Fix generation of Vim syntax file
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index b01edf5..7512dc7 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt
@@ -66,7 +66,7 @@ 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 837afa6..03c0b47 100755 --- a/utils/generate_vim_syntax.py +++ b/utils/generate_vim_syntax.py
@@ -150,6 +150,10 @@ type=str, required=False, default=None, help='input JSON grammar file for OpenGL extended ' 'instruction set') + parser.add_argument('--extinst-debuginfo-grammar', metavar='<path>', + 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 @@ 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,')