1 /*
  2     JessieCode Parser and Compiler
  3 
  4     Copyright 2011-2012
  5         Michael Gerhäuser
  6         Alfred Wassermann
  7 
  8     Licensed under the LGPL v3
  9 */
 10 
 11 /**
 12  * @fileoverview JessieCode is a scripting language designed to provide a simple scripting language to build constructions
 13  * with JSXGraph. It is similar to JavaScript, but prevents access to the DOM. Hence, it can be used in community driven
 14  * Math portals which want to use JSXGraph to display interactive math graphics.
 15  */
 16 
 17 /**
 18  * A JessieCode object provides an interfacce to the parser and stores all variables and objects used within a JessieCode script.
 19  * The optional argument <tt>code</tt> is interpreted after initializing. To evaluate more code after initializing a JessieCode instance
 20  * please use {@link JXG.JessieCode#parse}. For code snippets like single expressions use {@link JXG.JessieCode#snippet}.
 21  * @constructor
 22  * @param {String} [code] Code to parse.
 23  * @param {Boolean} [geonext=false] Geonext compatibility mode.
 24  */
 25 JXG.JessieCode = function(code, geonext) {
 26     var i;
 27 
 28     // Control structures
 29 
 30     /**
 31      * Stores all variables, local and global. The current scope is determined by {@link JXG.JessieCode#scope}.
 32      * @type Array
 33      * @private
 34      */
 35     this.sstack = [{}];
 36 
 37     /**
 38      * Defines the current variable scope.
 39      * @type Number
 40      * @private
 41      */
 42     this.scope = 0;
 43 
 44     /**
 45      * A stack used to store the parameter lists for function definitions and calls.
 46      * @type Array
 47      * @private
 48      */
 49     this.pstack = [[]];
 50 
 51     /**
 52      * Determines the parameter stack scope.
 53      * @type Number
 54      * @private
 55      */
 56     this.pscope = 0;
 57 
 58     /**
 59      * Used to store the property-value definition while parsing an object literal.
 60      * @type Array
 61      * @private
 62      */
 63     this.propstack = [{}];
 64 
 65     /**
 66      * The current scope of the object literal stack {@link JXG.JessieCode#propstack}.
 67      * @type Number
 68      * @private
 69      */
 70     this.propscope = 0;
 71 
 72     /**
 73      * Whenever an element attribute is set via <tt>element.attribute = 'something';</tt>, the element is stored
 74      * in here, so following attribute changes can be set without the element: <tt>.attribute = 'something else';</tt>.
 75      * @type JXG.GeometryElement
 76      * @private
 77      */
 78     this.propobj = 0;
 79 
 80     /**
 81      * Store the left hand side of an assignment. If an element is constructed and no attributes are given, this is
 82      * used as the element's name.
 83      * @type Array
 84      * @private
 85      */
 86     this.lhs = [];
 87 
 88     /**
 89      * lhs flag, used by JXG.JessieCode#replaceNames
 90      * @type Boolean
 91      * @default false
 92      */
 93     this.isLHS = false;
 94 
 95     /**
 96      * The id of an HTML node in which innerHTML all warnings are stored (if no <tt>console</tt> object is available).
 97      * @type String
 98      * @default 'jcwarn'
 99      */
100     this.warnLog = 'jcwarn';
101 
102     /**
103      * Built-in functions and constants
104      * @type Object
105      */
106     this.builtIn = this.defineBuiltIn();
107 
108     /**
109      * The board which currently is used to create and look up elements.
110      * @type JXG.Board
111      */
112     this.board = null;
113 
114     this.countLines = true;
115     this.parCurLine = 1;
116     this.parCurColumn = 0;
117 
118     /**
119      * Maximum number of seconds the parser is allowed to run. After that the interpreter is stopped.
120      * @type Number
121      * @default 10000
122      */
123     this.maxRuntime = 10000;
124 
125     if (typeof code === 'string') {
126         this.parse(code);
127     }
128 };
129 
130 
131 JXG.extend(JXG.JessieCode.prototype, /** @lends JXG.JessieCode.prototype */ {
132     /**
133      * Create a new parse tree node.
134      * @param {String} type Type of node, e.g. node_op, node_var, or node_const
135      * @param value The nodes value, e.g. a variables value or a functions body.
136      * @param {Array} children Arbitrary number of child nodes.
137      */
138     node: function (type, value, children) {
139         return {
140             type: type,
141             value: value,
142             children: children
143         };
144     },
145 
146     /**
147      * Create a new parse tree node. Basically the same as node(), but this builds
148      * the children part out of an arbitrary number of parameters, instead of one
149      * array parameter.
150      * @param {String} type Type of node, e.g. node_op, node_var, or node_const
151      * @param value The nodes value, e.g. a variables value or a functions body.
152      * @param children Arbitrary number of parameters; define the child nodes.
153      */
154     createNode: function (type, value, children) {
155         var n = this.node(type, value, []),
156             i;
157 
158         for(i = 2; i < arguments.length; i++)
159             n.children.push( arguments[i] );
160 
161         n.line = this.parCurLine;
162         n.col = this.parCurColumn;
163 
164         return n;
165     },
166 
167     /**
168      * Looks up an {@link JXG.GeometryElement} by its id.
169      * @param {String} id
170      * @returns {JXG.GeometryElement}
171      */
172     getElementById: function (id) {
173         return this.board.objects[id];
174     },
175 
176     /**
177      * Returns a element creator function which takes two parameters: the parents array and the attributes object.
178      * @param {String} vname The element type, e.g. 'point', 'line', 'midpoint'
179      * @returns {function}
180      */
181     creator: (function () {
182         // stores the already defined creators
183         var _ccache = {}, r;
184 
185         r = function (vname) {
186             var f;
187 
188             // _ccache is global, i.e. it is the same for ALL JessieCode instances.
189             // That's why we need the board id here
190             if (typeof _ccache[this.board.id + vname] === 'function') {
191                 return _ccache[this.board.id + vname];
192             } else {
193                 f = (function (that) {
194                     return function (parameters, attributes) {
195                         var attr;
196 
197                         if (JXG.exists(attributes)) {
198                             attr = attributes;
199                         } else {
200                             attr = {name: (that.lhs[that.scope] !== 0 ? that.lhs[that.scope] : '')};
201                         }
202                         return that.board.create(vname, parameters, attr);
203                     }
204                 })(this);
205 
206                 f.creator = true;
207                 _ccache[this.board.id + vname] = f;
208 
209                 return f;
210             }
211 
212         };
213 
214         r.clearCache = function () {
215             _ccache = {};
216         };
217 
218         return r;
219     })(),
220 
221    /**
222      * Assigns a value to a variable in the current scope.
223      * @param {String} vname Variable name
224      * @param {%} value Anything
225      * @see JXG.JessieCode#sstack
226      * @see JXG.JessieCode#scope
227      */
228     letvar: function (vname, value) {
229         if (this.builtIn[vname]) {
230             this._warn('"' + vname + '" is a predefined value.');
231         }
232 
233         this.sstack[this.scope][vname] = value;
234     },
235 
236     /**
237      * Checks if the given variable name can be found in {@link JXG.JessieCode#sstack}.
238      * @param {String} vname
239      * @returns {Number} The position in the local variable stack where the variable can be found. <tt>-1</tt> if it couldn't be found.
240      */
241     isLocalVariable: function (vname) {
242         var s;
243         for (s = this.scope; s > -1; s--) {
244             if (JXG.exists(this.sstack[s][vname])) {
245                 return s;
246             }
247         }
248 
249         return -1;
250     },
251 
252     /**
253      * Checks if the given variable name is a valid creator method.
254      * @param {String} vname
255      * @returns {Boolean}
256      */
257     isCreator: function (vname) {
258         // check for an element with this name
259         return !!JXG.JSXGraph.elements[vname];
260     },
261 
262     /**
263      * Checks if the given variable identifier is a valid member of the JavaScript Math Object.
264      * @param {String} vname
265      * @returns {Boolean}
266      */
267     isMathMethod: function (vname) {
268         return vname !== 'E' && !!Math[vname];
269     },
270 
271     /**
272      * Returns true if the given identifier is a builtIn variable/function.
273      * @param {String} vname
274      * @returns {Boolean}
275      */
276     isBuiltIn: function (vname) {
277         return !!this.builtIn[vname];
278     },
279 
280     /**
281      * Looks up the value of the given variable.
282      * @param {String} vname Name of the variable
283      * @paran {Boolean} [local=false] Only look up the internal symbol table and don't look for
284      * the <tt>vname</tt> in Math or the element list.
285      */
286     getvar: function (vname, local) {
287         var s, undef;
288 
289         local = JXG.def(local, false);
290 
291         s = this.isLocalVariable(vname);
292         if (s > -1) {
293             return this.sstack[s][vname];
294         }
295 
296         // check for an element with this name
297         if (this.isCreator(vname)) {
298             return this.creator(vname);
299         }
300 
301         if (this.isMathMethod(vname)) {
302             return Math[vname];
303         }
304 
305         if (this.isBuiltIn(vname)) {
306             return this.builtIn[vname];
307         }
308 
309         if (!local) {
310             s = JXG.getRef(this.board, vname);
311             if (s !== vname) {
312                 return s;
313             }
314         }
315 
316         return undef;
317     },
318 
319     /**
320      * Looks up a variable identifier in various tables and generates JavaScript code that could be eval'd to get the value.
321      * @param {String} vname Identifier
322      * @param {Boolean} [local=false] Don't resolve ids and names of elements
323      */
324     getvarJS: function (vname, local) {
325         var s;
326 
327         local = JXG.def(local, false);
328 
329         if (JXG.indexOf(this.pstack[this.pscope], vname) > -1) {
330             return vname;
331         }
332 
333         s = this.isLocalVariable(vname);
334         if (s > -1) {
335             return '$jc$.sstack[' + s + '][\'' + vname + '\']';
336         }
337 
338         // check for an element with this name
339         if (this.isCreator(vname)) {
340             return '(function () { var a = Array.prototype.slice.call(arguments, 0); return $jc$.board.create.apply(this, [\'' + vname + '\'].concat(a)); })';
341         }
342 
343         if (this.isMathMethod(vname)) {
344             return 'Math.' + vname;
345         }
346 
347         if (this.isBuiltIn(vname)) {
348             return this.builtIn[vname].src;
349         }
350 
351         if (!local) {
352             if (JXG.isId(this.board, vname)) {
353                 return '$jc$.board.objects[\'' + vname + '\']';
354             } else if (JXG.isName(this.board, vname)) {
355                 return '$jc$.board.elementsByName[\'' + vname + '\']';
356             } else if (JXG.isGroup(this.board, vname)) {
357                 return '$jc$.board.groups[\'' + vname + '\']';
358             }
359             //return 'JXG.getRef(JXG.JSXGraph.boards[$jc$.board.id], \'' + vname + '\')';
360         }
361 
362         return '';
363     },
364 
365     /**
366      * Sets the property <tt>what</tt> of {@link JXG.JessieCode#propobj} to <tt>value</tt>
367      * @param {String} what
368      * @param {%} value
369      */
370     setProp: function (o, what, value) {
371         var par = {}, x, y;
372 
373         if (o.elementClass === JXG.OBJECT_CLASS_POINT && (what === 'X' || what === 'Y')) {
374             // set coords
375 
376             what = what.toLowerCase();
377 
378             // be advised, we've spotted three cases in your AO:
379             // o.isDraggable && typeof value === number:
380             //   stay draggable, just set the new coords (e.g. via moveTo)
381             // o.isDraggable && typeof value === function:
382             //   convert to !o.isDraggable, set the new coords via o.addConstraint()
383             // !o.isDraggable:
384             //   stay !o.isDraggable, update the given coord by overwriting X/YEval
385 
386             if (o.isDraggable && typeof value === 'number') {
387                 x = what === 'x' ? value : o.X();
388                 y = what === 'y' ? value : o.Y();
389 
390                 //o.XEval = function() { return this.coords.usrCoords[1]; };
391                 //o.YEval = function() { return this.coords.usrCoords[2]; };
392                 o.setPosition(JXG.COORDS_BY_USER, x, y);
393             } else if (o.isDraggable && (typeof value === 'function' || typeof value === 'string')) {
394                 x = what === 'x' ? value : o.coords.usrCoords[1];
395                 y = what === 'y' ? value : o.coords.usrCoords[2];
396 
397                 o.addConstraint([x, y]);
398             } else if (!o.isDraggable) {
399                 x = what === 'x' ? value : o.XEval.origin;
400                 y = what === 'y' ? value : o.YEval.origin;
401 
402                 o.addConstraint([x, y]);
403             }
404 
405             this.board.update();
406         } else if (o.type === JXG.OBJECT_TYPE_TEXT && (what === 'X' || what === 'Y')) {
407             if (typeof value === 'number') {
408                 o[what] = function () { return value; };
409             } else if (typeof value === 'function') {
410                 o.isDraggable = false;
411                 o[what] = value;
412             } else if (typeof value === 'string') {
413                 o.isDraggable = false;
414                 o[what] = JXG.createFunction(value, this.board, null, true);
415                 o[what + 'jc'] = value;
416             }
417 
418             o[what].origin = value;
419 
420             this.board.update();
421         } else if (o.type && o.elementClass && o.visProp) {
422             par[what] = value;
423             o.setProperty(par);
424         } else {
425             o[what] = value;
426         }
427     },
428 
429     /**
430      * Encode characters outside the ASCII table into HTML Entities, because JavaScript or JS/CC can't handle a RegEx
431      * applied to a string with unicode characters.
432      * @param {String} string
433      * @returns {String}
434      */
435     utf8_encode : function (string) {
436         var utftext = [], n, c;
437 
438         for (n = 0; n < string.length; n++) {
439             c = string.charCodeAt(n);
440 
441             if (c < 128) {
442                 utftext.push(String.fromCharCode(c));
443             } else {
444                 utftext.push('&#x' + c.toString(16) + ';');
445             }
446 
447         }
448 
449         return utftext.join('');
450     },
451 
452     /**
453      * Parses JessieCode
454      * @param {String} code
455      * @param {Boolean} [geonext=false] Geonext compatibility mode.
456      */
457     parse: function (code, geonext) {
458         var error_cnt = 0,
459             error_off = [],
460             error_la = [],
461             that = this,
462             to,
463             replacegxt = ['Abs', 'ACos', 'ASin', 'ATan','Ceil','Cos','Exp','Factorial','Floor','Log','Max','Min','Random','Round','Sin','Sqrt','Tan','Trunc', 'If', 'Deg', 'Rad', 'Dist'],
464             regex,
465             ccode = code.replace(/\r\n/g,'\n').split('\n'), i, j, cleaned = [];
466 
467         if (!JXG.exists(geonext)) {
468             geonext = false;
469         }
470 
471         for (i = 0; i < ccode.length; i++) {
472             if (!(JXG.trim(ccode[i])[0] === '/' && JXG.trim(ccode[i])[1] === '/')) {
473                 if (geonext) {
474                     for (j = 0; j < replacegxt.length; j++) {
475                         regex = new RegExp(replacegxt[j] + "\\(", 'g');
476                         ccode[i] = ccode[i].replace(regex, replacegxt[j].toLowerCase() + '(');
477                     }
478                 }
479 
480                 cleaned.push(ccode[i]);
481             }
482         }
483         code = cleaned.join('\n');
484         code = this.utf8_encode(code);
485 
486         /*to = window.setTimeout(function () {
487             console.log('CANCEL!');
488             that.cancel = true;
489         }, this.maxRuntime);
490         this.cancel = false;*/
491 
492         if((error_cnt = this._parse(code, error_off, error_la)) > 0) {
493             for(i = 0; i < error_cnt; i++) {
494                 this.line = error_off[i].line;
495                 this._error("Parse error in line " + error_off[i].line + " near >"  + code.substr( error_off[i].offset, 30 ) + "<, expecting \"" + error_la[i].join() + "\"");
496             }
497         }
498 
499         /*window.clearTimeout(to);*/
500 
501         //this.board.update();
502     },
503 
504     /**
505      * Parses a JessieCode snippet, e.g. "3+4", and wraps it into a function, if desired.
506      * @param {String} code A small snippet of JessieCode. Must not be an assignment.
507      * @param {Boolean} funwrap If true, the code is wrapped in a function.
508      * @param {String} varname Name of the parameter(s)
509      * @param {Boolean} [geonext=false] Geonext compatibility mode.
510      */
511     snippet: function (code, funwrap, varname, geonext) {
512         var vname, c, tmp, result;
513 
514         vname = 'jxg__tmp__intern_' + JXG.Util.genUUID().replace(/\-/g, '');
515 
516         if (!JXG.exists(funwrap)) {
517             funwrap = true;
518         }
519 
520         if (!JXG.exists(varname)) {
521             varname = '';
522         }
523 
524         if (!JXG.exists(geonext)) {
525             geonext = false;
526         }
527 
528         // just in case...
529         tmp = this.sstack[0][vname];
530 
531         this.countLines = false;
532 
533         c = vname + ' = ' + (funwrap ? ' function (' + varname + ') { return ' : '') + code + (funwrap ? '; }' : '') + ';';
534         this.parse(c, geonext);
535 
536         result = this.sstack[0][vname];
537         if (JXG.exists(tmp)) {
538             this.sstack[0][vname] = tmp;
539         } else {
540             delete this.sstack[0][vname];
541         }
542 
543         this.countLines = true;
544 
545         return result;
546     },
547 
548     /**
549      * Traverses through the given subtree and changes all values of nodes with the replaced flag set by
550      * {@link JXG.JessieCode#replaceNames} to the name of the element (if not empty).
551      * @param {Object} node
552      */
553     replaceIDs: function (node) {
554         var i, v;
555 
556         if (node.replaced) {
557             // these children exist, if node.replaced is set.
558             v = this.board.objects[node.children[1].children[0].value];
559             if (JXG.exists(v) && JXG.exists(v) && v.name !== '') {
560                 node.type = 'node_var';
561                 node.value = v.name;
562                 // maybe it's not necessary, but just to be sure that everything's cleaned up we better delete all
563                 // children and the replaced flag
564                 node.children.length = 0;
565                 delete node.replaced;
566             }
567         }
568 
569         if (node.children) {
570             // assignments are first evaluated on the right hand side
571             for (i = node.children.length ; i > 0; i--) {
572                 if (JXG.exists(node.children[i-1])) {
573                     node.children[i-1] = this.replaceIDs(node.children[i-1]);
574                 }
575 
576             }
577         }
578 
579         return node;
580     },
581 
582     /**
583      * Traverses through the given subtree and changes all elements referenced by names through referencing them by ID.
584      * An identifier is only replaced if it is not found in all scopes above the current scope and if it
585      * has not been blacklisted within the codeblock determined by the given subtree.
586      * @param {Object} node
587      */
588     replaceNames: function (node) {
589         var i, v;
590 
591         v = node.value;
592 
593         // we are interested only in nodes of type node_var and node_op > op_lhs.
594         // currently, we are not checking if the id is a local variable. in this case, we're stuck anyway.
595 
596         if (node.type == 'node_op' && v == 'op_lhs' && node.children.length === 1) {
597             this.isLHS = true;
598         } else if (node.type == 'node_var') {
599             if (this.isLHS) {
600                 this.letvar(v, true);
601             } else if (!JXG.exists(this.getvar(v, true)) && JXG.exists(this.board.elementsByName[v])) {
602                 node = this.createReplacementNode(node);
603             }
604         }
605 
606         if (node.children) {
607             // assignments are first evaluated on the right hand side
608             for (i = node.children.length ; i > 0; i--) {
609                 if (JXG.exists(node.children[i-1])) {
610                     node.children[i-1] = this.replaceNames(node.children[i-1]);
611                 }
612 
613             }
614         }
615 
616         if (node.type == 'node_op' && node.value == 'op_lhs' && node.children.length === 1) {
617             this.isLHS = false;
618         }
619 
620         return node;
621     },
622 
623     /**
624      * Replaces node_var nodes with node_op>op_execfun nodes, calling the internal $() function with the id of the
625      * element accessed by the node_var node.
626      * @param {Object} node
627      * @returns {Object} op_execfun node
628      */
629     createReplacementNode: function (node) {
630         var v = node.value,
631             el = this.board.elementsByName[v];
632 
633         node = this.createNode('node_op', 'op_execfun',
634             this.createNode('node_var', '$'),
635             this.createNode('node_op', 'op_param',
636                 this.createNode('node_str', el.id)
637             )
638         );
639 
640         node.replaced = true;
641 
642         return node;
643     },
644 
645     /**
646      * Search the parse tree below <tt>node</tt> for <em>stationary</em> dependencies, i.e. dependencies hard coded into
647      * the function.
648      * @param {Object} node
649      * @param {Object} result An object where the referenced elements will be stored. Access key is their id.
650      */
651     collectDependencies: function (node, result) {
652         var i, v, e;
653 
654         v = node.value;
655 
656         if (node.type == 'node_var') {
657             e = this.getvar(v);
658             if (e && e.visProp && e.type && e.elementClass && e.id) {
659                 result[e.id] = e;
660             }
661         }
662 
663         // the $()-function-calls are special because their parameter is given as a string, not as a node_var.
664         if (node.type == 'node_op' && node.value == 'op_execfun' && node.children.length > 1 && node.children[0].value == '$' && node.children[1].children.length > 0) {
665             e = node.children[1].children[0].value;
666             result[e] = this.board.objects[e];
667         }
668 
669         if (node.children) {
670             for (i = node.children.length; i > 0; i--) {
671                 if (JXG.exists(node.children[i-1])) {
672                     this.collectDependencies(node.children[i-1], result);
673                 }
674 
675             }
676         }
677     },
678 
679     resolveProperty: function (e, v, compile) {
680         compile = JXG.def(compile, false);
681 
682         // is it a geometry element?
683         if (e && e.type && e.elementClass && e.methodMap) {
684             // yeah, it is. but what does the user want?
685             if (v === 'label') {
686                 // he wants to access the label properties!
687                 // adjust the base object...
688                 e = e.label;
689                 // and the property we are accessing
690                 v = 'content';
691             } else {
692                 // ok, it's not the label he wants to change
693 
694                 // well, what then?
695                 if (JXG.exists(e.subs[v])) {
696                     // a subelement it is, good sir.
697                     e = e.subs;
698                 } else if (JXG.exists(e.methodMap[v])) {
699                     // the user wants to call a method
700                     v = e.methodMap[v];
701                 } else {
702                     // the user wants to change an attribute
703                     e = e.visProp;
704                     v = v.toLowerCase();
705                 }
706             }
707         }
708 
709         if (!JXG.exists(e)) {
710             this._error(e + ' is not an object.');
711         }
712 
713         if (!JXG.exists(e[v])) {
714             this._error('unknown property ' + v + '.');
715         }
716 
717         if (compile && typeof e[v] === 'function') {
718             return function () { return e[v].apply(e, arguments); };
719         }
720 
721         return e[v];
722     },
723 
724     /**
725      * Executes a parse subtree.
726      * @param {Object} node
727      * @returns Something
728      * @private
729      */
730     execute: function (node) {
731         var ret, v, i, e, parents = [];
732 
733         ret = 0;
734 
735         if (this.cancel) {
736             this._error('Max runtime exceeded');
737         }
738 
739         if (!node)
740             return ret;
741 
742         this.line = node.line;
743 
744 
745         switch (node.type) {
746             case 'node_op':
747                 switch (node.value) {
748                     case 'op_none':
749                         if (node.children[0]) {
750                             this.execute(node.children[0]);
751                         }
752                         if (node.children[1]) {
753                             ret = this.execute(node.children[1]);
754                         }
755                         break;
756                     case 'op_assign':
757                         v = this.execute(node.children[0]);
758                         this.lhs[this.scope] = v[1];
759 
760                         if (v[0].type && v[0].elementClass && v[0].methodMap && v[1] === 'label') {
761                             this._error('Left-hand side of assignment is read-only.');
762                         }
763 
764                         if (v[0] !== this.sstack[this.scope] || (JXG.isArray(v[0]) && typeof v[1] === 'number')) {
765                             // it is either an array component being set or a property of an object.
766                             this.setProp(v[0], v[1], this.execute(node.children[1]));
767                         } else {
768                             // this is just a local variable inside JessieCode
769                             this.letvar(v[1], this.execute(node.children[1]));
770                         }
771 
772                         this.lhs[this.scope] = 0;
773                         break;
774                     case 'op_noassign':
775                         ret = this.execute(node.children[0]);
776                         break;
777                     case 'op_if':
778                         if (this.execute(node.children[0])) {
779                             ret = this.execute(node.children[1]);
780                         }
781                         break;
782                     case 'op_if_else':
783                         if (this.execute(node.children[0])) {
784                             ret = this.execute(node.children[1]);
785                         } else {
786                             ret = this.execute(node.children[2]);
787                         }
788                         break;
789                     case 'op_while':
790                         while (this.execute(node.children[0])) {
791                             this.execute(node.children[1]);
792                         }
793                         break;
794                     case 'op_do':
795                         do {
796                             this.execute(node.children[0]);
797                         } while (this.execute(node.children[1]));
798                         break;
799                     case 'op_for':
800                         i = new Date().getTime();
801                         for (this.execute(node.children[0]); this.execute(node.children[1]); this.execute(node.children[2])) {
802                             if (new Date().getTime() - i > this.maxRuntime || this.cancel) {
803                                 this._error('for: max runtime exceeded');
804                                 break;
805                             }
806                             this.execute(node.children[3]);
807                         }
808                         break;
809                     case 'op_param':
810                         if (node.children[1]) {
811                             this.execute(node.children[1]);
812                         }
813 
814                         ret = node.children[0];
815                         this.pstack[this.pscope].push(ret);
816                         break;
817                     case 'op_paramdef':
818                         if (node.children[1]) {
819                             this.execute(node.children[1]);
820                         }
821 
822                         ret = node.children[0];
823                         this.pstack[this.pscope].push(ret);
824                         break;
825                     case 'op_proplst':
826                         if (node.children[0]) {
827                             this.execute(node.children[0]);
828                         }
829                         if (node.children[1]) {
830                             this.execute(node.children[1]);
831                         }
832                         break;
833                     case 'op_proplst_val':
834                         this.propstack.push({});
835                         this.propscope++;
836 
837                         this.execute(node.children[0]);
838                         ret = this.propstack[this.propscope];
839 
840                         this.propstack.pop();
841                         this.propscope--;
842                         break;
843                     case 'op_prop':
844                         // child 0: Identifier
845                         // child 1: Value
846                         this.propstack[this.propscope][node.children[0]] = this.execute(node.children[1]);
847                         break;
848                     case 'op_array':
849                         var l;
850 
851                         this.pstack.push([]);
852                         this.pscope++;
853 
854                         this.execute(node.children[0]);
855 
856                         ret = [];
857                         l = this.pstack[this.pscope].length;
858 
859                         for (i = 0; i < l; i++) {
860                             ret.push(this.execute(this.pstack[this.pscope][i]));
861                         }
862 
863                         this.pstack.pop();
864                         this.pscope--;
865 
866                         break;
867                     case 'op_extvalue':
868                         var undef;
869 
870                         ret = this.execute(node.children[0]);
871                         i = this.execute(node.children[1]);
872 
873                         if (typeof i === 'number' && Math.abs(Math.round(i) - i) < JXG.Math.eps) {
874                             ret = ret[i];
875                         } else {
876                             ret = undef;
877                         }
878                         break;
879                     case 'op_return':
880                         if (this.scope === 0) {
881                             this._error('Unexpected return.');
882                         } else {
883                             return this.execute(node.children[0]);
884                         }
885                         break;
886                     case 'op_function':
887                         this.pstack.push([]);
888                         this.pscope++;
889 
890                         // parse the parameter list
891                         // after this, the parameters are in pstack
892                         this.execute(node.children[0]);
893 
894                         if (this.board.options.jc.compile) {
895                             this.sstack.push({});
896                             this.scope++;
897 
898                             this.isLHS = false;
899 
900                             for (i = 0; i < this.pstack[this.pscope].length; i++) {
901                                 this.sstack[this.scope][this.pstack[this.pscope][i]] = this.pstack[this.pscope][i];
902                             }
903 
904                             this.replaceNames(node.children[1]);
905 
906                             ret = (function ($jc$) {
907                                 var p = $jc$.pstack[$jc$.pscope].join(', '),
908                                     str = 'var f = function (' + p + ') {\n$jc$.sstack.push([]);\n$jc$.scope++;\nvar r = (function () {\n' + $jc$.compile(node.children[1], true) + '})();\n$jc$.sstack.pop();\n$jc$.scope--;\nreturn r;\n}; f;';
909 
910                                 // the function code formatted:
911                                 /*
912                                 var f = function (_parameters_) {
913                                     // handle the stack
914                                     $jc$.sstack.push([]);
915                                     $jc$.scope++;
916 
917                                     // this is required for stack handling: usually at some point in a function
918                                     // there's a return statement, that prevents the cleanup of the stack.
919                                     var r = (function () {
920                                         _compiledcode_;
921                                     })();
922 
923                                     // clean up the stack
924                                     $jc$.sstack.pop();
925                                     $jc$.scope--;
926 
927                                     // return the result
928                                     return r;
929                                 };
930                                 f;   // the return value of eval()
931                                 */
932 
933                                 return eval(str);
934                             })(this);
935 
936                             // clean up scope
937                             this.sstack.pop();
938                             this.scope--;
939                         } else {
940                             ret = (function (_pstack, that) {
941                                 return function () {
942                                     var r;
943 
944                                     that.sstack.push({});
945                                     that.scope++;
946                                     for (r = 0; r < _pstack.length; r++) {
947                                         that.sstack[that.scope][_pstack[r]] = arguments[r];
948                                     }
949 
950                                     r = that.execute(node.children[1]);
951 
952                                     that.sstack.pop();
953                                     that.scope--;
954                                     return r;
955                                 };
956                             })(this.pstack[this.pscope], this);
957                         }
958 
959                         ret.toJS = ret.toString;
960                         ret.toString = (function (_that) {
961                             return function () {
962                                 return _that.compile(_that.replaceIDs(JXG.deepCopy(node)));
963                             };
964                         })(this);
965 
966                         ret.deps = {};
967                         this.collectDependencies(node.children[1], ret.deps);
968 
969                         this.pstack.pop();
970                         this.pscope--;
971                         break;
972                     case 'op_execfun':
973                         // node.children:
974                         //   [0]: Name of the function
975                         //   [1]: Parameter list as a parse subtree
976                         //   [2]: Properties, only used in case of a create function
977                         var fun, attr, sc;
978 
979                         this.pstack.push([]);
980                         this.pscope++;
981 
982                         // parse the parameter list
983                         // after this, the parameters are in pstack
984                         this.execute(node.children[1]);
985 
986                         // parse the properties only if given
987                         if (typeof node.children[2] !== 'undefined') {
988                             attr = this.execute(node.children[2]);
989                         }
990 
991                         // look up the variables name in the variable table
992                         fun = this.execute(node.children[0]);
993 
994                         // determine the scope the function wants to run in
995                         if (fun.sc) {
996                             sc = fun.sc;
997                         } else {
998                             sc = this;
999                         }
1000 
1001                         // interpret ALL the parameters
1002                         for(i = 0; i < this.pstack[this.pscope].length; i++) {
1003                             parents[i] = this.execute(this.pstack[this.pscope][i]);
1004                         }
1005 
1006                         // check for the function in the variable table
1007                         if (typeof fun === 'function' && !fun.creator) {
1008                             ret = fun.apply(sc, parents);
1009                         } else if (typeof fun === 'function' && !!fun.creator) {
1010                             // creator methods are the only ones that take properties, hence this special case
1011                             ret = fun(parents, attr);
1012                             ret.jcLine = this.line;
1013                         } else {
1014                             this._error('Function \'' + fun + '\' is undefined.');
1015                         }
1016 
1017                         // clear parameter stack
1018                         this.pstack.pop();
1019                         this.pscope--;
1020                         break;
1021                     case 'op_property':
1022                         e = this.execute(node.children[0]);
1023                         v = node.children[1];
1024 
1025                         ret = this.resolveProperty(e, v, false);
1026 
1027                         // set the scope, in case this is a method the user wants to call
1028                         ret.sc = e;
1029                         break;
1030                     case 'op_lhs':
1031                         v = node.children[0];
1032 
1033                         // we have a subtree here (in case this is an array component)
1034                         if (v.children && v.type && v.value) {
1035                             v = this.execute(v);
1036                         }
1037 
1038                         if (node.children.length === 1) {
1039                             e = this.sstack[this.scope];
1040                         } else {
1041                             e = this.execute(node.children[1]);
1042 
1043                             if (e.type && e.elementClass && v.toLowerCase && v.toLowerCase() !== 'x' && v.toLowerCase() !== 'y') {
1044                                 v = v.toLowerCase();
1045                             }
1046                         }
1047 
1048                         ret = [e, v];
1049                         break;
1050                     case 'op_use':
1051                         // node.children:
1052                         //   [0]: A string providing the id of the div the board is in.
1053                         var found = false;
1054 
1055                         // search all the boards for the one with the appropriate container div
1056                         for(var b in JXG.JSXGraph.boards) {
1057                             if(JXG.JSXGraph.boards[b].container === node.children[0].toString()) {
1058                                 this.board = JXG.JSXGraph.boards[b];
1059                                 found = true;
1060                             }
1061                         }
1062 
1063                         if(!found)
1064                             this._error('Board \'' + node.children[0].toString() + '\' not found!');
1065                         break;
1066                     case 'op_delete':
1067                         v = this.getvar(node.children[0]);
1068 
1069                         if (typeof v === 'object' && JXG.exists(v.type) && JXG.exists(v.elementClass)) {
1070                             this.board.removeObject(v);
1071                         }
1072                         break;
1073                     case 'op_equ':
1074                         ret = this.execute(node.children[0]) == this.execute(node.children[1]);
1075                         break;
1076                     case 'op_neq':
1077                         ret = this.execute(node.children[0]) != this.execute(node.children[1]);
1078                         break;
1079                     case 'op_approx':
1080                         ret = Math.abs(this.execute(node.children[0]) - this.execute(node.children[1])) < JXG.Math.eps;
1081                         break;
1082                     case 'op_grt':
1083                         ret = this.execute(node.children[0]) > this.execute(node.children[1]);
1084                         break;
1085                     case 'op_lot':
1086                         ret = this.execute(node.children[0]) < this.execute(node.children[1]);
1087                         break;
1088                     case 'op_gre':
1089                         ret = this.execute(node.children[0]) >= this.execute(node.children[1]);
1090                         break;
1091                     case 'op_loe':
1092                         ret = this.execute(node.children[0]) <= this.execute(node.children[1]);
1093                         break;
1094                     case 'op_or':
1095                         ret = this.execute(node.children[0]) || this.execute(node.children[1]);
1096                         break;
1097                     case 'op_and':
1098                         ret = this.execute(node.children[0]) && this.execute(node.children[1]);
1099                         break;
1100                     case 'op_not':
1101                         ret = !this.execute(node.children[0]);
1102                         break;
1103                     case 'op_add':
1104                         ret = JXG.Math.Statistics.add(this.execute(node.children[0]), this.execute(node.children[1]));
1105                         break;
1106                     case 'op_sub':
1107                         ret = JXG.Math.Statistics.subtract(this.execute(node.children[0]), this.execute(node.children[1]));
1108                         break;
1109                     case 'op_div':
1110                         ret = JXG.Math.Statistics.div(this.execute(node.children[0]), this.execute(node.children[1]));
1111                         break;
1112                     case 'op_mod':
1113                         // use mathematical modulo, JavaScript implements the symmetric modulo.
1114                         ret = JXG.Math.Statistics.mod(this.execute(node.children[0]), this.execute(node.children[1]), true);
1115                         break;
1116                     case 'op_mul':
1117                         ret = this.mul(this.execute(node.children[0]), this.execute(node.children[1]));
1118                         break;
1119                     case 'op_exp':
1120                         ret = Math.pow(this.execute(node.children[0]),  this.execute(node.children[1]));
1121                         break;
1122                     case 'op_neg':
1123                         ret = this.execute(node.children[0]) * -1;
1124                         break;
1125                 }
1126                 break;
1127 
1128             case 'node_var':
1129                 ret = this.getvar(node.value);
1130                 break;
1131 
1132             case 'node_const':
1133                 ret = Number(node.value);
1134                 break;
1135 
1136             case 'node_const_bool':
1137                 ret = node.value.toLowerCase() !== 'false';
1138                 break;
1139 
1140             case 'node_str':
1141                 ret = node.value;
1142                 break;
1143         }
1144 
1145         return ret;
1146     },
1147 
1148     /**
1149      * Compiles a parse tree back to JessieCode.
1150      * @param {Object} node
1151      * @param {Boolean} [js=false] Currently ignored. Compile either to JavaScript or back to JessieCode (required for the UI).
1152      * @returns Something
1153      * @private
1154      */
1155     compile: function (node, js) {
1156         var ret, i, e, v;
1157 
1158         ret = '';
1159 
1160         if (!JXG.exists(js)) {
1161             js = false
1162         }
1163 
1164         if (!node)
1165             return ret;
1166 
1167         switch (node.type) {
1168             case 'node_op':
1169                 switch (node.value) {
1170                     case 'op_none':
1171                         if (node.children[0]) {
1172                             ret = this.compile(node.children[0], js);
1173                         }
1174                         if (node.children[1]) {
1175                             ret += this.compile(node.children[1], js);
1176                         }
1177                         break;
1178                     case 'op_assign':
1179                         e = this.compile(node.children[0], js);
1180                         if (js) {
1181                             if (JXG.isArray(e)) {
1182                                 ret = '$jc$.setProp(' + e[0] + ', \'' + e[1] + '\', ' + this.compile(node.children[1], js) + ');\n';
1183                             } else {
1184                                 if (this.isLocalVariable(e) !== this.scope) {
1185                                     this.sstack[this.scope][e] = true;
1186                                 }
1187                                 ret = '$jc$.sstack[' + this.scope + '][\'' + e + '\'] = ' + this.compile(node.children[1], js) + ';\n';
1188                             }
1189                         } else {
1190                             ret = e + ' = ' + this.compile(node.children[1], js) + ';\n';
1191                         }
1192 
1193                         break;
1194                     case 'op_noassign':
1195                         ret = this.compile(node.children[0], js);
1196                         break;
1197                     case 'op_if':
1198                         ret = ' if (' + this.compile(node.children[0], js) + ') ' + this.compile(node.children[1], js);
1199                         break;
1200                     case 'op_if_else':
1201                         ret = ' if (' + this.compile(node.children[0], js) + ')' + this.compile(node.children[1], js);
1202                         ret += ' else ' + this.compile(node.children[2], js);
1203                         break;
1204                     case 'op_while':
1205                         ret = ' while (' + this.compile(node.children[0], js) + ') {\n' + this.compile(node.children[1], js) + '}\n';
1206                         break;
1207                     case 'op_do':
1208                         ret = ' do {\n' + this.compile(node.children[0], js) + '} while (' + this.compile(node.children[1], js) + ');\n';
1209                         break;
1210                     case 'op_for':
1211                         ret = ' for (' + this.compile(node.children[0], js) + '; ' + this.compile(node.children[1], js) + '; ' + this.compile(node.children[2], js) + ') {\n' + this.compile(node.children[3], js) + '\n}\n';
1212                         break;
1213                     case 'op_param':
1214                         if (node.children[1]) {
1215                             ret = this.compile(node.children[1], js) + ', ';
1216                         }
1217 
1218                         ret += this.compile(node.children[0], js);
1219                         break;
1220                     case 'op_paramdef':
1221                         if (node.children[1]) {
1222                             ret = this.compile(node.children[1], js) + ', ';
1223                         }
1224 
1225                         ret += node.children[0];
1226                         break;
1227                     case 'op_proplst':
1228                         if (node.children[0]) {
1229                             ret = this.compile(node.children[0], js) + ', ';
1230                         }
1231 
1232                         ret += this.compile(node.children[1], js);
1233                         break;
1234                     case 'op_prop':
1235                         // child 0: Identifier
1236                         // child 1: Value
1237                         ret = node.children[0] + ': ' + this.compile(node.children[1], js);
1238                         break;
1239                     case 'op_proplst_val':
1240                         ret = (js ? '{' : '<<') + this.compile(node.children[0], js) + (js ? '}' : '>>');
1241                         break;
1242                     case 'op_array':
1243                         ret = '[' + this.compile(node.children[0], js) + ']';
1244                         break;
1245                     case 'op_extvalue':
1246                         ret = this.compile(node.children[0], js) + '[' + this.compile(node.children[1], js) + ']';
1247                         break;
1248                     case 'op_return':
1249                         ret = ' return ' + this.compile(node.children[0], js) + ';\n';
1250                         break;
1251                     case 'op_function':
1252                         ret = ' function (' + this.compile(node.children[0], js) + ') {\n' + this.compile(node.children[1], js) + '}';
1253                         break;
1254                     case 'op_execfun':
1255                         // parse the properties only if given
1256                         if (node.children[2]) {
1257                             e = (js ? '{' : '<<') + this.compile(node.children[2], js) + (js ? '}' : '>>');
1258                         }
1259                         ret = this.compile(node.children[0], js) + '(' + this.compile(node.children[1], js) + (node.children[2] ? ', ' + e : '') + ')';
1260 
1261                         // save us a function call when compiled to javascript
1262                         if (js && node.children[0].value === '$') {
1263                             ret = '$jc$.board.objects[' + this.compile(node.children[1], js) + ']';
1264                         }
1265 
1266                         break;
1267                     case 'op_property':
1268                         if (js && node.children[1] !== 'X' && node.children[1] !== 'Y') {
1269                             ret = '$jc$.resolveProperty(' + this.compile(node.children[0], js) + ', \'' + node.children[1] + '\', true)';
1270                         } else {
1271                             ret = this.compile(node.children[0], js) + '.' + node.children[1];
1272                         }
1273                         break;
1274                     case 'op_lhs':
1275                         if (node.children.length === 1) {
1276                             ret = node.children[0];
1277                         } else if (node.children[2] === 'dot') {
1278                             if (js) {
1279                                 ret = [this.compile(node.children[1], js), node.children[0]];
1280                             } else {
1281                                 ret = this.compile(node.children[1], js) + '.' + node.children[0];
1282                             }
1283                         } else if (node.children[2] === 'bracket') {
1284                             if (js) {
1285                                 ret = [this.compile(node.children[1], js), this.compile(node.children[0], js)];
1286                             } else {
1287                                 ret = this.compile(node.children[1], js) + '[' + this.compile(node.children[0], js) + ']';
1288                             }
1289                         }
1290                         break;
1291                     case 'op_use':
1292                         if (js) {
1293                             ret = '$jc$.board = JXG.JSXGraph.boards[\'' + node.children[0] + '\']';
1294                         } else {
1295                             ret = 'use ' + node.children[0] + ';';
1296                         }
1297                         break;
1298                     case 'op_delete':
1299                         ret = 'delete ' + node.children[0];
1300                         break;
1301                     case 'op_equ':
1302                         ret = '(' + this.compile(node.children[0], js) + ' == ' + this.compile(node.children[1], js) + ')';
1303                         break;
1304                     case 'op_neq':
1305                         ret = '(' + this.compile(node.children[0], js) + ' != ' + this.compile(node.children[1], js) + ')';
1306                         break;
1307                     case 'op_approx':
1308                         ret = '(' + this.compile(node.children[0], js) + ' ~= ' + this.compile(node.children[1], js) + ')';
1309                         break;
1310                     case 'op_grt':
1311                         ret = '(' + this.compile(node.children[0], js) + ' > ' + this.compile(node.children[1], js) + ')';
1312                         break;
1313                     case 'op_lot':
1314                         ret = '(' + this.compile(node.children[0], js) + ' < ' + this.compile(node.children[1], js) + ')';
1315                         break;
1316                     case 'op_gre':
1317                         ret = '(' + this.compile(node.children[0], js) + ' >= ' + this.compile(node.children[1], js) + ')';
1318                         break;
1319                     case 'op_loe':
1320                         ret = '(' + this.compile(node.children[0], js) + ' <= ' + this.compile(node.children[1], js) + ')';
1321                         break;
1322                     case 'op_or':
1323                         ret = '(' + this.compile(node.children[0], js) + ' || ' + this.compile(node.children[1], js) + ')';
1324                         break;
1325                     case 'op_and':
1326                         ret = '(' + this.compile(node.children[0], js) + ' && ' + this.compile(node.children[1], js) + ')';
1327                         break;
1328                     case 'op_not':
1329                         ret = '!(' + this.compile(node.children[0], js) + ')';
1330                         break;
1331                     case 'op_add':
1332                         if (js) {
1333                             ret = 'JXG.Math.Statistics.add(' + this.compile(node.children[0], js) + ', ' + this.compile(node.children[1], js) + ')';
1334                         } else {
1335                             ret = '(' + this.compile(node.children[0], js) + ' + ' + this.compile(node.children[1], js) + ')';
1336                         }
1337                         break;
1338                     case 'op_sub':
1339                         if (js) {
1340                             ret = 'JXG.Math.Statistics.subtract(' + this.compile(node.children[0], js) + ', ' + this.compile(node.children[1], js) + ')';
1341                         } else {
1342                             ret = '(' + this.compile(node.children[0], js) + ' - ' + this.compile(node.children[1], js) + ')';
1343                         }
1344                         break;
1345                     case 'op_div':
1346                         if (js) {
1347                             ret = 'JXG.Math.Statistics.div(' + this.compile(node.children[0], js) + ', ' + this.compile(node.children[1], js) + ')';
1348                         } else {
1349                             ret = '(' + this.compile(node.children[0], js) + ' / ' + this.compile(node.children[1], js) + ')';
1350                         }
1351                         break;
1352                     case 'op_mod':
1353                         if (js) {
1354                             ret = 'JXG.Math.mod(' + this.compile(node.children[0], js) + ', ' + this.compile(node.children[1], js) + ', true)';
1355                         } else {
1356                             ret = '(' + this.compile(node.children[0], js) + ' % ' + this.compile(node.children[1], js) + ')';
1357                         }
1358                         break;
1359                     case 'op_mul':
1360                         if (js) {
1361                             ret = '$jc$.mul(' + this.compile(node.children[0], js) + ', ' + this.compile(node.children[1], js) + ')';
1362                         } else {
1363                             ret = '(' + this.compile(node.children[0], js) + ' * ' + this.compile(node.children[1], js) + ')';
1364                         }
1365                         break;
1366                     case 'op_exp':
1367                         if (js) {
1368                             ret = 'Math.pow(' + this.compile(node.children[0], js) + ', ' + this.compile(node.children[1], js) + ')';
1369                         } else {
1370                             ret = '(' + this.compile(node.children[0], js) + '^' + this.compile(node.children[1], js) + ')';
1371                         }
1372                         break;
1373                     case 'op_neg':
1374                         ret = '(-' + this.compile(node.children[0], js) + ')';
1375                         break;
1376                 }
1377                 break;
1378 
1379             case 'node_var':
1380                 if (js) {
1381                     //ret = '$jc$.getvar(\'' + node.value + '\')';
1382                     ret = this.getvarJS(node.value);
1383                 } else {
1384                     ret = node.value;
1385                 }
1386                 break;
1387 
1388             case 'node_const':
1389                 ret = node.value;
1390                 break;
1391 
1392             case 'node_const_bool':
1393                 ret = node.value;
1394                 break;
1395 
1396             case 'node_str':
1397                 ret = '\'' + node.value.replace(/'/g, '\\\'') + '\'';
1398                 break;
1399         }
1400 
1401         if (node.needsBrackets) {
1402             ret = '{\n' + ret + '}\n';
1403         }
1404 
1405         return ret;
1406     },
1407 
1408     /**
1409      * This is used as the global X() function.
1410      * @param {JXG.Point|JXG.Text} e
1411      * @returns {Number}
1412      */
1413     X: function (e) {
1414         return e.X();
1415     },
1416 
1417     /**
1418      * This is used as the global Y() function.
1419      * @param {JXG.Point|JXG.Text} e
1420      * @returns {Number}
1421      */
1422     Y: function (e) {
1423         return e.Y();
1424     },
1425 
1426     /**
1427      * This is used as the global V() function.
1428      * @param {Glider|Slider} e
1429      * @returns {%}
1430      */
1431     V: function (e) {
1432         return e.Value();
1433     },
1434 
1435     /**
1436      * This is used as the global L() function.
1437      * @param {JXG.Line} e
1438      * @returns {Number}
1439      */
1440    L: function (e) {
1441         return e.L();
1442     },
1443 
1444     /**
1445      * This is used as the global dist() function.
1446      * @param {JXG.Point} p1
1447      * @param {JXG.Point} p2
1448      * @returns {Number}
1449      */
1450     dist: function (p1, p2) {
1451         if (!JXG.exists(p1) || !JXG.exists(p1.Dist)) {
1452             this._error('Error: Can\'t calculate distance.');
1453         }
1454 
1455         return p1.Dist(p2);
1456     },
1457 
1458     /**
1459      * Multiplication of vectors and numbers
1460      * @param {Number|Array} a
1461      * @param {Number|Array} b
1462      * @returns {Number|Array} (Inner) product of the given input values.
1463      */
1464     mul: function (a, b) {
1465         if (JXG.isArray(a) * JXG.isArray(b)) {
1466             return JXG.Math.innerProduct(a, b, Math.min(a.length, b.length));
1467         } else {
1468             return JXG.Math.Statistics.multiply(a, b);
1469         }
1470     },
1471 
1472     /**
1473      * Defines built in methods and constants.
1474      * @returns {Object} BuiltIn control object
1475      */
1476     defineBuiltIn: function () {
1477         var that = this,
1478             builtIn = {
1479                 PI: Math.PI,
1480                 EULER: Math.E,
1481                 X: that.X,
1482                 Y: that.Y,
1483                 V: that.V,
1484                 L: that.L,
1485                 dist: that.dist,
1486                 rad: JXG.Math.Geometry.rad,
1487                 deg: JXG.Math.Geometry.trueAngle,
1488                 factorial: JXG.Math.factorial,
1489                 trunc: JXG.trunc,
1490                 '$': that.getElementById
1491             };
1492 
1493         // special scopes for factorial, deg, and rad
1494         builtIn.rad.sc = JXG.Math.Geometry;
1495         builtIn.deg.sc = JXG.Math.Geometry;
1496         builtIn.factorial.sc = JXG.Math;
1497 
1498         // set the javascript equivalent for the builtIns
1499         // some of the anonymous functions should be replaced by global methods later on
1500         builtIn.PI.src = 'Math.PI';
1501         builtIn.EULER.src = 'Math.E';
1502         builtIn.X.src = '$jc$.X';
1503         builtIn.Y.src = '$jc$.Y';
1504         builtIn.V.src = '$jc$.V';
1505         builtIn.L.src = '$jc$.L';
1506         builtIn.dist.src = '$jc$.dist';
1507         builtIn.rad.src = 'JXG.Math.Geometry.rad';
1508         builtIn.deg.src = 'JXG.Math.Geometry.trueAngle';
1509         builtIn.factorial.src = 'JXG.Math.factorial';
1510         builtIn.trunc.src = 'JXG.trunc';
1511         // usually unused, see node_op > op_execfun
1512         builtIn['$'].src = '(function (n) { return JXG.getRef($jc$.board, n); })';
1513 
1514         return builtIn;
1515     },
1516 
1517     /**
1518      * Output a debugging message. Uses debug console, if available. Otherwise an HTML element with the
1519      * id "debug" and an innerHTML property is used.
1520      * @param {String} log
1521      * @private
1522      */
1523     _debug: function (log) {
1524         if(typeof console !== "undefined") {
1525             console.log(log);
1526         } else if(document.getElementById('debug') !== null) {
1527             document.getElementById('debug').innerHTML += log + '<br />';
1528         }
1529     },
1530 
1531     /**
1532      * Throws an exception with the given error message.
1533      * @param {String} msg Error message
1534      */
1535     _error: function (msg) {
1536         var e = new Error('Error(' + this.line + '): ' + msg);
1537         e.line = this.line;
1538         throw e;
1539     },
1540 
1541     /**
1542      * Output a warning message using {@link JXG#debug} and precedes the message with "Warning: ".
1543      * @param {String} msg
1544      */
1545     _warn: function (msg) {
1546         if(typeof console !== "undefined") {
1547             console.log('Warning(' + this.line + '): ' + msg);
1548         } else if(document.getElementById(this.warnLog) !== null) {
1549             document.getElementById(this.warnLog).innerHTML += 'Warning(' + this.line + '): ' + msg + '<br />';
1550         }
1551     }
1552 
1553 });
1554 
1555 /*
1556     Copyright 2008-2011
1557         Matthias Ehmann,
1558         Michael Gerhaeuser,
1559         Carsten Miller,
1560         Bianca Valentin,
1561         Alfred Wassermann,
1562         Peter Wilfahrt
1563 
1564     This file is part of JSXGraph.
1565 
1566     JSXGraph is free software: you can redistribute it and/or modify
1567     it under the terms of the GNU Lesser General Public License as published by
1568     the Free Software Foundation, either version 3 of the License, or
1569     (at your option) any later version.
1570 
1571     JSXGraph is distributed in the hope that it will be useful,
1572     but WITHOUT ANY WARRANTY; without even the implied warranty of
1573     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1574     GNU Lesser General Public License for more details.
1575 
1576     You should have received a copy of the GNU Lesser General Public License
1577     along with JSXGraph.  If not, see <http://www.gnu.org/licenses/>.
1578 */
1579 
1580 
1581 
1582 /*
1583     Default template driver for JS/CC generated parsers running as
1584     browser-based JavaScript/ECMAScript applications.
1585     
1586     WARNING:     This parser template will only run together with JSXGraph on a website.
1587     
1588     Features:
1589     - Parser trace messages
1590     - Integrated panic-mode error recovery
1591     
1592     Written 2007, 2008 by Jan Max Meyer, J.M.K S.F. Software Technologies
1593     Modified 2011 by Michael Gerhaeuser, JSXGraph
1594     
1595     This is in the public domain.
1596 */
1597 
1598 
1599 JXG.extend(JXG.JessieCode.prototype, /** @lends JXG.JessieCode.prototype */ {
1600     /**
1601      * Internal lexer method.
1602      * @private
1603      */
1604     _lex: function (PCB) {
1605         var state,
1606             match = -1,
1607             match_pos = 0,
1608             start = 0,
1609             pos,
1610             chr;
1611 
1612         while (1) {
1613             state = 0;
1614             match = -1;
1615             match_pos = 0;
1616             start = 0;
1617             pos = PCB.offset + 1 + ( match_pos - start );
1618 
1619             do {
1620 
1621                 pos--;
1622                 state = 0;
1623                 match = -2;
1624                 start = pos;
1625 
1626                 if( PCB.src.length <= start )
1627                     return 66;
1628 
1629                 do {
1630                     chr = PCB.src.charCodeAt( pos );
1631 
1632 switch( state )
1633 {
1634 	case 0:
1635 		if( ( chr >= 9 && chr <= 10 ) || chr == 13 || chr == 32 ) state = 1;
1636 		else if( chr == 33 ) state = 2;
1637 		else if( chr == 35 ) state = 3;
1638 		else if( chr == 36 || ( chr >= 65 && chr <= 67 ) || ( chr >= 71 && chr <= 72 ) || ( chr >= 74 && chr <= 81 ) || chr == 83 || chr == 86 || ( chr >= 88 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 99 ) || ( chr >= 103 && chr <= 104 ) || ( chr >= 106 && chr <= 113 ) || chr == 115 || chr == 118 || ( chr >= 120 && chr <= 122 ) ) state = 4;
1639 		else if( chr == 37 ) state = 5;
1640 		else if( chr == 40 ) state = 6;
1641 		else if( chr == 41 ) state = 7;
1642 		else if( chr == 42 ) state = 8;
1643 		else if( chr == 43 ) state = 9;
1644 		else if( chr == 44 ) state = 10;
1645 		else if( chr == 45 ) state = 11;
1646 		else if( chr == 46 ) state = 12;
1647 		else if( chr == 47 ) state = 13;
1648 		else if( ( chr >= 48 && chr <= 57 ) ) state = 14;
1649 		else if( chr == 58 ) state = 15;
1650 		else if( chr == 59 ) state = 16;
1651 		else if( chr == 60 ) state = 17;
1652 		else if( chr == 61 ) state = 18;
1653 		else if( chr == 62 ) state = 19;
1654 		else if( chr == 91 ) state = 20;
1655 		else if( chr == 93 ) state = 21;
1656 		else if( chr == 94 ) state = 22;
1657 		else if( chr == 123 ) state = 23;
1658 		else if( chr == 124 ) state = 24;
1659 		else if( chr == 125 ) state = 25;
1660 		else if( chr == 38 ) state = 48;
1661 		else if( chr == 68 || chr == 100 ) state = 49;
1662 		else if( chr == 39 ) state = 51;
1663 		else if( chr == 73 || chr == 105 ) state = 52;
1664 		else if( chr == 126 ) state = 53;
1665 		else if( chr == 70 || chr == 102 ) state = 64;
1666 		else if( chr == 85 || chr == 117 ) state = 65;
1667 		else if( chr == 69 || chr == 101 ) state = 73;
1668 		else if( chr == 84 || chr == 116 ) state = 74;
1669 		else if( chr == 87 || chr == 119 ) state = 80;
1670 		else if( chr == 82 || chr == 114 ) state = 84;
1671 		else state = -1;
1672 		break;
1673 
1674 	case 1:
1675 		state = -1;
1676 		match = 2;
1677 		match_pos = pos;
1678 		break;
1679 
1680 	case 2:
1681 		if( chr == 61 ) state = 26;
1682 		else state = -1;
1683 		match = 31;
1684 		match_pos = pos;
1685 		break;
1686 
1687 	case 3:
1688 		state = -1;
1689 		match = 41;
1690 		match_pos = pos;
1691 		break;
1692 
1693 	case 4:
1694 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 122 ) ) state = 4;
1695 		else state = -1;
1696 		match = 45;
1697 		match_pos = pos;
1698 		break;
1699 
1700 	case 5:
1701 		state = -1;
1702 		match = 35;
1703 		match_pos = pos;
1704 		break;
1705 
1706 	case 6:
1707 		state = -1;
1708 		match = 38;
1709 		match_pos = pos;
1710 		break;
1711 
1712 	case 7:
1713 		state = -1;
1714 		match = 39;
1715 		match_pos = pos;
1716 		break;
1717 
1718 	case 8:
1719 		state = -1;
1720 		match = 36;
1721 		match_pos = pos;
1722 		break;
1723 
1724 	case 9:
1725 		state = -1;
1726 		match = 32;
1727 		match_pos = pos;
1728 		break;
1729 
1730 	case 10:
1731 		state = -1;
1732 		match = 40;
1733 		match_pos = pos;
1734 		break;
1735 
1736 	case 11:
1737 		state = -1;
1738 		match = 33;
1739 		match_pos = pos;
1740 		break;
1741 
1742 	case 12:
1743 		if( ( chr >= 48 && chr <= 57 ) ) state = 29;
1744 		else state = -1;
1745 		match = 44;
1746 		match_pos = pos;
1747 		break;
1748 
1749 	case 13:
1750 		state = -1;
1751 		match = 34;
1752 		match_pos = pos;
1753 		break;
1754 
1755 	case 14:
1756 		if( ( chr >= 48 && chr <= 57 ) ) state = 14;
1757 		else if( chr == 46 ) state = 29;
1758 		else state = -1;
1759 		match = 47;
1760 		match_pos = pos;
1761 		break;
1762 
1763 	case 15:
1764 		state = -1;
1765 		match = 42;
1766 		match_pos = pos;
1767 		break;
1768 
1769 	case 16:
1770 		state = -1;
1771 		match = 20;
1772 		match_pos = pos;
1773 		break;
1774 
1775 	case 17:
1776 		if( chr == 60 ) state = 30;
1777 		else if( chr == 61 ) state = 31;
1778 		else state = -1;
1779 		match = 28;
1780 		match_pos = pos;
1781 		break;
1782 
1783 	case 18:
1784 		if( chr == 61 ) state = 32;
1785 		else state = -1;
1786 		match = 21;
1787 		match_pos = pos;
1788 		break;
1789 
1790 	case 19:
1791 		if( chr == 61 ) state = 33;
1792 		else if( chr == 62 ) state = 34;
1793 		else state = -1;
1794 		match = 27;
1795 		match_pos = pos;
1796 		break;
1797 
1798 	case 20:
1799 		state = -1;
1800 		match = 16;
1801 		match_pos = pos;
1802 		break;
1803 
1804 	case 21:
1805 		state = -1;
1806 		match = 17;
1807 		match_pos = pos;
1808 		break;
1809 
1810 	case 22:
1811 		state = -1;
1812 		match = 37;
1813 		match_pos = pos;
1814 		break;
1815 
1816 	case 23:
1817 		state = -1;
1818 		match = 18;
1819 		match_pos = pos;
1820 		break;
1821 
1822 	case 24:
1823 		if( chr == 124 ) state = 37;
1824 		else state = -1;
1825 		match = 43;
1826 		match_pos = pos;
1827 		break;
1828 
1829 	case 25:
1830 		state = -1;
1831 		match = 19;
1832 		match_pos = pos;
1833 		break;
1834 
1835 	case 26:
1836 		state = -1;
1837 		match = 23;
1838 		match_pos = pos;
1839 		break;
1840 
1841 	case 27:
1842 		state = -1;
1843 		match = 30;
1844 		match_pos = pos;
1845 		break;
1846 
1847 	case 28:
1848 		state = -1;
1849 		match = 46;
1850 		match_pos = pos;
1851 		break;
1852 
1853 	case 29:
1854 		if( ( chr >= 48 && chr <= 57 ) ) state = 29;
1855 		else state = -1;
1856 		match = 48;
1857 		match_pos = pos;
1858 		break;
1859 
1860 	case 30:
1861 		state = -1;
1862 		match = 14;
1863 		match_pos = pos;
1864 		break;
1865 
1866 	case 31:
1867 		state = -1;
1868 		match = 25;
1869 		match_pos = pos;
1870 		break;
1871 
1872 	case 32:
1873 		state = -1;
1874 		match = 22;
1875 		match_pos = pos;
1876 		break;
1877 
1878 	case 33:
1879 		state = -1;
1880 		match = 26;
1881 		match_pos = pos;
1882 		break;
1883 
1884 	case 34:
1885 		state = -1;
1886 		match = 15;
1887 		match_pos = pos;
1888 		break;
1889 
1890 	case 35:
1891 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 122 ) ) state = 4;
1892 		else state = -1;
1893 		match = 6;
1894 		match_pos = pos;
1895 		break;
1896 
1897 	case 36:
1898 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 122 ) ) state = 4;
1899 		else state = -1;
1900 		match = 3;
1901 		match_pos = pos;
1902 		break;
1903 
1904 	case 37:
1905 		state = -1;
1906 		match = 29;
1907 		match_pos = pos;
1908 		break;
1909 
1910 	case 38:
1911 		state = -1;
1912 		match = 24;
1913 		match_pos = pos;
1914 		break;
1915 
1916 	case 39:
1917 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 122 ) ) state = 4;
1918 		else state = -1;
1919 		match = 7;
1920 		match_pos = pos;
1921 		break;
1922 
1923 	case 40:
1924 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 122 ) ) state = 4;
1925 		else state = -1;
1926 		match = 9;
1927 		match_pos = pos;
1928 		break;
1929 
1930 	case 41:
1931 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 122 ) ) state = 4;
1932 		else state = -1;
1933 		match = 4;
1934 		match_pos = pos;
1935 		break;
1936 
1937 	case 42:
1938 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 122 ) ) state = 4;
1939 		else state = -1;
1940 		match = 12;
1941 		match_pos = pos;
1942 		break;
1943 
1944 	case 43:
1945 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 122 ) ) state = 4;
1946 		else state = -1;
1947 		match = 13;
1948 		match_pos = pos;
1949 		break;
1950 
1951 	case 44:
1952 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 122 ) ) state = 4;
1953 		else state = -1;
1954 		match = 5;
1955 		match_pos = pos;
1956 		break;
1957 
1958 	case 45:
1959 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 122 ) ) state = 4;
1960 		else state = -1;
1961 		match = 11;
1962 		match_pos = pos;
1963 		break;
1964 
1965 	case 46:
1966 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 122 ) ) state = 4;
1967 		else state = -1;
1968 		match = 10;
1969 		match_pos = pos;
1970 		break;
1971 
1972 	case 47:
1973 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 122 ) ) state = 4;
1974 		else state = -1;
1975 		match = 8;
1976 		match_pos = pos;
1977 		break;
1978 
1979 	case 48:
1980 		if( chr == 38 ) state = 27;
1981 		else state = -1;
1982 		break;
1983 
1984 	case 49:
1985 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 68 ) || ( chr >= 70 && chr <= 78 ) || ( chr >= 80 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 100 ) || ( chr >= 102 && chr <= 110 ) || ( chr >= 112 && chr <= 122 ) ) state = 4;
1986 		else if( chr == 79 || chr == 111 ) state = 35;
1987 		else if( chr == 69 || chr == 101 ) state = 81;
1988 		else state = -1;
1989 		match = 45;
1990 		match_pos = pos;
1991 		break;
1992 
1993 	case 50:
1994 		if( chr == 39 ) state = 28;
1995 		else if( ( chr >= 0 && chr <= 38 ) || ( chr >= 40 && chr <= 91 ) || ( chr >= 93 && chr <= 254 ) ) state = 51;
1996 		else if( chr == 92 ) state = 55;
1997 		else state = -1;
1998 		match = 46;
1999 		match_pos = pos;
2000 		break;
2001 
2002 	case 51:
2003 		if( chr == 39 ) state = 28;
2004 		else if( ( chr >= 0 && chr <= 38 ) || ( chr >= 40 && chr <= 91 ) || ( chr >= 93 && chr <= 254 ) ) state = 51;
2005 		else if( chr == 92 ) state = 55;
2006 		else state = -1;
2007 		break;
2008 
2009 	case 52:
2010 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 69 ) || ( chr >= 71 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 101 ) || ( chr >= 103 && chr <= 122 ) ) state = 4;
2011 		else if( chr == 70 || chr == 102 ) state = 36;
2012 		else state = -1;
2013 		match = 45;
2014 		match_pos = pos;
2015 		break;
2016 
2017 	case 53:
2018 		if( chr == 61 ) state = 38;
2019 		else state = -1;
2020 		break;
2021 
2022 	case 54:
2023 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 81 ) || ( chr >= 83 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 113 ) || ( chr >= 115 && chr <= 122 ) ) state = 4;
2024 		else if( chr == 82 || chr == 114 ) state = 39;
2025 		else state = -1;
2026 		match = 45;
2027 		match_pos = pos;
2028 		break;
2029 
2030 	case 55:
2031 		if( chr == 39 ) state = 50;
2032 		else if( ( chr >= 0 && chr <= 38 ) || ( chr >= 40 && chr <= 91 ) || ( chr >= 93 && chr <= 254 ) ) state = 51;
2033 		else if( chr == 92 ) state = 55;
2034 		else state = -1;
2035 		break;
2036 
2037 	case 56:
2038 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 68 ) || ( chr >= 70 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 100 ) || ( chr >= 102 && chr <= 122 ) ) state = 4;
2039 		else if( chr == 69 || chr == 101 ) state = 40;
2040 		else state = -1;
2041 		match = 45;
2042 		match_pos = pos;
2043 		break;
2044 
2045 	case 57:
2046 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 68 ) || ( chr >= 70 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 100 ) || ( chr >= 102 && chr <= 122 ) ) state = 4;
2047 		else if( chr == 69 || chr == 101 ) state = 41;
2048 		else state = -1;
2049 		match = 45;
2050 		match_pos = pos;
2051 		break;
2052 
2053 	case 58:
2054 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 68 ) || ( chr >= 70 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 100 ) || ( chr >= 102 && chr <= 122 ) ) state = 4;
2055 		else if( chr == 69 || chr == 101 ) state = 42;
2056 		else state = -1;
2057 		match = 45;
2058 		match_pos = pos;
2059 		break;
2060 
2061 	case 59:
2062 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 68 ) || ( chr >= 70 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 100 ) || ( chr >= 102 && chr <= 122 ) ) state = 4;
2063 		else if( chr == 69 || chr == 101 ) state = 43;
2064 		else state = -1;
2065 		match = 45;
2066 		match_pos = pos;
2067 		break;
2068 
2069 	case 60:
2070 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 68 ) || ( chr >= 70 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 100 ) || ( chr >= 102 && chr <= 122 ) ) state = 4;
2071 		else if( chr == 69 || chr == 101 ) state = 44;
2072 		else state = -1;
2073 		match = 45;
2074 		match_pos = pos;
2075 		break;
2076 
2077 	case 61:
2078 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 68 ) || ( chr >= 70 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 100 ) || ( chr >= 102 && chr <= 122 ) ) state = 4;
2079 		else if( chr == 69 || chr == 101 ) state = 45;
2080 		else state = -1;
2081 		match = 45;
2082 		match_pos = pos;
2083 		break;
2084 
2085 	case 62:
2086 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 77 ) || ( chr >= 79 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 109 ) || ( chr >= 111 && chr <= 122 ) ) state = 4;
2087 		else if( chr == 78 || chr == 110 ) state = 46;
2088 		else state = -1;
2089 		match = 45;
2090 		match_pos = pos;
2091 		break;
2092 
2093 	case 63:
2094 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 77 ) || ( chr >= 79 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 109 ) || ( chr >= 111 && chr <= 122 ) ) state = 4;
2095 		else if( chr == 78 || chr == 110 ) state = 47;
2096 		else state = -1;
2097 		match = 45;
2098 		match_pos = pos;
2099 		break;
2100 
2101 	case 64:
2102 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 66 && chr <= 78 ) || ( chr >= 80 && chr <= 84 ) || ( chr >= 86 && chr <= 90 ) || chr == 95 || ( chr >= 98 && chr <= 110 ) || ( chr >= 112 && chr <= 116 ) || ( chr >= 118 && chr <= 122 ) ) state = 4;
2103 		else if( chr == 79 || chr == 111 ) state = 54;
2104 		else if( chr == 65 || chr == 97 ) state = 75;
2105 		else if( chr == 85 || chr == 117 ) state = 86;
2106 		else state = -1;
2107 		match = 45;
2108 		match_pos = pos;
2109 		break;
2110 
2111 	case 65:
2112 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 82 ) || ( chr >= 84 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 114 ) || ( chr >= 116 && chr <= 122 ) ) state = 4;
2113 		else if( chr == 83 || chr == 115 ) state = 56;
2114 		else state = -1;
2115 		match = 45;
2116 		match_pos = pos;
2117 		break;
2118 
2119 	case 66:
2120 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 82 ) || ( chr >= 84 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 114 ) || ( chr >= 116 && chr <= 122 ) ) state = 4;
2121 		else if( chr == 83 || chr == 115 ) state = 57;
2122 		else state = -1;
2123 		match = 45;
2124 		match_pos = pos;
2125 		break;
2126 
2127 	case 67:
2128 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 84 ) || ( chr >= 86 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 116 ) || ( chr >= 118 && chr <= 122 ) ) state = 4;
2129 		else if( chr == 85 || chr == 117 ) state = 58;
2130 		else state = -1;
2131 		match = 45;
2132 		match_pos = pos;
2133 		break;
2134 
2135 	case 68:
2136 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 82 ) || ( chr >= 84 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 114 ) || ( chr >= 116 && chr <= 122 ) ) state = 4;
2137 		else if( chr == 83 || chr == 115 ) state = 59;
2138 		else state = -1;
2139 		match = 45;
2140 		match_pos = pos;
2141 		break;
2142 
2143 	case 69:
2144 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 75 ) || ( chr >= 77 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 107 ) || ( chr >= 109 && chr <= 122 ) ) state = 4;
2145 		else if( chr == 76 || chr == 108 ) state = 60;
2146 		else state = -1;
2147 		match = 45;
2148 		match_pos = pos;
2149 		break;
2150 
2151 	case 70:
2152 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 83 ) || ( chr >= 85 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 115 ) || ( chr >= 117 && chr <= 122 ) ) state = 4;
2153 		else if( chr == 84 || chr == 116 ) state = 61;
2154 		else state = -1;
2155 		match = 45;
2156 		match_pos = pos;
2157 		break;
2158 
2159 	case 71:
2160 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 81 ) || ( chr >= 83 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 113 ) || ( chr >= 115 && chr <= 122 ) ) state = 4;
2161 		else if( chr == 82 || chr == 114 ) state = 62;
2162 		else state = -1;
2163 		match = 45;
2164 		match_pos = pos;
2165 		break;
2166 
2167 	case 72:
2168 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 78 ) || ( chr >= 80 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 110 ) || ( chr >= 112 && chr <= 122 ) ) state = 4;
2169 		else if( chr == 79 || chr == 111 ) state = 63;
2170 		else state = -1;
2171 		match = 45;
2172 		match_pos = pos;
2173 		break;
2174 
2175 	case 73:
2176 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 75 ) || ( chr >= 77 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 107 ) || ( chr >= 109 && chr <= 122 ) ) state = 4;
2177 		else if( chr == 76 || chr == 108 ) state = 66;
2178 		else state = -1;
2179 		match = 45;
2180 		match_pos = pos;
2181 		break;
2182 
2183 	case 74:
2184 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 81 ) || ( chr >= 83 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 113 ) || ( chr >= 115 && chr <= 122 ) ) state = 4;
2185 		else if( chr == 82 || chr == 114 ) state = 67;
2186 		else state = -1;
2187 		match = 45;
2188 		match_pos = pos;
2189 		break;
2190 
2191 	case 75:
2192 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 75 ) || ( chr >= 77 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 107 ) || ( chr >= 109 && chr <= 122 ) ) state = 4;
2193 		else if( chr == 76 || chr == 108 ) state = 68;
2194 		else state = -1;
2195 		match = 45;
2196 		match_pos = pos;
2197 		break;
2198 
2199 	case 76:
2200 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 72 ) || ( chr >= 74 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 104 ) || ( chr >= 106 && chr <= 122 ) ) state = 4;
2201 		else if( chr == 73 || chr == 105 ) state = 69;
2202 		else state = -1;
2203 		match = 45;
2204 		match_pos = pos;
2205 		break;
2206 
2207 	case 77:
2208 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 68 ) || ( chr >= 70 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 100 ) || ( chr >= 102 && chr <= 122 ) ) state = 4;
2209 		else if( chr == 69 || chr == 101 ) state = 70;
2210 		else state = -1;
2211 		match = 45;
2212 		match_pos = pos;
2213 		break;
2214 
2215 	case 78:
2216 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 84 ) || ( chr >= 86 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 116 ) || ( chr >= 118 && chr <= 122 ) ) state = 4;
2217 		else if( chr == 85 || chr == 117 ) state = 71;
2218 		else state = -1;
2219 		match = 45;
2220 		match_pos = pos;
2221 		break;
2222 
2223 	case 79:
2224 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 72 ) || ( chr >= 74 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 104 ) || ( chr >= 106 && chr <= 122 ) ) state = 4;
2225 		else if( chr == 73 || chr == 105 ) state = 72;
2226 		else state = -1;
2227 		match = 45;
2228 		match_pos = pos;
2229 		break;
2230 
2231 	case 80:
2232 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 71 ) || ( chr >= 73 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 103 ) || ( chr >= 105 && chr <= 122 ) ) state = 4;
2233 		else if( chr == 72 || chr == 104 ) state = 76;
2234 		else state = -1;
2235 		match = 45;
2236 		match_pos = pos;
2237 		break;
2238 
2239 	case 81:
2240 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 75 ) || ( chr >= 77 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 107 ) || ( chr >= 109 && chr <= 122 ) ) state = 4;
2241 		else if( chr == 76 || chr == 108 ) state = 77;
2242 		else state = -1;
2243 		match = 45;
2244 		match_pos = pos;
2245 		break;
2246 
2247 	case 82:
2248 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 83 ) || ( chr >= 85 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 115 ) || ( chr >= 117 && chr <= 122 ) ) state = 4;
2249 		else if( chr == 84 || chr == 116 ) state = 78;
2250 		else state = -1;
2251 		match = 45;
2252 		match_pos = pos;
2253 		break;
2254 
2255 	case 83:
2256 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 83 ) || ( chr >= 85 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 115 ) || ( chr >= 117 && chr <= 122 ) ) state = 4;
2257 		else if( chr == 84 || chr == 116 ) state = 79;
2258 		else state = -1;
2259 		match = 45;
2260 		match_pos = pos;
2261 		break;
2262 
2263 	case 84:
2264 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 68 ) || ( chr >= 70 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 100 ) || ( chr >= 102 && chr <= 122 ) ) state = 4;
2265 		else if( chr == 69 || chr == 101 ) state = 82;
2266 		else state = -1;
2267 		match = 45;
2268 		match_pos = pos;
2269 		break;
2270 
2271 	case 85:
2272 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 66 ) || ( chr >= 68 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 98 ) || ( chr >= 100 && chr <= 122 ) ) state = 4;
2273 		else if( chr == 67 || chr == 99 ) state = 83;
2274 		else state = -1;
2275 		match = 45;
2276 		match_pos = pos;
2277 		break;
2278 
2279 	case 86:
2280 		if( ( chr >= 48 && chr <= 57 ) || ( chr >= 65 && chr <= 77 ) || ( chr >= 79 && chr <= 90 ) || chr == 95 || ( chr >= 97 && chr <= 109 ) || ( chr >= 111 && chr <= 122 ) ) state = 4;
2281 		else if( chr == 78 || chr == 110 ) state = 85;
2282 		else state = -1;
2283 		match = 45;
2284 		match_pos = pos;
2285 		break;
2286 
2287 }
2288 
2289 
2290 
2291                     //Line- and column-counter
2292                     if( state > -1 ) {
2293                         if( chr == 10 ) {
2294                             PCB.line++;
2295                             PCB.column = 0;
2296                             if (this.countLines) {
2297                                 this.parCurLine = PCB.line;
2298                                 this.parCurColumn = PCB.column;
2299                             }
2300                         }
2301                         PCB.column++;
2302                     }
2303 
2304                     pos++;
2305 
2306                 } while( state > -1 );
2307 
2308             } while (2 > -1 && match == 2);
2309 
2310             if (match > -1) {
2311                 PCB.att = PCB.src.substr( start, match_pos - start );
2312                 PCB.offset = match_pos;
2313         
2314 	if( match == 46 )
2315 	{
2316 		 PCB.att = PCB.att.substr( 1, PCB.att.length - 2 );
2317                                                                                 PCB.att = PCB.att.replace( /\\\'/g, "\'" );    
2318 		}
2319 
2320             } else {
2321                 PCB.att = new String();
2322                 match = -1;
2323             }
2324 
2325             break;
2326         }
2327         return match;
2328     },
2329 
2330     /**
2331      * Internal parse tree generator.
2332      * @param {String} src source code
2333      * @param {Array} err_off The positions where the errors occured are stored here.
2334      * @param {Array} err_la What the parser expected will be stored here.
2335      * @private
2336      */
2337     _parse: function (src, err_off, err_la) {
2338         var sstack = [],
2339             vstack = [],
2340             err_cnt = 0,
2341             act,
2342             rval,
2343             i,
2344 
2345             PCB = {
2346                 la: 0,
2347                 act: 0,
2348                 offset: 0,
2349                 src: src,
2350                 att: '',
2351                 line: 1,
2352                 column: 1,
2353                 error_step: 0
2354             };
2355 
2356 /* Pop-Table */
2357 var pop_tab = new Array(
2358 	new Array( 0/* Program' */, 1 ),
2359 	new Array( 49/* Program */, 2 ),
2360 	new Array( 49/* Program */, 0 ),
2361 	new Array( 51/* Stmt_List */, 2 ),
2362 	new Array( 51/* Stmt_List */, 0 ),
2363 	new Array( 52/* Param_List */, 3 ),
2364 	new Array( 52/* Param_List */, 1 ),
2365 	new Array( 52/* Param_List */, 0 ),
2366 	new Array( 54/* Prop_List */, 3 ),
2367 	new Array( 54/* Prop_List */, 1 ),
2368 	new Array( 54/* Prop_List */, 0 ),
2369 	new Array( 55/* Prop */, 3 ),
2370 	new Array( 56/* Param_Def_List */, 3 ),
2371 	new Array( 56/* Param_Def_List */, 1 ),
2372 	new Array( 56/* Param_Def_List */, 0 ),
2373 	new Array( 58/* Assign */, 3 ),
2374 	new Array( 50/* Stmt */, 3 ),
2375 	new Array( 50/* Stmt */, 5 ),
2376 	new Array( 50/* Stmt */, 3 ),
2377 	new Array( 50/* Stmt */, 5 ),
2378 	new Array( 50/* Stmt */, 9 ),
2379 	new Array( 50/* Stmt */, 3 ),
2380 	new Array( 50/* Stmt */, 2 ),
2381 	new Array( 50/* Stmt */, 2 ),
2382 	new Array( 50/* Stmt */, 2 ),
2383 	new Array( 50/* Stmt */, 2 ),
2384 	new Array( 50/* Stmt */, 3 ),
2385 	new Array( 50/* Stmt */, 1 ),
2386 	new Array( 57/* Lhs */, 3 ),
2387 	new Array( 57/* Lhs */, 4 ),
2388 	new Array( 57/* Lhs */, 1 ),
2389 	new Array( 53/* Expression */, 3 ),
2390 	new Array( 53/* Expression */, 3 ),
2391 	new Array( 53/* Expression */, 3 ),
2392 	new Array( 53/* Expression */, 3 ),
2393 	new Array( 53/* Expression */, 3 ),
2394 	new Array( 53/* Expression */, 3 ),
2395 	new Array( 53/* Expression */, 3 ),
2396 	new Array( 53/* Expression */, 1 ),
2397 	new Array( 61/* LogExp */, 3 ),
2398 	new Array( 61/* LogExp */, 3 ),
2399 	new Array( 61/* LogExp */, 2 ),
2400 	new Array( 61/* LogExp */, 1 ),
2401 	new Array( 60/* AddSubExp */, 3 ),
2402 	new Array( 60/* AddSubExp */, 3 ),
2403 	new Array( 60/* AddSubExp */, 1 ),
2404 	new Array( 62/* MulDivExp */, 3 ),
2405 	new Array( 62/* MulDivExp */, 3 ),
2406 	new Array( 62/* MulDivExp */, 3 ),
2407 	new Array( 62/* MulDivExp */, 1 ),
2408 	new Array( 63/* ExpExp */, 3 ),
2409 	new Array( 63/* ExpExp */, 1 ),
2410 	new Array( 64/* NegExp */, 2 ),
2411 	new Array( 64/* NegExp */, 2 ),
2412 	new Array( 64/* NegExp */, 1 ),
2413 	new Array( 59/* ExtValue */, 4 ),
2414 	new Array( 59/* ExtValue */, 4 ),
2415 	new Array( 59/* ExtValue */, 5 ),
2416 	new Array( 59/* ExtValue */, 3 ),
2417 	new Array( 59/* ExtValue */, 1 ),
2418 	new Array( 65/* Value */, 1 ),
2419 	new Array( 65/* Value */, 1 ),
2420 	new Array( 65/* Value */, 1 ),
2421 	new Array( 65/* Value */, 3 ),
2422 	new Array( 65/* Value */, 1 ),
2423 	new Array( 65/* Value */, 7 ),
2424 	new Array( 65/* Value */, 3 ),
2425 	new Array( 65/* Value */, 3 ),
2426 	new Array( 65/* Value */, 1 ),
2427 	new Array( 65/* Value */, 1 )
2428 );
2429 
2430 /* Action-Table */
2431 var act_tab = new Array(
2432 	/* State 0 */ new Array(  ),
2433 	/* State 1 */ new Array( 3/* "IF" */,3 , 5/* "WHILE" */,4 , 6/* "DO" */,5 , 7/* "FOR" */,6 , 9/* "USE" */,7 , 11/* "DELETE" */,8 , 10/* "RETURN" */,9 , 18/* "{" */,12 , 20/* ";" */,13 , 45/* "Identifier" */,17 , 31/* "!" */,18 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 , 33/* "-" */,33 , 32/* "+" */,34 ),
2434 	/* State 2 */ new Array(  ),
2435 	/* State 3 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2436 	/* State 4 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2437 	/* State 5 */ new Array( 3/* "IF" */,3 , 5/* "WHILE" */,4 , 6/* "DO" */,5 , 7/* "FOR" */,6 , 9/* "USE" */,7 , 11/* "DELETE" */,8 , 10/* "RETURN" */,9 , 18/* "{" */,12 , 20/* ";" */,13 , 45/* "Identifier" */,17 , 31/* "!" */,18 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 , 33/* "-" */,33 , 32/* "+" */,34 ),
2438 	/* State 6 */ new Array( 38/* "(" */,40 ),
2439 	/* State 7 */ new Array( 45/* "Identifier" */,41 ),
2440 	/* State 8 */ new Array( 45/* "Identifier" */,42 ),
2441 	/* State 9 */ new Array( 3/* "IF" */,3 , 5/* "WHILE" */,4 , 6/* "DO" */,5 , 7/* "FOR" */,6 , 9/* "USE" */,7 , 11/* "DELETE" */,8 , 10/* "RETURN" */,9 , 18/* "{" */,12 , 20/* ";" */,13 , 45/* "Identifier" */,17 , 31/* "!" */,18 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 , 33/* "-" */,33 , 32/* "+" */,34 ),
2442 	/* State 10 */ new Array( 20/* ";" */,44 ),
2443 	/* State 11 */ new Array( 24/* "~=" */,45 , 23/* "!=" */,46 , 26/* ">=" */,47 , 25/* "<=" */,48 , 27/* ">" */,49 , 28/* "<" */,50 , 22/* "==" */,51 , 20/* ";" */,52 ),
2444 	/* State 12 */ new Array(  ),
2445 	/* State 13 */ new Array(  ),
2446 	/* State 14 */ new Array( 21/* "=" */,54 ),
2447 	/* State 15 */ new Array( 30/* "&&" */,55 , 29/* "||" */,56 ),
2448 	/* State 16 */ new Array( 44/* "." */,57 , 38/* "(" */,58 , 16/* "[" */,59 ),
2449 	/* State 17 */ new Array( 21/* "=" */,-30 ),
2450 	/* State 18 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2451 	/* State 19 */ new Array( 32/* "+" */,61 , 33/* "-" */,62 ),
2452 	/* State 20 */ new Array(  ),
2453 	/* State 21 */ new Array( 35/* "%" */,63 , 34/* "/" */,64 , 36/* "*" */,65 ),
2454 	/* State 22 */ new Array(  ),
2455 	/* State 23 */ new Array(  ),
2456 	/* State 24 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2457 	/* State 25 */ new Array(  ),
2458 	/* State 26 */ new Array( 38/* "(" */,67 ),
2459 	/* State 27 */ new Array( 45/* "Identifier" */,70 ),
2460 	/* State 28 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2461 	/* State 29 */ new Array(  ),
2462 	/* State 30 */ new Array(  ),
2463 	/* State 31 */ new Array(  ),
2464 	/* State 32 */ new Array( 37/* "^" */,73 ),
2465 	/* State 33 */ new Array( 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2466 	/* State 34 */ new Array( 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2467 	/* State 35 */ new Array( 24/* "~=" */,45 , 23/* "!=" */,46 , 26/* ">=" */,47 , 25/* "<=" */,48 , 27/* ">" */,49 , 28/* "<" */,50 , 22/* "==" */,51 , 3/* "IF" */,3 , 5/* "WHILE" */,4 , 6/* "DO" */,5 , 7/* "FOR" */,6 , 9/* "USE" */,7 , 11/* "DELETE" */,8 , 10/* "RETURN" */,9 , 18/* "{" */,12 , 20/* ";" */,13 , 45/* "Identifier" */,17 , 31/* "!" */,18 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 , 33/* "-" */,33 , 32/* "+" */,34 ),
2468 	/* State 36 */ new Array( 44/* "." */,77 , 38/* "(" */,58 , 16/* "[" */,78 ),
2469 	/* State 37 */ new Array(  ),
2470 	/* State 38 */ new Array( 24/* "~=" */,45 , 23/* "!=" */,46 , 26/* ">=" */,47 , 25/* "<=" */,48 , 27/* ">" */,49 , 28/* "<" */,50 , 22/* "==" */,51 , 3/* "IF" */,3 , 5/* "WHILE" */,4 , 6/* "DO" */,5 , 7/* "FOR" */,6 , 9/* "USE" */,7 , 11/* "DELETE" */,8 , 10/* "RETURN" */,9 , 18/* "{" */,12 , 20/* ";" */,13 , 45/* "Identifier" */,17 , 31/* "!" */,18 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 , 33/* "-" */,33 , 32/* "+" */,34 ),
2471 	/* State 39 */ new Array( 5/* "WHILE" */,80 ),
2472 	/* State 40 */ new Array( 45/* "Identifier" */,17 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2473 	/* State 41 */ new Array( 20/* ";" */,83 ),
2474 	/* State 42 */ new Array(  ),
2475 	/* State 43 */ new Array(  ),
2476 	/* State 44 */ new Array(  ),
2477 	/* State 45 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2478 	/* State 46 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2479 	/* State 47 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2480 	/* State 48 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2481 	/* State 49 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2482 	/* State 50 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2483 	/* State 51 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2484 	/* State 52 */ new Array(  ),
2485 	/* State 53 */ new Array( 19/* "}" */,91 , 3/* "IF" */,3 , 5/* "WHILE" */,4 , 6/* "DO" */,5 , 7/* "FOR" */,6 , 9/* "USE" */,7 , 11/* "DELETE" */,8 , 10/* "RETURN" */,9 , 18/* "{" */,12 , 20/* ";" */,13 , 45/* "Identifier" */,17 , 31/* "!" */,18 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 , 33/* "-" */,33 , 32/* "+" */,34 ),
2486 	/* State 54 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2487 	/* State 55 */ new Array( 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2488 	/* State 56 */ new Array( 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2489 	/* State 57 */ new Array( 45/* "Identifier" */,96 ),
2490 	/* State 58 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2491 	/* State 59 */ new Array( 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2492 	/* State 60 */ new Array( 30/* "&&" */,55 , 29/* "||" */,56 ),
2493 	/* State 61 */ new Array( 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2494 	/* State 62 */ new Array( 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2495 	/* State 63 */ new Array( 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2496 	/* State 64 */ new Array( 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2497 	/* State 65 */ new Array( 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2498 	/* State 66 */ new Array( 39/* ")" */,104 , 24/* "~=" */,45 , 23/* "!=" */,46 , 26/* ">=" */,47 , 25/* "<=" */,48 , 27/* ">" */,49 , 28/* "<" */,50 , 22/* "==" */,51 ),
2499 	/* State 67 */ new Array( 45/* "Identifier" */,106 ),
2500 	/* State 68 */ new Array( 15/* ">>" */,107 , 40/* "," */,108 ),
2501 	/* State 69 */ new Array(  ),
2502 	/* State 70 */ new Array( 42/* ":" */,109 ),
2503 	/* State 71 */ new Array( 17/* "]" */,110 , 40/* "," */,111 ),
2504 	/* State 72 */ new Array( 24/* "~=" */,45 , 23/* "!=" */,46 , 26/* ">=" */,47 , 25/* "<=" */,48 , 27/* ">" */,49 , 28/* "<" */,50 , 22/* "==" */,51 ),
2505 	/* State 73 */ new Array( 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2506 	/* State 74 */ new Array( 44/* "." */,77 , 38/* "(" */,58 , 16/* "[" */,78 ),
2507 	/* State 75 */ new Array( 44/* "." */,77 , 38/* "(" */,58 , 16/* "[" */,78 ),
2508 	/* State 76 */ new Array( 4/* "ELSE" */,113 ),
2509 	/* State 77 */ new Array( 45/* "Identifier" */,114 ),
2510 	/* State 78 */ new Array( 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2511 	/* State 79 */ new Array(  ),
2512 	/* State 80 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2513 	/* State 81 */ new Array( 20/* ";" */,117 ),
2514 	/* State 82 */ new Array( 44/* "." */,57 , 38/* "(" */,58 , 16/* "[" */,59 ),
2515 	/* State 83 */ new Array(  ),
2516 	/* State 84 */ new Array( 30/* "&&" */,55 , 29/* "||" */,56 ),
2517 	/* State 85 */ new Array( 30/* "&&" */,55 , 29/* "||" */,56 ),
2518 	/* State 86 */ new Array( 30/* "&&" */,55 , 29/* "||" */,56 ),
2519 	/* State 87 */ new Array( 30/* "&&" */,55 , 29/* "||" */,56 ),
2520 	/* State 88 */ new Array( 30/* "&&" */,55 , 29/* "||" */,56 ),
2521 	/* State 89 */ new Array( 30/* "&&" */,55 , 29/* "||" */,56 ),
2522 	/* State 90 */ new Array( 30/* "&&" */,55 , 29/* "||" */,56 ),
2523 	/* State 91 */ new Array(  ),
2524 	/* State 92 */ new Array(  ),
2525 	/* State 93 */ new Array( 24/* "~=" */,45 , 23/* "!=" */,46 , 26/* ">=" */,47 , 25/* "<=" */,48 , 27/* ">" */,49 , 28/* "<" */,50 , 22/* "==" */,51 ),
2526 	/* State 94 */ new Array( 32/* "+" */,61 , 33/* "-" */,62 ),
2527 	/* State 95 */ new Array( 32/* "+" */,61 , 33/* "-" */,62 ),
2528 	/* State 96 */ new Array( 21/* "=" */,-28 ),
2529 	/* State 97 */ new Array( 39/* ")" */,118 , 40/* "," */,111 ),
2530 	/* State 98 */ new Array( 17/* "]" */,119 , 32/* "+" */,61 , 33/* "-" */,62 ),
2531 	/* State 99 */ new Array( 35/* "%" */,63 , 34/* "/" */,64 , 36/* "*" */,65 ),
2532 	/* State 100 */ new Array( 35/* "%" */,63 , 34/* "/" */,64 , 36/* "*" */,65 ),
2533 	/* State 101 */ new Array(  ),
2534 	/* State 102 */ new Array(  ),
2535 	/* State 103 */ new Array(  ),
2536 	/* State 104 */ new Array(  ),
2537 	/* State 105 */ new Array( 39/* ")" */,120 , 40/* "," */,121 ),
2538 	/* State 106 */ new Array(  ),
2539 	/* State 107 */ new Array(  ),
2540 	/* State 108 */ new Array( 45/* "Identifier" */,70 ),
2541 	/* State 109 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2542 	/* State 110 */ new Array(  ),
2543 	/* State 111 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2544 	/* State 112 */ new Array(  ),
2545 	/* State 113 */ new Array( 3/* "IF" */,3 , 5/* "WHILE" */,4 , 6/* "DO" */,5 , 7/* "FOR" */,6 , 9/* "USE" */,7 , 11/* "DELETE" */,8 , 10/* "RETURN" */,9 , 18/* "{" */,12 , 20/* ";" */,13 , 45/* "Identifier" */,17 , 31/* "!" */,18 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 , 33/* "-" */,33 , 32/* "+" */,34 ),
2546 	/* State 114 */ new Array(  ),
2547 	/* State 115 */ new Array( 17/* "]" */,126 , 32/* "+" */,61 , 33/* "-" */,62 ),
2548 	/* State 116 */ new Array( 24/* "~=" */,45 , 23/* "!=" */,46 , 26/* ">=" */,47 , 25/* "<=" */,48 , 27/* ">" */,49 , 28/* "<" */,50 , 22/* "==" */,51 , 20/* ";" */,127 ),
2549 	/* State 117 */ new Array( 31/* "!" */,18 , 33/* "-" */,33 , 32/* "+" */,34 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2550 	/* State 118 */ new Array( 47/* "Integer" */,22 , 48/* "Float" */,23 , 45/* "Identifier" */,37 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2551 	/* State 119 */ new Array( 21/* "=" */,-29 ),
2552 	/* State 120 */ new Array( 18/* "{" */,130 ),
2553 	/* State 121 */ new Array( 45/* "Identifier" */,131 ),
2554 	/* State 122 */ new Array(  ),
2555 	/* State 123 */ new Array( 24/* "~=" */,45 , 23/* "!=" */,46 , 26/* ">=" */,47 , 25/* "<=" */,48 , 27/* ">" */,49 , 28/* "<" */,50 , 22/* "==" */,51 ),
2556 	/* State 124 */ new Array( 24/* "~=" */,45 , 23/* "!=" */,46 , 26/* ">=" */,47 , 25/* "<=" */,48 , 27/* ">" */,49 , 28/* "<" */,50 , 22/* "==" */,51 ),
2557 	/* State 125 */ new Array(  ),
2558 	/* State 126 */ new Array(  ),
2559 	/* State 127 */ new Array(  ),
2560 	/* State 128 */ new Array( 24/* "~=" */,45 , 23/* "!=" */,46 , 26/* ">=" */,47 , 25/* "<=" */,48 , 27/* ">" */,49 , 28/* "<" */,50 , 22/* "==" */,51 , 20/* ";" */,132 ),
2561 	/* State 129 */ new Array( 44/* "." */,77 , 38/* "(" */,58 , 16/* "[" */,78 ),
2562 	/* State 130 */ new Array(  ),
2563 	/* State 131 */ new Array(  ),
2564 	/* State 132 */ new Array( 45/* "Identifier" */,17 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 ),
2565 	/* State 133 */ new Array( 19/* "}" */,135 , 3/* "IF" */,3 , 5/* "WHILE" */,4 , 6/* "DO" */,5 , 7/* "FOR" */,6 , 9/* "USE" */,7 , 11/* "DELETE" */,8 , 10/* "RETURN" */,9 , 18/* "{" */,12 , 20/* ";" */,13 , 45/* "Identifier" */,17 , 31/* "!" */,18 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 , 33/* "-" */,33 , 32/* "+" */,34 ),
2566 	/* State 134 */ new Array( 39/* ")" */,136 ),
2567 	/* State 135 */ new Array(  ),
2568 	/* State 136 */ new Array( 3/* "IF" */,3 , 5/* "WHILE" */,4 , 6/* "DO" */,5 , 7/* "FOR" */,6 , 9/* "USE" */,7 , 11/* "DELETE" */,8 , 10/* "RETURN" */,9 , 18/* "{" */,12 , 20/* ";" */,13 , 45/* "Identifier" */,17 , 31/* "!" */,18 , 47/* "Integer" */,22 , 48/* "Float" */,23 , 38/* "(" */,24 , 46/* "String" */,25 , 8/* "FUNCTION" */,26 , 14/* "<<" */,27 , 16/* "[" */,28 , 12/* "TRUE" */,29 , 13/* "FALSE" */,30 , 33/* "-" */,33 , 32/* "+" */,34 ),
2569 	/* State 137 */ new Array(  )
2570 );
2571 
2572 /* Goto-Table */
2573 var goto_tab = new Array(
2574 	/* State 0 */ new Array( 49/* Program */,1 ),
2575 	/* State 1 */ new Array( 50/* Stmt */,2 , 58/* Assign */,10 , 53/* Expression */,11 , 57/* Lhs */,14 , 61/* LogExp */,15 , 59/* ExtValue */,16 , 60/* AddSubExp */,19 , 65/* Value */,20 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 ),
2576 	/* State 2 */ new Array(  ),
2577 	/* State 3 */ new Array( 53/* Expression */,35 , 61/* LogExp */,15 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2578 	/* State 4 */ new Array( 53/* Expression */,38 , 61/* LogExp */,15 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2579 	/* State 5 */ new Array( 50/* Stmt */,39 , 58/* Assign */,10 , 53/* Expression */,11 , 57/* Lhs */,14 , 61/* LogExp */,15 , 59/* ExtValue */,16 , 60/* AddSubExp */,19 , 65/* Value */,20 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 ),
2580 	/* State 6 */ new Array(  ),
2581 	/* State 7 */ new Array(  ),
2582 	/* State 8 */ new Array(  ),
2583 	/* State 9 */ new Array( 50/* Stmt */,43 , 58/* Assign */,10 , 53/* Expression */,11 , 57/* Lhs */,14 , 61/* LogExp */,15 , 59/* ExtValue */,16 , 60/* AddSubExp */,19 , 65/* Value */,20 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 ),
2584 	/* State 10 */ new Array(  ),
2585 	/* State 11 */ new Array(  ),
2586 	/* State 12 */ new Array( 51/* Stmt_List */,53 ),
2587 	/* State 13 */ new Array(  ),
2588 	/* State 14 */ new Array(  ),
2589 	/* State 15 */ new Array(  ),
2590 	/* State 16 */ new Array(  ),
2591 	/* State 17 */ new Array(  ),
2592 	/* State 18 */ new Array( 61/* LogExp */,60 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2593 	/* State 19 */ new Array(  ),
2594 	/* State 20 */ new Array(  ),
2595 	/* State 21 */ new Array(  ),
2596 	/* State 22 */ new Array(  ),
2597 	/* State 23 */ new Array(  ),
2598 	/* State 24 */ new Array( 53/* Expression */,66 , 61/* LogExp */,15 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2599 	/* State 25 */ new Array(  ),
2600 	/* State 26 */ new Array(  ),
2601 	/* State 27 */ new Array( 54/* Prop_List */,68 , 55/* Prop */,69 ),
2602 	/* State 28 */ new Array( 52/* Param_List */,71 , 53/* Expression */,72 , 61/* LogExp */,15 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2603 	/* State 29 */ new Array(  ),
2604 	/* State 30 */ new Array(  ),
2605 	/* State 31 */ new Array(  ),
2606 	/* State 32 */ new Array(  ),
2607 	/* State 33 */ new Array( 59/* ExtValue */,74 , 65/* Value */,20 ),
2608 	/* State 34 */ new Array( 59/* ExtValue */,75 , 65/* Value */,20 ),
2609 	/* State 35 */ new Array( 50/* Stmt */,76 , 58/* Assign */,10 , 53/* Expression */,11 , 57/* Lhs */,14 , 61/* LogExp */,15 , 59/* ExtValue */,16 , 60/* AddSubExp */,19 , 65/* Value */,20 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 ),
2610 	/* State 36 */ new Array(  ),
2611 	/* State 37 */ new Array(  ),
2612 	/* State 38 */ new Array( 50/* Stmt */,79 , 58/* Assign */,10 , 53/* Expression */,11 , 57/* Lhs */,14 , 61/* LogExp */,15 , 59/* ExtValue */,16 , 60/* AddSubExp */,19 , 65/* Value */,20 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 ),
2613 	/* State 39 */ new Array(  ),
2614 	/* State 40 */ new Array( 58/* Assign */,81 , 57/* Lhs */,14 , 59/* ExtValue */,82 , 65/* Value */,20 ),
2615 	/* State 41 */ new Array(  ),
2616 	/* State 42 */ new Array(  ),
2617 	/* State 43 */ new Array(  ),
2618 	/* State 44 */ new Array(  ),
2619 	/* State 45 */ new Array( 61/* LogExp */,84 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2620 	/* State 46 */ new Array( 61/* LogExp */,85 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2621 	/* State 47 */ new Array( 61/* LogExp */,86 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2622 	/* State 48 */ new Array( 61/* LogExp */,87 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2623 	/* State 49 */ new Array( 61/* LogExp */,88 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2624 	/* State 50 */ new Array( 61/* LogExp */,89 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2625 	/* State 51 */ new Array( 61/* LogExp */,90 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2626 	/* State 52 */ new Array(  ),
2627 	/* State 53 */ new Array( 50/* Stmt */,92 , 58/* Assign */,10 , 53/* Expression */,11 , 57/* Lhs */,14 , 61/* LogExp */,15 , 59/* ExtValue */,16 , 60/* AddSubExp */,19 , 65/* Value */,20 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 ),
2628 	/* State 54 */ new Array( 53/* Expression */,93 , 61/* LogExp */,15 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2629 	/* State 55 */ new Array( 60/* AddSubExp */,94 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2630 	/* State 56 */ new Array( 60/* AddSubExp */,95 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2631 	/* State 57 */ new Array(  ),
2632 	/* State 58 */ new Array( 52/* Param_List */,97 , 53/* Expression */,72 , 61/* LogExp */,15 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2633 	/* State 59 */ new Array( 60/* AddSubExp */,98 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2634 	/* State 60 */ new Array(  ),
2635 	/* State 61 */ new Array( 62/* MulDivExp */,99 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2636 	/* State 62 */ new Array( 62/* MulDivExp */,100 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2637 	/* State 63 */ new Array( 63/* ExpExp */,101 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2638 	/* State 64 */ new Array( 63/* ExpExp */,102 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2639 	/* State 65 */ new Array( 63/* ExpExp */,103 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2640 	/* State 66 */ new Array(  ),
2641 	/* State 67 */ new Array( 56/* Param_Def_List */,105 ),
2642 	/* State 68 */ new Array(  ),
2643 	/* State 69 */ new Array(  ),
2644 	/* State 70 */ new Array(  ),
2645 	/* State 71 */ new Array(  ),
2646 	/* State 72 */ new Array(  ),
2647 	/* State 73 */ new Array( 63/* ExpExp */,112 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2648 	/* State 74 */ new Array(  ),
2649 	/* State 75 */ new Array(  ),
2650 	/* State 76 */ new Array(  ),
2651 	/* State 77 */ new Array(  ),
2652 	/* State 78 */ new Array( 60/* AddSubExp */,115 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2653 	/* State 79 */ new Array(  ),
2654 	/* State 80 */ new Array( 53/* Expression */,116 , 61/* LogExp */,15 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2655 	/* State 81 */ new Array(  ),
2656 	/* State 82 */ new Array(  ),
2657 	/* State 83 */ new Array(  ),
2658 	/* State 84 */ new Array(  ),
2659 	/* State 85 */ new Array(  ),
2660 	/* State 86 */ new Array(  ),
2661 	/* State 87 */ new Array(  ),
2662 	/* State 88 */ new Array(  ),
2663 	/* State 89 */ new Array(  ),
2664 	/* State 90 */ new Array(  ),
2665 	/* State 91 */ new Array(  ),
2666 	/* State 92 */ new Array(  ),
2667 	/* State 93 */ new Array(  ),
2668 	/* State 94 */ new Array(  ),
2669 	/* State 95 */ new Array(  ),
2670 	/* State 96 */ new Array(  ),
2671 	/* State 97 */ new Array(  ),
2672 	/* State 98 */ new Array(  ),
2673 	/* State 99 */ new Array(  ),
2674 	/* State 100 */ new Array(  ),
2675 	/* State 101 */ new Array(  ),
2676 	/* State 102 */ new Array(  ),
2677 	/* State 103 */ new Array(  ),
2678 	/* State 104 */ new Array(  ),
2679 	/* State 105 */ new Array(  ),
2680 	/* State 106 */ new Array(  ),
2681 	/* State 107 */ new Array(  ),
2682 	/* State 108 */ new Array( 55/* Prop */,122 ),
2683 	/* State 109 */ new Array( 53/* Expression */,123 , 61/* LogExp */,15 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2684 	/* State 110 */ new Array(  ),
2685 	/* State 111 */ new Array( 53/* Expression */,124 , 61/* LogExp */,15 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2686 	/* State 112 */ new Array(  ),
2687 	/* State 113 */ new Array( 50/* Stmt */,125 , 58/* Assign */,10 , 53/* Expression */,11 , 57/* Lhs */,14 , 61/* LogExp */,15 , 59/* ExtValue */,16 , 60/* AddSubExp */,19 , 65/* Value */,20 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 ),
2688 	/* State 114 */ new Array(  ),
2689 	/* State 115 */ new Array(  ),
2690 	/* State 116 */ new Array(  ),
2691 	/* State 117 */ new Array( 53/* Expression */,128 , 61/* LogExp */,15 , 60/* AddSubExp */,19 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 , 59/* ExtValue */,36 , 65/* Value */,20 ),
2692 	/* State 118 */ new Array( 59/* ExtValue */,129 , 65/* Value */,20 ),
2693 	/* State 119 */ new Array(  ),
2694 	/* State 120 */ new Array(  ),
2695 	/* State 121 */ new Array(  ),
2696 	/* State 122 */ new Array(  ),
2697 	/* State 123 */ new Array(  ),
2698 	/* State 124 */ new Array(  ),
2699 	/* State 125 */ new Array(  ),
2700 	/* State 126 */ new Array(  ),
2701 	/* State 127 */ new Array(  ),
2702 	/* State 128 */ new Array(  ),
2703 	/* State 129 */ new Array(  ),
2704 	/* State 130 */ new Array( 51/* Stmt_List */,133 ),
2705 	/* State 131 */ new Array(  ),
2706 	/* State 132 */ new Array( 58/* Assign */,134 , 57/* Lhs */,14 , 59/* ExtValue */,82 , 65/* Value */,20 ),
2707 	/* State 133 */ new Array( 50/* Stmt */,92 , 58/* Assign */,10 , 53/* Expression */,11 , 57/* Lhs */,14 , 61/* LogExp */,15 , 59/* ExtValue */,16 , 60/* AddSubExp */,19 , 65/* Value */,20 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 ),
2708 	/* State 134 */ new Array(  ),
2709 	/* State 135 */ new Array(  ),
2710 	/* State 136 */ new Array( 50/* Stmt */,137 , 58/* Assign */,10 , 53/* Expression */,11 , 57/* Lhs */,14 , 61/* LogExp */,15 , 59/* ExtValue */,16 , 60/* AddSubExp */,19 , 65/* Value */,20 , 62/* MulDivExp */,21 , 63/* ExpExp */,31 , 64/* NegExp */,32 ),
2711 	/* State 137 */ new Array(  )
2712 );
2713 
2714 /* Default-Actions-Table */
2715 var defact_tab = new Array(
2716 	 /* State 0 */ 2 ,
2717 	 /* State 1 */ 0 ,
2718 	 /* State 2 */ 1 ,
2719 	 /* State 3 */ -1 ,
2720 	 /* State 4 */ -1 ,
2721 	 /* State 5 */ -1 ,
2722 	 /* State 6 */ -1 ,
2723 	 /* State 7 */ -1 ,
2724 	 /* State 8 */ -1 ,
2725 	 /* State 9 */ -1 ,
2726 	 /* State 10 */ -1 ,
2727 	 /* State 11 */ -1 ,
2728 	 /* State 12 */ 4 ,
2729 	 /* State 13 */ 27 ,
2730 	 /* State 14 */ -1 ,
2731 	 /* State 15 */ 38 ,
2732 	 /* State 16 */ 54 ,
2733 	 /* State 17 */ 62 ,
2734 	 /* State 18 */ -1 ,
2735 	 /* State 19 */ 42 ,
2736 	 /* State 20 */ 59 ,
2737 	 /* State 21 */ 45 ,
2738 	 /* State 22 */ 60 ,
2739 	 /* State 23 */ 61 ,
2740 	 /* State 24 */ -1 ,
2741 	 /* State 25 */ 64 ,
2742 	 /* State 26 */ -1 ,
2743 	 /* State 27 */ 10 ,
2744 	 /* State 28 */ 7 ,
2745 	 /* State 29 */ 68 ,
2746 	 /* State 30 */ 69 ,
2747 	 /* State 31 */ 49 ,
2748 	 /* State 32 */ 51 ,
2749 	 /* State 33 */ -1 ,
2750 	 /* State 34 */ -1 ,
2751 	 /* State 35 */ -1 ,
2752 	 /* State 36 */ 54 ,
2753 	 /* State 37 */ 62 ,
2754 	 /* State 38 */ -1 ,
2755 	 /* State 39 */ -1 ,
2756 	 /* State 40 */ -1 ,
2757 	 /* State 41 */ -1 ,
2758 	 /* State 42 */ 22 ,
2759 	 /* State 43 */ 23 ,
2760 	 /* State 44 */ 24 ,
2761 	 /* State 45 */ -1 ,
2762 	 /* State 46 */ -1 ,
2763 	 /* State 47 */ -1 ,
2764 	 /* State 48 */ -1 ,
2765 	 /* State 49 */ -1 ,
2766 	 /* State 50 */ -1 ,
2767 	 /* State 51 */ -1 ,
2768 	 /* State 52 */ 25 ,
2769 	 /* State 53 */ -1 ,
2770 	 /* State 54 */ -1 ,
2771 	 /* State 55 */ -1 ,
2772 	 /* State 56 */ -1 ,
2773 	 /* State 57 */ -1 ,
2774 	 /* State 58 */ 7 ,
2775 	 /* State 59 */ -1 ,
2776 	 /* State 60 */ 41 ,
2777 	 /* State 61 */ -1 ,
2778 	 /* State 62 */ -1 ,
2779 	 /* State 63 */ -1 ,
2780 	 /* State 64 */ -1 ,
2781 	 /* State 65 */ -1 ,
2782 	 /* State 66 */ -1 ,
2783 	 /* State 67 */ 14 ,
2784 	 /* State 68 */ -1 ,
2785 	 /* State 69 */ 9 ,
2786 	 /* State 70 */ -1 ,
2787 	 /* State 71 */ -1 ,
2788 	 /* State 72 */ 6 ,
2789 	 /* State 73 */ -1 ,
2790 	 /* State 74 */ 52 ,
2791 	 /* State 75 */ 53 ,
2792 	 /* State 76 */ 16 ,
2793 	 /* State 77 */ -1 ,
2794 	 /* State 78 */ -1 ,
2795 	 /* State 79 */ 18 ,
2796 	 /* State 80 */ -1 ,
2797 	 /* State 81 */ -1 ,
2798 	 /* State 82 */ -1 ,
2799 	 /* State 83 */ 21 ,
2800 	 /* State 84 */ 37 ,
2801 	 /* State 85 */ 36 ,
2802 	 /* State 86 */ 35 ,
2803 	 /* State 87 */ 34 ,
2804 	 /* State 88 */ 33 ,
2805 	 /* State 89 */ 32 ,
2806 	 /* State 90 */ 31 ,
2807 	 /* State 91 */ 26 ,
2808 	 /* State 92 */ 3 ,
2809 	 /* State 93 */ 15 ,
2810 	 /* State 94 */ 40 ,
2811 	 /* State 95 */ 39 ,
2812 	 /* State 96 */ 58 ,
2813 	 /* State 97 */ -1 ,
2814 	 /* State 98 */ -1 ,
2815 	 /* State 99 */ 44 ,
2816 	 /* State 100 */ 43 ,
2817 	 /* State 101 */ 48 ,
2818 	 /* State 102 */ 47 ,
2819 	 /* State 103 */ 46 ,
2820 	 /* State 104 */ 63 ,
2821 	 /* State 105 */ -1 ,
2822 	 /* State 106 */ 13 ,
2823 	 /* State 107 */ 66 ,
2824 	 /* State 108 */ -1 ,
2825 	 /* State 109 */ -1 ,
2826 	 /* State 110 */ 67 ,
2827 	 /* State 111 */ -1 ,
2828 	 /* State 112 */ 50 ,
2829 	 /* State 113 */ -1 ,
2830 	 /* State 114 */ 58 ,
2831 	 /* State 115 */ -1 ,
2832 	 /* State 116 */ -1 ,
2833 	 /* State 117 */ -1 ,
2834 	 /* State 118 */ 56 ,
2835 	 /* State 119 */ 55 ,
2836 	 /* State 120 */ -1 ,
2837 	 /* State 121 */ -1 ,
2838 	 /* State 122 */ 8 ,
2839 	 /* State 123 */ 11 ,
2840 	 /* State 124 */ 5 ,
2841 	 /* State 125 */ 17 ,
2842 	 /* State 126 */ 55 ,
2843 	 /* State 127 */ 19 ,
2844 	 /* State 128 */ -1 ,
2845 	 /* State 129 */ 57 ,
2846 	 /* State 130 */ 4 ,
2847 	 /* State 131 */ 12 ,
2848 	 /* State 132 */ -1 ,
2849 	 /* State 133 */ -1 ,
2850 	 /* State 134 */ -1 ,
2851 	 /* State 135 */ 65 ,
2852 	 /* State 136 */ -1 ,
2853 	 /* State 137 */ 20 
2854 );
2855 
2856 
2857 
2858 /* Symbol labels */
2859 var labels = new Array(
2860 	"Program'" /* Non-terminal symbol */,
2861 	"ERROR_RESYNC" /* Terminal symbol */,
2862 	"WHITESPACE" /* Terminal symbol */,
2863 	"IF" /* Terminal symbol */,
2864 	"ELSE" /* Terminal symbol */,
2865 	"WHILE" /* Terminal symbol */,
2866 	"DO" /* Terminal symbol */,
2867 	"FOR" /* Terminal symbol */,
2868 	"FUNCTION" /* Terminal symbol */,
2869 	"USE" /* Terminal symbol */,
2870 	"RETURN" /* Terminal symbol */,
2871 	"DELETE" /* Terminal symbol */,
2872 	"TRUE" /* Terminal symbol */,
2873 	"FALSE" /* Terminal symbol */,
2874 	"<<" /* Terminal symbol */,
2875 	">>" /* Terminal symbol */,
2876 	"[" /* Terminal symbol */,
2877 	"]" /* Terminal symbol */,
2878 	"{" /* Terminal symbol */,
2879 	"}" /* Terminal symbol */,
2880 	";" /* Terminal symbol */,
2881 	"=" /* Terminal symbol */,
2882 	"==" /* Terminal symbol */,
2883 	"!=" /* Terminal symbol */,
2884 	"~=" /* Terminal symbol */,
2885 	"<=" /* Terminal symbol */,
2886 	">=" /* Terminal symbol */,
2887 	">" /* Terminal symbol */,
2888 	"<" /* Terminal symbol */,
2889 	"||" /* Terminal symbol */,
2890 	"&&" /* Terminal symbol */,
2891 	"!" /* Terminal symbol */,
2892 	"+" /* Terminal symbol */,
2893 	"-" /* Terminal symbol */,
2894 	"/" /* Terminal symbol */,
2895 	"%" /* Terminal symbol */,
2896 	"*" /* Terminal symbol */,
2897 	"^" /* Terminal symbol */,
2898 	"(" /* Terminal symbol */,
2899 	")" /* Terminal symbol */,
2900 	"," /* Terminal symbol */,
2901 	"#" /* Terminal symbol */,
2902 	":" /* Terminal symbol */,
2903 	"|" /* Terminal symbol */,
2904 	"." /* Terminal symbol */,
2905 	"Identifier" /* Terminal symbol */,
2906 	"String" /* Terminal symbol */,
2907 	"Integer" /* Terminal symbol */,
2908 	"Float" /* Terminal symbol */,
2909 	"Program" /* Non-terminal symbol */,
2910 	"Stmt" /* Non-terminal symbol */,
2911 	"Stmt_List" /* Non-terminal symbol */,
2912 	"Param_List" /* Non-terminal symbol */,
2913 	"Expression" /* Non-terminal symbol */,
2914 	"Prop_List" /* Non-terminal symbol */,
2915 	"Prop" /* Non-terminal symbol */,
2916 	"Param_Def_List" /* Non-terminal symbol */,
2917 	"Lhs" /* Non-terminal symbol */,
2918 	"Assign" /* Non-terminal symbol */,
2919 	"ExtValue" /* Non-terminal symbol */,
2920 	"AddSubExp" /* Non-terminal symbol */,
2921 	"LogExp" /* Non-terminal symbol */,
2922 	"MulDivExp" /* Non-terminal symbol */,
2923 	"ExpExp" /* Non-terminal symbol */,
2924 	"NegExp" /* Non-terminal symbol */,
2925 	"Value" /* Non-terminal symbol */,
2926 	"$" /* Terminal symbol */
2927 );
2928 
2929 
2930 
2931         if( !err_off ) {
2932             err_off = [];
2933         }
2934         if( !err_la ) {
2935             err_la = [];
2936         }
2937 
2938         sstack.push(0);
2939         vstack.push(0);
2940     
2941         PCB.la = this._lex(PCB);
2942             
2943         while( true ) {
2944             PCB.act = 139;
2945             for( i = 0; i < act_tab[sstack[sstack.length-1]].length; i+=2 ) {
2946                 if( act_tab[sstack[sstack.length-1]][i] == PCB.la ) {
2947                     PCB.act = act_tab[sstack[sstack.length-1]][i+1];
2948                     break;
2949                 }
2950             }
2951         
2952             if( PCB.act == 139 ) {
2953                 if( ( PCB.act = defact_tab[ sstack[sstack.length-1] ] ) < 0 )
2954                     PCB.act = 139;
2955                 else
2956                     PCB.act *= -1;
2957             }
2958 
2959             //Parse error? Try to recover!
2960             if( PCB.act == 139 )
2961             {
2962                 //Report errors only when error_step is 0, and this is not a
2963                 //subsequent error from a previous parse
2964                 if( PCB.error_step == 0 )
2965                 {
2966                     err_cnt++;
2967                     err_off.push( {offset: PCB.offset - PCB.att.length, line: PCB.line} );
2968                     err_la.push([]);
2969                     for( i = 0; i < act_tab[sstack[sstack.length-1]].length; i+=2 )
2970                         err_la[err_la.length-1].push(
2971                                 labels[act_tab[sstack[sstack.length-1]][i]] );
2972                 }
2973             
2974                 //Perform error recovery
2975                 while( sstack.length > 1 && PCB.act == 139 )
2976                 {
2977                     sstack.pop();
2978                     vstack.pop();
2979                 
2980                     //Try to shift on error token
2981                     for( i = 0; i < act_tab[sstack[sstack.length-1]].length; i+=2 )
2982                     {
2983                         if( act_tab[sstack[sstack.length-1]][i] == 1 )
2984                         {
2985                             PCB.act = act_tab[sstack[sstack.length-1]][i+1];
2986                         
2987                             sstack.push( PCB.act );
2988                             vstack.push( '' );
2989                         
2990                             break;
2991                         }
2992                     }
2993                 }
2994             
2995                 //Is it better to leave the parser now?
2996                 if( sstack.length > 1 && PCB.act != 139 )
2997                 {
2998                     //Ok, now try to shift on the next tokens
2999                     while( PCB.la != 66 )
3000                     {
3001                         PCB.act = 139;
3002                     
3003                         for( i = 0; i < act_tab[sstack[sstack.length-1]].length; i+=2 )
3004                         {
3005                             if( act_tab[sstack[sstack.length-1]][i] == PCB.la )
3006                             {
3007                                 PCB.act = act_tab[sstack[sstack.length-1]][i+1];
3008                                 break;
3009                             }
3010                         }
3011                     
3012                         if( PCB.act != 139 )
3013                             break;
3014                         
3015                         while( ( PCB.la = this._lex( PCB ) ) < 0 )
3016                             PCB.offset++;
3017                     }
3018                     while( PCB.la != 66 && PCB.act == 139 ) {}
3019                 }
3020             
3021                 if( PCB.act == 139 || PCB.la == 66 )
3022                 {
3023                     break;
3024                 }
3025 
3026                 //Try to parse the next three tokens successfully...
3027                 PCB.error_step = 3;
3028             }
3029 
3030             //Shift
3031             if( PCB.act > 0 )
3032             {
3033                 sstack.push( PCB.act );
3034                 vstack.push( PCB.att );
3035             
3036                 PCB.la = this._lex( PCB );
3037             
3038                 //Successfull shift and right beyond error recovery?
3039                 if( PCB.error_step > 0 )
3040                     PCB.error_step--;
3041             }
3042             //Reduce
3043             else
3044             {
3045                 act = PCB.act * -1;
3046             
3047                 rval = void( 0 );
3048             
3049 switch( act )
3050 {
3051 	case 0:
3052 	{
3053 		rval = vstack[ vstack.length - 1 ];
3054 	}
3055 	break;
3056 	case 1:
3057 	{
3058 		 this.execute( vstack[ vstack.length - 1 ] ); 
3059 	}
3060 	break;
3061 	case 2:
3062 	{
3063 		rval = vstack[ vstack.length - 0 ];
3064 	}
3065 	break;
3066 	case 3:
3067 	{
3068 		 rval = this.createNode('node_op', 'op_none', vstack[ vstack.length - 2 ], vstack[ vstack.length - 1 ] ); 
3069 	}
3070 	break;
3071 	case 4:
3072 	{
3073 		rval = vstack[ vstack.length - 0 ];
3074 	}
3075 	break;
3076 	case 5:
3077 	{
3078 		 rval = this.createNode('node_op', 'op_param', vstack[ vstack.length - 1 ], vstack[ vstack.length - 3 ] ); 
3079 	}
3080 	break;
3081 	case 6:
3082 	{
3083 		 rval = this.createNode('node_op', 'op_param', vstack[ vstack.length - 1 ]); 
3084 	}
3085 	break;
3086 	case 7:
3087 	{
3088 		rval = vstack[ vstack.length - 0 ];
3089 	}
3090 	break;
3091 	case 8:
3092 	{
3093 		 rval = this.createNode('node_op', 'op_proplst', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3094 	}
3095 	break;
3096 	case 9:
3097 	{
3098 		rval = vstack[ vstack.length - 1 ];
3099 	}
3100 	break;
3101 	case 10:
3102 	{
3103 		rval = vstack[ vstack.length - 0 ];
3104 	}
3105 	break;
3106 	case 11:
3107 	{
3108 		 rval = this.createNode('node_op', 'op_prop', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3109 	}
3110 	break;
3111 	case 12:
3112 	{
3113 		 rval = this.createNode('node_op', 'op_paramdef', vstack[ vstack.length - 1 ], vstack[ vstack.length - 3 ]); 
3114 	}
3115 	break;
3116 	case 13:
3117 	{
3118 		 rval = this.createNode('node_op', 'op_paramdef', vstack[ vstack.length - 1 ]); 
3119 	}
3120 	break;
3121 	case 14:
3122 	{
3123 		rval = vstack[ vstack.length - 0 ];
3124 	}
3125 	break;
3126 	case 15:
3127 	{
3128 		 rval = this.createNode('node_op', 'op_assign', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3129 	}
3130 	break;
3131 	case 16:
3132 	{
3133 		 rval = this.createNode('node_op', 'op_if', vstack[ vstack.length - 2 ], vstack[ vstack.length - 1 ] ); 
3134 	}
3135 	break;
3136 	case 17:
3137 	{
3138 		 rval = this.createNode('node_op', 'op_if_else', vstack[ vstack.length - 4 ], vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3139 	}
3140 	break;
3141 	case 18:
3142 	{
3143 		 rval = this.createNode('node_op', 'op_while', vstack[ vstack.length - 2 ], vstack[ vstack.length - 1 ] ); 
3144 	}
3145 	break;
3146 	case 19:
3147 	{
3148 		 rval = this.createNode('node_op', 'op_do', vstack[ vstack.length - 4 ], vstack[ vstack.length - 2 ] ); 
3149 	}
3150 	break;
3151 	case 20:
3152 	{
3153 		 rval = this.createNode('node_op', 'op_for', vstack[ vstack.length - 7 ], vstack[ vstack.length - 5 ], vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ]); 
3154 	}
3155 	break;
3156 	case 21:
3157 	{
3158 		 rval = this.createNode('node_op', 'op_use', vstack[ vstack.length - 2 ] ); 
3159 	}
3160 	break;
3161 	case 22:
3162 	{
3163 		 rval = this.createNode('node_op', 'op_delete', vstack[ vstack.length - 1 ]); 
3164 	}
3165 	break;
3166 	case 23:
3167 	{
3168 		 rval = this.createNode('node_op', 'op_return', vstack[ vstack.length - 1 ] ); 
3169 	}
3170 	break;
3171 	case 24:
3172 	{
3173 		rval = vstack[ vstack.length - 2 ];
3174 	}
3175 	break;
3176 	case 25:
3177 	{
3178 		 rval = this.createNode('node_op', 'op_noassign', vstack[ vstack.length - 2 ] ); 
3179 	}
3180 	break;
3181 	case 26:
3182 	{
3183 		 rval = vstack[ vstack.length - 2 ]; rval.needsBrackets = true; 
3184 	}
3185 	break;
3186 	case 27:
3187 	{
3188 		 rval = this.createNode('node_op', 'op_none' ); 
3189 	}
3190 	break;
3191 	case 28:
3192 	{
3193 		 rval = this.createNode('node_op', 'op_lhs', vstack[ vstack.length - 1 ], vstack[ vstack.length - 3 ], 'dot'); 
3194 	}
3195 	break;
3196 	case 29:
3197 	{
3198 		 rval = this.createNode('node_op', 'op_lhs', vstack[ vstack.length - 2 ], vstack[ vstack.length - 4 ], 'bracket'); 
3199 	}
3200 	break;
3201 	case 30:
3202 	{
3203 		 rval = this.createNode('node_op', 'op_lhs', vstack[ vstack.length - 1 ]); 
3204 	}
3205 	break;
3206 	case 31:
3207 	{
3208 		 rval = this.createNode('node_op', 'op_equ', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3209 	}
3210 	break;
3211 	case 32:
3212 	{
3213 		 rval = this.createNode('node_op', 'op_lot', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3214 	}
3215 	break;
3216 	case 33:
3217 	{
3218 		 rval = this.createNode('node_op', 'op_grt', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3219 	}
3220 	break;
3221 	case 34:
3222 	{
3223 		 rval = this.createNode('node_op', 'op_loe', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3224 	}
3225 	break;
3226 	case 35:
3227 	{
3228 		 rval = this.createNode('node_op', 'op_gre', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3229 	}
3230 	break;
3231 	case 36:
3232 	{
3233 		 rval = this.createNode('node_op', 'op_neq', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3234 	}
3235 	break;
3236 	case 37:
3237 	{
3238 		 rval = this.createNode('node_op', 'op_approx', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3239 	}
3240 	break;
3241 	case 38:
3242 	{
3243 		rval = vstack[ vstack.length - 1 ];
3244 	}
3245 	break;
3246 	case 39:
3247 	{
3248 		 rval = this.createNode('node_op', 'op_or', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ]); 
3249 	}
3250 	break;
3251 	case 40:
3252 	{
3253 		 rval = this.createNode('node_op', 'op_and', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ]); 
3254 	}
3255 	break;
3256 	case 41:
3257 	{
3258 		 rval = this.createNode('node_op', 'op_not', vstack[ vstack.length - 1 ]); 
3259 	}
3260 	break;
3261 	case 42:
3262 	{
3263 		rval = vstack[ vstack.length - 1 ];
3264 	}
3265 	break;
3266 	case 43:
3267 	{
3268 		 rval = this.createNode('node_op', 'op_sub', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3269 	}
3270 	break;
3271 	case 44:
3272 	{
3273 		 rval = this.createNode('node_op', 'op_add', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3274 	}
3275 	break;
3276 	case 45:
3277 	{
3278 		rval = vstack[ vstack.length - 1 ];
3279 	}
3280 	break;
3281 	case 46:
3282 	{
3283 		 rval = this.createNode('node_op', 'op_mul', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3284 	}
3285 	break;
3286 	case 47:
3287 	{
3288 		 rval = this.createNode('node_op', 'op_div', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3289 	}
3290 	break;
3291 	case 48:
3292 	{
3293 		 rval = this.createNode('node_op', 'op_mod', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3294 	}
3295 	break;
3296 	case 49:
3297 	{
3298 		rval = vstack[ vstack.length - 1 ];
3299 	}
3300 	break;
3301 	case 50:
3302 	{
3303 		 rval = this.createNode('node_op', 'op_exp', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ] ); 
3304 	}
3305 	break;
3306 	case 51:
3307 	{
3308 		rval = vstack[ vstack.length - 1 ];
3309 	}
3310 	break;
3311 	case 52:
3312 	{
3313 		 rval = this.createNode('node_op', 'op_neg', vstack[ vstack.length - 1 ] ); 
3314 	}
3315 	break;
3316 	case 53:
3317 	{
3318 		 rval = vstack[ vstack.length - 1 ]; 
3319 	}
3320 	break;
3321 	case 54:
3322 	{
3323 		rval = vstack[ vstack.length - 1 ];
3324 	}
3325 	break;
3326 	case 55:
3327 	{
3328 		 rval = this.createNode('node_op', 'op_extvalue', vstack[ vstack.length - 4 ], vstack[ vstack.length - 2 ]); 
3329 	}
3330 	break;
3331 	case 56:
3332 	{
3333 		 rval = this.createNode('node_op', 'op_execfun', vstack[ vstack.length - 4 ], vstack[ vstack.length - 2 ]); 
3334 	}
3335 	break;
3336 	case 57:
3337 	{
3338 		 rval = this.createNode('node_op', 'op_execfun', vstack[ vstack.length - 5 ], vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ]); 
3339 	}
3340 	break;
3341 	case 58:
3342 	{
3343 		 rval = this.createNode('node_op', 'op_property', vstack[ vstack.length - 3 ], vstack[ vstack.length - 1 ]); 
3344 	}
3345 	break;
3346 	case 59:
3347 	{
3348 		rval = vstack[ vstack.length - 1 ];
3349 	}
3350 	break;
3351 	case 60:
3352 	{
3353 		 rval = this.createNode('node_const', vstack[ vstack.length - 1 ] ); 
3354 	}
3355 	break;
3356 	case 61:
3357 	{
3358 		 rval = this.createNode('node_const', vstack[ vstack.length - 1 ] ); 
3359 	}
3360 	break;
3361 	case 62:
3362 	{
3363 		 rval = this.createNode('node_var', vstack[ vstack.length - 1 ] ); 
3364 	}
3365 	break;
3366 	case 63:
3367 	{
3368 		 rval = vstack[ vstack.length - 2 ]; 
3369 	}
3370 	break;
3371 	case 64:
3372 	{
3373 		 rval = this.createNode('node_str', vstack[ vstack.length - 1 ]); 
3374 	}
3375 	break;
3376 	case 65:
3377 	{
3378 		 rval = this.createNode('node_op', 'op_function', vstack[ vstack.length - 5 ], vstack[ vstack.length - 2 ]); 
3379 	}
3380 	break;
3381 	case 66:
3382 	{
3383 		 rval = this.createNode('node_op', 'op_proplst_val', vstack[ vstack.length - 2 ]); 
3384 	}
3385 	break;
3386 	case 67:
3387 	{
3388 		 rval = this.createNode('node_op', 'op_array', vstack[ vstack.length - 2 ]); 
3389 	}
3390 	break;
3391 	case 68:
3392 	{
3393 		 rval = this.createNode('node_const_bool', vstack[ vstack.length - 1 ] ); 
3394 	}
3395 	break;
3396 	case 69:
3397 	{
3398 		 rval = this.createNode('node_const_bool', vstack[ vstack.length - 1 ] ); 
3399 	}
3400 	break;
3401 }
3402 
3403 
3404             
3405                 for( i = 0; i < pop_tab[act][1]; i++ )
3406                 {
3407                     sstack.pop();
3408                     vstack.pop();
3409                 }
3410 
3411                 //Get goto-table entry
3412                 PCB.act = 139;
3413                 for( i = 0; i < goto_tab[sstack[sstack.length-1]].length; i+=2 )
3414                 {
3415                     if( goto_tab[sstack[sstack.length-1]][i] == pop_tab[act][0] )
3416                     {
3417                         PCB.act = goto_tab[sstack[sstack.length-1]][i+1];
3418                         break;
3419                     }
3420                 }
3421             
3422                 //Goal symbol match?
3423                 if( act == 0 ) //Don't use PCB.act here!
3424                     break;
3425                 
3426                 //...and push it!
3427                 sstack.push( PCB.act );
3428                 vstack.push( rval );
3429             }
3430         }
3431 
3432         return err_cnt;
3433     }
3434 
3435 });
3436 
3437 
3438 
3439 
3440