Skip to content

Commit 081179c

Browse files
committed
fix: parse continued latex env as paragraph (close #38)
1 parent eb1e080 commit 081179c

File tree

8 files changed

+34811
-36153
lines changed

8 files changed

+34811
-36153
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "tree-sitter-org"
33
description = "org grammar for the tree-sitter parsing library"
4-
version = "1.3.2"
4+
version = "1.3.3"
55
keywords = ["incremental", "parsing", "org"]
66
categories = ["parsing", "text-editors"]
77
repository = "https://github.com/milisims/tree-sitter-org"

corpus/basic.tst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,32 @@ LatexEnv.5 - Uppercase
13601360
name: (name)
13611361
(name))))
13621362

1363+
================================================================================
1364+
LatexEnv.6a - Junk
1365+
================================================================================
1366+
\( a \) b
1367+
--------------------------------------------------------------------------------
1368+
1369+
(document
1370+
body: (body
1371+
(paragraph
1372+
(expr)
1373+
(expr)
1374+
(expr)
1375+
(expr))))
1376+
1377+
================================================================================
1378+
LatexEnv.6b - Junk
1379+
================================================================================
1380+
\( \)
1381+
--------------------------------------------------------------------------------
1382+
1383+
(document
1384+
body: (body
1385+
(paragraph
1386+
(expr)
1387+
(expr))))
1388+
13631389
================================================================================
13641390
Precedence.1 - Paragraph comment
13651391
================================================================================

grammar.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,12 @@ org_grammar = {
305305
token.immediate('}'),
306306
),
307307
seq(
308-
caseInsensitive('\\['),
309-
$._nl,
308+
token(seq(caseInsensitive('\\['), choice('\n', '\r'))),
310309
optional(field('contents', $.contents)),
311310
caseInsensitive('\\]'),
312311
),
313312
seq(
314-
caseInsensitive('\\('),
315-
$._nl,
313+
token(seq(caseInsensitive('\\('), choice('\n', '\r'))),
316314
optional(field('contents', $.contents)),
317315
caseInsensitive('\\)'),
318316
),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tree-sitter-org",
3-
"version": "1.3.2",
3+
"version": "1.3.3",
44
"description": "Org grammar for tree-sitter",
55
"main": "bindings/node",
66
"keywords": [

src/grammar.json

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,17 +1820,34 @@
18201820
"type": "SEQ",
18211821
"members": [
18221822
{
1823-
"type": "ALIAS",
1823+
"type": "TOKEN",
18241824
"content": {
1825-
"type": "PATTERN",
1826-
"value": "\\\\\\["
1827-
},
1828-
"named": false,
1829-
"value": "\\["
1830-
},
1831-
{
1832-
"type": "SYMBOL",
1833-
"name": "_nl"
1825+
"type": "SEQ",
1826+
"members": [
1827+
{
1828+
"type": "ALIAS",
1829+
"content": {
1830+
"type": "PATTERN",
1831+
"value": "\\\\\\["
1832+
},
1833+
"named": false,
1834+
"value": "\\["
1835+
},
1836+
{
1837+
"type": "CHOICE",
1838+
"members": [
1839+
{
1840+
"type": "STRING",
1841+
"value": "\n"
1842+
},
1843+
{
1844+
"type": "STRING",
1845+
"value": "\r"
1846+
}
1847+
]
1848+
}
1849+
]
1850+
}
18341851
},
18351852
{
18361853
"type": "CHOICE",
@@ -1863,17 +1880,34 @@
18631880
"type": "SEQ",
18641881
"members": [
18651882
{
1866-
"type": "ALIAS",
1883+
"type": "TOKEN",
18671884
"content": {
1868-
"type": "PATTERN",
1869-
"value": "\\\\\\("
1870-
},
1871-
"named": false,
1872-
"value": "\\("
1873-
},
1874-
{
1875-
"type": "SYMBOL",
1876-
"name": "_nl"
1885+
"type": "SEQ",
1886+
"members": [
1887+
{
1888+
"type": "ALIAS",
1889+
"content": {
1890+
"type": "PATTERN",
1891+
"value": "\\\\\\("
1892+
},
1893+
"named": false,
1894+
"value": "\\("
1895+
},
1896+
{
1897+
"type": "CHOICE",
1898+
"members": [
1899+
{
1900+
"type": "STRING",
1901+
"value": "\n"
1902+
},
1903+
{
1904+
"type": "STRING",
1905+
"value": "\r"
1906+
}
1907+
]
1908+
}
1909+
]
1910+
}
18771911
},
18781912
{
18791913
"type": "CHOICE",

src/node-types.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,18 +1114,10 @@
11141114
"type": "\\",
11151115
"named": false
11161116
},
1117-
{
1118-
"type": "\\(",
1119-
"named": false
1120-
},
11211117
{
11221118
"type": "\\)",
11231119
"named": false
11241120
},
1125-
{
1126-
"type": "\\[",
1127-
"named": false
1128-
},
11291121
{
11301122
"type": "\\]",
11311123
"named": false

0 commit comments

Comments
 (0)