From bee1c113ca4077f874ed5a6cf1e5caf49a62aa75 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Fri, 28 May 2021 16:15:49 +0100 Subject: [PATCH] Update LLVM lexer to use keywords of LLVM 12.0. The keywords are based on the extraction of keywords the LLVM 12.0 lexer source code. They were taken from the `KEYWORD` and `INSTKEYWORD` macros for the 'Keyword' tokens, and 'Type' tokens were from the `TYPEKEYWORD` macro. The keywords were then sorted against the current set. Due to formatting issues in the arrays, the actual diff is provided for clarity: ``` diff +aarch64_sve_vector_pcs +aarch64_vector_pcs +alwaysInline +amdgpu_gfx +blockcount +byref +callbr +canAutoHide +cfguard_checkcc +dso_local_equivalent +fneg +mustprogress +nocallback +nofree +noInline +nomerge +noprofile +nosync +noundef +null_pointer_is_valid +param +params +partition +preallocated +sanitize_memtag +speculative_load_hardening +tailcc +typeidCompatibleVTable +varFlags +vcall_visibility +virtFunc +vscale +vTableFuncs ``` --- pygments/lexers/asm.py | 141 ++++++++++++++++++++++++----------------- 1 file changed, 84 insertions(+), 57 deletions(-) diff --git a/pygments/lexers/asm.py b/pygments/lexers/asm.py index d7e3e4baf6..ce545c49f8 100644 --- a/pygments/lexers/asm.py +++ b/pygments/lexers/asm.py @@ -384,68 +384,95 @@ class LlvmLexer(RegexLexer): 'keyword': [ # Regular keywords (words(( - 'acq_rel', 'acquire', 'add', 'addrspace', 'addrspacecast', 'afn', 'alias', - 'aliasee', 'align', 'alignLog2', 'alignstack', 'alloca', 'allocsize', 'allOnes', - 'alwaysinline', 'amdgpu_cs', 'amdgpu_es', 'amdgpu_gs', 'amdgpu_hs', - 'amdgpu_kernel', 'amdgpu_ls', 'amdgpu_ps', 'amdgpu_vs', 'and', 'any', - 'anyregcc', 'appending', 'arcp', 'argmemonly', 'args', 'arm_aapcs_vfpcc', - 'arm_aapcscc', 'arm_apcscc', 'ashr', 'asm', 'atomic', 'atomicrmw', 'attributes', - 'available_externally', 'avr_intrcc', 'avr_signalcc', 'bit', 'bitcast', - 'bitMask', 'blockaddress', 'br', 'branchFunnel', 'builtin', 'byArg', 'byte', - 'byteArray', 'byval', 'c', 'call', 'callee', 'caller', 'calls', 'catch', - 'catchpad', 'catchret', 'catchswitch', 'cc', 'ccc', 'cleanup', 'cleanuppad', - 'cleanupret', 'cmpxchg', 'cold', 'coldcc', 'comdat', 'common', 'constant', - 'contract', 'convergent', 'critical', 'cxx_fast_tlscc', 'datalayout', 'declare', - 'default', 'define', 'deplibs', 'dereferenceable', 'dereferenceable_or_null', - 'distinct', 'dllexport', 'dllimport', 'dso_local', 'dso_preemptable', - 'dsoLocal', 'eq', 'exact', 'exactmatch', 'extern_weak', 'external', - 'externally_initialized', 'extractelement', 'extractvalue', 'fadd', 'false', - 'fast', 'fastcc', 'fcmp', 'fdiv', 'fence', 'filter', 'flags', 'fmul', - 'fpext', 'fptosi', 'fptoui', 'fptrunc', 'freeze', 'frem', 'from', 'fsub', - 'funcFlags', 'function', 'gc', 'getelementptr', 'ghccc', 'global', 'guid', 'gv', - 'hash', 'hhvm_ccc', 'hhvmcc', 'hidden', 'hot', 'hotness', 'icmp', - 'ifunc', 'inaccessiblemem_or_argmemonly', 'inaccessiblememonly', 'inalloca', - 'inbounds', 'indir', 'indirectbr', 'info', 'initialexec', 'inline', - 'inlineBits', 'inlinehint', 'inrange', 'inreg', 'insertelement', 'insertvalue', - 'insts', 'intel_ocl_bicc', 'inteldialect', 'internal', 'inttoptr', 'invoke', - 'jumptable', 'kind', 'landingpad', 'largest', 'linkage', 'linkonce', - 'linkonce_odr', 'live', 'load', 'local_unnamed_addr', 'localdynamic', - 'localexec', 'lshr', 'max', 'metadata', 'min', 'minsize', 'module', 'monotonic', - 'msp430_intrcc', 'mul', 'musttail', 'naked', 'name', 'nand', 'ne', 'nest', - 'ninf', 'nnan', 'noalias', 'nobuiltin', 'nocapture', 'nocf_check', - 'noduplicate', 'noduplicates', 'noimplicitfloat', 'noinline', 'none', - 'nonlazybind', 'nonnull', 'norecurse', 'noRecurse', 'noredzone', 'noreturn', - 'notail', 'notEligibleToImport', 'nounwind', 'nsw', 'nsz', 'null', 'nuw', 'oeq', - 'offset', 'oge', 'ogt', 'ole', 'olt', 'one', 'opaque', 'optforfuzzing', - 'optnone', 'optsize', 'or', 'ord', 'path', 'personality', 'phi', 'poison', - 'prefix', 'preserve_allcc', 'preserve_mostcc', 'private', 'prologue', - 'protected', 'ptrtoint', 'ptx_device', 'ptx_kernel', 'readnone', 'readNone', - 'readonly', 'readOnly', 'reassoc', 'refs', 'relbf', 'release', 'resByArg', - 'resume', 'ret', 'returnDoesNotAlias', 'returned', 'returns_twice', 'safestack', - 'samesize', 'sanitize_address', 'sanitize_hwaddress', 'sanitize_memory', - 'sanitize_thread', 'sdiv', 'section', 'select', 'seq_cst', 'sext', 'sge', 'sgt', - 'shadowcallstack', 'shl', 'shufflevector', 'sideeffect', 'signext', 'single', - 'singleImpl', 'singleImplName', 'sitofp', 'sizeM1', 'sizeM1BitWidth', 'sle', - 'slt', 'source_filename', 'speculatable', 'spir_func', 'spir_kernel', 'srem', - 'sret', 'ssp', 'sspreq', 'sspstrong', 'store', 'strictfp', 'sub', 'summaries', - 'summary', 'swiftcc', 'swifterror', 'swiftself', 'switch', 'syncscope', 'tail', - 'target', 'thread_local', 'to', 'token', 'triple', 'true', 'trunc', 'type', - 'typeCheckedLoadConstVCalls', 'typeCheckedLoadVCalls', 'typeid', 'typeIdInfo', - 'typeTestAssumeConstVCalls', 'typeTestAssumeVCalls', 'typeTestRes', 'typeTests', - 'udiv', 'ueq', 'uge', 'ugt', 'uitofp', 'ule', 'ult', 'umax', 'umin', 'undef', - 'une', 'uniformRetVal', 'uniqueRetVal', 'unknown', 'unnamed_addr', 'uno', - 'unordered', 'unreachable', 'unsat', 'unwind', 'urem', 'uselistorder', - 'uselistorder_bb', 'uwtable', 'va_arg', 'variable', 'vFuncId', - 'virtualConstProp', 'void', 'volatile', 'weak', 'weak_odr', 'webkit_jscc', + 'aarch64_sve_vector_pcs', 'aarch64_vector_pcs', 'acq_rel', + 'acquire', 'add', 'addrspace', 'addrspacecast', 'afn', 'alias', + 'aliasee', 'align', 'alignLog2', 'alignstack', 'alloca', + 'allocsize', 'allOnes', 'alwaysinline', 'alwaysInline', + 'amdgpu_cs', 'amdgpu_es', 'amdgpu_gfx', 'amdgpu_gs', + 'amdgpu_hs', 'amdgpu_kernel', 'amdgpu_ls', 'amdgpu_ps', + 'amdgpu_vs', 'and', 'any', 'anyregcc', 'appending', 'arcp', + 'argmemonly', 'args', 'arm_aapcs_vfpcc', 'arm_aapcscc', + 'arm_apcscc', 'ashr', 'asm', 'atomic', 'atomicrmw', + 'attributes', 'available_externally', 'avr_intrcc', + 'avr_signalcc', 'bit', 'bitcast', 'bitMask', 'blockaddress', + 'blockcount', 'br', 'branchFunnel', 'builtin', 'byArg', + 'byref', 'byte', 'byteArray', 'byval', 'c', 'call', 'callbr', + 'callee', 'caller', 'calls', 'canAutoHide', 'catch', + 'catchpad', 'catchret', 'catchswitch', 'cc', 'ccc', + 'cfguard_checkcc', 'cleanup', 'cleanuppad', 'cleanupret', + 'cmpxchg', 'cold', 'coldcc', 'comdat', 'common', 'constant', + 'contract', 'convergent', 'critical', 'cxx_fast_tlscc', + 'datalayout', 'declare', 'default', 'define', 'deplibs', + 'dereferenceable', 'dereferenceable_or_null', 'distinct', + 'dllexport', 'dllimport', 'dso_local', 'dso_local_equivalent', + 'dso_preemptable', 'dsoLocal', 'eq', 'exact', 'exactmatch', + 'extern_weak', 'external', 'externally_initialized', + 'extractelement', 'extractvalue', 'fadd', 'false', 'fast', + 'fastcc', 'fcmp', 'fdiv', 'fence', 'filter', 'flags', 'fmul', + 'fneg', 'fpext', 'fptosi', 'fptoui', 'fptrunc', 'freeze', + 'frem', 'from', 'fsub', 'funcFlags', 'function', 'gc', + 'getelementptr', 'ghccc', 'global', 'guid', 'gv', 'hash', + 'hhvm_ccc', 'hhvmcc', 'hidden', 'hot', 'hotness', 'icmp', + 'ifunc', 'inaccessiblemem_or_argmemonly', + 'inaccessiblememonly', 'inalloca', 'inbounds', 'indir', + 'indirectbr', 'info', 'initialexec', 'inline', 'inlineBits', + 'inlinehint', 'inrange', 'inreg', 'insertelement', + 'insertvalue', 'insts', 'intel_ocl_bicc', 'inteldialect', + 'internal', 'inttoptr', 'invoke', 'jumptable', 'kind', + 'landingpad', 'largest', 'linkage', 'linkonce', 'linkonce_odr', + 'live', 'load', 'local_unnamed_addr', 'localdynamic', + 'localexec', 'lshr', 'max', 'metadata', 'min', 'minsize', + 'module', 'monotonic', 'msp430_intrcc', 'mul', 'mustprogress', + 'musttail', 'naked', 'name', 'nand', 'ne', 'nest', 'ninf', + 'nnan', 'noalias', 'nobuiltin', 'nocallback', 'nocapture', + 'nocf_check', 'noduplicate', 'noduplicates', 'nofree', + 'noimplicitfloat', 'noinline', 'noInline', 'nomerge', 'none', + 'nonlazybind', 'nonnull', 'noprofile', 'norecurse', + 'noRecurse', 'noredzone', 'noreturn', 'nosync', 'notail', + 'notEligibleToImport', 'noundef', 'nounwind', 'nsw', + 'nsz', 'null', 'null_pointer_is_valid', 'nuw', 'oeq', 'offset', + 'oge', 'ogt', 'ole', 'olt', 'one', 'opaque', 'optforfuzzing', + 'optnone', 'optsize', 'or', 'ord', 'param', 'params', + 'partition', 'path', 'personality', 'phi', 'poison', + 'preallocated', 'prefix', 'preserve_allcc', 'preserve_mostcc', + 'private', 'prologue', 'protected', 'ptrtoint', 'ptx_device', + 'ptx_kernel', 'readnone', 'readNone', 'readonly', 'readOnly', + 'reassoc', 'refs', 'relbf', 'release', 'resByArg', 'resume', + 'ret', 'returnDoesNotAlias', 'returned', 'returns_twice', + 'safestack', 'samesize', 'sanitize_address', + 'sanitize_hwaddress', 'sanitize_memory', 'sanitize_memtag', + 'sanitize_thread', 'sdiv', 'section', 'select', 'seq_cst', + 'sext', 'sge', 'sgt', 'shadowcallstack', 'shl', + 'shufflevector', 'sideeffect', 'signext', 'single', + 'singleImpl', 'singleImplName', 'sitofp', 'sizeM1', + 'sizeM1BitWidth', 'sle', 'slt', 'source_filename', + 'speculatable', 'speculative_load_hardening', 'spir_func', + 'spir_kernel', 'srem', 'sret', 'ssp', 'sspreq', 'sspstrong', + 'store', 'strictfp', 'sub', 'summaries', 'summary', 'swiftcc', + 'swifterror', 'swiftself', 'switch', 'syncscope', 'tail', + 'tailcc', 'target', 'thread_local', 'to', 'token', 'triple', + 'true', 'trunc', 'type', 'typeCheckedLoadConstVCalls', + 'typeCheckedLoadVCalls', 'typeid', 'typeidCompatibleVTable', + 'typeIdInfo', 'typeTestAssumeConstVCalls', + 'typeTestAssumeVCalls', 'typeTestRes', 'typeTests', 'udiv', + 'ueq', 'uge', 'ugt', 'uitofp', 'ule', 'ult', 'umax', 'umin', + 'undef', 'une', 'uniformRetVal', 'uniqueRetVal', 'unknown', + 'unnamed_addr', 'uno', 'unordered', 'unreachable', 'unsat', + 'unwind', 'urem', 'uselistorder', 'uselistorder_bb', 'uwtable', + 'va_arg', 'varFlags', 'variable', 'vcall_visibility', + 'vFuncId', 'virtFunc', 'virtualConstProp', 'void', 'volatile', + 'vscale', 'vTableFuncs', 'weak', 'weak_odr', 'webkit_jscc', 'win64cc', 'within', 'wpdRes', 'wpdResolutions', 'writeonly', - 'x86_64_sysvcc', 'x86_fastcallcc', 'x86_intrcc', 'x86_mmx', - 'x86_regcallcc', 'x86_stdcallcc', 'x86_thiscallcc', 'x86_vectorcallcc', 'xchg', - 'xor', 'zeroext', 'zeroinitializer', 'zext', 'immarg', 'willreturn'), + 'x', 'x86_64_sysvcc', 'x86_fastcallcc', 'x86_intrcc', + 'x86_mmx', 'x86_regcallcc', 'x86_stdcallcc', 'x86_thiscallcc', + 'x86_vectorcallcc', 'xchg', 'xor', 'zeroext', + 'zeroinitializer', 'zext', 'immarg', 'willreturn'), suffix=r'\b'), Keyword), # Types (words(('void', 'half', 'bfloat', 'float', 'double', 'fp128', - 'x86_fp80', 'ppc_fp128', 'label', 'metadata', 'token')), + 'x86_fp80', 'ppc_fp128', 'label', 'metadata', 'x86_mmx', + 'x86_amx', 'token')), Keyword.Type), # Integer types