You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 17, 2025. It is now read-only.
feat!: Rebuild text parsing. Remove (expr), add (sym)(str)(num)(nl)
Previously, (expr) had anonymous "str" "num" and "sym" nodes. Those are
now exposed. (sym) nodes retain the anonymous symbols, like (sym "*").
Additionally, (sym next: "str") indicates the symbol is before an immediate
(str), and (sym prev: "num") indicates the symbol is after a number.
Add (nl) in multiline text:
- (paragraph)
- (fndef (description))
- (contents), in drawers, blocks, dynamic blocks, and latex_envs
Add "sub" and "final" fields to (stars)
- element contains: `(directive)* choose(paragraph, drawer, comment, footnote def, list, block, dynamic block, table)` or a bare `(directive)`
19
-
- paragraph contains: `(expr)+`
20
-
- expr contains: anonymous nodes for 'str', 'num', 'sym', and any ascii symbol that is not letters or numbers. (See top of grammar.js and queries for details)
21
-
22
-
Like in many regex systems, `*/+` is read as "0/1 or more", and `?` is 0 or 1.
23
-
24
8
## Example
25
9
26
10
```org
@@ -48,20 +32,24 @@ Parses as:
48
32
(document [0, 0] - [16, 0]
49
33
body: (body [0, 0] - [4, 0]
50
34
directive: (directive [0, 0] - [1, 0]
51
-
name: (expr [0, 2] - [0, 7])
35
+
name: (expr [0, 2] - [0, 7]
36
+
(str [0, 2] - [0, 7]))
52
37
value: (value [0, 9] - [0, 16]
53
-
(expr [0, 9] - [0, 16])))
38
+
(str [0, 9] - [0, 16])))
54
39
(paragraph [2, 0] - [3, 0]
55
-
(expr [2, 0] - [2, 4])
56
-
(expr [2, 5] - [2, 12])
57
-
(expr [2, 13] - [2, 16])
58
-
(expr [2, 17] - [2, 22])))
40
+
(str [2, 0] - [2, 4])
41
+
(sym [2, 5] - [2, 6])
42
+
(str [2, 6] - [2, 12])
43
+
(str [2, 13] - [2, 15])
44
+
(sym [2, 15] - [2, 16])
45
+
(str [2, 17] - [2, 22])
46
+
(nl [2, 22] - [3, 0])))
59
47
subsection: (section [4, 0] - [16, 0]
60
48
headline: (headline [4, 0] - [5, 0]
61
49
stars: (stars [4, 0] - [4, 1])
62
50
item: (item [4, 2] - [4, 12]
63
-
(expr [4, 2] - [4, 6])
64
-
(expr [4, 7] - [4, 12])))
51
+
(str [4, 2] - [4, 6])
52
+
(str [4, 7] - [4, 12])))
65
53
plan: (plan [5, 0] - [6, 0]
66
54
(entry [5, 0] - [5, 16]
67
55
timestamp: (timestamp [5, 0] - [5, 16]
@@ -72,50 +60,55 @@ Parses as:
72
60
(listitem [7, 2] - [8, 0]
73
61
bullet: (bullet [7, 2] - [7, 3])
74
62
contents: (paragraph [7, 4] - [8, 0]
75
-
(expr [7, 4] - [7, 8])
76
-
(expr [7, 9] - [7, 10])))
63
+
(str [7, 4] - [7, 8])
64
+
(str [7, 9] - [7, 10])
65
+
(nl [7, 10] - [8, 0])))
77
66
(listitem [8, 2] - [11, 0]
78
67
bullet: (bullet [8, 2] - [8, 3])
79
68
checkbox: (checkbox [8, 4] - [8, 7]
80
-
status: (expr [8, 5] - [8, 6]))
69
+
status: (sym [8, 5] - [8, 6]))
81
70
contents: (paragraph [8, 8] - [9, 0]
82
-
(expr [8, 8] - [8, 12])
83
-
(expr [8, 13] - [8, 14]))
71
+
(str [8, 8] - [8, 12])
72
+
(str [8, 13] - [8, 14])
73
+
(nl [8, 14] - [9, 0]))
84
74
contents: (list [9, 0] - [11, 0]
85
75
(listitem [9, 4] - [10, 0]
86
76
bullet: (bullet [9, 4] - [9, 5])
87
77
checkbox: (checkbox [9, 6] - [9, 9])
88
78
contents: (paragraph [9, 10] - [10, 0]
89
-
(expr [9, 10] - [9, 14])
90
-
(expr [9, 15] - [9, 16])))
79
+
(str [9, 10] - [9, 14])
80
+
(str [9, 15] - [9, 16])
81
+
(nl [9, 16] - [10, 0])))
91
82
(listitem [10, 4] - [11, 0]
92
83
bullet: (bullet [10, 4] - [10, 5])
93
84
checkbox: (checkbox [10, 6] - [10, 9]
94
-
status: (expr [10, 7] - [10, 8]))
85
+
status: (str [10, 7] - [10, 8]))
95
86
contents: (paragraph [10, 10] - [11, 0]
96
-
(expr [10, 10] - [10, 14])
97
-
(expr [10, 15] - [10, 16])))))
87
+
(str [10, 10] - [10, 14])
88
+
(str [10, 15] - [10, 16])
89
+
(nl [10, 16] - [11, 0])))))
98
90
(listitem [11, 2] - [12, 0]
99
91
bullet: (bullet [11, 2] - [11, 3])
100
92
contents: (paragraph [11, 4] - [12, 0]
101
-
(expr [11, 4] - [11, 8])
102
-
(expr [11, 9] - [11, 10])))))
93
+
(str [11, 4] - [11, 8])
94
+
(str [11, 9] - [11, 10])
95
+
(nl [11, 10] - [12, 0])))))
103
96
subsection: (section [13, 0] - [16, 0]
104
97
headline: (headline [13, 0] - [14, 0]
105
98
stars: (stars [13, 0] - [13, 2])
106
99
item: (item [13, 3] - [13, 13]
107
-
(expr [13, 3] - [13, 13]))
100
+
(str [13, 3] - [13, 13]))
108
101
tags: (tag_list [13, 14] - [13, 19]
109
-
tag: (tag [13, 15] - [13, 18])))
102
+
tag: (tag [13, 15] - [13, 18]
103
+
(str [13, 15] - [13, 18]))))
110
104
body: (body [14, 0] - [16, 0]
111
105
(paragraph [15, 0] - [16, 0]
112
-
(expr [15, 0] - [15, 4]))))))
106
+
(str [15, 0] - [15, 4])
107
+
(nl [15, 4] - [16, 0]))))))
113
108
```
114
109
115
110
## Install
116
111
117
-
For manual install, use `make`.
118
-
119
112
For neovim, using `nvim-treesitter/nvim-treesitter`, add to your configuration:
0 commit comments