mirror of
https://github.com/notwa/lips
synced 2024-05-04 10:33:22 -07: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
|
@ -394,6 +394,9 @@ function Lexer:lex(_yield)
|
||||||
elseif self.chr == '[' then
|
elseif self.chr == '[' then
|
||||||
self:nextc()
|
self:nextc()
|
||||||
local buff = self:read_chars('[%w_]')
|
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
|
if self.chr ~= ']' then
|
||||||
self:error('invalid variable name')
|
self:error('invalid variable name')
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user