diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2022-08-30 23:23:09 -0600 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2022-08-30 23:23:09 -0600 |
commit | 968aa6e3ed0497ea99f123c74c5fd0f3880ccc63 (patch) | |
tree | 32ac91852b82d040012d40a3f54f772723509968 /runtime/lua/vim/inspect.lua | |
parent | 242f75745009b3a0a2108d98ce6c02b6e13aac3f (diff) | |
parent | f4274d0f62625683486d3912dcd6e8e45877c6a4 (diff) | |
download | rneovim-968aa6e3ed0497ea99f123c74c5fd0f3880ccc63.tar.gz rneovim-968aa6e3ed0497ea99f123c74c5fd0f3880ccc63.tar.bz2 rneovim-968aa6e3ed0497ea99f123c74c5fd0f3880ccc63.zip |
Merge remote-tracking branch 'upstream/master' into userreg
Diffstat (limited to 'runtime/lua/vim/inspect.lua')
-rw-r--r-- | runtime/lua/vim/inspect.lua | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/runtime/lua/vim/inspect.lua b/runtime/lua/vim/inspect.lua index 0a53fb203b..c232f69590 100644 --- a/runtime/lua/vim/inspect.lua +++ b/runtime/lua/vim/inspect.lua @@ -89,8 +89,38 @@ local function escape(str) ) end +-- List of lua keywords +local luaKeywords = { + ['and'] = true, + ['break'] = true, + ['do'] = true, + ['else'] = true, + ['elseif'] = true, + ['end'] = true, + ['false'] = true, + ['for'] = true, + ['function'] = true, + ['goto'] = true, + ['if'] = true, + ['in'] = true, + ['local'] = true, + ['nil'] = true, + ['not'] = true, + ['or'] = true, + ['repeat'] = true, + ['return'] = true, + ['then'] = true, + ['true'] = true, + ['until'] = true, + ['while'] = true, +} + local function isIdentifier(str) - return type(str) == 'string' and not not str:match('^[_%a][_%a%d]*$') + return type(str) == 'string' + -- identifier must start with a letter and underscore, and be followed by letters, numbers, and underscores + and not not str:match('^[_%a][_%a%d]*$') + -- lua keywords are not valid identifiers + and not luaKeywords[str] end local flr = math.floor |