1
0
Fork 0
mirror of https://github.com/notwa/lips synced 2024-11-14 09:49:02 -08:00

fix unary preprocessing

This commit is contained in:
Connor Olding 2016-04-10 03:39:50 -07:00
parent b7831b49c3
commit 5afb743977

View file

@ -24,13 +24,14 @@ function Preproc:process(tokens)
local t = self:advance()
local sign = 1
if t.tt == 'UNARY' then
sign = t.tok
local peek = self.tokens[self.i + 1]
if peek.tt == 'UNARY' then
self:error('unary operators cannot be chained')
elseif peek.tt == 'EOL' or peek.tt == 'SEP' then
t.tt = 'RELLABEL'
t.tt = 'RELLABELSYM'
elseif peek.tt == 'DEFSYM' then
sign = t.tok
t = self:advance()
else
self:error('expected a symbolic constant after unary operator')
end