From 886859159e4a7854cc24cc47de7a03085641acd5 Mon Sep 17 00:00:00 2001 From: David Neto Date: Thu, 8 Feb 2018 12:05:40 -0500 Subject: [PATCH] Fix generation of Vim syntax file --- source/CMakeLists.txt | 2 +- utils/generate_vim_syntax.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index b01edf5b1..7512dc78a 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -66,7 +66,7 @@ macro(spvtools_vimsyntax VERSION CLVERSION) add_custom_command(OUTPUT ${VIMSYNTAX_FILE} COMMAND ${PYTHON_EXECUTABLE} ${VIMSYNTAX_PROCESSING_SCRIPT} --spirv-core-grammar=${GRAMMAR_JSON_FILE} - --exinst-debuginfo-grammar=${DEBUGINFO_GRAMMAR_JSON_FILE} + --extinst-debuginfo-grammar=${DEBUGINFO_GRAMMAR_JSON_FILE} --extinst-glsl-grammar=${GLSL_GRAMMAR_JSON_FILE} --extinst-opencl-grammar=${OPENCL_GRAMMAR_JSON_FILE} >${VIMSYNTAX_FILE} diff --git a/utils/generate_vim_syntax.py b/utils/generate_vim_syntax.py index 837afa62a..03c0b478b 100755 --- a/utils/generate_vim_syntax.py +++ b/utils/generate_vim_syntax.py @@ -150,6 +150,10 @@ def main(): type=str, required=False, default=None, help='input JSON grammar file for OpenGL extended ' 'instruction set') + parser.add_argument('--extinst-debuginfo-grammar', metavar='', + type=str, required=False, default=None, + help='input JSON grammar file for DebugInfo extended ' + 'instruction set') args = parser.parse_args() # Generate the syntax rules. @@ -179,6 +183,17 @@ def main(): for inst in opencl["instructions"]: EmitAsEnumerant(inst['opname']) + if args.extinst_debuginfo_grammar is not None: + print('\n" DebugInfo extended instructions') + debuginfo = json.loads(open(args.extinst_debuginfo_grammar).read()) + for inst in debuginfo["instructions"]: + EmitAsEnumerant(inst['opname']) + print('\n" DebugInfo operand enums') + for operand_kind in debuginfo["operand_kinds"]: + if 'enumerants' in operand_kind: + for e in operand_kind['enumerants']: + EmitAsEnumerant(e['enumerant']) + print('\n" OpSpecConstantOp opcodes') for word in SPEC_CONSTANT_OP_OPCODES.split(' '): stripped = word.strip('\n,')