style-script 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.
@@ -0,0 +1,29 @@
1
+ module StyleScript
2
+
3
+ # Racc will raise this Exception whenever a syntax error occurs. The main
4
+ # benefit over the Racc::ParseError is that the StyleScript::ParseError is
5
+ # line-number aware.
6
+ class ParseError < Racc::ParseError
7
+
8
+ TOKEN_MAP = {
9
+ 'INDENT' => 'indent',
10
+ 'OUTDENT' => 'outdent',
11
+ "\n" => 'newline'
12
+ }
13
+
14
+ def initialize(token_id, value, stack=nil, message=nil)
15
+ @token_id, @value, @stack, @message = token_id, value, stack, message
16
+ end
17
+
18
+ def message
19
+ line = @value.respond_to?(:line) ? @value.line : "END"
20
+ line_part = "line #{line}:"
21
+ id_part = @token_id != @value.to_s ? " unexpected #{@token_id.to_s.downcase}" : ""
22
+ val_part = @message || "for #{TOKEN_MAP[@value.to_s] || "'#{@value}'"}"
23
+ "#{line_part} syntax error, #{val_part}#{id_part}"
24
+ end
25
+ alias_method :inspect, :message
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,544 @@
1
+ (function(){
2
+ var Parser, __a, __b, __c, __d, __e, __f, bnf, grammar, name, non_terminal, o, operators, option, parser, part, tokens, unwrap;
3
+ var __hasProp = Object.prototype.hasOwnProperty;
4
+ Parser = require('jison').Parser;
5
+ process.mixin(require('./nodes'));
6
+ // DSL ===================================================================
7
+ // Detect functions: [
8
+ unwrap = /function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/;
9
+ // Quickie DSL for Jison access.
10
+ o = function o(pattern_string, func) {
11
+ var match;
12
+ if (func) {
13
+ func = (match = (func + "").match(unwrap)) ? match[1] : '(' + func + '())';
14
+ return [pattern_string, '$$ = ' + func + ';'];
15
+ } else {
16
+ return [pattern_string, '$$ = $1;'];
17
+ }
18
+ };
19
+ // Precedence ===========================================================
20
+ operators = [["left", '?'], ["right", 'NOT', '!', '!!', '~', '++', '--'], ["left", '*', '/', '%'], ["left", '+', '-'], ["left", '<<', '>>', '>>>'], ["left", '&', '|', '^'], ["left", '<=', '<', '>', '>='], ["right", '==', '!=', 'IS', 'ISNT'], ["left", '&&', '||', 'AND', 'OR'], ["right", '-=', '+=', '/=', '*=', '%='], ["right", 'DELETE', 'INSTANCEOF', 'TYPEOF'], ["left", '.'], ["right", 'INDENT'], ["left", 'OUTDENT'], ["right", 'WHEN', 'LEADING_WHEN', 'IN', 'OF', 'BY'], ["right", 'THROW', 'FOR', 'NEW', 'SUPER'], ["left", 'EXTENDS'], ["left", '||=', '&&=', '?='], ["right", 'ASSIGN', 'RETURN'], ["right", '->', '=>', 'UNLESS', 'IF', 'ELSE', 'WHILE']];
21
+ // Grammar ==============================================================
22
+ grammar = {
23
+ // All parsing will end in this rule, being the trunk of the AST.
24
+ Root: [o("", function() {
25
+ return new Expressions();
26
+ }), o("TERMINATOR", function() {
27
+ return new Expressions();
28
+ }), o("Expressions"), o("Block TERMINATOR")
29
+ ],
30
+ // Any list of expressions or method body, seperated by line breaks or semis.
31
+ Expressions: [o("Expression", function() {
32
+ return Expressions.wrap([$1]);
33
+ }), o("Expressions TERMINATOR Expression", function() {
34
+ return $1.push($3);
35
+ }), o("Expressions TERMINATOR")
36
+ ],
37
+ // All types of expressions in our language. The basic unit of StyleScript
38
+ // is the expression.
39
+ Expression: [o("Value"), o("Call"), o("Code"), o("Operation"), o("Assign"), o("If"), o("Try"), o("Throw"), o("Return"), o("While"), o("For"), o("Switch"), o("Extends"), o("Splat"), o("Existence"), o("Comment")],
40
+ // A block of expressions. Note that the Rewriter will convert some postfix
41
+ // forms into blocks for us, by altering the token stream.
42
+ Block: [o("INDENT Expressions OUTDENT", function() {
43
+ return $2;
44
+ }), o("INDENT OUTDENT", function() {
45
+ return new Expressions();
46
+ })
47
+ ],
48
+ // All hard-coded values. These can be printed straight to JavaScript.
49
+ Literal: [o("NUMBER", function() {
50
+ return new LiteralNode(yytext);
51
+ }), o("STRING", function() {
52
+ return new LiteralNode(yytext);
53
+ }), o("JS", function() {
54
+ return new LiteralNode(yytext);
55
+ }), o("REGEX", function() {
56
+ return new LiteralNode(yytext);
57
+ }), o("BREAK", function() {
58
+ return new LiteralNode(yytext);
59
+ }), o("CONTINUE", function() {
60
+ return new LiteralNode(yytext);
61
+ }), o("ARGUMENTS", function() {
62
+ return new LiteralNode(yytext);
63
+ }), o("TRUE", function() {
64
+ return new LiteralNode(true);
65
+ }), o("FALSE", function() {
66
+ return new LiteralNode(false);
67
+ }), o("YES", function() {
68
+ return new LiteralNode(true);
69
+ }), o("NO", function() {
70
+ return new LiteralNode(false);
71
+ }), o("ON", function() {
72
+ return new LiteralNode(true);
73
+ }), o("OFF", function() {
74
+ return new LiteralNode(false);
75
+ })
76
+ ],
77
+ // Assignment to a variable (or index).
78
+ Assign: [o("Value ASSIGN Expression", function() {
79
+ return new AssignNode($1, $3);
80
+ })
81
+ ],
82
+ // Assignment within an object literal (can be quoted).
83
+ AssignObj: [o("IDENTIFIER ASSIGN Expression", function() {
84
+ return new AssignNode(new ValueNode(new LiteralNode(yytext)), $3, 'object');
85
+ }), o("STRING ASSIGN Expression", function() {
86
+ return new AssignNode(new ValueNode(new LiteralNode(yytext)), $3, 'object');
87
+ }), o("NUMBER ASSIGN Expression", function() {
88
+ return new AssignNode(new ValueNode(new LiteralNode(yytext)), $3, 'object');
89
+ }), o("Comment")
90
+ ],
91
+ // A return statement.
92
+ Return: [o("RETURN Expression", function() {
93
+ return new ReturnNode($2);
94
+ }), o("RETURN", function() {
95
+ return new ReturnNode(new ValueNode(new LiteralNode('null')));
96
+ })
97
+ ],
98
+ // A comment.
99
+ Comment: [o("COMMENT", function() {
100
+ return new CommentNode(yytext);
101
+ })
102
+ ],
103
+ //
104
+ // # Arithmetic and logical operators
105
+ // # For Ruby's Operator precedence, see: [
106
+ // # https://www.cs.auckland.ac.nz/references/ruby/ProgrammingRuby/language.html
107
+ // Operation: [
108
+ // o "! Expression", -> new OpNode($1, $2)
109
+ // o "!! Expression", -> new OpNode($1, $2)
110
+ // o "- Expression", -> new OpNode($1, $2)
111
+ // o "+ Expression", -> new OpNode($1, $2)
112
+ // o "NOT Expression", -> new OpNode($1, $2)
113
+ // o "~ Expression", -> new OpNode($1, $2)
114
+ // o "-- Expression", -> new OpNode($1, $2)
115
+ // o "++ Expression", -> new OpNode($1, $2)
116
+ // o "DELETE Expression", -> new OpNode($1, $2)
117
+ // o "TYPEOF Expression", -> new OpNode($1, $2)
118
+ // o "Expression --", -> new OpNode($2, $1, null, true)
119
+ // o "Expression ++", -> new OpNode($2, $1, null, true)
120
+ //
121
+ // o "Expression * Expression", -> new OpNode($2, $1, $3)
122
+ // o "Expression / Expression", -> new OpNode($2, $1, $3)
123
+ // o "Expression % Expression", -> new OpNode($2, $1, $3)
124
+ //
125
+ // o "Expression + Expression", -> new OpNode($2, $1, $3)
126
+ // o "Expression - Expression", -> new OpNode($2, $1, $3)
127
+ //
128
+ // o "Expression << Expression", -> new OpNode($2, $1, $3)
129
+ // o "Expression >> Expression", -> new OpNode($2, $1, $3)
130
+ // o "Expression >>> Expression", -> new OpNode($2, $1, $3)
131
+ //
132
+ // o "Expression & Expression", -> new OpNode($2, $1, $3)
133
+ // o "Expression | Expression", -> new OpNode($2, $1, $3)
134
+ // o "Expression ^ Expression", -> new OpNode($2, $1, $3)
135
+ //
136
+ // o "Expression <= Expression", -> new OpNode($2, $1, $3)
137
+ // o "Expression < Expression", -> new OpNode($2, $1, $3)
138
+ // o "Expression > Expression", -> new OpNode($2, $1, $3)
139
+ // o "Expression >= Expression", -> new OpNode($2, $1, $3)
140
+ //
141
+ // o "Expression == Expression", -> new OpNode($2, $1, $3)
142
+ // o "Expression != Expression", -> new OpNode($2, $1, $3)
143
+ // o "Expression IS Expression", -> new OpNode($2, $1, $3)
144
+ // o "Expression ISNT Expression", -> new OpNode($2, $1, $3)
145
+ //
146
+ // o "Expression && Expression", -> new OpNode($2, $1, $3)
147
+ // o "Expression || Expression", -> new OpNode($2, $1, $3)
148
+ // o "Expression AND Expression", -> new OpNode($2, $1, $3)
149
+ // o "Expression OR Expression", -> new OpNode($2, $1, $3)
150
+ // o "Expression ? Expression", -> new OpNode($2, $1, $3)
151
+ //
152
+ // o "Expression -= Expression", -> new OpNode($2, $1, $3)
153
+ // o "Expression += Expression", -> new OpNode($2, $1, $3)
154
+ // o "Expression /= Expression", -> new OpNode($2, $1, $3)
155
+ // o "Expression *= Expression", -> new OpNode($2, $1, $3)
156
+ // o "Expression %= Expression", -> new OpNode($2, $1, $3)
157
+ // o "Expression ||= Expression", -> new OpNode($2, $1, $3)
158
+ // o "Expression &&= Expression", -> new OpNode($2, $1, $3)
159
+ // o "Expression ?= Expression", -> new OpNode($2, $1, $3)
160
+ //
161
+ // o "Expression INSTANCEOF Expression", -> new OpNode($2, $1, $3)
162
+ // o "Expression IN Expression", -> new OpNode($2, $1, $3)
163
+ // ]
164
+ // The existence operator.
165
+ Existence: [o("Expression ?", function() {
166
+ return new ExistenceNode($1);
167
+ })
168
+ ],
169
+ // Function definition.
170
+ Code: [o("PARAM_START ParamList PARAM_END FuncGlyph Block", function() {
171
+ return new CodeNode($2, $5, $4);
172
+ }), o("FuncGlyph Block", function() {
173
+ return new CodeNode([], $2, $1);
174
+ })
175
+ ],
176
+ // The symbols to signify functions, and bound functions.
177
+ FuncGlyph: [o("->", function() {
178
+ return 'func';
179
+ }), o("=>", function() {
180
+ return 'boundfunc';
181
+ })
182
+ ],
183
+ // The parameters to a function definition.
184
+ ParamList: [o("Param", function() {
185
+ return [$1];
186
+ }), o("ParamList , Param", function() {
187
+ return $1.push($3);
188
+ })
189
+ ],
190
+ // A Parameter (or ParamSplat) in a function definition.
191
+ Param: [o("PARAM", function() {
192
+ return new LiteralNode(yytext);
193
+ }), o("PARAM . . .", function() {
194
+ return new SplatNode(yytext);
195
+ })
196
+ ],
197
+ // A regular splat.
198
+ Splat: [o("Expression . . .", function() {
199
+ return new SplatNode($1);
200
+ })
201
+ ],
202
+ // Expressions that can be treated as values.
203
+ Value: [o("IDENTIFIER", function() {
204
+ return new ValueNode(new LiteralNode(yytext));
205
+ }), o("Literal", function() {
206
+ return new ValueNode($1);
207
+ }), o("Array", function() {
208
+ return new ValueNode($1);
209
+ }), o("Object", function() {
210
+ return new ValueNode($1);
211
+ }), o("Parenthetical", function() {
212
+ return new ValueNode($1);
213
+ }), o("Range", function() {
214
+ return new ValueNode($1);
215
+ }), o("This", function() {
216
+ return new ValueNode($1);
217
+ }), o("Value Accessor", function() {
218
+ return $1.push($2);
219
+ }), o("Invocation Accessor", function() {
220
+ return new ValueNode($1, [$2]);
221
+ })
222
+ ],
223
+ // Accessing into an object or array, through dot or index notation.
224
+ Accessor: [o("PROPERTY_ACCESS IDENTIFIER", function() {
225
+ return new AccessorNode(new LiteralNode(yytext));
226
+ }), o("PROTOTYPE_ACCESS IDENTIFIER", function() {
227
+ return new AccessorNode(new LiteralNode(yytext), 'prototype');
228
+ }), o("SOAK_ACCESS IDENTIFIER", function() {
229
+ return new AccessorNode(new LiteralNode(yytext), 'soak');
230
+ }), o("Index"), o("Slice", function() {
231
+ return new SliceNode($1);
232
+ })
233
+ ],
234
+ // Indexing into an object or array.
235
+ Index: [o("INDEX_START Expression INDEX_END", function() {
236
+ return new IndexNode($2);
237
+ })
238
+ ],
239
+ // An object literal.
240
+ Object: [o("{ AssignList }", function() {
241
+ return new ObjectNode($2);
242
+ })
243
+ ],
244
+ // Assignment within an object literal (comma or newline separated).
245
+ AssignList: [o("", function() {
246
+ return [];
247
+ }), o("AssignObj", function() {
248
+ return [$1];
249
+ }), o("AssignList , AssignObj", function() {
250
+ return $1.push($3);
251
+ }), o("AssignList TERMINATOR AssignObj", function() {
252
+ return $1.push($3);
253
+ }), o("AssignList , TERMINATOR AssignObj", function() {
254
+ return $1.push($4);
255
+ }), o("INDENT AssignList OUTDENT", function() {
256
+ return $2;
257
+ })
258
+ ],
259
+ // All flavors of function call (instantiation, super, and regular).
260
+ Call: [o("Invocation", function() {
261
+ return $1;
262
+ }), o("NEW Invocation", function() {
263
+ return $2.new_instance();
264
+ }), o("Super", function() {
265
+ return $1;
266
+ })
267
+ ],
268
+ // Extending an object's prototype.
269
+ Extends: [o("Value EXTENDS Value", function() {
270
+ return new ExtendsNode($1, $3);
271
+ })
272
+ ],
273
+ // A generic function invocation.
274
+ Invocation: [o("Value Arguments", function() {
275
+ return new CallNode($1, $2);
276
+ }), o("Invocation Arguments", function() {
277
+ return new CallNode($1, $2);
278
+ })
279
+ ],
280
+ // The list of arguments to a function invocation.
281
+ Arguments: [o("CALL_START ArgList CALL_END", function() {
282
+ return $2;
283
+ })
284
+ ],
285
+ // Calling super.
286
+ Super: [o("SUPER CALL_START ArgList CALL_END", function() {
287
+ return new CallNode('super', $3);
288
+ })
289
+ ],
290
+ // This references, either naked or to a property.
291
+ This: [o("@", function() {
292
+ return new ThisNode();
293
+ }), o("@ IDENTIFIER", function() {
294
+ return new ThisNode(yytext);
295
+ })
296
+ ],
297
+ // The range literal.
298
+ Range: [o("[ Expression . . Expression ]", function() {
299
+ return new RangeNode($2, $5);
300
+ }), o("[ Expression . . . Expression ]", function() {
301
+ return new RangeNode($2, $6, true);
302
+ })
303
+ ],
304
+ // The slice literal.
305
+ Slice: [o("INDEX_START Expression . . Expression INDEX_END", function() {
306
+ return new RangeNode($2, $5);
307
+ }), o("INDEX_START Expression . . . Expression INDEX_END", function() {
308
+ return new RangeNode($2, $6, true);
309
+ })
310
+ ],
311
+ // The array literal.
312
+ Array: [o("[ ArgList ]", function() {
313
+ return new ArrayNode($2);
314
+ })
315
+ ],
316
+ // A list of arguments to a method call, or as the contents of an array.
317
+ ArgList: [o("", function() {
318
+ return [];
319
+ }), o("Expression", function() {
320
+ return [$1];
321
+ }), o("INDENT Expression", function() {
322
+ return [$2];
323
+ }), o("ArgList , Expression", function() {
324
+ return $1.push($3);
325
+ }), o("ArgList TERMINATOR Expression", function() {
326
+ return $1.push($3);
327
+ }), o("ArgList , TERMINATOR Expression", function() {
328
+ return $1.push($4);
329
+ }), o("ArgList , INDENT Expression", function() {
330
+ return $1.push($4);
331
+ }), o("ArgList OUTDENT", function() {
332
+ return $1;
333
+ })
334
+ ],
335
+ // Just simple, comma-separated, required arguments (no fancy syntax).
336
+ SimpleArgs: [o("Expression", function() {
337
+ return $1;
338
+ }), o("SimpleArgs , Expression", function() {
339
+ return ([$1].push($3)).reduce(function(a, b) {
340
+ return a.concat(b);
341
+ });
342
+ })
343
+ ],
344
+ // Try/catch/finally exception handling blocks.
345
+ Try: [o("TRY Block Catch", function() {
346
+ return new TryNode($2, $3[0], $3[1]);
347
+ }), o("TRY Block FINALLY Block", function() {
348
+ return new TryNode($2, null, null, $4);
349
+ }), o("TRY Block Catch FINALLY Block", function() {
350
+ return new TryNode($2, $3[0], $3[1], $5);
351
+ })
352
+ ],
353
+ // A catch clause.
354
+ Catch: [o("CATCH IDENTIFIER Block", function() {
355
+ return [$2, $3];
356
+ })
357
+ ],
358
+ // Throw an exception.
359
+ Throw: [o("THROW Expression", function() {
360
+ return new ThrowNode($2);
361
+ })
362
+ ],
363
+ // Parenthetical expressions.
364
+ Parenthetical: [o("( Expression )", function() {
365
+ return new ParentheticalNode($2);
366
+ })
367
+ ],
368
+ // The while loop. (there is no do..while).
369
+ While: [o("WHILE Expression Block", function() {
370
+ return new WhileNode($2, $3);
371
+ }), o("WHILE Expression", function() {
372
+ return new WhileNode($2, null);
373
+ }), o("Expression WHILE Expression", function() {
374
+ return new WhileNode($3, Expressions.wrap([$1]));
375
+ })
376
+ ],
377
+ // Array comprehensions, including guard and current index.
378
+ // Looks a little confusing, check nodes.rb for the arguments to ForNode.
379
+ For: [o("Expression FOR ForVariables ForSource", function() {
380
+ return new ForNode($1, $4, $3[0], $3[1]);
381
+ }), o("FOR ForVariables ForSource Block", function() {
382
+ return new ForNode($4, $3, $2[0], $2[1]);
383
+ })
384
+ ],
385
+ // An array comprehension has variables for the current element and index.
386
+ ForVariables: [o("IDENTIFIER", function() {
387
+ return [$1];
388
+ }), o("IDENTIFIER , IDENTIFIER", function() {
389
+ return [$1, $3];
390
+ })
391
+ ],
392
+ // The source of the array comprehension can optionally be filtered.
393
+ ForSource: [o("IN Expression", function() {
394
+ return {
395
+ source: $2
396
+ };
397
+ }), o("OF Expression", function() {
398
+ return {
399
+ source: $2,
400
+ object: true
401
+ };
402
+ }), o("ForSource WHEN Expression", function() {
403
+ $1.filter = $3;
404
+ return $1;
405
+ }), o("ForSource BY Expression", function() {
406
+ $1.step = $3;
407
+ return $1;
408
+ })
409
+ ],
410
+ // Switch/When blocks.
411
+ Switch: [o("SWITCH Expression INDENT Whens OUTDENT", function() {
412
+ return $4.rewrite_condition($2);
413
+ }), o("SWITCH Expression INDENT Whens ELSE Block OUTDENT", function() {
414
+ return $4.rewrite_condition($2).add_else($6);
415
+ })
416
+ ],
417
+ // The inner list of whens.
418
+ Whens: [o("When", function() {
419
+ return $1;
420
+ }), o("Whens When", function() {
421
+ return $1.push($2);
422
+ })
423
+ ],
424
+ // An individual when.
425
+ When: [o("LEADING_WHEN SimpleArgs Block", function() {
426
+ return new IfNode($2, $3, null, {
427
+ statement: true
428
+ });
429
+ }), o("LEADING_WHEN SimpleArgs Block TERMINATOR", function() {
430
+ return new IfNode($2, $3, null, {
431
+ statement: true
432
+ });
433
+ }), o("Comment TERMINATOR When", function() {
434
+ return $3.add_comment($1);
435
+ })
436
+ ],
437
+ // The most basic form of "if".
438
+ IfBlock: [o("IF Expression Block", function() {
439
+ return new IfNode($2, $3);
440
+ })
441
+ ],
442
+ // An elsif portion of an if-else block.
443
+ ElsIf: [o("ELSE IfBlock", function() {
444
+ return $2.force_statement();
445
+ })
446
+ ],
447
+ // Multiple elsifs can be chained together.
448
+ ElsIfs: [o("ElsIf", function() {
449
+ return $1;
450
+ }), o("ElsIfs ElsIf", function() {
451
+ return $1.add_else($2);
452
+ })
453
+ ],
454
+ // Terminating else bodies are strictly optional.
455
+ ElseBody: [o("", function() {
456
+ return null;
457
+ }), o("ELSE Block", function() {
458
+ return $2;
459
+ })
460
+ ],
461
+ // All the alternatives for ending an if-else block.
462
+ IfEnd: [o("ElseBody", function() {
463
+ return $1;
464
+ }), o("ElsIfs ElseBody", function() {
465
+ return $1.add_else($2);
466
+ })
467
+ ],
468
+ // The full complement of if blocks, including postfix one-liner ifs and unlesses.
469
+ If: [o("IfBlock IfEnd", function() {
470
+ return $1.add_else($2);
471
+ }), o("Expression IF Expression", function() {
472
+ return new IfNode($3, Expressions.wrap([$1]), null, {
473
+ statement: true
474
+ });
475
+ }), o("Expression UNLESS Expression", function() {
476
+ return new IfNode($3, Expressions.wrap([$1]), null, {
477
+ statement: true,
478
+ invert: true
479
+ });
480
+ })
481
+ ]
482
+ };
483
+ // Helpers ==============================================================
484
+ // Make the Jison parser.
485
+ bnf = {
486
+ };
487
+ tokens = [];
488
+ __a = grammar;
489
+ for (name in __a) {
490
+ non_terminal = __a[name];
491
+ if (__hasProp.call(__a, name)) {
492
+ bnf[name] = (function() {
493
+ __b = []; __c = non_terminal;
494
+ for (__d = 0; __d < __c.length; __d++) {
495
+ option = __c[__d];
496
+ __b.push((function() {
497
+ __e = option[0].split(" ");
498
+ for (__f = 0; __f < __e.length; __f++) {
499
+ part = __e[__f];
500
+ !grammar[part] ? tokens.push(part) : null;
501
+ }
502
+ name === "Root" ? (option[1] = "return " + option[1]) : null;
503
+ return option;
504
+ }).call(this));
505
+ }
506
+ return __b;
507
+ }).call(this);
508
+ }
509
+ }
510
+ tokens = tokens.join(" ");
511
+ parser = new Parser({
512
+ tokens: tokens,
513
+ bnf: bnf,
514
+ operators: operators,
515
+ startSymbol: 'Root'
516
+ }, {
517
+ debug: false
518
+ });
519
+ // Thin wrapper around the real lexer
520
+ parser.lexer = {
521
+ lex: function lex() {
522
+ var token;
523
+ token = this.tokens[this.pos] || [""];
524
+ this.pos += 1;
525
+ this.yylineno = token[2];
526
+ this.yytext = token[1];
527
+ return token[0];
528
+ },
529
+ setInput: function setInput(tokens) {
530
+ this.tokens = tokens;
531
+ return this.pos = 0;
532
+ },
533
+ upcomingInput: function upcomingInput() {
534
+ return "";
535
+ },
536
+ showPosition: function showPosition() {
537
+ return this.pos;
538
+ }
539
+ };
540
+ exports.Parser = function Parser() { };
541
+ exports.Parser.prototype.parse = function parse(tokens) {
542
+ return parser.parse(tokens);
543
+ };
544
+ })();