Skip to content

Commit d208e25

Browse files
author
jneen
committed
generate/update keywords files to use constants
1 parent 50664b1 commit d208e25

11 files changed

Lines changed: 182 additions & 202 deletions

File tree

lib/rouge/lexers/apache/keywords.rb

Lines changed: 3 additions & 9 deletions
Large diffs are not rendered by default.

lib/rouge/lexers/gherkin/keywords.rb

Lines changed: 6 additions & 6 deletions
Large diffs are not rendered by default.

lib/rouge/lexers/isbl/builtins.rb

Lines changed: 8 additions & 7 deletions
Large diffs are not rendered by default.

lib/rouge/lexers/lasso/keywords.rb

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

lib/rouge/lexers/llvm/keywords.rb

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,9 @@
88
module Rouge
99
module Lexers
1010
class LLVM
11-
def self.keywords
12-
@keywords ||= Set.new ["aarch64_sve_vector_pcs", "aarch64_vector_pcs", "acq_rel", "acquire", "addrspace", "afn", "alias", "aliasee", "align", "alignLog2", "alignstack", "allOnes", "allocalign", "allocptr", "allocsize", "alwaysInline", "alwaysinline", "amdgpu_cs", "amdgpu_es", "amdgpu_gfx", "amdgpu_gs", "amdgpu_hs", "amdgpu_kernel", "amdgpu_ls", "amdgpu_ps", "amdgpu_vs", "any", "anyregcc", "appending", "arcp", "argmemonly", "args", "arm_aapcs_vfpcc", "arm_aapcscc", "arm_apcscc", "asm", "async", "atomic", "attributes", "available_externally", "avr_intrcc", "avr_signalcc", "bit", "bitMask", "blockaddress", "blockcount", "branchFunnel", "builtin", "byArg", "byref", "byte", "byteArray", "byval", "c", "callee", "caller", "calls", "canAutoHide", "catch", "cc", "ccc", "cfguard_checkcc", "cleanup", "cold", "coldcc", "comdat", "common", "constant", "contract", "convergent", "critical", "cxx_fast_tlscc", "datalayout", "declare", "default", "define", "dereferenceable", "dereferenceable_or_null", "disable_sanitizer_instrumentation", "distinct", "dllexport", "dllimport", "dsoLocal", "dso_local", "dso_local_equivalent", "dso_preemptable", "elementtype", "eq", "exact", "exactmatch", "extern_weak", "external", "externally_initialized", "false", "fast", "fastcc", "filter", "flags", "from", "funcFlags", "function", "gc", "ghccc", "global", "guid", "gv", "hasUnknownCall", "hash", "hhvm_ccc", "hhvmcc", "hidden", "hot", "hotness", "ifunc", "immarg", "inaccessiblemem_or_argmemonly", "inaccessiblememonly", "inalloca", "inbounds", "indir", "info", "initialexec", "inline", "inlineBits", "inlinehint", "inrange", "inreg", "insts", "intel_ocl_bicc", "inteldialect", "internal", "jumptable", "kind", "largest", "linkage", "linkonce", "linkonce_odr", "live", "local_unnamed_addr", "localdynamic", "localexec", "max", "mayThrow", "min", "minsize", "module", "monotonic", "msp430_intrcc", "mustBeUnreachable", "mustprogress", "musttail", "naked", "name", "nand", "ne", "nest", "ninf", "nnan", "noInline", "noRecurse", "noUnwind", "no_cfi", "noalias", "nobuiltin", "nocallback", "nocapture", "nocf_check", "nodeduplicate", "noduplicate", "nofree", "noimplicitfloat", "noinline", "nomerge", "none", "nonlazybind", "nonnull", "noprofile", "norecurse", "noredzone", "noreturn", "nosanitize_bounds", "nosanitize_coverage", "nosync", "notEligibleToImport", "notail", "noundef", "nounwind", "nsw", "nsz", "null", "null_pointer_is_valid", "nuw", "oeq", "offset", "oge", "ogt", "ole", "olt", "one", "opaque", "optforfuzzing", "optnone", "optsize", "ord", "param", "params", "partition", "path", "personality", "poison", "preallocated", "prefix", "preserve_allcc", "preserve_mostcc", "private", "prologue", "protected", "ptx_device", "ptx_kernel", "readNone", "readOnly", "readnone", "readonly", "reassoc", "refs", "relbf", "release", "resByArg", "returnDoesNotAlias", "returned", "returns_twice", "safestack", "samesize", "sanitize_address", "sanitize_hwaddress", "sanitize_memory", "sanitize_memtag", "sanitize_thread", "section", "seq_cst", "sge", "sgt", "shadowcallstack", "sideeffect", "signext", "single", "singleImpl", "singleImplName", "sizeM1", "sizeM1BitWidth", "sle", "slt", "source_filename", "speculatable", "speculative_load_hardening", "spir_func", "spir_kernel", "sret", "ssp", "sspreq", "sspstrong", "strictfp", "summaries", "summary", "swiftasync", "swiftcc", "swifterror", "swiftself", "swifttailcc", "sync", "syncscope", "tail", "tailcc", "target", "thread_local", "to", "triple", "true", "type", "typeCheckedLoadConstVCalls", "typeCheckedLoadVCalls", "typeIdInfo", "typeTestAssumeConstVCalls", "typeTestAssumeVCalls", "typeTestRes", "typeTests", "typeid", "typeidCompatibleVTable", "ueq", "uge", "ugt", "ule", "ult", "umax", "umin", "undef", "une", "uniformRetVal", "uniqueRetVal", "unknown", "unnamed_addr", "uno", "unordered", "unsat", "unwind", "uselistorder", "uselistorder_bb", "uwtable", "vFuncId", "vTableFuncs", "varFlags", "variable", "vcall_visibility", "virtFunc", "virtualConstProp", "visibility", "volatile", "vscale", "vscale_range", "weak", "weak_odr", "webkit_jscc", "willreturn", "win64cc", "within", "wpdRes", "wpdResolutions", "writeonly", "x", "x86_64_sysvcc", "x86_fastcallcc", "x86_intrcc", "x86_regcallcc", "x86_stdcallcc", "x86_thiscallcc", "x86_vectorcallcc", "xchg", "zeroext", "zeroinitializer"]
13-
end
14-
15-
def self.types
16-
@types ||= Set.new ["bfloat", "double", "float", "fp128", "half", "label", "metadata", "ppc_fp128", "ptr", "token", "void", "x86_amx", "x86_fp80", "x86_mmx"]
17-
end
18-
19-
def self.instructions
20-
@instructions ||= Set.new ["add", "addrspacecast", "alloca", "and", "ashr", "atomicrmw", "bitcast", "br", "call", "callbr", "catchpad", "catchret", "catchswitch", "cleanuppad", "cleanupret", "cmpxchg", "extractelement", "extractvalue", "fadd", "fcmp", "fdiv", "fence", "fmul", "fneg", "fpext", "fptosi", "fptoui", "fptrunc", "freeze", "frem", "fsub", "getelementptr", "icmp", "indirectbr", "insertelement", "insertvalue", "inttoptr", "invoke", "landingpad", "load", "lshr", "mul", "or", "phi", "ptrtoint", "resume", "ret", "sdiv", "select", "sext", "shl", "shufflevector", "sitofp", "srem", "store", "sub", "switch", "trunc", "udiv", "uitofp", "unreachable", "urem", "va_arg", "xor", "zext"]
21-
end
22-
11+
KEYWORDS = Set.new ["aarch64_sve_vector_pcs", "aarch64_vector_pcs", "acq_rel", "acquire", "addrspace", "afn", "alias", "aliasee", "align", "alignLog2", "alignstack", "allOnes", "allocalign", "allocptr", "allocsize", "alwaysInline", "alwaysinline", "amdgpu_cs", "amdgpu_es", "amdgpu_gfx", "amdgpu_gs", "amdgpu_hs", "amdgpu_kernel", "amdgpu_ls", "amdgpu_ps", "amdgpu_vs", "any", "anyregcc", "appending", "arcp", "argmemonly", "args", "arm_aapcs_vfpcc", "arm_aapcscc", "arm_apcscc", "asm", "async", "atomic", "attributes", "available_externally", "avr_intrcc", "avr_signalcc", "bit", "bitMask", "blockaddress", "blockcount", "branchFunnel", "builtin", "byArg", "byref", "byte", "byteArray", "byval", "c", "callee", "caller", "calls", "canAutoHide", "catch", "cc", "ccc", "cfguard_checkcc", "cleanup", "cold", "coldcc", "comdat", "common", "constant", "contract", "convergent", "critical", "cxx_fast_tlscc", "datalayout", "declare", "default", "define", "dereferenceable", "dereferenceable_or_null", "disable_sanitizer_instrumentation", "distinct", "dllexport", "dllimport", "dsoLocal", "dso_local", "dso_local_equivalent", "dso_preemptable", "elementtype", "eq", "exact", "exactmatch", "extern_weak", "external", "externally_initialized", "false", "fast", "fastcc", "filter", "flags", "from", "funcFlags", "function", "gc", "ghccc", "global", "guid", "gv", "hasUnknownCall", "hash", "hhvm_ccc", "hhvmcc", "hidden", "hot", "hotness", "ifunc", "immarg", "inaccessiblemem_or_argmemonly", "inaccessiblememonly", "inalloca", "inbounds", "indir", "info", "initialexec", "inline", "inlineBits", "inlinehint", "inrange", "inreg", "insts", "intel_ocl_bicc", "inteldialect", "internal", "jumptable", "kind", "largest", "linkage", "linkonce", "linkonce_odr", "live", "local_unnamed_addr", "localdynamic", "localexec", "max", "mayThrow", "min", "minsize", "module", "monotonic", "msp430_intrcc", "mustBeUnreachable", "mustprogress", "musttail", "naked", "name", "nand", "ne", "nest", "ninf", "nnan", "noInline", "noRecurse", "noUnwind", "no_cfi", "noalias", "nobuiltin", "nocallback", "nocapture", "nocf_check", "nodeduplicate", "noduplicate", "nofree", "noimplicitfloat", "noinline", "nomerge", "none", "nonlazybind", "nonnull", "noprofile", "norecurse", "noredzone", "noreturn", "nosanitize_bounds", "nosanitize_coverage", "nosync", "notEligibleToImport", "notail", "noundef", "nounwind", "nsw", "nsz", "null", "null_pointer_is_valid", "nuw", "oeq", "offset", "oge", "ogt", "ole", "olt", "one", "opaque", "optforfuzzing", "optnone", "optsize", "ord", "param", "params", "partition", "path", "personality", "poison", "preallocated", "prefix", "preserve_allcc", "preserve_mostcc", "private", "prologue", "protected", "ptx_device", "ptx_kernel", "readNone", "readOnly", "readnone", "readonly", "reassoc", "refs", "relbf", "release", "resByArg", "returnDoesNotAlias", "returned", "returns_twice", "safestack", "samesize", "sanitize_address", "sanitize_hwaddress", "sanitize_memory", "sanitize_memtag", "sanitize_thread", "section", "seq_cst", "sge", "sgt", "shadowcallstack", "sideeffect", "signext", "single", "singleImpl", "singleImplName", "sizeM1", "sizeM1BitWidth", "sle", "slt", "source_filename", "speculatable", "speculative_load_hardening", "spir_func", "spir_kernel", "sret", "ssp", "sspreq", "sspstrong", "strictfp", "summaries", "summary", "swiftasync", "swiftcc", "swifterror", "swiftself", "swifttailcc", "sync", "syncscope", "tail", "tailcc", "target", "thread_local", "to", "triple", "true", "type", "typeCheckedLoadConstVCalls", "typeCheckedLoadVCalls", "typeIdInfo", "typeTestAssumeConstVCalls", "typeTestAssumeVCalls", "typeTestRes", "typeTests", "typeid", "typeidCompatibleVTable", "ueq", "uge", "ugt", "ule", "ult", "umax", "umin", "undef", "une", "uniformRetVal", "uniqueRetVal", "unknown", "unnamed_addr", "uno", "unordered", "unsat", "unwind", "uselistorder", "uselistorder_bb", "uwtable", "vFuncId", "vTableFuncs", "varFlags", "variable", "vcall_visibility", "virtFunc", "virtualConstProp", "visibility", "volatile", "vscale", "vscale_range", "weak", "weak_odr", "webkit_jscc", "willreturn", "win64cc", "within", "wpdRes", "wpdResolutions", "writeonly", "x", "x86_64_sysvcc", "x86_fastcallcc", "x86_intrcc", "x86_regcallcc", "x86_stdcallcc", "x86_thiscallcc", "x86_vectorcallcc", "xchg", "zeroext", "zeroinitializer"]
12+
TYPES = Set.new ["bfloat", "double", "float", "fp128", "half", "label", "metadata", "ppc_fp128", "ptr", "token", "void", "x86_amx", "x86_fp80", "x86_mmx"]
13+
INSTRUCTIONS = Set.new ["add", "addrspacecast", "alloca", "and", "ashr", "atomicrmw", "bitcast", "br", "call", "callbr", "catchpad", "catchret", "catchswitch", "cleanuppad", "cleanupret", "cmpxchg", "extractelement", "extractvalue", "fadd", "fcmp", "fdiv", "fence", "fmul", "fneg", "fpext", "fptosi", "fptoui", "fptrunc", "freeze", "frem", "fsub", "getelementptr", "icmp", "indirectbr", "insertelement", "insertvalue", "inttoptr", "invoke", "landingpad", "load", "lshr", "mul", "or", "phi", "ptrtoint", "resume", "ret", "sdiv", "select", "sext", "shl", "shufflevector", "sitofp", "srem", "store", "sub", "switch", "trunc", "udiv", "uitofp", "unreachable", "urem", "va_arg", "xor", "zext"]
2314
end
2415
end
2516
end

lib/rouge/lexers/lua/keywords.rb

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,17 @@
99
module Rouge
1010
module Lexers
1111
class Lua
12-
def self.builtins
13-
@builtins ||= {}.tap do |b|
14-
b["basic"] = Set.new ["_g", "_version", "assert", "collectgarbage", "dofile", "error", "getmetatable", "ipairs", "load", "loadfile", "next", "pairs", "pcall", "print", "rawequal", "rawget", "rawlen", "rawset", "select", "setmetatable", "tonumber", "tostring", "type", "xpcall", "file:close", "file:flush", "file:lines", "file:read", "file:seek", "file:setvbuf", "file:write", "lua_cpath", "lua_cpath_5_3", "lua_init", "lua_init_5_3", "lua_path", "lua_path_5_3", "luaopen_base", "luaopen_coroutine", "luaopen_debug", "luaopen_io", "luaopen_math", "luaopen_os", "luaopen_package", "luaopen_string", "luaopen_table", "luaopen_utf8", "lua_errerr", "lua_errfile", "lua_errgcmm", "lua_errmem", "lua_errrun", "lua_errsyntax", "lua_hookcall", "lua_hookcount", "lua_hookline", "lua_hookret", "lua_hooktailcall", "lua_maskcall", "lua_maskcount", "lua_maskline", "lua_maskret", "lua_maxinteger", "lua_mininteger", "lua_minstack", "lua_multret", "lua_noref", "lua_ok", "lua_opadd", "lua_opband", "lua_opbnot", "lua_opbor", "lua_opbxor", "lua_opdiv", "lua_opeq", "lua_opidiv", "lua_ople", "lua_oplt", "lua_opmod", "lua_opmul", "lua_oppow", "lua_opshl", "lua_opshr", "lua_opsub", "lua_opunm", "lua_refnil", "lua_registryindex", "lua_ridx_globals", "lua_ridx_mainthread", "lua_tboolean", "lua_tfunction", "lua_tlightuserdata", "lua_tnil", "lua_tnone", "lua_tnumber", "lua_tstring", "lua_ttable", "lua_tthread", "lua_tuserdata", "lua_use_apicheck", "lua_yield", "lual_buffersize"]
15-
b["modules"] = Set.new ["require", "package.config", "package.cpath", "package.loaded", "package.loadlib", "package.path", "package.preload", "package.searchers", "package.searchpath"]
16-
b["coroutine"] = Set.new ["coroutine.create", "coroutine.isyieldable", "coroutine.resume", "coroutine.running", "coroutine.status", "coroutine.wrap", "coroutine.yield"]
17-
b["debug"] = Set.new ["debug.debug", "debug.gethook", "debug.getinfo", "debug.getlocal", "debug.getmetatable", "debug.getregistry", "debug.getupvalue", "debug.getuservalue", "debug.sethook", "debug.setlocal", "debug.setmetatable", "debug.setupvalue", "debug.setuservalue", "debug.traceback", "debug.upvalueid", "debug.upvaluejoin"]
18-
b["io"] = Set.new ["io.close", "io.flush", "io.input", "io.lines", "io.open", "io.output", "io.popen", "io.read", "io.stderr", "io.stdin", "io.stdout", "io.tmpfile", "io.type", "io.write"]
19-
b["math"] = Set.new ["math.abs", "math.acos", "math.asin", "math.atan", "math.ceil", "math.cos", "math.deg", "math.exp", "math.floor", "math.fmod", "math.huge", "math.log", "math.max", "math.maxinteger", "math.min", "math.mininteger", "math.modf", "math.pi", "math.rad", "math.random", "math.randomseed", "math.sin", "math.sqrt", "math.tan", "math.tointeger", "math.type", "math.ult"]
20-
b["os"] = Set.new ["os.clock", "os.date", "os.difftime", "os.execute", "os.exit", "os.getenv", "os.remove", "os.rename", "os.setlocale", "os.time", "os.tmpname"]
21-
b["string"] = Set.new ["string.byte", "string.char", "string.dump", "string.find", "string.format", "string.gmatch", "string.gsub", "string.len", "string.lower", "string.match", "string.pack", "string.packsize", "string.rep", "string.reverse", "string.sub", "string.unpack", "string.upper"]
22-
b["table"] = Set.new ["table.concat", "table.insert", "table.move", "table.pack", "table.remove", "table.sort", "table.unpack"]
23-
b["utf8"] = Set.new ["utf8.char", "utf8.charpattern", "utf8.codepoint", "utf8.codes", "utf8.len", "utf8.offset"]
24-
end
12+
BUILTINS = {}.tap do |b|
13+
b["basic"] = Set["_g", "_version", "assert", "collectgarbage", "dofile", "error", "getmetatable", "ipairs", "load", "loadfile", "next", "pairs", "pcall", "print", "rawequal", "rawget", "rawlen", "rawset", "select", "setmetatable", "tonumber", "tostring", "type", "xpcall", "file:close", "file:flush", "file:lines", "file:read", "file:seek", "file:setvbuf", "file:write", "lua_cpath", "lua_cpath_5_3", "lua_init", "lua_init_5_3", "lua_path", "lua_path_5_3", "luaopen_base", "luaopen_coroutine", "luaopen_debug", "luaopen_io", "luaopen_math", "luaopen_os", "luaopen_package", "luaopen_string", "luaopen_table", "luaopen_utf8", "lua_errerr", "lua_errfile", "lua_errgcmm", "lua_errmem", "lua_errrun", "lua_errsyntax", "lua_hookcall", "lua_hookcount", "lua_hookline", "lua_hookret", "lua_hooktailcall", "lua_maskcall", "lua_maskcount", "lua_maskline", "lua_maskret", "lua_maxinteger", "lua_mininteger", "lua_minstack", "lua_multret", "lua_noref", "lua_ok", "lua_opadd", "lua_opband", "lua_opbnot", "lua_opbor", "lua_opbxor", "lua_opdiv", "lua_opeq", "lua_opidiv", "lua_ople", "lua_oplt", "lua_opmod", "lua_opmul", "lua_oppow", "lua_opshl", "lua_opshr", "lua_opsub", "lua_opunm", "lua_refnil", "lua_registryindex", "lua_ridx_globals", "lua_ridx_mainthread", "lua_tboolean", "lua_tfunction", "lua_tlightuserdata", "lua_tnil", "lua_tnone", "lua_tnumber", "lua_tstring", "lua_ttable", "lua_tthread", "lua_tuserdata", "lua_use_apicheck", "lua_yield", "lual_buffersize"]
14+
b["modules"] = Set["require", "package.config", "package.cpath", "package.loaded", "package.loadlib", "package.path", "package.preload", "package.searchers", "package.searchpath"]
15+
b["coroutine"] = Set["coroutine.create", "coroutine.isyieldable", "coroutine.resume", "coroutine.running", "coroutine.status", "coroutine.wrap", "coroutine.yield"]
16+
b["debug"] = Set["debug.debug", "debug.gethook", "debug.getinfo", "debug.getlocal", "debug.getmetatable", "debug.getregistry", "debug.getupvalue", "debug.getuservalue", "debug.sethook", "debug.setlocal", "debug.setmetatable", "debug.setupvalue", "debug.setuservalue", "debug.traceback", "debug.upvalueid", "debug.upvaluejoin"]
17+
b["io"] = Set["io.close", "io.flush", "io.input", "io.lines", "io.open", "io.output", "io.popen", "io.read", "io.stderr", "io.stdin", "io.stdout", "io.tmpfile", "io.type", "io.write"]
18+
b["math"] = Set["math.abs", "math.acos", "math.asin", "math.atan", "math.ceil", "math.cos", "math.deg", "math.exp", "math.floor", "math.fmod", "math.huge", "math.log", "math.max", "math.maxinteger", "math.min", "math.mininteger", "math.modf", "math.pi", "math.rad", "math.random", "math.randomseed", "math.sin", "math.sqrt", "math.tan", "math.tointeger", "math.type", "math.ult"]
19+
b["os"] = Set["os.clock", "os.date", "os.difftime", "os.execute", "os.exit", "os.getenv", "os.remove", "os.rename", "os.setlocale", "os.time", "os.tmpname"]
20+
b["string"] = Set["string.byte", "string.char", "string.dump", "string.find", "string.format", "string.gmatch", "string.gsub", "string.len", "string.lower", "string.match", "string.pack", "string.packsize", "string.rep", "string.reverse", "string.sub", "string.unpack", "string.upper"]
21+
b["table"] = Set["table.concat", "table.insert", "table.move", "table.pack", "table.remove", "table.sort", "table.unpack"]
22+
b["utf8"] = Set["utf8.char", "utf8.charpattern", "utf8.codepoint", "utf8.codes", "utf8.len", "utf8.offset"]
2523
end
2624
end
2725
end

lib/rouge/lexers/mathematica/keywords.rb

Lines changed: 1 addition & 3 deletions
Large diffs are not rendered by default.

lib/rouge/lexers/matlab/keywords.rb

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)