Skip to content

Commit 3d57c38

Browse files
jneenjneen
andauthored
ensure all generated keyword sets are sorted / uniq (#2230)
Co-authored-by: jneen <[email protected]>
1 parent cdb8770 commit 3d57c38

File tree

17 files changed

+31
-40
lines changed

17 files changed

+31
-40
lines changed

lib/rouge/lexers/lasso/keywords.rb

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

lib/rouge/lexers/lua/keywords.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ module Rouge
1010
module Lexers
1111
class Lua
1212
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"]
13+
b["basic"] = Set["_g", "_version", "assert", "collectgarbage", "dofile", "error", "file:close", "file:flush", "file:lines", "file:read", "file:seek", "file:setvbuf", "file:write", "getmetatable", "ipairs", "load", "loadfile", "lua_cpath", "lua_cpath_5_3", "lua_errerr", "lua_errfile", "lua_errgcmm", "lua_errmem", "lua_errrun", "lua_errsyntax", "lua_hookcall", "lua_hookcount", "lua_hookline", "lua_hookret", "lua_hooktailcall", "lua_init", "lua_init_5_3", "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_path", "lua_path_5_3", "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", "luaopen_base", "luaopen_coroutine", "luaopen_debug", "luaopen_io", "luaopen_math", "luaopen_os", "luaopen_package", "luaopen_string", "luaopen_table", "luaopen_utf8", "next", "pairs", "pcall", "print", "rawequal", "rawget", "rawlen", "rawset", "select", "setmetatable", "tonumber", "tostring", "type", "xpcall"]
14+
b["modules"] = Set["package.config", "package.cpath", "package.loaded", "package.loadlib", "package.path", "package.preload", "package.searchers", "package.searchpath", "require"]
1515
b["coroutine"] = Set["coroutine.create", "coroutine.isyieldable", "coroutine.resume", "coroutine.running", "coroutine.status", "coroutine.wrap", "coroutine.yield"]
1616
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"]
1717
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"]

lib/rouge/lexers/mathematica/keywords.rb

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

lib/rouge/lexers/matlab.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def self.keywords
3737
end
3838

3939

40+
# TODO [jneen]: there are elements of BUILTINS with
41+
# a . in them - this won't match any of those.
4042
rule %r/[a-zA-Z][_a-zA-Z0-9]*/m do |m|
4143
match = m[0]
4244
if self.class.keywords.include? match

lib/rouge/lexers/matlab/builtins.rb

Lines changed: 0 additions & 11 deletions
This file was deleted.

lib/rouge/lexers/matlab/keywords.rb

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

lib/rouge/lexers/php/keywords.rb

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

lib/rouge/lexers/sqf/keywords.rb

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

lib/rouge/lexers/viml/keywords.rb

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

tasks/builtins/lasso.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class LassoGenerator < BuiltinsGenerator
3838
keywords[groups[m[0]]].concat values
3939
end
4040

41-
keywords
41+
keywords.transform_values { |v| v.sort.uniq }
4242
end
4343

4444
def generate

0 commit comments

Comments
 (0)