Tweak comment parsing

This is taken verbatim from tree-sitter-c [1], just in case :-).

[1]: https://github.com/tree-sitter/tree-sitter-c
This commit is contained in:
Bruno BELANYI 2024-04-11 18:38:14 +01:00
parent b62fc19da9
commit adec624d74
3 changed files with 478 additions and 452 deletions

View file

@ -23,8 +23,8 @@ module.exports = grammar({
), ),
comment: (_) => choice( comment: (_) => choice(
seq("//", /[^\n]*/), seq("//", /(\\+(.|\r?\n)|[^\\\n])*/),
seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, '/'), seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, "/"),
), ),
// Definitions {{{ // Definitions {{{

2
src/grammar.json generated
View file

@ -33,7 +33,7 @@
}, },
{ {
"type": "PATTERN", "type": "PATTERN",
"value": "[^\\n]*" "value": "(\\\\+(.|\\r?\\n)|[^\\\\\\n])*"
} }
] ]
}, },

924
src/parser.c generated

File diff suppressed because it is too large Load diff