tagset-parser 0.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.
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calcBitmask = calcBitmask;
4
+ function calcBitmask(pattern, sets) {
5
+ const tokens = pattern.split('&');
6
+ let mask = 0;
7
+ for (const token of tokens) {
8
+ const t = token.trim();
9
+ if (t !== '' && t !== '_') {
10
+ for (const set of sets) {
11
+ if (set.id === t) {
12
+ mask = mask | (1 << set.index);
13
+ }
14
+ }
15
+ }
16
+ }
17
+ return mask;
18
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TagSetLexer = void 0;
4
+ const antlr = require("antlr4ng");
5
+ class TagSetLexer extends antlr.Lexer {
6
+ static SET = 1;
7
+ static ITEM = 2;
8
+ static AMP = 3;
9
+ static COMMA = 4;
10
+ static COLON = 5;
11
+ static QUOTED_STRING = 6;
12
+ static WORD = 7;
13
+ static NL = 8;
14
+ static WS = 9;
15
+ static channelNames = [
16
+ "DEFAULT_TOKEN_CHANNEL", "HIDDEN"
17
+ ];
18
+ static literalNames = [
19
+ null, "'set'", "'item'", "'&'", "','", "':'"
20
+ ];
21
+ static symbolicNames = [
22
+ null, "SET", "ITEM", "AMP", "COMMA", "COLON", "QUOTED_STRING", "WORD",
23
+ "NL", "WS"
24
+ ];
25
+ static modeNames = [
26
+ "DEFAULT_MODE",
27
+ ];
28
+ static ruleNames = [
29
+ "SET", "ITEM", "AMP", "COMMA", "COLON", "QUOTED_STRING", "WORD",
30
+ "NL", "WS",
31
+ ];
32
+ constructor(input) {
33
+ super(input);
34
+ this.interpreter = new antlr.LexerATNSimulator(this, TagSetLexer._ATN, TagSetLexer.decisionsToDFA, new antlr.PredictionContextCache());
35
+ }
36
+ get grammarFileName() { return "TagSet.g4"; }
37
+ get literalNames() { return TagSetLexer.literalNames; }
38
+ get symbolicNames() { return TagSetLexer.symbolicNames; }
39
+ get ruleNames() { return TagSetLexer.ruleNames; }
40
+ get serializedATN() { return TagSetLexer._serializedATN; }
41
+ get channelNames() { return TagSetLexer.channelNames; }
42
+ get modeNames() { return TagSetLexer.modeNames; }
43
+ static _serializedATN = [
44
+ 4, 0, 9, 60, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2,
45
+ 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
46
+ 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 5, 5, 37, 8, 5, 10, 5, 12, 5, 40, 9, 5, 1, 5, 1, 5, 1,
47
+ 6, 4, 6, 45, 8, 6, 11, 6, 12, 6, 46, 1, 7, 4, 7, 50, 8, 7, 11, 7, 12, 7, 51, 1, 8, 4, 8, 55,
48
+ 8, 8, 11, 8, 12, 8, 56, 1, 8, 1, 8, 0, 0, 9, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15,
49
+ 8, 17, 9, 1, 0, 4, 3, 0, 10, 10, 13, 13, 34, 34, 7, 0, 9, 10, 13, 13, 32, 32, 34, 34, 38,
50
+ 38, 44, 44, 58, 58, 2, 0, 10, 10, 13, 13, 2, 0, 9, 9, 32, 32, 63, 0, 1, 1, 0, 0, 0, 0, 3,
51
+ 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1,
52
+ 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 1, 19, 1, 0, 0, 0, 3, 23, 1, 0, 0, 0, 5, 28, 1,
53
+ 0, 0, 0, 7, 30, 1, 0, 0, 0, 9, 32, 1, 0, 0, 0, 11, 34, 1, 0, 0, 0, 13, 44, 1, 0, 0, 0, 15, 49,
54
+ 1, 0, 0, 0, 17, 54, 1, 0, 0, 0, 19, 20, 5, 115, 0, 0, 20, 21, 5, 101, 0, 0, 21, 22, 5, 116,
55
+ 0, 0, 22, 2, 1, 0, 0, 0, 23, 24, 5, 105, 0, 0, 24, 25, 5, 116, 0, 0, 25, 26, 5, 101, 0, 0,
56
+ 26, 27, 5, 109, 0, 0, 27, 4, 1, 0, 0, 0, 28, 29, 5, 38, 0, 0, 29, 6, 1, 0, 0, 0, 30, 31, 5,
57
+ 44, 0, 0, 31, 8, 1, 0, 0, 0, 32, 33, 5, 58, 0, 0, 33, 10, 1, 0, 0, 0, 34, 38, 5, 34, 0, 0,
58
+ 35, 37, 8, 0, 0, 0, 36, 35, 1, 0, 0, 0, 37, 40, 1, 0, 0, 0, 38, 36, 1, 0, 0, 0, 38, 39, 1,
59
+ 0, 0, 0, 39, 41, 1, 0, 0, 0, 40, 38, 1, 0, 0, 0, 41, 42, 5, 34, 0, 0, 42, 12, 1, 0, 0, 0, 43,
60
+ 45, 8, 1, 0, 0, 44, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 44, 1, 0, 0, 0, 46, 47, 1, 0, 0,
61
+ 0, 47, 14, 1, 0, 0, 0, 48, 50, 7, 2, 0, 0, 49, 48, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 49,
62
+ 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 16, 1, 0, 0, 0, 53, 55, 7, 3, 0, 0, 54, 53, 1, 0, 0, 0,
63
+ 55, 56, 1, 0, 0, 0, 56, 54, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 59, 6,
64
+ 8, 0, 0, 59, 18, 1, 0, 0, 0, 5, 0, 38, 46, 51, 56, 1, 6, 0, 0
65
+ ];
66
+ static __ATN;
67
+ static get _ATN() {
68
+ if (!TagSetLexer.__ATN) {
69
+ TagSetLexer.__ATN = new antlr.ATNDeserializer().deserialize(TagSetLexer._serializedATN);
70
+ }
71
+ return TagSetLexer.__ATN;
72
+ }
73
+ static vocabulary = new antlr.Vocabulary(TagSetLexer.literalNames, TagSetLexer.symbolicNames, []);
74
+ get vocabulary() {
75
+ return TagSetLexer.vocabulary;
76
+ }
77
+ static decisionsToDFA = TagSetLexer._ATN.decisionToState.map((ds, index) => new antlr.DFA(ds, index));
78
+ }
79
+ exports.TagSetLexer = TagSetLexer;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TagSetListener = void 0;
4
+ /**
5
+ * This interface defines a complete listener for a parse tree produced by
6
+ * `TagSetParser`.
7
+ */
8
+ class TagSetListener {
9
+ /**
10
+ * Enter a parse tree produced by `TagSetParser.program`.
11
+ * @param ctx the parse tree
12
+ */
13
+ enterProgram;
14
+ /**
15
+ * Exit a parse tree produced by `TagSetParser.program`.
16
+ * @param ctx the parse tree
17
+ */
18
+ exitProgram;
19
+ /**
20
+ * Enter a parse tree produced by `TagSetParser.line`.
21
+ * @param ctx the parse tree
22
+ */
23
+ enterLine;
24
+ /**
25
+ * Exit a parse tree produced by `TagSetParser.line`.
26
+ * @param ctx the parse tree
27
+ */
28
+ exitLine;
29
+ /**
30
+ * Enter a parse tree produced by `TagSetParser.setDecl`.
31
+ * @param ctx the parse tree
32
+ */
33
+ enterSetDecl;
34
+ /**
35
+ * Exit a parse tree produced by `TagSetParser.setDecl`.
36
+ * @param ctx the parse tree
37
+ */
38
+ exitSetDecl;
39
+ /**
40
+ * Enter a parse tree produced by `TagSetParser.labelPart`.
41
+ * @param ctx the parse tree
42
+ */
43
+ enterLabelPart;
44
+ /**
45
+ * Exit a parse tree produced by `TagSetParser.labelPart`.
46
+ * @param ctx the parse tree
47
+ */
48
+ exitLabelPart;
49
+ /**
50
+ * Enter a parse tree produced by `TagSetParser.itemDecl`.
51
+ * @param ctx the parse tree
52
+ */
53
+ enterItemDecl;
54
+ /**
55
+ * Exit a parse tree produced by `TagSetParser.itemDecl`.
56
+ * @param ctx the parse tree
57
+ */
58
+ exitItemDecl;
59
+ /**
60
+ * Enter a parse tree produced by `TagSetParser.sugarDecl`.
61
+ * @param ctx the parse tree
62
+ */
63
+ enterSugarDecl;
64
+ /**
65
+ * Exit a parse tree produced by `TagSetParser.sugarDecl`.
66
+ * @param ctx the parse tree
67
+ */
68
+ exitSugarDecl;
69
+ /**
70
+ * Enter a parse tree produced by `TagSetParser.pattern`.
71
+ * @param ctx the parse tree
72
+ */
73
+ enterPattern;
74
+ /**
75
+ * Exit a parse tree produced by `TagSetParser.pattern`.
76
+ * @param ctx the parse tree
77
+ */
78
+ exitPattern;
79
+ /**
80
+ * Enter a parse tree produced by `TagSetParser.valueList`.
81
+ * @param ctx the parse tree
82
+ */
83
+ enterValueList;
84
+ /**
85
+ * Exit a parse tree produced by `TagSetParser.valueList`.
86
+ * @param ctx the parse tree
87
+ */
88
+ exitValueList;
89
+ /**
90
+ * Enter a parse tree produced by `TagSetParser.valueItem`.
91
+ * @param ctx the parse tree
92
+ */
93
+ enterValueItem;
94
+ /**
95
+ * Exit a parse tree produced by `TagSetParser.valueItem`.
96
+ * @param ctx the parse tree
97
+ */
98
+ exitValueItem;
99
+ visitTerminal(node) { }
100
+ visitErrorNode(node) { }
101
+ enterEveryRule(node) { }
102
+ exitEveryRule(node) { }
103
+ }
104
+ exports.TagSetListener = TagSetListener;