Make comments a single node in the grammar
This looks to be a *strong* idiom in tree-sitter parsers.
This commit is contained in:
parent
aa8472e73f
commit
b62fc19da9
6 changed files with 588 additions and 723 deletions
57
src/grammar.json
generated
57
src/grammar.json
generated
|
|
@ -21,33 +21,38 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"line_comment": {
|
||||
"type": "SEQ",
|
||||
"comment": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "//"
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "//"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "[^\\n]*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "[^\\n]*"
|
||||
}
|
||||
]
|
||||
},
|
||||
"block_comment": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "/*"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "/"
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "/*"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -956,11 +961,7 @@
|
|||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "line_comment"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "block_comment"
|
||||
"name": "comment"
|
||||
}
|
||||
],
|
||||
"conflicts": [],
|
||||
|
|
|
|||
9
src/node-types.json
generated
9
src/node-types.json
generated
|
|
@ -168,12 +168,12 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"type": "block_comment",
|
||||
"type": "boolean_literal",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "boolean_literal",
|
||||
"type": "comment",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
|
|
@ -259,11 +259,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "list_expression",
|
||||
"named": true,
|
||||
|
|
|
|||
1208
src/parser.c
generated
1208
src/parser.c
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue