From 91e028ef6ab6107e7838f28342608e28e409732f Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Wed, 20 Apr 2016 16:28:59 -0700 Subject: [PATCH] rename internal DEF to VAR --- lips/Collector.lua | 8 ++++---- lips/Lexer.lua | 4 ++-- lips/Muncher.lua | 4 ++-- lips/Preproc.lua | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lips/Collector.lua b/lips/Collector.lua index 5ce86a5..b0a5dc8 100644 --- a/lips/Collector.lua +++ b/lips/Collector.lua @@ -9,7 +9,7 @@ local Muncher = require(path.."Muncher") local arg_types = { -- for instructions NUM = true, REG = true, - DEFSYM = true, + VARSYM = true, LABELSYM = true, RELLABELSYM = true, } @@ -78,7 +78,7 @@ function Collector:variable() local t = self.t local t2 = self:advance() - local s = self:statement('!DEF', t, t2) + local s = self:statement('!VAR', t, t2) insert(self.statements, s) self:advance() end @@ -165,7 +165,7 @@ function Collector:instruction() insert(s, t) elseif self.tt == 'UNARY' then local peek = self.tokens[self.i + 1] - if peek.tt == 'DEFSYM' then + if peek.tt == 'VARSYM' then t = self:advance() t = Token(t):set('negate') insert(s, t) @@ -216,7 +216,7 @@ function Collector:collect(tokens, fn) elseif self.tt == 'EOL' then -- empty line self:advance() - elseif self.tt == 'DEF' then + elseif self.tt == 'VAR' then self:variable() -- handles advancing elseif self.tt == 'LABEL' or self.tt == 'RELLABEL' then insert(self.statements, self:statement('!LABEL', self.t)) diff --git a/lips/Lexer.lua b/lips/Lexer.lua index 6c0ac71..d035991 100644 --- a/lips/Lexer.lua +++ b/lips/Lexer.lua @@ -358,7 +358,7 @@ function Lexer:lex(_yield) self:error('expected a colon after closing bracket') end self:nextc() - yield('DEF', buff) + yield('VAR', buff) elseif self.chr == ']' then self:error('unmatched closing bracket') elseif self.chr == '(' then @@ -391,7 +391,7 @@ function Lexer:lex(_yield) elseif self.chr == '@' then self:nextc() local buff = self:read_chars('[%w_]') - yield('DEFSYM', buff) + yield('VARSYM', buff) elseif self.chr == '%' then self:nextc() if self.chr:find('[%a_]') then diff --git a/lips/Muncher.lua b/lips/Muncher.lua index 1d8842b..b3f52fa 100644 --- a/lips/Muncher.lua +++ b/lips/Muncher.lua @@ -9,7 +9,7 @@ local Token = require(path.."Token") local arg_types = { NUM = true, REG = true, - DEFSYM = true, + VARSYM = true, LABELSYM = true, RELLABELSYM = true, } @@ -115,7 +115,7 @@ function Muncher:deref() end function Muncher:const(relative, no_label) - if self.tt ~= 'NUM' and self.tt ~= 'DEFSYM' and self.tt ~= 'LABELSYM' then + if self.tt ~= 'NUM' and self.tt ~= 'VARSYM' and self.tt ~= 'LABELSYM' then self:error('expected constant', self.tt) end if no_label and self.tt == 'LABELSYM' then diff --git a/lips/Preproc.lua b/lips/Preproc.lua index 4baef26..540b1f6 100644 --- a/lips/Preproc.lua +++ b/lips/Preproc.lua @@ -52,7 +52,7 @@ function Preproc:process(tokens) elseif peek.tt == 'EOL' or peek.tt == 'SEP' then t.tt = 'RELLABELSYM' t.tok = sign == 1 and '+' or sign == -1 and '-' - elseif peek.tt == 'DEFSYM' then + elseif peek.tt == 'VARSYM' then t = self:advance() else self:error('expected a symbolic constant after unary operator') @@ -60,13 +60,13 @@ function Preproc:process(tokens) end if t.tt == nil then error('Internal Error: missing token') - elseif t.tt == 'DEF' then + elseif t.tt == 'VAR' then local t2 = self:advance() if t2.tt ~= 'NUM' then self:error('expected number for variable') end variables[t.tok] = t2.tok - elseif t.tt == 'DEFSYM' then + elseif t.tt == 'VARSYM' then local tt = 'NUM' local tok = variables[t.tok] if tok == nil then