Skip to content

Commit eb1e080

Browse files
committed
fix: tabs not included in regexes (close #36)
1 parent 698bb1a commit eb1e080

File tree

6 files changed

+180
-433
lines changed

6 files changed

+180
-433
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.1"
4+
version = "1.3.2"
55
keywords = ["incremental", "parsing", "org"]
66
categories = ["parsing", "text-editors"]
77
repository = "https://github.com/milisims/tree-sitter-org"

corpus/basic.tst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,3 +2427,22 @@ Plan.16 - Link
24272427
body: (body
24282428
(paragraph
24292429
(expr)))))
2430+
2431+
================================================================================
2432+
Plan.17 - Tab
2433+
================================================================================
2434+
* a
2435+
a: <2-2-2>
2436+
--------------------------------------------------------------------------------
2437+
2438+
(document
2439+
subsection: (section
2440+
headline: (headline
2441+
stars: (stars)
2442+
item: (item
2443+
(expr)))
2444+
plan: (plan
2445+
(entry
2446+
name: (entry_name)
2447+
timestamp: (timestamp
2448+
date: (date))))))

grammar.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ org_grammar = {
172172
date: $ => /\p{N}{1,4}-\p{N}{1,4}-\p{N}{1,4}/,
173173

174174
_ts_element: $ => choice(
175-
field('day', alias(/\p{L}[^\]>\p{Z}\n\r]*/, $.day)),
175+
field('day', alias(/\p{L}[^\]>\p{Z}\t\n\r]*/, $.day)),
176176
field('time', alias(/\p{N}?\p{N}[:.]\p{N}\p{N}( ?\p{L}{1,2})?/, $.time)),
177177
field('duration', alias(/\p{N}?\p{N}[:.]\p{N}\p{N}( ?\p{L}{1,2})?-\p{N}?\p{N}[:.]\p{N}\p{N}( ?\p{L}{1,2})?/, $.duration)),
178178
field('repeat', alias(/[.+]?\+\p{N}+\p{L}/, $.repeat)),
179179
field('delay', alias(/--?\p{N}+\p{L}/, $.delay)),
180-
alias(prec(-1, /[^\[<\]>\p{Z}\n\r]+/), $.expr),
180+
alias(prec(-1, /[^\[<\]>\p{Z}\t\n\r]+/), $.expr),
181181
),
182182

183183
paragraph: $ => seq(optional($._directive_list), $._multiline_text),
@@ -186,7 +186,7 @@ org_grammar = {
186186
optional($._directive_list),
187187
seq(
188188
caseInsensitive('[fn:'),
189-
field('label', alias(/[^\p{Z}\n\r\]]+/, $.expr)),
189+
field('label', alias(/[^\p{Z}\t\n\r\]]+/, $.expr)),
190190
']',
191191
),
192192
field('description', alias($._multiline_text, $.description))
@@ -356,7 +356,7 @@ function expr(pr, tfunc, skip = '') {
356356
...asciiSymbols.filter(c => !skip.includes(c)).map(c => tfunc(prec(pr, c))),
357357
alias(tfunc(prec(pr, /\p{L}+/)), 'str'),
358358
alias(tfunc(prec(pr, /\p{N}+/)), 'num'),
359-
alias(tfunc(prec(pr, /[^\p{Z}\p{L}\p{N}\n\r]/)), 'sym'),
359+
alias(tfunc(prec(pr, /[^\p{Z}\p{L}\p{N}\t\n\r]/)), 'sym'),
360360
// for checkboxes: ugly, but makes them work..
361361
// alias(tfunc(prec(pr, 'x')), 'str'),
362362
// alias(tfunc(prec(pr, 'X')), 'str'),

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.1",
3+
"version": "1.3.2",
44
"description": "Org grammar for tree-sitter",
55
"main": "bindings/node",
66
"keywords": [

src/grammar.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@
833833
"type": "ALIAS",
834834
"content": {
835835
"type": "PATTERN",
836-
"value": "\\p{L}[^\\]>\\p{Z}\\n\\r]*"
836+
"value": "\\p{L}[^\\]>\\p{Z}\\t\\n\\r]*"
837837
},
838838
"named": true,
839839
"value": "day"
@@ -898,7 +898,7 @@
898898
"value": -1,
899899
"content": {
900900
"type": "PATTERN",
901-
"value": "[^\\[<\\]>\\p{Z}\\n\\r]+"
901+
"value": "[^\\[<\\]>\\p{Z}\\t\\n\\r]+"
902902
}
903903
},
904904
"named": true,
@@ -961,7 +961,7 @@
961961
"type": "ALIAS",
962962
"content": {
963963
"type": "PATTERN",
964-
"value": "[^\\p{Z}\\n\\r\\]]+"
964+
"value": "[^\\p{Z}\\t\\n\\r\\]]+"
965965
},
966966
"named": true,
967967
"value": "expr"
@@ -2407,7 +2407,7 @@
24072407
"value": "immediate",
24082408
"content": {
24092409
"type": "PATTERN",
2410-
"value": "[^\\p{Z}\\p{L}\\p{N}\\n\\r]"
2410+
"value": "[^\\p{Z}\\p{L}\\p{N}\\t\\n\\r]"
24112411
}
24122412
}
24132413
},
@@ -2804,7 +2804,7 @@
28042804
"value": "immediate",
28052805
"content": {
28062806
"type": "PATTERN",
2807-
"value": "[^\\p{Z}\\p{L}\\p{N}\\n\\r]"
2807+
"value": "[^\\p{Z}\\p{L}\\p{N}\\t\\n\\r]"
28082808
}
28092809
}
28102810
},
@@ -3199,7 +3199,7 @@
31993199
"value": "immediate",
32003200
"content": {
32013201
"type": "PATTERN",
3202-
"value": "[^\\p{Z}\\p{L}\\p{N}\\n\\r]"
3202+
"value": "[^\\p{Z}\\p{L}\\p{N}\\t\\n\\r]"
32033203
}
32043204
}
32053205
},
@@ -3585,7 +3585,7 @@
35853585
"value": "non-immediate",
35863586
"content": {
35873587
"type": "PATTERN",
3588-
"value": "[^\\p{Z}\\p{L}\\p{N}\\n\\r]"
3588+
"value": "[^\\p{Z}\\p{L}\\p{N}\\t\\n\\r]"
35893589
}
35903590
}
35913591
},
@@ -3970,7 +3970,7 @@
39703970
"value": "immediate",
39713971
"content": {
39723972
"type": "PATTERN",
3973-
"value": "[^\\p{Z}\\p{L}\\p{N}\\n\\r]"
3973+
"value": "[^\\p{Z}\\p{L}\\p{N}\\t\\n\\r]"
39743974
}
39753975
}
39763976
},
@@ -4381,7 +4381,7 @@
43814381
"value": "non-immediate",
43824382
"content": {
43834383
"type": "PATTERN",
4384-
"value": "[^\\p{Z}\\p{L}\\p{N}\\n\\r]"
4384+
"value": "[^\\p{Z}\\p{L}\\p{N}\\t\\n\\r]"
43854385
}
43864386
}
43874387
},
@@ -4788,7 +4788,7 @@
47884788
"value": "immediate",
47894789
"content": {
47904790
"type": "PATTERN",
4791-
"value": "[^\\p{Z}\\p{L}\\p{N}\\n\\r]"
4791+
"value": "[^\\p{Z}\\p{L}\\p{N}\\t\\n\\r]"
47924792
}
47934793
}
47944794
},

0 commit comments

Comments
 (0)