tree-sitter-beancount 2.0.0 → 2.1.0
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 +15 -0
- package/Cargo.toml +26 -0
- 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 +40 -0
- package/bindings/rust/lib.rs +52 -0
- package/flake.lock +67 -0
- package/flake.nix +123 -0
- package/grammar.js +167 -111
- package/package.json +6 -5
- package/shell.nix +13 -0
- package/src/grammar.json +472 -54
- package/src/node-types.json +306 -156
- package/src/parser.c +11779 -4344
- package/src/scanner.cc +163 -0
- package/src/tree_sitter/parser.h +73 -84
- package/test/corpus/arithmetic.txt +77 -36
- package/test/corpus/comment.txt +17 -12
- package/test/corpus/currencies.txt +9 -5
- package/test/corpus/entry_types.txt +17 -18
- package/test/corpus/markdown_orgmode.txt +64 -0
- package/test/corpus/metadata.txt +90 -82
- package/test/corpus/multi_line.txt +2 -2
- package/test/corpus/orgmode_sections.txt +53 -0
- package/test/corpus/parse_lots.txt +80 -42
- package/test/corpus/parser_links.txt +4 -4
- package/test/corpus/push_pop_meta.txt +4 -3
- package/test/corpus/transaction.txt +53 -24
- package/test/corpus/ugly_bugs.txt +4 -2
- package/index.js +0 -13
- package/tree-sitter-beancount.wasm +0 -0
package/grammar.js
CHANGED
|
@@ -3,64 +3,108 @@ module.exports = grammar({
|
|
|
3
3
|
* From beancount grammar.y
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
name:
|
|
6
|
+
name: "beancount",
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// Ensure we don't extract keywords from tokens
|
|
9
|
+
//word: ($) => $.identifier,
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
inline: ($) => [
|
|
12
|
+
],
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
conflicts: ($) => [
|
|
15
|
+
],
|
|
16
|
+
|
|
17
|
+
externals: ($) => [
|
|
18
|
+
$._stars,
|
|
19
|
+
$._sectionend,
|
|
20
|
+
$._eof, // Basically just '\0', but allows multiple to be matched
|
|
21
|
+
],
|
|
22
|
+
|
|
23
|
+
extras: ($) => [
|
|
24
|
+
/( |\r|\t)+/,
|
|
25
|
+
],
|
|
14
26
|
|
|
15
27
|
rules: {
|
|
28
|
+
file: $ => repeat(
|
|
29
|
+
choice(
|
|
30
|
+
$.section,
|
|
31
|
+
$._declarations,
|
|
32
|
+
$._nl,
|
|
33
|
+
)
|
|
34
|
+
),
|
|
35
|
+
|
|
36
|
+
_nl: _ => choice('\n', '\r'),
|
|
37
|
+
_eol: $ => choice('\n', '\r', $._eof),
|
|
38
|
+
_any: $ => /.*/,
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
* Org Header Sections
|
|
43
|
+
*/
|
|
44
|
+
section: $ => seq(
|
|
45
|
+
field('headline', $.headline),
|
|
46
|
+
repeat(choice(
|
|
47
|
+
$._declarations,
|
|
48
|
+
$._nl
|
|
49
|
+
)),
|
|
50
|
+
repeat(field('subsection', $.section)),
|
|
51
|
+
$._sectionend
|
|
52
|
+
),
|
|
53
|
+
_org_stars: $ => seq($._stars, /\*+/),
|
|
54
|
+
headline: $ => seq(
|
|
55
|
+
$._org_stars,
|
|
56
|
+
/[ \t]+/, // so it's not part of (item)
|
|
57
|
+
optional(field('item', $.item)),
|
|
58
|
+
$._nl,
|
|
59
|
+
),
|
|
60
|
+
item: $ => $._any,
|
|
16
61
|
|
|
17
|
-
file: $ => repeat($._declarations),
|
|
18
62
|
|
|
19
63
|
/* Types for terminal symbols */
|
|
20
|
-
_indent:
|
|
21
|
-
_eol:
|
|
22
|
-
_pipe:
|
|
23
|
-
atat:
|
|
24
|
-
at:
|
|
64
|
+
_indent: $ => token(/[ \r\t]+/),
|
|
65
|
+
_eol: $ => token(/\n/),
|
|
66
|
+
_pipe: $ => token('|'),
|
|
67
|
+
atat: $ => token('@@'),
|
|
68
|
+
at: $ => token('@'),
|
|
25
69
|
lcurllcurl: $ => token('{{'),
|
|
26
70
|
rcurlrcurl: $ => token('}}'),
|
|
27
|
-
lcurl:
|
|
28
|
-
rcurl:
|
|
29
|
-
_equal:
|
|
30
|
-
_comma:
|
|
31
|
-
_tilde:
|
|
32
|
-
_hash:
|
|
33
|
-
asterisk:
|
|
34
|
-
slash:
|
|
35
|
-
_colon:
|
|
36
|
-
plus:
|
|
37
|
-
minus:
|
|
38
|
-
_lparen:
|
|
39
|
-
_rparen:
|
|
40
|
-
flag:
|
|
41
|
-
TXN:
|
|
42
|
-
BALANCE:
|
|
43
|
-
OPEN:
|
|
44
|
-
CLOSE:
|
|
45
|
-
COMMODITY:
|
|
46
|
-
PAD:
|
|
47
|
-
EVENT:
|
|
48
|
-
PRICE:
|
|
49
|
-
NOTE:
|
|
50
|
-
DOCUMENT:
|
|
51
|
-
QUERY:
|
|
52
|
-
CUSTOM:
|
|
53
|
-
PUSHTAG:
|
|
54
|
-
POPTAG:
|
|
55
|
-
PUSHMETA:
|
|
56
|
-
POPMETA:
|
|
57
|
-
OPTION:
|
|
58
|
-
INCLUDE:
|
|
59
|
-
PLUGIN:
|
|
60
|
-
_none:
|
|
61
|
-
bool:
|
|
62
|
-
date:
|
|
63
|
-
account:
|
|
71
|
+
lcurl: $ => token('{'),
|
|
72
|
+
rcurl: $ => token('}'),
|
|
73
|
+
_equal: $ => token('='),
|
|
74
|
+
_comma: $ => token(','),
|
|
75
|
+
_tilde: $ => token('~'),
|
|
76
|
+
_hash: $ => token('#'),
|
|
77
|
+
asterisk: $ => token('*'),
|
|
78
|
+
slash: $ => token('/'),
|
|
79
|
+
_colon: $ => token(':'),
|
|
80
|
+
plus: $ => token('+'),
|
|
81
|
+
minus: $ => token('-'),
|
|
82
|
+
_lparen: $ => token('('),
|
|
83
|
+
_rparen: $ => token(')'),
|
|
84
|
+
flag: $ => token(/[!&?%PSTCURM*#]/),
|
|
85
|
+
TXN: $ => token('txn'),
|
|
86
|
+
BALANCE: $ => token('balance'),
|
|
87
|
+
OPEN: $ => token('open'),
|
|
88
|
+
CLOSE: $ => token('close'),
|
|
89
|
+
COMMODITY: $ => token('commodity'),
|
|
90
|
+
PAD: $ => token('pad'),
|
|
91
|
+
EVENT: $ => token('event'),
|
|
92
|
+
PRICE: $ => token('price'),
|
|
93
|
+
NOTE: $ => token('note'),
|
|
94
|
+
DOCUMENT: $ => token('document'),
|
|
95
|
+
QUERY: $ => token('query'),
|
|
96
|
+
CUSTOM: $ => token('custom'),
|
|
97
|
+
PUSHTAG: $ => token('pushtag'),
|
|
98
|
+
POPTAG: $ => token('poptag'),
|
|
99
|
+
PUSHMETA: $ => token('pushmeta'),
|
|
100
|
+
POPMETA: $ => token('popmeta'),
|
|
101
|
+
OPTION: $ => token('option'),
|
|
102
|
+
INCLUDE: $ => token('include'),
|
|
103
|
+
PLUGIN: $ => token('plugin'),
|
|
104
|
+
_none: $ => token('NULL'),
|
|
105
|
+
bool: $ => token(/TRUE|FALSE/),
|
|
106
|
+
date: $ => token(/([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))/),
|
|
107
|
+
account: $ =>
|
|
64
108
|
token(
|
|
65
109
|
seq(
|
|
66
110
|
/[A-Z]|[^\x00-\x7F]/,
|
|
@@ -74,20 +118,20 @@ module.exports = grammar({
|
|
|
74
118
|
),
|
|
75
119
|
),
|
|
76
120
|
),
|
|
77
|
-
currency:
|
|
78
|
-
string:
|
|
79
|
-
number:
|
|
80
|
-
tag:
|
|
81
|
-
link:
|
|
82
|
-
key:
|
|
121
|
+
currency: $ => token(/[A-Z][A-Z0-9\'\._\-]{0,22}[A-Z0-9]/),
|
|
122
|
+
string: $ => token(/"[^"]*"/),
|
|
123
|
+
number: $ => token(/([0-9]+|[0-9][0-9,]+[0-9])(\.[0-9]*)?/),
|
|
124
|
+
tag: $ => token(/#[A-Za-z0-9\-_/.]+/),
|
|
125
|
+
link: $ => token(/\^[A-Za-z0-9\-_/.]+/),
|
|
126
|
+
key: $ => token(/[a-z][a-zA-Z0-9\-_]+/),
|
|
83
127
|
|
|
84
128
|
/* Operator precedence.
|
|
85
129
|
* This is pulled straight out of the textbook example:
|
|
86
130
|
* https://www.gnu.org/software/bison/manual/html_node/Infix-Calc.html#Infix-Calc
|
|
87
131
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
132
|
+
// %left MINUS PLUS
|
|
133
|
+
// %left ASTERISK SLASH
|
|
134
|
+
// %precedence NEGATIVE /* negation--unary minus */
|
|
91
135
|
|
|
92
136
|
// Start symbol: file
|
|
93
137
|
/* We have some number of expected shift/reduce conflicts at 'eol'. */
|
|
@@ -133,16 +177,16 @@ module.exports = grammar({
|
|
|
133
177
|
prec(3,
|
|
134
178
|
choice(
|
|
135
179
|
prec.left(1,
|
|
136
|
-
seq(
|
|
180
|
+
seq($._number_expr, $.plus, $._number_expr),
|
|
137
181
|
),
|
|
138
182
|
prec.left(1,
|
|
139
|
-
seq(
|
|
183
|
+
seq($._number_expr, $.minus, $._number_expr),
|
|
140
184
|
),
|
|
141
185
|
prec.left(2,
|
|
142
|
-
seq(
|
|
186
|
+
seq($._number_expr, $.asterisk, $._number_expr),
|
|
143
187
|
),
|
|
144
188
|
prec.left(2,
|
|
145
|
-
seq(
|
|
189
|
+
seq($._number_expr, $.slash, $._number_expr),
|
|
146
190
|
),
|
|
147
191
|
),
|
|
148
192
|
),
|
|
@@ -158,11 +202,11 @@ module.exports = grammar({
|
|
|
158
202
|
tags_links: $ =>
|
|
159
203
|
repeat1(
|
|
160
204
|
//seq(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
205
|
+
// optional($._indent),
|
|
206
|
+
choice(
|
|
207
|
+
$.link,
|
|
208
|
+
$.tag,
|
|
209
|
+
),
|
|
166
210
|
//),
|
|
167
211
|
),
|
|
168
212
|
|
|
@@ -172,6 +216,7 @@ module.exports = grammar({
|
|
|
172
216
|
field("txn", $.txn),
|
|
173
217
|
field("txn_strings", optional($.txn_strings)),
|
|
174
218
|
field("tags_links", optional($.tags_links)),
|
|
219
|
+
field("comment", optional($.comment)),
|
|
175
220
|
$._eol,
|
|
176
221
|
field("posting_or_kv_list", optional($.posting_or_kv_list)),
|
|
177
222
|
),
|
|
@@ -185,16 +230,16 @@ module.exports = grammar({
|
|
|
185
230
|
),
|
|
186
231
|
|
|
187
232
|
price_annotation: $ => $.incomplete_amount,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
233
|
+
//choice(
|
|
234
|
+
// seq(
|
|
235
|
+
// $.atat,
|
|
236
|
+
// $.incomplete_amount
|
|
237
|
+
// ),
|
|
238
|
+
// seq(
|
|
239
|
+
// $.at,
|
|
240
|
+
// $.incomplete_amount
|
|
241
|
+
// )
|
|
242
|
+
//),
|
|
198
243
|
|
|
199
244
|
//account: $ => $.ACCOUNT,
|
|
200
245
|
|
|
@@ -206,6 +251,7 @@ module.exports = grammar({
|
|
|
206
251
|
field("account", $.account),
|
|
207
252
|
field("amount", optional($.incomplete_amount)),
|
|
208
253
|
field("cost_spec", optional($.cost_spec)),
|
|
254
|
+
field("comment", optional($.comment)),
|
|
209
255
|
$._eol
|
|
210
256
|
),
|
|
211
257
|
seq(
|
|
@@ -216,6 +262,7 @@ module.exports = grammar({
|
|
|
216
262
|
field("cost_spec", optional($.cost_spec)),
|
|
217
263
|
$.at,
|
|
218
264
|
field("price_annotation", optional($.price_annotation)),
|
|
265
|
+
field("comment", optional($.comment)),
|
|
219
266
|
$._eol
|
|
220
267
|
),
|
|
221
268
|
seq(
|
|
@@ -226,6 +273,7 @@ module.exports = grammar({
|
|
|
226
273
|
field("cost_spec", optional($.cost_spec)),
|
|
227
274
|
$.atat,
|
|
228
275
|
field("price_annotation", optional($.price_annotation)),
|
|
276
|
+
field("comment", optional($.comment)),
|
|
229
277
|
$._eol
|
|
230
278
|
),
|
|
231
279
|
seq(
|
|
@@ -233,6 +281,7 @@ module.exports = grammar({
|
|
|
233
281
|
field("optflag", optional($.optflag)),
|
|
234
282
|
field("account", $.account),
|
|
235
283
|
field("amount", optional($.incomplete_amount)),
|
|
284
|
+
field("comment", optional($.comment)),
|
|
236
285
|
$._eol
|
|
237
286
|
)
|
|
238
287
|
),
|
|
@@ -278,11 +327,12 @@ module.exports = grammar({
|
|
|
278
327
|
$._eol
|
|
279
328
|
),
|
|
280
329
|
$.key_value_line,
|
|
281
|
-
$.posting
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
330
|
+
$.posting,
|
|
331
|
+
seq(
|
|
332
|
+
$._indent,
|
|
333
|
+
$.comment,
|
|
334
|
+
$._eol
|
|
335
|
+
)
|
|
286
336
|
)
|
|
287
337
|
),
|
|
288
338
|
|
|
@@ -313,25 +363,25 @@ module.exports = grammar({
|
|
|
313
363
|
),
|
|
314
364
|
|
|
315
365
|
pushtag: $ => seq(
|
|
316
|
-
$.PUSHTAG,
|
|
366
|
+
alias($.PUSHTAG, "pushtag"),
|
|
317
367
|
$.tag,
|
|
318
368
|
$._eol
|
|
319
369
|
),
|
|
320
370
|
|
|
321
371
|
poptag: $ => seq(
|
|
322
|
-
$.POPTAG,
|
|
372
|
+
alias($.POPTAG, "poptag"),
|
|
323
373
|
$.tag,
|
|
324
374
|
$._eol
|
|
325
375
|
),
|
|
326
376
|
|
|
327
377
|
pushmeta: $ => seq(
|
|
328
|
-
$.PUSHMETA,
|
|
378
|
+
alias($.PUSHMETA, "pushmeta"),
|
|
329
379
|
$.key_value,
|
|
330
380
|
$._eol
|
|
331
381
|
),
|
|
332
382
|
|
|
333
383
|
popmeta: $ => seq(
|
|
334
|
-
$.POPMETA,
|
|
384
|
+
alias($.POPMETA, "popmeta"),
|
|
335
385
|
$.key,
|
|
336
386
|
$._colon,
|
|
337
387
|
$._eol
|
|
@@ -340,10 +390,11 @@ module.exports = grammar({
|
|
|
340
390
|
open: $ =>
|
|
341
391
|
seq(
|
|
342
392
|
field("date", $.date),
|
|
343
|
-
$.OPEN,
|
|
393
|
+
alias($.OPEN, "open"),
|
|
344
394
|
field("account", $.account),
|
|
345
395
|
field("currencies", repeat($.currency_list)),
|
|
346
396
|
field("opt_booking", optional($.opt_booking)),
|
|
397
|
+
field("comment", optional($.comment)),
|
|
347
398
|
$._eol,
|
|
348
399
|
optional($.key_value_list)
|
|
349
400
|
),
|
|
@@ -354,8 +405,9 @@ module.exports = grammar({
|
|
|
354
405
|
close: $ =>
|
|
355
406
|
seq(
|
|
356
407
|
field("date", $.date),
|
|
357
|
-
$.CLOSE,
|
|
408
|
+
alias($.CLOSE, "close"),
|
|
358
409
|
field("account", $.account),
|
|
410
|
+
field("comment", optional($.comment)),
|
|
359
411
|
$._eol,
|
|
360
412
|
optional($.key_value_list)
|
|
361
413
|
),
|
|
@@ -363,8 +415,9 @@ module.exports = grammar({
|
|
|
363
415
|
commodity: $ =>
|
|
364
416
|
seq(
|
|
365
417
|
field("date", $.date),
|
|
366
|
-
$.COMMODITY,
|
|
418
|
+
alias($.COMMODITY, "commodity"),
|
|
367
419
|
field("currency", $.currency),
|
|
420
|
+
field("comment", optional($.comment)),
|
|
368
421
|
$._eol,
|
|
369
422
|
optional($.key_value_list)
|
|
370
423
|
),
|
|
@@ -372,9 +425,10 @@ module.exports = grammar({
|
|
|
372
425
|
pad: $ =>
|
|
373
426
|
seq(
|
|
374
427
|
field("date", $.date),
|
|
375
|
-
$.PAD,
|
|
428
|
+
alias($.PAD, "pad"),
|
|
376
429
|
field("account", $.account),
|
|
377
430
|
field("from_account", $.account),
|
|
431
|
+
field("comment", optional($.comment)),
|
|
378
432
|
$._eol,
|
|
379
433
|
optional($.key_value_list)
|
|
380
434
|
),
|
|
@@ -382,14 +436,15 @@ module.exports = grammar({
|
|
|
382
436
|
balance: $ =>
|
|
383
437
|
seq(
|
|
384
438
|
field("date", $.date),
|
|
385
|
-
$.BALANCE,
|
|
439
|
+
alias($.BALANCE, "balance"),
|
|
386
440
|
field("account", $.account),
|
|
387
441
|
field("amount",
|
|
388
442
|
//choice(
|
|
389
443
|
// $.amount,
|
|
390
|
-
|
|
444
|
+
$.amount_tolerance,
|
|
391
445
|
//)
|
|
392
446
|
),
|
|
447
|
+
field("comment", optional($.comment)),
|
|
393
448
|
$._eol,
|
|
394
449
|
optional($.key_value_list)
|
|
395
450
|
),
|
|
@@ -451,12 +506,12 @@ module.exports = grammar({
|
|
|
451
506
|
choice(
|
|
452
507
|
seq(
|
|
453
508
|
$.lcurl,
|
|
454
|
-
field("cost_comp_list",
|
|
509
|
+
field("cost_comp_list", optional($.cost_comp_list)),
|
|
455
510
|
$.rcurl
|
|
456
511
|
),
|
|
457
512
|
seq(
|
|
458
513
|
$.lcurllcurl,
|
|
459
|
-
field("cost_comp_list",
|
|
514
|
+
field("cost_comp_list", optional($.cost_comp_list)),
|
|
460
515
|
$.rcurlrcurl
|
|
461
516
|
),
|
|
462
517
|
),
|
|
@@ -484,7 +539,7 @@ module.exports = grammar({
|
|
|
484
539
|
price: $ =>
|
|
485
540
|
seq(
|
|
486
541
|
field("date", $.date),
|
|
487
|
-
$.PRICE,
|
|
542
|
+
alias($.PRICE, "price"),
|
|
488
543
|
field("currency", $.currency),
|
|
489
544
|
field("amount", $.amount),
|
|
490
545
|
$._eol,
|
|
@@ -494,7 +549,7 @@ module.exports = grammar({
|
|
|
494
549
|
event: $ =>
|
|
495
550
|
seq(
|
|
496
551
|
field("date", $.date),
|
|
497
|
-
$.EVENT,
|
|
552
|
+
alias($.EVENT, "event"),
|
|
498
553
|
field("type", $.string),
|
|
499
554
|
field("desc", $.string),
|
|
500
555
|
$._eol,
|
|
@@ -504,7 +559,7 @@ module.exports = grammar({
|
|
|
504
559
|
query: $ =>
|
|
505
560
|
seq(
|
|
506
561
|
field("date", $.date),
|
|
507
|
-
$.QUERY,
|
|
562
|
+
alias($.QUERY, "query"),
|
|
508
563
|
field("name", $.string),
|
|
509
564
|
field("query", $.string),
|
|
510
565
|
$._eol,
|
|
@@ -514,7 +569,7 @@ module.exports = grammar({
|
|
|
514
569
|
note: $ =>
|
|
515
570
|
seq(
|
|
516
571
|
field("date", $.date),
|
|
517
|
-
$.NOTE,
|
|
572
|
+
alias($.NOTE, "note"),
|
|
518
573
|
field("account", $.account),
|
|
519
574
|
field("note", $.string),
|
|
520
575
|
$._eol,
|
|
@@ -523,10 +578,10 @@ module.exports = grammar({
|
|
|
523
578
|
|
|
524
579
|
filename: $ => $.string,
|
|
525
580
|
|
|
526
|
-
document:
|
|
581
|
+
document: $ =>
|
|
527
582
|
seq(
|
|
528
583
|
field("date", $.date),
|
|
529
|
-
$.DOCUMENT,
|
|
584
|
+
alias($.DOCUMENT, "document"),
|
|
530
585
|
field("account", $.account),
|
|
531
586
|
field("filename", $.filename),
|
|
532
587
|
field("tags_links", optional($.tags_links)),
|
|
@@ -552,7 +607,7 @@ module.exports = grammar({
|
|
|
552
607
|
custom: $ =>
|
|
553
608
|
seq(
|
|
554
609
|
field("date", $.date),
|
|
555
|
-
$.CUSTOM,
|
|
610
|
+
alias($.CUSTOM, "custom"),
|
|
556
611
|
field("name", $.string),
|
|
557
612
|
field("custom_value_list", optional($.custom_value_list)),
|
|
558
613
|
$._eol,
|
|
@@ -576,14 +631,14 @@ module.exports = grammar({
|
|
|
576
631
|
),
|
|
577
632
|
|
|
578
633
|
option: $ => seq(
|
|
579
|
-
$.OPTION,
|
|
634
|
+
alias($.OPTION, "option"),
|
|
580
635
|
field("key", $.string),
|
|
581
|
-
field("value"
|
|
636
|
+
field("value", $.string),
|
|
582
637
|
$._eol,
|
|
583
638
|
),
|
|
584
639
|
|
|
585
640
|
include: $ => seq(
|
|
586
|
-
$.INCLUDE,
|
|
641
|
+
alias($.INCLUDE, "include"),
|
|
587
642
|
$.string,
|
|
588
643
|
$._eol,
|
|
589
644
|
),
|
|
@@ -591,12 +646,12 @@ module.exports = grammar({
|
|
|
591
646
|
plugin: $ =>
|
|
592
647
|
choice(
|
|
593
648
|
seq(
|
|
594
|
-
$.PLUGIN,
|
|
649
|
+
alias($.PLUGIN, "plugin"),
|
|
595
650
|
$.string,
|
|
596
651
|
$._eol
|
|
597
652
|
),
|
|
598
653
|
seq(
|
|
599
|
-
$.PLUGIN,
|
|
654
|
+
alias($.PLUGIN, "plugin"),
|
|
600
655
|
$.string,
|
|
601
656
|
$.string,
|
|
602
657
|
$._eol
|
|
@@ -619,12 +674,14 @@ module.exports = grammar({
|
|
|
619
674
|
$._entry,
|
|
620
675
|
$._skipped_lines,
|
|
621
676
|
),
|
|
677
|
+
|
|
622
678
|
/* End Grammar Rules */
|
|
623
679
|
/*--------------------------------------------------------------------------------*/
|
|
624
680
|
|
|
625
|
-
|
|
681
|
+
comment: $ => seq(';', /.*/),
|
|
626
682
|
|
|
627
|
-
|
|
683
|
+
// NOTE: includes reserved identifiers
|
|
684
|
+
identifier: $ => /[_a-zA-Z0-9]+/,
|
|
628
685
|
|
|
629
686
|
_skipped_lines: $ =>
|
|
630
687
|
choice(
|
|
@@ -642,7 +699,7 @@ module.exports = grammar({
|
|
|
642
699
|
seq(
|
|
643
700
|
$.comment,
|
|
644
701
|
$._eol
|
|
645
|
-
)
|
|
702
|
+
),
|
|
646
703
|
),
|
|
647
704
|
|
|
648
705
|
_ASCII: $ => /[\x00-\x7f]/,
|
|
@@ -694,10 +751,9 @@ module.exports = grammar({
|
|
|
694
751
|
$._UTF_8_3,
|
|
695
752
|
$._UTF_8_4,
|
|
696
753
|
),
|
|
697
|
-
_UTF_8: $ =>
|
|
754
|
+
_UTF_8: $ => choice(
|
|
698
755
|
$._ASCII,
|
|
699
756
|
$._UTF_8_ONLY,
|
|
700
757
|
),
|
|
701
|
-
|
|
702
758
|
}
|
|
703
|
-
})
|
|
759
|
+
})
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tree-sitter-beancount",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "a tree-sitter parser for the beancount syntax",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "bindings/node",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
7
|
+
"build": "tree-sitter generate",
|
|
8
|
+
"test": "tree-sitter test"
|
|
8
9
|
},
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
@@ -21,9 +22,9 @@
|
|
|
21
22
|
},
|
|
22
23
|
"homepage": "https://github.com/bryall/tree-sitter-beancount#readme",
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"nan": "^2.
|
|
25
|
+
"nan": "^2.15.0"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"tree-sitter-cli": "
|
|
28
|
+
"tree-sitter-cli": "0.20.0"
|
|
28
29
|
}
|
|
29
30
|
}
|