Rename command to generic_command

pull/511/head
Patrick Förster 2022-02-26 21:15:52 +07:00
parent 899b7408d8
commit 7a3d14d057
9 changed files with 819 additions and 551 deletions

@ -61,6 +61,11 @@ module.exports = grammar({
$.inline_formula,
$.math_set,
$.block_comment,
$._command
),
_command: $ =>
choice(
$.package_include,
$.class_include,
$.latex_include,
@ -90,7 +95,7 @@ module.exports = grammar({
$.color_set_definition,
$.color_reference,
$.tikz_library_import,
$.command
$.generic_command
),
//--- Sections
@ -557,7 +562,7 @@ module.exports = grammar({
//--- Command
command: $ =>
generic_command: $ =>
prec.right(
seq(
field('command', $.command_name),

13
src/grammar.json vendored

@ -177,6 +177,15 @@
"type": "SYMBOL",
"name": "block_comment"
},
{
"type": "SYMBOL",
"name": "_command"
}
]
},
"_command": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "package_include"
@ -295,7 +304,7 @@
},
{
"type": "SYMBOL",
"name": "command"
"name": "generic_command"
}
]
},
@ -2758,7 +2767,7 @@
}
]
},
"command": {
"generic_command": {
"type": "PREC_RIGHT",
"value": 0,
"content": {

204
src/node-types.json vendored

@ -459,10 +459,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -479,6 +475,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -755,10 +755,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -779,6 +775,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -1368,36 +1368,6 @@
}
}
},
{
"type": "command",
"named": true,
"fields": {
"arg": {
"multiple": true,
"required": false,
"types": [
{
"type": "curly_group",
"named": true
},
{
"type": "mixed_group",
"named": true
}
]
},
"command": {
"multiple": false,
"required": true,
"types": [
{
"type": "command_name",
"named": true
}
]
}
}
},
{
"type": "comment_environment",
"named": true,
@ -1490,10 +1460,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -1514,6 +1480,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -1729,10 +1699,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "curly_group",
"named": true
@ -1745,6 +1711,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "glossary_entry_definition",
"named": true
@ -1978,10 +1948,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -2002,6 +1968,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -2246,10 +2216,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -2266,6 +2232,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -2419,6 +2389,36 @@
}
}
},
{
"type": "generic_command",
"named": true,
"fields": {
"arg": {
"multiple": true,
"required": false,
"types": [
{
"type": "curly_group",
"named": true
},
{
"type": "mixed_group",
"named": true
}
]
},
"command": {
"multiple": false,
"required": true,
"types": [
{
"type": "command_name",
"named": true
}
]
}
}
},
{
"type": "generic_environment",
"named": true,
@ -2496,10 +2496,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -2520,6 +2516,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -3092,10 +3092,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -3116,6 +3112,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -3643,10 +3643,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -3667,6 +3663,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -3886,10 +3886,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -3906,6 +3902,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -4249,10 +4249,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -4273,6 +4269,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -4473,10 +4473,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -4497,6 +4493,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -4745,10 +4745,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -4769,6 +4765,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -4948,10 +4948,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -4972,6 +4968,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -5180,10 +5180,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -5204,6 +5200,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -5388,10 +5388,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -5412,6 +5408,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -5608,10 +5608,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "comment_environment",
"named": true
@ -5632,6 +5628,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "generic_environment",
"named": true
@ -5963,10 +5963,6 @@
"type": "color_set_definition",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "curly_group",
"named": true
@ -5979,6 +5975,10 @@
"type": "environment_definition",
"named": true
},
{
"type": "generic_command",
"named": true
},
{
"type": "glossary_entry_definition",
"named": true

1084
src/parser.c vendored

File diff suppressed because it is too large Load Diff

@ -7,7 +7,7 @@ Command without arguments
--------------------------------------------------------------------------------
(source_file
(command
(generic_command
(command_name))
(text
(word)))
@ -21,7 +21,7 @@ Command with one curly argument
--------------------------------------------------------------------------------
(source_file
(command
(generic_command
(command_name)
(curly_group
(text
@ -36,7 +36,7 @@ Command with one curly argument and one mixed argument
--------------------------------------------------------------------------------
(source_file
(command
(generic_command
(command_name)
(curly_group
(text
@ -54,7 +54,7 @@ Command with nested paren argument
--------------------------------------------------------------------------------
(source_file
(command
(generic_command
(command_name)
(mixed_group
(mixed_group

@ -42,7 +42,7 @@ Package include with options
(value
(text
(word))
(command
(generic_command
(command_name))))
(key_value_pair
(text
@ -98,7 +98,7 @@ Class include with options
(value
(text
(word))
(command
(generic_command
(command_name))))
(key_value_pair
(text

@ -25,7 +25,7 @@ foo foo foo foo foo foo
(curly_group_text
(text
(word))))
(command
(generic_command
(command_name)
(curly_group
(text
@ -38,7 +38,7 @@ foo foo foo foo foo foo
(word)
(word)
(word))
(command
(generic_command
(command_name)
(curly_group
(text
@ -56,7 +56,7 @@ foo foo foo foo foo foo
(word)
(word)
(word))
(command
(generic_command
(command_name)
(curly_group
(text
@ -143,23 +143,23 @@ tree-sitter-latex (Issue #10)
--------------------------------------------------------------------------------
(source_file
(command
(generic_command
(command_name)
(curly_group
(section))
(curly_group
(command
(generic_command
(command_name)))
(curly_group
(command
(generic_command
(command_name)))
(curly_group
(text
(word)))
(curly_group
(command
(generic_command
(command_name))))
(command
(generic_command
(command_name)
(curly_group
(paragraph))
@ -169,12 +169,12 @@ tree-sitter-latex (Issue #10)
(curly_group
(text
(word))
(command
(generic_command
(command_name)))
(curly_group
(text
(word))
(command
(generic_command
(command_name)))))
================================================================================
@ -197,7 +197,7 @@ rm -rf "$(biber --cache)"
(text
(word)
(word))
(command
(generic_command
(command_name)
(curly_group
(text
@ -233,13 +233,13 @@ tree-sitter-latex (Issue #11)
(text
(word)))
(curly_group_impl
(command
(generic_command
(command_name)
(curly_group
(text
(word)))))
(curly_group_impl
(command
(generic_command
(command_name)
(curly_group
(text
@ -255,23 +255,23 @@ tree-sitter-latex (Issue #10)
--------------------------------------------------------------------------------
(source_file
(command
(generic_command
(command_name)
(curly_group
(section))
(curly_group
(command
(generic_command
(command_name)))
(curly_group
(command
(generic_command
(command_name)))
(curly_group
(text
(word)))
(curly_group
(command
(generic_command
(command_name))))
(command
(generic_command
(command_name)
(curly_group
(paragraph))
@ -281,12 +281,12 @@ tree-sitter-latex (Issue #10)
(curly_group
(text
(word))
(command
(generic_command
(command_name)))
(curly_group
(text
(word))
(command
(generic_command
(command_name)))))
================================================================================
@ -306,7 +306,7 @@ tree-sitter-latex (Issue #13)
(value
(text
(word))
(command
(generic_command
(command_name)))))
(curly_group_path
(path))))
@ -364,7 +364,7 @@ tree-sitter-latex (Issue #25 Nesting of document structure)
(enum_item
(text
word: (word))
(command
(generic_command
command: (command_name)
arg: (curly_group
(text

@ -68,7 +68,7 @@ Nested sections
(word))
(part
(curly_group
(command
(generic_command
(command_name)))
(text
(word))

@ -21,7 +21,7 @@ Escaped percent
--------------------------------------------------------------------------------
(source_file
(command
(generic_command
(command_name))
(text
(word)))