Skip to content

Commit 52d0e5d

Browse files
authored
Fix NL rule to handle multiline comments correctly
Wrong behavior: after seeing `/*`, always look for `\n`. Correct behavior: after seeing `/*`, look for `\n` only when there is no `*/` before that.
1 parent 37a9f69 commit 52d0e5d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

syncode/parsers/grammars/go.lark

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ nls: NL+
301301
NAME : /[a-zA-Z_]\w*/
302302

303303
COMMENT : /\/\/[^\n]*\n/
304-
NL: COMMENT | /(\r?\n[\t ]*)+/ | /\/\*[^\n]*\n(\*+[^*\/]|[^*])*\*+\//s
304+
NL: COMMENT | /(\r?\n[\t ]*)+/ | /\/\*(\*+[^*\/\n]|[^*\n])*\**\n(\*+[^*\/]|[^*])*\*+\//s
305305

306306
// %import common.WS_INLINE
307307
// %ignore WS_INLINE

0 commit comments

Comments
 (0)