mirror of
https://github.com/notwa/lips
synced 2024-11-14 20:09:03 -08:00
lex newlines in block comments
This commit is contained in:
parent
dc7f457b95
commit
76fe45adee
1 changed files with 8 additions and 5 deletions
13
lips.lua
13
lips.lua
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue