Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lua] Add more builtins #4144

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Lua/Lua.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ variables:
metamethod: |- # http://lua-users.org/wiki/MetatableEvents
(?x:__(?:
# special
index|newindex|call|tostring|len|i?pairs|gc
index|newindex|call|tostring|len|i?pairs|gc|close
# math operators
|unm|add|sub|mul|i?div|mod|pow|concat
# bitwise operators
Expand All @@ -36,7 +36,7 @@ variables:
|eq|lt|le
){{identifier_break}})
# __metatable and __mode don't use functions
metaproperty: (?:__(?:metatable|mode){{identifier_break}})
metaproperty: (?:__(?:metatable|mode|name){{identifier_break}})

identifier_start: '[A-Za-z_]'
identifier_char: '[A-Za-z0-9_]'
Expand Down Expand Up @@ -557,7 +557,7 @@ contexts:

support:
- match: |-
(?x:_G|_VERSION){{identifier_break}}
(?x:_G|_VERSION|_ENV){{identifier_break}}
scope: support.constant.builtin.lua
pop: 1

Expand All @@ -566,7 +566,7 @@ contexts:
assert|collectgarbage|dofile|error|getmetatable|ipairs|load|loadfile
|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|select
|setmetatable|tonumber|tostring|type|xpcall
|require|getfenv|module|setfenv|unpack
|require|getfenv|module|setfenv|unpack|warn
){{function_call_ahead}}
scope: meta.function-call.lua support.function.builtin.lua
pop: 1
Expand Down
6 changes: 6 additions & 0 deletions Lua/tests/syntax_test_lua_support.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
_G;
-- ^^ support.constant.builtin

_ENV;
-- ^^^^ support.constant.builtin

_VERSION;
-- ^^^^^^^^ support.constant.builtin

Expand All @@ -18,6 +21,9 @@
error();
-- ^^^^^ support.function.builtin

warn();
-- ^^^^ support.function.builtin

getfenv();
-- ^^^^^^^ support.function.builtin

Expand Down