Make 'line_comment' more explicit about newlines
Because of the way regular expressions work, they were already bounded at newlines here, but explicit is better than implicit :-).
This commit is contained in:
parent
73b0797891
commit
be1e3f07d3
|
@ -23,7 +23,7 @@ module.exports = grammar({
|
||||||
$.module,
|
$.module,
|
||||||
),
|
),
|
||||||
|
|
||||||
line_comment: (_) => seq("//", /.*/),
|
line_comment: (_) => seq("//", /[^\n]*/),
|
||||||
|
|
||||||
block_comment: (_) => seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, '/'),
|
block_comment: (_) => seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, '/'),
|
||||||
|
|
||||||
|
|
2
src/grammar.json
generated
2
src/grammar.json
generated
|
@ -30,7 +30,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": ".*"
|
"value": "[^\\n]*"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -85,6 +85,23 @@ Block comment with asterisks
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(block_comment))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Block comment (multiline)
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
/*
|
||||||
|
This
|
||||||
|
is
|
||||||
|
a
|
||||||
|
long
|
||||||
|
comment
|
||||||
|
*/
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(block_comment))
|
(block_comment))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue