Skip to content

Commit

Permalink
Make block comments non-greedy
Browse files Browse the repository at this point in the history
Prevent the regex from matching `*/` within a block comment,
so they can't "leak" from one to the next one
  • Loading branch information
ISSOtm committed Mar 9, 2024
1 parent 29e169d commit 778b182
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parser.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ match {
// Skip whitespace and comments
r"\s*" => { },
r"//[^\n\r]*[\n\r]*" => { }, // `// comment`
r"/\*([^\*]*\*+[^\*/])*([^\*]*\*+|[^\*])*\*/" => { }, // `/* comment */`
r"/\*([^*]|\*[^/])*\*/" => { }, // `/* comment */`
}

pub File = { <Root*> }
Expand Down

0 comments on commit 778b182

Please sign in to comment.