mirror of
https://github.com/notwa/lips
synced 2024-11-14 14:49:03 -08:00
disallow variable names beginning with a number
this makes lexing easier. i don't think this worked properly anyway.
This commit is contained in:
parent
de2618bb61
commit
64ef102183
1 changed files with 3 additions and 0 deletions
|
@ -394,6 +394,9 @@ function Lexer:lex(_yield)
|
|||
elseif self.chr == '[' then
|
||||
self:nextc()
|
||||
local buff = self:read_chars('[%w_]')
|
||||
if buff:match('^%d') then
|
||||
self:error('variable names cannot begin with a number')
|
||||
end
|
||||
if self.chr ~= ']' then
|
||||
self:error('invalid variable name')
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue