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

lex newlines in block comments

This commit is contained in:
Connor Olding 2015-11-26 18:51:07 -08:00
parent dc7f457b95
commit 76fe45adee

View file

@ -543,11 +543,12 @@ function Lexer:read_binary()
return num return num
end end
function Lexer:skip_block_comment() function Lexer:lex_block_comment(yield)
self:nextc()
self:nextc()
while true do while true do
if self.ord == self.EOF then if self.chr == '\n' then
self:nextc()
yield('EOL', '\n')
elseif self.ord == self.EOF then
self:error('incomplete block comment') self:error('incomplete block comment')
elseif self.chrchr == '*/' then elseif self.chrchr == '*/' then
self:nextc() self:nextc()
@ -596,7 +597,9 @@ function Lexer:lex(yield)
elseif self.chrchr == '//' then elseif self.chrchr == '//' then
self:skip_to_EOL() self:skip_to_EOL()
elseif self.chrchr == '/*' then elseif self.chrchr == '/*' then
self:skip_block_comment() self:nextc()
self:nextc()
self:lex_block_comment(yield)
elseif self.chr:find('%s') then elseif self.chr:find('%s') then
self:nextc() self:nextc()
elseif self.chr == ',' then elseif self.chr == ',' then