File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,30 +94,12 @@ local function escape(str)
9494 " %c" , shortControlCharEscapes ))
9595end
9696
97- local luaKeywords = {
98- [' and' ] = true ,
99- [' break' ] = true ,
100- [' do' ] = true ,
101- [' else' ] = true ,
102- [' elseif' ] = true ,
103- [' end' ] = true ,
104- [' false' ] = true ,
105- [' for' ] = true ,
106- [' function' ] = true ,
107- [' goto' ] = true ,
108- [' if' ] = true ,
109- [' in' ] = true ,
110- [' local' ] = true ,
111- [' nil' ] = true ,
112- [' not' ] = true ,
113- [' or' ] = true ,
114- [' repeat' ] = true ,
115- [' return' ] = true ,
116- [' then' ] = true ,
117- [' true' ] = true ,
118- [' until' ] = true ,
119- [' while' ] = true ,
120- }
97+ local luaKeywords = {}
98+ for k in ([[ and break do else elseif end false for function goto if
99+ in local nil not or repeat return then true until while
100+ ]] ):gmatch (' %w' ) do
101+ luaKeywords [k ] = true
102+ end
121103
122104local function isIdentifier (str )
123105 return type (str ) == " string" and
Original file line number Diff line number Diff line change @@ -94,30 +94,12 @@ local function escape(str: string): string
9494 " %c" , shortControlCharEscapes))
9595end
9696
97- local luaKeywords: {string :boolean } = {
98- [' and' ] = true ,
99- [' break' ] = true ,
100- [' do' ] = true ,
101- [' else' ] = true ,
102- [' elseif' ] = true ,
103- [' end' ] = true ,
104- [' false' ] = true ,
105- [' for' ] = true ,
106- [' function' ] = true ,
107- [' goto' ] = true ,
108- [' if' ] = true ,
109- [' in' ] = true ,
110- [' local' ] = true ,
111- [' nil' ] = true ,
112- [' not' ] = true ,
113- [' or' ] = true ,
114- [' repeat' ] = true ,
115- [' return' ] = true ,
116- [' then' ] = true ,
117- [' true' ] = true ,
118- [' until' ] = true ,
119- [' while' ] = true ,
120- }
97+ local luaKeywords: {string :boolean } = {}
98+ for k in ([[ and break do else elseif end false for function goto if
99+ in local nil not or repeat return then true until while
100+ ]] ):gmatch (' %w' ) do
101+ luaKeywords[k] = true
102+ end
121103
122104local function isIdentifier (str: any ): boolean
123105 return str is string
You can’t perform that action at this time.
0 commit comments