1
0
Fork 0
mirror of https://github.com/notwa/lips synced 2024-04-24 23:03: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:
Connor Olding 2016-11-27 21:16:38 -08:00
parent de2618bb61
commit 64ef102183

View File

@ -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