From b80fb49a22c631fdd4d60a7e838168238691100c Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Thu, 1 Dec 2016 10:31:55 -0800 Subject: [PATCH] allow _ in expr vars; tweak number matching --- lips/Expression.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lips/Expression.lua b/lips/Expression.lua index 0d1950a..5634c3a 100644 --- a/lips/Expression.lua +++ b/lips/Expression.lua @@ -174,9 +174,9 @@ function Expression:lex1(str, tokens) return "bad octal number: "..considered..here end num = tonumber(considered:sub(2), 8) - elseif consider('#[0-9]*') then + elseif consider('#[0-9]+') then num = tonumber(considered:sub(2)) - elseif consider('[0-9]*') then + elseif consider('[0-9]+') then num = tonumber(considered) end if num == nil then @@ -193,7 +193,7 @@ function Expression:lex1(str, tokens) elseif consider_operator() then insert(tokens, {type='operator', value=considered}) consume(#considered) - elseif consider('%w+') then + elseif consider('[%w_]+') then local num = self.variables[considered] if num == nil then return 'undefined variable "'..considered..'"'