Skip to content

Commit 7562ba4

Browse files
committed
Tag line comments and block comments separately
1 parent b2c95d3 commit 7562ba4

File tree

4 files changed

+95480
-74949
lines changed

4 files changed

+95480
-74949
lines changed

grammar.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4305,18 +4305,16 @@ const rules = {
43054305
// block_comment: $ => /* comment_text */
43064306
// comment_text: $ => { Any_ASCII_character }
43074307

4308+
one_line_comment: $ => token(seq('//', /.*/)),
4309+
43084310
// http://stackoverflow.com/questions/13014947/regex-to-match-a-c-style-multiline-comment/36328890#36328890
43094311
// from: https://github.com/tree-sitter/tree-sitter-c/blob/master/grammar.js
4310-
comment: $ => token(choice(
4311-
seq('//', /.*/), // $._one_line_comment -> seq('//', $.comment_text)
4312-
seq( // $._block_comment
4313-
'/*',
4314-
/[^*]*\*+([^/*][^*]*\*+)*/,
4315-
'/'
4316-
)
4312+
block_comment: $ => token(seq(
4313+
'/*',
4314+
/[^*]*\*+([^/*][^*]*\*+)*/,
4315+
'/'
43174316
)),
43184317

4319-
43204318
// ** A.9.3 Identifiers
43214319
array_identifier: $ => $._identifier, // Seems unused
43224320
block_identifier: $ => $._identifier,
@@ -4715,7 +4713,7 @@ module.exports = grammar({
47154713
name: 'systemverilog',
47164714
word: $ => $.simple_identifier,
47174715
rules: rules,
4718-
extras: $ => [/\s/, $.comment],
4716+
extras: $ => [/\s/, $.one_line_comment, $.block_comment],
47194717

47204718
// Annex B
47214719
reserved: {
@@ -6151,4 +6149,3 @@ module.exports = grammar({
61516149
],
61526150

61536151
});
6154-

src/grammar.json

Lines changed: 31 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node-types.json

Lines changed: 10 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)