From 64ef102183a4e0ffee18a94dfabd85252428168e Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sun, 27 Nov 2016 21:16:38 -0800 Subject: [PATCH] disallow variable names beginning with a number this makes lexing easier. i don't think this worked properly anyway. --- lips/Lexer.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lips/Lexer.lua b/lips/Lexer.lua index 95aaf32..22cd5cb 100644 --- a/lips/Lexer.lua +++ b/lips/Lexer.lua @@ -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