From 9f6252117e20ffbfcaafb5c6229d711eb9217dbf Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Tue, 29 Nov 2016 09:58:00 -0800 Subject: [PATCH] allow comments after filenames this is hack city but it will do until i refactor this crap --- TODO | 1 + lips/Lexer.lua | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 8fcf85f..c3159dc 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ unify/optimize ascii/asciiz/byte/halfword/word into BIN directives +also lex strings to binary strings, why not directive aliases, are these right? DB = 'BYTE', diff --git a/lips/Lexer.lua b/lips/Lexer.lua index ff7318c..026247c 100644 --- a/lips/Lexer.lua +++ b/lips/Lexer.lua @@ -297,11 +297,19 @@ function Lexer:lex_filename(_yield) end) _yield('STRING', fn, self.fn, self.line) - if self.chr ~= '\n' then + self:read_spaces() + if self.chr == ';' or self.chrchr == '//' then + self:skip_to_EOL() + end + if self.chr == '\n' then + _yield('EOL', '\n', self.fn, self.line) + self:nextc() + elseif self.ord == self.EOF then + _yield('EOL', '\n', self.fn, self.line) + self.was_EOL = true + else self:error('expected EOL after filename') end - _yield('EOL', '\n', self.fn, self.line) - self:nextc() return fn end