-
Notifications
You must be signed in to change notification settings - Fork 0
/
ptc.js
14324 lines (12832 loc) · 281 KB
/
ptc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* parser generated by jison 0.6.1-215 */
/*
* Returns a Parser object of the following structure:
*
* Parser: {
* yy: {} The so-called "shared state" or rather the *source* of it;
* the real "shared state" `yy` passed around to
* the rule actions, etc. is a derivative/copy of this one,
* not a direct reference!
* }
*
* Parser.prototype: {
* yy: {},
* EOF: 1,
* TERROR: 2,
*
* trace: function(errorMessage, ...),
*
* JisonParserError: function(msg, hash),
*
* quoteName: function(name),
* Helper function which can be overridden by user code later on: put suitable
* quotes around literal IDs in a description string.
*
* originalQuoteName: function(name),
* The basic quoteName handler provided by JISON.
* `cleanupAfterParse()` will clean up and reset `quoteName()` to reference this function
* at the end of the `parse()`.
*
* describeSymbol: function(symbol),
* Return a more-or-less human-readable description of the given symbol, when
* available, or the symbol itself, serving as its own 'description' for lack
* of something better to serve up.
*
* Return NULL when the symbol is unknown to the parser.
*
* symbols_: {associative list: name ==> number},
* terminals_: {associative list: number ==> name},
* nonterminals: {associative list: rule-name ==> {associative list: number ==> rule-alt}},
* terminal_descriptions_: (if there are any) {associative list: number ==> description},
* productions_: [...],
*
* performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack),
*
* The function parameters and `this` have the following value/meaning:
* - `this` : reference to the `yyval` internal object, which has members (`$` and `_$`)
* to store/reference the rule value `$$` and location info `@$`.
*
* One important thing to note about `this` a.k.a. `yyval`: every *reduce* action gets
* to see the same object via the `this` reference, i.e. if you wish to carry custom
* data from one reduce action through to the next within a single parse run, then you
* may get nasty and use `yyval` a.k.a. `this` for storing you own semi-permanent data.
*
* `this.yy` is a direct reference to the `yy` shared state object.
*
* `%parse-param`-specified additional `parse()` arguments have been added to this `yy`
* object at `parse()` start and are therefore available to the action code via the
* same named `yy.xxxx` attributes (where `xxxx` represents a identifier name from
* the %parse-param` list.
*
* - `yytext` : reference to the lexer value which belongs to the last lexer token used
* to match this rule. This is *not* the look-ahead token, but the last token
* that's actually part of this rule.
*
* Formulated another way, `yytext` is the value of the token immediately preceeding
* the current look-ahead token.
* Caveats apply for rules which don't require look-ahead, such as epsilon rules.
*
* - `yyleng` : ditto as `yytext`, only now for the lexer.yyleng value.
*
* - `yylineno`: ditto as `yytext`, only now for the lexer.yylineno value.
*
* - `yyloc` : ditto as `yytext`, only now for the lexer.yylloc lexer token location info.
*
* WARNING: since jison 0.4.18-186 this entry may be NULL/UNDEFINED instead
* of an empty object when no suitable location info can be provided.
*
* - `yystate` : the current parser state number, used internally for dispatching and
* executing the action code chunk matching the rule currently being reduced.
*
* - `yysp` : the current state stack position (a.k.a. 'stack pointer')
*
* This one comes in handy when you are going to do advanced things to the parser
* stacks, all of which are accessible from your action code (see the next entries below).
*
* Also note that you can access this and other stack index values using the new double-hash
* syntax, i.e. `##$ === ##0 === yysp`, while `##1` is the stack index for all things
* related to the first rule term, just like you have `$1`, `@1` and `#1`.
* This is made available to write very advanced grammar action rules, e.g. when you want
* to investigate the parse state stack in your action code, which would, for example,
* be relevant when you wish to implement error diagnostics and reporting schemes similar
* to the work described here:
*
* + Pottier, F., 2016. Reachability and error diagnosis in LR(1) automata.
* In Journées Francophones des Languages Applicatifs.
*
* + Jeffery, C.L., 2003. Generating LR syntax error messages from examples.
* ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5), pp.631–640.
*
* - `yyrulelength`: the current rule's term count, i.e. the number of entries occupied on the stack.
*
* This one comes in handy when you are going to do advanced things to the parser
* stacks, all of which are accessible from your action code (see the next entries below).
*
* - `yyvstack`: reference to the parser value stack. Also accessed via the `$1` etc.
* constructs.
*
* - `yylstack`: reference to the parser token location stack. Also accessed via
* the `@1` etc. constructs.
*
* WARNING: since jison 0.4.18-186 this array MAY contain slots which are
* UNDEFINED rather than an empty (location) object, when the lexer/parser
* action code did not provide a suitable location info object when such a
* slot was filled!
*
* - `yystack` : reference to the parser token id stack. Also accessed via the
* `#1` etc. constructs.
*
* Note: this is a bit of a **white lie** as we can statically decode any `#n` reference to
* its numeric token id value, hence that code wouldn't need the `yystack` but *you* might
* want access this array for your own purposes, such as error analysis as mentioned above!
*
* Note that this stack stores the current stack of *tokens*, that is the sequence of
* already parsed=reduced *nonterminals* (tokens representing rules) and *terminals*
* (lexer tokens *shifted* onto the stack until the rule they belong to is found and
* *reduced*.
*
* - `yysstack`: reference to the parser state stack. This one carries the internal parser
* *states* such as the one in `yystate`, which are used to represent
* the parser state machine in the *parse table*. *Very* *internal* stuff,
* what can I say? If you access this one, you're clearly doing wicked things
*
* - `...` : the extra arguments you specified in the `%parse-param` statement in your
* grammar definition file.
*
* table: [...],
* State transition table
* ----------------------
*
* index levels are:
* - `state` --> hash table
* - `symbol` --> action (number or array)
*
* If the `action` is an array, these are the elements' meaning:
* - index [0]: 1 = shift, 2 = reduce, 3 = accept
* - index [1]: GOTO `state`
*
* If the `action` is a number, it is the GOTO `state`
*
* defaultActions: {...},
*
* parseError: function(str, hash, ExceptionClass),
* yyError: function(str, ...),
* yyRecovering: function(),
* yyErrOk: function(),
* yyClearIn: function(),
*
* constructParseErrorInfo: function(error_message, exception_object, expected_token_set, is_recoverable),
* Helper function **which will be set up during the first invocation of the `parse()` method**.
* Produces a new errorInfo 'hash object' which can be passed into `parseError()`.
* See it's use in this parser kernel in many places; example usage:
*
* var infoObj = parser.constructParseErrorInfo('fail!', null,
* parser.collect_expected_token_set(state), true);
* var retVal = parser.parseError(infoObj.errStr, infoObj, parser.JisonParserError);
*
* originalParseError: function(str, hash, ExceptionClass),
* The basic `parseError` handler provided by JISON.
* `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function
* at the end of the `parse()`.
*
* options: { ... parser %options ... },
*
* parse: function(input[, args...]),
* Parse the given `input` and return the parsed value (or `true` when none was provided by
* the root action, in which case the parser is acting as a *matcher*).
* You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar:
* these extra `args...` are added verbatim to the `yy` object reference as member variables.
*
* WARNING:
* Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with
* any attributes already added to `yy` by the jison run-time;
* when such a collision is detected an exception is thrown to prevent the generated run-time
* from silently accepting this confusing and potentially hazardous situation!
*
* The lexer MAY add its own set of additional parameters (via the `%parse-param` line in
* the lexer section of the grammar spec): these will be inserted in the `yy` shared state
* object and any collision with those will be reported by the lexer via a thrown exception.
*
* cleanupAfterParse: function(resultValue, invoke_post_methods, do_not_nuke_errorinfos),
* Helper function **which will be set up during the first invocation of the `parse()` method**.
* This helper API is invoked at the end of the `parse()` call, unless an exception was thrown
* and `%options no-try-catch` has been defined for this grammar: in that case this helper MAY
* be invoked by calling user code to ensure the `post_parse` callbacks are invoked and
* the internal parser gets properly garbage collected under these particular circumstances.
*
* yyMergeLocationInfo: function(first_index, last_index, first_yylloc, last_yylloc, dont_look_back),
* Helper function **which will be set up during the first invocation of the `parse()` method**.
* This helper API can be invoked to calculate a spanning `yylloc` location info object.
*
* Note: %epsilon rules MAY specify no `first_index` and `first_yylloc`, in which case
* this function will attempt to obtain a suitable location marker by inspecting the location stack
* backwards.
*
* For more info see the documentation comment further below, immediately above this function's
* implementation.
*
* lexer: {
* yy: {...}, A reference to the so-called "shared state" `yy` once
* received via a call to the `.setInput(input, yy)` lexer API.
* EOF: 1,
* ERROR: 2,
* JisonLexerError: function(msg, hash),
* parseError: function(str, hash, ExceptionClass),
* setInput: function(input, [yy]),
* input: function(),
* unput: function(str),
* more: function(),
* reject: function(),
* less: function(n),
* pastInput: function(n),
* upcomingInput: function(n),
* showPosition: function(),
* test_match: function(regex_match_array, rule_index, ...),
* next: function(...),
* lex: function(...),
* begin: function(condition),
* pushState: function(condition),
* popState: function(),
* topState: function(),
* _currentRules: function(),
* stateStackSize: function(),
* cleanupAfterLex: function()
*
* options: { ... lexer %options ... },
*
* performAction: function(yy, yy_, $avoiding_name_collisions, YY_START, ...),
* rules: [...],
* conditions: {associative list: name ==> set},
* }
* }
*
*
* token location info (@$, _$, etc.): {
* first_line: n,
* last_line: n,
* first_column: n,
* last_column: n,
* range: [start_number, end_number]
* (where the numbers are indexes into the input string, zero-based)
* }
*
* ---
*
* The `parseError` function receives a 'hash' object with these members for lexer and
* parser errors:
*
* {
* text: (matched text)
* token: (the produced terminal token, if any)
* token_id: (the produced terminal token numeric ID, if any)
* line: (yylineno)
* loc: (yylloc)
* }
*
* parser (grammar) errors will also provide these additional members:
*
* {
* expected: (array describing the set of expected tokens;
* may be UNDEFINED when we cannot easily produce such a set)
* state: (integer (or array when the table includes grammar collisions);
* represents the current internal state of the parser kernel.
* can, for example, be used to pass to the `collect_expected_token_set()`
* API to obtain the expected token set)
* action: (integer; represents the current internal action which will be executed)
* new_state: (integer; represents the next/planned internal state, once the current
* action has executed)
* recoverable: (boolean: TRUE when the parser MAY have an error recovery rule
* available for this particular error)
* state_stack: (array: the current parser LALR/LR internal state stack; this can be used,
* for instance, for advanced error analysis and reporting)
* value_stack: (array: the current parser LALR/LR internal `$$` value stack; this can be used,
* for instance, for advanced error analysis and reporting)
* location_stack: (array: the current parser LALR/LR internal location stack; this can be used,
* for instance, for advanced error analysis and reporting)
* yy: (object: the current parser internal "shared state" `yy`
* as is also available in the rule actions; this can be used,
* for instance, for advanced error analysis and reporting)
* lexer: (reference to the current lexer instance used by the parser)
* parser: (reference to the current parser instance)
* }
*
* while `this` will reference the current parser instance.
*
* When `parseError` is invoked by the lexer, `this` will still reference the related *parser*
* instance, while these additional `hash` fields will also be provided:
*
* {
* lexer: (reference to the current lexer instance which reported the error)
* }
*
* When `parseError` is invoked by the parser due to a **JavaScript exception** being fired
* from either the parser or lexer, `this` will still reference the related *parser*
* instance, while these additional `hash` fields will also be provided:
*
* {
* exception: (reference to the exception thrown)
* }
*
* Please do note that in the latter situation, the `expected` field will be omitted as
* this type of failure is assumed not to be due to *parse errors* but rather due to user
* action code in either parser or lexer failing unexpectedly.
*
* ---
*
* You can specify parser options by setting / modifying the `.yy` object of your Parser instance.
* These options are available:
*
* ### options which are global for all parser instances
*
* Parser.pre_parse: function(yy)
* optional: you can specify a pre_parse() function in the chunk following
* the grammar, i.e. after the last `%%`.
* Parser.post_parse: function(yy, retval, parseInfo) { return retval; }
* optional: you can specify a post_parse() function in the chunk following
* the grammar, i.e. after the last `%%`. When it does not return any value,
* the parser will return the original `retval`.
*
* ### options which can be set up per parser instance
*
* yy: {
* pre_parse: function(yy)
* optional: is invoked before the parse cycle starts (and before the first
* invocation of `lex()`) but immediately after the invocation of
* `parser.pre_parse()`).
* post_parse: function(yy, retval, parseInfo) { return retval; }
* optional: is invoked when the parse terminates due to success ('accept')
* or failure (even when exceptions are thrown).
* `retval` contains the return value to be produced by `Parser.parse()`;
* this function can override the return value by returning another.
* When it does not return any value, the parser will return the original
* `retval`.
* This function is invoked immediately before `parser.post_parse()`.
*
* parseError: function(str, hash, ExceptionClass)
* optional: overrides the default `parseError` function.
* quoteName: function(name),
* optional: overrides the default `quoteName` function.
* }
*
* parser.lexer.options: {
* pre_lex: function()
* optional: is invoked before the lexer is invoked to produce another token.
* `this` refers to the Lexer object.
* post_lex: function(token) { return token; }
* optional: is invoked when the lexer has produced a token `token`;
* this function can override the returned token value by returning another.
* When it does not return any (truthy) value, the lexer will return
* the original `token`.
* `this` refers to the Lexer object.
*
* ranges: boolean
* optional: `true` ==> token location info will include a .range[] member.
* flex: boolean
* optional: `true` ==> flex-like lexing behaviour where the rules are tested
* exhaustively to find the longest match.
* backtrack_lexer: boolean
* optional: `true` ==> lexer regexes are tested in order and for invoked;
* the lexer terminates the scan when a token is returned by the action code.
* xregexp: boolean
* optional: `true` ==> lexer rule regexes are "extended regex format" requiring the
* `XRegExp` library. When this `%option` has not been specified at compile time, all lexer
* rule regexes have been written as standard JavaScript RegExp expressions.
* }
*/
var ptc = (function () {
// See also:
// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508
// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility
// with userland code which might access the derived class in a 'classic' way.
function JisonParserError(msg, hash) {
Object.defineProperty(this, 'name', {
enumerable: false,
writable: false,
value: 'JisonParserError'
});
if (msg == null) msg = '???';
Object.defineProperty(this, 'message', {
enumerable: false,
writable: true,
value: msg
});
this.hash = hash;
var stacktrace;
if (hash && hash.exception instanceof Error) {
var ex2 = hash.exception;
this.message = ex2.message || msg;
stacktrace = ex2.stack;
}
if (!stacktrace) {
if (Error.hasOwnProperty('captureStackTrace')) { // V8/Chrome engine
Error.captureStackTrace(this, this.constructor);
} else {
stacktrace = (new Error(msg)).stack;
}
}
if (stacktrace) {
Object.defineProperty(this, 'stack', {
enumerable: false,
writable: false,
value: stacktrace
});
}
}
if (typeof Object.setPrototypeOf === 'function') {
Object.setPrototypeOf(JisonParserError.prototype, Error.prototype);
} else {
JisonParserError.prototype = Object.create(Error.prototype);
}
JisonParserError.prototype.constructor = JisonParserError;
JisonParserError.prototype.name = 'JisonParserError';
// helper: reconstruct the productions[] table
function bp(s) {
var rv = [];
var p = s.pop;
var r = s.rule;
for (var i = 0, l = p.length; i < l; i++) {
rv.push([
p[i],
r[i]
]);
}
return rv;
}
// helper: reconstruct the defaultActions[] table
function bda(s) {
var rv = {};
var d = s.idx;
var g = s.goto;
for (var i = 0, l = d.length; i < l; i++) {
var j = d[i];
rv[j] = g[i];
}
return rv;
}
// helper: reconstruct the 'goto' table
function bt(s) {
var rv = [];
var d = s.len;
var y = s.symbol;
var t = s.type;
var a = s.state;
var m = s.mode;
var g = s.goto;
for (var i = 0, l = d.length; i < l; i++) {
var n = d[i];
var q = {};
for (var j = 0; j < n; j++) {
var z = y.shift();
switch (t.shift()) {
case 2:
q[z] = [
m.shift(),
g.shift()
];
break;
case 0:
q[z] = a.shift();
break;
default:
// type === 1: accept
q[z] = [
3
];
}
}
rv.push(q);
}
return rv;
}
// helper: runlength encoding with increment step: code, length: step (default step = 0)
// `this` references an array
function s(c, l, a) {
a = a || 0;
for (var i = 0; i < l; i++) {
this.push(c);
c += a;
}
}
// helper: duplicate sequence from *relative* offset and length.
// `this` references an array
function c(i, l) {
i = this.length - i;
for (l += i; i < l; i++) {
this.push(this[i]);
}
}
// helper: unpack an array using helpers and data, all passed in an array argument 'a'.
function u(a) {
var rv = [];
for (var i = 0, l = a.length; i < l; i++) {
var e = a[i];
// Is this entry a helper function?
if (typeof e === 'function') {
i++;
e.apply(rv, a[i]);
} else {
rv.push(e);
}
}
return rv;
}
var parser = {
// Code Generator Information Report
// ---------------------------------
//
// Options:
//
// default action mode: ............. ["classic","merge"]
// test-compile action mode: ........ "parser:*,lexer:*"
// try..catch: ...................... true
// default resolve on conflict: ..... true
// on-demand look-ahead: ............ false
// error recovery token skip maximum: 3
// yyerror in parse actions is: ..... NOT recoverable,
// yyerror in lexer actions and other non-fatal lexer are:
// .................................. NOT recoverable,
// debug grammar/output: ............ false
// has partial LR conflict upgrade: true
// rudimentary token-stack support: false
// parser table compression mode: ... 2
// export debug tables: ............. false
// export *all* tables: ............. false
// module type: ..................... commonjs
// parser engine type: .............. lalr
// output main() in the module: ..... true
// has user-specified main(): ....... false
// has user-specified require()/import modules for main():
// .................................. false
// number of expected conflicts: .... 0
//
//
// Parser Analysis flags:
//
// no significant actions (parser is a language matcher only):
// .................................. false
// uses yyleng: ..................... false
// uses yylineno: ................... false
// uses yytext: ..................... false
// uses yylloc: ..................... false
// uses ParseError API: ............. false
// uses YYERROR: .................... false
// uses YYRECOVERING: ............... false
// uses YYERROK: .................... false
// uses YYCLEARIN: .................. false
// tracks rule values: .............. true
// assigns rule values: ............. true
// uses location tracking: .......... false
// assigns location: ................ false
// uses yystack: .................... false
// uses yysstack: ................... false
// uses yysp: ....................... true
// uses yyrulelength: ............... false
// uses yyMergeLocationInfo API: .... false
// has error recovery: .............. true
// has error reporting: ............. false
//
// --------- END OF REPORT -----------
trace: function no_op_trace() { },
JisonParserError: JisonParserError,
yy: {},
options: {
type: "lalr",
hasPartialLrUpgradeOnConflict: true,
errorRecoveryTokenDiscardCount: 3
},
symbols_: {
"!": 19,
"!=": 195,
"$accept": 0,
"$end": 1,
"%": 16,
"(": 4,
")": 5,
"*": 14,
"+": 13,
",": 8,
"-": 12,
"/": 15,
":": 3,
";": 11,
"<": 18,
"<=": 197,
"=": 9,
"==": 194,
">": 17,
">=": 196,
"?": 10,
"ABS": 128,
"ACLS": 56,
"AND": 191,
"ASC": 141,
"ATAN": 140,
"BEEP": 112,
"BGCHK": 150,
"BGCLIP": 106,
"BGCLR": 105,
"BGCOPY": 111,
"BGFILL": 109,
"BGMCHK": 151,
"BGMCLEAR": 118,
"BGMGETV": 152,
"BGMPLAY": 113,
"BGMPRG": 120,
"BGMSET": 116,
"BGMSETD": 117,
"BGMSETV": 119,
"BGMSTOP": 114,
"BGMVOL": 115,
"BGOFS": 107,
"BGPAGE": 104,
"BGPUT": 108,
"BGREAD": 110,
"BREPEAT": 60,
"BTRIG": 124,
"BUTTON": 123,
"CANCEL": 176,
"CHKCHR": 122,
"CHR$": 155,
"CHRINIT": 88,
"CHRREAD": 90,
"CHRSET": 89,
"CLEAR": 28,
"CLS": 53,
"COLINIT": 85,
"COLOR": 54,
"COLREAD": 87,
"COLSET": 86,
"COMMENT": 20,
"COS": 138,
"CSRX": 161,
"CSRY": 162,
"DATA": 49,
"DATE$": 200,
"DEG": 136,
"DELETE": 67,
"DIM": 27,
"DTREAD": 52,
"ELSE": 47,
"END": 40,
"ENDL": 21,
"EOF": 1,
"ERL": 166,
"ERR": 165,
"EXEC": 71,
"EXP": 131,
"FALSE": 175,
"FLOOR": 126,
"FOR": 41,
"FREEMEM": 163,
"FREEVAR": 178,
"FUNCNO": 177,
"GBOX": 78,
"GCIRCLE": 80,
"GCLS": 74,
"GCOLOR": 73,
"GCOPY": 83,
"GDRAWMD": 82,
"GFILL": 79,
"GLINE": 77,
"GOSUB": 37,
"GOTO": 36,
"GPAGE": 72,
"GPAINT": 76,
"GPRIO": 81,
"GPSET": 75,
"GPUTCHR": 84,
"GSPOIT": 144,
"HEX$": 156,
"ICONCHK": 125,
"ICONCLR": 64,
"ICONPAGE": 186,
"ICONPUSE": 185,
"ICONSET": 63,
"IF": 45,
"INKEY$": 154,
"INPUT": 58,
"INSTR": 143,
"KEY": 29,
"KEYBOARD": 179,
"LABEL": 23,
"LEFT$": 159,
"LEN": 142,
"LINPUT": 59,
"LOAD": 65,
"LOCATE": 55,
"LOG": 132,
"MAINCNTH": 172,
"MAINCNTL": 173,
"MEM$": 203,
"MID$": 157,
"NEXT": 44,
"NOT": 198,
"NUMB10": 188,
"NUMB16": 190,
"NUMB2": 189,
"NUMVAR": 24,
"ON": 35,
"OR": 192,
"PACKAGE$": 202,
"PI": 134,
"PNLSTR": 62,
"PNLTYPE": 61,
"POW": 133,
"PRGNAME$": 201,
"PRINT": 26,
"RAD": 135,
"READ": 48,
"RECVFILE": 69,
"REM": 22,
"RENAME": 68,
"RESTORE": 50,
"RESULT": 167,
"RETURN": 38,
"RIGHT$": 158,
"RND": 127,
"RSORT": 32,
"SAVE": 66,
"SENDFILE": 70,
"SGN": 129,
"SIN": 137,
"SORT": 31,
"SPANGLE": 98,
"SPANIM": 97,
"SPCHK": 145,
"SPCHR": 96,
"SPCLR": 93,
"SPCOL": 102,
"SPCOLVEC": 103,
"SPGETV": 146,
"SPHIT": 147,
"SPHITNO": 180,
"SPHITRC": 149,
"SPHITSP": 148,
"SPHITT": 183,
"SPHITX": 181,
"SPHITY": 182,
"SPHOME": 94,
"SPOFS": 95,
"SPPAGE": 91,
"SPREAD": 100,
"SPSCALE": 99,
"SPSET": 92,
"SPSETV": 101,
"SQR": 130,
"STEP": 43,
"STOP": 39,
"STR$": 153,
"STRING": 204,
"STRVAR": 25,
"SUBST$": 160,
"SWAP": 30,
"SYSBEEP": 187,
"TABSTEP": 184,
"TAN": 139,
"TCHST": 170,
"TCHTIME": 171,
"TCHX": 168,
"TCHY": 169,
"THEN": 46,
"TIME$": 199,
"TMREAD": 51,
"TO": 42,
"TRUE": 174,
"VAL": 121,
"VERSION": 164,
"VISIBLE": 57,
"VSYNC": 33,
"WAIT": 34,
"XOR": 193,
"[": 6,
"]": 7,
"abs": 320,
"acls": 239,
"asc": 333,
"atan": 332,
"beep": 295,
"bgchk": 342,
"bgclip": 289,
"bgclr": 288,
"bgcopy": 294,
"bgfill": 292,
"bgmchk": 343,
"bgmclear": 301,
"bgmgetv": 344,
"bgmplay": 296,
"bgmprg": 303,
"bgmset": 299,
"bgmsetd": 300,
"bgmsetv": 302,
"bgmstop": 297,
"bgmvol": 298,
"bgofs": 290,
"bgpage": 287,
"bgput": 291,
"bgread": 293,
"brepeat": 243,
"btrig": 316,
"button": 315,
"chkchr": 314,
"chr": 348,
"chrinit": 271,
"chrread": 273,
"chrset": 272,
"clear": 215,
"cls": 236,
"colinit": 268,
"color": 237,
"colread": 270,
"colset": 269,
"command": 212,
"cos": 330,
"data": 232,
"dataargs": 305,
"declare": 211,
"deg": 328,
"delete": 250,
"dim": 214,
"dimargs": 310,
"dtread": 235,
"end": 227,
"error": 2,
"exec": 254,
"exp": 323,
"floor": 318,
"for": 228,
"gbox": 261,
"gcircle": 263,
"gcls": 257,
"gcolor": 256,
"gcopy": 266,
"gdrawmd": 265,
"gfill": 262,
"gline": 260,
"gosub": 224,
"goto": 223,
"gpage": 255,
"gpaint": 259,
"gprio": 264,
"gpset": 258,
"gputchr": 267,
"gspoit": 336,
"hex": 349,
"iconchk": 317,
"iconclr": 247,
"iconset": 246,
"if": 230,
"ifcommands": 307,
"inkey": 347,
"input": 241,
"instr": 335,
"key": 216,
"label": 207,
"labelacc": 208,
"left": 352,
"len": 334,
"line": 206,
"linput": 242,
"load": 248,
"locate": 238,
"log": 324,
"mid": 350,
"mmllist": 304,
"next": 229,
"numarray": 209,
"number": 356,
"numberfunction": 312,
"numvariable": 362,
"on": 222,
"onargs": 308,
"pi": 326,
"pnlstr": 245,
"pnltype": 244,
"pow": 325,
"print": 213,
"printargs": 311,
"program": 205,
"rad": 327,
"read": 231,
"readargs": 306,
"readnumvar": 354,
"readstrvar": 357,
"recvfile": 252,
"rename": 251,
"restore": 233,
"return": 225,
"right": 351,
"rnd": 319,
"rsort": 219,
"save": 249,
"sendfile": 253,
"sgn": 321,
"sin": 329,
"sort": 218,
"sortargs": 309,
"spangle": 281,
"spanim": 280,
"spchk": 337,
"spchr": 279,
"spclr": 276,
"spcol": 285,
"spcolvec": 286,
"spgetv": 338,
"sphit": 339,
"sphitrc": 341,
"sphitsp": 340,
"sphome": 277,
"spofs": 278,
"sppage": 274,
"spread": 283,
"spscale": 282,
"spset": 275,
"spsetv": 284,
"sqr": 322,
"stop": 226,
"str": 346,
"strarray": 210,
"string": 359,
"stringfunction": 345,
"strvariable": 361,
"subst": 353,
"swap": 217,
"tan": 331,
"tmread": 234,
"val": 313,
"variable": 360,
"visible": 240,
"vsync": 220,
"wait": 221,
"writenumvar": 355,
"writestrvar": 358
},
terminals_: {
1: "EOF",
2: "error",
3: ":",
4: "(",
5: ")",
6: "[",
7: "]",
8: ",",
9: "=",
10: "?",
11: ";",
12: "-",
13: "+",
14: "*",
15: "/",
16: "%",
17: ">",
18: "<",
19: "!",
20: "COMMENT",
21: "ENDL",
22: "REM",
23: "LABEL",
24: "NUMVAR",
25: "STRVAR",