1
0
Fork 0
mirror of https://github.com/notwa/lips synced 2024-04-30 09:03:23 -07:00

allow comments after filenames

this is hack city but it will do until i refactor this crap
This commit is contained in:
Connor Olding 2016-11-29 09:58:00 -08:00
parent 8546411e14
commit 9f6252117e
2 changed files with 12 additions and 3 deletions

1
TODO
View File

@ -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',

View File

@ -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