1
0
Fork 0
mirror of https://github.com/notwa/lips synced 2024-05-02 17:43:23 -07: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
end
function Lexer:skip_block_comment()
self:nextc()
self:nextc()
function Lexer:lex_block_comment(yield)
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')
elseif self.chrchr == '*/' then
self:nextc()
@ -596,7 +597,9 @@ function Lexer:lex(yield)
elseif self.chrchr == '//' then
self:skip_to_EOL()
elseif self.chrchr == '/*' then
self:skip_block_comment()
self:nextc()
self:nextc()
self:lex_block_comment(yield)
elseif self.chr:find('%s') then
self:nextc()
elseif self.chr == ',' then