lezer-beancount 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Robin van der Vleuten <robin@webstronauts.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # lezer-beancount
2
+
3
+ This is a Beancount grammar for the [lezer](https://lezer.codemirror.net/) parser system.
4
+
5
+ Reference:
6
+
7
+ - https://beancount.github.io/docs/index.html
8
+ - https://beancount.github.io/docs/beancount_language_syntax.html (contains the full spec)
package/dist/index.cjs ADDED
@@ -0,0 +1,85 @@
1
+ 'use strict';
2
+
3
+ var lr = require('@lezer/lr');
4
+ var highlight = require('@lezer/highlight');
5
+
6
+ /* Syntax highlighting for Beancount */
7
+
8
+
9
+ const beancountHighlighting = highlight.styleTags({
10
+ // Comments
11
+ LineComment: highlight.tags.lineComment,
12
+
13
+ // Literals
14
+ String: highlight.tags.string,
15
+ Number: highlight.tags.number,
16
+ Date: highlight.tags.literal,
17
+ BooleanValue: highlight.tags.bool,
18
+
19
+ // Accounts and Currencies
20
+ Account: highlight.tags.variableName,
21
+ Currency: highlight.tags.unit,
22
+
23
+ // Transaction flags
24
+ TxnFlag: highlight.tags.modifier,
25
+ TxnKeyword: highlight.tags.modifier,
26
+
27
+ // Tags and Links
28
+ Tag: highlight.tags.tagName,
29
+ Link: highlight.tags.link,
30
+
31
+ // Keywords (directives)
32
+ "open close balance pad note document event price commodity query custom": highlight.tags.keyword,
33
+ "option include plugin pushtag poptag": highlight.tags.keyword,
34
+
35
+ // Metadata
36
+ MetadataKey: highlight.tags.propertyName,
37
+ identifier: highlight.tags.name,
38
+
39
+ // Operators
40
+ ArithOp: highlight.tags.arithmeticOperator,
41
+ PriceOp: highlight.tags.operator,
42
+ "~": highlight.tags.operator,
43
+
44
+ // Cost spec markers
45
+ LotLabel: highlight.tags.special(highlight.tags.operator),
46
+ CostMerge: highlight.tags.special(highlight.tags.operator),
47
+
48
+ // Delimiters
49
+ "{ } {{ }}": highlight.tags.brace,
50
+ "( )": highlight.tags.paren,
51
+ ",": highlight.tags.separator,
52
+ ":": highlight.tags.punctuation,
53
+ "@ @@": highlight.tags.operator,
54
+
55
+ // Org-mode headers
56
+ OrgHeader: highlight.tags.heading,
57
+ OrgMarker: highlight.tags.heading,
58
+
59
+ // Indent (for structure)
60
+ Indent: highlight.tags.indent,
61
+ });
62
+
63
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
64
+ const spec_identifier = {__proto__:null,open:78, close:86, balance:90, pad:96, note:100, document:104, event:108, price:112, commodity:116, query:120, custom:124, option:130, include:134, plugin:138, pushtag:142, poptag:146};
65
+ const parser = lr.LRParser.deserialize({
66
+ version: 14,
67
+ states: "3tQ]QPOOOtQQO'#C_OOQO'#Dm'#DmOOQO'#Dx'#DxOOQO'#EV'#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PriceOp @ @@ TransactionMetadata MetadataKey : BooleanValue Open open MetadataBlock DirectiveMetadata Close close Balance balance ~ Pad pad Note note Document document Event event Price price Commodity commodity Query query Custom custom UndatedDirective Option option Include include Plugin plugin Pushtag pushtag Poptag poptag OrgHeader OrgMarker",
71
+ maxTerm: 99,
72
+ nodeProps: [
73
+ ["isolate", -3,1,8,75,""]
74
+ ],
75
+ propSources: [beancountHighlighting],
76
+ skippedNodes: [0,1],
77
+ repeatNodeCount: 7,
78
+ tokenData: ";{~RtXY#cYZ#n]^#npq#cqr$[rs$ast&|xy'pyz'uz{'z{|)R|})W}!O)]!P!Q)R!Q![*R![!],T!]!^,Y!b!c,q!c!d-O!d!g/b!g!h/{!h!i1t!i!k/b!k!l4v!l!n/b!n!o5|!o!v/b!v!w7f!w!}/b#Q#R8t#T#h9f#h#i9w#i#o9f#o#p;[#q#r;i#r#s;v~#hQ!w~XY#cpq#c~#sS!x~XY$PYZ#n]^#npq$P~$UQ]~XY$Ppq$PQ$aOVQ~$dWpq$aqr$ars$|s#O$a#O#P%R#P;'S$a;'S;=`&v<%lO$a~%ROW~~%UYYZ$ars$a!P!Q$a#O#P$a#U#V$a#Y#Z$a#b#c$a#f#g$a#h#i$a#i#j%t~%wR!Q![&Q!c!i&Q#T#Z&Q~&TR!Q![&^!c!i&^#T#Z&^~&aR!Q![&j!c!i&j#T#Z&j~&mR!Q![$a!c!i$a#T#Z$a~&yP;=`<%l$aX'RR#QW!Q!['[!c!}'[#T#o'[P'aTXP}!O'[!Q!['[!c!}'[#R#S'[#T#o'[~'uOa~~'zOb~_(TRcSiWVQXY(^pq(^z{(uP(cS!mPOY(^Z;'S(^;'S;=`(o<%lO(^P(rP;=`<%l(^P(xRXY(^pq(^z{(uS)WOcS~)]Oj~])bPcS!Q![)eX)jR`X|})e!O!P)s!Q![)eX)vP!Q![)yX*OP`X!Q![)y~*WR`X|})e!O!P)s!Q![*a~*fR`X|})e!O!P)s!Q![*o~*tR`X|})e!O!P)s!Q![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l~8[Wd~wx-l}!O-l!O!P-l!Q![-l!c!w-l!w!x3n!x!}-l#R#S-l~8wR!Q![9Q!c!}9Q#T#o9Q~9VTY~}!O9Q!Q![9Q!c!}9Q#R#S9Q#T#o9Q~9kS#R~}!O9f!Q![9f#R#S9f#T#o9f~9|U#R~}!O9f!Q![9f#R#S9f#T#l9f#l#m:`#m#o9f~:eU#R~}!O9f!Q![9f#R#S9f#T#b9f#b#c:w#c#o9f~;OSU~#R~}!O9f!Q![9f#R#S9f#T#o9f~;aPf~#o#p;d~;iOl~~;nPk~#q#r;q~;vOm~~;{O!O~",
79
+ tokenizers: [0, 1, 2, 3],
80
+ topRules: {"File":[0,2]},
81
+ specialized: [{term: 95, get: (value) => spec_identifier[value] || -1}],
82
+ tokenPrec: 1340
83
+ });
84
+
85
+ exports.parser = parser;
package/dist/index.js ADDED
@@ -0,0 +1,83 @@
1
+ import { LRParser } from '@lezer/lr';
2
+ import { styleTags, tags } from '@lezer/highlight';
3
+
4
+ /* Syntax highlighting for Beancount */
5
+
6
+
7
+ const beancountHighlighting = styleTags({
8
+ // Comments
9
+ LineComment: tags.lineComment,
10
+
11
+ // Literals
12
+ String: tags.string,
13
+ Number: tags.number,
14
+ Date: tags.literal,
15
+ BooleanValue: tags.bool,
16
+
17
+ // Accounts and Currencies
18
+ Account: tags.variableName,
19
+ Currency: tags.unit,
20
+
21
+ // Transaction flags
22
+ TxnFlag: tags.modifier,
23
+ TxnKeyword: tags.modifier,
24
+
25
+ // Tags and Links
26
+ Tag: tags.tagName,
27
+ Link: tags.link,
28
+
29
+ // Keywords (directives)
30
+ "open close balance pad note document event price commodity query custom": tags.keyword,
31
+ "option include plugin pushtag poptag": tags.keyword,
32
+
33
+ // Metadata
34
+ MetadataKey: tags.propertyName,
35
+ identifier: tags.name,
36
+
37
+ // Operators
38
+ ArithOp: tags.arithmeticOperator,
39
+ PriceOp: tags.operator,
40
+ "~": tags.operator,
41
+
42
+ // Cost spec markers
43
+ LotLabel: tags.special(tags.operator),
44
+ CostMerge: tags.special(tags.operator),
45
+
46
+ // Delimiters
47
+ "{ } {{ }}": tags.brace,
48
+ "( )": tags.paren,
49
+ ",": tags.separator,
50
+ ":": tags.punctuation,
51
+ "@ @@": tags.operator,
52
+
53
+ // Org-mode headers
54
+ OrgHeader: tags.heading,
55
+ OrgMarker: tags.heading,
56
+
57
+ // Indent (for structure)
58
+ Indent: tags.indent,
59
+ });
60
+
61
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
62
+ const spec_identifier = {__proto__:null,open:78, close:86, balance:90, pad:96, note:100, document:104, event:108, price:112, commodity:116, query:120, custom:124, option:130, include:134, plugin:138, pushtag:142, poptag:146};
63
+ const parser = LRParser.deserialize({
64
+ version: 14,
65
+ states: "3tQ]QPOOOtQQO'#C_OOQO'#Dm'#DmOOQO'#Dx'#DxOOQO'#EV'#EVOOQO'#Dz'#DzQ]QPOOO!oQPO'#DnO!tQPO'#DpO!yQPO'#DrO#OQPO'#DtO#TQPO'#DvOOQO'#EW'#EWO#YQPO'#CaOOQO,58y,58yO$QQPO'#DSO$VQPO'#DWO$[QPO'#DYO$aQPO'#D]O$fQPO'#D_O$kQPO'#DaO$pQPO'#DcO$uQPO'#DeO$zQPO'#DgO%PQPO'#DiO%UQPO'#DkOOQO-E7x-E7xO%ZQPO,5:YOOQO,5:[,5:[O%`QPO,5:^OOQO,5:`,5:`OOQO,5:b,5:bO%}QPO'#EXOOQO'#D{'#D{O&uQPO,58{O'jQPO'#ChOOQO'#D|'#D|O'rQPO'#CgOOQO,58{,58{O&uQPO,58{O(aQPO,59nO)UQPO,59rO)sQPO,59tO)xQPO,59wO)}QPO,59yO*SQPO,59{O*XQPO,59}O*^QPO,5:PO*fQPO,5:RO+TQPO,5:TO+nQPO,5:VOOQO1G/t1G/tOOQO1G/x1G/xOOQO,5:s,5:sOOQO-E7y-E7yOOQO1G.g1G.gO,[QPO,59SOOQO'#DP'#DPO-VQPO,59jOOQO-E7z-E7zO-[QPO1G.gO.PQ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Q#U!hQ#V!iQ#W!jQ#Y!kQ#Z!lQ#_!pQ#`!rQ#b!uQ#o#RR#q#Xs!axy!Q!S!b!d!e!h!i!j!k!l!p!r!u#R#XTQOUQUORjUQr]Y!Wr!^!w#X#iQ!^wQ!w!YQ#X!kR#i!yWu]rw!^R!]uQ$Q#vR$T$QQ!}!_R#m!}p!bxy!Q!S!d!e!h!i!j!k!l!p!r!u#R#XR#P!bQ!u!SR#a!uTTOUR]PRw]R!y!Y[!o!P!Y#c#d#f$PQ#[!nR#r#]Q#x#cR#y#dS#v#c#dR$S$PQ#k!zR#|#nR!exR!hzT!t!S!u",
68
+ nodeNames: "⚠ LineComment File DatedDirective Date Transaction TxnKeyword TxnFlag String Tag Link PostingBlock Posting Indent Account Amount Number ( ) ArithOp Currency CostSpec { LotLabel CostMerge ArithMult , } {{ }} PriceAnnotation PriceOp @ @@ TransactionMetadata MetadataKey : BooleanValue Open open MetadataBlock DirectiveMetadata Close close Balance balance ~ Pad pad Note note Document document Event event Price price Commodity commodity Query query Custom custom UndatedDirective Option option Include include Plugin plugin Pushtag pushtag Poptag poptag OrgHeader OrgMarker",
69
+ maxTerm: 99,
70
+ nodeProps: [
71
+ ["isolate", -3,1,8,75,""]
72
+ ],
73
+ propSources: [beancountHighlighting],
74
+ skippedNodes: [0,1],
75
+ repeatNodeCount: 7,
76
+ tokenData: ";{~RtXY#cYZ#n]^#npq#cqr$[rs$ast&|xy'pyz'uz{'z{|)R|})W}!O)]!P!Q)R!Q![*R![!],T!]!^,Y!b!c,q!c!d-O!d!g/b!g!h/{!h!i1t!i!k/b!k!l4v!l!n/b!n!o5|!o!v/b!v!w7f!w!}/b#Q#R8t#T#h9f#h#i9w#i#o9f#o#p;[#q#r;i#r#s;v~#hQ!w~XY#cpq#c~#sS!x~XY$PYZ#n]^#npq$P~$UQ]~XY$Ppq$PQ$aOVQ~$dWpq$aqr$ars$|s#O$a#O#P%R#P;'S$a;'S;=`&v<%lO$a~%ROW~~%UYYZ$ars$a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O-l!O!P-l!Q![-l!c!n-l!n!o3P!o!}-l#R#S-l~3UWd~wx-l}!O-l!O!P-l!Q![-l!c!u-l!u!v3n!v!}-l#R#S-l~3sWd~wx-l}!O-l!O!P-l!Q![-l!c!g-l!g!h4]!h!}-l#R#S-l~4dUu~d~wx-l}!O-l!O!P-l!Q![-l!c!}-l#R#S-l~4}VVQd~wx-l}!O-l!O!P-l!Q![-l!c!}-l#R#S-l#b#c5d~5gP#V#W5j~5mP#c#d5p~5sP#a#b5v~5yP#X#Y.m~6TVVQd~wx-l}!O-l!O!P-l!Q![-l!c!}-l#R#S-l#]#^6j~6mP#T#U6p~6sP#U#V6v~6yP#]#^6|~7PP#`#a7S~7VP#]#^7Y~7]P#h#i7`~7cP#]#^1n~7mWVQd~wx-l}!O-l!O!P-l!Q![-l!c!t-l!t!u8V!u!}-l#R#S-l~8[Wd~wx-l}!O-l!O!P-l!Q![-l!c!w-l!w!x3n!x!}-l#R#S-l~8wR!Q![9Q!c!}9Q#T#o9Q~9VTY~}!O9Q!Q![9Q!c!}9Q#R#S9Q#T#o9Q~9kS#R~}!O9f!Q![9f#R#S9f#T#o9f~9|U#R~}!O9f!Q![9f#R#S9f#T#l9f#l#m:`#m#o9f~:eU#R~}!O9f!Q![9f#R#S9f#T#b9f#b#c:w#c#o9f~;OSU~#R~}!O9f!Q![9f#R#S9f#T#o9f~;aPf~#o#p;d~;iOl~~;nPk~#q#r;q~;vOm~~;{O!O~",
77
+ tokenizers: [0, 1, 2, 3],
78
+ topRules: {"File":[0,2]},
79
+ specialized: [{term: 95, get: (value) => spec_identifier[value] || -1}],
80
+ tokenPrec: 1340
81
+ });
82
+
83
+ export { parser };
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "lezer-beancount",
3
+ "version": "1.0.0",
4
+ "description": "lezer-based Beancount grammar",
5
+ "license": "MIT",
6
+ "author": "Robin van der Vleuten <robin@webstronauts.com>",
7
+ "type": "module",
8
+ "main": "dist/index.cjs",
9
+ "module": "dist/index.js",
10
+ "exports": {
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ },
14
+ "scripts": {
15
+ "build": "lezer-generator src/beancount.grammar -o src/parser && rollup -c",
16
+ "test": "uvu test"
17
+ },
18
+ "devDependencies": {
19
+ "@lezer/generator": "^1.8.0",
20
+ "@lezer/highlight": "^1.2.0",
21
+ "@lezer/lr": "^1.4.0",
22
+ "@rollup/plugin-node-resolve": "^15.2.3",
23
+ "rollup": "^4.53.3",
24
+ "uvu": "^0.5.6"
25
+ },
26
+ "peerDependencies": {
27
+ "@lezer/highlight": "^1.0.0",
28
+ "@lezer/lr": "^1.0.0"
29
+ },
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/robinvdvleuten/lezer-beancount.git"
36
+ },
37
+ "keywords": [
38
+ "lezer",
39
+ "grammar",
40
+ "beancount",
41
+ "parser",
42
+ "double-entry",
43
+ "accounting"
44
+ ]
45
+ }