tzo 1.0.19 → 1.0.20
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/README.md +284 -280
- package/bin/package.json +2 -2
- package/bin/tzo +3 -3
- package/bin/tzo.mjs +3 -3
- package/dist/browser/cli.d.ts +1 -1
- package/dist/browser/cli.js +34 -34
- package/dist/browser/concisetext/ConciseTextLexer.d.ts +30 -30
- package/dist/browser/concisetext/ConciseTextLexer.js +122 -122
- package/dist/browser/concisetext/ConciseTextListener.d.ts +14 -14
- package/dist/browser/concisetext/ConciseTextListener.js +35 -35
- package/dist/browser/concisetext/ConciseTextParser.d.ts +99 -99
- package/dist/browser/concisetext/ConciseTextParser.js +438 -438
- package/dist/browser/getStackParams.d.ts +2 -2
- package/dist/browser/getStackParams.js +23 -23
- package/dist/browser/index.d.ts +5 -5
- package/dist/browser/index.js +17 -17
- package/dist/browser/interfaces.d.ts +42 -42
- package/dist/browser/interfaces.js +2 -2
- package/dist/browser/opcodes/and.d.ts +3 -3
- package/dist/browser/opcodes/and.js +8 -8
- package/dist/browser/opcodes/charCode.d.ts +3 -3
- package/dist/browser/opcodes/charCode.js +9 -9
- package/dist/browser/opcodes/closeBrace.d.ts +3 -3
- package/dist/browser/opcodes/closeBrace.js +6 -6
- package/dist/browser/opcodes/concat.d.ts +3 -3
- package/dist/browser/opcodes/concat.js +8 -8
- package/dist/browser/opcodes/delContext.d.ts +3 -3
- package/dist/browser/opcodes/delContext.js +8 -8
- package/dist/browser/opcodes/dup.d.ts +6 -6
- package/dist/browser/opcodes/dup.js +12 -12
- package/dist/browser/opcodes/eq.d.ts +3 -3
- package/dist/browser/opcodes/eq.js +9 -9
- package/dist/browser/opcodes/exit.d.ts +3 -3
- package/dist/browser/opcodes/exit.js +6 -6
- package/dist/browser/opcodes/getContext.d.ts +3 -3
- package/dist/browser/opcodes/getContext.js +12 -12
- package/dist/browser/opcodes/goto.d.ts +3 -3
- package/dist/browser/opcodes/goto.js +19 -19
- package/dist/browser/opcodes/gt.d.ts +3 -3
- package/dist/browser/opcodes/gt.js +9 -9
- package/dist/browser/opcodes/hasContext.d.ts +3 -3
- package/dist/browser/opcodes/hasContext.js +13 -13
- package/dist/browser/opcodes/jgz.d.ts +3 -3
- package/dist/browser/opcodes/jgz.js +10 -10
- package/dist/browser/opcodes/jz.d.ts +3 -3
- package/dist/browser/opcodes/jz.js +10 -10
- package/dist/browser/opcodes/lt.d.ts +3 -3
- package/dist/browser/opcodes/lt.js +9 -9
- package/dist/browser/opcodes/min.d.ts +3 -3
- package/dist/browser/opcodes/min.js +10 -10
- package/dist/browser/opcodes/mul.d.ts +3 -3
- package/dist/browser/opcodes/mul.js +10 -10
- package/dist/browser/opcodes/nop.d.ts +6 -6
- package/dist/browser/opcodes/nop.js +9 -9
- package/dist/browser/opcodes/not.d.ts +6 -6
- package/dist/browser/opcodes/not.js +16 -16
- package/dist/browser/opcodes/openBrace.d.ts +3 -3
- package/dist/browser/opcodes/openBrace.js +20 -20
- package/dist/browser/opcodes/or.d.ts +3 -3
- package/dist/browser/opcodes/or.js +8 -8
- package/dist/browser/opcodes/pause.d.ts +3 -3
- package/dist/browser/opcodes/pause.js +6 -6
- package/dist/browser/opcodes/plus.d.ts +3 -3
- package/dist/browser/opcodes/plus.js +10 -10
- package/dist/browser/opcodes/pop.d.ts +3 -3
- package/dist/browser/opcodes/pop.js +6 -6
- package/dist/browser/opcodes/ppc.d.ts +6 -6
- package/dist/browser/opcodes/ppc.js +9 -9
- package/dist/browser/opcodes/randInt.d.ts +3 -3
- package/dist/browser/opcodes/randInt.js +9 -9
- package/dist/browser/opcodes/rconcat.d.ts +3 -3
- package/dist/browser/opcodes/rconcat.js +8 -8
- package/dist/browser/opcodes/setContext.d.ts +3 -3
- package/dist/browser/opcodes/setContext.js +8 -8
- package/dist/browser/opcodes/stacksize.d.ts +3 -3
- package/dist/browser/opcodes/stacksize.js +6 -6
- package/dist/browser/opcodes/stdout.d.ts +3 -3
- package/dist/browser/opcodes/stdout.js +6 -6
- package/dist/browser/util/builder.d.ts +12 -12
- package/dist/browser/util/builder.js +37 -37
- package/dist/browser/util/fix_antlr_grammar_ts.d.ts +1 -1
- package/dist/browser/util/fix_antlr_grammar_ts.js +7 -7
- package/dist/browser/util/tokenizer.d.ts +20 -20
- package/dist/browser/util/tokenizer.js +176 -176
- package/dist/browser/util/tokenizer.js.map +1 -1
- package/dist/browser/vm.d.ts +26 -26
- package/dist/browser/vm.js +201 -201
- package/dist/browser/vm.test.d.ts +1 -1
- package/dist/browser/vm.test.js +398 -355
- package/dist/browser/vm.test.js.map +1 -1
- package/dist/node/cli.d.ts +1 -1
- package/dist/node/cli.js +34 -34
- package/dist/node/concisetext/ConciseTextLexer.d.ts +30 -30
- package/dist/node/concisetext/ConciseTextLexer.js +122 -122
- package/dist/node/concisetext/ConciseTextListener.d.ts +14 -14
- package/dist/node/concisetext/ConciseTextListener.js +35 -35
- package/dist/node/concisetext/ConciseTextParser.d.ts +99 -99
- package/dist/node/concisetext/ConciseTextParser.js +438 -438
- package/dist/node/getStackParams.d.ts +2 -2
- package/dist/node/getStackParams.js +23 -23
- package/dist/node/index.d.ts +5 -5
- package/dist/node/index.js +17 -17
- package/dist/node/interfaces.d.ts +42 -42
- package/dist/node/interfaces.js +2 -2
- package/dist/node/opcodes/and.d.ts +3 -3
- package/dist/node/opcodes/and.js +8 -8
- package/dist/node/opcodes/charCode.d.ts +3 -3
- package/dist/node/opcodes/charCode.js +9 -9
- package/dist/node/opcodes/closeBrace.d.ts +3 -3
- package/dist/node/opcodes/closeBrace.js +6 -6
- package/dist/node/opcodes/concat.d.ts +3 -3
- package/dist/node/opcodes/concat.js +8 -8
- package/dist/node/opcodes/delContext.d.ts +3 -3
- package/dist/node/opcodes/delContext.js +8 -8
- package/dist/node/opcodes/dup.d.ts +6 -6
- package/dist/node/opcodes/dup.js +12 -12
- package/dist/node/opcodes/eq.d.ts +3 -3
- package/dist/node/opcodes/eq.js +9 -9
- package/dist/node/opcodes/exit.d.ts +3 -3
- package/dist/node/opcodes/exit.js +6 -6
- package/dist/node/opcodes/getContext.d.ts +3 -3
- package/dist/node/opcodes/getContext.js +12 -12
- package/dist/node/opcodes/goto.d.ts +3 -3
- package/dist/node/opcodes/goto.js +19 -19
- package/dist/node/opcodes/gt.d.ts +3 -3
- package/dist/node/opcodes/gt.js +9 -9
- package/dist/node/opcodes/hasContext.d.ts +3 -3
- package/dist/node/opcodes/hasContext.js +13 -13
- package/dist/node/opcodes/jgz.d.ts +3 -3
- package/dist/node/opcodes/jgz.js +10 -10
- package/dist/node/opcodes/jz.d.ts +3 -3
- package/dist/node/opcodes/jz.js +10 -10
- package/dist/node/opcodes/lt.d.ts +3 -3
- package/dist/node/opcodes/lt.js +9 -9
- package/dist/node/opcodes/min.d.ts +3 -3
- package/dist/node/opcodes/min.js +10 -10
- package/dist/node/opcodes/mul.d.ts +3 -3
- package/dist/node/opcodes/mul.js +10 -10
- package/dist/node/opcodes/nop.d.ts +6 -6
- package/dist/node/opcodes/nop.js +9 -9
- package/dist/node/opcodes/not.d.ts +6 -6
- package/dist/node/opcodes/not.js +16 -16
- package/dist/node/opcodes/openBrace.d.ts +3 -3
- package/dist/node/opcodes/openBrace.js +20 -20
- package/dist/node/opcodes/or.d.ts +3 -3
- package/dist/node/opcodes/or.js +8 -8
- package/dist/node/opcodes/pause.d.ts +3 -3
- package/dist/node/opcodes/pause.js +6 -6
- package/dist/node/opcodes/plus.d.ts +3 -3
- package/dist/node/opcodes/plus.js +10 -10
- package/dist/node/opcodes/pop.d.ts +3 -3
- package/dist/node/opcodes/pop.js +6 -6
- package/dist/node/opcodes/ppc.d.ts +6 -6
- package/dist/node/opcodes/ppc.js +9 -9
- package/dist/node/opcodes/randInt.d.ts +3 -3
- package/dist/node/opcodes/randInt.js +9 -9
- package/dist/node/opcodes/rconcat.d.ts +3 -3
- package/dist/node/opcodes/rconcat.js +8 -8
- package/dist/node/opcodes/setContext.d.ts +3 -3
- package/dist/node/opcodes/setContext.js +8 -8
- package/dist/node/opcodes/stacksize.d.ts +3 -3
- package/dist/node/opcodes/stacksize.js +6 -6
- package/dist/node/opcodes/stdout.d.ts +3 -3
- package/dist/node/opcodes/stdout.js +6 -6
- package/dist/node/util/builder.d.ts +12 -12
- package/dist/node/util/builder.js +37 -37
- package/dist/node/util/fix_antlr_grammar_ts.d.ts +1 -1
- package/dist/node/util/fix_antlr_grammar_ts.js +7 -7
- package/dist/node/util/tokenizer.d.ts +20 -20
- package/dist/node/util/tokenizer.js +176 -176
- package/dist/node/util/tokenizer.js.map +1 -1
- package/dist/node/vm.d.ts +26 -26
- package/dist/node/vm.js +201 -201
- package/dist/node/vm.test.d.ts +1 -1
- package/dist/node/vm.test.js +398 -355
- package/dist/node/vm.test.js.map +1 -1
- package/jest.config.js +4 -4
- package/package.json +50 -50
- package/tsconfig-browser.json +8 -8
- package/tsconfig.json +28 -28
|
@@ -1,439 +1,439 @@
|
|
|
1
|
-
// Generated from ../grammars/ConciseText.g4 by ANTLR 4.8
|
|
2
|
-
// jshint ignore: start
|
|
3
|
-
var antlr4 = require('antlr4/index');
|
|
4
|
-
var ConciseTextListener = require('./ConciseTextListener').ConciseTextListener;
|
|
5
|
-
var grammarFileName = "ConciseText.g4";
|
|
6
|
-
var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
|
|
7
|
-
"\u0003\u000e(\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004\u0004\t",
|
|
8
|
-
"\u0004\u0004\u0005\t\u0005\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
|
|
9
|
-
"\u0002\u0007\u0002\u000f\n\u0002\f\u0002\u000e\u0002\u0012\u000b\u0002",
|
|
10
|
-
"\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003",
|
|
11
|
-
"\u0005\u0003\u001a\n\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
|
|
12
|
-
"\u0004\u0005\u0004 \n\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
|
|
13
|
-
"\u0005\u0005\u0005&\n\u0005\u0003\u0005\u0002\u0002\u0006\u0002\u0004",
|
|
14
|
-
"\u0006\b\u0002\u0003\u0004\u0002\u0004\u0004\f\f\u0002*\u0002\u0010",
|
|
15
|
-
"\u0003\u0002\u0002\u0002\u0004\u0015\u0003\u0002\u0002\u0002\u0006\u001b",
|
|
16
|
-
"\u0003\u0002\u0002\u0002\b!\u0003\u0002\u0002\u0002\n\u000f\u0005\u0004",
|
|
17
|
-
"\u0003\u0002\u000b\u000f\u0005\u0006\u0004\u0002\f\u000f\u0005\b\u0005",
|
|
18
|
-
"\u0002\r\u000f\u0007\u000e\u0002\u0002\u000e\n\u0003\u0002\u0002\u0002",
|
|
19
|
-
"\u000e\u000b\u0003\u0002\u0002\u0002\u000e\f\u0003\u0002\u0002\u0002",
|
|
20
|
-
"\u000e\r\u0003\u0002\u0002\u0002\u000f\u0012\u0003\u0002\u0002\u0002",
|
|
21
|
-
"\u0010\u000e\u0003\u0002\u0002\u0002\u0010\u0011\u0003\u0002\u0002\u0002",
|
|
22
|
-
"\u0011\u0013\u0003\u0002\u0002\u0002\u0012\u0010\u0003\u0002\u0002\u0002",
|
|
23
|
-
"\u0013\u0014\u0007\u0002\u0002\u0003\u0014\u0003\u0003\u0002\u0002\u0002",
|
|
24
|
-
"\u0015\u0019\u0007\n\u0002\u0002\u0016\u0017\u0007\u000e\u0002\u0002",
|
|
25
|
-
"\u0017\u0018\u0007\r\u0002\u0002\u0018\u001a\u0007\f\u0002\u0002\u0019",
|
|
26
|
-
"\u0016\u0003\u0002\u0002\u0002\u0019\u001a\u0003\u0002\u0002\u0002\u001a",
|
|
27
|
-
"\u0005\u0003\u0002\u0002\u0002\u001b\u001f\u0007\u000b\u0002\u0002\u001c",
|
|
28
|
-
"\u001d\u0007\u000e\u0002\u0002\u001d\u001e\u0007\r\u0002\u0002\u001e",
|
|
29
|
-
" \u0007\f\u0002\u0002\u001f\u001c\u0003\u0002\u0002\u0002\u001f \u0003",
|
|
30
|
-
"\u0002\u0002\u0002 \u0007\u0003\u0002\u0002\u0002!%\t\u0002\u0002\u0002",
|
|
31
|
-
"\"#\u0007\u000e\u0002\u0002#$\u0007\r\u0002\u0002$&\u0007\f\u0002\u0002",
|
|
32
|
-
"%\"\u0003\u0002\u0002\u0002%&\u0003\u0002\u0002\u0002&\t\u0003\u0002",
|
|
33
|
-
"\u0002\u0002\u0007\u000e\u0010\u0019\u001f%"].join("");
|
|
34
|
-
var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
|
|
35
|
-
var decisionsToDFA = atn.decisionToState.map(function (ds, index) { return new antlr4.dfa.DFA(ds, index); });
|
|
36
|
-
var sharedContextCache = new antlr4.PredictionContextCache();
|
|
37
|
-
var literalNames = [null, "'/'", "'*'", null, null, null, null, null, null,
|
|
38
|
-
null, null, "'#'"];
|
|
39
|
-
var symbolicNames = [null, "SLASH", "ASTERISK", "COMMENT_START", "ML_COMMENT_BEGIN",
|
|
40
|
-
"ML_COMMENT_END", "MULTILINE_COMMENT", "COMMENT",
|
|
41
|
-
"NUMBER", "STRING", "WORD", "LABEL_START", "WHITESPACE"];
|
|
42
|
-
var ruleNames = ["instructions", "pushNumber", "pushString", "invokeFunction"];
|
|
43
|
-
function ConciseTextParser(input) {
|
|
44
|
-
antlr4.Parser.call(this, input);
|
|
45
|
-
this._interp = new antlr4.atn.ParserATNSimulator(this, atn, decisionsToDFA, sharedContextCache);
|
|
46
|
-
this.ruleNames = ruleNames;
|
|
47
|
-
this.literalNames = literalNames;
|
|
48
|
-
this.symbolicNames = symbolicNames;
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
|
-
ConciseTextParser.prototype = Object.create(antlr4.Parser.prototype);
|
|
52
|
-
ConciseTextParser.prototype.constructor = ConciseTextParser;
|
|
53
|
-
Object.defineProperty(ConciseTextParser.prototype, "atn", {
|
|
54
|
-
get: function () {
|
|
55
|
-
return atn;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
ConciseTextParser.EOF = antlr4.Token.EOF;
|
|
59
|
-
ConciseTextParser.SLASH = 1;
|
|
60
|
-
ConciseTextParser.ASTERISK = 2;
|
|
61
|
-
ConciseTextParser.COMMENT_START = 3;
|
|
62
|
-
ConciseTextParser.ML_COMMENT_BEGIN = 4;
|
|
63
|
-
ConciseTextParser.ML_COMMENT_END = 5;
|
|
64
|
-
ConciseTextParser.MULTILINE_COMMENT = 6;
|
|
65
|
-
ConciseTextParser.COMMENT = 7;
|
|
66
|
-
ConciseTextParser.NUMBER = 8;
|
|
67
|
-
ConciseTextParser.STRING = 9;
|
|
68
|
-
ConciseTextParser.WORD = 10;
|
|
69
|
-
ConciseTextParser.LABEL_START = 11;
|
|
70
|
-
ConciseTextParser.WHITESPACE = 12;
|
|
71
|
-
ConciseTextParser.RULE_instructions = 0;
|
|
72
|
-
ConciseTextParser.RULE_pushNumber = 1;
|
|
73
|
-
ConciseTextParser.RULE_pushString = 2;
|
|
74
|
-
ConciseTextParser.RULE_invokeFunction = 3;
|
|
75
|
-
function InstructionsContext(parser, parent, invokingState) {
|
|
76
|
-
if (parent === undefined) {
|
|
77
|
-
parent = null;
|
|
78
|
-
}
|
|
79
|
-
if (invokingState === undefined || invokingState === null) {
|
|
80
|
-
invokingState = -1;
|
|
81
|
-
}
|
|
82
|
-
antlr4.ParserRuleContext.call(this, parent, invokingState);
|
|
83
|
-
this.parser = parser;
|
|
84
|
-
this.ruleIndex = ConciseTextParser.RULE_instructions;
|
|
85
|
-
return this;
|
|
86
|
-
}
|
|
87
|
-
InstructionsContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
|
|
88
|
-
InstructionsContext.prototype.constructor = InstructionsContext;
|
|
89
|
-
InstructionsContext.prototype.EOF = function () {
|
|
90
|
-
return this.getToken(ConciseTextParser.EOF, 0);
|
|
91
|
-
};
|
|
92
|
-
InstructionsContext.prototype.pushNumber = function (i) {
|
|
93
|
-
if (i === undefined) {
|
|
94
|
-
i = null;
|
|
95
|
-
}
|
|
96
|
-
if (i === null) {
|
|
97
|
-
return this.getTypedRuleContexts(PushNumberContext);
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
return this.getTypedRuleContext(PushNumberContext, i);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
InstructionsContext.prototype.pushString = function (i) {
|
|
104
|
-
if (i === undefined) {
|
|
105
|
-
i = null;
|
|
106
|
-
}
|
|
107
|
-
if (i === null) {
|
|
108
|
-
return this.getTypedRuleContexts(PushStringContext);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
return this.getTypedRuleContext(PushStringContext, i);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
InstructionsContext.prototype.invokeFunction = function (i) {
|
|
115
|
-
if (i === undefined) {
|
|
116
|
-
i = null;
|
|
117
|
-
}
|
|
118
|
-
if (i === null) {
|
|
119
|
-
return this.getTypedRuleContexts(InvokeFunctionContext);
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
return this.getTypedRuleContext(InvokeFunctionContext, i);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
InstructionsContext.prototype.WHITESPACE = function (i) {
|
|
126
|
-
if (i === undefined) {
|
|
127
|
-
i = null;
|
|
128
|
-
}
|
|
129
|
-
if (i === null) {
|
|
130
|
-
return this.getTokens(ConciseTextParser.WHITESPACE);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
return this.getToken(ConciseTextParser.WHITESPACE, i);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
InstructionsContext.prototype.enterRule = function (listener) {
|
|
137
|
-
if (listener instanceof ConciseTextListener) {
|
|
138
|
-
listener.enterInstructions(this);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
InstructionsContext.prototype.exitRule = function (listener) {
|
|
142
|
-
if (listener instanceof ConciseTextListener) {
|
|
143
|
-
listener.exitInstructions(this);
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
ConciseTextParser.InstructionsContext = InstructionsContext;
|
|
147
|
-
ConciseTextParser.prototype.instructions = function () {
|
|
148
|
-
var localctx = new InstructionsContext(this, this._ctx, this.state);
|
|
149
|
-
this.enterRule(localctx, 0, ConciseTextParser.RULE_instructions);
|
|
150
|
-
var _la = 0; // Token type
|
|
151
|
-
try {
|
|
152
|
-
this.enterOuterAlt(localctx, 1);
|
|
153
|
-
this.state = 14;
|
|
154
|
-
this._errHandler.sync(this);
|
|
155
|
-
_la = this._input.LA(1);
|
|
156
|
-
while ((((_la) & ~0x1f) == 0 && ((1 << _la) & ((1 << ConciseTextParser.ASTERISK) | (1 << ConciseTextParser.NUMBER) | (1 << ConciseTextParser.STRING) | (1 << ConciseTextParser.WORD) | (1 << ConciseTextParser.WHITESPACE))) !== 0)) {
|
|
157
|
-
this.state = 12;
|
|
158
|
-
this._errHandler.sync(this);
|
|
159
|
-
switch (this._input.LA(1)) {
|
|
160
|
-
case ConciseTextParser.NUMBER:
|
|
161
|
-
this.state = 8;
|
|
162
|
-
this.pushNumber();
|
|
163
|
-
break;
|
|
164
|
-
case ConciseTextParser.STRING:
|
|
165
|
-
this.state = 9;
|
|
166
|
-
this.pushString();
|
|
167
|
-
break;
|
|
168
|
-
case ConciseTextParser.ASTERISK:
|
|
169
|
-
case ConciseTextParser.WORD:
|
|
170
|
-
this.state = 10;
|
|
171
|
-
this.invokeFunction();
|
|
172
|
-
break;
|
|
173
|
-
case ConciseTextParser.WHITESPACE:
|
|
174
|
-
this.state = 11;
|
|
175
|
-
this.match(ConciseTextParser.WHITESPACE);
|
|
176
|
-
break;
|
|
177
|
-
default:
|
|
178
|
-
throw new antlr4.error.NoViableAltException(this);
|
|
179
|
-
}
|
|
180
|
-
this.state = 16;
|
|
181
|
-
this._errHandler.sync(this);
|
|
182
|
-
_la = this._input.LA(1);
|
|
183
|
-
}
|
|
184
|
-
this.state = 17;
|
|
185
|
-
this.match(ConciseTextParser.EOF);
|
|
186
|
-
}
|
|
187
|
-
catch (re) {
|
|
188
|
-
if (re instanceof antlr4.error.RecognitionException) {
|
|
189
|
-
localctx.exception = re;
|
|
190
|
-
this._errHandler.reportError(this, re);
|
|
191
|
-
this._errHandler.recover(this, re);
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
throw re;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
finally {
|
|
198
|
-
this.exitRule();
|
|
199
|
-
}
|
|
200
|
-
return localctx;
|
|
201
|
-
};
|
|
202
|
-
function PushNumberContext(parser, parent, invokingState) {
|
|
203
|
-
if (parent === undefined) {
|
|
204
|
-
parent = null;
|
|
205
|
-
}
|
|
206
|
-
if (invokingState === undefined || invokingState === null) {
|
|
207
|
-
invokingState = -1;
|
|
208
|
-
}
|
|
209
|
-
antlr4.ParserRuleContext.call(this, parent, invokingState);
|
|
210
|
-
this.parser = parser;
|
|
211
|
-
this.ruleIndex = ConciseTextParser.RULE_pushNumber;
|
|
212
|
-
this.number = null; // Token
|
|
213
|
-
this.label = null; // Token
|
|
214
|
-
return this;
|
|
215
|
-
}
|
|
216
|
-
PushNumberContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
|
|
217
|
-
PushNumberContext.prototype.constructor = PushNumberContext;
|
|
218
|
-
PushNumberContext.prototype.NUMBER = function () {
|
|
219
|
-
return this.getToken(ConciseTextParser.NUMBER, 0);
|
|
220
|
-
};
|
|
221
|
-
PushNumberContext.prototype.WHITESPACE = function () {
|
|
222
|
-
return this.getToken(ConciseTextParser.WHITESPACE, 0);
|
|
223
|
-
};
|
|
224
|
-
PushNumberContext.prototype.LABEL_START = function () {
|
|
225
|
-
return this.getToken(ConciseTextParser.LABEL_START, 0);
|
|
226
|
-
};
|
|
227
|
-
PushNumberContext.prototype.WORD = function () {
|
|
228
|
-
return this.getToken(ConciseTextParser.WORD, 0);
|
|
229
|
-
};
|
|
230
|
-
PushNumberContext.prototype.enterRule = function (listener) {
|
|
231
|
-
if (listener instanceof ConciseTextListener) {
|
|
232
|
-
listener.enterPushNumber(this);
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
PushNumberContext.prototype.exitRule = function (listener) {
|
|
236
|
-
if (listener instanceof ConciseTextListener) {
|
|
237
|
-
listener.exitPushNumber(this);
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
ConciseTextParser.PushNumberContext = PushNumberContext;
|
|
241
|
-
ConciseTextParser.prototype.pushNumber = function () {
|
|
242
|
-
var localctx = new PushNumberContext(this, this._ctx, this.state);
|
|
243
|
-
this.enterRule(localctx, 2, ConciseTextParser.RULE_pushNumber);
|
|
244
|
-
try {
|
|
245
|
-
this.enterOuterAlt(localctx, 1);
|
|
246
|
-
this.state = 19;
|
|
247
|
-
localctx.number = this.match(ConciseTextParser.NUMBER);
|
|
248
|
-
this.state = 23;
|
|
249
|
-
this._errHandler.sync(this);
|
|
250
|
-
var la_ = this._interp.adaptivePredict(this._input, 2, this._ctx);
|
|
251
|
-
if (la_ === 1) {
|
|
252
|
-
this.state = 20;
|
|
253
|
-
this.match(ConciseTextParser.WHITESPACE);
|
|
254
|
-
this.state = 21;
|
|
255
|
-
this.match(ConciseTextParser.LABEL_START);
|
|
256
|
-
this.state = 22;
|
|
257
|
-
localctx.label = this.match(ConciseTextParser.WORD);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
catch (re) {
|
|
261
|
-
if (re instanceof antlr4.error.RecognitionException) {
|
|
262
|
-
localctx.exception = re;
|
|
263
|
-
this._errHandler.reportError(this, re);
|
|
264
|
-
this._errHandler.recover(this, re);
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
throw re;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
finally {
|
|
271
|
-
this.exitRule();
|
|
272
|
-
}
|
|
273
|
-
return localctx;
|
|
274
|
-
};
|
|
275
|
-
function PushStringContext(parser, parent, invokingState) {
|
|
276
|
-
if (parent === undefined) {
|
|
277
|
-
parent = null;
|
|
278
|
-
}
|
|
279
|
-
if (invokingState === undefined || invokingState === null) {
|
|
280
|
-
invokingState = -1;
|
|
281
|
-
}
|
|
282
|
-
antlr4.ParserRuleContext.call(this, parent, invokingState);
|
|
283
|
-
this.parser = parser;
|
|
284
|
-
this.ruleIndex = ConciseTextParser.RULE_pushString;
|
|
285
|
-
this.string = null; // Token
|
|
286
|
-
this.label = null; // Token
|
|
287
|
-
return this;
|
|
288
|
-
}
|
|
289
|
-
PushStringContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
|
|
290
|
-
PushStringContext.prototype.constructor = PushStringContext;
|
|
291
|
-
PushStringContext.prototype.STRING = function () {
|
|
292
|
-
return this.getToken(ConciseTextParser.STRING, 0);
|
|
293
|
-
};
|
|
294
|
-
PushStringContext.prototype.WHITESPACE = function () {
|
|
295
|
-
return this.getToken(ConciseTextParser.WHITESPACE, 0);
|
|
296
|
-
};
|
|
297
|
-
PushStringContext.prototype.LABEL_START = function () {
|
|
298
|
-
return this.getToken(ConciseTextParser.LABEL_START, 0);
|
|
299
|
-
};
|
|
300
|
-
PushStringContext.prototype.WORD = function () {
|
|
301
|
-
return this.getToken(ConciseTextParser.WORD, 0);
|
|
302
|
-
};
|
|
303
|
-
PushStringContext.prototype.enterRule = function (listener) {
|
|
304
|
-
if (listener instanceof ConciseTextListener) {
|
|
305
|
-
listener.enterPushString(this);
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
PushStringContext.prototype.exitRule = function (listener) {
|
|
309
|
-
if (listener instanceof ConciseTextListener) {
|
|
310
|
-
listener.exitPushString(this);
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
ConciseTextParser.PushStringContext = PushStringContext;
|
|
314
|
-
ConciseTextParser.prototype.pushString = function () {
|
|
315
|
-
var localctx = new PushStringContext(this, this._ctx, this.state);
|
|
316
|
-
this.enterRule(localctx, 4, ConciseTextParser.RULE_pushString);
|
|
317
|
-
try {
|
|
318
|
-
this.enterOuterAlt(localctx, 1);
|
|
319
|
-
this.state = 25;
|
|
320
|
-
localctx.string = this.match(ConciseTextParser.STRING);
|
|
321
|
-
this.state = 29;
|
|
322
|
-
this._errHandler.sync(this);
|
|
323
|
-
var la_ = this._interp.adaptivePredict(this._input, 3, this._ctx);
|
|
324
|
-
if (la_ === 1) {
|
|
325
|
-
this.state = 26;
|
|
326
|
-
this.match(ConciseTextParser.WHITESPACE);
|
|
327
|
-
this.state = 27;
|
|
328
|
-
this.match(ConciseTextParser.LABEL_START);
|
|
329
|
-
this.state = 28;
|
|
330
|
-
localctx.label = this.match(ConciseTextParser.WORD);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
catch (re) {
|
|
334
|
-
if (re instanceof antlr4.error.RecognitionException) {
|
|
335
|
-
localctx.exception = re;
|
|
336
|
-
this._errHandler.reportError(this, re);
|
|
337
|
-
this._errHandler.recover(this, re);
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
throw re;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
finally {
|
|
344
|
-
this.exitRule();
|
|
345
|
-
}
|
|
346
|
-
return localctx;
|
|
347
|
-
};
|
|
348
|
-
function InvokeFunctionContext(parser, parent, invokingState) {
|
|
349
|
-
if (parent === undefined) {
|
|
350
|
-
parent = null;
|
|
351
|
-
}
|
|
352
|
-
if (invokingState === undefined || invokingState === null) {
|
|
353
|
-
invokingState = -1;
|
|
354
|
-
}
|
|
355
|
-
antlr4.ParserRuleContext.call(this, parent, invokingState);
|
|
356
|
-
this.parser = parser;
|
|
357
|
-
this.ruleIndex = ConciseTextParser.RULE_invokeFunction;
|
|
358
|
-
this.opcode = null; // Token
|
|
359
|
-
this.label = null; // Token
|
|
360
|
-
return this;
|
|
361
|
-
}
|
|
362
|
-
InvokeFunctionContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
|
|
363
|
-
InvokeFunctionContext.prototype.constructor = InvokeFunctionContext;
|
|
364
|
-
InvokeFunctionContext.prototype.WORD = function (i) {
|
|
365
|
-
if (i === undefined) {
|
|
366
|
-
i = null;
|
|
367
|
-
}
|
|
368
|
-
if (i === null) {
|
|
369
|
-
return this.getTokens(ConciseTextParser.WORD);
|
|
370
|
-
}
|
|
371
|
-
else {
|
|
372
|
-
return this.getToken(ConciseTextParser.WORD, i);
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
InvokeFunctionContext.prototype.ASTERISK = function () {
|
|
376
|
-
return this.getToken(ConciseTextParser.ASTERISK, 0);
|
|
377
|
-
};
|
|
378
|
-
InvokeFunctionContext.prototype.WHITESPACE = function () {
|
|
379
|
-
return this.getToken(ConciseTextParser.WHITESPACE, 0);
|
|
380
|
-
};
|
|
381
|
-
InvokeFunctionContext.prototype.LABEL_START = function () {
|
|
382
|
-
return this.getToken(ConciseTextParser.LABEL_START, 0);
|
|
383
|
-
};
|
|
384
|
-
InvokeFunctionContext.prototype.enterRule = function (listener) {
|
|
385
|
-
if (listener instanceof ConciseTextListener) {
|
|
386
|
-
listener.enterInvokeFunction(this);
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
InvokeFunctionContext.prototype.exitRule = function (listener) {
|
|
390
|
-
if (listener instanceof ConciseTextListener) {
|
|
391
|
-
listener.exitInvokeFunction(this);
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
ConciseTextParser.InvokeFunctionContext = InvokeFunctionContext;
|
|
395
|
-
ConciseTextParser.prototype.invokeFunction = function () {
|
|
396
|
-
var localctx = new InvokeFunctionContext(this, this._ctx, this.state);
|
|
397
|
-
this.enterRule(localctx, 6, ConciseTextParser.RULE_invokeFunction);
|
|
398
|
-
var _la = 0; // Token type
|
|
399
|
-
try {
|
|
400
|
-
this.enterOuterAlt(localctx, 1);
|
|
401
|
-
this.state = 31;
|
|
402
|
-
localctx.opcode = this._input.LT(1);
|
|
403
|
-
_la = this._input.LA(1);
|
|
404
|
-
if (!(_la === ConciseTextParser.ASTERISK || _la === ConciseTextParser.WORD)) {
|
|
405
|
-
localctx.opcode = this._errHandler.recoverInline(this);
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
this._errHandler.reportMatch(this);
|
|
409
|
-
this.consume();
|
|
410
|
-
}
|
|
411
|
-
this.state = 35;
|
|
412
|
-
this._errHandler.sync(this);
|
|
413
|
-
var la_ = this._interp.adaptivePredict(this._input, 4, this._ctx);
|
|
414
|
-
if (la_ === 1) {
|
|
415
|
-
this.state = 32;
|
|
416
|
-
this.match(ConciseTextParser.WHITESPACE);
|
|
417
|
-
this.state = 33;
|
|
418
|
-
this.match(ConciseTextParser.LABEL_START);
|
|
419
|
-
this.state = 34;
|
|
420
|
-
localctx.label = this.match(ConciseTextParser.WORD);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
catch (re) {
|
|
424
|
-
if (re instanceof antlr4.error.RecognitionException) {
|
|
425
|
-
localctx.exception = re;
|
|
426
|
-
this._errHandler.reportError(this, re);
|
|
427
|
-
this._errHandler.recover(this, re);
|
|
428
|
-
}
|
|
429
|
-
else {
|
|
430
|
-
throw re;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
finally {
|
|
434
|
-
this.exitRule();
|
|
435
|
-
}
|
|
436
|
-
return localctx;
|
|
437
|
-
};
|
|
438
|
-
exports.ConciseTextParser = ConciseTextParser;
|
|
1
|
+
// Generated from ../grammars/ConciseText.g4 by ANTLR 4.8
|
|
2
|
+
// jshint ignore: start
|
|
3
|
+
var antlr4 = require('antlr4/index');
|
|
4
|
+
var ConciseTextListener = require('./ConciseTextListener').ConciseTextListener;
|
|
5
|
+
var grammarFileName = "ConciseText.g4";
|
|
6
|
+
var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
|
|
7
|
+
"\u0003\u000e(\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004\u0004\t",
|
|
8
|
+
"\u0004\u0004\u0005\t\u0005\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
|
|
9
|
+
"\u0002\u0007\u0002\u000f\n\u0002\f\u0002\u000e\u0002\u0012\u000b\u0002",
|
|
10
|
+
"\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003",
|
|
11
|
+
"\u0005\u0003\u001a\n\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
|
|
12
|
+
"\u0004\u0005\u0004 \n\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
|
|
13
|
+
"\u0005\u0005\u0005&\n\u0005\u0003\u0005\u0002\u0002\u0006\u0002\u0004",
|
|
14
|
+
"\u0006\b\u0002\u0003\u0004\u0002\u0004\u0004\f\f\u0002*\u0002\u0010",
|
|
15
|
+
"\u0003\u0002\u0002\u0002\u0004\u0015\u0003\u0002\u0002\u0002\u0006\u001b",
|
|
16
|
+
"\u0003\u0002\u0002\u0002\b!\u0003\u0002\u0002\u0002\n\u000f\u0005\u0004",
|
|
17
|
+
"\u0003\u0002\u000b\u000f\u0005\u0006\u0004\u0002\f\u000f\u0005\b\u0005",
|
|
18
|
+
"\u0002\r\u000f\u0007\u000e\u0002\u0002\u000e\n\u0003\u0002\u0002\u0002",
|
|
19
|
+
"\u000e\u000b\u0003\u0002\u0002\u0002\u000e\f\u0003\u0002\u0002\u0002",
|
|
20
|
+
"\u000e\r\u0003\u0002\u0002\u0002\u000f\u0012\u0003\u0002\u0002\u0002",
|
|
21
|
+
"\u0010\u000e\u0003\u0002\u0002\u0002\u0010\u0011\u0003\u0002\u0002\u0002",
|
|
22
|
+
"\u0011\u0013\u0003\u0002\u0002\u0002\u0012\u0010\u0003\u0002\u0002\u0002",
|
|
23
|
+
"\u0013\u0014\u0007\u0002\u0002\u0003\u0014\u0003\u0003\u0002\u0002\u0002",
|
|
24
|
+
"\u0015\u0019\u0007\n\u0002\u0002\u0016\u0017\u0007\u000e\u0002\u0002",
|
|
25
|
+
"\u0017\u0018\u0007\r\u0002\u0002\u0018\u001a\u0007\f\u0002\u0002\u0019",
|
|
26
|
+
"\u0016\u0003\u0002\u0002\u0002\u0019\u001a\u0003\u0002\u0002\u0002\u001a",
|
|
27
|
+
"\u0005\u0003\u0002\u0002\u0002\u001b\u001f\u0007\u000b\u0002\u0002\u001c",
|
|
28
|
+
"\u001d\u0007\u000e\u0002\u0002\u001d\u001e\u0007\r\u0002\u0002\u001e",
|
|
29
|
+
" \u0007\f\u0002\u0002\u001f\u001c\u0003\u0002\u0002\u0002\u001f \u0003",
|
|
30
|
+
"\u0002\u0002\u0002 \u0007\u0003\u0002\u0002\u0002!%\t\u0002\u0002\u0002",
|
|
31
|
+
"\"#\u0007\u000e\u0002\u0002#$\u0007\r\u0002\u0002$&\u0007\f\u0002\u0002",
|
|
32
|
+
"%\"\u0003\u0002\u0002\u0002%&\u0003\u0002\u0002\u0002&\t\u0003\u0002",
|
|
33
|
+
"\u0002\u0002\u0007\u000e\u0010\u0019\u001f%"].join("");
|
|
34
|
+
var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
|
|
35
|
+
var decisionsToDFA = atn.decisionToState.map(function (ds, index) { return new antlr4.dfa.DFA(ds, index); });
|
|
36
|
+
var sharedContextCache = new antlr4.PredictionContextCache();
|
|
37
|
+
var literalNames = [null, "'/'", "'*'", null, null, null, null, null, null,
|
|
38
|
+
null, null, "'#'"];
|
|
39
|
+
var symbolicNames = [null, "SLASH", "ASTERISK", "COMMENT_START", "ML_COMMENT_BEGIN",
|
|
40
|
+
"ML_COMMENT_END", "MULTILINE_COMMENT", "COMMENT",
|
|
41
|
+
"NUMBER", "STRING", "WORD", "LABEL_START", "WHITESPACE"];
|
|
42
|
+
var ruleNames = ["instructions", "pushNumber", "pushString", "invokeFunction"];
|
|
43
|
+
function ConciseTextParser(input) {
|
|
44
|
+
antlr4.Parser.call(this, input);
|
|
45
|
+
this._interp = new antlr4.atn.ParserATNSimulator(this, atn, decisionsToDFA, sharedContextCache);
|
|
46
|
+
this.ruleNames = ruleNames;
|
|
47
|
+
this.literalNames = literalNames;
|
|
48
|
+
this.symbolicNames = symbolicNames;
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
ConciseTextParser.prototype = Object.create(antlr4.Parser.prototype);
|
|
52
|
+
ConciseTextParser.prototype.constructor = ConciseTextParser;
|
|
53
|
+
Object.defineProperty(ConciseTextParser.prototype, "atn", {
|
|
54
|
+
get: function () {
|
|
55
|
+
return atn;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
ConciseTextParser.EOF = antlr4.Token.EOF;
|
|
59
|
+
ConciseTextParser.SLASH = 1;
|
|
60
|
+
ConciseTextParser.ASTERISK = 2;
|
|
61
|
+
ConciseTextParser.COMMENT_START = 3;
|
|
62
|
+
ConciseTextParser.ML_COMMENT_BEGIN = 4;
|
|
63
|
+
ConciseTextParser.ML_COMMENT_END = 5;
|
|
64
|
+
ConciseTextParser.MULTILINE_COMMENT = 6;
|
|
65
|
+
ConciseTextParser.COMMENT = 7;
|
|
66
|
+
ConciseTextParser.NUMBER = 8;
|
|
67
|
+
ConciseTextParser.STRING = 9;
|
|
68
|
+
ConciseTextParser.WORD = 10;
|
|
69
|
+
ConciseTextParser.LABEL_START = 11;
|
|
70
|
+
ConciseTextParser.WHITESPACE = 12;
|
|
71
|
+
ConciseTextParser.RULE_instructions = 0;
|
|
72
|
+
ConciseTextParser.RULE_pushNumber = 1;
|
|
73
|
+
ConciseTextParser.RULE_pushString = 2;
|
|
74
|
+
ConciseTextParser.RULE_invokeFunction = 3;
|
|
75
|
+
function InstructionsContext(parser, parent, invokingState) {
|
|
76
|
+
if (parent === undefined) {
|
|
77
|
+
parent = null;
|
|
78
|
+
}
|
|
79
|
+
if (invokingState === undefined || invokingState === null) {
|
|
80
|
+
invokingState = -1;
|
|
81
|
+
}
|
|
82
|
+
antlr4.ParserRuleContext.call(this, parent, invokingState);
|
|
83
|
+
this.parser = parser;
|
|
84
|
+
this.ruleIndex = ConciseTextParser.RULE_instructions;
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
InstructionsContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
|
|
88
|
+
InstructionsContext.prototype.constructor = InstructionsContext;
|
|
89
|
+
InstructionsContext.prototype.EOF = function () {
|
|
90
|
+
return this.getToken(ConciseTextParser.EOF, 0);
|
|
91
|
+
};
|
|
92
|
+
InstructionsContext.prototype.pushNumber = function (i) {
|
|
93
|
+
if (i === undefined) {
|
|
94
|
+
i = null;
|
|
95
|
+
}
|
|
96
|
+
if (i === null) {
|
|
97
|
+
return this.getTypedRuleContexts(PushNumberContext);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
return this.getTypedRuleContext(PushNumberContext, i);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
InstructionsContext.prototype.pushString = function (i) {
|
|
104
|
+
if (i === undefined) {
|
|
105
|
+
i = null;
|
|
106
|
+
}
|
|
107
|
+
if (i === null) {
|
|
108
|
+
return this.getTypedRuleContexts(PushStringContext);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
return this.getTypedRuleContext(PushStringContext, i);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
InstructionsContext.prototype.invokeFunction = function (i) {
|
|
115
|
+
if (i === undefined) {
|
|
116
|
+
i = null;
|
|
117
|
+
}
|
|
118
|
+
if (i === null) {
|
|
119
|
+
return this.getTypedRuleContexts(InvokeFunctionContext);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
return this.getTypedRuleContext(InvokeFunctionContext, i);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
InstructionsContext.prototype.WHITESPACE = function (i) {
|
|
126
|
+
if (i === undefined) {
|
|
127
|
+
i = null;
|
|
128
|
+
}
|
|
129
|
+
if (i === null) {
|
|
130
|
+
return this.getTokens(ConciseTextParser.WHITESPACE);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
return this.getToken(ConciseTextParser.WHITESPACE, i);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
InstructionsContext.prototype.enterRule = function (listener) {
|
|
137
|
+
if (listener instanceof ConciseTextListener) {
|
|
138
|
+
listener.enterInstructions(this);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
InstructionsContext.prototype.exitRule = function (listener) {
|
|
142
|
+
if (listener instanceof ConciseTextListener) {
|
|
143
|
+
listener.exitInstructions(this);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
ConciseTextParser.InstructionsContext = InstructionsContext;
|
|
147
|
+
ConciseTextParser.prototype.instructions = function () {
|
|
148
|
+
var localctx = new InstructionsContext(this, this._ctx, this.state);
|
|
149
|
+
this.enterRule(localctx, 0, ConciseTextParser.RULE_instructions);
|
|
150
|
+
var _la = 0; // Token type
|
|
151
|
+
try {
|
|
152
|
+
this.enterOuterAlt(localctx, 1);
|
|
153
|
+
this.state = 14;
|
|
154
|
+
this._errHandler.sync(this);
|
|
155
|
+
_la = this._input.LA(1);
|
|
156
|
+
while ((((_la) & ~0x1f) == 0 && ((1 << _la) & ((1 << ConciseTextParser.ASTERISK) | (1 << ConciseTextParser.NUMBER) | (1 << ConciseTextParser.STRING) | (1 << ConciseTextParser.WORD) | (1 << ConciseTextParser.WHITESPACE))) !== 0)) {
|
|
157
|
+
this.state = 12;
|
|
158
|
+
this._errHandler.sync(this);
|
|
159
|
+
switch (this._input.LA(1)) {
|
|
160
|
+
case ConciseTextParser.NUMBER:
|
|
161
|
+
this.state = 8;
|
|
162
|
+
this.pushNumber();
|
|
163
|
+
break;
|
|
164
|
+
case ConciseTextParser.STRING:
|
|
165
|
+
this.state = 9;
|
|
166
|
+
this.pushString();
|
|
167
|
+
break;
|
|
168
|
+
case ConciseTextParser.ASTERISK:
|
|
169
|
+
case ConciseTextParser.WORD:
|
|
170
|
+
this.state = 10;
|
|
171
|
+
this.invokeFunction();
|
|
172
|
+
break;
|
|
173
|
+
case ConciseTextParser.WHITESPACE:
|
|
174
|
+
this.state = 11;
|
|
175
|
+
this.match(ConciseTextParser.WHITESPACE);
|
|
176
|
+
break;
|
|
177
|
+
default:
|
|
178
|
+
throw new antlr4.error.NoViableAltException(this);
|
|
179
|
+
}
|
|
180
|
+
this.state = 16;
|
|
181
|
+
this._errHandler.sync(this);
|
|
182
|
+
_la = this._input.LA(1);
|
|
183
|
+
}
|
|
184
|
+
this.state = 17;
|
|
185
|
+
this.match(ConciseTextParser.EOF);
|
|
186
|
+
}
|
|
187
|
+
catch (re) {
|
|
188
|
+
if (re instanceof antlr4.error.RecognitionException) {
|
|
189
|
+
localctx.exception = re;
|
|
190
|
+
this._errHandler.reportError(this, re);
|
|
191
|
+
this._errHandler.recover(this, re);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
throw re;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
finally {
|
|
198
|
+
this.exitRule();
|
|
199
|
+
}
|
|
200
|
+
return localctx;
|
|
201
|
+
};
|
|
202
|
+
function PushNumberContext(parser, parent, invokingState) {
|
|
203
|
+
if (parent === undefined) {
|
|
204
|
+
parent = null;
|
|
205
|
+
}
|
|
206
|
+
if (invokingState === undefined || invokingState === null) {
|
|
207
|
+
invokingState = -1;
|
|
208
|
+
}
|
|
209
|
+
antlr4.ParserRuleContext.call(this, parent, invokingState);
|
|
210
|
+
this.parser = parser;
|
|
211
|
+
this.ruleIndex = ConciseTextParser.RULE_pushNumber;
|
|
212
|
+
this.number = null; // Token
|
|
213
|
+
this.label = null; // Token
|
|
214
|
+
return this;
|
|
215
|
+
}
|
|
216
|
+
PushNumberContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
|
|
217
|
+
PushNumberContext.prototype.constructor = PushNumberContext;
|
|
218
|
+
PushNumberContext.prototype.NUMBER = function () {
|
|
219
|
+
return this.getToken(ConciseTextParser.NUMBER, 0);
|
|
220
|
+
};
|
|
221
|
+
PushNumberContext.prototype.WHITESPACE = function () {
|
|
222
|
+
return this.getToken(ConciseTextParser.WHITESPACE, 0);
|
|
223
|
+
};
|
|
224
|
+
PushNumberContext.prototype.LABEL_START = function () {
|
|
225
|
+
return this.getToken(ConciseTextParser.LABEL_START, 0);
|
|
226
|
+
};
|
|
227
|
+
PushNumberContext.prototype.WORD = function () {
|
|
228
|
+
return this.getToken(ConciseTextParser.WORD, 0);
|
|
229
|
+
};
|
|
230
|
+
PushNumberContext.prototype.enterRule = function (listener) {
|
|
231
|
+
if (listener instanceof ConciseTextListener) {
|
|
232
|
+
listener.enterPushNumber(this);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
PushNumberContext.prototype.exitRule = function (listener) {
|
|
236
|
+
if (listener instanceof ConciseTextListener) {
|
|
237
|
+
listener.exitPushNumber(this);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
ConciseTextParser.PushNumberContext = PushNumberContext;
|
|
241
|
+
ConciseTextParser.prototype.pushNumber = function () {
|
|
242
|
+
var localctx = new PushNumberContext(this, this._ctx, this.state);
|
|
243
|
+
this.enterRule(localctx, 2, ConciseTextParser.RULE_pushNumber);
|
|
244
|
+
try {
|
|
245
|
+
this.enterOuterAlt(localctx, 1);
|
|
246
|
+
this.state = 19;
|
|
247
|
+
localctx.number = this.match(ConciseTextParser.NUMBER);
|
|
248
|
+
this.state = 23;
|
|
249
|
+
this._errHandler.sync(this);
|
|
250
|
+
var la_ = this._interp.adaptivePredict(this._input, 2, this._ctx);
|
|
251
|
+
if (la_ === 1) {
|
|
252
|
+
this.state = 20;
|
|
253
|
+
this.match(ConciseTextParser.WHITESPACE);
|
|
254
|
+
this.state = 21;
|
|
255
|
+
this.match(ConciseTextParser.LABEL_START);
|
|
256
|
+
this.state = 22;
|
|
257
|
+
localctx.label = this.match(ConciseTextParser.WORD);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
catch (re) {
|
|
261
|
+
if (re instanceof antlr4.error.RecognitionException) {
|
|
262
|
+
localctx.exception = re;
|
|
263
|
+
this._errHandler.reportError(this, re);
|
|
264
|
+
this._errHandler.recover(this, re);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
throw re;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
finally {
|
|
271
|
+
this.exitRule();
|
|
272
|
+
}
|
|
273
|
+
return localctx;
|
|
274
|
+
};
|
|
275
|
+
function PushStringContext(parser, parent, invokingState) {
|
|
276
|
+
if (parent === undefined) {
|
|
277
|
+
parent = null;
|
|
278
|
+
}
|
|
279
|
+
if (invokingState === undefined || invokingState === null) {
|
|
280
|
+
invokingState = -1;
|
|
281
|
+
}
|
|
282
|
+
antlr4.ParserRuleContext.call(this, parent, invokingState);
|
|
283
|
+
this.parser = parser;
|
|
284
|
+
this.ruleIndex = ConciseTextParser.RULE_pushString;
|
|
285
|
+
this.string = null; // Token
|
|
286
|
+
this.label = null; // Token
|
|
287
|
+
return this;
|
|
288
|
+
}
|
|
289
|
+
PushStringContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
|
|
290
|
+
PushStringContext.prototype.constructor = PushStringContext;
|
|
291
|
+
PushStringContext.prototype.STRING = function () {
|
|
292
|
+
return this.getToken(ConciseTextParser.STRING, 0);
|
|
293
|
+
};
|
|
294
|
+
PushStringContext.prototype.WHITESPACE = function () {
|
|
295
|
+
return this.getToken(ConciseTextParser.WHITESPACE, 0);
|
|
296
|
+
};
|
|
297
|
+
PushStringContext.prototype.LABEL_START = function () {
|
|
298
|
+
return this.getToken(ConciseTextParser.LABEL_START, 0);
|
|
299
|
+
};
|
|
300
|
+
PushStringContext.prototype.WORD = function () {
|
|
301
|
+
return this.getToken(ConciseTextParser.WORD, 0);
|
|
302
|
+
};
|
|
303
|
+
PushStringContext.prototype.enterRule = function (listener) {
|
|
304
|
+
if (listener instanceof ConciseTextListener) {
|
|
305
|
+
listener.enterPushString(this);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
PushStringContext.prototype.exitRule = function (listener) {
|
|
309
|
+
if (listener instanceof ConciseTextListener) {
|
|
310
|
+
listener.exitPushString(this);
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
ConciseTextParser.PushStringContext = PushStringContext;
|
|
314
|
+
ConciseTextParser.prototype.pushString = function () {
|
|
315
|
+
var localctx = new PushStringContext(this, this._ctx, this.state);
|
|
316
|
+
this.enterRule(localctx, 4, ConciseTextParser.RULE_pushString);
|
|
317
|
+
try {
|
|
318
|
+
this.enterOuterAlt(localctx, 1);
|
|
319
|
+
this.state = 25;
|
|
320
|
+
localctx.string = this.match(ConciseTextParser.STRING);
|
|
321
|
+
this.state = 29;
|
|
322
|
+
this._errHandler.sync(this);
|
|
323
|
+
var la_ = this._interp.adaptivePredict(this._input, 3, this._ctx);
|
|
324
|
+
if (la_ === 1) {
|
|
325
|
+
this.state = 26;
|
|
326
|
+
this.match(ConciseTextParser.WHITESPACE);
|
|
327
|
+
this.state = 27;
|
|
328
|
+
this.match(ConciseTextParser.LABEL_START);
|
|
329
|
+
this.state = 28;
|
|
330
|
+
localctx.label = this.match(ConciseTextParser.WORD);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
catch (re) {
|
|
334
|
+
if (re instanceof antlr4.error.RecognitionException) {
|
|
335
|
+
localctx.exception = re;
|
|
336
|
+
this._errHandler.reportError(this, re);
|
|
337
|
+
this._errHandler.recover(this, re);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
throw re;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
finally {
|
|
344
|
+
this.exitRule();
|
|
345
|
+
}
|
|
346
|
+
return localctx;
|
|
347
|
+
};
|
|
348
|
+
function InvokeFunctionContext(parser, parent, invokingState) {
|
|
349
|
+
if (parent === undefined) {
|
|
350
|
+
parent = null;
|
|
351
|
+
}
|
|
352
|
+
if (invokingState === undefined || invokingState === null) {
|
|
353
|
+
invokingState = -1;
|
|
354
|
+
}
|
|
355
|
+
antlr4.ParserRuleContext.call(this, parent, invokingState);
|
|
356
|
+
this.parser = parser;
|
|
357
|
+
this.ruleIndex = ConciseTextParser.RULE_invokeFunction;
|
|
358
|
+
this.opcode = null; // Token
|
|
359
|
+
this.label = null; // Token
|
|
360
|
+
return this;
|
|
361
|
+
}
|
|
362
|
+
InvokeFunctionContext.prototype = Object.create(antlr4.ParserRuleContext.prototype);
|
|
363
|
+
InvokeFunctionContext.prototype.constructor = InvokeFunctionContext;
|
|
364
|
+
InvokeFunctionContext.prototype.WORD = function (i) {
|
|
365
|
+
if (i === undefined) {
|
|
366
|
+
i = null;
|
|
367
|
+
}
|
|
368
|
+
if (i === null) {
|
|
369
|
+
return this.getTokens(ConciseTextParser.WORD);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
return this.getToken(ConciseTextParser.WORD, i);
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
InvokeFunctionContext.prototype.ASTERISK = function () {
|
|
376
|
+
return this.getToken(ConciseTextParser.ASTERISK, 0);
|
|
377
|
+
};
|
|
378
|
+
InvokeFunctionContext.prototype.WHITESPACE = function () {
|
|
379
|
+
return this.getToken(ConciseTextParser.WHITESPACE, 0);
|
|
380
|
+
};
|
|
381
|
+
InvokeFunctionContext.prototype.LABEL_START = function () {
|
|
382
|
+
return this.getToken(ConciseTextParser.LABEL_START, 0);
|
|
383
|
+
};
|
|
384
|
+
InvokeFunctionContext.prototype.enterRule = function (listener) {
|
|
385
|
+
if (listener instanceof ConciseTextListener) {
|
|
386
|
+
listener.enterInvokeFunction(this);
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
InvokeFunctionContext.prototype.exitRule = function (listener) {
|
|
390
|
+
if (listener instanceof ConciseTextListener) {
|
|
391
|
+
listener.exitInvokeFunction(this);
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
ConciseTextParser.InvokeFunctionContext = InvokeFunctionContext;
|
|
395
|
+
ConciseTextParser.prototype.invokeFunction = function () {
|
|
396
|
+
var localctx = new InvokeFunctionContext(this, this._ctx, this.state);
|
|
397
|
+
this.enterRule(localctx, 6, ConciseTextParser.RULE_invokeFunction);
|
|
398
|
+
var _la = 0; // Token type
|
|
399
|
+
try {
|
|
400
|
+
this.enterOuterAlt(localctx, 1);
|
|
401
|
+
this.state = 31;
|
|
402
|
+
localctx.opcode = this._input.LT(1);
|
|
403
|
+
_la = this._input.LA(1);
|
|
404
|
+
if (!(_la === ConciseTextParser.ASTERISK || _la === ConciseTextParser.WORD)) {
|
|
405
|
+
localctx.opcode = this._errHandler.recoverInline(this);
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
this._errHandler.reportMatch(this);
|
|
409
|
+
this.consume();
|
|
410
|
+
}
|
|
411
|
+
this.state = 35;
|
|
412
|
+
this._errHandler.sync(this);
|
|
413
|
+
var la_ = this._interp.adaptivePredict(this._input, 4, this._ctx);
|
|
414
|
+
if (la_ === 1) {
|
|
415
|
+
this.state = 32;
|
|
416
|
+
this.match(ConciseTextParser.WHITESPACE);
|
|
417
|
+
this.state = 33;
|
|
418
|
+
this.match(ConciseTextParser.LABEL_START);
|
|
419
|
+
this.state = 34;
|
|
420
|
+
localctx.label = this.match(ConciseTextParser.WORD);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
catch (re) {
|
|
424
|
+
if (re instanceof antlr4.error.RecognitionException) {
|
|
425
|
+
localctx.exception = re;
|
|
426
|
+
this._errHandler.reportError(this, re);
|
|
427
|
+
this._errHandler.recover(this, re);
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
throw re;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
finally {
|
|
434
|
+
this.exitRule();
|
|
435
|
+
}
|
|
436
|
+
return localctx;
|
|
437
|
+
};
|
|
438
|
+
exports.ConciseTextParser = ConciseTextParser;
|
|
439
439
|
//# sourceMappingURL=ConciseTextParser.js.map
|