tree-sitter-beancount 2.0.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.clang-format +20 -0
- package/.envrc +1 -0
- package/.github/workflows/cicd.yml +30 -0
- package/.github/workflows/release.yml +72 -0
- package/CHANGELOG.md +31 -0
- package/Cargo.lock +59 -0
- package/Cargo.toml +26 -0
- package/README.md +5 -1
- package/binding.gyp +2 -1
- package/{src → bindings/node}/binding.cc +0 -0
- package/bindings/node/index.js +19 -0
- package/bindings/rust/build.rs +38 -0
- package/bindings/rust/lib.rs +52 -0
- package/flake.lock +67 -0
- package/flake.nix +123 -0
- package/grammar.js +238 -202
- package/package.json +6 -5
- package/shell.nix +13 -0
- package/src/grammar.json +569 -485
- package/src/node-types.json +465 -432
- package/src/parser.c +13350 -4930
- package/src/scanner.cc +163 -0
- package/src/tree_sitter/parser.h +73 -84
- package/test/corpus/arithmetic.txt +71 -53
- package/test/corpus/comment.txt +12 -17
- package/test/corpus/currencies.txt +10 -12
- package/test/corpus/entry_types.txt +17 -31
- package/test/corpus/markdown_orgmode.txt +60 -0
- package/test/corpus/metadata.txt +95 -104
- package/test/corpus/multi_line.txt +2 -4
- package/test/corpus/orgmode_sections.txt +53 -0
- package/test/corpus/parse_lots.txt +31 -87
- package/test/corpus/parser_links.txt +4 -6
- package/test/corpus/push_pop_meta.txt +5 -6
- package/test/corpus/transaction.txt +54 -47
- package/test/corpus/ugly_bugs.txt +4 -4
- package/index.js +0 -13
- package/tree-sitter-beancount.wasm +0 -0
package/test/corpus/comment.txt
CHANGED
|
@@ -6,7 +6,7 @@ comment
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
(file)
|
|
9
|
+
(file (comment))
|
|
10
10
|
|
|
11
11
|
===========================
|
|
12
12
|
comment before transaction
|
|
@@ -20,10 +20,10 @@ comment before transaction
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
22
|
(file
|
|
23
|
+
(comment)
|
|
23
24
|
(transaction
|
|
24
25
|
(date)
|
|
25
|
-
(
|
|
26
|
-
(postings
|
|
26
|
+
(txn)
|
|
27
27
|
(posting
|
|
28
28
|
(account)
|
|
29
29
|
(incomplete_amount
|
|
@@ -38,7 +38,6 @@ comment before transaction
|
|
|
38
38
|
(currency)
|
|
39
39
|
)
|
|
40
40
|
)
|
|
41
|
-
)
|
|
42
41
|
)
|
|
43
42
|
)
|
|
44
43
|
|
|
@@ -56,8 +55,7 @@ comment after transaction
|
|
|
56
55
|
(file
|
|
57
56
|
(transaction
|
|
58
57
|
(date)
|
|
59
|
-
(
|
|
60
|
-
(postings
|
|
58
|
+
(txn)
|
|
61
59
|
(posting
|
|
62
60
|
(account)
|
|
63
61
|
(incomplete_amount
|
|
@@ -72,7 +70,7 @@ comment after transaction
|
|
|
72
70
|
(currency)
|
|
73
71
|
)
|
|
74
72
|
)
|
|
75
|
-
|
|
73
|
+
(comment)
|
|
76
74
|
)
|
|
77
75
|
)
|
|
78
76
|
|
|
@@ -90,8 +88,7 @@ comment between posting
|
|
|
90
88
|
(file
|
|
91
89
|
(transaction
|
|
92
90
|
(date)
|
|
93
|
-
(
|
|
94
|
-
(postings
|
|
91
|
+
(txn)
|
|
95
92
|
(posting
|
|
96
93
|
(account)
|
|
97
94
|
(incomplete_amount
|
|
@@ -99,6 +96,7 @@ comment between posting
|
|
|
99
96
|
(currency)
|
|
100
97
|
)
|
|
101
98
|
)
|
|
99
|
+
(comment)
|
|
102
100
|
(posting
|
|
103
101
|
(account)
|
|
104
102
|
(incomplete_amount
|
|
@@ -106,7 +104,6 @@ comment between posting
|
|
|
106
104
|
(currency)
|
|
107
105
|
)
|
|
108
106
|
)
|
|
109
|
-
)
|
|
110
107
|
)
|
|
111
108
|
)
|
|
112
109
|
|
|
@@ -123,14 +120,14 @@ comment after posting
|
|
|
123
120
|
(file
|
|
124
121
|
(transaction
|
|
125
122
|
(date)
|
|
126
|
-
(
|
|
127
|
-
(postings
|
|
123
|
+
(txn)
|
|
128
124
|
(posting
|
|
129
125
|
(account)
|
|
130
126
|
(incomplete_amount
|
|
131
127
|
(number)
|
|
132
128
|
(currency)
|
|
133
129
|
)
|
|
130
|
+
(comment)
|
|
134
131
|
)
|
|
135
132
|
(posting
|
|
136
133
|
(account)
|
|
@@ -139,12 +136,11 @@ comment after posting
|
|
|
139
136
|
(currency)
|
|
140
137
|
)
|
|
141
138
|
)
|
|
142
|
-
)
|
|
143
139
|
)
|
|
144
140
|
)
|
|
145
141
|
|
|
146
142
|
================================
|
|
147
|
-
comment
|
|
143
|
+
comment after transaction start
|
|
148
144
|
================================
|
|
149
145
|
|
|
150
146
|
2015-06-07 * ; Hi
|
|
@@ -156,8 +152,8 @@ comment adter transaction start
|
|
|
156
152
|
(file
|
|
157
153
|
(transaction
|
|
158
154
|
(date)
|
|
159
|
-
(
|
|
160
|
-
(
|
|
155
|
+
(txn)
|
|
156
|
+
(comment)
|
|
161
157
|
(posting
|
|
162
158
|
(account)
|
|
163
159
|
(incomplete_amount
|
|
@@ -172,6 +168,5 @@ comment adter transaction start
|
|
|
172
168
|
(currency)
|
|
173
169
|
)
|
|
174
170
|
)
|
|
175
|
-
)
|
|
176
171
|
)
|
|
177
172
|
)
|
|
@@ -13,26 +13,27 @@ parse currencies
|
|
|
13
13
|
(open
|
|
14
14
|
(date)
|
|
15
15
|
(account)
|
|
16
|
-
(
|
|
16
|
+
(currency)
|
|
17
17
|
)
|
|
18
18
|
(open
|
|
19
19
|
(date)
|
|
20
20
|
(account)
|
|
21
|
-
(
|
|
21
|
+
(currency)
|
|
22
|
+
)
|
|
22
23
|
(open
|
|
23
24
|
(date)
|
|
24
25
|
(account)
|
|
25
|
-
(
|
|
26
|
+
(currency)
|
|
26
27
|
)
|
|
27
28
|
(open
|
|
28
29
|
(date)
|
|
29
30
|
(account)
|
|
30
|
-
(
|
|
31
|
+
(currency)
|
|
31
32
|
)
|
|
32
33
|
)
|
|
33
34
|
|
|
34
35
|
================================
|
|
35
|
-
|
|
36
|
+
different cost and price currency
|
|
36
37
|
================================
|
|
37
38
|
|
|
38
39
|
2018-03-21 * "Convert MR to KrisFlyer"
|
|
@@ -44,17 +45,15 @@ diffent cost and price currency
|
|
|
44
45
|
(file
|
|
45
46
|
(transaction
|
|
46
47
|
(date)
|
|
47
|
-
(
|
|
48
|
-
(
|
|
49
|
-
(postings
|
|
48
|
+
(txn)
|
|
49
|
+
(narration)
|
|
50
50
|
(posting
|
|
51
51
|
(account)
|
|
52
52
|
(incomplete_amount (unary_number_expr (minus) (number)) (currency))
|
|
53
53
|
(cost_spec
|
|
54
|
-
|
|
55
|
-
(cost_comp (compound_amout (number) (currency)))
|
|
56
|
-
)
|
|
54
|
+
(cost_comp (compound_amount (number) (currency)))
|
|
57
55
|
)
|
|
56
|
+
(at)
|
|
58
57
|
(price_annotation
|
|
59
58
|
(incomplete_amount (number) (currency))
|
|
60
59
|
)
|
|
@@ -63,6 +62,5 @@ diffent cost and price currency
|
|
|
63
62
|
(account)
|
|
64
63
|
(incomplete_amount (number) (currency))
|
|
65
64
|
)
|
|
66
|
-
)
|
|
67
65
|
)
|
|
68
66
|
)
|
|
@@ -11,9 +11,8 @@ entry transaction one string
|
|
|
11
11
|
(file
|
|
12
12
|
(transaction
|
|
13
13
|
(date)
|
|
14
|
-
(
|
|
15
|
-
(
|
|
16
|
-
(postings
|
|
14
|
+
(txn)
|
|
15
|
+
(narration)
|
|
17
16
|
(posting
|
|
18
17
|
(account)
|
|
19
18
|
(incomplete_amount
|
|
@@ -25,12 +24,11 @@ entry transaction one string
|
|
|
25
24
|
(account)
|
|
26
25
|
(incomplete_amount
|
|
27
26
|
(unary_number_expr
|
|
28
|
-
(number)
|
|
27
|
+
(minus) (number)
|
|
29
28
|
)
|
|
30
29
|
(currency)
|
|
31
30
|
)
|
|
32
31
|
)
|
|
33
|
-
)
|
|
34
32
|
)
|
|
35
33
|
)
|
|
36
34
|
|
|
@@ -47,9 +45,9 @@ entry transaction two string
|
|
|
47
45
|
(file
|
|
48
46
|
(transaction
|
|
49
47
|
(date)
|
|
50
|
-
(
|
|
51
|
-
(
|
|
52
|
-
(
|
|
48
|
+
(txn)
|
|
49
|
+
(payee)
|
|
50
|
+
(narration)
|
|
53
51
|
(posting
|
|
54
52
|
(account)
|
|
55
53
|
(incomplete_amount
|
|
@@ -61,12 +59,11 @@ entry transaction two string
|
|
|
61
59
|
(account)
|
|
62
60
|
(incomplete_amount
|
|
63
61
|
(unary_number_expr
|
|
64
|
-
(number)
|
|
62
|
+
(minus) (number)
|
|
65
63
|
)
|
|
66
64
|
(currency)
|
|
67
65
|
)
|
|
68
66
|
)
|
|
69
|
-
)
|
|
70
67
|
)
|
|
71
68
|
)
|
|
72
69
|
|
|
@@ -83,9 +80,8 @@ entry transaction with txn keyword
|
|
|
83
80
|
(file
|
|
84
81
|
(transaction
|
|
85
82
|
(date)
|
|
86
|
-
(
|
|
87
|
-
(
|
|
88
|
-
(postings
|
|
83
|
+
(txn)
|
|
84
|
+
(narration)
|
|
89
85
|
(posting
|
|
90
86
|
(account)
|
|
91
87
|
(incomplete_amount
|
|
@@ -97,12 +93,11 @@ entry transaction with txn keyword
|
|
|
97
93
|
(account)
|
|
98
94
|
(incomplete_amount
|
|
99
95
|
(unary_number_expr
|
|
100
|
-
(number)
|
|
96
|
+
(minus) (number)
|
|
101
97
|
)
|
|
102
98
|
(currency)
|
|
103
99
|
)
|
|
104
100
|
)
|
|
105
|
-
)
|
|
106
101
|
)
|
|
107
102
|
)
|
|
108
103
|
|
|
@@ -118,7 +113,7 @@ entry balance
|
|
|
118
113
|
(balance
|
|
119
114
|
(date)
|
|
120
115
|
(account)
|
|
121
|
-
(
|
|
116
|
+
(amount_tolerance
|
|
122
117
|
(number)
|
|
123
118
|
(currency)
|
|
124
119
|
)
|
|
@@ -137,7 +132,7 @@ entry balnce 2
|
|
|
137
132
|
(balance
|
|
138
133
|
(date)
|
|
139
134
|
(account)
|
|
140
|
-
(
|
|
135
|
+
(amount_tolerance
|
|
141
136
|
(number)
|
|
142
137
|
(number)
|
|
143
138
|
(currency)
|
|
@@ -172,9 +167,7 @@ entry open 2
|
|
|
172
167
|
(open
|
|
173
168
|
(date)
|
|
174
169
|
(account)
|
|
175
|
-
(currency_list
|
|
176
170
|
(currency)
|
|
177
|
-
)
|
|
178
171
|
)
|
|
179
172
|
)
|
|
180
173
|
|
|
@@ -190,11 +183,9 @@ entry open 3
|
|
|
190
183
|
(open
|
|
191
184
|
(date)
|
|
192
185
|
(account)
|
|
193
|
-
(currency_list
|
|
194
186
|
(currency)
|
|
195
187
|
(currency)
|
|
196
188
|
(currency)
|
|
197
|
-
)
|
|
198
189
|
)
|
|
199
190
|
)
|
|
200
191
|
|
|
@@ -210,9 +201,7 @@ entry open 4
|
|
|
210
201
|
(open
|
|
211
202
|
(date)
|
|
212
203
|
(account)
|
|
213
|
-
(currency_list
|
|
214
204
|
(currency)
|
|
215
|
-
)
|
|
216
205
|
(opt_booking (string))
|
|
217
206
|
)
|
|
218
207
|
)
|
|
@@ -390,14 +379,11 @@ entry custom
|
|
|
390
379
|
(custom
|
|
391
380
|
(date)
|
|
392
381
|
(string)
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
(number)
|
|
398
|
-
(currency)
|
|
399
|
-
)
|
|
400
|
-
(number)
|
|
382
|
+
(custom_value (string))
|
|
383
|
+
(custom_value (date))
|
|
384
|
+
(custom_value (bool))
|
|
385
|
+
(custom_value (amount (number) (currency)))
|
|
386
|
+
(custom_value (number))
|
|
401
387
|
)
|
|
402
388
|
)
|
|
403
389
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
==============
|
|
2
|
+
orgmode heading
|
|
3
|
+
==============
|
|
4
|
+
|
|
5
|
+
* TITLE
|
|
6
|
+
|
|
7
|
+
2014-04-20 * "Money from CC" ^610fa7f17e7a #trip
|
|
8
|
+
Expenses:Restaurant 100 USD
|
|
9
|
+
Assets:US:Cash -100 USD
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
(file
|
|
14
|
+
(section (headline (item))
|
|
15
|
+
(transaction
|
|
16
|
+
(date)
|
|
17
|
+
(txn)
|
|
18
|
+
(narration)
|
|
19
|
+
(tags_links (link) (tag))
|
|
20
|
+
(posting
|
|
21
|
+
(account)
|
|
22
|
+
(incomplete_amount (number) (currency))
|
|
23
|
+
)
|
|
24
|
+
(posting
|
|
25
|
+
(account)
|
|
26
|
+
(incomplete_amount (unary_number_expr (minus) (number)) (currency))
|
|
27
|
+
)
|
|
28
|
+
)
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
==============
|
|
33
|
+
orgmode subheading
|
|
34
|
+
==============
|
|
35
|
+
|
|
36
|
+
****** TITLE
|
|
37
|
+
2014-04-20 * "Money from CC" ^610fa7f17e7a #trip
|
|
38
|
+
Expenses:Restaurant 100 USD
|
|
39
|
+
Assets:US:Cash -100 USD
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
(file
|
|
44
|
+
(section (headline (item))
|
|
45
|
+
(transaction
|
|
46
|
+
(date)
|
|
47
|
+
(txn)
|
|
48
|
+
(narration)
|
|
49
|
+
(tags_links (link) (tag))
|
|
50
|
+
(posting
|
|
51
|
+
(account)
|
|
52
|
+
(incomplete_amount (number) (currency))
|
|
53
|
+
)
|
|
54
|
+
(posting
|
|
55
|
+
(account)
|
|
56
|
+
(incomplete_amount (unary_number_expr (minus) (number)) (currency))
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
)
|