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:
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
|
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
|
||||||
|
|
Loading…
Reference in a new issue