diff --git a/lib/lrama/lexer.rb b/lib/lrama/lexer.rb index 81466286..c50af82a 100644 --- a/lib/lrama/lexer.rb +++ b/lib/lrama/lexer.rb @@ -169,12 +169,11 @@ def lex_c_code def lex_comment until @scanner.eos? do case - when @scanner.scan(/\n/) - newline - when @scanner.scan(/\*\//) + when @scanner.scan_until(/[\s\S]*?\*\//) + @scanner.matched.count("\n").times { newline } return - else - @scanner.getch + when @scanner.scan_until(/\n/) + newline end end end