tagset-parser 0.0.0 → 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.
@@ -2,28 +2,28 @@ import * as antlr from "antlr4ng";
2
2
  export class TagSetLexer extends antlr.Lexer {
3
3
  static SET = 1;
4
4
  static ITEM = 2;
5
- static AMP = 3;
6
- static COMMA = 4;
7
- static COLON = 5;
8
- static QUOTED_STRING = 6;
9
- static WORD = 7;
5
+ static COMMA = 3;
6
+ static COLON = 4;
7
+ static QUOTED_STRING = 5;
8
+ static WORD = 6;
9
+ static COMMENT = 7;
10
10
  static NL = 8;
11
11
  static WS = 9;
12
12
  static channelNames = [
13
13
  "DEFAULT_TOKEN_CHANNEL", "HIDDEN"
14
14
  ];
15
15
  static literalNames = [
16
- null, "'set'", "'item'", "'&'", "','", "':'"
16
+ null, "'set'", "'item'", "','", "':'"
17
17
  ];
18
18
  static symbolicNames = [
19
- null, "SET", "ITEM", "AMP", "COMMA", "COLON", "QUOTED_STRING", "WORD",
20
- "NL", "WS"
19
+ null, "SET", "ITEM", "COMMA", "COLON", "QUOTED_STRING", "WORD",
20
+ "COMMENT", "NL", "WS"
21
21
  ];
22
22
  static modeNames = [
23
23
  "DEFAULT_MODE",
24
24
  ];
25
25
  static ruleNames = [
26
- "SET", "ITEM", "AMP", "COMMA", "COLON", "QUOTED_STRING", "WORD",
26
+ "SET", "ITEM", "COMMA", "COLON", "QUOTED_STRING", "WORD", "COMMENT",
27
27
  "NL", "WS",
28
28
  ];
29
29
  constructor(input) {
@@ -38,27 +38,29 @@ export class TagSetLexer extends antlr.Lexer {
38
38
  get channelNames() { return TagSetLexer.channelNames; }
39
39
  get modeNames() { return TagSetLexer.modeNames; }
40
40
  static _serializedATN = [
41
- 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,
41
+ 4, 0, 9, 67, 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, 24, 25, 5, 116, 0, 0, 25, 26, 5, 101, 0, 0,
53
- 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,
54
- 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,
55
- 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,
56
- 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,
57
- 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,
58
- 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,
59
- 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,
60
- 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,
61
- 8, 0, 0, 59, 18, 1, 0, 0, 0, 5, 0, 38, 46, 51, 56, 1, 6, 0, 0
43
+ 2, 1, 3, 1, 3, 1, 4, 1, 4, 5, 4, 35, 8, 4, 10, 4, 12, 4, 38, 9, 4, 1, 4, 1, 4, 1, 5, 4, 5, 43,
44
+ 8, 5, 11, 5, 12, 5, 44, 1, 6, 1, 6, 5, 6, 49, 8, 6, 10, 6, 12, 6, 52, 9, 6, 1, 6, 1, 6, 1, 7,
45
+ 4, 7, 57, 8, 7, 11, 7, 12, 7, 58, 1, 8, 4, 8, 62, 8, 8, 11, 8, 12, 8, 63, 1, 8, 1, 8, 0, 0,
46
+ 9, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 1, 0, 4, 3, 0, 10, 10, 13, 13,
47
+ 34, 34, 6, 0, 9, 10, 13, 13, 32, 32, 34, 34, 44, 44, 58, 58, 2, 0, 10, 10, 13, 13, 2, 0,
48
+ 9, 9, 32, 32, 71, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9,
49
+ 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 1, 19,
50
+ 1, 0, 0, 0, 3, 23, 1, 0, 0, 0, 5, 28, 1, 0, 0, 0, 7, 30, 1, 0, 0, 0, 9, 32, 1, 0, 0, 0, 11, 42,
51
+ 1, 0, 0, 0, 13, 46, 1, 0, 0, 0, 15, 56, 1, 0, 0, 0, 17, 61, 1, 0, 0, 0, 19, 20, 5, 115, 0,
52
+ 0, 20, 21, 5, 101, 0, 0, 21, 22, 5, 116, 0, 0, 22, 2, 1, 0, 0, 0, 23, 24, 5, 105, 0, 0, 24,
53
+ 25, 5, 116, 0, 0, 25, 26, 5, 101, 0, 0, 26, 27, 5, 109, 0, 0, 27, 4, 1, 0, 0, 0, 28, 29,
54
+ 5, 44, 0, 0, 29, 6, 1, 0, 0, 0, 30, 31, 5, 58, 0, 0, 31, 8, 1, 0, 0, 0, 32, 36, 5, 34, 0, 0,
55
+ 33, 35, 8, 0, 0, 0, 34, 33, 1, 0, 0, 0, 35, 38, 1, 0, 0, 0, 36, 34, 1, 0, 0, 0, 36, 37, 1,
56
+ 0, 0, 0, 37, 39, 1, 0, 0, 0, 38, 36, 1, 0, 0, 0, 39, 40, 5, 34, 0, 0, 40, 10, 1, 0, 0, 0, 41,
57
+ 43, 8, 1, 0, 0, 42, 41, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 44, 45, 1, 0, 0,
58
+ 0, 45, 12, 1, 0, 0, 0, 46, 50, 5, 35, 0, 0, 47, 49, 8, 2, 0, 0, 48, 47, 1, 0, 0, 0, 49, 52,
59
+ 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 53, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0,
60
+ 53, 54, 6, 6, 0, 0, 54, 14, 1, 0, 0, 0, 55, 57, 7, 2, 0, 0, 56, 55, 1, 0, 0, 0, 57, 58, 1,
61
+ 0, 0, 0, 58, 56, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 16, 1, 0, 0, 0, 60, 62, 7, 3, 0, 0, 61,
62
+ 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 61, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 65, 1, 0, 0,
63
+ 0, 65, 66, 6, 8, 0, 0, 66, 18, 1, 0, 0, 0, 6, 0, 36, 44, 50, 58, 63, 1, 6, 0, 0
62
64
  ];
63
65
  static __ATN;
64
66
  static get _ATN() {
@@ -63,16 +63,6 @@ export class TagSetListener {
63
63
  * @param ctx the parse tree
64
64
  */
65
65
  exitSugarDecl;
66
- /**
67
- * Enter a parse tree produced by `TagSetParser.pattern`.
68
- * @param ctx the parse tree
69
- */
70
- enterPattern;
71
- /**
72
- * Exit a parse tree produced by `TagSetParser.pattern`.
73
- * @param ctx the parse tree
74
- */
75
- exitPattern;
76
66
  /**
77
67
  * Enter a parse tree produced by `TagSetParser.valueList`.
78
68
  * @param ctx the parse tree
@@ -2,11 +2,11 @@ import * as antlr from "antlr4ng";
2
2
  export class TagSetParser extends antlr.Parser {
3
3
  static SET = 1;
4
4
  static ITEM = 2;
5
- static AMP = 3;
6
- static COMMA = 4;
7
- static COLON = 5;
8
- static QUOTED_STRING = 6;
9
- static WORD = 7;
5
+ static COMMA = 3;
6
+ static COLON = 4;
7
+ static QUOTED_STRING = 5;
8
+ static WORD = 6;
9
+ static COMMENT = 7;
10
10
  static NL = 8;
11
11
  static WS = 9;
12
12
  static RULE_program = 0;
@@ -15,19 +15,18 @@ export class TagSetParser extends antlr.Parser {
15
15
  static RULE_labelPart = 3;
16
16
  static RULE_itemDecl = 4;
17
17
  static RULE_sugarDecl = 5;
18
- static RULE_pattern = 6;
19
- static RULE_valueList = 7;
20
- static RULE_valueItem = 8;
18
+ static RULE_valueList = 6;
19
+ static RULE_valueItem = 7;
21
20
  static literalNames = [
22
- null, "'set'", "'item'", "'&'", "','", "':'"
21
+ null, "'set'", "'item'", "','", "':'"
23
22
  ];
24
23
  static symbolicNames = [
25
- null, "SET", "ITEM", "AMP", "COMMA", "COLON", "QUOTED_STRING", "WORD",
26
- "NL", "WS"
24
+ null, "SET", "ITEM", "COMMA", "COLON", "QUOTED_STRING", "WORD",
25
+ "COMMENT", "NL", "WS"
27
26
  ];
28
27
  static ruleNames = [
29
28
  "program", "line", "setDecl", "labelPart", "itemDecl", "sugarDecl",
30
- "pattern", "valueList", "valueItem",
29
+ "valueList", "valueItem",
31
30
  ];
32
31
  get grammarFileName() { return "TagSet.g4"; }
33
32
  get literalNames() { return TagSetParser.literalNames; }
@@ -48,17 +47,17 @@ export class TagSetParser extends antlr.Parser {
48
47
  try {
49
48
  this.enterOuterAlt(localContext, 1);
50
49
  {
51
- this.state = 22;
50
+ this.state = 20;
52
51
  this.errorHandler.sync(this);
53
52
  _la = this.tokenStream.LA(1);
54
- while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 390) !== 0)) {
53
+ while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 326) !== 0)) {
55
54
  {
56
- this.state = 20;
55
+ this.state = 18;
57
56
  this.errorHandler.sync(this);
58
57
  switch (this.tokenStream.LA(1)) {
59
58
  case TagSetParser.NL:
60
59
  {
61
- this.state = 18;
60
+ this.state = 16;
62
61
  this.match(TagSetParser.NL);
63
62
  }
64
63
  break;
@@ -66,7 +65,7 @@ export class TagSetParser extends antlr.Parser {
66
65
  case TagSetParser.ITEM:
67
66
  case TagSetParser.WORD:
68
67
  {
69
- this.state = 19;
68
+ this.state = 17;
70
69
  this.line();
71
70
  }
72
71
  break;
@@ -74,11 +73,11 @@ export class TagSetParser extends antlr.Parser {
74
73
  throw new antlr.NoViableAltException(this);
75
74
  }
76
75
  }
77
- this.state = 24;
76
+ this.state = 22;
78
77
  this.errorHandler.sync(this);
79
78
  _la = this.tokenStream.LA(1);
80
79
  }
81
- this.state = 25;
80
+ this.state = 23;
82
81
  this.match(TagSetParser.EOF);
83
82
  }
84
83
  }
@@ -102,36 +101,36 @@ export class TagSetParser extends antlr.Parser {
102
101
  try {
103
102
  this.enterOuterAlt(localContext, 1);
104
103
  {
105
- this.state = 30;
104
+ this.state = 28;
106
105
  this.errorHandler.sync(this);
107
106
  switch (this.tokenStream.LA(1)) {
108
107
  case TagSetParser.SET:
109
108
  {
110
- this.state = 27;
109
+ this.state = 25;
111
110
  this.setDecl();
112
111
  }
113
112
  break;
114
113
  case TagSetParser.ITEM:
115
114
  {
116
- this.state = 28;
115
+ this.state = 26;
117
116
  this.itemDecl();
118
117
  }
119
118
  break;
120
119
  case TagSetParser.WORD:
121
120
  {
122
- this.state = 29;
121
+ this.state = 27;
123
122
  this.sugarDecl();
124
123
  }
125
124
  break;
126
125
  default:
127
126
  throw new antlr.NoViableAltException(this);
128
127
  }
129
- this.state = 33;
128
+ this.state = 31;
130
129
  this.errorHandler.sync(this);
131
130
  switch (this.interpreter.adaptivePredict(this.tokenStream, 3, this.context)) {
132
131
  case 1:
133
132
  {
134
- this.state = 32;
133
+ this.state = 30;
135
134
  this.match(TagSetParser.NL);
136
135
  }
137
136
  break;
@@ -159,11 +158,11 @@ export class TagSetParser extends antlr.Parser {
159
158
  let alternative;
160
159
  this.enterOuterAlt(localContext, 1);
161
160
  {
162
- this.state = 35;
161
+ this.state = 33;
163
162
  this.match(TagSetParser.SET);
164
- this.state = 36;
163
+ this.state = 34;
165
164
  this.match(TagSetParser.WORD);
166
- this.state = 38;
165
+ this.state = 36;
167
166
  this.errorHandler.sync(this);
168
167
  alternative = 1;
169
168
  do {
@@ -171,7 +170,7 @@ export class TagSetParser extends antlr.Parser {
171
170
  case 1:
172
171
  {
173
172
  {
174
- this.state = 37;
173
+ this.state = 35;
175
174
  this.labelPart();
176
175
  }
177
176
  }
@@ -179,7 +178,7 @@ export class TagSetParser extends antlr.Parser {
179
178
  default:
180
179
  throw new antlr.NoViableAltException(this);
181
180
  }
182
- this.state = 40;
181
+ this.state = 38;
183
182
  this.errorHandler.sync(this);
184
183
  alternative = this.interpreter.adaptivePredict(this.tokenStream, 4, this.context);
185
184
  } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER);
@@ -206,9 +205,9 @@ export class TagSetParser extends antlr.Parser {
206
205
  try {
207
206
  this.enterOuterAlt(localContext, 1);
208
207
  {
209
- this.state = 42;
208
+ this.state = 40;
210
209
  _la = this.tokenStream.LA(1);
211
- if (!(_la === 6 || _la === 7)) {
210
+ if (!(_la === 5 || _la === 6)) {
212
211
  this.errorHandler.recoverInline(this);
213
212
  }
214
213
  else {
@@ -237,11 +236,11 @@ export class TagSetParser extends antlr.Parser {
237
236
  try {
238
237
  this.enterOuterAlt(localContext, 1);
239
238
  {
240
- this.state = 44;
239
+ this.state = 42;
241
240
  this.match(TagSetParser.ITEM);
242
- this.state = 45;
243
- this.pattern();
244
- this.state = 46;
241
+ this.state = 43;
242
+ this.match(TagSetParser.WORD);
243
+ this.state = 44;
245
244
  this.valueList();
246
245
  }
247
246
  }
@@ -266,27 +265,27 @@ export class TagSetParser extends antlr.Parser {
266
265
  try {
267
266
  this.enterOuterAlt(localContext, 1);
268
267
  {
269
- this.state = 48;
268
+ this.state = 46;
270
269
  this.match(TagSetParser.WORD);
271
- this.state = 53;
270
+ this.state = 51;
272
271
  this.errorHandler.sync(this);
273
272
  _la = this.tokenStream.LA(1);
274
- while (_la === 4) {
273
+ while (_la === 3) {
275
274
  {
276
275
  {
277
- this.state = 49;
276
+ this.state = 47;
278
277
  this.match(TagSetParser.COMMA);
279
- this.state = 50;
278
+ this.state = 48;
280
279
  this.match(TagSetParser.WORD);
281
280
  }
282
281
  }
283
- this.state = 55;
282
+ this.state = 53;
284
283
  this.errorHandler.sync(this);
285
284
  _la = this.tokenStream.LA(1);
286
285
  }
287
- this.state = 56;
286
+ this.state = 54;
288
287
  this.match(TagSetParser.COLON);
289
- this.state = 57;
288
+ this.state = 55;
290
289
  this.valueList();
291
290
  }
292
291
  }
@@ -304,69 +303,28 @@ export class TagSetParser extends antlr.Parser {
304
303
  }
305
304
  return localContext;
306
305
  }
307
- pattern() {
308
- let localContext = new PatternContext(this.context, this.state);
309
- this.enterRule(localContext, 12, TagSetParser.RULE_pattern);
310
- let _la;
311
- try {
312
- this.enterOuterAlt(localContext, 1);
313
- {
314
- this.state = 59;
315
- this.match(TagSetParser.WORD);
316
- this.state = 64;
317
- this.errorHandler.sync(this);
318
- _la = this.tokenStream.LA(1);
319
- while (_la === 3) {
320
- {
321
- {
322
- this.state = 60;
323
- this.match(TagSetParser.AMP);
324
- this.state = 61;
325
- this.match(TagSetParser.WORD);
326
- }
327
- }
328
- this.state = 66;
329
- this.errorHandler.sync(this);
330
- _la = this.tokenStream.LA(1);
331
- }
332
- }
333
- }
334
- catch (re) {
335
- if (re instanceof antlr.RecognitionException) {
336
- this.errorHandler.reportError(this, re);
337
- this.errorHandler.recover(this, re);
338
- }
339
- else {
340
- throw re;
341
- }
342
- }
343
- finally {
344
- this.exitRule();
345
- }
346
- return localContext;
347
- }
348
306
  valueList() {
349
307
  let localContext = new ValueListContext(this.context, this.state);
350
- this.enterRule(localContext, 14, TagSetParser.RULE_valueList);
308
+ this.enterRule(localContext, 12, TagSetParser.RULE_valueList);
351
309
  let _la;
352
310
  try {
353
311
  this.enterOuterAlt(localContext, 1);
354
312
  {
355
- this.state = 67;
313
+ this.state = 57;
356
314
  this.valueItem();
357
- this.state = 72;
315
+ this.state = 62;
358
316
  this.errorHandler.sync(this);
359
317
  _la = this.tokenStream.LA(1);
360
- while (_la === 4) {
318
+ while (_la === 3) {
361
319
  {
362
320
  {
363
- this.state = 68;
321
+ this.state = 58;
364
322
  this.match(TagSetParser.COMMA);
365
- this.state = 69;
323
+ this.state = 59;
366
324
  this.valueItem();
367
325
  }
368
326
  }
369
- this.state = 74;
327
+ this.state = 64;
370
328
  this.errorHandler.sync(this);
371
329
  _la = this.tokenStream.LA(1);
372
330
  }
@@ -388,13 +346,13 @@ export class TagSetParser extends antlr.Parser {
388
346
  }
389
347
  valueItem() {
390
348
  let localContext = new ValueItemContext(this.context, this.state);
391
- this.enterRule(localContext, 16, TagSetParser.RULE_valueItem);
349
+ this.enterRule(localContext, 14, TagSetParser.RULE_valueItem);
392
350
  let _la;
393
351
  try {
394
352
  let alternative;
395
353
  this.enterOuterAlt(localContext, 1);
396
354
  {
397
- this.state = 76;
355
+ this.state = 66;
398
356
  this.errorHandler.sync(this);
399
357
  alternative = 1;
400
358
  do {
@@ -402,9 +360,9 @@ export class TagSetParser extends antlr.Parser {
402
360
  case 1:
403
361
  {
404
362
  {
405
- this.state = 75;
363
+ this.state = 65;
406
364
  _la = this.tokenStream.LA(1);
407
- if (!(_la === 6 || _la === 7)) {
365
+ if (!(_la === 5 || _la === 6)) {
408
366
  this.errorHandler.recoverInline(this);
409
367
  }
410
368
  else {
@@ -417,9 +375,9 @@ export class TagSetParser extends antlr.Parser {
417
375
  default:
418
376
  throw new antlr.NoViableAltException(this);
419
377
  }
420
- this.state = 78;
378
+ this.state = 68;
421
379
  this.errorHandler.sync(this);
422
- alternative = this.interpreter.adaptivePredict(this.tokenStream, 8, this.context);
380
+ alternative = this.interpreter.adaptivePredict(this.tokenStream, 7, this.context);
423
381
  } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER);
424
382
  }
425
383
  }
@@ -438,31 +396,28 @@ export class TagSetParser extends antlr.Parser {
438
396
  return localContext;
439
397
  }
440
398
  static _serializedATN = [
441
- 4, 1, 9, 81, 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, 6, 7, 6,
442
- 2, 7, 7, 7, 2, 8, 7, 8, 1, 0, 1, 0, 5, 0, 21, 8, 0, 10, 0, 12, 0, 24, 9, 0, 1, 0, 1, 0, 1, 1,
443
- 1, 1, 1, 1, 3, 1, 31, 8, 1, 1, 1, 3, 1, 34, 8, 1, 1, 2, 1, 2, 1, 2, 4, 2, 39, 8, 2, 11, 2, 12,
444
- 2, 40, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 5, 5, 52, 8, 5, 10, 5, 12, 5, 55,
445
- 9, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 5, 6, 63, 8, 6, 10, 6, 12, 6, 66, 9, 6, 1, 7, 1, 7,
446
- 1, 7, 5, 7, 71, 8, 7, 10, 7, 12, 7, 74, 9, 7, 1, 8, 4, 8, 77, 8, 8, 11, 8, 12, 8, 78, 1, 8,
447
- 0, 0, 9, 0, 2, 4, 6, 8, 10, 12, 14, 16, 0, 1, 1, 0, 6, 7, 81, 0, 22, 1, 0, 0, 0, 2, 30, 1, 0,
448
- 0, 0, 4, 35, 1, 0, 0, 0, 6, 42, 1, 0, 0, 0, 8, 44, 1, 0, 0, 0, 10, 48, 1, 0, 0, 0, 12, 59, 1,
449
- 0, 0, 0, 14, 67, 1, 0, 0, 0, 16, 76, 1, 0, 0, 0, 18, 21, 5, 8, 0, 0, 19, 21, 3, 2, 1, 0, 20,
450
- 18, 1, 0, 0, 0, 20, 19, 1, 0, 0, 0, 21, 24, 1, 0, 0, 0, 22, 20, 1, 0, 0, 0, 22, 23, 1, 0, 0,
451
- 0, 23, 25, 1, 0, 0, 0, 24, 22, 1, 0, 0, 0, 25, 26, 5, 0, 0, 1, 26, 1, 1, 0, 0, 0, 27, 31, 3,
452
- 4, 2, 0, 28, 31, 3, 8, 4, 0, 29, 31, 3, 10, 5, 0, 30, 27, 1, 0, 0, 0, 30, 28, 1, 0, 0, 0, 30,
453
- 29, 1, 0, 0, 0, 31, 33, 1, 0, 0, 0, 32, 34, 5, 8, 0, 0, 33, 32, 1, 0, 0, 0, 33, 34, 1, 0, 0,
454
- 0, 34, 3, 1, 0, 0, 0, 35, 36, 5, 1, 0, 0, 36, 38, 5, 7, 0, 0, 37, 39, 3, 6, 3, 0, 38, 37, 1,
455
- 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 38, 1, 0, 0, 0, 40, 41, 1, 0, 0, 0, 41, 5, 1, 0, 0, 0, 42,
456
- 43, 7, 0, 0, 0, 43, 7, 1, 0, 0, 0, 44, 45, 5, 2, 0, 0, 45, 46, 3, 12, 6, 0, 46, 47, 3, 14,
457
- 7, 0, 47, 9, 1, 0, 0, 0, 48, 53, 5, 7, 0, 0, 49, 50, 5, 4, 0, 0, 50, 52, 5, 7, 0, 0, 51, 49,
458
- 1, 0, 0, 0, 52, 55, 1, 0, 0, 0, 53, 51, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 56, 1, 0, 0, 0,
459
- 55, 53, 1, 0, 0, 0, 56, 57, 5, 5, 0, 0, 57, 58, 3, 14, 7, 0, 58, 11, 1, 0, 0, 0, 59, 64, 5,
460
- 7, 0, 0, 60, 61, 5, 3, 0, 0, 61, 63, 5, 7, 0, 0, 62, 60, 1, 0, 0, 0, 63, 66, 1, 0, 0, 0, 64,
461
- 62, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 13, 1, 0, 0, 0, 66, 64, 1, 0, 0, 0, 67, 72, 3, 16,
462
- 8, 0, 68, 69, 5, 4, 0, 0, 69, 71, 3, 16, 8, 0, 70, 68, 1, 0, 0, 0, 71, 74, 1, 0, 0, 0, 72,
463
- 70, 1, 0, 0, 0, 72, 73, 1, 0,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+ 0, 0, 0, 21, 23, 1, 0, 0, 0, 22, 20, 1, 0, 0, 0, 23, 24, 5, 0, 0, 1, 24, 1, 1, 0, 0, 0, 25,
409
+ 29, 3, 4, 2, 0, 26, 29, 3, 8, 4, 0, 27, 29, 3, 10, 5, 0, 28, 25, 1, 0, 0, 0, 28, 26, 1, 0,
410
+ 0, 0, 28, 27, 1, 0, 0, 0, 29, 31, 1, 0, 0, 0, 30, 32, 5, 8, 0, 0, 31, 30, 1, 0, 0, 0, 31, 32,
411
+ 1, 0, 0, 0, 32, 3, 1, 0, 0, 0, 33, 34, 5, 1, 0, 0, 34, 36, 5, 6, 0, 0, 35, 37, 3, 6, 3, 0, 36,
412
+ 35, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 36, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 5, 1, 0, 0,
413
+ 0, 40, 41, 7, 0, 0, 0, 41, 7, 1, 0, 0, 0, 42, 43, 5, 2, 0, 0, 43, 44, 5, 6, 0, 0, 44, 45, 3,
414
+ 12, 6, 0, 45, 9, 1, 0, 0, 0, 46, 51, 5, 6, 0, 0, 47, 48, 5, 3, 0, 0, 48, 50, 5, 6, 0, 0, 49,
415
+ 47, 1, 0, 0, 0, 50, 53, 1, 0, 0, 0, 51, 49, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 54, 1, 0, 0,
416
+ 0, 53, 51, 1, 0, 0, 0, 54, 55, 5, 4, 0, 0, 55, 56, 3, 12, 6, 0, 56, 11, 1, 0, 0, 0, 57, 62,
417
+ 3, 14, 7, 0, 58, 59, 5, 3, 0, 0, 59, 61, 3, 14, 7, 0, 60, 58, 1, 0, 0, 0, 61, 64, 1, 0, 0,
418
+ 0, 62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 13, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 65, 67,
419
+ 7, 0, 0, 0, 66, 65, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 66, 1, 0, 0, 0, 68, 69, 1, 0, 0, 0,
420
+ 69, 15, 1, 0, 0, 0, 8, 18, 20, 28, 31, 38, 51, 62, 68
466
421
  ];
467
422
  static __ATN;
468
423
  static get _ATN() {
@@ -635,8 +590,8 @@ export class ItemDeclContext extends antlr.ParserRuleContext {
635
590
  ITEM() {
636
591
  return this.getToken(TagSetParser.ITEM, 0);
637
592
  }
638
- pattern() {
639
- return this.getRuleContext(0, PatternContext);
593
+ WORD() {
594
+ return this.getToken(TagSetParser.WORD, 0);
640
595
  }
641
596
  valueList() {
642
597
  return this.getRuleContext(0, ValueListContext);
@@ -711,48 +666,6 @@ export class SugarDeclContext extends antlr.ParserRuleContext {
711
666
  }
712
667
  }
713
668
  }
714
- export class PatternContext extends antlr.ParserRuleContext {
715
- constructor(parent, invokingState) {
716
- super(parent, invokingState);
717
- }
718
- WORD(i) {
719
- if (i === undefined) {
720
- return this.getTokens(TagSetParser.WORD);
721
- }
722
- else {
723
- return this.getToken(TagSetParser.WORD, i);
724
- }
725
- }
726
- AMP(i) {
727
- if (i === undefined) {
728
- return this.getTokens(TagSetParser.AMP);
729
- }
730
- else {
731
- return this.getToken(TagSetParser.AMP, i);
732
- }
733
- }
734
- get ruleIndex() {
735
- return TagSetParser.RULE_pattern;
736
- }
737
- enterRule(listener) {
738
- if (listener.enterPattern) {
739
- listener.enterPattern(this);
740
- }
741
- }
742
- exitRule(listener) {
743
- if (listener.exitPattern) {
744
- listener.exitPattern(this);
745
- }
746
- }
747
- accept(visitor) {
748
- if (visitor.visitPattern) {
749
- return visitor.visitPattern(this);
750
- }
751
- else {
752
- return visitor.visitChildren(this);
753
- }
754
- }
755
- }
756
669
  export class ValueListContext extends antlr.ParserRuleContext {
757
670
  constructor(parent, invokingState) {
758
671
  super(parent, invokingState);
@@ -43,12 +43,6 @@ export class TagSetVisitor extends AbstractParseTreeVisitor {
43
43
  * @return the visitor result
44
44
  */
45
45
  visitSugarDecl;
46
- /**
47
- * Visit a parse tree produced by `TagSetParser.pattern`.
48
- * @param ctx the parse tree
49
- * @return the visitor result
50
- */
51
- visitPattern;
52
46
  /**
53
47
  * Visit a parse tree produced by `TagSetParser.valueList`.
54
48
  * @param ctx the parse tree
@@ -1,11 +1,5 @@
1
1
  import { TagSetVisitor } from './generated/TagSetVisitor.js';
2
2
  import { calcBitmask } from './bitmask.js';
3
- function extractPatternIds(ctx) {
4
- return ctx
5
- .WORD()
6
- .map((w) => w.getText())
7
- .filter((t) => t !== '_');
8
- }
9
3
  function extractValues(ctx) {
10
4
  return ctx.valueItem().map((vi) => {
11
5
  const parts = [
@@ -56,8 +50,8 @@ export class TagSetASTVisitor extends TagSetVisitor {
56
50
  this.explicitSets.push({ id, label, index: this.setIndex++ });
57
51
  };
58
52
  visitItemDecl = (ctx) => {
59
- const patternCtx = ctx.pattern();
60
- const patternIds = extractPatternIds(patternCtx);
53
+ const id = ctx.WORD().getText();
54
+ const patternIds = id === '_' ? [] : [id];
61
55
  const values = extractValues(ctx.valueList());
62
56
  this.rawItems.push({ patternIds, values });
63
57
  };
@@ -72,7 +66,7 @@ export class TagSetASTVisitor extends TagSetVisitor {
72
66
  buildAST() {
73
67
  const sets = autoDetectSets(this.explicitSets, this.rawItems);
74
68
  const items = this.rawItems.map((raw) => {
75
- const pattern = raw.patternIds.join('&');
69
+ const pattern = raw.patternIds.join(',');
76
70
  const bitmask = calcBitmask(pattern, sets);
77
71
  return { pattern, bitmask, values: raw.values };
78
72
  });
@@ -2,11 +2,11 @@ import * as antlr from "antlr4ng";
2
2
  export declare class TagSetLexer extends antlr.Lexer {
3
3
  static readonly SET = 1;
4
4
  static readonly ITEM = 2;
5
- static readonly AMP = 3;
6
- static readonly COMMA = 4;
7
- static readonly COLON = 5;
8
- static readonly QUOTED_STRING = 6;
9
- static readonly WORD = 7;
5
+ static readonly COMMA = 3;
6
+ static readonly COLON = 4;
7
+ static readonly QUOTED_STRING = 5;
8
+ static readonly WORD = 6;
9
+ static readonly COMMENT = 7;
10
10
  static readonly NL = 8;
11
11
  static readonly WS = 9;
12
12
  static readonly channelNames: string[];