Stop treating \big, \bigg, \Big, \Bigg delimiters as pairable

Delimiters preceded by these commands are treated by TeX as Ord atoms --
meaning they don't require any sort of pairing, and shouldn't be treated
as such.

See #84 and The TeXbook, page 171.
pull/813/head
João de Felipe 2023-05-11 02:47:30 +07:00
parent cd3cc493a9
commit d3f3dde488
5 changed files with 598474 additions and 616860 deletions

@ -861,10 +861,6 @@ module.exports = grammar({
'left_command', 'left_command',
choice( choice(
'\\left', '\\left',
'\\big',
'\\Big',
'\\bigg',
'\\Bigg',
'\\bigl', '\\bigl',
'\\Bigl', '\\Bigl',
'\\biggl', '\\biggl',
@ -877,10 +873,6 @@ module.exports = grammar({
'right_command', 'right_command',
choice( choice(
'\\right', '\\right',
'\\big',
'\\Big',
'\\bigg',
'\\Bigg',
'\\bigr', '\\bigr',
'\\Bigr', '\\Bigr',
'\\biggr', '\\biggr',

32
src/grammar.json vendored

@ -4357,22 +4357,6 @@
"type": "STRING", "type": "STRING",
"value": "\\left" "value": "\\left"
}, },
{
"type": "STRING",
"value": "\\big"
},
{
"type": "STRING",
"value": "\\Big"
},
{
"type": "STRING",
"value": "\\bigg"
},
{
"type": "STRING",
"value": "\\Bigg"
},
{ {
"type": "STRING", "type": "STRING",
"value": "\\bigl" "value": "\\bigl"
@ -4417,22 +4401,6 @@
"type": "STRING", "type": "STRING",
"value": "\\right" "value": "\\right"
}, },
{
"type": "STRING",
"value": "\\big"
},
{
"type": "STRING",
"value": "\\Big"
},
{
"type": "STRING",
"value": "\\bigg"
},
{
"type": "STRING",
"value": "\\Bigg"
},
{ {
"type": "STRING", "type": "STRING",
"value": "\\bigr" "value": "\\bigr"

@ -3977,14 +3977,6 @@
"multiple": false, "multiple": false,
"required": true, "required": true,
"types": [ "types": [
{
"type": "\\Big",
"named": false
},
{
"type": "\\Bigg",
"named": false
},
{ {
"type": "\\Biggl", "type": "\\Biggl",
"named": false "named": false
@ -3993,14 +3985,6 @@
"type": "\\Bigl", "type": "\\Bigl",
"named": false "named": false
}, },
{
"type": "\\big",
"named": false
},
{
"type": "\\bigg",
"named": false
},
{ {
"type": "\\biggl", "type": "\\biggl",
"named": false "named": false
@ -4053,14 +4037,6 @@
"multiple": false, "multiple": false,
"required": true, "required": true,
"types": [ "types": [
{
"type": "\\Big",
"named": false
},
{
"type": "\\Bigg",
"named": false
},
{ {
"type": "\\Biggr", "type": "\\Biggr",
"named": false "named": false
@ -4069,14 +4045,6 @@
"type": "\\Bigr", "type": "\\Bigr",
"named": false "named": false
}, },
{
"type": "\\big",
"named": false
},
{
"type": "\\bigg",
"named": false
},
{ {
"type": "\\biggr", "type": "\\biggr",
"named": false "named": false
@ -7470,14 +7438,6 @@
"type": "\\Avolcite", "type": "\\Avolcite",
"named": false "named": false
}, },
{
"type": "\\Big",
"named": false
},
{
"type": "\\Bigg",
"named": false
},
{ {
"type": "\\Biggl", "type": "\\Biggl",
"named": false "named": false
@ -7898,14 +7858,6 @@
"type": "\\bibliography", "type": "\\bibliography",
"named": false "named": false
}, },
{
"type": "\\big",
"named": false
},
{
"type": "\\bigg",
"named": false
},
{ {
"type": "\\biggl", "type": "\\biggl",
"named": false "named": false

1215224
src/parser.c vendored

File diff suppressed because it is too large Load Diff

@ -726,14 +726,13 @@ tree-sitter-latex (Issue #55) | minted with options
(word)))))) (word))))))
================================================================================ ================================================================================
tree-sitter-latex (Issue #58) | math delimiters tree-sitter-latex (Issues #58 and #84) | math delimiters
================================================================================ ================================================================================
\big( 2 + 2 \big)
\bigl( 2 + 2 \bigr) \bigl( 2 + 2 \bigr)
\left( 2 + 2 \right) \left( 2 + 2 \right)
\big\langle 2 + 2 \big\rangle
\bigl| v \bigr| \bigl| v \bigr|
r \big|_0^a
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -750,16 +749,13 @@ tree-sitter-latex (Issue #58) | math delimiters
(word))) (word)))
(math_delimiter (math_delimiter
(text (text
(word)
(operator)
(word))) (word)))
(math_delimiter (text
(command_name) (word)
(text (generic_command
(word) (command_name))
(operator) (operator)
(subscript
(word)) (word))
(command_name)) (superscript
(math_delimiter
(text
(word)))) (word))))