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/metadata.txt
CHANGED
|
@@ -12,20 +12,20 @@ metadata begin
|
|
|
12
12
|
(file
|
|
13
13
|
(transaction
|
|
14
14
|
(date)
|
|
15
|
-
(
|
|
16
|
-
(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
(txn)
|
|
16
|
+
(narration)
|
|
17
|
+
(key_value
|
|
18
|
+
(key)
|
|
19
|
+
(value (string))
|
|
20
|
+
)
|
|
21
21
|
(posting
|
|
22
22
|
(account)
|
|
23
23
|
(incomplete_amount
|
|
24
24
|
(number)
|
|
25
25
|
(currency)
|
|
26
26
|
)
|
|
27
|
+
(atat)
|
|
27
28
|
(price_annotation
|
|
28
|
-
(atat)
|
|
29
29
|
(incomplete_amount
|
|
30
30
|
(number)
|
|
31
31
|
(currency)
|
|
@@ -41,7 +41,6 @@ metadata begin
|
|
|
41
41
|
(currency)
|
|
42
42
|
)
|
|
43
43
|
)
|
|
44
|
-
)
|
|
45
44
|
)
|
|
46
45
|
)
|
|
47
46
|
|
|
@@ -59,25 +58,25 @@ metadata middle
|
|
|
59
58
|
(file
|
|
60
59
|
(transaction
|
|
61
60
|
(date)
|
|
62
|
-
(
|
|
63
|
-
(
|
|
64
|
-
(postings
|
|
61
|
+
(txn)
|
|
62
|
+
(narration)
|
|
65
63
|
(posting
|
|
66
64
|
(account)
|
|
67
65
|
(incomplete_amount
|
|
68
66
|
(number)
|
|
69
67
|
(currency)
|
|
70
68
|
)
|
|
69
|
+
(atat)
|
|
71
70
|
(price_annotation
|
|
72
|
-
(atat)
|
|
73
71
|
(incomplete_amount
|
|
74
72
|
(number)
|
|
75
73
|
(currency)
|
|
76
74
|
)
|
|
77
75
|
)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
)
|
|
76
|
+
)
|
|
77
|
+
(key_value
|
|
78
|
+
(key)
|
|
79
|
+
(value (string))
|
|
81
80
|
)
|
|
82
81
|
(posting
|
|
83
82
|
(account)
|
|
@@ -88,7 +87,6 @@ metadata middle
|
|
|
88
87
|
(currency)
|
|
89
88
|
)
|
|
90
89
|
)
|
|
91
|
-
)
|
|
92
90
|
)
|
|
93
91
|
)
|
|
94
92
|
|
|
@@ -106,17 +104,16 @@ metadata end
|
|
|
106
104
|
(file
|
|
107
105
|
(transaction
|
|
108
106
|
(date)
|
|
109
|
-
(
|
|
110
|
-
(
|
|
111
|
-
(postings
|
|
107
|
+
(txn)
|
|
108
|
+
(narration)
|
|
112
109
|
(posting
|
|
113
110
|
(account)
|
|
114
111
|
(incomplete_amount
|
|
115
112
|
(number)
|
|
116
113
|
(currency)
|
|
117
114
|
)
|
|
115
|
+
(atat)
|
|
118
116
|
(price_annotation
|
|
119
|
-
(atat)
|
|
120
117
|
(incomplete_amount
|
|
121
118
|
(number)
|
|
122
119
|
(currency)
|
|
@@ -131,11 +128,11 @@ metadata end
|
|
|
131
128
|
)
|
|
132
129
|
(currency)
|
|
133
130
|
)
|
|
134
|
-
(metadata
|
|
135
|
-
(key_value (key) (string))
|
|
136
|
-
)
|
|
137
131
|
)
|
|
138
|
-
|
|
132
|
+
(key_value
|
|
133
|
+
(key)
|
|
134
|
+
(value (string))
|
|
135
|
+
)
|
|
139
136
|
)
|
|
140
137
|
)
|
|
141
138
|
|
|
@@ -157,29 +154,33 @@ metadata many
|
|
|
157
154
|
(file
|
|
158
155
|
(transaction
|
|
159
156
|
(date)
|
|
160
|
-
(
|
|
161
|
-
(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
157
|
+
(txn)
|
|
158
|
+
(narration)
|
|
159
|
+
(key_value
|
|
160
|
+
(key)
|
|
161
|
+
(value (string))
|
|
162
|
+
)
|
|
166
163
|
(posting
|
|
167
164
|
(account)
|
|
168
165
|
(incomplete_amount
|
|
169
166
|
(number)
|
|
170
167
|
(currency)
|
|
171
168
|
)
|
|
169
|
+
(atat)
|
|
172
170
|
(price_annotation
|
|
173
|
-
(atat)
|
|
174
171
|
(incomplete_amount
|
|
175
172
|
(number)
|
|
176
173
|
(currency)
|
|
177
174
|
)
|
|
178
175
|
)
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
)
|
|
176
|
+
)
|
|
177
|
+
(key_value
|
|
178
|
+
(key)
|
|
179
|
+
(value (string))
|
|
180
|
+
)
|
|
181
|
+
(key_value
|
|
182
|
+
(key)
|
|
183
|
+
(value (string))
|
|
183
184
|
)
|
|
184
185
|
(posting
|
|
185
186
|
(account)
|
|
@@ -189,12 +190,15 @@ metadata many
|
|
|
189
190
|
)
|
|
190
191
|
(currency)
|
|
191
192
|
)
|
|
192
|
-
(metadata
|
|
193
|
-
(key_value (key) (string))
|
|
194
|
-
(key_value (key) (string))
|
|
195
|
-
)
|
|
196
193
|
)
|
|
197
|
-
|
|
194
|
+
(key_value
|
|
195
|
+
(key)
|
|
196
|
+
(value (string))
|
|
197
|
+
)
|
|
198
|
+
(key_value
|
|
199
|
+
(key)
|
|
200
|
+
(value (string))
|
|
201
|
+
)
|
|
198
202
|
)
|
|
199
203
|
)
|
|
200
204
|
|
|
@@ -217,29 +221,30 @@ metadata indented
|
|
|
217
221
|
(file
|
|
218
222
|
(transaction
|
|
219
223
|
(date)
|
|
220
|
-
(
|
|
221
|
-
(
|
|
222
|
-
|
|
223
|
-
(key_value (key) (string))
|
|
224
|
-
)
|
|
225
|
-
(postings
|
|
224
|
+
(txn)
|
|
225
|
+
(narration)
|
|
226
|
+
(key_value (key) (value (string)))
|
|
226
227
|
(posting
|
|
227
228
|
(account)
|
|
228
229
|
(incomplete_amount
|
|
229
230
|
(number)
|
|
230
231
|
(currency)
|
|
231
232
|
)
|
|
233
|
+
(atat)
|
|
232
234
|
(price_annotation
|
|
233
|
-
(atat)
|
|
234
235
|
(incomplete_amount
|
|
235
236
|
(number)
|
|
236
237
|
(currency)
|
|
237
238
|
)
|
|
238
239
|
)
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
)
|
|
240
|
+
)
|
|
241
|
+
(key_value
|
|
242
|
+
(key)
|
|
243
|
+
(value (string))
|
|
244
|
+
)
|
|
245
|
+
(key_value
|
|
246
|
+
(key)
|
|
247
|
+
(value (string))
|
|
243
248
|
)
|
|
244
249
|
(posting
|
|
245
250
|
(account)
|
|
@@ -249,13 +254,19 @@ metadata indented
|
|
|
249
254
|
)
|
|
250
255
|
(currency)
|
|
251
256
|
)
|
|
252
|
-
(metadata
|
|
253
|
-
(key_value (key) (string))
|
|
254
|
-
(key_value (key) (string))
|
|
255
|
-
(key_value (key) (string))
|
|
256
|
-
)
|
|
257
257
|
)
|
|
258
|
-
|
|
258
|
+
(key_value
|
|
259
|
+
(key)
|
|
260
|
+
(value (string))
|
|
261
|
+
)
|
|
262
|
+
(key_value
|
|
263
|
+
(key)
|
|
264
|
+
(value (string))
|
|
265
|
+
)
|
|
266
|
+
(key_value
|
|
267
|
+
(key)
|
|
268
|
+
(value (string))
|
|
269
|
+
)
|
|
259
270
|
)
|
|
260
271
|
)
|
|
261
272
|
|
|
@@ -292,60 +303,46 @@ metadata other
|
|
|
292
303
|
(open
|
|
293
304
|
(date)
|
|
294
305
|
(account)
|
|
295
|
-
|
|
296
|
-
(key_value (key) (string))
|
|
297
|
-
(key_value (key) (string))
|
|
298
|
-
)
|
|
306
|
+
(key_value (key) (value (string)))
|
|
307
|
+
(key_value (key) (value (string)))
|
|
299
308
|
)
|
|
300
309
|
(close
|
|
301
310
|
(date)
|
|
302
311
|
(account)
|
|
303
|
-
|
|
304
|
-
(key_value (key) (string))
|
|
305
|
-
)
|
|
312
|
+
(key_value (key) (value (string)))
|
|
306
313
|
)
|
|
307
314
|
(note
|
|
308
315
|
(date)
|
|
309
316
|
(account)
|
|
310
317
|
(string)
|
|
311
|
-
|
|
312
|
-
(key_value (key) (string))
|
|
313
|
-
)
|
|
318
|
+
(key_value (key) (value (string)))
|
|
314
319
|
)
|
|
315
320
|
(pad
|
|
316
321
|
(date)
|
|
317
322
|
(account)
|
|
318
323
|
(account)
|
|
319
|
-
|
|
320
|
-
(key_value (key) (string))
|
|
321
|
-
)
|
|
324
|
+
(key_value (key) (value (string)))
|
|
322
325
|
)
|
|
323
326
|
(balance
|
|
324
327
|
(date)
|
|
325
328
|
(account)
|
|
326
|
-
(
|
|
329
|
+
(amount_tolerance
|
|
327
330
|
(number)
|
|
328
331
|
(currency)
|
|
329
332
|
)
|
|
330
|
-
|
|
331
|
-
(key_value (key) (string))
|
|
332
|
-
)
|
|
333
|
+
(key_value (key) (value (string)))
|
|
333
334
|
)
|
|
334
335
|
(event
|
|
335
336
|
(date)
|
|
336
337
|
(string)
|
|
337
338
|
(string)
|
|
338
|
-
|
|
339
|
-
(key_value (key) (string))
|
|
340
|
-
)
|
|
339
|
+
(key_value (key) (value (string)))
|
|
341
340
|
)
|
|
342
341
|
(document
|
|
343
342
|
(date)
|
|
344
343
|
(account)
|
|
345
344
|
(filename (string))
|
|
346
|
-
|
|
347
|
-
(key_value (key) (string))
|
|
348
|
-
)
|
|
345
|
+
(key_value (key) (value (string)))
|
|
349
346
|
)
|
|
350
347
|
(price
|
|
351
348
|
(date)
|
|
@@ -354,9 +351,7 @@ metadata other
|
|
|
354
351
|
(number)
|
|
355
352
|
(currency)
|
|
356
353
|
)
|
|
357
|
-
|
|
358
|
-
(key_value (key) (string))
|
|
359
|
-
)
|
|
354
|
+
(key_value (key) (value (string)))
|
|
360
355
|
)
|
|
361
356
|
)
|
|
362
357
|
|
|
@@ -380,19 +375,17 @@ metadata datatypes
|
|
|
380
375
|
(file
|
|
381
376
|
(transaction
|
|
382
377
|
(date)
|
|
383
|
-
(
|
|
384
|
-
(
|
|
385
|
-
|
|
386
|
-
(key_value (key) (
|
|
387
|
-
(key_value (key) (
|
|
388
|
-
(key_value (key) (
|
|
389
|
-
(key_value (key) (
|
|
390
|
-
(key_value (key) (
|
|
391
|
-
(key_value (key) (number))
|
|
392
|
-
(key_value (key) (
|
|
393
|
-
(key_value (key) (bool))
|
|
394
|
-
(key_value (key) (bool))
|
|
395
|
-
)
|
|
378
|
+
(txn)
|
|
379
|
+
(narration)
|
|
380
|
+
(key_value (key) (value (string)))
|
|
381
|
+
(key_value (key) (value (account)))
|
|
382
|
+
(key_value (key) (value (date)))
|
|
383
|
+
(key_value (key) (value (currency)))
|
|
384
|
+
(key_value (key) (value (tag)))
|
|
385
|
+
(key_value (key) (value (number)))
|
|
386
|
+
(key_value (key) (value (amount (number) (currency))))
|
|
387
|
+
(key_value (key) (value (bool)))
|
|
388
|
+
(key_value (key) (value (bool)))
|
|
396
389
|
)
|
|
397
390
|
)
|
|
398
391
|
|
|
@@ -411,13 +404,11 @@ metadata key syntax
|
|
|
411
404
|
(file
|
|
412
405
|
(transaction
|
|
413
406
|
(date)
|
|
414
|
-
(
|
|
415
|
-
(
|
|
416
|
-
|
|
417
|
-
(key_value (key) (string))
|
|
418
|
-
(key_value (key) (string))
|
|
419
|
-
(key_value (key) (string))
|
|
420
|
-
(key_value (key) (string))
|
|
421
|
-
)
|
|
407
|
+
(txn)
|
|
408
|
+
(narration)
|
|
409
|
+
(key_value (key) (value (string)))
|
|
410
|
+
(key_value (key) (value (string)))
|
|
411
|
+
(key_value (key) (value (string)))
|
|
412
|
+
(key_value (key) (value (string)))
|
|
422
413
|
)
|
|
423
414
|
)
|
|
@@ -13,9 +13,8 @@ and why not another!"
|
|
|
13
13
|
(file
|
|
14
14
|
(transaction
|
|
15
15
|
(date)
|
|
16
|
-
(
|
|
17
|
-
(
|
|
18
|
-
(postings
|
|
16
|
+
(txn)
|
|
17
|
+
(narration)
|
|
19
18
|
(posting
|
|
20
19
|
(account)
|
|
21
20
|
(incomplete_amount (number) (currency))
|
|
@@ -24,6 +23,5 @@ and why not another!"
|
|
|
24
23
|
(account)
|
|
25
24
|
(incomplete_amount (unary_number_expr (minus) (number)) (currency))
|
|
26
25
|
)
|
|
27
|
-
)
|
|
28
26
|
)
|
|
29
27
|
)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
==============
|
|
2
|
+
1 orgmode heading
|
|
3
|
+
==============
|
|
4
|
+
|
|
5
|
+
* Title
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
(file
|
|
9
|
+
(section
|
|
10
|
+
(headline (item))
|
|
11
|
+
)
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
==============
|
|
15
|
+
2 orgmode heading
|
|
16
|
+
==============
|
|
17
|
+
|
|
18
|
+
* Title
|
|
19
|
+
|
|
20
|
+
* B
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
(file
|
|
24
|
+
(section
|
|
25
|
+
(headline (item))
|
|
26
|
+
)
|
|
27
|
+
(section
|
|
28
|
+
(headline (item))
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
==============
|
|
33
|
+
orgmode heading in different levels
|
|
34
|
+
==============
|
|
35
|
+
|
|
36
|
+
* Title
|
|
37
|
+
|
|
38
|
+
** Title
|
|
39
|
+
|
|
40
|
+
*** Title
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
(file
|
|
44
|
+
(section
|
|
45
|
+
(headline (item))
|
|
46
|
+
(section
|
|
47
|
+
(headline (item))
|
|
48
|
+
(section
|
|
49
|
+
(headline (item))
|
|
50
|
+
)
|
|
51
|
+
)
|
|
52
|
+
)
|
|
53
|
+
)
|