r94459 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:< r94458‎ | r94459 | r94460 >
Date:14:12, 14 August 2011
Author:vasilievvv
Status:deferred
Tags:
Comment:
Dramatic update for InlineScripts:
* They are no longer inline! Introduce:
** Module namespace with GeSHi highlighting
** Modules contain functions
** Wikitext has {{i:module|function|arg1|...|argN}} construction to call those functions
** Functions may use return, append and yield instructions to return values
* Change + operator behavior for lists and associated arrays
* Add single-line comments
* Dramatically reorganize file structure
* Different cleanup and code file headers
* Split out user exceptions and control exceptions
* Store LR table version in a seperate file so we can load it to check cache without loading the whole thing
Modified paths:
  • /trunk/extensions/InlineScripts/Hooks.php (added) (history)
  • /trunk/extensions/InlineScripts/InlineScripts.i18n.php (deleted) (history)
  • /trunk/extensions/InlineScripts/InlineScripts.php (modified) (history)
  • /trunk/extensions/InlineScripts/LinksUpdate.php (added) (history)
  • /trunk/extensions/InlineScripts/geshi (added) (history)
  • /trunk/extensions/InlineScripts/geshi/wikiscript.php (added) (history)
  • /trunk/extensions/InlineScripts/i18n (added) (history)
  • /trunk/extensions/InlineScripts/i18n/Magic.php (added) (history)
  • /trunk/extensions/InlineScripts/i18n/Messages.php (added) (history)
  • /trunk/extensions/InlineScripts/i18n/Namespaces.php (added) (history)
  • /trunk/extensions/InlineScripts/inlinescripts.sql (added) (history)
  • /trunk/extensions/InlineScripts/interpreter/CallStack.php (added) (history)
  • /trunk/extensions/InlineScripts/interpreter/Data.php (modified) (history)
  • /trunk/extensions/InlineScripts/interpreter/EvaluationContext.php (added) (history)
  • /trunk/extensions/InlineScripts/interpreter/Interpreter.php (modified) (history)
  • /trunk/extensions/InlineScripts/interpreter/LRParser.php (modified) (history)
  • /trunk/extensions/InlineScripts/interpreter/LRTable.php (modified) (history)
  • /trunk/extensions/InlineScripts/interpreter/LRTableVersion.php (added) (history)
  • /trunk/extensions/InlineScripts/interpreter/Scanner.php (modified) (history)
  • /trunk/extensions/InlineScripts/interpreter/Shared.php (modified) (history)
  • /trunk/extensions/InlineScripts/interpreter/buildLRTables.php (modified) (history)
  • /trunk/extensions/InlineScripts/interpreter/syntax.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/InlineScripts/InlineScripts.i18n.php
——@@ -1,42 +0,0 @@
2 -<?php
3 -/**
4 - * Internationalisation file for extension InlineScripts.
5 - *
6 - * @file
7 - * @ingroup Extensions
8 - */
9 -
10 -$messages = array();
11 -
12 -/** English
13 - * @author Victor Vasiliev
14 - */
15 -$messages['en'] = array(
16 - 'inlinescriprs-desc' => 'Provides a build into wikitext scripting language',
17 -
18 - 'inlinescripts-exception-unexceptedtoken' => 'Unexpected token $1 at line $2: expected $3',
19 - 'inlinescripts-exception-unclosedstring' => 'Unclosed string at char $1',
20 - 'inlinescripts-exception-unrecognisedtoken' => 'Unrecognized token at char $1',
21 - 'inlinescripts-exception-toomanytokens' => 'Exceeded tokens limit',
22 - 'inlinescripts-exception-toomanyevals' => 'Exceeded evaluations limit',
23 - 'inlinescripts-exception-recoverflow' => 'Too deep abstract syntax tree',
24 - 'inlinescripts-exception-notanarray' => 'Tried to get or set an element of a non-array at line $1',
25 - 'inlinescripts-exception-outofbounds' => 'Got out of array bounds at line $1',
26 - 'inlinescripts-exception-notenoughargs' => 'Not enough arguments for function at line $1',
27 - 'inlinescripts-exception-dividebyzero' => 'Division by zero at line $1',
28 - 'inlinescripts-exception-break' => '"break" called outside of foreach at line $1',
29 - 'inlinescripts-exception-continue' => '"continue" called outside of foreach at line $1',
30 - 'inlinescripts-exception-emptyidx' => 'Trying to get a value of an empty index at line $1',
31 - 'inlinescripts-exception-unknownvar' => 'Trying to use an undeclared variable at line $1',
32 - 'inlinescripts-exception-unknownfunction' => 'Trying to use an unnknown function at line $1',
33 - 'inlinescripts-exception-notlist' => 'Trying to append an element to the end of \'\'associated\'\' array at line $1',
34 -);
35 -
36 -// == Magic words ==
37 -
38 -$magicWords = array();
39 -
40 -$magicWords['en'] = array(
41 - 'script' => array( 0, 'script' ),
42 - 'inline' => array( 0, 'inline' ),
43 -);
Index: trunk/extensions/InlineScripts/geshi/wikiscript.php
——@@ -0,0 +1,98 @@
 2+<?php
 3+/*************************************************************************************
 4+ * wikiscripts.php
 5+ * --------------
 6+ * Author: Victor Vasiliev (vasilvv@gmail.com)
 7+ * Copyright: (c) 2011 Victor Vasiliev (vasilvv@gmail.com)
 8+ * Release Version: 1.0
 9+ * Date Started: 2011/08/11
 10+ *
 11+ * WikiScripts language file for GeSHi.
 12+ *
 13+ *************************************************************************************
 14+ *
 15+ * This file is part of GeSHi and MediaWiki.
 16+ *
 17+ * GeSHi is free software; you can redistribute it and/or modify
 18+ * it under the terms of the GNU General Public License as published by
 19+ * the Free Software Foundation; either version 2 of the License, or
 20+ * (at your option) any later version.
 21+ *
 22+ * GeSHi is distributed in the hope that it will be useful,
 23+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 24+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 25+ * GNU General Public License for more details.
 26+ *
 27+ * You should have received a copy of the GNU General Public License
 28+ * along with GeSHi; if not, write to the Free Software
 29+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 30+ *
 31+ ************************************************************************************/
 32+
 33+$language_data = array (
 34+ 'LANG_NAME' => 'WikiScripts',
 35+ 'COMMENT_SINGLE' => array(1 => '//'),
 36+ 'COMMENT_MULTI' => array('/*' => '*/'),
 37+ 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
 38+ 'QUOTEMARKS' => array("'", '"'),
 39+ 'ESCAPE_CHAR' => '\\',
 40+ 'KEYWORDS' => array(
 41+ 1 => array(
 42+ 'append', 'break', 'catch', 'contains', 'continue', 'delete', 'else', 'false', 'for',
 43+ 'function', 'if', 'in', 'isset', 'null', 'return', 'self', 'then', 'true', 'try', 'yield',
 44+ ),
 45+ ),
 46+ 'SYMBOLS' => array(
 47+ '(', ')', '[', ']', '{', '}',
 48+ '+', '-', '*', '/',
 49+ '!', '&', '|', '^',
 50+ '<', '>', '=',
 51+ ',', ';', '?', ':', '::',
 52+ ),
 53+ 'CASE_SENSITIVE' => array(
 54+ GESHI_COMMENTS => false,
 55+ 1 => true,
 56+ ),
 57+ 'STYLES' => array(
 58+ 'KEYWORDS' => array(
 59+ 1 => 'color: #000066; font-weight: bold;',
 60+ ),
 61+ 'COMMENTS' => array(
 62+ 1 => 'color: #006600; font-style: italic;',
 63+ 2 => 'color: #009966; font-style: italic;',
 64+ 'MULTI' => 'color: #006600; font-style: italic;'
 65+ ),
 66+ 'ESCAPE_CHAR' => array(
 67+ 0 => 'color: #000099; font-weight: bold;'
 68+ ),
 69+ 'BRACKETS' => array(
 70+ 0 => 'color: #009900;'
 71+ ),
 72+ 'STRINGS' => array(
 73+ 0 => 'color: #3366CC;'
 74+ ),
 75+ 'NUMBERS' => array(
 76+ 0 => 'color: #CC0000;'
 77+ ),
 78+ 'METHODS' => array(
 79+ 1 => 'color: #660066;'
 80+ ),
 81+ 'SYMBOLS' => array(
 82+ 0 => 'color: #339933;'
 83+ ),
 84+ 'REGEXPS' => array(
 85+ ),
 86+ 'SCRIPT' => array(
 87+ 0 => '',
 88+ )
 89+ ),
 90+ 'URLS' => array(
 91+ 1 => '',
 92+ ),
 93+ 'OOLANG' => false,
 94+ 'REGEXPS' => array(
 95+ ),
 96+ 'STRICT_MODE_APPLIES' => GESHI_NEVER,
 97+ 'SCRIPT_DELIMITERS' => array(),
 98+ 'HIGHLIGHT_STRICT_BLOCK' => array(),
 99+);
Index: trunk/extensions/InlineScripts/i18n/Namespaces.php
——@@ -0,0 +1,8 @@
 2+<?php
 3+
 4+$namespaceNames = array();
 5+
 6+$namespaceNames['en'] = array(
 7+ NS_MODULE => 'Module',
 8+ NS_MODULE_TALK => 'Module_talk',
 9+);
Index: trunk/extensions/InlineScripts/i18n/Magic.php
——@@ -0,0 +1,7 @@
 2+<?php
 3+
 4+$magicWords = array();
 5+
 6+$magicWords['en'] = array(
 7+ 'i' => array( 0, 'i' ),
 8+);
Index: trunk/extensions/InlineScripts/i18n/Messages.php
——@@ -0,0 +1,51 @@
 2+<?php
 3+/**
 4+ * Internationalisation file for extension InlineScripts.
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+
 12+/** English
 13+ * @author Victor Vasiliev
 14+ */
 15+$messages['en'] = array(
 16+ 'inlinescripts-desc' => 'Provides a build into wikitext scripting language',
 17+
 18+ 'inlinescripts-call-frommodule' => '$1::$2 called by $3::$4 at line $5',
 19+ 'inlinescripts-call-fromwikitext' => '$1::$2 called by wikitext',
 20+ 'inlinescripts-call-parse' => 'parse( "$1" )',
 21+
 22+ 'inlinescripts-codelocation' => 'in module $1 at line $2',
 23+
 24+ 'inlinescripts-exception-unexceptedtoken' => 'Unexpected token $2 $1: expected $3 (parser state $4)',
 25+ 'inlinescripts-exception-unclosedstring' => 'Unclosed string in module $1 at char $2',
 26+ 'inlinescripts-exception-unrecognisedtoken' => 'Unrecognized token in module $1 at char $2',
 27+ 'inlinescripts-exception-toomanytokens' => 'Exceeded tokens limit',
 28+ 'inlinescripts-exception-toomanyevals' => 'Exceeded evaluations limit $1',
 29+ 'inlinescripts-exception-recoverflow' => 'Too deep abstract syntax tree',
 30+ 'inlinescripts-exception-notanarray' => 'Tried to get or set an element of a non-array $1',
 31+ 'inlinescripts-exception-outofbounds' => 'Got out of array bounds $1',
 32+ 'inlinescripts-exception-notenoughargs' => 'Not enough arguments for function $1',
 33+ 'inlinescripts-exception-dividebyzero' => 'Division by zero $1',
 34+ 'inlinescripts-exception-break' => '"break" called outside of foreach $1',
 35+ 'inlinescripts-exception-continue' => '"continue" called outside of foreach $1',
 36+ 'inlinescripts-exception-emptyidx' => 'Trying to get a value of an empty index $1',
 37+ 'inlinescripts-exception-unknownvar' => 'Trying to use an undeclared variable $1',
 38+ 'inlinescripts-exception-unknownfunction' => 'Trying to use an unnknown function $2 $1',
 39+ 'inlinescripts-exception-notlist' => 'Trying to append an element to the end of \'\'associated\'\' array $1',
 40+ 'inlinescripts-exception-appendyield' => 'Trying to use append and yield in the same function $1',
 41+
 42+ 'inlinescripts-exception-notenoughargs-user' => 'Not enough arguments for function $2::$3 $1',
 43+ 'inlinescripts-exception-nonexistent-module' => 'Call to non-existent module $2 $1',
 44+ 'inlinescripts-exception-unknownfunction-user' => 'Trying to use an unnknown user function $2::$3 $1',
 45+ 'inlinescripts-exception-recursion' => 'Function loop detected when calling function $2::$3 $1',
 46+
 47+ 'inlinescripts-transerror-notenoughargs-user' => 'Not enough arguments for function $1::$2',
 48+ 'inlinescripts-transerror-nonexistent-module' => 'Call to non-existent module $1',
 49+ 'inlinescripts-transerror-unknownfunction-user' => 'Trying to use an unnknown user function $1::$2',
 50+ 'inlinescripts-transerror-recursion' => 'Function loop detected when calling function $1::$2',
 51+ 'inlinescripts-transerror-nofunction' => 'Missing function name when invoking the script',
 52+);
Property changes on: trunk/extensions/InlineScripts/i18n/Messages.php
___________________________________________________________________
Added: svn:executable
153 + *
Index: trunk/extensions/InlineScripts/interpreter/Data.php
——@@ -1,5 +1,29 @@
22 <?php
 3+/**
 4+ * Built-in scripting language for MediaWiki: data.
 5+ * Based on the AbuseFilter AFData.
 6+ * Copyright (C) 2008-2011 Victor Vasiliev <vasilvv@gmail.com>, Andrew Garrett <andrew@epstone.net>
 7+ * http://www.mediawiki.org/
 8+ *
 9+ * This program is free software; you can redistribute it and/or modify
 10+ * it under the terms of the GNU General Public License as published by
 11+ * the Free Software Foundation; either version 2 of the License, or
 12+ * (at your option) any later version.
 13+ *
 14+ * This program is distributed in the hope that it will be useful,
 15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 17+ * GNU General Public License for more details.
 18+ *
 19+ * You should have received a copy of the GNU General Public License along
 20+ * with this program; if not, write to the Free Software Foundation, Inc.,
 21+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 22+ * http://www.gnu.org/copyleft/gpl.html
 23+ */
324
 25+if( !defined( 'MEDIAWIKI' ) )
 26+ die();
 27+
428 /**
529 * Class implementing data in the scripts.
630 */
——@@ -155,7 +179,7 @@
156180 throw new ISException( "Invalid comparison operation: {$op}" ); // Should never happen
157181 }
158182
159 - public static function mulRel( $a, $b, $op, $pos ) {
 183+ public static function mulRel( $a, $b, $op, $module, $pos ) {
160184 // Figure out the type.
161185 if( ( $a->type == self::DFloat || $b->type == self::DFloat ) &&
162186 $op != '/' ) {
——@@ -169,7 +193,7 @@
170194 }
171195
172196 if( $op != '*' && $b == 0 ) {
173 - throw new ISUserVisibleException( 'dividebyzero', $pos, array($a) );
 197+ throw new ISUserVisibleException( 'dividebyzero', $module, $pos, array($a) );
174198 }
175199
176200 $data = null;
——@@ -195,12 +219,16 @@
196220 return new ISData( self::DString, $a->toString() . $b->toString() );
197221 elseif( $a->type == self::DList && $b->type == self::DList )
198222 return new ISData( self::DList, array_merge( $a->toList(), $b->toList() ) );
 223+ elseif( $a->type == self::DList )
 224+ return new ISData( self::DList, array_merge( $a->toList(), array( $b ) ) );
 225+ elseif( $a->type == self::DAssoc && $b->type == self::DAssoc )
 226+ return new ISData( self::DAssoc, array_merge( $a->toAssoc(), $b->toAssoc() ) );
199227 elseif( $a->type == self::DInt && $b->type == self::DInt )
200228 return new ISData( self::DInt, $a->toInt() + $b->toInt() );
201229 else
202230 return new ISData( self::DFloat, $a->toFloat() + $b->toFloat() );
203231 }
204 -
 232+
205233 public static function sub( $a, $b ) {
206234 if( $a->type == self::DInt && $b->type == self::DInt )
207235 return new ISData( self::DInt, $a->toInt() - $b->toInt() );
Index: trunk/extensions/InlineScripts/interpreter/Scanner.php
——@@ -1,5 +1,29 @@
22 <?php
 3+/**
 4+ * Built-in scripting language for MediaWiki: scanner.
 5+ * Based on the AbuseFilter scanner.
 6+ * Copyright (C) 2008-2011 Victor Vasiliev <vasilvv@gmail.com>, Andrew Garrett <andrew@epstone.net>
 7+ * http://www.mediawiki.org/
 8+ *
 9+ * This program is free software; you can redistribute it and/or modify
 10+ * it under the terms of the GNU General Public License as published by
 11+ * the Free Software Foundation; either version 2 of the License, or
 12+ * (at your option) any later version.
 13+ *
 14+ * This program is distributed in the hope that it will be useful,
 15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 17+ * GNU General Public License for more details.
 18+ *
 19+ * You should have received a copy of the GNU General Public License along
 20+ * with this program; if not, write to the Free Software Foundation, Inc.,
 21+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 22+ * http://www.gnu.org/copyleft/gpl.html
 23+ */
324
 25+if( !defined( 'MEDIAWIKI' ) )
 26+ die();
 27+
428 /**
529 * Lexical analizator for inline scripts. Splits strings to tokens.
630 */
——@@ -7,7 +31,7 @@
832 require_once( 'Shared.php' );
933
1034 class ISScanner implements Iterator {
11 - var $mCode, $mPos, $mCur, $mEof;
 35+ var $mModule, $mCode, $mPos, $mCur, $mEof;
1236
1337 // Order is important. The punctuation-matching regex requires that
1438 // ** comes before *, etc. They are sorted to make it easy to spot
——@@ -19,7 +43,7 @@
2044 '**', '*', // Multiplication/exponentiation
2145 '/', '+', '-', '%', // Other arithmetic
2246 '&', '|', '^', // Logic
23 - '?', ':', // Ternery
 47+ '?', '::', ':', // Ternery
2448 '<=','<', // Less than
2549 '>=', '>', // Greater than
2650 '===', '==', '=', // Equality
——@@ -29,12 +53,12 @@
3054 );
3155
3256 static $mKeywords = array(
33 - 'in', 'true', 'false', 'null', 'contains', 'break',
34 - 'if', 'then', 'else', 'for', 'do', 'try', 'catch',
35 - 'continue', 'isset', 'delete',
 57+ 'append', 'break', 'catch', 'contains', 'continue', 'delete', 'else', 'false', 'for',
 58+ 'function', 'if', 'in', 'isset', 'null', 'return', 'self', 'then', 'true', 'try', 'yield',
3659 );
3760
38 - public function __construct( $code ) {
 61+ public function __construct( $module, $code ) {
 62+ $this->mModule = $module;
3963 $this->mCode = $code;
4064 $this->rewind();
4165 }
——@@ -90,6 +114,16 @@
91115 return self::nextToken();
92116 }
93117
 118+ if( substr( $this->mCode, $this->mPos, 2 ) == '//' ) {
 119+ $newlinePos = strpos( $this->mCode, "\n", $this->mPos );
 120+ if( $newlinePos === false ) {
 121+ return array( null, ISToken::TEnd );
 122+ } else {
 123+ $this->mPos = $newlinePos + 1;
 124+ return self::nextToken();
 125+ }
 126+ }
 127+
94128 // Strings
95129 if( $this->mCode[$this->mPos] == '"' || $this->mCode[$this->mPos] == "'" ) {
96130 $type = $this->mCode[$this->mPos];
——@@ -144,7 +178,7 @@
145179 $this->mPos++;
146180 }
147181 }
148 - throw new ISUserVisibleException( 'unclosedstring', $this->mPos, array() );
 182+ throw new ISUserVisibleException( 'unclosedstring', $this->mModule, $this->mPos, array() );
149183 }
150184
151185 // Find operators
——@@ -231,7 +265,7 @@
232266 $matches = array();
233267
234268 if ( preg_match( $idSymbolRegex, $this->mCode, $matches, 0, $this->mPos ) ) {
235 - $tok = strtolower( $matches[0] );
 269+ $tok = $matches[0];
236270
237271 $type = in_array( $tok, self::$mKeywords )
238272 ? $tok : ISToken::TID;
——@@ -241,11 +275,13 @@
242276 }
243277
244278 throw new ISUserVisibleException(
245 - 'unrecognisedtoken', $this->mPos, array( substr( $this->mCode, $this->mPos ) ) );
 279+ 'unrecognisedtoken', $this->mModule, $this->mPos, array( substr( $this->mCode, $this->mPos ) ) );
246280 }
247281
248282 private static function getOperatorType( $op ) {
249283 switch( $op ) {
 284+ case '::':
 285+ return ISToken::TDoubleColon;
250286 case ':':
251287 return ISToken::TColon;
252288 case ',':
Index: trunk/extensions/InlineScripts/interpreter/LRParser.php
——@@ -8,30 +8,32 @@
99 * See http://en.wikipedia.org/wiki/LR_parser for details of how does that works.
1010 */
1111
 12+require_once( 'LRTableVersion.php' );
 13+
1214 class ISLRParser implements ISParser {
1315 const Shift = 0;
1416 const Reduce = 1;
1517 const Accept = 2;
1618
17 - var $mNonterminals, $mProductions, $mAction, $mGoto;
 19+ var $mLoaded, $mNonterminals, $mProductions, $mAction, $mGoto;
1820
1921 public static function getVersion() {
20 - return ISLRTable::Timestamp;
 22+ return IS_LR_VERSION;
2123 }
2224
23 - public function __construct() {
24 - $this->loadGrammar();
25 - }
26 -
2725 private function loadGrammar() {
2826 wfProfileIn( __METHOD__ );
29 -
 27+
 28+ if( $this->mLoaded )
 29+ return;
 30+
3031 require_once( 'LRTable.php' );
3132
3233 $this->mNonterminals = ISLRTable::$nonterminals;
3334 $this->mProductions = ISLRTable::$productions;
3435 $this->mAction = ISLRTable::$action;
3536 $this->mGoto = ISLRTable::$goto;
 37+ $this->mLoaded = true;
3638
3739 wfProfileOut( __METHOD__ );
3840 }
——@@ -40,7 +42,9 @@
4143 return true;
4244 }
4345
44 - public function parse( $scanner, $maxTokens ) {
 46+ public function parse( $scanner, $module, $maxTokens ) {
 47+ $this->loadGrammar();
 48+
4549 $states = array( array( null, 0 ) );
4650 $scanner->rewind();
4751 $tokenCount = 0;
——@@ -58,15 +62,15 @@
5963 $tokenCount++;
6064 if( $tokenCount > $maxTokens ) {
6165 wfProfileOut( __METHOD__ );
62 - throw new ISUserVisibleException( 'toomanytokens', $token->line );
 66+ throw new ISUserVisibleException( 'toomanytokens', $module, $token->line );
6367 }
6468
6569 list( $stateval, $state ) = end( $states );
6670 $act = @$this->mAction[$state][$cur];
6771 if( !$act ) {
6872 wfProfileOut( __METHOD__ );
69 - throw new ISUserVisibleException( 'unexceptedtoken', $token->line,
70 - array( $token, implode( ', ', array_keys( @$this->mAction[$state] ) ) ) );
 73+ throw new ISUserVisibleException( 'unexceptedtoken', $module, $token->line,
 74+ array( $token, implode( ', ', array_keys( @$this->mAction[$state] ) ), $state ) );
7175 }
7276 if( $act[0] == self::Shift ) {
7377 $states[] = array( $token, $act[1] );
Index: trunk/extensions/InlineScripts/interpreter/LRTableVersion.php
——@@ -0,0 +1,9 @@
 2+<?php
 3+
 4+/**
 5+ * This file includes timestamp which indicates the version of LRTable.php file.
 6+ * Since the file is too large, loading it every time is expensive and we store the
 7+ * version in separate file.
 8+ */
 9+
 10+define( 'IS_LR_VERSION', "2011-08-13 21:53:42" );
Index: trunk/extensions/InlineScripts/interpreter/EvaluationContext.php
——@@ -0,0 +1,764 @@
 2+<?php
 3+/**
 4+ * Built-in scripting language for MediaWiki.
 5+ * Copyright (C) 2009-2011 Victor Vasiliev <vasilvv@gmail.com>
 6+ * http://www.mediawiki.org/
 7+ *
 8+ * This program is free software; you can redistribute it and/or modify
 9+ * it under the terms of the GNU General Public License as published by
 10+ * the Free Software Foundation; either version 2 of the License, or
 11+ * (at your option) any later version.
 12+ *
 13+ * This program is distributed in the hope that it will be useful,
 14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 16+ * GNU General Public License for more details.
 17+ *
 18+ * You should have received a copy of the GNU General Public License along
 19+ * with this program; if not, write to the Free Software Foundation, Inc.,
 20+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 21+ * http://www.gnu.org/copyleft/gpl.html
 22+ */
 23+
 24+if( !defined( 'MEDIAWIKI' ) )
 25+ die();
 26+
 27+/**
 28+ * An internal class used by InlineScript. Used to evaluate a parsed code
 29+ * in a sepereate context with its own output, variables and parser frame.
 30+ *
 31+ * Handles evaluation of an individual functions.
 32+ */
 33+class ISEvaluationContext {
 34+ var $mVars, $mFrame, $mName, $mInterpreter, $mModule;
 35+
 36+ var $mOutput, $mListOutput;
 37+
 38+ static $mFunctions = array(
 39+ /* String functions */
 40+ 'lc' => 'funcLc',
 41+ 'uc' => 'funcUc',
 42+ 'ucfirst' => 'funcUcFirst',
 43+ 'urlencode' => 'funcUrlencode',
 44+ 'grammar' => 'funcGrammar',
 45+ 'plural' => 'funcPlural',
 46+ 'anchorencode' => 'funcAnchorEncode',
 47+ 'strlen' => 'funcStrlen',
 48+ 'substr' => 'funcSubstr',
 49+ 'strreplace' => 'funcStrreplace',
 50+ 'split' => 'funcSplit',
 51+
 52+ /* Array functions */
 53+ 'join' => 'funcJoin',
 54+ 'count' => 'funcCount',
 55+
 56+ /* Parser interaction functions */
 57+ 'arg' => 'funcArg',
 58+ 'args' => 'funcArgs',
 59+ 'isTranscluded' => 'funcIsTranscluded',
 60+ 'parse' => 'funcParse',
 61+
 62+ /* Cast functions */
 63+ 'string' => 'castString',
 64+ 'int' => 'castInt',
 65+ 'float' => 'castFloat',
 66+ 'bool' => 'castBool',
 67+ );
 68+
 69+ public function __construct( $interpreter, $module, $name, $frame ) {
 70+ $this->mVars = array();
 71+ $this->mOut = '';
 72+ $this->mModule = $module;
 73+ $this->mModuleName = $module->getName();
 74+ $this->mName = $name;
 75+ $this->mInterpreter = $interpreter;
 76+ $this->mParser = $interpreter->getParser();
 77+ $this->mFrame = $frame;
 78+
 79+ $this->mOutput = new ISData();
 80+ $this->mListOutput = array();
 81+ }
 82+
 83+ public function getModule() {
 84+ return $this->mModule;
 85+ }
 86+
 87+ public function getFrame() {
 88+ return $this->mFrame;
 89+ }
 90+
 91+ public function getOutput() {
 92+ if( $this->mOutput->type != ISData::DNull ) {
 93+ return $this->mOutput;
 94+ } elseif( $this->mListOutput ) {
 95+ return new ISData( ISData::DList, $this->mListOutput );
 96+ } else {
 97+ return new ISData();
 98+ }
 99+ }
 100+
 101+ public function setArgument( $name, $value ) {
 102+ $this->mVars[$name] = $value->dup();
 103+ }
 104+
 105+ /**
 106+ * The core interpreter method. Evaluates a single AST node.
 107+ * The $rec parameter must be increated by 1 each time the function is called
 108+ * recursively.
 109+ */
 110+ public function evaluateNode( $node, $rec ) {
 111+ if( !$node instanceof ISParserTreeNode ) {
 112+ throw new ISException( 'evaluateNode() accepts only nonterminals' );
 113+ }
 114+
 115+ if( !$this->mInterpreter->checkRecursionLimit( $rec ) ) {
 116+ throw new ISUserVisibleException( 'recoverflow', $this->mModuleName, $this->getLine( $node ) );
 117+ }
 118+
 119+ $c = $node->getChildren();
 120+ switch( $node->getType() ) {
 121+ case 'stmts':
 122+ $stmts = array();
 123+ while( isset( $c[1] ) ) {
 124+ array_unshift( $stmts, $c[1] );
 125+ $c = $c[0]->getChildren();
 126+ }
 127+ array_unshift( $stmts, $c[0] );
 128+ foreach( $stmts as $stmt )
 129+ $res = $this->evaluateNode( $stmt, $rec + 1 );
 130+ return $res;
 131+ case 'stmt':
 132+ if( $c[0] instanceof ISToken ) {
 133+ switch( $c[0]->type ) {
 134+ case 'leftcurly':
 135+ return $this->evaluateNode( $c[1], $rec + 1 );
 136+ case 'if':
 137+ $cond = $this->evaluateNode( $c[2], $rec + 1 );
 138+ if( $cond->toBool() ) {
 139+ return $this->evaluateNode( $c[4], $rec + 1 );
 140+ } else {
 141+ if( isset( $c[6] ) ) {
 142+ return $this->evaluateNode( $c[6], $rec + 1 );
 143+ } else {
 144+ return new ISData();
 145+ }
 146+ }
 147+ case 'for':
 148+ $array = $this->evaluateNode( $c[4], $rec + 1 );
 149+ if( !$array->isArray() )
 150+ throw new ISUserVisibleException( 'invalidforeach', $this->mModuleName, $c[0]->line );
 151+ $last = new ISData();
 152+ $lvalues = $c[2]->getChildren();
 153+
 154+ foreach( $array->data as $key => $item ) {
 155+ // <forlvalue> ::= <lvalue> | <lvalue> colon <lvalue>
 156+ if( count( $lvalues ) > 1 ) {
 157+ $this->setVar( $lvalues[0], ISData::newFromPHPVar( $key ), $rec );
 158+ $this->setVar( $lvalues[2], $item, $rec );
 159+ } else {
 160+ $this->setVar( $lvalues[0], $item, $rec );
 161+ }
 162+ try {
 163+ $last = $this->evaluateNode( $c[6], $rec + 1 );
 164+ } catch( ISUserVisibleException $e ) {
 165+ if( $e->getExceptionID() == 'break' )
 166+ break;
 167+ elseif( $e->getExceptionID() == 'continue' )
 168+ continue;
 169+ else
 170+ throw $e;
 171+ }
 172+ }
 173+ return $last;
 174+ case 'try':
 175+ try {
 176+ return $this->evaluateNode( $c[1], $rec + 1 );
 177+ } catch( ISUserVisibleException $e ) {
 178+ if( $e instanceof ISControlException ) {
 179+ throw $e;
 180+ } else {
 181+ $this->setVar( $c[4], new ISData( ISData::DString, $e->getExceptionID() ), $rec );
 182+ return $this->evaluateNode( $c[6], $rec + 1 );
 183+ }
 184+ }
 185+ default:
 186+ throw new ISException( "Unknown keyword: {$c[0]->type}" );
 187+ }
 188+ } else {
 189+ return $this->evaluateNode( $c[0], $rec + 1 );
 190+ }
 191+ case 'exprreturn':
 192+ switch( $c[0]->value ) {
 193+ case 'return':
 194+ if( isset( $c[1] ) ) {
 195+ $retval = $this->evaluateNode( $c[1], $rec + 1 );
 196+ $empty = false;
 197+ } else {
 198+ $retval = new ISData();
 199+ $empty = true;
 200+ }
 201+ throw new ISReturnException( $retval, $empty );
 202+ case 'append':
 203+ if( $this->mListOutput ) {
 204+ throw new ISUserVisibleException( 'appendyield', $this->mModuleName, $c[0]->line );
 205+ }
 206+
 207+ $this->mOutput = ISData::sum( $this->mOutput, $this->evaluateNode( $c[1], $rec + 1 ) );
 208+ break 2;
 209+ case 'yield':
 210+ if( $this->mOutput->type != ISData::DNull ) {
 211+ throw new ISUserVisibleException( 'appendyield', $this->mModuleName, $c[0]->line );
 212+ }
 213+
 214+ $this->mListOutput[] = $this->evaluateNode( $c[1], $rec + 1 );
 215+ break 2;
 216+ default:
 217+ throw new ISException( "Unknown return keyword: {$c[0]->value}" );
 218+ }
 219+ case 'exprset':
 220+ $this->mInterpreter->increaseEvaluationsCount( $this->mModuleName, $c[1]->line );
 221+ if( $c[1]->value == '=' ) {
 222+ $new = $this->evaluateNode( $c[2], $rec + 1 );
 223+ $this->setVar( $c[0], $new, $rec );
 224+ return $new;
 225+ } else {
 226+ $old = $this->getVar( $c[0], $rec, false );
 227+ $new = $this->evaluateNode( $c[2], $rec + 1 );
 228+ $new = $this->getValueForSetting( $old, $new,
 229+ $c[1]->value, $c[1]->line );
 230+ $this->setVar( $c[0], $new, $rec );
 231+ return $new;
 232+ }
 233+ case 'exprtrinary':
 234+ $cond = $this->evaluateNode( $c[0], $rec + 1 );
 235+ if( $cond->toBool() ) {
 236+ return $this->evaluateNode( $c[2], $rec + 1 );
 237+ } else {
 238+ return $this->evaluateNode( $c[4], $rec + 1 );
 239+ }
 240+ case 'exprlogical':
 241+ $this->mInterpreter->increaseEvaluationsCount( $this->mModuleName, $c[1]->line );
 242+ $arg1 = $this->evaluateNode( $c[0], $rec + 1 );
 243+ switch( $c[1]->value ) {
 244+ case '&':
 245+ if( !$arg1->toBool() )
 246+ return new ISData( ISData::DBool, false );
 247+ else
 248+ return $this->evaluateNode( $c[2], $rec + 1 );
 249+ case '|':
 250+ if( $arg1->toBool() )
 251+ return new ISData( ISData::DBool, true );
 252+ else
 253+ return $this->evaluateNode( $c[2], $rec + 1 );
 254+ case '^':
 255+ $arg2 = $this->evaluateNode( $c[2], $rec + 1 );
 256+ return new ISData( ISData::DBool, $arg1->toBool() xor $arg2->toBool() );
 257+ default:
 258+ throw new ISException( "Invalid logical operation: {$c[1]->value}" );
 259+ }
 260+ case 'exprequals':
 261+ case 'exprcompare':
 262+ $this->mInterpreter->increaseEvaluationsCount( $this->mModuleName, $c[1]->line );
 263+ $arg1 = $this->evaluateNode( $c[0], $rec + 1 );
 264+ $arg2 = $this->evaluateNode( $c[2], $rec + 1 );
 265+ return ISData::compareOp( $arg1, $arg2, $c[1]->value );
 266+ case 'exprsum':
 267+ $this->mInterpreter->increaseEvaluationsCount( $this->mModuleName, $c[1]->line );
 268+ $arg1 = $this->evaluateNode( $c[0], $rec + 1 );
 269+ $arg2 = $this->evaluateNode( $c[2], $rec + 1 );
 270+ switch( $c[1]->value ) {
 271+ case '+':
 272+ return ISData::sum( $arg1, $arg2 );
 273+ case '-':
 274+ return ISData::sub( $arg1, $arg2 );
 275+ }
 276+ case 'exprmul':
 277+ $this->mInterpreter->increaseEvaluationsCount( $this->mModuleName, $c[1]->line );
 278+ $arg1 = $this->evaluateNode( $c[0], $rec + 1 );
 279+ $arg2 = $this->evaluateNode( $c[2], $rec + 1 );
 280+ return ISData::mulRel( $arg1, $arg2, $c[1]->value, $this->mModuleName, $c[1]->line );
 281+ case 'exprpow':
 282+ $this->mInterpreter->increaseEvaluationsCount( $this->mModuleName, $c[1]->line );
 283+ $arg1 = $this->evaluateNode( $c[0], $rec + 1 );
 284+ $arg2 = $this->evaluateNode( $c[2], $rec + 1 );
 285+ return ISData::pow( $arg1, $arg2 );
 286+ case 'exprkeyword':
 287+ $this->mInterpreter->increaseEvaluationsCount( $this->mModuleName, $c[1]->line );
 288+ $arg1 = $this->evaluateNode( $c[0], $rec + 1 );
 289+ $arg2 = $this->evaluateNode( $c[2], $rec + 1 );
 290+ switch( $c[1]->value ) {
 291+ case 'in':
 292+ return ISData::keywordIn( $arg1, $arg2 );
 293+ case 'contains':
 294+ return ISData::keywordIn( $arg2, $arg1 );
 295+ default:
 296+ throw new ISException( "Invalid keyword: {$c[1]->value}" );
 297+ }
 298+ case 'exprinvert':
 299+ $this->mInterpreter->increaseEvaluationsCount( $this->mModuleName, $c[0]->line );
 300+ $arg = $this->evaluateNode( $c[1], $rec + 1 );
 301+ return ISData::boolInvert( $arg );
 302+ case 'exprunary':
 303+ $this->mInterpreter->increaseEvaluationsCount( $this->mModuleName, $c[0]->line );
 304+ $arg = $this->evaluateNode( $c[1], $rec + 1 );
 305+ if( $c[0]->value == '-' )
 306+ return ISData::unaryMinus( $arg );
 307+ else
 308+ return $arg;
 309+ case 'exprfunction':
 310+ // <exprFunction> ::= <funcid> leftbracket <commaListPlain> rightbracket | <funcid> leftbracket rightbracket
 311+ // <exprFunction> ::= <varfunc> leftbracket <lvalue> rightbracket | <exprAtom>
 312+ // <varfunc> ::= isset | delete
 313+ // <funcid> ::= id | <exprAtom> doublecolon id | self doublecolon id
 314+
 315+ $this->mInterpreter->increaseEvaluationsCount( $this->mModuleName, $c[1]->line );
 316+ if( $c[0]->getType() == 'funcid' ) {
 317+ if( $c[2] instanceof ISParserTreeNode ) {
 318+ $args = $this->parseArray( $c[2], $rec, $dummy );
 319+ } else {
 320+ $args = array();
 321+ }
 322+
 323+ $idch = $c[0]->getChildren();
 324+ if( count( $idch ) == 1 ) {
 325+ $funcname = $idch[0]->value;
 326+ if( !isset( self::$mFunctions[$funcname] ) )
 327+ throw new ISUserVisibleException( 'unknownfunction', $this->mModuleName, $idch[0]->line, array( $funcname ) );
 328+ $func = self::$mFunctions[$funcname];
 329+ return $this->$func( $args, $idch[0]->line );
 330+ } else {
 331+ $funcname = $idch[2]->value;
 332+ if( $idch[0] instanceof ISToken ) {
 333+ // self::function()
 334+ $module = $this->mModule;
 335+ } else {
 336+ // "ModuleName"::function()
 337+ $module = $this->evaluateNode( $idch[0], $rec + 1 )->toString();
 338+ }
 339+ return $this->mInterpreter->invokeUserFunctionFromModule(
 340+ $module, $funcname, $args, $this, $idch[1]->line );
 341+ }
 342+ } else {
 343+ $type = $c[0]->mChildren[0]->value;
 344+ switch( $type ) {
 345+ case 'isset':
 346+ $val = $this->getVar( $c[2], $rec, true );
 347+ return new ISData( ISData::DBool, $val !== null );
 348+ case 'delete':
 349+ $this->deleteVar( $c[2], $rec );
 350+ return new ISData();
 351+ default:
 352+ throw new ISException( "Unknown keyword: {$type}" );
 353+ }
 354+ }
 355+ case 'expratom':
 356+ if( $c[0] instanceof ISParserTreeNode ) {
 357+ if( $c[0]->getType() == 'atom' ) {
 358+ list( $val ) = $c[0]->getChildren();
 359+ switch( $val->type ) {
 360+ case 'string':
 361+ return new ISData( ISData::DString, $val->value );
 362+ case 'int':
 363+ return new ISData( ISData::DInt, $val->value );
 364+ case 'float':
 365+ return new ISData( ISData::DFloat, $val->value );
 366+ case 'true':
 367+ return new ISData( ISData::DBool, true );
 368+ case 'false':
 369+ return new ISData( ISData::DBool, false );
 370+ case 'null':
 371+ return new ISData();
 372+ }
 373+ } else {
 374+ return $this->getVar( $c[0], $rec );
 375+ }
 376+ } else {
 377+ switch( $c[0]->type ) {
 378+ case 'leftbracket':
 379+ return $this->evaluateNode( $c[1], $rec + 1 );
 380+ case 'leftsquare':
 381+ case 'leftcurly':
 382+ $arraytype = null;
 383+ $array = $this->parseArray( $c[1], $rec + 1, $arraytype );
 384+ return new ISData( $arraytype, $array );
 385+ case 'break':
 386+ throw new ISControlException( 'break', $this->mModuleName, $c[0]->line );
 387+ case 'continue':
 388+ throw new ISControlException( 'continue', $this->mModuleName, $c[0]->line );
 389+ }
 390+ }
 391+ default:
 392+ $type = $node->getType();
 393+ throw new ISException( "Invalid node type passed to evaluateNode(): {$type}" );
 394+ }
 395+ }
 396+
 397+ /*
 398+ * Converts commaList* to a PHP array.
 399+ */
 400+ protected function parseArray( $node, $rec, &$arraytype ) {
 401+ $c = $node->getChildren();
 402+ $type = $node->getType();
 403+ if( $type == 'commalist' ) {
 404+ return $this->parseArray( $c[0], $rec, $arraytype );
 405+ }
 406+
 407+ wfProfileIn( __METHOD__ );
 408+
 409+ // <commaListWhatever> ::= <commaListWhatever> comma <expr> | <expr>
 410+ $elements = $result = array();
 411+ while( isset( $c[2] ) ) {
 412+ array_unshift( $elements, $c[2] );
 413+ $c = $c[0]->getChildren();
 414+ }
 415+ array_unshift( $elements, $c[0] );
 416+
 417+ switch( $type ) {
 418+ case 'commalistplain':
 419+ foreach( $elements as $elem ) {
 420+ $result[] = $this->evaluateNode( $elem, $rec + 1 );
 421+ }
 422+
 423+ $arraytype = ISData::DList;
 424+ wfProfileOut( __METHOD__ );
 425+ return $result;
 426+
 427+ case 'commalistassoc':
 428+ foreach( $elements as $elem ) {
 429+ //<keyValue> ::= <expr> colon <expr>
 430+ list( $key, $crap, $value ) = $elem->getChildren();
 431+ $key = $this->evaluateNode( $key, $rec + 1 );
 432+ $value = $this->evaluateNode( $value, $rec + 1 );
 433+ $result[ $key->toString() ] = $value;
 434+ }
 435+
 436+ $arraytype = ISData::DAssoc;
 437+ wfProfileOut( __METHOD__ );
 438+ return $result;
 439+ }
 440+ }
 441+
 442+ /**
 443+ * Returns a value of the variable in $lval. If $nullIfNotSet is set to true,
 444+ * returns null if variable does not exist, otherwise throws an exception.
 445+ */
 446+ protected function getVar( $lval, $rec, $nullIfNotSet = false ) {
 447+ // <lvalue> ::= id | <lvalue> <arrayIdx>
 448+ // <arrayIdx> ::= leftsquare <expr> rightsquare | leftsquare rightsquare
 449+
 450+ if( !$this->mInterpreter->checkRecursionLimit( $rec ) ) {
 451+ throw new ISUserVisibleException( 'recoverflow', $this->mModuleName, $this->getLine( $node ) );
 452+ }
 453+
 454+ $c = $lval->getChildren();
 455+ if( $c[0] instanceof ISToken ) {
 456+ // Variable ID
 457+ $varname = $c[0]->value;
 458+ if( !isset( $this->mVars[$varname] ) ) {
 459+ if( $nullIfNotSet )
 460+ return null;
 461+ else
 462+ throw new ISUserVisibleException( 'unknownvar', $this->mModuleName, $c[0]->line, array( $varname ) );
 463+ }
 464+ return $this->mVars[$varname];
 465+ } else {
 466+ // Array element
 467+ $idxchildren = $c[1]->getChildren();
 468+ $var = $this->getVar( $c[0], $rec + 1, $nullIfNotSet );
 469+ if( $nullIfNotSet && $var === null )
 470+ return null;
 471+
 472+ if( count( $idxchildren ) == 2 ) {
 473+ // x = a[]. a[] is still legitimage in a[] = x
 474+ throw new ISUserVisibleException( 'emptyidx', $this->mModuleName, $idxchildren[0]->line );
 475+ }
 476+
 477+ switch( $var->type ) {
 478+ case ISData::DList:
 479+ $idx = $this->evaluateNode( $idxchildren[1], $rec + 1 )->toInt();
 480+ if( $idx >= count( $var->data ) ) {
 481+ if( $nullIfNotSet )
 482+ return null;
 483+ else
 484+ throw new ISUserVisibleException( 'outofbounds', $this->mModuleName, $idxchildren[0]->line );
 485+ }
 486+ return $var->data[$idx];
 487+ case ISData::DAssoc:
 488+ $idx = $this->evaluateNode( $idxchildren[1], $rec + 1 )->toString();
 489+ if( !isset( $var->data[$idx] ) ) {
 490+ if( $nullIfNotSet )
 491+ return null;
 492+ else
 493+ throw new ISUserVisibleException( 'outofbounds', $this->mModuleName, $idxchildren[0]->line );
 494+ }
 495+ return $var->data[$idx];
 496+ default:
 497+ throw new ISUserVisibleException( 'notanarray', $this->mModuleName, $idxchildren[0]->line );
 498+ }
 499+ }
 500+ }
 501+
 502+ /**
 503+ * Gets the line of the first terminal in the node.
 504+ */
 505+ protected function getLine( $node ) {
 506+ while( $node instanceof ISParserTreeNode ) {
 507+ $children = $node->getChildren();
 508+ $node = $children[0];
 509+ }
 510+ return $node->line;
 511+ }
 512+
 513+ /**
 514+ * Changes the value of variable or array element specified in $lval to $newval.
 515+ */
 516+ protected function setVar( $lval, $newval, $rec ) {
 517+ $var = &$this->setVarGetRef( $lval, $rec );
 518+ $var = $newval;
 519+ unset( $var );
 520+ }
 521+
 522+ /**
 523+ * Recursive function that return the link to the place
 524+ * where the new value of the variable must be set.
 525+ */
 526+ protected function &setVarGetRef( $lval, $rec ) {
 527+ if( !$this->mInterpreter->checkRecursionLimit( $rec ) ) {
 528+ throw new ISUserVisibleException( 'recoverflow', $this->mModuleName, $this->getLine( $node ) );
 529+ }
 530+
 531+ $c = $lval->getChildren();
 532+ if( count( $c ) == 1 ) {
 533+ if( !isset( $this->mVars[ $c[0]->value ] ) )
 534+ $this->mVars[ $c[0]->value ] = new ISPlaceholder();
 535+ return $this->mVars[ $c[0]->value ];
 536+ } else {
 537+ $ref = &$this->setVarGetRef( $c[0], $rec + 1 );
 538+
 539+ // <arrayIdx> ::= leftsquare <expr> rightsquare | leftsquare rightsquare
 540+ $idxc = $c[1]->getChildren();
 541+ if( $ref instanceof ISPlaceholder ) {
 542+ if( count( $idxc ) > 2 ) {
 543+ $index = $this->evaluateNode( $idxc[1], $rec + 1 );
 544+ $ref = new ISData( ISData::DAssoc, array() );
 545+ } else {
 546+ $ref = new ISData( ISData::DList, array() );
 547+ }
 548+ }
 549+
 550+ switch( $ref->type ) {
 551+ case ISData::DList:
 552+ if( count( $idxc ) > 2 ) {
 553+ $index = $this->evaluateNode( $idxc[1], $rec + 1 );
 554+ $key = $index->toInt();
 555+
 556+ if( $key < 0 || $key > count( $ref->data ) )
 557+ throw new ISUserVisibleException( 'outofbounds', $this->mModuleName, $idxc[0]->line );
 558+ } else {
 559+ $key = count( $ref->data );
 560+ }
 561+
 562+ if( !isset( $ref->data[$key] ) )
 563+ $ref->data[$key] = new ISPlaceholder();
 564+
 565+ return $ref->data[$key];
 566+ case ISData::DAssoc:
 567+ if( count( $idxc ) > 2 ) {
 568+ if( !isset( $index ) )
 569+ $index = $this->evaluateNode( $idxc[1], $rec + 1 );
 570+ $key = $index->toString();
 571+
 572+ if( !isset( $ref->data[$key] ) )
 573+ $ref->data[$key] = new ISPlaceholder();
 574+ return $ref->data[$key];
 575+ } else {
 576+ throw new ISUserVisibleException( 'notlist', $this->mModuleName, $idxc[0]->line );
 577+ }
 578+ break;
 579+ default:
 580+ throw new ISUserVisibleException( 'notanarray', $this->mModuleName, $idxc[0]->line );
 581+ }
 582+ }
 583+ }
 584+
 585+ protected function getValueForSetting( $old, $new, $set, $line ) {
 586+ switch( $set ) {
 587+ case '+=':
 588+ return ISData::sum( $old, $new );
 589+ case '-=':
 590+ return ISData::sub( $old, $new );
 591+ case '*=':
 592+ return ISData::mulRel( $old, $new, '*', $line );
 593+ case '/=':
 594+ return ISData::mulRel( $old, $new, '/', $line );
 595+ default:
 596+ return $new;
 597+ }
 598+ }
 599+
 600+ protected function checkParamsCount( $args, $pos, $count ) {
 601+ if( count( $args ) < $count )
 602+ throw new ISUserVisibleException( 'notenoughargs', $this->mModuleName, $pos );
 603+ }
 604+
 605+ protected function deleteVar( $lval, $rec ) {
 606+ $c = $lval->getChildren();
 607+ $line = $c[0]->line;
 608+ $varname = $c[0]->value;
 609+ if( isset( $c[1] ) ) {
 610+ throw new ISException( 'delete() is not usable for array elements' );
 611+ }
 612+ unset( $this->mVars[$varname] );
 613+ }
 614+
 615+ /** Functions */
 616+ protected function funcArg( $args, $pos ) {
 617+ $this->checkParamsCount( $args, $pos, 1 );
 618+
 619+ $argName = $args[0]->toString();
 620+ $default = isset( $args[1] ) ? $args[1] : new ISData();
 621+ if( $this->mFrame->getArgument( $argName ) === false )
 622+ return $default;
 623+ else
 624+ return new ISData( ISData::DString, $this->mFrame->getArgument( $argName ) );
 625+ }
 626+
 627+ protected function funcArgs( $args, $pos ) {
 628+ return ISData::newFromPHPVar( $this->mFrame->getNumberedArguments() );
 629+ }
 630+
 631+ protected function funcIsTranscluded( $args, $pos ) {
 632+ return new ISData( ISData::DBool, $this->mFrame->isTemplate() );
 633+ }
 634+
 635+ protected function funcParse( $args, $pos ) {
 636+ $this->checkParamsCount( $args, $pos, 1 );
 637+
 638+ $text = $args[0]->toString();
 639+ $this->mInterpreter->mCallStack->addParse( $text );
 640+
 641+ $oldOT = $this->mParser->mOutputType;
 642+ $this->mParser->setOutputType( Parser::OT_PREPROCESS );
 643+ $parsed = $this->mParser->replaceVariables( $text, $this->mFrame );
 644+ $parsed = $this->mParser->mStripState->unstripBoth( $parsed );
 645+ $this->mParser->setOutputType( $oldOT );
 646+
 647+ $this->mInterpreter->mCallStack->pop();
 648+ return new ISData( ISData::DString, $parsed );
 649+ }
 650+
 651+ protected function funcLc( $args, $pos ) {
 652+ global $wgContLang;
 653+ $this->checkParamsCount( $args, $pos, 1 );
 654+ return new ISData( ISData::DString, $wgContLang->lc( $args[0]->toString() ) );
 655+ }
 656+
 657+ protected function funcUc( $args, $pos ) {
 658+ global $wgContLang;
 659+ $this->checkParamsCount( $args, $pos, 1 );
 660+ return new ISData( ISData::DString, $wgContLang->uc( $args[0]->toString() ) );
 661+ }
 662+
 663+ protected function funcUcFirst( $args, $pos ) {
 664+ global $wgContLang;
 665+ $this->checkParamsCount( $args, $pos, 1 );
 666+ return new ISData( ISData::DString, $wgContLang->ucfirst( $args[0]->toString() ) );
 667+ }
 668+
 669+ protected function funcUrlencode( $args, $pos ) {
 670+ $this->checkParamsCount( $args, $pos, 1 );
 671+ return new ISData( ISData::DString, urlencode( $args[0]->toString() ) );
 672+ }
 673+
 674+ protected function funcAnchorEncode( $args, $pos ) {
 675+ $this->checkParamsCount( $args, $pos, 1 );
 676+
 677+ $s = urlencode( $args[0]->toString() );
 678+ $s = strtr( $s, array( '%' => '.', '+' => '_' ) );
 679+ $s = str_replace( '.3A', ':', $s );
 680+
 681+ return new ISData( ISData::DString, $s );
 682+ }
 683+
 684+ protected function funcGrammar( $args, $pos ) {
 685+ $this->checkParamsCount( $args, $pos, 2 );
 686+ list( $case, $word ) = $args;
 687+ $res = $this->mParser->getFunctionLang()->convertGrammar(
 688+ $word->toString(), $case->toString() );
 689+ return new ISData( ISData::DString, $res );
 690+ }
 691+
 692+ protected function funcPlural( $args, $pos ) {
 693+ $this->checkParamsCount( $args, $pos, 2 );
 694+ $num = $args[0]->toInt();
 695+ for( $i = 1; $i < count( $args ); $i++ )
 696+ $forms[] = $args[$i]->toString();
 697+ $res = $this->mParser->getFunctionLang()->convertPlural( $num, $forms );
 698+ return new ISData( ISData::DString, $res );
 699+ }
 700+
 701+ protected function funcStrlen( $args, $pos ) {
 702+ $this->checkParamsCount( $args, $pos, 1 );
 703+ return new ISData( ISData::DInt, mb_strlen( $args[0]->toString() ) );
 704+ }
 705+
 706+ protected function funcSubstr( $args, $pos ) {
 707+ $this->checkParamsCount( $args, $pos, 3 );
 708+ $s = $args[0]->toString();
 709+ $start = $args[1]->toInt();
 710+ $end = $args[2]->toInt();
 711+ return new ISData( ISData::DString, mb_substr( $s, $start, $end ) );
 712+ }
 713+
 714+ protected function funcStrreplace( $args, $pos ) {
 715+ $this->checkParamsCount( $args, $pos, 3 );
 716+ $s = $args[0]->toString();
 717+ $old = $args[1]->toString();
 718+ $new = $args[2]->toString();
 719+ return new ISData( ISData::DString, str_replace( $old, $new, $s ) );
 720+ }
 721+
 722+ protected function funcSplit( $args, $pos ) {
 723+ $this->checkParamsCount( $args, $pos, 2 );
 724+ $list = explode( $args[0]->toString(), $args[1]->toString() );
 725+ return ISData::newFromPHPVar( $list );
 726+ }
 727+
 728+ protected function funcJoin( $args, $pos ) {
 729+ $this->checkParamsCount( $args, $pos, 2 );
 730+ $seperator = $args[0]->toString();
 731+ if( $args[1]->type == ISData::DList ) {
 732+ $bits = $args[1]->data;
 733+ } else {
 734+ $bits = array_slice( $args, 1 );
 735+ }
 736+ foreach( $bits as &$bit )
 737+ $bit = $bit->toString();
 738+ return new ISData( ISData::DString, implode( $seperator, $bits ) );
 739+ }
 740+
 741+ protected function funcCount( $args, $pos ) {
 742+ $this->checkParamsCount( $args, $pos, 1 );
 743+ return new ISData( ISData::DInt, count( $args[0]->toList()->data ) );
 744+ }
 745+
 746+ protected function castString( $args, $pos ) {
 747+ $this->checkParamsCount( $args, $pos, 1 );
 748+ return ISData::castTypes( $args[0], ISData::DString );
 749+ }
 750+
 751+ protected function castInt( $args, $pos ) {
 752+ $this->checkParamsCount( $args, $pos, 1 );
 753+ return ISData::castTypes( $args[0], ISData::DInt );
 754+ }
 755+
 756+ protected function castFloat( $args, $pos ) {
 757+ $this->checkParamsCount( $args, $pos, 1 );
 758+ return ISData::castTypes( $args[0], ISData::DFloat );
 759+ }
 760+
 761+ protected function castBool( $args, $pos ) {
 762+ $this->checkParamsCount( $args, $pos, 1 );
 763+ return ISData::castTypes( $args[0], ISData::DBool );
 764+ }
 765+}
Index: trunk/extensions/InlineScripts/interpreter/syntax.txt
——@@ -1,6 +1,11 @@
2 -<program> ::= <stmts>
 2+<module> ::= <functions>
 3+<functions> ::= <function> <functions> | <function>
 4+
 5+<function> ::= function id leftbracket <args> rightbracket leftcurly <stmts> rightcurly
 6+<function> ::= function id leftbracket rightbracket leftcurly <stmts> rightcurly
 7+<args> ::= id comma <args> | id
 8+
39 <stmts> ::= <stmts> <stmt> | <stmt>
4 -
510 <stmt> ::= <expr> semicolon
611 <stmt> ::= if leftbracket <expr> rightbracket <stmt>
712 <stmt> ::= if leftbracket <expr> rightbracket <stmt> else <stmt>
——@@ -8,7 +13,9 @@
914 <stmt> ::= try <stmt> catch leftbracket <lvalue> rightbracket <stmt>
1015 <stmt> ::= leftcurly <stmts> rightcurly
1116
12 -<expr> ::= <exprSet>
 17+<expr> ::= <exprReturn>
 18+<exprReturn> ::= return | return <exprSet> | <exprSet>
 19+<exprReturn> ::= append <exprSet> | yield <exprSet>
1320 <exprSet> ::= <lvalue> setto <exprSet> | <exprTrinary>
1421 <exprTrinary> ::= <exprLogical> trinary <exprTrinary> colon <exprTrinary> | <exprLogical>
1522 <exprLogical> ::= <exprLogical> logicop <exprCompare> | <exprCompare>
——@@ -20,13 +27,15 @@
2128 <exprInvert> ::= invert <exprKeyword> | <exprKeyword>
2229 <exprKeyword> ::= <exprUnary> in <exprUnary> | <exprUnary> contains <exprUnary> | <exprUnary>
2330 <exprUnary> ::= sum <exprFunction> | <exprFunction>
24 -<exprFunction> ::= id leftbracket <commaListPlain> rightbracket | id leftbracket rightbracket
 31+<exprFunction> ::= <funcid> leftbracket <commaListPlain> rightbracket | <funcid> leftbracket rightbracket
2532 <exprFunction> ::= <varfunc> leftbracket <lvalue> rightbracket | <exprAtom>
2633 <exprAtom> ::= <lvalue> | <atom> | break | continue
2734 <exprAtom> ::= leftbracket <expr> rightbracket
2835 <exprAtom> ::= leftsquare <commaListPlain> rightsquare | leftcurly <commaListAssoc> rightcurly
2936
3037 <varfunc> ::= isset | delete
 38+<funcid> ::= id | <exprAtom> doublecolon id | self doublecolon id
 39+
3140 <commaListPlain> ::= <commaListPlain> comma <expr> | <expr>
3241 <commaListAssoc> ::= <commaListAssoc> comma <keyValue> | <keyValue>
3342 <keyValue> ::= <expr> colon <expr>
Index: trunk/extensions/InlineScripts/interpreter/CallStack.php
——@@ -0,0 +1,88 @@
 2+<?php
 3+
 4+abstract class ISCallStackEntry {
 5+ abstract function toString();
 6+}
 7+
 8+abstract class ISCallStackFunctionEntry extends ISCallStackEntry {
 9+ public $module;
 10+ public $function;
 11+}
 12+
 13+class ISCallStackFunctionFromModuleEntry extends ISCallStackFunctionEntry {
 14+ public $invokingModule;
 15+ public $line;
 16+
 17+ public function toString() {
 18+ return wfMsg( 'inlinescripts-call-frommodule', $this->module, $this->function,
 19+ $this->invokingModule, $this->line );
 20+ }
 21+}
 22+
 23+class ISCallStackFunctionFromWikitextEntry extends ISCallStackFunctionEntry {
 24+ public function toString() {
 25+ return wfMsg( 'inlinescripts-call-frommodule', $this->module, $this->function );
 26+ }
 27+}
 28+
 29+class ISCallStackParseEntry extends ISCallStackEntry {
 30+ public $text;
 31+
 32+ public function toString() {
 33+ return wfMsg( 'inlinescripts-call-parse', $this->text );
 34+ }
 35+}
 36+
 37+class ISCallStack {
 38+ var $mInterpreter, $mStack;
 39+
 40+ public function __construct( $interpreter ) {
 41+ $this->mInterpreter = $interpreter;
 42+ $this->mStack = array();
 43+ }
 44+
 45+ public function pop() {
 46+ array_pop( $this->mStack );
 47+ }
 48+
 49+ public function isFull() {
 50+ global $wgInlineScriptsMaxCallStackDepth;
 51+ }
 52+
 53+ public function contains( $module, $name ) {
 54+ foreach( $this->mStack as $entry ) {
 55+ if( $entry instanceof ISCallStackFunctionEntry ) {
 56+ if( $entry->module == $module && $entry->function == $name ) {
 57+ return true;
 58+ }
 59+ }
 60+ }
 61+ return false;
 62+ }
 63+
 64+ public function addFunctionFromModule( $module, $name, $invokingModule, $line ) {
 65+ $entry = new ISCallStackFunctionFromModuleEntry();
 66+ $entry->module = $module;
 67+ $entry->function = $name;
 68+ $entry->invokingModule = $invokingModule;
 69+ $entry->line = $line;
 70+ $this->mStack[] = $entry;
 71+ }
 72+
 73+ public function addFunctionFromWikitext( $module, $name ) {
 74+ $entry = new ISCallStackFunctionFromWikitextEntry();
 75+ $entry->module = $module;
 76+ $entry->function = $name;
 77+ $this->mStack[] = $entry;
 78+ }
 79+
 80+ public function addParse( $wikitext ) {
 81+ if( strlen( $wikitext ) > 64 ) {
 82+ $wikitext = substr( $wikitext, 0, 64 ) . "...";
 83+ }
 84+
 85+ $entry = new ISCallStackParseEntry();
 86+ $entry->text = $wikitext;
 87+ $this->mStack[] = $entry;
 88+ }
 89+}
Index: trunk/extensions/InlineScripts/interpreter/Interpreter.php
——@@ -1,37 +1,80 @@
22 <?php
33 /**
4 - * Interpreter for MediaWiki inline scripts.
5 - * Copyright (C) Victor Vasiliev, Andrew Garrett, 2008-2009.
6 - * Distributed under GNU GPL v2 or later terms.
 4+ * Built-in scripting language for MediaWiki: interpreter.
 5+ * Copyright (C) 2009-2011 Victor Vasiliev <vasilvv@gmail.com>
 6+ * http://www.mediawiki.org/
 7+ *
 8+ * This program is free software; you can redistribute it and/or modify
 9+ * it under the terms of the GNU General Public License as published by
 10+ * the Free Software Foundation; either version 2 of the License, or
 11+ * (at your option) any later version.
 12+ *
 13+ * This program is distributed in the hope that it will be useful,
 14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 16+ * GNU General Public License for more details.
 17+ *
 18+ * You should have received a copy of the GNU General Public License along
 19+ * with this program; if not, write to the Free Software Foundation, Inc.,
 20+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 21+ * http://www.gnu.org/copyleft/gpl.html
722 */
823
 24+if( !defined( 'MEDIAWIKI' ) )
 25+ die();
 26+
927 require_once( 'Shared.php' );
1028 require_once( 'Data.php' );
 29+require_once( 'EvaluationContext.php' );
 30+require_once( 'CallStack.php' );
1131
1232 /**
13 - * The global interpreter object.
 33+ * The global interpreter object. Each parser has one.
1434 */
1535 class ISInterpreter {
1636 const ParserVersion = 1;
1737
18 - var $mCodeParser, $mMaxRecursion, $mEvaluations, $mTokens, $mUseCache;
 38+ var $mParser, $mCodeParser, $mUseCache, $mUsedModules, $mCallStack;
 39+ var $mMaxRecursion, $mEvaluations, $mTokens;
1940
20 - public function __construct() {
 41+ var $mParserCache; // Unserializing can be expensive as well
 42+
 43+ public function __construct( $parser ) {
2144 global $wgInlineScriptsParserClass, $wgInlineScriptsUseCache;
2245
 46+ $this->mParser = $parser;
2347 $this->mCodeParser = new $wgInlineScriptsParserClass( $this );
 48+ $this->mUseCache = $wgInlineScriptsUseCache;
 49+
 50+ $this->mCallStack = new ISCallStack( $this );
 51+ $this->mUsedModules = array();
2452 $this->mMaxRecursion =
2553 $this->mEvaluations =
2654 $this->mTokens =
2755 0;
28 -
29 - $this->mUseCache = $wgInlineScriptsUseCache;
3056 }
3157
 58+ /**
 59+ * Disable cache for benchmarking or debugging purposes.
 60+ */
3261 public function disableCache() {
3362 $this->mUseCache = false;
3463 }
3564
 65+ /**
 66+ * Get the wikitext parser linked to the interpreter.
 67+ */
 68+ public function getParser() {
 69+ return $this->mParser;
 70+ }
 71+
 72+ /** Limit handling code */
 73+
 74+ /**
 75+ * Check whether the argument is more than recursion limit.
 76+ *
 77+ * @return Boolean
 78+ */
3679 public function checkRecursionLimit( $rec ) {
3780 global $wgInlineScriptsLimits;
3881 if( $rec > $this->mMaxRecursion )
——@@ -39,11 +82,18 @@
4083 return $rec <= $wgInlineScriptsLimits['depth'];
4184 }
4285
43 - public function increaseEvaluationsCount() {
 86+ /**
 87+ * Increases the number of evaluations.
 88+ *
 89+ * @param $module ISModule Module where the evaluation happens
 90+ * @param $line int Line number of the evaluation
 91+ * @return Boolean
 92+ */
 93+ public function increaseEvaluationsCount( $module, $line ) {
4494 global $wgInlineScriptsLimits;
4595 $this->mEvaluations++;
4696 if( $this->mEvaluations > $wgInlineScriptsLimits['evaluations'] )
47 - throw new ISUserVisibleException( 'toomanyevals', 0 );
 97+ throw new ISUserVisibleException( 'toomanyevals', $module, $line );
4898 }
4999
50100 public function getMaxTokensLeft() {
——@@ -51,732 +101,340 @@
52102 return $wgInlineScriptsLimits['tokens'] - $this->mTokens;
53103 }
54104
55 - public function execute( $code, $parser, $frame ) {
56 - wfProfileIn( __METHOD__ );
57 - $context = new ISEvaluationContext( $this, $parser, $frame );
58 - $ast = $this->parseCode( $code );
59 -
60 - wfProfileIn( __METHOD__ . '-evaluation' );
61 - $context->evaluateNode( $ast, 0 )->toString();
62 - wfProfileOut( __METHOD__ . '-evaluation' );
63 -
64 - wfProfileOut( __METHOD__ );
65 - return $context->mOut;
 105+ /**
 106+ * Adds the title of the module used by the parser for tracking purposes.
 107+ *
 108+ * @param $title Title Title of the module.
 109+ */
 110+ public function addModuleTitle( $title ) {
 111+ if( !in_array( $title->getText(), $this->mUsedModules ) )
 112+ $this->mUsedModules[] = $title->getDBkey();
66113 }
67114
68 - public function evaluate( $code, $parser, $frame ) {
69 - wfProfileIn( __METHOD__ );
70 - $context = new ISEvaluationContext( $this, $parser, $frame );
71 - $ast = $this->parseCode( $code );
 115+ /** Module loading code */
72116
73 - wfProfileIn( __METHOD__ . '-evaluation' );
74 - $result = $context->evaluateNode( $ast, 0 )->toString();
75 - wfProfileOut( __METHOD__ . '-evaluation' );
76 -
77 - wfProfileOut( __METHOD__ );
78 - return $result;
79 - }
80 -
81 - public function parseCode( $code ) {
 117+ /**
 118+ * Loads module from cache or from page and parses it. Cached as much as possible.
 119+ *
 120+ * @param $title Title Title of the module to load.
 121+ */
 122+ public function getModule( $title ) {
82123 global $parserMemc;
83 - static $parserCache; // Unserializing can be expensive as well
84124
85125 wfProfileIn( __METHOD__ );
86 - $code = trim( $code );
87126
88 - $memcKey = 'isparser:ast:' . md5( $code );
 127+ // Add nominal title. Real title may differ due to redirects
 128+ $this->addModuleTitle( $title );
89129
90 - if( $this->mUseCache && isset( $parserCache[$memcKey] ) ) {
 130+ // Try local cache
 131+ $key = ISModule::getCacheKey( $title );
 132+ if( $this->mUseCache && isset( $this->mParserCache[$key] ) ) {
 133+ $module = $this->mParserCache[$key];
 134+ $this->addModuleTitle( $module->getTitle() );
91135 wfProfileOut( __METHOD__ );
92 - return $parserCache[$memcKey];
 136+ return $module;
93137 }
94138
95 - $cached = $parserMemc->get( $memcKey );
96 - if( $this->mUseCache && @$cached instanceof ISParserOutput && !$cached->isOutOfDate() ) {
97 - $cached->appendTokenCount( $this );
98 - $parserCache[$memcKey] = $cached->getParserTree();
 139+ // Try the object cache
 140+ wfProfileIn( __METHOD__ . '-unserialize' );
 141+ $cached = $parserMemc->get( $key );
 142+ wfProfileOut( __METHOD__ . '-unserialize' );
 143+ if( $this->mUseCache && @$cached instanceof ISModule && !$cached->isOutOfDate() ) {
 144+ $this->mParserCache[$key] = $cached;
 145+ $this->addModuleTitle( $cached->getTitle() );
99146 wfProfileOut( __METHOD__ );
100 - return $cached->getParserTree();
 147+ return $cached;
101148 }
102149
103 - $scanner = new ISScanner( $code );
104 - $out = $this->mCodeParser->parse( $scanner, $this->getMaxTokensLeft() );
 150+ // Load from database
 151+ $rev = self::getModuleRev( $title );
 152+ if( !$rev || $rev->getTitle()->getNamespace() != NS_MODULE ) {
 153+ return false;
 154+ }
105155
106 - $out->appendTokenCount( $this );
107 - $parserMemc->set( $memcKey, $out );
108 - $parserCache[$memcKey] = $out->getParserTree();
 156+ // Parse
 157+ $moduleName = $rev->getTitle()->getText();
 158+ $scanner = new ISScanner( $moduleName, $rev->getText() );
 159+ $out = $this->mCodeParser->parse( $scanner, $moduleName, $this->getMaxTokensLeft() );
 160+ $module = ISModule::newFromParserOutput( $this, $rev->getTitle(), $out );
109161
 162+ // Save to cache
 163+ $this->mParserCache[$key] = $module;
 164+ $parserMemc->set( $key, $module );
 165+ $this->addModuleTitle( $module->getTitle() );
 166+
110167 wfProfileOut( __METHOD__ );
111 - return $out->getParserTree();
 168+ return $module;
112169 }
113 -}
114170
115 -/**
116 - * An internal class used by InlineScript. Used to evaluate a parsed code
117 - * in a sepereate context with its own output, variables and parser frame.
118 - */
119 -class ISEvaluationContext {
120 - var $mVars, $mOut, $mParser, $mFrame, $mInterpreter;
121 -
122 - static $mFunctions = array(
123 - 'out' => 'funcOut',
124 -
125 - /* String functions */
126 - 'lc' => 'funcLc',
127 - 'uc' => 'funcUc',
128 - 'ucfirst' => 'funcUcFirst',
129 - 'urlencode' => 'funcUrlencode',
130 - 'grammar' => 'funcGrammar',
131 - 'plural' => 'funcPlural',
132 - 'anchorencode' => 'funcAnchorEncode',
133 - 'strlen' => 'funcStrlen',
134 - 'substr' => 'funcSubstr',
135 - 'strreplace' => 'funcStrreplace',
136 - 'split' => 'funcSplit',
137 -
138 - /* Array functions */
139 - 'join' => 'funcJoin',
140 - 'count' => 'funcCount',
141 -
142 - /* Parser interaction functions */
143 - 'arg' => 'funcArg',
144 - 'args' => 'funcArgs',
145 - 'istranscluded' => 'funcIsTranscluded',
146 - 'parse' => 'funcParse',
147 -
148 - /* Cast functions */
149 - 'string' => 'castString',
150 - 'int' => 'castInt',
151 - 'float' => 'castFloat',
152 - 'bool' => 'castBool',
153 - );
154 -
155 - public function __construct( $interpreter, $parser, $frame ) {
156 - $this->mVars = array();
157 - $this->mOut = '';
158 - $this->mInterpreter = $interpreter;
159 - $this->mParser = $parser;
160 - $this->mFrame = $frame;
 171+ /**
 172+ * Fetches the revision for given module title.
 173+ */
 174+ private function getModuleRev( $title ) {
 175+ $rev = Revision::newFromTitle( $title );
 176+ if( $rev && $real = Title::newFromRedirect( $rev->getText() ) ) {
 177+ $rev = Revision::newFromTitle( $real );
 178+ }
 179+ return $rev;
161180 }
 181+
 182+ /** Function evaluation code */
162183
163184 /**
164 - * The core interpreter method. Evaluates a single AST node.
165 - * The $rec parameter must be increated by 1 each time the function is called
166 - * recursively.
 185+ * Invokes the user function from script code.
 186+ *
 187+ * @param $module ISModule/string Module or its name
 188+ * @param $name string Name of the function
 189+ * @param $args array(ISData) Arguments of the function
 190+ * @param $parentContext ISEvaluationContext The context from which the function was invoked
 191+ * @param $line The line from which the function was invoked.
 192+ * @return ISData
167193 */
168 - public function evaluateNode( $node, $rec ) {
169 - if( !$node instanceof ISParserTreeNode ) {
170 - throw new ISException( 'evaluateNode() accepts only nonterminals' );
171 - }
 194+ public function invokeUserFunctionFromModule( $module, $name, $args, $parentContext, $line ) {
 195+ global $wgInlineScriptsAllowRecursion;
172196
173 - if( !$this->mInterpreter->checkRecursionLimit( $rec ) ) {
174 - throw new ISUserVisibleException( 'recoverflow', 0 );
175 - }
 197+ // Load module
 198+ if( $module instanceof ISModule ) {
 199+ $moduleName = $module->getName();
 200+ } else {
 201+ $moduleName = $module;
176202
177 - $c = $node->getChildren();
178 - switch( $node->getType() ) {
179 - case 'stmts':
180 - $stmts = array();
181 - while( isset( $c[1] ) ) {
182 - array_unshift( $stmts, $c[1] );
183 - $c = $c[0]->getChildren();
184 - }
185 - array_unshift( $stmts, $c[0] );
186 - foreach( $stmts as $stmt )
187 - $res = $this->evaluateNode( $stmt, $rec + 1 );
188 - return $res;
189 - case 'stmt':
190 - if( $c[0] instanceof ISToken ) {
191 - switch( $c[0]->type ) {
192 - case 'leftcurly':
193 - return $this->evaluateNode( $c[1], $rec + 1 );
194 - case 'if':
195 - $cond = $this->evaluateNode( $c[2], $rec + 1 );
196 - if( $cond->toBool() ) {
197 - return $this->evaluateNode( $c[4], $rec + 1 );
198 - } else {
199 - if( isset( $c[6] ) ) {
200 - return $this->evaluateNode( $c[6], $rec + 1 );
201 - } else {
202 - return new ISData();
203 - }
204 - }
205 - case 'for':
206 - $array = $this->evaluateNode( $c[4], $rec + 1 );
207 - if( !$array->isArray() )
208 - throw new ISUserVisibleException( 'invalidforeach', $c[0]->type );
209 - $last = new ISData();
210 - $lvalues = $c[2]->getChildren();
 203+ $moduleTitle = Title::makeTitleSafe( NS_MODULE, $moduleName );
 204+ if( !$moduleTitle instanceof Title || $moduleTitle->getNamespace() != NS_MODULE ) {
 205+ throw new ISUserVisibleException( 'nonexistent-module', $parentContext->mModuleName, $line, array( $moduleName ) );
 206+ }
211207
212 - foreach( $array->data as $key => $item ) {
213 - // <forlvalue> ::= <lvalue> | <lvalue> colon <lvalue>
214 - if( count( $lvalues ) > 1 ) {
215 - $this->setVar( $lvalues[0], ISData::newFromPHPVar( $key ), $rec );
216 - $this->setVar( $lvalues[2], $item, $rec );
217 - } else {
218 - $this->setVar( $lvalues[0], $item, $rec );
219 - }
220 - try {
221 - $last = $this->evaluateNode( $c[6], $rec + 1 );
222 - } catch( ISUserVisibleException $e ) {
223 - if( $e->getExceptionID() == 'break' )
224 - break;
225 - elseif( $e->getExceptionID() == 'continue' )
226 - continue;
227 - else
228 - throw $e;
229 - }
230 - }
231 - return $last;
232 - case 'try':
233 - try {
234 - return $this->evaluateNode( $c[1], $rec + 1 );
235 - } catch( ISUserVisibleException $e ) {
236 - if( $e->getExceptionID() == 'break' || $e->getExceptionID() == 'continue' ) {
237 - throw $e;
238 - } else {
239 - $this->setVar( $c[4], new ISData( ISData::DString, $e->getExceptionID() ), $rec );
240 - return $this->evaluateNode( $c[6], $rec + 1 );
241 - }
242 - }
243 - default:
244 - throw new ISException( "Unknown keyword: {$c[0]->type}" );
245 - }
246 - } else {
247 - return $this->evaluateNode( $c[0], $rec + 1 );
248 - }
249 - case 'exprset':
250 - $this->mInterpreter->increaseEvaluationsCount();
251 - if( $c[1]->value == '=' ) {
252 - $new = $this->evaluateNode( $c[2], $rec + 1 );
253 - $this->setVar( $c[0], $new, $rec );
254 - return $new;
255 - } else {
256 - $old = $this->getVar( $c[0], $rec, false );
257 - $new = $this->evaluateNode( $c[2], $rec + 1 );
258 - $new = $this->getValueForSetting( $old, $new,
259 - $c[1]->value, $c[1]->line );
260 - $this->setVar( $c[0], $new, $rec );
261 - return $new;
262 - }
263 - case 'exprtrinary':
264 - $cond = $this->evaluateNode( $c[0], $rec + 1 );
265 - if( $cond->toBool() ) {
266 - return $this->evaluateNode( $c[2], $rec + 1 );
267 - } else {
268 - return $this->evaluateNode( $c[4], $rec + 1 );
269 - }
270 - case 'exprlogical':
271 - $this->mInterpreter->increaseEvaluationsCount();
272 - $arg1 = $this->evaluateNode( $c[0], $rec + 1 );
273 - switch( $c[1]->value ) {
274 - case '&':
275 - if( !$arg1->toBool() )
276 - return new ISData( ISData::DBool, false );
277 - else
278 - return $this->evaluateNode( $c[2], $rec + 1 );
279 - case '|':
280 - if( $arg1->toBool() )
281 - return new ISData( ISData::DBool, true );
282 - else
283 - return $this->evaluateNode( $c[2], $rec + 1 );
284 - case '^':
285 - $arg2 = $this->evaluateNode( $c[2], $rec + 1 );
286 - return new ISData( ISData::DBool, $arg1->toBool() xor $arg2->toBool() );
287 - default:
288 - throw new ISException( "Invalid logical operation: {$c[1]->value}" );
289 - }
290 - case 'exprequals':
291 - case 'exprcompare':
292 - $this->mInterpreter->increaseEvaluationsCount();
293 - $arg1 = $this->evaluateNode( $c[0], $rec + 1 );
294 - $arg2 = $this->evaluateNode( $c[2], $rec + 1 );
295 - return ISData::compareOp( $arg1, $arg2, $c[1]->value );
296 - case 'exprsum':
297 - $this->mInterpreter->increaseEvaluationsCount();
298 - $arg1 = $this->evaluateNode( $c[0], $rec + 1 );
299 - $arg2 = $this->evaluateNode( $c[2], $rec + 1 );
300 - switch( $c[1]->value ) {
301 - case '+':
302 - return ISData::sum( $arg1, $arg2 );
303 - case '-':
304 - return ISData::sub( $arg1, $arg2 );
305 - }
306 - case 'exprmul':
307 - $this->mInterpreter->increaseEvaluationsCount();
308 - $arg1 = $this->evaluateNode( $c[0], $rec + 1 );
309 - $arg2 = $this->evaluateNode( $c[2], $rec + 1 );
310 - return ISData::mulRel( $arg1, $arg2, $c[1]->value, $c[1]->line );
311 - case 'exprpow':
312 - $this->mInterpreter->increaseEvaluationsCount();
313 - $arg1 = $this->evaluateNode( $c[0], $rec + 1 );
314 - $arg2 = $this->evaluateNode( $c[2], $rec + 1 );
315 - return ISData::pow( $arg1, $arg2 );
316 - case 'exprkeyword':
317 - $this->mInterpreter->increaseEvaluationsCount();
318 - $arg1 = $this->evaluateNode( $c[0], $rec + 1 );
319 - $arg2 = $this->evaluateNode( $c[2], $rec + 1 );
320 - switch( $c[1]->value ) {
321 - case 'in':
322 - return ISData::keywordIn( $arg1, $arg2 );
323 - case 'contains':
324 - return ISData::keywordIn( $arg2, $arg1 );
325 - default:
326 - throw new ISException( "Invalid keyword: {$c[1]->value}" );
327 - }
328 - case 'exprinvert':
329 - $this->mInterpreter->increaseEvaluationsCount();
330 - $arg = $this->evaluateNode( $c[1], $rec + 1 );
331 - return ISData::boolInvert( $arg );
332 - case 'exprunary':
333 - $this->mInterpreter->increaseEvaluationsCount();
334 - $arg = $this->evaluateNode( $c[1], $rec + 1 );
335 - if( $c[0]->value == '-' )
336 - return ISData::unaryMinus( $arg );
337 - else
338 - return $arg;
339 - case 'exprfunction':
340 - $this->mInterpreter->increaseEvaluationsCount();
341 - if( $c[0] instanceof ISToken ) {
342 - $funcname = $c[0]->value;
343 - if( !isset( self::$mFunctions[$funcname] ) )
344 - throw new ISUserVisibleException( 'unknownfunction', $c[0]->line );
345 - $func = self::$mFunctions[$funcname];
346 - if( $c[2] instanceof ISParserTreeNode ) {
347 - $args = $this->parseArray( $c[2], $rec, $dummy );
348 - } else {
349 - $args = array();
350 - }
351 - return $this->$func( $args, $c[0]->line );
352 - } else {
353 - $type = $c[0]->mChildren[0]->value;
354 - switch( $type ) {
355 - case 'isset':
356 - $val = $this->getVar( $c[2], $rec, true );
357 - return new ISData( ISData::DBool, $val !== null );
358 - case 'delete':
359 - $this->deleteVar( $c[2], $rec );
360 - return new ISData();
361 - default:
362 - throw new ISException( "Unknown keyword: {$type}" );
363 - }
364 - }
365 - case 'expratom':
366 - if( $c[0] instanceof ISParserTreeNode ) {
367 - if( $c[0]->getType() == 'atom' ) {
368 - list( $val ) = $c[0]->getChildren();
369 - switch( $val->type ) {
370 - case 'string':
371 - return new ISData( ISData::DString, $val->value );
372 - case 'int':
373 - return new ISData( ISData::DInt, $val->value );
374 - case 'float':
375 - return new ISData( ISData::DFloat, $val->value );
376 - case 'true':
377 - return new ISData( ISData::DBool, true );
378 - case 'false':
379 - return new ISData( ISData::DBool, false );
380 - case 'null':
381 - return new ISData();
382 - }
383 - } else {
384 - return $this->getVar( $c[0], $rec );
385 - }
386 - } else {
387 - switch( $c[0]->type ) {
388 - case 'leftbracket':
389 - return $this->evaluateNode( $c[1], $rec + 1 );
390 - case 'leftsquare':
391 - case 'leftcurly':
392 - $arraytype = null;
393 - $array = $this->parseArray( $c[1], $rec + 1, $arraytype );
394 - return new ISData( $arraytype, $array );
395 - case 'break':
396 - throw new ISUserVisibleException( 'break', $c[0]->line );
397 - case 'continue':
398 - throw new ISUserVisibleException( 'continue', $c[0]->line );
399 - }
400 - }
401 - default:
402 - $type = $node->getType();
403 - throw new ISException( "Invalid node type passed to evaluateNode(): {$type}" );
 208+ $module = $this->getModule( $moduleTitle );
 209+ if( !$module ) {
 210+ throw new ISUserVisibleException( 'nonexistent-module', $parentContext->mModuleName, $line, array( $moduleName ) );
 211+ }
404212 }
405 - }
406213
407 - /*
408 - * Converts commaList* to a PHP array.
409 - */
410 - protected function parseArray( $node, $rec, &$arraytype ) {
411 - $c = $node->getChildren();
412 - $type = $node->getType();
413 - if( $type == 'commalist' ) {
414 - return $this->parseArray( $c[0], $rec, $arraytype );
 214+ // Load the function and handle possible errors
 215+ $function = $module->getFunction( $name );
 216+ if( !$function ) {
 217+ throw new ISUserVisibleException( 'unknownfunction-user', $parentContext->mModuleName, $line, array( $moduleName, $name ) );
415218 }
 219+ if( count( $args ) < $function->getMinArgCount() ) {
 220+ throw new ISUserVisibleException( 'notenoughargs-user', $parentContext->mModuleName, $line, array( $moduleName, $name ) );
 221+ }
 222+ if( !$wgInlineScriptsAllowRecursion && $this->mCallStack->contains( $moduleName, $name ) ) {
 223+ throw new ISUserVisibleException( 'recursion', $parentContext->mModuleName, $line, array( $moduleName, $name ) );
 224+ }
416225
417 - wfProfileIn( __METHOD__ );
418 -
419 - // <commaListWhatever> ::= <commaListWhatever> comma <expr> | <expr>
420 - $elements = $result = array();
421 - while( isset( $c[2] ) ) {
422 - array_unshift( $elements, $c[2] );
423 - $c = $c[0]->getChildren();
 226+ // Prepare the context and the arguments
 227+ $context = new ISEvaluationContext( $this, $module, $name, $parentContext->getFrame() );
 228+ foreach( $args as $n => $arg ) {
 229+ if( isset( $function->args[$n] ) ) {
 230+ $argname = $function->args[$n];
 231+ $context->setArgument( $argname, $arg );
 232+ }
424233 }
425 - array_unshift( $elements, $c[0] );
426234
427 - switch( $type ) {
428 - case 'commalistplain':
429 - foreach( $elements as $elem ) {
430 - $result[] = $this->evaluateNode( $elem, $rec + 1 );
431 - }
 235+ // Push function into call stack
 236+ $this->mCallStack->addFunctionFromModule( $moduleName, $name, $parentContext->mModuleName, $line );
432237
433 - $arraytype = ISData::DList;
434 - wfProfileOut( __METHOD__ );
435 - return $result;
 238+ // Finally execute it!
 239+ $result = $this->doInvokeFunction( $function, $context );
436240
437 - case 'commalistassoc':
438 - foreach( $elements as $elem ) {
439 - //<keyValue> ::= <expr> colon <expr>
440 - list( $key, $crap, $value ) = $elem->getChildren();
441 - $key = $this->evaluateNode( $key, $rec + 1 );
442 - $value = $this->evaluateNode( $value, $rec + 1 );
443 - $result[ $key->toString() ] = $value;
444 - }
445 -
446 - $arraytype = ISData::DAssoc;
447 - wfProfileOut( __METHOD__ );
448 - return $result;
449 - }
 241+ // Pop out of the call stack and return
 242+ $this->mCallStack->pop();
 243+ return $result;
450244 }
451245
452246 /**
453 - * Returns a value of the variable in $lval. If $nullIfNotSet is set to true,
454 - * returns null if variable does not exist, otherwise throws an exception.
 247+ * Invokes the user function from wikitext.
 248+ *
 249+ * @param $module string The name of the module
 250+ * @param $name string Name of the function
 251+ * @param $args array(string) Arguments of the function
 252+ * @param $frame PPFrame The parser frame from which the function was invoked
 253+ * @return string
455254 */
456 - protected function getVar( $lval, $rec, $nullIfNotSet = false ) {
457 - // <lvalue> ::= id | <lvalue> <arrayIdx>
458 - // <arrayIdx> ::= leftsquare <expr> rightsquare | leftsquare rightsquare
 255+ public function invokeUserFunctionFromWikitext( $moduleName, $name, $args, $frame ) {
 256+ global $wgInlineScriptsAllowRecursion;
459257
460 - if( !$this->mInterpreter->checkRecursionLimit( $rec ) ) {
461 - throw new ISUserVisibleException( 'recoverflow', 0 );
 258+ // Load module
 259+ $moduleTitle = Title::makeTitleSafe( NS_MODULE, $moduleName );
 260+ if( !$moduleTitle instanceof Title || $moduleTitle->getNamespace() != NS_MODULE ) {
 261+ throw new ISTransclusionException( 'nonexistent-module', array( $moduleName ) );
462262 }
463263
464 - $c = $lval->getChildren();
465 - if( $c[0] instanceof ISToken ) {
466 - $varname = $c[0]->value;
467 - if( !isset( $this->mVars[$varname] ) ) {
468 - if( $nullIfNotSet )
469 - return null;
470 - else
471 - throw new ISUserVisibleException( 'unknownvar', $c[0]->line, array( $varname ) );
472 - }
473 - return $this->mVars[$varname];
474 - } else {
475 - $idxchildren = $c[1]->getChildren();
476 - $var = $this->getVar( $c[0], $rec + 1, $nullIfNotSet );
477 - if( $nullIfNotSet && $var === null )
478 - return null;
479 -
480 - if( count( $idxchildren ) == 2 ) {
481 - // x = a[]. a[] is still legitimage in a[] = x
482 - throw new ISUserVisibleException( 'emptyidx', $idxchildren[0]->line );
483 - }
484 -
485 - switch( $var->type ) {
486 - case ISData::DList:
487 - $idx = $this->evaluateNode( $idxchildren[1], $rec + 1 )->toInt();
488 - if( $idx >= count( $var->data ) ) {
489 - if( $nullIfNotSet )
490 - return null;
491 - else
492 - throw new ISUserVisibleException( 'outofbounds', $idxchildren[0]->line );
493 - }
494 - return $var->data[$idx];
495 - case ISData::DAssoc:
496 - $idx = $this->evaluateNode( $idxchildren[1], $rec + 1 )->toString();
497 - if( !isset( $var->data[$idx] ) ) {
498 - if( $nullIfNotSet )
499 - return null;
500 - else
501 - throw new ISUserVisibleException( 'outofbounds', $idxchildren[0]->line );
502 - }
503 - return $var->data[$idx];
504 - default:
505 - throw new ISUserVisibleException( 'notanarray', $idxchildren[0]->line );
506 - }
 264+ $module = $this->getModule( $moduleTitle );
 265+ if( !$module ) {
 266+ throw new ISTransclusionException( 'nonexistent-module', array( $moduleName ) );
507267 }
508 - }
509268
510 - /**
511 - * Gets the line of the first terminal in the node.
512 - */
513 - protected function getLine( $node ) {
514 - while( $node instanceof ISParserTreeNode ) {
515 - $children = $node->getChildren();
516 - $node = $children[0];
 269+ // Load the function and handle possible errors
 270+ $function = $module->getFunction( $name );
 271+ if( !$function ) {
 272+ throw new ISTransclusionException( 'unknownfunction-user', array( $moduleName, $name ) );
517273 }
518 - return $node->line;
519 - }
520 -
521 - /**
522 - * Changes the value of variable or array element specified in $lval to $newval.
523 - */
524 - protected function setVar( $lval, $newval, $rec ) {
525 - $var = &$this->setVarGetRef( $lval, $rec );
526 - $var = $newval;
527 - unset( $var );
528 - }
529 -
530 - /**
531 - * Recursive function that return the link to the place
532 - * where the new value of the variable must be set.
533 - */
534 - protected function &setVarGetRef( $lval, $rec ) {
535 - if( !$this->mInterpreter->checkRecursionLimit( $rec ) ) {
536 - throw new ISUserVisibleException( 'recoverflow', 0 );
 274+ if( count( $args ) < $function->getMinArgCount() ) {
 275+ throw new ISTransclusionException( 'notenoughargs-user', array( $moduleName, $name ) );
537276 }
 277+ if( !$wgInlineScriptsAllowRecursion && $this->mCallStack->contains( $moduleName, $name ) ) {
 278+ throw new ISTransclusionException( 'recursion', array( $moduleName, $name ) );
 279+ }
538280
539 - $c = $lval->getChildren();
540 - if( count( $c ) == 1 ) {
541 - if( !isset( $this->mVars[ $c[0]->value ] ) )
542 - $this->mVars[ $c[0]->value ] = new ISPlaceholder();
543 - return $this->mVars[ $c[0]->value ];
544 - } else {
545 - $ref = &$this->setVarGetRef( $c[0], $rec + 1 );
546 -
547 - // <arrayIdx> ::= leftsquare <expr> rightsquare | leftsquare rightsquare
548 - $idxc = $c[1]->getChildren();
549 - if( $ref instanceof ISPlaceholder ) {
550 - if( count( $idxc ) > 2 ) {
551 - $index = $this->evaluateNode( $idxc[1], $rec + 1 );
552 - if( $index->type == ISData::DInt )
553 - $ref = new ISData( ISData::DList, array() );
554 - else
555 - $ref = new ISData( ISData::DAssoc, array() );
556 - } else {
557 - $ref = new ISData( ISData::DList, array() );
558 - }
 281+ // Prepare the context and the arguments
 282+ $context = new ISEvaluationContext( $this, $module, $name, $frame );
 283+ foreach( $args as $n => $arg ) {
 284+ if( isset( $function->args[$n] ) ) {
 285+ $argname = $function->args[$n];
 286+ $context->setArgument( $argname, new ISData( ISData::DString, strval( $arg ) ) );
559287 }
 288+ }
560289
561 - switch( $ref->type ) {
562 - case ISData::DList:
563 - if( count( $idxc ) > 2 ) {
564 - if( !isset( $index ) )
565 - $index = $this->evaluateNode( $idxc[1], $rec + 1 );
566 - $key = $index->toInt();
 290+ // Push function into call stack
 291+ $this->mCallStack->addFunctionFromWikitext( $moduleName, $name );
567292
568 - if( $key < 0 || $key > count( $ref->data ) )
569 - throw new ISUserVisibleException( 'outofbounds', $idxc[0]->line );
570 - } else {
571 - $key = count( $ref->data );
572 - }
 293+ // Finally execute it!
 294+ $result = $this->doInvokeFunction( $function, $context );
573295
574 - if( !isset( $ref->data[$key] ) )
575 - $ref->data[$key] = new ISPlaceholder();
 296+ // Pop out of the call stack and return
 297+ $this->mCallStack->pop();
 298+ return $result->toString();
 299+ }
576300
577 - return $ref->data[$key];
578 - case ISData::DAssoc:
579 - if( count( $idxc ) > 2 ) {
580 - if( !isset( $index ) )
581 - $index = $this->evaluateNode( $idxc[1], $rec + 1 );
582 - $key = $index->toString();
 301+ protected function doInvokeFunction( $function, $context ) {
 302+ // Indicates whether the data from append/yield should be used
 303+ $useOutput = true;
 304+ $result = new ISData();
583305
584 - if( !isset( $ref->data[$key] ) )
585 - $ref->data[$key] = new ISPlaceholder();
586 - return $ref->data[$key];
587 - } else {
588 - throw new ISUserVisibleException( 'notlist', $idxc[0]->line );
589 - }
590 - break;
591 - default:
592 - throw new ISUserVisibleException( 'notanarray', $idxc[0]->line );
 306+ try {
 307+ $context->evaluateNode( $function->body, 0 );
 308+ } catch( ISException $e ) {
 309+ if( $e instanceof ISReturnException ) {
 310+ $result = $e->getResult();
 311+ $useOutput = $e->isEmpty();
 312+ } else {
 313+ $this->mCallStack->pop();
 314+ throw $e;
593315 }
594316 }
595 - }
596317
597 - protected function getValueForSetting( $old, $new, $set, $line ) {
598 - switch( $set ) {
599 - case '+=':
600 - return ISData::sum( $old, $new );
601 - case '-=':
602 - return ISData::sub( $old, $new );
603 - case '*=':
604 - return ISData::mulRel( $old, $new, '*', $line );
605 - case '/=':
606 - return ISData::mulRel( $old, $new, '/', $line );
607 - default:
608 - return $new;
 318+ if( $useOutput ) {
 319+ $result = $context->getOutput();
609320 }
610 - }
611321
612 - protected function checkParamsCount( $args, $pos, $count ) {
613 - if( count( $args ) < $count )
614 - throw new ISUserVisibleException( 'notenoughargs', $pos );
 322+ return $result;
615323 }
616 -
617 - protected function deleteVar( $lval, $rec ) {
618 - $c = $lval->getChildren();
619 - $line = $c[0]->line;
620 - $varname = $c[0]->value;
621 - if( isset( $c[1] ) ) {
622 - throw new ISException( 'delete() is not usable for array elements' );
623 - }
624 - unset( $this->mVars[$varname] );
625 - }
 324+}
626325
627 - /** Functions */
628 - protected function funcOut( $args, $pos ) {
629 - $this->checkParamsCount( $args, $pos, 1 );
630 -
631 - for( $i = 0; $i < count( $args ); $i++ )
632 - $args[$i] = $args[$i]->toString();
633 - $str = implode( "\n", $args );
634 - $this->mOut .= $str;
635 - return new ISData();
636 - }
637 -
638 - protected function funcArg( $args, $pos ) {
639 - $this->checkParamsCount( $args, $pos, 1 );
640 -
641 - $argName = $args[0]->toString();
642 - $default = isset( $args[1] ) ? $args[1] : new ISData();
643 - if( $this->mFrame->getArgument( $argName ) === false )
644 - return $default;
645 - else
646 - return new ISData( ISData::DString, $this->mFrame->getArgument( $argName ) );
647 - }
648 -
649 - protected function funcArgs( $args, $pos ) {
650 - return ISData::newFromPHPVar( $this->mFrame->getNumberedArguments() );
651 - }
652 -
653 - protected function funcIsTranscluded( $args, $pos ) {
654 - return new ISData( ISData::DBool, $this->mFrame->isTemplate() );
655 - }
656 -
657 - protected function funcParse( $args, $pos ) {
658 - $this->checkParamsCount( $args, $pos, 1 );
659 -
660 - $text = $args[0]->toString();
661 - $oldOT = $this->mParser->mOutputType;
662 - $this->mParser->setOutputType( Parser::OT_PREPROCESS );
663 - $parsed = $this->mParser->replaceVariables( $text, $this->mFrame );
664 - $parsed = $this->mParser->mStripState->unstripBoth( $parsed );
665 - $this->mParser->setOutputType( $oldOT );
666 - return new ISData( ISData::DString, $parsed );
667 - }
 326+/**
 327+ * Represents an individual module.
 328+ */
 329+class ISModule {
 330+ var $mTitle, $mFunctions, $mParserVersion;
668331
669 - protected function funcLc( $args, $pos ) {
670 - global $wgContLang;
671 - $this->checkParamsCount( $args, $pos, 1 );
672 - return new ISData( ISData::DString, $wgContLang->lc( $args[0]->toString() ) );
673 - }
 332+ protected function __construct() {}
674333
675 - protected function funcUc( $args, $pos ) {
676 - global $wgContLang;
677 - $this->checkParamsCount( $args, $pos, 1 );
678 - return new ISData( ISData::DString, $wgContLang->uc( $args[0]->toString() ) );
679 - }
 334+ /**
 335+ * Initializes module from the code parser output.
 336+ */
 337+ public static function newFromParserOutput( $interpreter, $title, $output ) {
 338+ $m = new ISModule();
 339+ $m->mTitle = $title;
 340+ $m->mParserVersion = $output->getVersion();
 341+ $m->mFunctions = array();
680342
681 - protected function funcUcFirst( $args, $pos ) {
682 - global $wgContLang;
683 - $this->checkParamsCount( $args, $pos, 1 );
684 - return new ISData( ISData::DString, $wgContLang->ucfirst( $args[0]->toString() ) );
685 - }
 343+ $cur = $output->getParserTree();
 344+ for( ; ; ) {
 345+ $curch = $cur->getChildren();
 346+ $funcnode = $curch[0];
686347
687 - protected function funcUrlencode( $args, $pos ) {
688 - $this->checkParamsCount( $args, $pos, 1 );
689 - return new ISData( ISData::DString, urlencode( $args[0]->toString() ) );
690 - }
 348+ // <function> ::= function id leftbracket <arglist> rightbracket leftcurly <stmts> rightcurly (total 8)
 349+ // <function> ::= function id leftbracket rightbracket leftcurly <stmts> rightcurly (total 7)
 350+ $c = $funcnode->getChildren();
 351+ $func = new ISFunction();
 352+ $func->name = $c[1]->value;
691353
692 - protected function funcAnchorEncode( $args, $pos ) {
693 - $this->checkParamsCount( $args, $pos, 1 );
 354+ if( $funcnode->getChildrenCount() == 8 ) {
 355+ $func->body = $c[6];
 356+ $func->args = self::parseArgs( $c[3] );
 357+ } else {
 358+ $func->body = $c[5];
 359+ $func->args = array();
 360+ }
 361+ $m->mFunctions[$func->name] = $func;
694362
695 - $s = urlencode( $args[0]->toString() );
696 - $s = strtr( $s, array( '%' => '.', '+' => '_' ) );
697 - $s = str_replace( '.3A', ':', $s );
698 -
699 - return new ISData( ISData::DString, $s );
 363+ if( $cur->hasSingleChild() )
 364+ break;
 365+ else
 366+ $cur = $curch[1];
 367+ }
 368+
 369+ return $m;
700370 }
701371
702 - protected function funcGrammar( $args, $pos ) {
703 - $this->checkParamsCount( $args, $pos, 2 );
704 - list( $case, $word ) = $args;
705 - $res = $this->mParser->getFunctionLang()->convertGrammar(
706 - $word->toString(), $case->toString() );
707 - return new ISData( ISData::DString, $res );
 372+ /**
 373+ * Converts the argument list node into an array.
 374+ */
 375+ private static function parseArgs( $argsnode ) {
 376+ $args = array();
 377+ $cur = $argsnode;
 378+ for( ; ; ) {
 379+ $c = $cur->getChildren();
 380+ $args[] = $c[0]->value;
 381+
 382+ if( $cur->hasSingleChild() )
 383+ break;
 384+ else
 385+ $cur = $c[2];
 386+ }
 387+ return $args;
708388 }
709389
710 - protected function funcPlural( $args, $pos ) {
711 - $this->checkParamsCount( $args, $pos, 2 );
712 - $num = $args[0]->toInt();
713 - for( $i = 1; $i < count( $args ); $i++ )
714 - $forms[] = $args[$i]->toString();
715 - $res = $this->mParser->getFunctionLang()->convertPlural( $num, $forms );
716 - return new ISData( ISData::DString, $res );
 390+ /**
 391+ * Gets the cache key for a module.
 392+ */
 393+ public static function getCacheKey( $title ) {
 394+ return 'scripts:module:' . sha1( $title->getText() );
717395 }
718396
719 - protected function funcStrlen( $args, $pos ) {
720 - $this->checkParamsCount( $args, $pos, 1 );
721 - return new ISData( ISData::DInt, mb_strlen( $args[0]->toString() ) );
 397+ /**
 398+ * Returns the name of a module.
 399+ */
 400+ public function getName() {
 401+ return $this->mTitle->getText();
722402 }
723403
724 - protected function funcSubstr( $args, $pos ) {
725 - $this->checkParamsCount( $args, $pos, 3 );
726 - $s = $args[0]->toString();
727 - $start = $args[1]->toInt();
728 - $end = $args[2]->toInt();
729 - return new ISData( ISData::DString, mb_substr( $s, $start, $end ) );
 404+ /**
 405+ * Returns the title of a module.
 406+ */
 407+ public function getTitle() {
 408+ return $this->mTitle;
730409 }
731410
732 - protected function funcStrreplace( $args, $pos ) {
733 - $this->checkParamsCount( $args, $pos, 3 );
734 - $s = $args[0]->toString();
735 - $old = $args[1]->toString();
736 - $new = $args[2]->toString();
737 - return new ISData( ISData::DString, str_replace( $old, $new, $s ) );
 411+ /**
 412+ * Returns a specific function or null if it does not exist.
 413+ */
 414+ public function getFunction( $name ) {
 415+ if( isset( $this->mFunctions[$name] ) )
 416+ return $this->mFunctions[$name];
 417+ else
 418+ return null;
738419 }
739420
740 - protected function funcSplit( $args, $pos ) {
741 - $this->checkParamsCount( $args, $pos, 2 );
742 - $list = explode( $args[0]->toString(), $args[1]->toString() );
743 - return ISData::newFromPHPVar( $list );
 421+ /**
 422+ * Returns whether the module should be reparsed or not.
 423+ */
 424+ public function isOutOfDate() {
 425+ global $wgInlineScriptsParserClass;
 426+ return $wgInlineScriptsParserClass::getVersion() != $this->mParserVersion;
744427 }
 428+}
745429
746 - protected function funcJoin( $args, $pos ) {
747 - $this->checkParamsCount( $args, $pos, 2 );
748 - $seperator = $args[0]->toString();
749 - if( $args[1]->type == ISData::DList ) {
750 - $bits = $args[1]->data;
751 - } else {
752 - $bits = array_slice( $args, 1 );
753 - }
754 - foreach( $bits as &$bit )
755 - $bit = $bit->toString();
756 - return new ISData( ISData::DString, implode( $seperator, $bits ) );
757 - }
758 -
759 - protected function funcCount( $args, $pos ) {
760 - $this->checkParamsCount( $args, $pos, 1 );
761 - return new ISData( ISData::DInt, count( $args[0]->toList()->data ) );
762 - }
763 -
764 - protected function castString( $args, $pos ) {
765 - $this->checkParamsCount( $args, $pos, 1 );
766 - return ISData::castTypes( $args[0], ISData::DString );
767 - }
 430+/**
 431+ * Represents a function.
 432+ */
 433+class ISFunction {
 434+ public $name;
 435+ public $args;
 436+ public $body;
768437
769 - protected function castInt( $args, $pos ) {
770 - $this->checkParamsCount( $args, $pos, 1 );
771 - return ISData::castTypes( $args[0], ISData::DInt );
 438+ public function getMinArgCount() {
 439+ return count( $this->args );
772440 }
773 -
774 - protected function castFloat( $args, $pos ) {
775 - $this->checkParamsCount( $args, $pos, 1 );
776 - return ISData::castTypes( $args[0], ISData::DFloat );
777 - }
778 -
779 - protected function castBool( $args, $pos ) {
780 - $this->checkParamsCount( $args, $pos, 1 );
781 - return ISData::castTypes( $args[0], ISData::DBool );
782 - }
783441 }
Index: trunk/extensions/InlineScripts/interpreter/LRTable.php
——@@ -19,614 +19,711 @@
2020 * * $productions is a ID -> array( nonterminal, body ) map.
2121 * * Production body is an array of production symbols
2222 *
23 - * Generated on 2011-08-06 07:13.
 23+ * Generated on 2011-08-13 21:53:42.
2424 */
2525
2626 class ISLRTable {
2727
28 -const Timestamp = '2011-08-06 07:13';
 28+const Timestamp = '2011-08-13 21:53:42';
2929
3030 static $nonterminals = array(
31 - 0 => 'program',
32 - 1 => 'stmts',
33 - 2 => 'stmt',
34 - 3 => 'expr',
35 - 4 => 'forlvalue',
36 - 5 => 'lvalue',
37 - 6 => 'exprset',
38 - 7 => 'exprtrinary',
39 - 8 => 'exprlogical',
40 - 9 => 'exprcompare',
41 - 10 => 'exprequals',
42 - 11 => 'exprsum',
43 - 12 => 'exprmul',
44 - 13 => 'exprpow',
45 - 14 => 'exprinvert',
46 - 15 => 'exprkeyword',
47 - 16 => 'exprunary',
48 - 17 => 'exprfunction',
49 - 18 => 'commalistplain',
50 - 19 => 'varfunc',
51 - 20 => 'expratom',
52 - 21 => 'atom',
53 - 22 => 'commalistassoc',
54 - 23 => 'keyvalue',
55 - 24 => 'arrayidx',
 31+ 0 => 'module',
 32+ 1 => 'functions',
 33+ 2 => 'function',
 34+ 3 => 'args',
 35+ 4 => 'stmts',
 36+ 5 => 'stmt',
 37+ 6 => 'expr',
 38+ 7 => 'forlvalue',
 39+ 8 => 'lvalue',
 40+ 9 => 'exprreturn',
 41+ 10 => 'exprset',
 42+ 11 => 'exprtrinary',
 43+ 12 => 'exprlogical',
 44+ 13 => 'exprcompare',
 45+ 14 => 'exprequals',
 46+ 15 => 'exprsum',
 47+ 16 => 'exprmul',
 48+ 17 => 'exprpow',
 49+ 18 => 'exprinvert',
 50+ 19 => 'exprkeyword',
 51+ 20 => 'exprunary',
 52+ 21 => 'exprfunction',
 53+ 22 => 'funcid',
 54+ 23 => 'commalistplain',
 55+ 24 => 'varfunc',
 56+ 25 => 'expratom',
 57+ 26 => 'atom',
 58+ 27 => 'commalistassoc',
 59+ 28 => 'keyvalue',
 60+ 29 => 'arrayidx',
5661 );
5762
5863 static $productions = array(
5964 0 => array( 0, array( 1 ) ),
60 - 1 => array( 1, array( 1, 2 ) ),
 65+ 1 => array( 1, array( 2, 1 ) ),
6166 2 => array( 1, array( 2 ) ),
62 - 3 => array( 2, array( 3, 'semicolon' ) ),
63 - 4 => array( 2, array( 'if', 'leftbracket', 3, 'rightbracket', 2 ) ),
64 - 5 => array( 2, array( 'if', 'leftbracket', 3, 'rightbracket', 2, 'else', 2 ) ),
65 - 6 => array( 2, array( 'for', 'leftbracket', 4, 'in', 3, 'rightbracket', 2 ) ),
66 - 7 => array( 2, array( 'try', 2, 'catch', 'leftbracket', 5, 'rightbracket', 2 ) ),
67 - 8 => array( 2, array( 'leftcurly', 1, 'rightcurly' ) ),
68 - 9 => array( 3, array( 6 ) ),
69 - 10 => array( 6, array( 5, 'setto', 6 ) ),
70 - 11 => array( 6, array( 7 ) ),
71 - 12 => array( 7, array( 8, 'trinary', 7, 'colon', 7 ) ),
72 - 13 => array( 7, array( 8 ) ),
73 - 14 => array( 8, array( 8, 'logicop', 9 ) ),
74 - 15 => array( 8, array( 9 ) ),
75 - 16 => array( 9, array( 9, 'compareop', 10 ) ),
76 - 17 => array( 9, array( 10 ) ),
77 - 18 => array( 10, array( 11, 'equalsto', 11 ) ),
78 - 19 => array( 10, array( 11 ) ),
79 - 20 => array( 11, array( 11, 'sum', 12 ) ),
80 - 21 => array( 11, array( 12 ) ),
81 - 22 => array( 12, array( 12, 'mul', 13 ) ),
82 - 23 => array( 12, array( 13 ) ),
83 - 24 => array( 13, array( 14, 'pow', 13 ) ),
84 - 25 => array( 13, array( 14 ) ),
85 - 26 => array( 14, array( 'invert', 15 ) ),
86 - 27 => array( 14, array( 15 ) ),
87 - 28 => array( 15, array( 16, 'in', 16 ) ),
88 - 29 => array( 15, array( 16, 'contains', 16 ) ),
89 - 30 => array( 15, array( 16 ) ),
90 - 31 => array( 16, array( 'sum', 17 ) ),
91 - 32 => array( 16, array( 17 ) ),
92 - 33 => array( 17, array( 'id', 'leftbracket', 18, 'rightbracket' ) ),
93 - 34 => array( 17, array( 'id', 'leftbracket', 'rightbracket' ) ),
94 - 35 => array( 17, array( 19, 'leftbracket', 5, 'rightbracket' ) ),
95 - 36 => array( 17, array( 20 ) ),
96 - 37 => array( 20, array( 5 ) ),
97 - 38 => array( 20, array( 21 ) ),
98 - 39 => array( 20, array( 'break' ) ),
99 - 40 => array( 20, array( 'continue' ) ),
100 - 41 => array( 20, array( 'leftbracket', 3, 'rightbracket' ) ),
101 - 42 => array( 20, array( 'leftsquare', 18, 'rightsquare' ) ),
102 - 43 => array( 20, array( 'leftcurly', 22, 'rightcurly' ) ),
103 - 44 => array( 19, array( 'isset' ) ),
104 - 45 => array( 19, array( 'delete' ) ),
105 - 46 => array( 18, array( 18, 'comma', 3 ) ),
106 - 47 => array( 18, array( 3 ) ),
107 - 48 => array( 22, array( 22, 'comma', 23 ) ),
108 - 49 => array( 22, array( 23 ) ),
109 - 50 => array( 23, array( 3, 'colon', 3 ) ),
110 - 51 => array( 21, array( 'string' ) ),
111 - 52 => array( 21, array( 'int' ) ),
112 - 53 => array( 21, array( 'float' ) ),
113 - 54 => array( 21, array( 'true' ) ),
114 - 55 => array( 21, array( 'false' ) ),
115 - 56 => array( 21, array( 'null' ) ),
116 - 57 => array( 5, array( 'id' ) ),
117 - 58 => array( 5, array( 5, 24 ) ),
118 - 59 => array( 24, array( 'leftsquare', 3, 'rightsquare' ) ),
119 - 60 => array( 24, array( 'leftsquare', 'rightsquare' ) ),
120 - 61 => array( 4, array( 5 ) ),
121 - 62 => array( 4, array( 5, 'colon', 5 ) ),
 67+ 3 => array( 2, array( 'function', 'id', 'leftbracket', 3, 'rightbracket', 'leftcurly', 4, 'rightcurly' ) ),
 68+ 4 => array( 2, array( 'function', 'id', 'leftbracket', 'rightbracket', 'leftcurly', 4, 'rightcurly' ) ),
 69+ 5 => array( 3, array( 'id', 'comma', 3 ) ),
 70+ 6 => array( 3, array( 'id' ) ),
 71+ 7 => array( 4, array( 4, 5 ) ),
 72+ 8 => array( 4, array( 5 ) ),
 73+ 9 => array( 5, array( 6, 'semicolon' ) ),
 74+ 10 => array( 5, array( 'if', 'leftbracket', 6, 'rightbracket', 5 ) ),
 75+ 11 => array( 5, array( 'if', 'leftbracket', 6, 'rightbracket', 5, 'else', 5 ) ),
 76+ 12 => array( 5, array( 'for', 'leftbracket', 7, 'in', 6, 'rightbracket', 5 ) ),
 77+ 13 => array( 5, array( 'try', 5, 'catch', 'leftbracket', 8, 'rightbracket', 5 ) ),
 78+ 14 => array( 5, array( 'leftcurly', 4, 'rightcurly' ) ),
 79+ 15 => array( 6, array( 9 ) ),
 80+ 16 => array( 9, array( 'return' ) ),
 81+ 17 => array( 9, array( 'return', 10 ) ),
 82+ 18 => array( 9, array( 10 ) ),
 83+ 19 => array( 9, array( 'append', 10 ) ),
 84+ 20 => array( 9, array( 'yield', 10 ) ),
 85+ 21 => array( 10, array( 8, 'setto', 10 ) ),
 86+ 22 => array( 10, array( 11 ) ),
 87+ 23 => array( 11, array( 12, 'trinary', 11, 'colon', 11 ) ),
 88+ 24 => array( 11, array( 12 ) ),
 89+ 25 => array( 12, array( 12, 'logicop', 13 ) ),
 90+ 26 => array( 12, array( 13 ) ),
 91+ 27 => array( 13, array( 13, 'compareop', 14 ) ),
 92+ 28 => array( 13, array( 14 ) ),
 93+ 29 => array( 14, array( 15, 'equalsto', 15 ) ),
 94+ 30 => array( 14, array( 15 ) ),
 95+ 31 => array( 15, array( 15, 'sum', 16 ) ),
 96+ 32 => array( 15, array( 16 ) ),
 97+ 33 => array( 16, array( 16, 'mul', 17 ) ),
 98+ 34 => array( 16, array( 17 ) ),
 99+ 35 => array( 17, array( 18, 'pow', 17 ) ),
 100+ 36 => array( 17, array( 18 ) ),
 101+ 37 => array( 18, array( 'invert', 19 ) ),
 102+ 38 => array( 18, array( 19 ) ),
 103+ 39 => array( 19, array( 20, 'in', 20 ) ),
 104+ 40 => array( 19, array( 20, 'contains', 20 ) ),
 105+ 41 => array( 19, array( 20 ) ),
 106+ 42 => array( 20, array( 'sum', 21 ) ),
 107+ 43 => array( 20, array( 21 ) ),
 108+ 44 => array( 21, array( 22, 'leftbracket', 23, 'rightbracket' ) ),
 109+ 45 => array( 21, array( 22, 'leftbracket', 'rightbracket' ) ),
 110+ 46 => array( 21, array( 24, 'leftbracket', 8, 'rightbracket' ) ),
 111+ 47 => array( 21, array( 25 ) ),
 112+ 48 => array( 25, array( 8 ) ),
 113+ 49 => array( 25, array( 26 ) ),
 114+ 50 => array( 25, array( 'break' ) ),
 115+ 51 => array( 25, array( 'continue' ) ),
 116+ 52 => array( 25, array( 'leftbracket', 6, 'rightbracket' ) ),
 117+ 53 => array( 25, array( 'leftsquare', 23, 'rightsquare' ) ),
 118+ 54 => array( 25, array( 'leftcurly', 27, 'rightcurly' ) ),
 119+ 55 => array( 24, array( 'isset' ) ),
 120+ 56 => array( 24, array( 'delete' ) ),
 121+ 57 => array( 22, array( 'id' ) ),
 122+ 58 => array( 22, array( 25, 'doublecolon', 'id' ) ),
 123+ 59 => array( 22, array( 'self', 'doublecolon', 'id' ) ),
 124+ 60 => array( 23, array( 23, 'comma', 6 ) ),
 125+ 61 => array( 23, array( 6 ) ),
 126+ 62 => array( 27, array( 27, 'comma', 28 ) ),
 127+ 63 => array( 27, array( 28 ) ),
 128+ 64 => array( 28, array( 6, 'colon', 6 ) ),
 129+ 65 => array( 26, array( 'string' ) ),
 130+ 66 => array( 26, array( 'int' ) ),
 131+ 67 => array( 26, array( 'float' ) ),
 132+ 68 => array( 26, array( 'true' ) ),
 133+ 69 => array( 26, array( 'false' ) ),
 134+ 70 => array( 26, array( 'null' ) ),
 135+ 71 => array( 8, array( 'id' ) ),
 136+ 72 => array( 8, array( 8, 29 ) ),
 137+ 73 => array( 29, array( 'leftsquare', 6, 'rightsquare' ) ),
 138+ 74 => array( 29, array( 'leftsquare', 'rightsquare' ) ),
 139+ 75 => array( 7, array( 8 ) ),
 140+ 76 => array( 7, array( 8, 'colon', 8 ) ),
122141 );
123142
124143 static $action = array(
125144 0 => array(
126 - 'if' => array( 0, 1 ),
127 - 'for' => array( 0, 3 ),
128 - 'try' => array( 0, 4 ),
129 - 'leftcurly' => array( 0, 5 ),
130 - 'id' => array( 0, 8 ),
131 - 'invert' => array( 0, 7 ),
132 - 'sum' => array( 0, 6 ),
133 - 'isset' => array( 0, 12 ),
134 - 'delete' => array( 0, 13 ),
135 - 'break' => array( 0, 9 ),
136 - 'continue' => array( 0, 10 ),
137 - 'leftbracket' => array( 0, 2 ),
138 - 'leftsquare' => array( 0, 11 ),
139 - 'string' => array( 0, 14 ),
140 - 'int' => array( 0, 15 ),
141 - 'float' => array( 0, 16 ),
142 - 'true' => array( 0, 17 ),
143 - 'false' => array( 0, 18 ),
144 - 'null' => array( 0, 19 ),
 145+ 'function' => array( 0, 1 ),
145146 ),
146147 1 => array(
147 - 'leftbracket' => array( 0, 39 ),
 148+ 'id' => array( 0, 4 ),
148149 ),
149150 2 => array(
150 - 'id' => array( 0, 8 ),
151 - 'invert' => array( 0, 7 ),
152 - 'sum' => array( 0, 6 ),
153 - 'isset' => array( 0, 12 ),
154 - 'delete' => array( 0, 13 ),
155 - 'break' => array( 0, 9 ),
156 - 'continue' => array( 0, 10 ),
157 - 'leftbracket' => array( 0, 2 ),
158 - 'leftsquare' => array( 0, 11 ),
159 - 'leftcurly' => array( 0, 40 ),
160 - 'string' => array( 0, 14 ),
161 - 'int' => array( 0, 15 ),
162 - 'float' => array( 0, 16 ),
163 - 'true' => array( 0, 17 ),
164 - 'false' => array( 0, 18 ),
165 - 'null' => array( 0, 19 ),
 151+ '$' => array( 2, null ),
166152 ),
167153 3 => array(
168 - 'leftbracket' => array( 0, 42 ),
 154+ '$' => array( 1, 2 ),
 155+ 'function' => array( 0, 1 ),
169156 ),
170157 4 => array(
171 - 'if' => array( 0, 1 ),
172 - 'for' => array( 0, 3 ),
173 - 'try' => array( 0, 4 ),
174 - 'leftcurly' => array( 0, 5 ),
175 - 'id' => array( 0, 8 ),
176 - 'invert' => array( 0, 7 ),
177 - 'sum' => array( 0, 6 ),
178 - 'isset' => array( 0, 12 ),
179 - 'delete' => array( 0, 13 ),
180 - 'break' => array( 0, 9 ),
181 - 'continue' => array( 0, 10 ),
182 - 'leftbracket' => array( 0, 2 ),
183 - 'leftsquare' => array( 0, 11 ),
184 - 'string' => array( 0, 14 ),
185 - 'int' => array( 0, 15 ),
186 - 'float' => array( 0, 16 ),
187 - 'true' => array( 0, 17 ),
188 - 'false' => array( 0, 18 ),
189 - 'null' => array( 0, 19 ),
 158+ 'leftbracket' => array( 0, 6 ),
190159 ),
191160 5 => array(
192 - 'if' => array( 0, 1 ),
193 - 'for' => array( 0, 3 ),
194 - 'try' => array( 0, 4 ),
195 - 'leftcurly' => array( 0, 5 ),
196 - 'id' => array( 0, 8 ),
197 - 'invert' => array( 0, 7 ),
198 - 'sum' => array( 0, 6 ),
199 - 'isset' => array( 0, 12 ),
200 - 'delete' => array( 0, 13 ),
201 - 'break' => array( 0, 9 ),
202 - 'continue' => array( 0, 10 ),
203 - 'leftbracket' => array( 0, 2 ),
204 - 'leftsquare' => array( 0, 11 ),
205 - 'string' => array( 0, 14 ),
206 - 'int' => array( 0, 15 ),
207 - 'float' => array( 0, 16 ),
208 - 'true' => array( 0, 17 ),
209 - 'false' => array( 0, 18 ),
210 - 'null' => array( 0, 19 ),
 161+ '$' => array( 1, 1 ),
211162 ),
212163 6 => array(
213 - 'id' => array( 0, 48 ),
214 - 'isset' => array( 0, 12 ),
215 - 'delete' => array( 0, 13 ),
216 - 'break' => array( 0, 9 ),
217 - 'continue' => array( 0, 10 ),
218 - 'leftbracket' => array( 0, 2 ),
219 - 'leftsquare' => array( 0, 11 ),
220 - 'leftcurly' => array( 0, 40 ),
221 - 'string' => array( 0, 14 ),
222 - 'int' => array( 0, 15 ),
223 - 'float' => array( 0, 16 ),
224 - 'true' => array( 0, 17 ),
225 - 'false' => array( 0, 18 ),
226 - 'null' => array( 0, 19 ),
 164+ 'rightbracket' => array( 0, 8 ),
 165+ 'id' => array( 0, 7 ),
227166 ),
228167 7 => array(
229 - 'sum' => array( 0, 6 ),
230 - 'id' => array( 0, 48 ),
231 - 'isset' => array( 0, 12 ),
232 - 'delete' => array( 0, 13 ),
233 - 'break' => array( 0, 9 ),
234 - 'continue' => array( 0, 10 ),
235 - 'leftbracket' => array( 0, 2 ),
236 - 'leftsquare' => array( 0, 11 ),
237 - 'leftcurly' => array( 0, 40 ),
238 - 'string' => array( 0, 14 ),
239 - 'int' => array( 0, 15 ),
240 - 'float' => array( 0, 16 ),
241 - 'true' => array( 0, 17 ),
242 - 'false' => array( 0, 18 ),
243 - 'null' => array( 0, 19 ),
 168+ 'comma' => array( 0, 10 ),
 169+ 'rightbracket' => array( 1, 6 ),
244170 ),
245171 8 => array(
246 - 'rightbracket' => array( 1, 57 ),
247 - 'setto' => array( 1, 57 ),
248 - 'in' => array( 1, 57 ),
249 - 'pow' => array( 1, 57 ),
250 - 'equalsto' => array( 1, 57 ),
251 - 'trinary' => array( 1, 57 ),
252 - 'semicolon' => array( 1, 57 ),
253 - 'colon' => array( 1, 57 ),
254 - 'logicop' => array( 1, 57 ),
255 - 'compareop' => array( 1, 57 ),
256 - 'sum' => array( 1, 57 ),
257 - 'mul' => array( 1, 57 ),
258 - 'contains' => array( 1, 57 ),
259 - 'leftsquare' => array( 1, 57 ),
260 - 'rightsquare' => array( 1, 57 ),
261 - 'comma' => array( 1, 57 ),
262 - 'rightcurly' => array( 1, 57 ),
263 - 'leftbracket' => array( 0, 52 ),
 172+ 'leftcurly' => array( 0, 11 ),
264173 ),
265174 9 => array(
266 - 'in' => array( 1, 39 ),
267 - 'pow' => array( 1, 39 ),
268 - 'equalsto' => array( 1, 39 ),
269 - 'trinary' => array( 1, 39 ),
270 - 'semicolon' => array( 1, 39 ),
271 - 'rightbracket' => array( 1, 39 ),
272 - 'colon' => array( 1, 39 ),
273 - 'logicop' => array( 1, 39 ),
274 - 'compareop' => array( 1, 39 ),
275 - 'sum' => array( 1, 39 ),
276 - 'mul' => array( 1, 39 ),
277 - 'contains' => array( 1, 39 ),
278 - 'rightsquare' => array( 1, 39 ),
279 - 'comma' => array( 1, 39 ),
280 - 'rightcurly' => array( 1, 39 ),
 175+ 'rightbracket' => array( 0, 12 ),
281176 ),
282177 10 => array(
283 - 'in' => array( 1, 40 ),
284 - 'pow' => array( 1, 40 ),
285 - 'equalsto' => array( 1, 40 ),
286 - 'trinary' => array( 1, 40 ),
287 - 'semicolon' => array( 1, 40 ),
288 - 'rightbracket' => array( 1, 40 ),
289 - 'colon' => array( 1, 40 ),
290 - 'logicop' => array( 1, 40 ),
291 - 'compareop' => array( 1, 40 ),
292 - 'sum' => array( 1, 40 ),
293 - 'mul' => array( 1, 40 ),
294 - 'contains' => array( 1, 40 ),
295 - 'rightsquare' => array( 1, 40 ),
296 - 'comma' => array( 1, 40 ),
297 - 'rightcurly' => array( 1, 40 ),
 178+ 'id' => array( 0, 7 ),
298179 ),
299180 11 => array(
300 - 'id' => array( 0, 8 ),
301 - 'invert' => array( 0, 7 ),
302 - 'sum' => array( 0, 6 ),
303 - 'isset' => array( 0, 12 ),
304 - 'delete' => array( 0, 13 ),
305 - 'break' => array( 0, 9 ),
306 - 'continue' => array( 0, 10 ),
307 - 'leftbracket' => array( 0, 2 ),
308 - 'leftsquare' => array( 0, 11 ),
309 - 'leftcurly' => array( 0, 40 ),
310 - 'string' => array( 0, 14 ),
311 - 'int' => array( 0, 15 ),
312 - 'float' => array( 0, 16 ),
313 - 'true' => array( 0, 17 ),
314 - 'false' => array( 0, 18 ),
315 - 'null' => array( 0, 19 ),
 181+ 'if' => array( 0, 17 ),
 182+ 'for' => array( 0, 18 ),
 183+ 'try' => array( 0, 19 ),
 184+ 'leftcurly' => array( 0, 16 ),
 185+ 'return' => array( 0, 20 ),
 186+ 'append' => array( 0, 21 ),
 187+ 'yield' => array( 0, 22 ),
 188+ 'id' => array( 0, 14 ),
 189+ 'invert' => array( 0, 24 ),
 190+ 'sum' => array( 0, 23 ),
 191+ 'self' => array( 0, 30 ),
 192+ 'isset' => array( 0, 28 ),
 193+ 'delete' => array( 0, 29 ),
 194+ 'break' => array( 0, 25 ),
 195+ 'continue' => array( 0, 26 ),
 196+ 'leftbracket' => array( 0, 15 ),
 197+ 'leftsquare' => array( 0, 27 ),
 198+ 'string' => array( 0, 31 ),
 199+ 'int' => array( 0, 32 ),
 200+ 'float' => array( 0, 33 ),
 201+ 'true' => array( 0, 34 ),
 202+ 'false' => array( 0, 35 ),
 203+ 'null' => array( 0, 36 ),
316204 ),
317205 12 => array(
318 - 'leftbracket' => array( 1, 44 ),
 206+ 'leftcurly' => array( 0, 58 ),
319207 ),
320208 13 => array(
321 - 'leftbracket' => array( 1, 45 ),
 209+ 'rightbracket' => array( 1, 5 ),
322210 ),
323211 14 => array(
324 - 'in' => array( 1, 51 ),
325 - 'pow' => array( 1, 51 ),
326 - 'equalsto' => array( 1, 51 ),
327 - 'trinary' => array( 1, 51 ),
328 - 'semicolon' => array( 1, 51 ),
329 - 'rightbracket' => array( 1, 51 ),
330 - 'colon' => array( 1, 51 ),
331 - 'logicop' => array( 1, 51 ),
332 - 'compareop' => array( 1, 51 ),
333 - 'sum' => array( 1, 51 ),
334 - 'mul' => array( 1, 51 ),
335 - 'contains' => array( 1, 51 ),
336 - 'rightsquare' => array( 1, 51 ),
337 - 'comma' => array( 1, 51 ),
338 - 'rightcurly' => array( 1, 51 ),
 212+ 'rightbracket' => array( 1, 71 ),
 213+ 'setto' => array( 1, 71 ),
 214+ 'in' => array( 1, 71 ),
 215+ 'pow' => array( 1, 71 ),
 216+ 'equalsto' => array( 1, 71 ),
 217+ 'trinary' => array( 1, 71 ),
 218+ 'semicolon' => array( 1, 71 ),
 219+ 'colon' => array( 1, 71 ),
 220+ 'logicop' => array( 1, 71 ),
 221+ 'compareop' => array( 1, 71 ),
 222+ 'sum' => array( 1, 71 ),
 223+ 'mul' => array( 1, 71 ),
 224+ 'contains' => array( 1, 71 ),
 225+ 'leftsquare' => array( 1, 71 ),
 226+ 'doublecolon' => array( 1, 71 ),
 227+ 'rightsquare' => array( 1, 71 ),
 228+ 'comma' => array( 1, 71 ),
 229+ 'rightcurly' => array( 1, 71 ),
 230+ 'leftbracket' => array( 1, 57 ),
339231 ),
340232 15 => array(
341 - 'in' => array( 1, 52 ),
342 - 'pow' => array( 1, 52 ),
343 - 'equalsto' => array( 1, 52 ),
344 - 'trinary' => array( 1, 52 ),
345 - 'semicolon' => array( 1, 52 ),
346 - 'rightbracket' => array( 1, 52 ),
347 - 'colon' => array( 1, 52 ),
348 - 'logicop' => array( 1, 52 ),
349 - 'compareop' => array( 1, 52 ),
350 - 'sum' => array( 1, 52 ),
351 - 'mul' => array( 1, 52 ),
352 - 'contains' => array( 1, 52 ),
353 - 'rightsquare' => array( 1, 52 ),
354 - 'comma' => array( 1, 52 ),
355 - 'rightcurly' => array( 1, 52 ),
 233+ 'return' => array( 0, 20 ),
 234+ 'append' => array( 0, 21 ),
 235+ 'yield' => array( 0, 22 ),
 236+ 'id' => array( 0, 14 ),
 237+ 'invert' => array( 0, 24 ),
 238+ 'sum' => array( 0, 23 ),
 239+ 'self' => array( 0, 30 ),
 240+ 'isset' => array( 0, 28 ),
 241+ 'delete' => array( 0, 29 ),
 242+ 'break' => array( 0, 25 ),
 243+ 'continue' => array( 0, 26 ),
 244+ 'leftbracket' => array( 0, 15 ),
 245+ 'leftsquare' => array( 0, 27 ),
 246+ 'leftcurly' => array( 0, 59 ),
 247+ 'string' => array( 0, 31 ),
 248+ 'int' => array( 0, 32 ),
 249+ 'float' => array( 0, 33 ),
 250+ 'true' => array( 0, 34 ),
 251+ 'false' => array( 0, 35 ),
 252+ 'null' => array( 0, 36 ),
356253 ),
357254 16 => array(
358 - 'in' => array( 1, 53 ),
359 - 'pow' => array( 1, 53 ),
360 - 'equalsto' => array( 1, 53 ),
361 - 'trinary' => array( 1, 53 ),
362 - 'semicolon' => array( 1, 53 ),
363 - 'rightbracket' => array( 1, 53 ),
364 - 'colon' => array( 1, 53 ),
365 - 'logicop' => array( 1, 53 ),
366 - 'compareop' => array( 1, 53 ),
367 - 'sum' => array( 1, 53 ),
368 - 'mul' => array( 1, 53 ),
369 - 'contains' => array( 1, 53 ),
370 - 'rightsquare' => array( 1, 53 ),
371 - 'comma' => array( 1, 53 ),
372 - 'rightcurly' => array( 1, 53 ),
 255+ 'if' => array( 0, 17 ),
 256+ 'for' => array( 0, 18 ),
 257+ 'try' => array( 0, 19 ),
 258+ 'leftcurly' => array( 0, 16 ),
 259+ 'return' => array( 0, 20 ),
 260+ 'append' => array( 0, 21 ),
 261+ 'yield' => array( 0, 22 ),
 262+ 'id' => array( 0, 14 ),
 263+ 'invert' => array( 0, 24 ),
 264+ 'sum' => array( 0, 23 ),
 265+ 'self' => array( 0, 30 ),
 266+ 'isset' => array( 0, 28 ),
 267+ 'delete' => array( 0, 29 ),
 268+ 'break' => array( 0, 25 ),
 269+ 'continue' => array( 0, 26 ),
 270+ 'leftbracket' => array( 0, 15 ),
 271+ 'leftsquare' => array( 0, 27 ),
 272+ 'string' => array( 0, 31 ),
 273+ 'int' => array( 0, 32 ),
 274+ 'float' => array( 0, 33 ),
 275+ 'true' => array( 0, 34 ),
 276+ 'false' => array( 0, 35 ),
 277+ 'null' => array( 0, 36 ),
373278 ),
374279 17 => array(
375 - 'in' => array( 1, 54 ),
376 - 'pow' => array( 1, 54 ),
377 - 'equalsto' => array( 1, 54 ),
378 - 'trinary' => array( 1, 54 ),
379 - 'semicolon' => array( 1, 54 ),
380 - 'rightbracket' => array( 1, 54 ),
381 - 'colon' => array( 1, 54 ),
382 - 'logicop' => array( 1, 54 ),
383 - 'compareop' => array( 1, 54 ),
384 - 'sum' => array( 1, 54 ),
385 - 'mul' => array( 1, 54 ),
386 - 'contains' => array( 1, 54 ),
387 - 'rightsquare' => array( 1, 54 ),
388 - 'comma' => array( 1, 54 ),
389 - 'rightcurly' => array( 1, 54 ),
 280+ 'leftbracket' => array( 0, 65 ),
390281 ),
391282 18 => array(
392 - 'in' => array( 1, 55 ),
393 - 'pow' => array( 1, 55 ),
394 - 'equalsto' => array( 1, 55 ),
395 - 'trinary' => array( 1, 55 ),
396 - 'semicolon' => array( 1, 55 ),
397 - 'rightbracket' => array( 1, 55 ),
398 - 'colon' => array( 1, 55 ),
399 - 'logicop' => array( 1, 55 ),
400 - 'compareop' => array( 1, 55 ),
401 - 'sum' => array( 1, 55 ),
402 - 'mul' => array( 1, 55 ),
403 - 'contains' => array( 1, 55 ),
404 - 'rightsquare' => array( 1, 55 ),
405 - 'comma' => array( 1, 55 ),
406 - 'rightcurly' => array( 1, 55 ),
 283+ 'leftbracket' => array( 0, 66 ),
407284 ),
408285 19 => array(
409 - 'in' => array( 1, 56 ),
410 - 'pow' => array( 1, 56 ),
411 - 'equalsto' => array( 1, 56 ),
412 - 'trinary' => array( 1, 56 ),
413 - 'semicolon' => array( 1, 56 ),
414 - 'rightbracket' => array( 1, 56 ),
415 - 'colon' => array( 1, 56 ),
416 - 'logicop' => array( 1, 56 ),
417 - 'compareop' => array( 1, 56 ),
418 - 'sum' => array( 1, 56 ),
419 - 'mul' => array( 1, 56 ),
420 - 'contains' => array( 1, 56 ),
421 - 'rightsquare' => array( 1, 56 ),
422 - 'comma' => array( 1, 56 ),
423 - 'rightcurly' => array( 1, 56 ),
 286+ 'if' => array( 0, 17 ),
 287+ 'for' => array( 0, 18 ),
 288+ 'try' => array( 0, 19 ),
 289+ 'leftcurly' => array( 0, 16 ),
 290+ 'return' => array( 0, 20 ),
 291+ 'append' => array( 0, 21 ),
 292+ 'yield' => array( 0, 22 ),
 293+ 'id' => array( 0, 14 ),
 294+ 'invert' => array( 0, 24 ),
 295+ 'sum' => array( 0, 23 ),
 296+ 'self' => array( 0, 30 ),
 297+ 'isset' => array( 0, 28 ),
 298+ 'delete' => array( 0, 29 ),
 299+ 'break' => array( 0, 25 ),
 300+ 'continue' => array( 0, 26 ),
 301+ 'leftbracket' => array( 0, 15 ),
 302+ 'leftsquare' => array( 0, 27 ),
 303+ 'string' => array( 0, 31 ),
 304+ 'int' => array( 0, 32 ),
 305+ 'float' => array( 0, 33 ),
 306+ 'true' => array( 0, 34 ),
 307+ 'false' => array( 0, 35 ),
 308+ 'null' => array( 0, 36 ),
424309 ),
425310 20 => array(
426 - '$' => array( 2, null ),
427 - 'if' => array( 0, 1 ),
428 - 'for' => array( 0, 3 ),
429 - 'try' => array( 0, 4 ),
430 - 'leftcurly' => array( 0, 5 ),
431 - 'id' => array( 0, 8 ),
432 - 'invert' => array( 0, 7 ),
433 - 'sum' => array( 0, 6 ),
434 - 'isset' => array( 0, 12 ),
435 - 'delete' => array( 0, 13 ),
436 - 'break' => array( 0, 9 ),
437 - 'continue' => array( 0, 10 ),
438 - 'leftbracket' => array( 0, 2 ),
439 - 'leftsquare' => array( 0, 11 ),
440 - 'string' => array( 0, 14 ),
441 - 'int' => array( 0, 15 ),
442 - 'float' => array( 0, 16 ),
443 - 'true' => array( 0, 17 ),
444 - 'false' => array( 0, 18 ),
445 - 'null' => array( 0, 19 ),
 311+ 'semicolon' => array( 1, 16 ),
 312+ 'rightbracket' => array( 1, 16 ),
 313+ 'rightsquare' => array( 1, 16 ),
 314+ 'comma' => array( 1, 16 ),
 315+ 'colon' => array( 1, 16 ),
 316+ 'rightcurly' => array( 1, 16 ),
 317+ 'id' => array( 0, 14 ),
 318+ 'invert' => array( 0, 24 ),
 319+ 'sum' => array( 0, 23 ),
 320+ 'self' => array( 0, 30 ),
 321+ 'isset' => array( 0, 28 ),
 322+ 'delete' => array( 0, 29 ),
 323+ 'break' => array( 0, 25 ),
 324+ 'continue' => array( 0, 26 ),
 325+ 'leftbracket' => array( 0, 15 ),
 326+ 'leftsquare' => array( 0, 27 ),
 327+ 'leftcurly' => array( 0, 59 ),
 328+ 'string' => array( 0, 31 ),
 329+ 'int' => array( 0, 32 ),
 330+ 'float' => array( 0, 33 ),
 331+ 'true' => array( 0, 34 ),
 332+ 'false' => array( 0, 35 ),
 333+ 'null' => array( 0, 36 ),
446334 ),
447335 21 => array(
448 - '$' => array( 1, 2 ),
449 - 'if' => array( 1, 2 ),
450 - 'for' => array( 1, 2 ),
451 - 'try' => array( 1, 2 ),
452 - 'leftcurly' => array( 1, 2 ),
453 - 'id' => array( 1, 2 ),
454 - 'invert' => array( 1, 2 ),
455 - 'sum' => array( 1, 2 ),
456 - 'isset' => array( 1, 2 ),
457 - 'delete' => array( 1, 2 ),
458 - 'break' => array( 1, 2 ),
459 - 'continue' => array( 1, 2 ),
460 - 'leftbracket' => array( 1, 2 ),
461 - 'leftsquare' => array( 1, 2 ),
462 - 'string' => array( 1, 2 ),
463 - 'int' => array( 1, 2 ),
464 - 'float' => array( 1, 2 ),
465 - 'true' => array( 1, 2 ),
466 - 'false' => array( 1, 2 ),
467 - 'null' => array( 1, 2 ),
468 - 'rightcurly' => array( 1, 2 ),
 336+ 'id' => array( 0, 14 ),
 337+ 'invert' => array( 0, 24 ),
 338+ 'sum' => array( 0, 23 ),
 339+ 'self' => array( 0, 30 ),
 340+ 'isset' => array( 0, 28 ),
 341+ 'delete' => array( 0, 29 ),
 342+ 'break' => array( 0, 25 ),
 343+ 'continue' => array( 0, 26 ),
 344+ 'leftbracket' => array( 0, 15 ),
 345+ 'leftsquare' => array( 0, 27 ),
 346+ 'leftcurly' => array( 0, 59 ),
 347+ 'string' => array( 0, 31 ),
 348+ 'int' => array( 0, 32 ),
 349+ 'float' => array( 0, 33 ),
 350+ 'true' => array( 0, 34 ),
 351+ 'false' => array( 0, 35 ),
 352+ 'null' => array( 0, 36 ),
469353 ),
470354 22 => array(
471 - 'semicolon' => array( 0, 56 ),
 355+ 'id' => array( 0, 14 ),
 356+ 'invert' => array( 0, 24 ),
 357+ 'sum' => array( 0, 23 ),
 358+ 'self' => array( 0, 30 ),
 359+ 'isset' => array( 0, 28 ),
 360+ 'delete' => array( 0, 29 ),
 361+ 'break' => array( 0, 25 ),
 362+ 'continue' => array( 0, 26 ),
 363+ 'leftbracket' => array( 0, 15 ),
 364+ 'leftsquare' => array( 0, 27 ),
 365+ 'leftcurly' => array( 0, 59 ),
 366+ 'string' => array( 0, 31 ),
 367+ 'int' => array( 0, 32 ),
 368+ 'float' => array( 0, 33 ),
 369+ 'true' => array( 0, 34 ),
 370+ 'false' => array( 0, 35 ),
 371+ 'null' => array( 0, 36 ),
472372 ),
473373 23 => array(
474 - 'setto' => array( 0, 57 ),
475 - 'in' => array( 1, 37 ),
476 - 'pow' => array( 1, 37 ),
477 - 'equalsto' => array( 1, 37 ),
478 - 'trinary' => array( 1, 37 ),
479 - 'semicolon' => array( 1, 37 ),
480 - 'rightbracket' => array( 1, 37 ),
481 - 'colon' => array( 1, 37 ),
482 - 'logicop' => array( 1, 37 ),
483 - 'compareop' => array( 1, 37 ),
484 - 'sum' => array( 1, 37 ),
485 - 'mul' => array( 1, 37 ),
486 - 'contains' => array( 1, 37 ),
487 - 'rightsquare' => array( 1, 37 ),
488 - 'comma' => array( 1, 37 ),
489 - 'rightcurly' => array( 1, 37 ),
490 - 'leftsquare' => array( 0, 58 ),
 374+ 'id' => array( 0, 71 ),
 375+ 'self' => array( 0, 30 ),
 376+ 'isset' => array( 0, 28 ),
 377+ 'delete' => array( 0, 29 ),
 378+ 'break' => array( 0, 25 ),
 379+ 'continue' => array( 0, 26 ),
 380+ 'leftbracket' => array( 0, 15 ),
 381+ 'leftsquare' => array( 0, 27 ),
 382+ 'leftcurly' => array( 0, 59 ),
 383+ 'string' => array( 0, 31 ),
 384+ 'int' => array( 0, 32 ),
 385+ 'float' => array( 0, 33 ),
 386+ 'true' => array( 0, 34 ),
 387+ 'false' => array( 0, 35 ),
 388+ 'null' => array( 0, 36 ),
491389 ),
492390 24 => array(
493 - 'semicolon' => array( 1, 9 ),
494 - 'rightbracket' => array( 1, 9 ),
495 - 'rightsquare' => array( 1, 9 ),
496 - 'comma' => array( 1, 9 ),
497 - 'colon' => array( 1, 9 ),
498 - 'rightcurly' => array( 1, 9 ),
 391+ 'sum' => array( 0, 23 ),
 392+ 'id' => array( 0, 71 ),
 393+ 'self' => array( 0, 30 ),
 394+ 'isset' => array( 0, 28 ),
 395+ 'delete' => array( 0, 29 ),
 396+ 'break' => array( 0, 25 ),
 397+ 'continue' => array( 0, 26 ),
 398+ 'leftbracket' => array( 0, 15 ),
 399+ 'leftsquare' => array( 0, 27 ),
 400+ 'leftcurly' => array( 0, 59 ),
 401+ 'string' => array( 0, 31 ),
 402+ 'int' => array( 0, 32 ),
 403+ 'float' => array( 0, 33 ),
 404+ 'true' => array( 0, 34 ),
 405+ 'false' => array( 0, 35 ),
 406+ 'null' => array( 0, 36 ),
499407 ),
500408 25 => array(
501 - 'semicolon' => array( 1, 11 ),
502 - 'rightbracket' => array( 1, 11 ),
503 - 'rightsquare' => array( 1, 11 ),
504 - 'comma' => array( 1, 11 ),
505 - 'colon' => array( 1, 11 ),
506 - 'rightcurly' => array( 1, 11 ),
 409+ 'in' => array( 1, 50 ),
 410+ 'pow' => array( 1, 50 ),
 411+ 'equalsto' => array( 1, 50 ),
 412+ 'trinary' => array( 1, 50 ),
 413+ 'semicolon' => array( 1, 50 ),
 414+ 'rightbracket' => array( 1, 50 ),
 415+ 'colon' => array( 1, 50 ),
 416+ 'logicop' => array( 1, 50 ),
 417+ 'compareop' => array( 1, 50 ),
 418+ 'sum' => array( 1, 50 ),
 419+ 'mul' => array( 1, 50 ),
 420+ 'contains' => array( 1, 50 ),
 421+ 'doublecolon' => array( 1, 50 ),
 422+ 'rightsquare' => array( 1, 50 ),
 423+ 'comma' => array( 1, 50 ),
 424+ 'rightcurly' => array( 1, 50 ),
507425 ),
508426 26 => array(
509 - 'trinary' => array( 0, 60 ),
510 - 'semicolon' => array( 1, 13 ),
511 - 'rightbracket' => array( 1, 13 ),
512 - 'colon' => array( 1, 13 ),
513 - 'rightsquare' => array( 1, 13 ),
514 - 'comma' => array( 1, 13 ),
515 - 'rightcurly' => array( 1, 13 ),
516 - 'logicop' => array( 0, 61 ),
 427+ 'in' => array( 1, 51 ),
 428+ 'pow' => array( 1, 51 ),
 429+ 'equalsto' => array( 1, 51 ),
 430+ 'trinary' => array( 1, 51 ),
 431+ 'semicolon' => array( 1, 51 ),
 432+ 'rightbracket' => array( 1, 51 ),
 433+ 'colon' => array( 1, 51 ),
 434+ 'logicop' => array( 1, 51 ),
 435+ 'compareop' => array( 1, 51 ),
 436+ 'sum' => array( 1, 51 ),
 437+ 'mul' => array( 1, 51 ),
 438+ 'contains' => array( 1, 51 ),
 439+ 'doublecolon' => array( 1, 51 ),
 440+ 'rightsquare' => array( 1, 51 ),
 441+ 'comma' => array( 1, 51 ),
 442+ 'rightcurly' => array( 1, 51 ),
517443 ),
518444 27 => array(
519 - 'trinary' => array( 1, 15 ),
520 - 'semicolon' => array( 1, 15 ),
521 - 'rightbracket' => array( 1, 15 ),
522 - 'colon' => array( 1, 15 ),
523 - 'logicop' => array( 1, 15 ),
524 - 'rightsquare' => array( 1, 15 ),
525 - 'comma' => array( 1, 15 ),
526 - 'rightcurly' => array( 1, 15 ),
527 - 'compareop' => array( 0, 62 ),
 445+ 'return' => array( 0, 20 ),
 446+ 'append' => array( 0, 21 ),
 447+ 'yield' => array( 0, 22 ),
 448+ 'id' => array( 0, 14 ),
 449+ 'invert' => array( 0, 24 ),
 450+ 'sum' => array( 0, 23 ),
 451+ 'self' => array( 0, 30 ),
 452+ 'isset' => array( 0, 28 ),
 453+ 'delete' => array( 0, 29 ),
 454+ 'break' => array( 0, 25 ),
 455+ 'continue' => array( 0, 26 ),
 456+ 'leftbracket' => array( 0, 15 ),
 457+ 'leftsquare' => array( 0, 27 ),
 458+ 'leftcurly' => array( 0, 59 ),
 459+ 'string' => array( 0, 31 ),
 460+ 'int' => array( 0, 32 ),
 461+ 'float' => array( 0, 33 ),
 462+ 'true' => array( 0, 34 ),
 463+ 'false' => array( 0, 35 ),
 464+ 'null' => array( 0, 36 ),
528465 ),
529466 28 => array(
530 - 'trinary' => array( 1, 17 ),
531 - 'semicolon' => array( 1, 17 ),
532 - 'rightbracket' => array( 1, 17 ),
533 - 'colon' => array( 1, 17 ),
534 - 'logicop' => array( 1, 17 ),
535 - 'compareop' => array( 1, 17 ),
536 - 'rightsquare' => array( 1, 17 ),
537 - 'comma' => array( 1, 17 ),
538 - 'rightcurly' => array( 1, 17 ),
 467+ 'leftbracket' => array( 1, 55 ),
539468 ),
540469 29 => array(
541 - 'equalsto' => array( 0, 63 ),
542 - 'trinary' => array( 1, 19 ),
543 - 'semicolon' => array( 1, 19 ),
544 - 'rightbracket' => array( 1, 19 ),
545 - 'colon' => array( 1, 19 ),
546 - 'logicop' => array( 1, 19 ),
547 - 'compareop' => array( 1, 19 ),
548 - 'rightsquare' => array( 1, 19 ),
549 - 'comma' => array( 1, 19 ),
550 - 'rightcurly' => array( 1, 19 ),
551 - 'sum' => array( 0, 64 ),
 470+ 'leftbracket' => array( 1, 56 ),
552471 ),
553472 30 => array(
554 - 'equalsto' => array( 1, 21 ),
555 - 'trinary' => array( 1, 21 ),
556 - 'semicolon' => array( 1, 21 ),
557 - 'rightbracket' => array( 1, 21 ),
558 - 'colon' => array( 1, 21 ),
559 - 'logicop' => array( 1, 21 ),
560 - 'compareop' => array( 1, 21 ),
561 - 'sum' => array( 1, 21 ),
562 - 'rightsquare' => array( 1, 21 ),
563 - 'comma' => array( 1, 21 ),
564 - 'rightcurly' => array( 1, 21 ),
565 - 'mul' => array( 0, 65 ),
 473+ 'doublecolon' => array( 0, 77 ),
566474 ),
567475 31 => array(
568 - 'equalsto' => array( 1, 23 ),
569 - 'trinary' => array( 1, 23 ),
570 - 'semicolon' => array( 1, 23 ),
571 - 'rightbracket' => array( 1, 23 ),
572 - 'colon' => array( 1, 23 ),
573 - 'logicop' => array( 1, 23 ),
574 - 'compareop' => array( 1, 23 ),
575 - 'sum' => array( 1, 23 ),
576 - 'mul' => array( 1, 23 ),
577 - 'rightsquare' => array( 1, 23 ),
578 - 'comma' => array( 1, 23 ),
579 - 'rightcurly' => array( 1, 23 ),
 476+ 'in' => array( 1, 65 ),
 477+ 'pow' => array( 1, 65 ),
 478+ 'equalsto' => array( 1, 65 ),
 479+ 'trinary' => array( 1, 65 ),
 480+ 'semicolon' => array( 1, 65 ),
 481+ 'rightbracket' => array( 1, 65 ),
 482+ 'colon' => array( 1, 65 ),
 483+ 'logicop' => array( 1, 65 ),
 484+ 'compareop' => array( 1, 65 ),
 485+ 'sum' => array( 1, 65 ),
 486+ 'mul' => array( 1, 65 ),
 487+ 'contains' => array( 1, 65 ),
 488+ 'doublecolon' => array( 1, 65 ),
 489+ 'rightsquare' => array( 1, 65 ),
 490+ 'comma' => array( 1, 65 ),
 491+ 'rightcurly' => array( 1, 65 ),
580492 ),
581493 32 => array(
582 - 'pow' => array( 0, 66 ),
583 - 'equalsto' => array( 1, 25 ),
584 - 'trinary' => array( 1, 25 ),
585 - 'semicolon' => array( 1, 25 ),
586 - 'rightbracket' => array( 1, 25 ),
587 - 'colon' => array( 1, 25 ),
588 - 'logicop' => array( 1, 25 ),
589 - 'compareop' => array( 1, 25 ),
590 - 'sum' => array( 1, 25 ),
591 - 'mul' => array( 1, 25 ),
592 - 'rightsquare' => array( 1, 25 ),
593 - 'comma' => array( 1, 25 ),
594 - 'rightcurly' => array( 1, 25 ),
 494+ 'in' => array( 1, 66 ),
 495+ 'pow' => array( 1, 66 ),
 496+ 'equalsto' => array( 1, 66 ),
 497+ 'trinary' => array( 1, 66 ),
 498+ 'semicolon' => array( 1, 66 ),
 499+ 'rightbracket' => array( 1, 66 ),
 500+ 'colon' => array( 1, 66 ),
 501+ 'logicop' => array( 1, 66 ),
 502+ 'compareop' => array( 1, 66 ),
 503+ 'sum' => array( 1, 66 ),
 504+ 'mul' => array( 1, 66 ),
 505+ 'contains' => array( 1, 66 ),
 506+ 'doublecolon' => array( 1, 66 ),
 507+ 'rightsquare' => array( 1, 66 ),
 508+ 'comma' => array( 1, 66 ),
 509+ 'rightcurly' => array( 1, 66 ),
595510 ),
596511 33 => array(
597 - 'pow' => array( 1, 27 ),
598 - 'equalsto' => array( 1, 27 ),
599 - 'trinary' => array( 1, 27 ),
600 - 'semicolon' => array( 1, 27 ),
601 - 'rightbracket' => array( 1, 27 ),
602 - 'colon' => array( 1, 27 ),
603 - 'logicop' => array( 1, 27 ),
604 - 'compareop' => array( 1, 27 ),
605 - 'sum' => array( 1, 27 ),
606 - 'mul' => array( 1, 27 ),
607 - 'rightsquare' => array( 1, 27 ),
608 - 'comma' => array( 1, 27 ),
609 - 'rightcurly' => array( 1, 27 ),
 512+ 'in' => array( 1, 67 ),
 513+ 'pow' => array( 1, 67 ),
 514+ 'equalsto' => array( 1, 67 ),
 515+ 'trinary' => array( 1, 67 ),
 516+ 'semicolon' => array( 1, 67 ),
 517+ 'rightbracket' => array( 1, 67 ),
 518+ 'colon' => array( 1, 67 ),
 519+ 'logicop' => array( 1, 67 ),
 520+ 'compareop' => array( 1, 67 ),
 521+ 'sum' => array( 1, 67 ),
 522+ 'mul' => array( 1, 67 ),
 523+ 'contains' => array( 1, 67 ),
 524+ 'doublecolon' => array( 1, 67 ),
 525+ 'rightsquare' => array( 1, 67 ),
 526+ 'comma' => array( 1, 67 ),
 527+ 'rightcurly' => array( 1, 67 ),
610528 ),
611529 34 => array(
612 - 'in' => array( 0, 67 ),
613 - 'contains' => array( 0, 68 ),
614 - 'pow' => array( 1, 30 ),
615 - 'equalsto' => array( 1, 30 ),
 530+ 'in' => array( 1, 68 ),
 531+ 'pow' => array( 1, 68 ),
 532+ 'equalsto' => array( 1, 68 ),
 533+ 'trinary' => array( 1, 68 ),
 534+ 'semicolon' => array( 1, 68 ),
 535+ 'rightbracket' => array( 1, 68 ),
 536+ 'colon' => array( 1, 68 ),
 537+ 'logicop' => array( 1, 68 ),
 538+ 'compareop' => array( 1, 68 ),
 539+ 'sum' => array( 1, 68 ),
 540+ 'mul' => array( 1, 68 ),
 541+ 'contains' => array( 1, 68 ),
 542+ 'doublecolon' => array( 1, 68 ),
 543+ 'rightsquare' => array( 1, 68 ),
 544+ 'comma' => array( 1, 68 ),
 545+ 'rightcurly' => array( 1, 68 ),
 546+ ),
 547+ 35 => array(
 548+ 'in' => array( 1, 69 ),
 549+ 'pow' => array( 1, 69 ),
 550+ 'equalsto' => array( 1, 69 ),
 551+ 'trinary' => array( 1, 69 ),
 552+ 'semicolon' => array( 1, 69 ),
 553+ 'rightbracket' => array( 1, 69 ),
 554+ 'colon' => array( 1, 69 ),
 555+ 'logicop' => array( 1, 69 ),
 556+ 'compareop' => array( 1, 69 ),
 557+ 'sum' => array( 1, 69 ),
 558+ 'mul' => array( 1, 69 ),
 559+ 'contains' => array( 1, 69 ),
 560+ 'doublecolon' => array( 1, 69 ),
 561+ 'rightsquare' => array( 1, 69 ),
 562+ 'comma' => array( 1, 69 ),
 563+ 'rightcurly' => array( 1, 69 ),
 564+ ),
 565+ 36 => array(
 566+ 'in' => array( 1, 70 ),
 567+ 'pow' => array( 1, 70 ),
 568+ 'equalsto' => array( 1, 70 ),
 569+ 'trinary' => array( 1, 70 ),
 570+ 'semicolon' => array( 1, 70 ),
 571+ 'rightbracket' => array( 1, 70 ),
 572+ 'colon' => array( 1, 70 ),
 573+ 'logicop' => array( 1, 70 ),
 574+ 'compareop' => array( 1, 70 ),
 575+ 'sum' => array( 1, 70 ),
 576+ 'mul' => array( 1, 70 ),
 577+ 'contains' => array( 1, 70 ),
 578+ 'doublecolon' => array( 1, 70 ),
 579+ 'rightsquare' => array( 1, 70 ),
 580+ 'comma' => array( 1, 70 ),
 581+ 'rightcurly' => array( 1, 70 ),
 582+ ),
 583+ 37 => array(
 584+ 'rightcurly' => array( 0, 78 ),
 585+ 'if' => array( 0, 17 ),
 586+ 'for' => array( 0, 18 ),
 587+ 'try' => array( 0, 19 ),
 588+ 'leftcurly' => array( 0, 16 ),
 589+ 'return' => array( 0, 20 ),
 590+ 'append' => array( 0, 21 ),
 591+ 'yield' => array( 0, 22 ),
 592+ 'id' => array( 0, 14 ),
 593+ 'invert' => array( 0, 24 ),
 594+ 'sum' => array( 0, 23 ),
 595+ 'self' => array( 0, 30 ),
 596+ 'isset' => array( 0, 28 ),
 597+ 'delete' => array( 0, 29 ),
 598+ 'break' => array( 0, 25 ),
 599+ 'continue' => array( 0, 26 ),
 600+ 'leftbracket' => array( 0, 15 ),
 601+ 'leftsquare' => array( 0, 27 ),
 602+ 'string' => array( 0, 31 ),
 603+ 'int' => array( 0, 32 ),
 604+ 'float' => array( 0, 33 ),
 605+ 'true' => array( 0, 34 ),
 606+ 'false' => array( 0, 35 ),
 607+ 'null' => array( 0, 36 ),
 608+ ),
 609+ 38 => array(
 610+ 'rightcurly' => array( 1, 8 ),
 611+ 'if' => array( 1, 8 ),
 612+ 'for' => array( 1, 8 ),
 613+ 'try' => array( 1, 8 ),
 614+ 'leftcurly' => array( 1, 8 ),
 615+ 'return' => array( 1, 8 ),
 616+ 'append' => array( 1, 8 ),
 617+ 'yield' => array( 1, 8 ),
 618+ 'id' => array( 1, 8 ),
 619+ 'invert' => array( 1, 8 ),
 620+ 'sum' => array( 1, 8 ),
 621+ 'break' => array( 1, 8 ),
 622+ 'continue' => array( 1, 8 ),
 623+ 'leftbracket' => array( 1, 8 ),
 624+ 'leftsquare' => array( 1, 8 ),
 625+ 'self' => array( 1, 8 ),
 626+ 'isset' => array( 1, 8 ),
 627+ 'delete' => array( 1, 8 ),
 628+ 'string' => array( 1, 8 ),
 629+ 'int' => array( 1, 8 ),
 630+ 'float' => array( 1, 8 ),
 631+ 'true' => array( 1, 8 ),
 632+ 'false' => array( 1, 8 ),
 633+ 'null' => array( 1, 8 ),
 634+ ),
 635+ 39 => array(
 636+ 'semicolon' => array( 0, 80 ),
 637+ ),
 638+ 40 => array(
 639+ 'setto' => array( 0, 81 ),
 640+ 'in' => array( 1, 48 ),
 641+ 'pow' => array( 1, 48 ),
 642+ 'equalsto' => array( 1, 48 ),
 643+ 'trinary' => array( 1, 48 ),
 644+ 'semicolon' => array( 1, 48 ),
 645+ 'rightbracket' => array( 1, 48 ),
 646+ 'colon' => array( 1, 48 ),
 647+ 'logicop' => array( 1, 48 ),
 648+ 'compareop' => array( 1, 48 ),
 649+ 'sum' => array( 1, 48 ),
 650+ 'mul' => array( 1, 48 ),
 651+ 'contains' => array( 1, 48 ),
 652+ 'doublecolon' => array( 1, 48 ),
 653+ 'rightsquare' => array( 1, 48 ),
 654+ 'comma' => array( 1, 48 ),
 655+ 'rightcurly' => array( 1, 48 ),
 656+ 'leftsquare' => array( 0, 82 ),
 657+ ),
 658+ 41 => array(
 659+ 'semicolon' => array( 1, 15 ),
 660+ 'rightbracket' => array( 1, 15 ),
 661+ 'rightsquare' => array( 1, 15 ),
 662+ 'comma' => array( 1, 15 ),
 663+ 'colon' => array( 1, 15 ),
 664+ 'rightcurly' => array( 1, 15 ),
 665+ ),
 666+ 42 => array(
 667+ 'semicolon' => array( 1, 18 ),
 668+ 'rightbracket' => array( 1, 18 ),
 669+ 'rightsquare' => array( 1, 18 ),
 670+ 'comma' => array( 1, 18 ),
 671+ 'colon' => array( 1, 18 ),
 672+ 'rightcurly' => array( 1, 18 ),
 673+ ),
 674+ 43 => array(
 675+ 'semicolon' => array( 1, 22 ),
 676+ 'rightbracket' => array( 1, 22 ),
 677+ 'rightsquare' => array( 1, 22 ),
 678+ 'comma' => array( 1, 22 ),
 679+ 'colon' => array( 1, 22 ),
 680+ 'rightcurly' => array( 1, 22 ),
 681+ ),
 682+ 44 => array(
 683+ 'trinary' => array( 0, 84 ),
 684+ 'semicolon' => array( 1, 24 ),
 685+ 'rightbracket' => array( 1, 24 ),
 686+ 'colon' => array( 1, 24 ),
 687+ 'rightsquare' => array( 1, 24 ),
 688+ 'comma' => array( 1, 24 ),
 689+ 'rightcurly' => array( 1, 24 ),
 690+ 'logicop' => array( 0, 85 ),
 691+ ),
 692+ 45 => array(
 693+ 'trinary' => array( 1, 26 ),
 694+ 'semicolon' => array( 1, 26 ),
 695+ 'rightbracket' => array( 1, 26 ),
 696+ 'colon' => array( 1, 26 ),
 697+ 'logicop' => array( 1, 26 ),
 698+ 'rightsquare' => array( 1, 26 ),
 699+ 'comma' => array( 1, 26 ),
 700+ 'rightcurly' => array( 1, 26 ),
 701+ 'compareop' => array( 0, 86 ),
 702+ ),
 703+ 46 => array(
 704+ 'trinary' => array( 1, 28 ),
 705+ 'semicolon' => array( 1, 28 ),
 706+ 'rightbracket' => array( 1, 28 ),
 707+ 'colon' => array( 1, 28 ),
 708+ 'logicop' => array( 1, 28 ),
 709+ 'compareop' => array( 1, 28 ),
 710+ 'rightsquare' => array( 1, 28 ),
 711+ 'comma' => array( 1, 28 ),
 712+ 'rightcurly' => array( 1, 28 ),
 713+ ),
 714+ 47 => array(
 715+ 'equalsto' => array( 0, 87 ),
616716 'trinary' => array( 1, 30 ),
617717 'semicolon' => array( 1, 30 ),
618718 'rightbracket' => array( 1, 30 ),
619719 'colon' => array( 1, 30 ),
620720 'logicop' => array( 1, 30 ),
621721 'compareop' => array( 1, 30 ),
622 - 'sum' => array( 1, 30 ),
623 - 'mul' => array( 1, 30 ),
624722 'rightsquare' => array( 1, 30 ),
625723 'comma' => array( 1, 30 ),
626724 'rightcurly' => array( 1, 30 ),
 725+ 'sum' => array( 0, 88 ),
627726 ),
628 - 35 => array(
629 - 'in' => array( 1, 32 ),
630 - 'pow' => array( 1, 32 ),
 727+ 48 => array(
631728 'equalsto' => array( 1, 32 ),
632729 'trinary' => array( 1, 32 ),
633730 'semicolon' => array( 1, 32 ),
——@@ -635,18 +732,27 @@
636733 'logicop' => array( 1, 32 ),
637734 'compareop' => array( 1, 32 ),
638735 'sum' => array( 1, 32 ),
639 - 'mul' => array( 1, 32 ),
640 - 'contains' => array( 1, 32 ),
641736 'rightsquare' => array( 1, 32 ),
642737 'comma' => array( 1, 32 ),
643738 'rightcurly' => array( 1, 32 ),
 739+ 'mul' => array( 0, 89 ),
644740 ),
645 - 36 => array(
646 - 'leftbracket' => array( 0, 69 ),
 741+ 49 => array(
 742+ 'equalsto' => array( 1, 34 ),
 743+ 'trinary' => array( 1, 34 ),
 744+ 'semicolon' => array( 1, 34 ),
 745+ 'rightbracket' => array( 1, 34 ),
 746+ 'colon' => array( 1, 34 ),
 747+ 'logicop' => array( 1, 34 ),
 748+ 'compareop' => array( 1, 34 ),
 749+ 'sum' => array( 1, 34 ),
 750+ 'mul' => array( 1, 34 ),
 751+ 'rightsquare' => array( 1, 34 ),
 752+ 'comma' => array( 1, 34 ),
 753+ 'rightcurly' => array( 1, 34 ),
647754 ),
648 - 37 => array(
649 - 'in' => array( 1, 36 ),
650 - 'pow' => array( 1, 36 ),
 755+ 50 => array(
 756+ 'pow' => array( 0, 90 ),
651757 'equalsto' => array( 1, 36 ),
652758 'trinary' => array( 1, 36 ),
653759 'semicolon' => array( 1, 36 ),
——@@ -656,13 +762,11 @@
657763 'compareop' => array( 1, 36 ),
658764 'sum' => array( 1, 36 ),
659765 'mul' => array( 1, 36 ),
660 - 'contains' => array( 1, 36 ),
661766 'rightsquare' => array( 1, 36 ),
662767 'comma' => array( 1, 36 ),
663768 'rightcurly' => array( 1, 36 ),
664769 ),
665 - 38 => array(
666 - 'in' => array( 1, 38 ),
 770+ 51 => array(
667771 'pow' => array( 1, 38 ),
668772 'equalsto' => array( 1, 38 ),
669773 'trinary' => array( 1, 38 ),
——@@ -673,841 +777,925 @@
674778 'compareop' => array( 1, 38 ),
675779 'sum' => array( 1, 38 ),
676780 'mul' => array( 1, 38 ),
677 - 'contains' => array( 1, 38 ),
678781 'rightsquare' => array( 1, 38 ),
679782 'comma' => array( 1, 38 ),
680783 'rightcurly' => array( 1, 38 ),
681784 ),
682 - 39 => array(
683 - 'id' => array( 0, 8 ),
684 - 'invert' => array( 0, 7 ),
685 - 'sum' => array( 0, 6 ),
686 - 'isset' => array( 0, 12 ),
687 - 'delete' => array( 0, 13 ),
688 - 'break' => array( 0, 9 ),
689 - 'continue' => array( 0, 10 ),
690 - 'leftbracket' => array( 0, 2 ),
691 - 'leftsquare' => array( 0, 11 ),
692 - 'leftcurly' => array( 0, 40 ),
693 - 'string' => array( 0, 14 ),
694 - 'int' => array( 0, 15 ),
695 - 'float' => array( 0, 16 ),
696 - 'true' => array( 0, 17 ),
697 - 'false' => array( 0, 18 ),
698 - 'null' => array( 0, 19 ),
699 - ),
700 - 40 => array(
701 - 'id' => array( 0, 8 ),
702 - 'invert' => array( 0, 7 ),
703 - 'sum' => array( 0, 6 ),
704 - 'isset' => array( 0, 12 ),
705 - 'delete' => array( 0, 13 ),
706 - 'break' => array( 0, 9 ),
707 - 'continue' => array( 0, 10 ),
708 - 'leftbracket' => array( 0, 2 ),
709 - 'leftsquare' => array( 0, 11 ),
710 - 'leftcurly' => array( 0, 40 ),
711 - 'string' => array( 0, 14 ),
712 - 'int' => array( 0, 15 ),
713 - 'float' => array( 0, 16 ),
714 - 'true' => array( 0, 17 ),
715 - 'false' => array( 0, 18 ),
716 - 'null' => array( 0, 19 ),
717 - ),
718 - 41 => array(
719 - 'rightbracket' => array( 0, 72 ),
720 - ),
721 - 42 => array(
722 - 'id' => array( 0, 73 ),
723 - ),
724 - 43 => array(
725 - 'catch' => array( 0, 76 ),
726 - ),
727 - 44 => array(
728 - 'rightcurly' => array( 0, 77 ),
729 - 'if' => array( 0, 1 ),
730 - 'for' => array( 0, 3 ),
731 - 'try' => array( 0, 4 ),
732 - 'leftcurly' => array( 0, 5 ),
733 - 'id' => array( 0, 8 ),
734 - 'invert' => array( 0, 7 ),
735 - 'sum' => array( 0, 6 ),
736 - 'isset' => array( 0, 12 ),
737 - 'delete' => array( 0, 13 ),
738 - 'break' => array( 0, 9 ),
739 - 'continue' => array( 0, 10 ),
740 - 'leftbracket' => array( 0, 2 ),
741 - 'leftsquare' => array( 0, 11 ),
742 - 'string' => array( 0, 14 ),
743 - 'int' => array( 0, 15 ),
744 - 'float' => array( 0, 16 ),
745 - 'true' => array( 0, 17 ),
746 - 'false' => array( 0, 18 ),
747 - 'null' => array( 0, 19 ),
748 - ),
749 - 45 => array(
750 - 'semicolon' => array( 0, 56 ),
751 - 'colon' => array( 0, 78 ),
752 - ),
753 - 46 => array(
754 - 'rightcurly' => array( 0, 79 ),
755 - 'comma' => array( 0, 80 ),
756 - ),
757 - 47 => array(
758 - 'rightcurly' => array( 1, 49 ),
759 - 'comma' => array( 1, 49 ),
760 - ),
761 - 48 => array(
762 - 'leftbracket' => array( 0, 52 ),
763 - 'rightbracket' => array( 1, 57 ),
764 - 'setto' => array( 1, 57 ),
765 - 'in' => array( 1, 57 ),
766 - 'pow' => array( 1, 57 ),
767 - 'equalsto' => array( 1, 57 ),
768 - 'trinary' => array( 1, 57 ),
769 - 'semicolon' => array( 1, 57 ),
770 - 'colon' => array( 1, 57 ),
771 - 'logicop' => array( 1, 57 ),
772 - 'compareop' => array( 1, 57 ),
773 - 'sum' => array( 1, 57 ),
774 - 'mul' => array( 1, 57 ),
775 - 'contains' => array( 1, 57 ),
776 - 'leftsquare' => array( 1, 57 ),
777 - 'rightsquare' => array( 1, 57 ),
778 - 'comma' => array( 1, 57 ),
779 - 'rightcurly' => array( 1, 57 ),
780 - ),
781 - 49 => array(
782 - 'in' => array( 1, 37 ),
783 - 'pow' => array( 1, 37 ),
784 - 'equalsto' => array( 1, 37 ),
785 - 'trinary' => array( 1, 37 ),
786 - 'semicolon' => array( 1, 37 ),
787 - 'rightbracket' => array( 1, 37 ),
788 - 'colon' => array( 1, 37 ),
789 - 'logicop' => array( 1, 37 ),
790 - 'compareop' => array( 1, 37 ),
791 - 'sum' => array( 1, 37 ),
792 - 'mul' => array( 1, 37 ),
793 - 'contains' => array( 1, 37 ),
794 - 'rightsquare' => array( 1, 37 ),
795 - 'comma' => array( 1, 37 ),
796 - 'rightcurly' => array( 1, 37 ),
797 - 'leftsquare' => array( 0, 58 ),
798 - ),
799 - 50 => array(
800 - 'in' => array( 1, 31 ),
801 - 'pow' => array( 1, 31 ),
802 - 'equalsto' => array( 1, 31 ),
803 - 'trinary' => array( 1, 31 ),
804 - 'semicolon' => array( 1, 31 ),
805 - 'rightbracket' => array( 1, 31 ),
806 - 'colon' => array( 1, 31 ),
807 - 'logicop' => array( 1, 31 ),
808 - 'compareop' => array( 1, 31 ),
809 - 'sum' => array( 1, 31 ),
810 - 'mul' => array( 1, 31 ),
811 - 'contains' => array( 1, 31 ),
812 - 'rightsquare' => array( 1, 31 ),
813 - 'comma' => array( 1, 31 ),
814 - 'rightcurly' => array( 1, 31 ),
815 - ),
816 - 51 => array(
817 - 'pow' => array( 1, 26 ),
818 - 'equalsto' => array( 1, 26 ),
819 - 'trinary' => array( 1, 26 ),
820 - 'semicolon' => array( 1, 26 ),
821 - 'rightbracket' => array( 1, 26 ),
822 - 'colon' => array( 1, 26 ),
823 - 'logicop' => array( 1, 26 ),
824 - 'compareop' => array( 1, 26 ),
825 - 'sum' => array( 1, 26 ),
826 - 'mul' => array( 1, 26 ),
827 - 'rightsquare' => array( 1, 26 ),
828 - 'comma' => array( 1, 26 ),
829 - 'rightcurly' => array( 1, 26 ),
830 - ),
831785 52 => array(
832 - 'rightbracket' => array( 0, 81 ),
833 - 'id' => array( 0, 8 ),
834 - 'invert' => array( 0, 7 ),
835 - 'sum' => array( 0, 6 ),
836 - 'isset' => array( 0, 12 ),
837 - 'delete' => array( 0, 13 ),
838 - 'break' => array( 0, 9 ),
839 - 'continue' => array( 0, 10 ),
840 - 'leftbracket' => array( 0, 2 ),
841 - 'leftsquare' => array( 0, 11 ),
842 - 'leftcurly' => array( 0, 40 ),
843 - 'string' => array( 0, 14 ),
844 - 'int' => array( 0, 15 ),
845 - 'float' => array( 0, 16 ),
846 - 'true' => array( 0, 17 ),
847 - 'false' => array( 0, 18 ),
848 - 'null' => array( 0, 19 ),
 786+ 'in' => array( 0, 91 ),
 787+ 'contains' => array( 0, 92 ),
 788+ 'pow' => array( 1, 41 ),
 789+ 'equalsto' => array( 1, 41 ),
 790+ 'trinary' => array( 1, 41 ),
 791+ 'semicolon' => array( 1, 41 ),
 792+ 'rightbracket' => array( 1, 41 ),
 793+ 'colon' => array( 1, 41 ),
 794+ 'logicop' => array( 1, 41 ),
 795+ 'compareop' => array( 1, 41 ),
 796+ 'sum' => array( 1, 41 ),
 797+ 'mul' => array( 1, 41 ),
 798+ 'rightsquare' => array( 1, 41 ),
 799+ 'comma' => array( 1, 41 ),
 800+ 'rightcurly' => array( 1, 41 ),
849801 ),
850802 53 => array(
851 - 'rightbracket' => array( 1, 47 ),
852 - 'rightsquare' => array( 1, 47 ),
853 - 'comma' => array( 1, 47 ),
 803+ 'in' => array( 1, 43 ),
 804+ 'pow' => array( 1, 43 ),
 805+ 'equalsto' => array( 1, 43 ),
 806+ 'trinary' => array( 1, 43 ),
 807+ 'semicolon' => array( 1, 43 ),
 808+ 'rightbracket' => array( 1, 43 ),
 809+ 'colon' => array( 1, 43 ),
 810+ 'logicop' => array( 1, 43 ),
 811+ 'compareop' => array( 1, 43 ),
 812+ 'sum' => array( 1, 43 ),
 813+ 'mul' => array( 1, 43 ),
 814+ 'contains' => array( 1, 43 ),
 815+ 'rightsquare' => array( 1, 43 ),
 816+ 'comma' => array( 1, 43 ),
 817+ 'rightcurly' => array( 1, 43 ),
854818 ),
855819 54 => array(
856 - 'rightsquare' => array( 0, 83 ),
857 - 'comma' => array( 0, 84 ),
 820+ 'leftbracket' => array( 0, 93 ),
858821 ),
859822 55 => array(
860 - '$' => array( 1, 1 ),
861 - 'if' => array( 1, 1 ),
862 - 'for' => array( 1, 1 ),
863 - 'try' => array( 1, 1 ),
864 - 'leftcurly' => array( 1, 1 ),
865 - 'id' => array( 1, 1 ),
866 - 'invert' => array( 1, 1 ),
867 - 'sum' => array( 1, 1 ),
868 - 'isset' => array( 1, 1 ),
869 - 'delete' => array( 1, 1 ),
870 - 'break' => array( 1, 1 ),
871 - 'continue' => array( 1, 1 ),
872 - 'leftbracket' => array( 1, 1 ),
873 - 'leftsquare' => array( 1, 1 ),
874 - 'string' => array( 1, 1 ),
875 - 'int' => array( 1, 1 ),
876 - 'float' => array( 1, 1 ),
877 - 'true' => array( 1, 1 ),
878 - 'false' => array( 1, 1 ),
879 - 'null' => array( 1, 1 ),
880 - 'rightcurly' => array( 1, 1 ),
 823+ 'leftbracket' => array( 0, 94 ),
881824 ),
882825 56 => array(
883 - '$' => array( 1, 3 ),
884 - 'if' => array( 1, 3 ),
885 - 'for' => array( 1, 3 ),
886 - 'try' => array( 1, 3 ),
887 - 'leftcurly' => array( 1, 3 ),
888 - 'id' => array( 1, 3 ),
889 - 'invert' => array( 1, 3 ),
890 - 'sum' => array( 1, 3 ),
891 - 'isset' => array( 1, 3 ),
892 - 'delete' => array( 1, 3 ),
893 - 'break' => array( 1, 3 ),
894 - 'continue' => array( 1, 3 ),
895 - 'leftbracket' => array( 1, 3 ),
896 - 'leftsquare' => array( 1, 3 ),
897 - 'string' => array( 1, 3 ),
898 - 'int' => array( 1, 3 ),
899 - 'float' => array( 1, 3 ),
900 - 'true' => array( 1, 3 ),
901 - 'false' => array( 1, 3 ),
902 - 'null' => array( 1, 3 ),
903 - 'else' => array( 1, 3 ),
904 - 'catch' => array( 1, 3 ),
905 - 'rightcurly' => array( 1, 3 ),
 826+ 'in' => array( 1, 47 ),
 827+ 'pow' => array( 1, 47 ),
 828+ 'equalsto' => array( 1, 47 ),
 829+ 'trinary' => array( 1, 47 ),
 830+ 'semicolon' => array( 1, 47 ),
 831+ 'rightbracket' => array( 1, 47 ),
 832+ 'colon' => array( 1, 47 ),
 833+ 'logicop' => array( 1, 47 ),
 834+ 'compareop' => array( 1, 47 ),
 835+ 'sum' => array( 1, 47 ),
 836+ 'mul' => array( 1, 47 ),
 837+ 'contains' => array( 1, 47 ),
 838+ 'rightsquare' => array( 1, 47 ),
 839+ 'comma' => array( 1, 47 ),
 840+ 'rightcurly' => array( 1, 47 ),
 841+ 'doublecolon' => array( 0, 95 ),
906842 ),
907843 57 => array(
908 - 'id' => array( 0, 8 ),
909 - 'invert' => array( 0, 7 ),
910 - 'sum' => array( 0, 6 ),
911 - 'isset' => array( 0, 12 ),
912 - 'delete' => array( 0, 13 ),
913 - 'break' => array( 0, 9 ),
914 - 'continue' => array( 0, 10 ),
915 - 'leftbracket' => array( 0, 2 ),
916 - 'leftsquare' => array( 0, 11 ),
917 - 'leftcurly' => array( 0, 40 ),
918 - 'string' => array( 0, 14 ),
919 - 'int' => array( 0, 15 ),
920 - 'float' => array( 0, 16 ),
921 - 'true' => array( 0, 17 ),
922 - 'false' => array( 0, 18 ),
923 - 'null' => array( 0, 19 ),
 844+ 'in' => array( 1, 49 ),
 845+ 'pow' => array( 1, 49 ),
 846+ 'equalsto' => array( 1, 49 ),
 847+ 'trinary' => array( 1, 49 ),
 848+ 'semicolon' => array( 1, 49 ),
 849+ 'rightbracket' => array( 1, 49 ),
 850+ 'colon' => array( 1, 49 ),
 851+ 'logicop' => array( 1, 49 ),
 852+ 'compareop' => array( 1, 49 ),
 853+ 'sum' => array( 1, 49 ),
 854+ 'mul' => array( 1, 49 ),
 855+ 'contains' => array( 1, 49 ),
 856+ 'doublecolon' => array( 1, 49 ),
 857+ 'rightsquare' => array( 1, 49 ),
 858+ 'comma' => array( 1, 49 ),
 859+ 'rightcurly' => array( 1, 49 ),
924860 ),
925861 58 => array(
926 - 'rightsquare' => array( 0, 86 ),
927 - 'id' => array( 0, 8 ),
928 - 'invert' => array( 0, 7 ),
929 - 'sum' => array( 0, 6 ),
930 - 'isset' => array( 0, 12 ),
931 - 'delete' => array( 0, 13 ),
932 - 'break' => array( 0, 9 ),
933 - 'continue' => array( 0, 10 ),
934 - 'leftbracket' => array( 0, 2 ),
935 - 'leftsquare' => array( 0, 11 ),
936 - 'leftcurly' => array( 0, 40 ),
937 - 'string' => array( 0, 14 ),
938 - 'int' => array( 0, 15 ),
939 - 'float' => array( 0, 16 ),
940 - 'true' => array( 0, 17 ),
941 - 'false' => array( 0, 18 ),
942 - 'null' => array( 0, 19 ),
 862+ 'if' => array( 0, 17 ),
 863+ 'for' => array( 0, 18 ),
 864+ 'try' => array( 0, 19 ),
 865+ 'leftcurly' => array( 0, 16 ),
 866+ 'return' => array( 0, 20 ),
 867+ 'append' => array( 0, 21 ),
 868+ 'yield' => array( 0, 22 ),
 869+ 'id' => array( 0, 14 ),
 870+ 'invert' => array( 0, 24 ),
 871+ 'sum' => array( 0, 23 ),
 872+ 'self' => array( 0, 30 ),
 873+ 'isset' => array( 0, 28 ),
 874+ 'delete' => array( 0, 29 ),
 875+ 'break' => array( 0, 25 ),
 876+ 'continue' => array( 0, 26 ),
 877+ 'leftbracket' => array( 0, 15 ),
 878+ 'leftsquare' => array( 0, 27 ),
 879+ 'string' => array( 0, 31 ),
 880+ 'int' => array( 0, 32 ),
 881+ 'float' => array( 0, 33 ),
 882+ 'true' => array( 0, 34 ),
 883+ 'false' => array( 0, 35 ),
 884+ 'null' => array( 0, 36 ),
943885 ),
944886 59 => array(
945 - 'rightbracket' => array( 1, 58 ),
946 - 'setto' => array( 1, 58 ),
947 - 'in' => array( 1, 58 ),
948 - 'pow' => array( 1, 58 ),
949 - 'equalsto' => array( 1, 58 ),
950 - 'trinary' => array( 1, 58 ),
951 - 'semicolon' => array( 1, 58 ),
952 - 'colon' => array( 1, 58 ),
953 - 'logicop' => array( 1, 58 ),
954 - 'compareop' => array( 1, 58 ),
955 - 'sum' => array( 1, 58 ),
956 - 'mul' => array( 1, 58 ),
957 - 'contains' => array( 1, 58 ),
958 - 'leftsquare' => array( 1, 58 ),
959 - 'rightsquare' => array( 1, 58 ),
960 - 'comma' => array( 1, 58 ),
961 - 'rightcurly' => array( 1, 58 ),
 887+ 'return' => array( 0, 20 ),
 888+ 'append' => array( 0, 21 ),
 889+ 'yield' => array( 0, 22 ),
 890+ 'id' => array( 0, 14 ),
 891+ 'invert' => array( 0, 24 ),
 892+ 'sum' => array( 0, 23 ),
 893+ 'self' => array( 0, 30 ),
 894+ 'isset' => array( 0, 28 ),
 895+ 'delete' => array( 0, 29 ),
 896+ 'break' => array( 0, 25 ),
 897+ 'continue' => array( 0, 26 ),
 898+ 'leftbracket' => array( 0, 15 ),
 899+ 'leftsquare' => array( 0, 27 ),
 900+ 'leftcurly' => array( 0, 59 ),
 901+ 'string' => array( 0, 31 ),
 902+ 'int' => array( 0, 32 ),
 903+ 'float' => array( 0, 33 ),
 904+ 'true' => array( 0, 34 ),
 905+ 'false' => array( 0, 35 ),
 906+ 'null' => array( 0, 36 ),
962907 ),
963908 60 => array(
964 - 'invert' => array( 0, 7 ),
965 - 'sum' => array( 0, 6 ),
966 - 'id' => array( 0, 48 ),
967 - 'isset' => array( 0, 12 ),
968 - 'delete' => array( 0, 13 ),
969 - 'break' => array( 0, 9 ),
970 - 'continue' => array( 0, 10 ),
971 - 'leftbracket' => array( 0, 2 ),
972 - 'leftsquare' => array( 0, 11 ),
973 - 'leftcurly' => array( 0, 40 ),
974 - 'string' => array( 0, 14 ),
975 - 'int' => array( 0, 15 ),
976 - 'float' => array( 0, 16 ),
977 - 'true' => array( 0, 17 ),
978 - 'false' => array( 0, 18 ),
979 - 'null' => array( 0, 19 ),
 909+ 'rightbracket' => array( 0, 98 ),
980910 ),
981911 61 => array(
982 - 'invert' => array( 0, 7 ),
983 - 'sum' => array( 0, 6 ),
984 - 'id' => array( 0, 48 ),
985 - 'isset' => array( 0, 12 ),
986 - 'delete' => array( 0, 13 ),
987 - 'break' => array( 0, 9 ),
988 - 'continue' => array( 0, 10 ),
989 - 'leftbracket' => array( 0, 2 ),
990 - 'leftsquare' => array( 0, 11 ),
991 - 'leftcurly' => array( 0, 40 ),
992 - 'string' => array( 0, 14 ),
993 - 'int' => array( 0, 15 ),
994 - 'float' => array( 0, 16 ),
995 - 'true' => array( 0, 17 ),
996 - 'false' => array( 0, 18 ),
997 - 'null' => array( 0, 19 ),
 912+ 'rightcurly' => array( 0, 99 ),
 913+ 'if' => array( 0, 17 ),
 914+ 'for' => array( 0, 18 ),
 915+ 'try' => array( 0, 19 ),
 916+ 'leftcurly' => array( 0, 16 ),
 917+ 'return' => array( 0, 20 ),
 918+ 'append' => array( 0, 21 ),
 919+ 'yield' => array( 0, 22 ),
 920+ 'id' => array( 0, 14 ),
 921+ 'invert' => array( 0, 24 ),
 922+ 'sum' => array( 0, 23 ),
 923+ 'self' => array( 0, 30 ),
 924+ 'isset' => array( 0, 28 ),
 925+ 'delete' => array( 0, 29 ),
 926+ 'break' => array( 0, 25 ),
 927+ 'continue' => array( 0, 26 ),
 928+ 'leftbracket' => array( 0, 15 ),
 929+ 'leftsquare' => array( 0, 27 ),
 930+ 'string' => array( 0, 31 ),
 931+ 'int' => array( 0, 32 ),
 932+ 'float' => array( 0, 33 ),
 933+ 'true' => array( 0, 34 ),
 934+ 'false' => array( 0, 35 ),
 935+ 'null' => array( 0, 36 ),
998936 ),
999937 62 => array(
1000 - 'invert' => array( 0, 7 ),
1001 - 'sum' => array( 0, 6 ),
1002 - 'id' => array( 0, 48 ),
1003 - 'isset' => array( 0, 12 ),
1004 - 'delete' => array( 0, 13 ),
1005 - 'break' => array( 0, 9 ),
1006 - 'continue' => array( 0, 10 ),
1007 - 'leftbracket' => array( 0, 2 ),
1008 - 'leftsquare' => array( 0, 11 ),
1009 - 'leftcurly' => array( 0, 40 ),
1010 - 'string' => array( 0, 14 ),
1011 - 'int' => array( 0, 15 ),
1012 - 'float' => array( 0, 16 ),
1013 - 'true' => array( 0, 17 ),
1014 - 'false' => array( 0, 18 ),
1015 - 'null' => array( 0, 19 ),
 938+ 'semicolon' => array( 0, 80 ),
 939+ 'colon' => array( 0, 100 ),
1016940 ),
1017941 63 => array(
1018 - 'invert' => array( 0, 7 ),
1019 - 'sum' => array( 0, 6 ),
1020 - 'id' => array( 0, 48 ),
1021 - 'isset' => array( 0, 12 ),
1022 - 'delete' => array( 0, 13 ),
1023 - 'break' => array( 0, 9 ),
1024 - 'continue' => array( 0, 10 ),
1025 - 'leftbracket' => array( 0, 2 ),
1026 - 'leftsquare' => array( 0, 11 ),
1027 - 'leftcurly' => array( 0, 40 ),
1028 - 'string' => array( 0, 14 ),
1029 - 'int' => array( 0, 15 ),
1030 - 'float' => array( 0, 16 ),
1031 - 'true' => array( 0, 17 ),
1032 - 'false' => array( 0, 18 ),
1033 - 'null' => array( 0, 19 ),
 942+ 'rightcurly' => array( 0, 101 ),
 943+ 'comma' => array( 0, 102 ),
1034944 ),
1035945 64 => array(
1036 - 'invert' => array( 0, 7 ),
1037 - 'sum' => array( 0, 6 ),
1038 - 'id' => array( 0, 48 ),
1039 - 'isset' => array( 0, 12 ),
1040 - 'delete' => array( 0, 13 ),
1041 - 'break' => array( 0, 9 ),
1042 - 'continue' => array( 0, 10 ),
1043 - 'leftbracket' => array( 0, 2 ),
1044 - 'leftsquare' => array( 0, 11 ),
1045 - 'leftcurly' => array( 0, 40 ),
1046 - 'string' => array( 0, 14 ),
1047 - 'int' => array( 0, 15 ),
1048 - 'float' => array( 0, 16 ),
1049 - 'true' => array( 0, 17 ),
1050 - 'false' => array( 0, 18 ),
1051 - 'null' => array( 0, 19 ),
 946+ 'rightcurly' => array( 1, 63 ),
 947+ 'comma' => array( 1, 63 ),
1052948 ),
1053949 65 => array(
1054 - 'invert' => array( 0, 7 ),
1055 - 'sum' => array( 0, 6 ),
1056 - 'id' => array( 0, 48 ),
1057 - 'isset' => array( 0, 12 ),
1058 - 'delete' => array( 0, 13 ),
1059 - 'break' => array( 0, 9 ),
1060 - 'continue' => array( 0, 10 ),
1061 - 'leftbracket' => array( 0, 2 ),
1062 - 'leftsquare' => array( 0, 11 ),
1063 - 'leftcurly' => array( 0, 40 ),
1064 - 'string' => array( 0, 14 ),
1065 - 'int' => array( 0, 15 ),
1066 - 'float' => array( 0, 16 ),
1067 - 'true' => array( 0, 17 ),
1068 - 'false' => array( 0, 18 ),
1069 - 'null' => array( 0, 19 ),
 950+ 'return' => array( 0, 20 ),
 951+ 'append' => array( 0, 21 ),
 952+ 'yield' => array( 0, 22 ),
 953+ 'id' => array( 0, 14 ),
 954+ 'invert' => array( 0, 24 ),
 955+ 'sum' => array( 0, 23 ),
 956+ 'self' => array( 0, 30 ),
 957+ 'isset' => array( 0, 28 ),
 958+ 'delete' => array( 0, 29 ),
 959+ 'break' => array( 0, 25 ),
 960+ 'continue' => array( 0, 26 ),
 961+ 'leftbracket' => array( 0, 15 ),
 962+ 'leftsquare' => array( 0, 27 ),
 963+ 'leftcurly' => array( 0, 59 ),
 964+ 'string' => array( 0, 31 ),
 965+ 'int' => array( 0, 32 ),
 966+ 'float' => array( 0, 33 ),
 967+ 'true' => array( 0, 34 ),
 968+ 'false' => array( 0, 35 ),
 969+ 'null' => array( 0, 36 ),
1070970 ),
1071971 66 => array(
1072 - 'invert' => array( 0, 7 ),
1073 - 'sum' => array( 0, 6 ),
1074 - 'id' => array( 0, 48 ),
1075 - 'isset' => array( 0, 12 ),
1076 - 'delete' => array( 0, 13 ),
1077 - 'break' => array( 0, 9 ),
1078 - 'continue' => array( 0, 10 ),
1079 - 'leftbracket' => array( 0, 2 ),
1080 - 'leftsquare' => array( 0, 11 ),
1081 - 'leftcurly' => array( 0, 40 ),
1082 - 'string' => array( 0, 14 ),
1083 - 'int' => array( 0, 15 ),
1084 - 'float' => array( 0, 16 ),
1085 - 'true' => array( 0, 17 ),
1086 - 'false' => array( 0, 18 ),
1087 - 'null' => array( 0, 19 ),
 972+ 'id' => array( 0, 104 ),
1088973 ),
1089974 67 => array(
1090 - 'sum' => array( 0, 6 ),
1091 - 'id' => array( 0, 48 ),
1092 - 'isset' => array( 0, 12 ),
1093 - 'delete' => array( 0, 13 ),
1094 - 'break' => array( 0, 9 ),
1095 - 'continue' => array( 0, 10 ),
1096 - 'leftbracket' => array( 0, 2 ),
1097 - 'leftsquare' => array( 0, 11 ),
1098 - 'leftcurly' => array( 0, 40 ),
1099 - 'string' => array( 0, 14 ),
1100 - 'int' => array( 0, 15 ),
1101 - 'float' => array( 0, 16 ),
1102 - 'true' => array( 0, 17 ),
1103 - 'false' => array( 0, 18 ),
1104 - 'null' => array( 0, 19 ),
 975+ 'catch' => array( 0, 107 ),
1105976 ),
1106977 68 => array(
1107 - 'sum' => array( 0, 6 ),
1108 - 'id' => array( 0, 48 ),
1109 - 'isset' => array( 0, 12 ),
1110 - 'delete' => array( 0, 13 ),
1111 - 'break' => array( 0, 9 ),
1112 - 'continue' => array( 0, 10 ),
1113 - 'leftbracket' => array( 0, 2 ),
1114 - 'leftsquare' => array( 0, 11 ),
1115 - 'leftcurly' => array( 0, 40 ),
1116 - 'string' => array( 0, 14 ),
1117 - 'int' => array( 0, 15 ),
1118 - 'float' => array( 0, 16 ),
1119 - 'true' => array( 0, 17 ),
1120 - 'false' => array( 0, 18 ),
1121 - 'null' => array( 0, 19 ),
 978+ 'semicolon' => array( 1, 17 ),
 979+ 'rightbracket' => array( 1, 17 ),
 980+ 'rightsquare' => array( 1, 17 ),
 981+ 'comma' => array( 1, 17 ),
 982+ 'colon' => array( 1, 17 ),
 983+ 'rightcurly' => array( 1, 17 ),
1122984 ),
1123985 69 => array(
1124 - 'id' => array( 0, 73 ),
 986+ 'semicolon' => array( 1, 19 ),
 987+ 'rightbracket' => array( 1, 19 ),
 988+ 'rightsquare' => array( 1, 19 ),
 989+ 'comma' => array( 1, 19 ),
 990+ 'colon' => array( 1, 19 ),
 991+ 'rightcurly' => array( 1, 19 ),
1125992 ),
1126993 70 => array(
1127 - 'rightbracket' => array( 0, 98 ),
 994+ 'semicolon' => array( 1, 20 ),
 995+ 'rightbracket' => array( 1, 20 ),
 996+ 'rightsquare' => array( 1, 20 ),
 997+ 'comma' => array( 1, 20 ),
 998+ 'colon' => array( 1, 20 ),
 999+ 'rightcurly' => array( 1, 20 ),
11281000 ),
11291001 71 => array(
1130 - 'colon' => array( 0, 78 ),
 1002+ 'leftbracket' => array( 1, 57 ),
 1003+ 'rightbracket' => array( 1, 71 ),
 1004+ 'setto' => array( 1, 71 ),
 1005+ 'in' => array( 1, 71 ),
 1006+ 'pow' => array( 1, 71 ),
 1007+ 'equalsto' => array( 1, 71 ),
 1008+ 'trinary' => array( 1, 71 ),
 1009+ 'semicolon' => array( 1, 71 ),
 1010+ 'colon' => array( 1, 71 ),
 1011+ 'logicop' => array( 1, 71 ),
 1012+ 'compareop' => array( 1, 71 ),
 1013+ 'sum' => array( 1, 71 ),
 1014+ 'mul' => array( 1, 71 ),
 1015+ 'contains' => array( 1, 71 ),
 1016+ 'leftsquare' => array( 1, 71 ),
 1017+ 'doublecolon' => array( 1, 71 ),
 1018+ 'rightsquare' => array( 1, 71 ),
 1019+ 'comma' => array( 1, 71 ),
 1020+ 'rightcurly' => array( 1, 71 ),
11311021 ),
11321022 72 => array(
1133 - 'in' => array( 1, 41 ),
1134 - 'pow' => array( 1, 41 ),
1135 - 'equalsto' => array( 1, 41 ),
1136 - 'trinary' => array( 1, 41 ),
1137 - 'semicolon' => array( 1, 41 ),
1138 - 'rightbracket' => array( 1, 41 ),
1139 - 'colon' => array( 1, 41 ),
1140 - 'logicop' => array( 1, 41 ),
1141 - 'compareop' => array( 1, 41 ),
1142 - 'sum' => array( 1, 41 ),
1143 - 'mul' => array( 1, 41 ),
1144 - 'contains' => array( 1, 41 ),
1145 - 'rightsquare' => array( 1, 41 ),
1146 - 'comma' => array( 1, 41 ),
1147 - 'rightcurly' => array( 1, 41 ),
 1023+ 'in' => array( 1, 48 ),
 1024+ 'pow' => array( 1, 48 ),
 1025+ 'equalsto' => array( 1, 48 ),
 1026+ 'trinary' => array( 1, 48 ),
 1027+ 'semicolon' => array( 1, 48 ),
 1028+ 'rightbracket' => array( 1, 48 ),
 1029+ 'colon' => array( 1, 48 ),
 1030+ 'logicop' => array( 1, 48 ),
 1031+ 'compareop' => array( 1, 48 ),
 1032+ 'sum' => array( 1, 48 ),
 1033+ 'mul' => array( 1, 48 ),
 1034+ 'contains' => array( 1, 48 ),
 1035+ 'doublecolon' => array( 1, 48 ),
 1036+ 'rightsquare' => array( 1, 48 ),
 1037+ 'comma' => array( 1, 48 ),
 1038+ 'rightcurly' => array( 1, 48 ),
 1039+ 'leftsquare' => array( 0, 82 ),
11481040 ),
11491041 73 => array(
1150 - 'rightbracket' => array( 1, 57 ),
1151 - 'setto' => array( 1, 57 ),
1152 - 'in' => array( 1, 57 ),
1153 - 'pow' => array( 1, 57 ),
1154 - 'equalsto' => array( 1, 57 ),
1155 - 'trinary' => array( 1, 57 ),
1156 - 'semicolon' => array( 1, 57 ),
1157 - 'colon' => array( 1, 57 ),
1158 - 'logicop' => array( 1, 57 ),
1159 - 'compareop' => array( 1, 57 ),
1160 - 'sum' => array( 1, 57 ),
1161 - 'mul' => array( 1, 57 ),
1162 - 'contains' => array( 1, 57 ),
1163 - 'leftsquare' => array( 1, 57 ),
1164 - 'rightsquare' => array( 1, 57 ),
1165 - 'comma' => array( 1, 57 ),
1166 - 'rightcurly' => array( 1, 57 ),
 1042+ 'in' => array( 1, 42 ),
 1043+ 'pow' => array( 1, 42 ),
 1044+ 'equalsto' => array( 1, 42 ),
 1045+ 'trinary' => array( 1, 42 ),
 1046+ 'semicolon' => array( 1, 42 ),
 1047+ 'rightbracket' => array( 1, 42 ),
 1048+ 'colon' => array( 1, 42 ),
 1049+ 'logicop' => array( 1, 42 ),
 1050+ 'compareop' => array( 1, 42 ),
 1051+ 'sum' => array( 1, 42 ),
 1052+ 'mul' => array( 1, 42 ),
 1053+ 'contains' => array( 1, 42 ),
 1054+ 'rightsquare' => array( 1, 42 ),
 1055+ 'comma' => array( 1, 42 ),
 1056+ 'rightcurly' => array( 1, 42 ),
11671057 ),
11681058 74 => array(
1169 - 'in' => array( 0, 99 ),
 1059+ 'pow' => array( 1, 37 ),
 1060+ 'equalsto' => array( 1, 37 ),
 1061+ 'trinary' => array( 1, 37 ),
 1062+ 'semicolon' => array( 1, 37 ),
 1063+ 'rightbracket' => array( 1, 37 ),
 1064+ 'colon' => array( 1, 37 ),
 1065+ 'logicop' => array( 1, 37 ),
 1066+ 'compareop' => array( 1, 37 ),
 1067+ 'sum' => array( 1, 37 ),
 1068+ 'mul' => array( 1, 37 ),
 1069+ 'rightsquare' => array( 1, 37 ),
 1070+ 'comma' => array( 1, 37 ),
 1071+ 'rightcurly' => array( 1, 37 ),
11701072 ),
11711073 75 => array(
1172 - 'in' => array( 1, 61 ),
1173 - 'colon' => array( 0, 100 ),
1174 - 'leftsquare' => array( 0, 58 ),
 1074+ 'rightbracket' => array( 1, 61 ),
 1075+ 'rightsquare' => array( 1, 61 ),
 1076+ 'comma' => array( 1, 61 ),
11751077 ),
11761078 76 => array(
1177 - 'leftbracket' => array( 0, 101 ),
 1079+ 'rightsquare' => array( 0, 109 ),
 1080+ 'comma' => array( 0, 108 ),
11781081 ),
11791082 77 => array(
1180 - '$' => array( 1, 8 ),
1181 - 'if' => array( 1, 8 ),
1182 - 'for' => array( 1, 8 ),
1183 - 'try' => array( 1, 8 ),
1184 - 'leftcurly' => array( 1, 8 ),
1185 - 'id' => array( 1, 8 ),
1186 - 'invert' => array( 1, 8 ),
1187 - 'sum' => array( 1, 8 ),
1188 - 'isset' => array( 1, 8 ),
1189 - 'delete' => array( 1, 8 ),
1190 - 'break' => array( 1, 8 ),
1191 - 'continue' => array( 1, 8 ),
1192 - 'leftbracket' => array( 1, 8 ),
1193 - 'leftsquare' => array( 1, 8 ),
1194 - 'string' => array( 1, 8 ),
1195 - 'int' => array( 1, 8 ),
1196 - 'float' => array( 1, 8 ),
1197 - 'true' => array( 1, 8 ),
1198 - 'false' => array( 1, 8 ),
1199 - 'null' => array( 1, 8 ),
1200 - 'else' => array( 1, 8 ),
1201 - 'catch' => array( 1, 8 ),
1202 - 'rightcurly' => array( 1, 8 ),
 1083+ 'id' => array( 0, 110 ),
12031084 ),
12041085 78 => array(
1205 - 'id' => array( 0, 8 ),
1206 - 'invert' => array( 0, 7 ),
1207 - 'sum' => array( 0, 6 ),
1208 - 'isset' => array( 0, 12 ),
1209 - 'delete' => array( 0, 13 ),
1210 - 'break' => array( 0, 9 ),
1211 - 'continue' => array( 0, 10 ),
1212 - 'leftbracket' => array( 0, 2 ),
1213 - 'leftsquare' => array( 0, 11 ),
1214 - 'leftcurly' => array( 0, 40 ),
1215 - 'string' => array( 0, 14 ),
1216 - 'int' => array( 0, 15 ),
1217 - 'float' => array( 0, 16 ),
1218 - 'true' => array( 0, 17 ),
1219 - 'false' => array( 0, 18 ),
1220 - 'null' => array( 0, 19 ),
 1086+ 'function' => array( 1, 4 ),
 1087+ '$' => array( 1, 4 ),
12211088 ),
12221089 79 => array(
1223 - 'in' => array( 1, 43 ),
1224 - 'pow' => array( 1, 43 ),
1225 - 'equalsto' => array( 1, 43 ),
1226 - 'trinary' => array( 1, 43 ),
1227 - 'semicolon' => array( 1, 43 ),
1228 - 'rightbracket' => array( 1, 43 ),
1229 - 'colon' => array( 1, 43 ),
1230 - 'logicop' => array( 1, 43 ),
1231 - 'compareop' => array( 1, 43 ),
1232 - 'sum' => array( 1, 43 ),
1233 - 'mul' => array( 1, 43 ),
1234 - 'contains' => array( 1, 43 ),
1235 - 'rightsquare' => array( 1, 43 ),
1236 - 'comma' => array( 1, 43 ),
1237 - 'rightcurly' => array( 1, 43 ),
 1090+ 'rightcurly' => array( 1, 7 ),
 1091+ 'if' => array( 1, 7 ),
 1092+ 'for' => array( 1, 7 ),
 1093+ 'try' => array( 1, 7 ),
 1094+ 'leftcurly' => array( 1, 7 ),
 1095+ 'return' => array( 1, 7 ),
 1096+ 'append' => array( 1, 7 ),
 1097+ 'yield' => array( 1, 7 ),
 1098+ 'id' => array( 1, 7 ),
 1099+ 'invert' => array( 1, 7 ),
 1100+ 'sum' => array( 1, 7 ),
 1101+ 'break' => array( 1, 7 ),
 1102+ 'continue' => array( 1, 7 ),
 1103+ 'leftbracket' => array( 1, 7 ),
 1104+ 'leftsquare' => array( 1, 7 ),
 1105+ 'self' => array( 1, 7 ),
 1106+ 'isset' => array( 1, 7 ),
 1107+ 'delete' => array( 1, 7 ),
 1108+ 'string' => array( 1, 7 ),
 1109+ 'int' => array( 1, 7 ),
 1110+ 'float' => array( 1, 7 ),
 1111+ 'true' => array( 1, 7 ),
 1112+ 'false' => array( 1, 7 ),
 1113+ 'null' => array( 1, 7 ),
12381114 ),
12391115 80 => array(
1240 - 'id' => array( 0, 8 ),
1241 - 'invert' => array( 0, 7 ),
1242 - 'sum' => array( 0, 6 ),
1243 - 'isset' => array( 0, 12 ),
1244 - 'delete' => array( 0, 13 ),
1245 - 'break' => array( 0, 9 ),
1246 - 'continue' => array( 0, 10 ),
1247 - 'leftbracket' => array( 0, 2 ),
1248 - 'leftsquare' => array( 0, 11 ),
1249 - 'leftcurly' => array( 0, 40 ),
1250 - 'string' => array( 0, 14 ),
1251 - 'int' => array( 0, 15 ),
1252 - 'float' => array( 0, 16 ),
1253 - 'true' => array( 0, 17 ),
1254 - 'false' => array( 0, 18 ),
1255 - 'null' => array( 0, 19 ),
 1116+ 'rightcurly' => array( 1, 9 ),
 1117+ 'if' => array( 1, 9 ),
 1118+ 'for' => array( 1, 9 ),
 1119+ 'try' => array( 1, 9 ),
 1120+ 'leftcurly' => array( 1, 9 ),
 1121+ 'return' => array( 1, 9 ),
 1122+ 'append' => array( 1, 9 ),
 1123+ 'yield' => array( 1, 9 ),
 1124+ 'id' => array( 1, 9 ),
 1125+ 'invert' => array( 1, 9 ),
 1126+ 'sum' => array( 1, 9 ),
 1127+ 'break' => array( 1, 9 ),
 1128+ 'continue' => array( 1, 9 ),
 1129+ 'leftbracket' => array( 1, 9 ),
 1130+ 'leftsquare' => array( 1, 9 ),
 1131+ 'self' => array( 1, 9 ),
 1132+ 'isset' => array( 1, 9 ),
 1133+ 'delete' => array( 1, 9 ),
 1134+ 'string' => array( 1, 9 ),
 1135+ 'int' => array( 1, 9 ),
 1136+ 'float' => array( 1, 9 ),
 1137+ 'true' => array( 1, 9 ),
 1138+ 'false' => array( 1, 9 ),
 1139+ 'null' => array( 1, 9 ),
 1140+ 'else' => array( 1, 9 ),
 1141+ 'catch' => array( 1, 9 ),
12561142 ),
12571143 81 => array(
1258 - 'in' => array( 1, 34 ),
1259 - 'pow' => array( 1, 34 ),
1260 - 'equalsto' => array( 1, 34 ),
1261 - 'trinary' => array( 1, 34 ),
1262 - 'semicolon' => array( 1, 34 ),
1263 - 'rightbracket' => array( 1, 34 ),
1264 - 'colon' => array( 1, 34 ),
1265 - 'logicop' => array( 1, 34 ),
1266 - 'compareop' => array( 1, 34 ),
1267 - 'sum' => array( 1, 34 ),
1268 - 'mul' => array( 1, 34 ),
1269 - 'contains' => array( 1, 34 ),
1270 - 'rightsquare' => array( 1, 34 ),
1271 - 'comma' => array( 1, 34 ),
1272 - 'rightcurly' => array( 1, 34 ),
 1144+ 'id' => array( 0, 14 ),
 1145+ 'invert' => array( 0, 24 ),
 1146+ 'sum' => array( 0, 23 ),
 1147+ 'self' => array( 0, 30 ),
 1148+ 'isset' => array( 0, 28 ),
 1149+ 'delete' => array( 0, 29 ),
 1150+ 'break' => array( 0, 25 ),
 1151+ 'continue' => array( 0, 26 ),
 1152+ 'leftbracket' => array( 0, 15 ),
 1153+ 'leftsquare' => array( 0, 27 ),
 1154+ 'leftcurly' => array( 0, 59 ),
 1155+ 'string' => array( 0, 31 ),
 1156+ 'int' => array( 0, 32 ),
 1157+ 'float' => array( 0, 33 ),
 1158+ 'true' => array( 0, 34 ),
 1159+ 'false' => array( 0, 35 ),
 1160+ 'null' => array( 0, 36 ),
12731161 ),
12741162 82 => array(
1275 - 'rightbracket' => array( 0, 104 ),
1276 - 'comma' => array( 0, 84 ),
 1163+ 'rightsquare' => array( 0, 112 ),
 1164+ 'return' => array( 0, 20 ),
 1165+ 'append' => array( 0, 21 ),
 1166+ 'yield' => array( 0, 22 ),
 1167+ 'id' => array( 0, 14 ),
 1168+ 'invert' => array( 0, 24 ),
 1169+ 'sum' => array( 0, 23 ),
 1170+ 'self' => array( 0, 30 ),
 1171+ 'isset' => array( 0, 28 ),
 1172+ 'delete' => array( 0, 29 ),
 1173+ 'break' => array( 0, 25 ),
 1174+ 'continue' => array( 0, 26 ),
 1175+ 'leftbracket' => array( 0, 15 ),
 1176+ 'leftsquare' => array( 0, 27 ),
 1177+ 'leftcurly' => array( 0, 59 ),
 1178+ 'string' => array( 0, 31 ),
 1179+ 'int' => array( 0, 32 ),
 1180+ 'float' => array( 0, 33 ),
 1181+ 'true' => array( 0, 34 ),
 1182+ 'false' => array( 0, 35 ),
 1183+ 'null' => array( 0, 36 ),
12771184 ),
12781185 83 => array(
1279 - 'in' => array( 1, 42 ),
1280 - 'pow' => array( 1, 42 ),
1281 - 'equalsto' => array( 1, 42 ),
1282 - 'trinary' => array( 1, 42 ),
1283 - 'semicolon' => array( 1, 42 ),
1284 - 'rightbracket' => array( 1, 42 ),
1285 - 'colon' => array( 1, 42 ),
1286 - 'logicop' => array( 1, 42 ),
1287 - 'compareop' => array( 1, 42 ),
1288 - 'sum' => array( 1, 42 ),
1289 - 'mul' => array( 1, 42 ),
1290 - 'contains' => array( 1, 42 ),
1291 - 'rightsquare' => array( 1, 42 ),
1292 - 'comma' => array( 1, 42 ),
1293 - 'rightcurly' => array( 1, 42 ),
 1186+ 'rightbracket' => array( 1, 72 ),
 1187+ 'setto' => array( 1, 72 ),
 1188+ 'in' => array( 1, 72 ),
 1189+ 'pow' => array( 1, 72 ),
 1190+ 'equalsto' => array( 1, 72 ),
 1191+ 'trinary' => array( 1, 72 ),
 1192+ 'semicolon' => array( 1, 72 ),
 1193+ 'colon' => array( 1, 72 ),
 1194+ 'logicop' => array( 1, 72 ),
 1195+ 'compareop' => array( 1, 72 ),
 1196+ 'sum' => array( 1, 72 ),
 1197+ 'mul' => array( 1, 72 ),
 1198+ 'contains' => array( 1, 72 ),
 1199+ 'leftsquare' => array( 1, 72 ),
 1200+ 'doublecolon' => array( 1, 72 ),
 1201+ 'rightsquare' => array( 1, 72 ),
 1202+ 'comma' => array( 1, 72 ),
 1203+ 'rightcurly' => array( 1, 72 ),
12941204 ),
12951205 84 => array(
1296 - 'id' => array( 0, 8 ),
1297 - 'invert' => array( 0, 7 ),
1298 - 'sum' => array( 0, 6 ),
1299 - 'isset' => array( 0, 12 ),
1300 - 'delete' => array( 0, 13 ),
1301 - 'break' => array( 0, 9 ),
1302 - 'continue' => array( 0, 10 ),
1303 - 'leftbracket' => array( 0, 2 ),
1304 - 'leftsquare' => array( 0, 11 ),
1305 - 'leftcurly' => array( 0, 40 ),
1306 - 'string' => array( 0, 14 ),
1307 - 'int' => array( 0, 15 ),
1308 - 'float' => array( 0, 16 ),
1309 - 'true' => array( 0, 17 ),
1310 - 'false' => array( 0, 18 ),
1311 - 'null' => array( 0, 19 ),
 1206+ 'invert' => array( 0, 24 ),
 1207+ 'sum' => array( 0, 23 ),
 1208+ 'id' => array( 0, 71 ),
 1209+ 'self' => array( 0, 30 ),
 1210+ 'isset' => array( 0, 28 ),
 1211+ 'delete' => array( 0, 29 ),
 1212+ 'break' => array( 0, 25 ),
 1213+ 'continue' => array( 0, 26 ),
 1214+ 'leftbracket' => array( 0, 15 ),
 1215+ 'leftsquare' => array( 0, 27 ),
 1216+ 'leftcurly' => array( 0, 59 ),
 1217+ 'string' => array( 0, 31 ),
 1218+ 'int' => array( 0, 32 ),
 1219+ 'float' => array( 0, 33 ),
 1220+ 'true' => array( 0, 34 ),
 1221+ 'false' => array( 0, 35 ),
 1222+ 'null' => array( 0, 36 ),
13121223 ),
13131224 85 => array(
1314 - 'semicolon' => array( 1, 10 ),
1315 - 'rightbracket' => array( 1, 10 ),
1316 - 'rightsquare' => array( 1, 10 ),
1317 - 'comma' => array( 1, 10 ),
1318 - 'colon' => array( 1, 10 ),
1319 - 'rightcurly' => array( 1, 10 ),
 1225+ 'invert' => array( 0, 24 ),
 1226+ 'sum' => array( 0, 23 ),
 1227+ 'id' => array( 0, 71 ),
 1228+ 'self' => array( 0, 30 ),
 1229+ 'isset' => array( 0, 28 ),
 1230+ 'delete' => array( 0, 29 ),
 1231+ 'break' => array( 0, 25 ),
 1232+ 'continue' => array( 0, 26 ),
 1233+ 'leftbracket' => array( 0, 15 ),
 1234+ 'leftsquare' => array( 0, 27 ),
 1235+ 'leftcurly' => array( 0, 59 ),
 1236+ 'string' => array( 0, 31 ),
 1237+ 'int' => array( 0, 32 ),
 1238+ 'float' => array( 0, 33 ),
 1239+ 'true' => array( 0, 34 ),
 1240+ 'false' => array( 0, 35 ),
 1241+ 'null' => array( 0, 36 ),
13201242 ),
13211243 86 => array(
1322 - 'rightbracket' => array( 1, 60 ),
1323 - 'setto' => array( 1, 60 ),
1324 - 'in' => array( 1, 60 ),
1325 - 'pow' => array( 1, 60 ),
1326 - 'equalsto' => array( 1, 60 ),
1327 - 'trinary' => array( 1, 60 ),
1328 - 'semicolon' => array( 1, 60 ),
1329 - 'colon' => array( 1, 60 ),
1330 - 'logicop' => array( 1, 60 ),
1331 - 'compareop' => array( 1, 60 ),
1332 - 'sum' => array( 1, 60 ),
1333 - 'mul' => array( 1, 60 ),
1334 - 'contains' => array( 1, 60 ),
1335 - 'leftsquare' => array( 1, 60 ),
1336 - 'rightsquare' => array( 1, 60 ),
1337 - 'comma' => array( 1, 60 ),
1338 - 'rightcurly' => array( 1, 60 ),
 1244+ 'invert' => array( 0, 24 ),
 1245+ 'sum' => array( 0, 23 ),
 1246+ 'id' => array( 0, 71 ),
 1247+ 'self' => array( 0, 30 ),
 1248+ 'isset' => array( 0, 28 ),
 1249+ 'delete' => array( 0, 29 ),
 1250+ 'break' => array( 0, 25 ),
 1251+ 'continue' => array( 0, 26 ),
 1252+ 'leftbracket' => array( 0, 15 ),
 1253+ 'leftsquare' => array( 0, 27 ),
 1254+ 'leftcurly' => array( 0, 59 ),
 1255+ 'string' => array( 0, 31 ),
 1256+ 'int' => array( 0, 32 ),
 1257+ 'float' => array( 0, 33 ),
 1258+ 'true' => array( 0, 34 ),
 1259+ 'false' => array( 0, 35 ),
 1260+ 'null' => array( 0, 36 ),
13391261 ),
13401262 87 => array(
1341 - 'rightsquare' => array( 0, 106 ),
 1263+ 'invert' => array( 0, 24 ),
 1264+ 'sum' => array( 0, 23 ),
 1265+ 'id' => array( 0, 71 ),
 1266+ 'self' => array( 0, 30 ),
 1267+ 'isset' => array( 0, 28 ),
 1268+ 'delete' => array( 0, 29 ),
 1269+ 'break' => array( 0, 25 ),
 1270+ 'continue' => array( 0, 26 ),
 1271+ 'leftbracket' => array( 0, 15 ),
 1272+ 'leftsquare' => array( 0, 27 ),
 1273+ 'leftcurly' => array( 0, 59 ),
 1274+ 'string' => array( 0, 31 ),
 1275+ 'int' => array( 0, 32 ),
 1276+ 'float' => array( 0, 33 ),
 1277+ 'true' => array( 0, 34 ),
 1278+ 'false' => array( 0, 35 ),
 1279+ 'null' => array( 0, 36 ),
13421280 ),
13431281 88 => array(
1344 - 'colon' => array( 0, 107 ),
 1282+ 'invert' => array( 0, 24 ),
 1283+ 'sum' => array( 0, 23 ),
 1284+ 'id' => array( 0, 71 ),
 1285+ 'self' => array( 0, 30 ),
 1286+ 'isset' => array( 0, 28 ),
 1287+ 'delete' => array( 0, 29 ),
 1288+ 'break' => array( 0, 25 ),
 1289+ 'continue' => array( 0, 26 ),
 1290+ 'leftbracket' => array( 0, 15 ),
 1291+ 'leftsquare' => array( 0, 27 ),
 1292+ 'leftcurly' => array( 0, 59 ),
 1293+ 'string' => array( 0, 31 ),
 1294+ 'int' => array( 0, 32 ),
 1295+ 'float' => array( 0, 33 ),
 1296+ 'true' => array( 0, 34 ),
 1297+ 'false' => array( 0, 35 ),
 1298+ 'null' => array( 0, 36 ),
13451299 ),
13461300 89 => array(
1347 - 'trinary' => array( 1, 14 ),
1348 - 'semicolon' => array( 1, 14 ),
1349 - 'rightbracket' => array( 1, 14 ),
1350 - 'colon' => array( 1, 14 ),
1351 - 'logicop' => array( 1, 14 ),
1352 - 'rightsquare' => array( 1, 14 ),
1353 - 'comma' => array( 1, 14 ),
1354 - 'rightcurly' => array( 1, 14 ),
1355 - 'compareop' => array( 0, 62 ),
 1301+ 'invert' => array( 0, 24 ),
 1302+ 'sum' => array( 0, 23 ),
 1303+ 'id' => array( 0, 71 ),
 1304+ 'self' => array( 0, 30 ),
 1305+ 'isset' => array( 0, 28 ),
 1306+ 'delete' => array( 0, 29 ),
 1307+ 'break' => array( 0, 25 ),
 1308+ 'continue' => array( 0, 26 ),
 1309+ 'leftbracket' => array( 0, 15 ),
 1310+ 'leftsquare' => array( 0, 27 ),
 1311+ 'leftcurly' => array( 0, 59 ),
 1312+ 'string' => array( 0, 31 ),
 1313+ 'int' => array( 0, 32 ),
 1314+ 'float' => array( 0, 33 ),
 1315+ 'true' => array( 0, 34 ),
 1316+ 'false' => array( 0, 35 ),
 1317+ 'null' => array( 0, 36 ),
13561318 ),
13571319 90 => array(
1358 - 'trinary' => array( 1, 16 ),
1359 - 'semicolon' => array( 1, 16 ),
1360 - 'rightbracket' => array( 1, 16 ),
1361 - 'colon' => array( 1, 16 ),
1362 - 'logicop' => array( 1, 16 ),
1363 - 'compareop' => array( 1, 16 ),
1364 - 'rightsquare' => array( 1, 16 ),
1365 - 'comma' => array( 1, 16 ),
1366 - 'rightcurly' => array( 1, 16 ),
 1320+ 'invert' => array( 0, 24 ),
 1321+ 'sum' => array( 0, 23 ),
 1322+ 'id' => array( 0, 71 ),
 1323+ 'self' => array( 0, 30 ),
 1324+ 'isset' => array( 0, 28 ),
 1325+ 'delete' => array( 0, 29 ),
 1326+ 'break' => array( 0, 25 ),
 1327+ 'continue' => array( 0, 26 ),
 1328+ 'leftbracket' => array( 0, 15 ),
 1329+ 'leftsquare' => array( 0, 27 ),
 1330+ 'leftcurly' => array( 0, 59 ),
 1331+ 'string' => array( 0, 31 ),
 1332+ 'int' => array( 0, 32 ),
 1333+ 'float' => array( 0, 33 ),
 1334+ 'true' => array( 0, 34 ),
 1335+ 'false' => array( 0, 35 ),
 1336+ 'null' => array( 0, 36 ),
13671337 ),
13681338 91 => array(
1369 - 'trinary' => array( 1, 18 ),
1370 - 'semicolon' => array( 1, 18 ),
1371 - 'rightbracket' => array( 1, 18 ),
1372 - 'colon' => array( 1, 18 ),
1373 - 'logicop' => array( 1, 18 ),
1374 - 'compareop' => array( 1, 18 ),
1375 - 'rightsquare' => array( 1, 18 ),
1376 - 'comma' => array( 1, 18 ),
1377 - 'rightcurly' => array( 1, 18 ),
1378 - 'sum' => array( 0, 64 ),
 1339+ 'sum' => array( 0, 23 ),
 1340+ 'id' => array( 0, 71 ),
 1341+ 'self' => array( 0, 30 ),
 1342+ 'isset' => array( 0, 28 ),
 1343+ 'delete' => array( 0, 29 ),
 1344+ 'break' => array( 0, 25 ),
 1345+ 'continue' => array( 0, 26 ),
 1346+ 'leftbracket' => array( 0, 15 ),
 1347+ 'leftsquare' => array( 0, 27 ),
 1348+ 'leftcurly' => array( 0, 59 ),
 1349+ 'string' => array( 0, 31 ),
 1350+ 'int' => array( 0, 32 ),
 1351+ 'float' => array( 0, 33 ),
 1352+ 'true' => array( 0, 34 ),
 1353+ 'false' => array( 0, 35 ),
 1354+ 'null' => array( 0, 36 ),
13791355 ),
13801356 92 => array(
1381 - 'equalsto' => array( 1, 20 ),
1382 - 'trinary' => array( 1, 20 ),
1383 - 'semicolon' => array( 1, 20 ),
1384 - 'rightbracket' => array( 1, 20 ),
1385 - 'colon' => array( 1, 20 ),
1386 - 'logicop' => array( 1, 20 ),
1387 - 'compareop' => array( 1, 20 ),
1388 - 'sum' => array( 1, 20 ),
1389 - 'rightsquare' => array( 1, 20 ),
1390 - 'comma' => array( 1, 20 ),
1391 - 'rightcurly' => array( 1, 20 ),
1392 - 'mul' => array( 0, 65 ),
 1357+ 'sum' => array( 0, 23 ),
 1358+ 'id' => array( 0, 71 ),
 1359+ 'self' => array( 0, 30 ),
 1360+ 'isset' => array( 0, 28 ),
 1361+ 'delete' => array( 0, 29 ),
 1362+ 'break' => array( 0, 25 ),
 1363+ 'continue' => array( 0, 26 ),
 1364+ 'leftbracket' => array( 0, 15 ),
 1365+ 'leftsquare' => array( 0, 27 ),
 1366+ 'leftcurly' => array( 0, 59 ),
 1367+ 'string' => array( 0, 31 ),
 1368+ 'int' => array( 0, 32 ),
 1369+ 'float' => array( 0, 33 ),
 1370+ 'true' => array( 0, 34 ),
 1371+ 'false' => array( 0, 35 ),
 1372+ 'null' => array( 0, 36 ),
13931373 ),
13941374 93 => array(
1395 - 'equalsto' => array( 1, 22 ),
1396 - 'trinary' => array( 1, 22 ),
1397 - 'semicolon' => array( 1, 22 ),
1398 - 'rightbracket' => array( 1, 22 ),
1399 - 'colon' => array( 1, 22 ),
1400 - 'logicop' => array( 1, 22 ),
1401 - 'compareop' => array( 1, 22 ),
1402 - 'sum' => array( 1, 22 ),
1403 - 'mul' => array( 1, 22 ),
1404 - 'rightsquare' => array( 1, 22 ),
1405 - 'comma' => array( 1, 22 ),
1406 - 'rightcurly' => array( 1, 22 ),
 1375+ 'rightbracket' => array( 0, 123 ),
 1376+ 'return' => array( 0, 20 ),
 1377+ 'append' => array( 0, 21 ),
 1378+ 'yield' => array( 0, 22 ),
 1379+ 'id' => array( 0, 14 ),
 1380+ 'invert' => array( 0, 24 ),
 1381+ 'sum' => array( 0, 23 ),
 1382+ 'self' => array( 0, 30 ),
 1383+ 'isset' => array( 0, 28 ),
 1384+ 'delete' => array( 0, 29 ),
 1385+ 'break' => array( 0, 25 ),
 1386+ 'continue' => array( 0, 26 ),
 1387+ 'leftbracket' => array( 0, 15 ),
 1388+ 'leftsquare' => array( 0, 27 ),
 1389+ 'leftcurly' => array( 0, 59 ),
 1390+ 'string' => array( 0, 31 ),
 1391+ 'int' => array( 0, 32 ),
 1392+ 'float' => array( 0, 33 ),
 1393+ 'true' => array( 0, 34 ),
 1394+ 'false' => array( 0, 35 ),
 1395+ 'null' => array( 0, 36 ),
14071396 ),
14081397 94 => array(
1409 - 'equalsto' => array( 1, 24 ),
1410 - 'trinary' => array( 1, 24 ),
1411 - 'semicolon' => array( 1, 24 ),
1412 - 'rightbracket' => array( 1, 24 ),
1413 - 'colon' => array( 1, 24 ),
1414 - 'logicop' => array( 1, 24 ),
1415 - 'compareop' => array( 1, 24 ),
1416 - 'sum' => array( 1, 24 ),
1417 - 'mul' => array( 1, 24 ),
1418 - 'rightsquare' => array( 1, 24 ),
1419 - 'comma' => array( 1, 24 ),
1420 - 'rightcurly' => array( 1, 24 ),
 1398+ 'id' => array( 0, 104 ),
14211399 ),
14221400 95 => array(
1423 - 'pow' => array( 1, 28 ),
1424 - 'equalsto' => array( 1, 28 ),
1425 - 'trinary' => array( 1, 28 ),
1426 - 'semicolon' => array( 1, 28 ),
1427 - 'rightbracket' => array( 1, 28 ),
1428 - 'colon' => array( 1, 28 ),
1429 - 'logicop' => array( 1, 28 ),
1430 - 'compareop' => array( 1, 28 ),
1431 - 'sum' => array( 1, 28 ),
1432 - 'mul' => array( 1, 28 ),
1433 - 'rightsquare' => array( 1, 28 ),
1434 - 'comma' => array( 1, 28 ),
1435 - 'rightcurly' => array( 1, 28 ),
 1401+ 'id' => array( 0, 126 ),
14361402 ),
14371403 96 => array(
1438 - 'pow' => array( 1, 29 ),
1439 - 'equalsto' => array( 1, 29 ),
1440 - 'trinary' => array( 1, 29 ),
1441 - 'semicolon' => array( 1, 29 ),
1442 - 'rightbracket' => array( 1, 29 ),
1443 - 'colon' => array( 1, 29 ),
1444 - 'logicop' => array( 1, 29 ),
1445 - 'compareop' => array( 1, 29 ),
1446 - 'sum' => array( 1, 29 ),
1447 - 'mul' => array( 1, 29 ),
1448 - 'rightsquare' => array( 1, 29 ),
1449 - 'comma' => array( 1, 29 ),
1450 - 'rightcurly' => array( 1, 29 ),
 1404+ 'rightcurly' => array( 0, 127 ),
 1405+ 'if' => array( 0, 17 ),
 1406+ 'for' => array( 0, 18 ),
 1407+ 'try' => array( 0, 19 ),
 1408+ 'leftcurly' => array( 0, 16 ),
 1409+ 'return' => array( 0, 20 ),
 1410+ 'append' => array( 0, 21 ),
 1411+ 'yield' => array( 0, 22 ),
 1412+ 'id' => array( 0, 14 ),
 1413+ 'invert' => array( 0, 24 ),
 1414+ 'sum' => array( 0, 23 ),
 1415+ 'self' => array( 0, 30 ),
 1416+ 'isset' => array( 0, 28 ),
 1417+ 'delete' => array( 0, 29 ),
 1418+ 'break' => array( 0, 25 ),
 1419+ 'continue' => array( 0, 26 ),
 1420+ 'leftbracket' => array( 0, 15 ),
 1421+ 'leftsquare' => array( 0, 27 ),
 1422+ 'string' => array( 0, 31 ),
 1423+ 'int' => array( 0, 32 ),
 1424+ 'float' => array( 0, 33 ),
 1425+ 'true' => array( 0, 34 ),
 1426+ 'false' => array( 0, 35 ),
 1427+ 'null' => array( 0, 36 ),
14511428 ),
14521429 97 => array(
1453 - 'rightbracket' => array( 0, 108 ),
1454 - 'leftsquare' => array( 0, 58 ),
 1430+ 'colon' => array( 0, 100 ),
14551431 ),
14561432 98 => array(
1457 - 'if' => array( 0, 1 ),
1458 - 'for' => array( 0, 3 ),
1459 - 'try' => array( 0, 4 ),
1460 - 'leftcurly' => array( 0, 5 ),
1461 - 'id' => array( 0, 8 ),
1462 - 'invert' => array( 0, 7 ),
1463 - 'sum' => array( 0, 6 ),
1464 - 'isset' => array( 0, 12 ),
1465 - 'delete' => array( 0, 13 ),
1466 - 'break' => array( 0, 9 ),
1467 - 'continue' => array( 0, 10 ),
1468 - 'leftbracket' => array( 0, 2 ),
1469 - 'leftsquare' => array( 0, 11 ),
1470 - 'string' => array( 0, 14 ),
1471 - 'int' => array( 0, 15 ),
1472 - 'float' => array( 0, 16 ),
1473 - 'true' => array( 0, 17 ),
1474 - 'false' => array( 0, 18 ),
1475 - 'null' => array( 0, 19 ),
 1433+ 'in' => array( 1, 52 ),
 1434+ 'pow' => array( 1, 52 ),
 1435+ 'equalsto' => array( 1, 52 ),
 1436+ 'trinary' => array( 1, 52 ),
 1437+ 'semicolon' => array( 1, 52 ),
 1438+ 'rightbracket' => array( 1, 52 ),
 1439+ 'colon' => array( 1, 52 ),
 1440+ 'logicop' => array( 1, 52 ),
 1441+ 'compareop' => array( 1, 52 ),
 1442+ 'sum' => array( 1, 52 ),
 1443+ 'mul' => array( 1, 52 ),
 1444+ 'contains' => array( 1, 52 ),
 1445+ 'doublecolon' => array( 1, 52 ),
 1446+ 'rightsquare' => array( 1, 52 ),
 1447+ 'comma' => array( 1, 52 ),
 1448+ 'rightcurly' => array( 1, 52 ),
14761449 ),
14771450 99 => array(
1478 - 'id' => array( 0, 8 ),
1479 - 'invert' => array( 0, 7 ),
1480 - 'sum' => array( 0, 6 ),
1481 - 'isset' => array( 0, 12 ),
1482 - 'delete' => array( 0, 13 ),
1483 - 'break' => array( 0, 9 ),
1484 - 'continue' => array( 0, 10 ),
1485 - 'leftbracket' => array( 0, 2 ),
1486 - 'leftsquare' => array( 0, 11 ),
1487 - 'leftcurly' => array( 0, 40 ),
1488 - 'string' => array( 0, 14 ),
1489 - 'int' => array( 0, 15 ),
1490 - 'float' => array( 0, 16 ),
1491 - 'true' => array( 0, 17 ),
1492 - 'false' => array( 0, 18 ),
1493 - 'null' => array( 0, 19 ),
 1451+ 'rightcurly' => array( 1, 14 ),
 1452+ 'if' => array( 1, 14 ),
 1453+ 'for' => array( 1, 14 ),
 1454+ 'try' => array( 1, 14 ),
 1455+ 'leftcurly' => array( 1, 14 ),
 1456+ 'return' => array( 1, 14 ),
 1457+ 'append' => array( 1, 14 ),
 1458+ 'yield' => array( 1, 14 ),
 1459+ 'id' => array( 1, 14 ),
 1460+ 'invert' => array( 1, 14 ),
 1461+ 'sum' => array( 1, 14 ),
 1462+ 'break' => array( 1, 14 ),
 1463+ 'continue' => array( 1, 14 ),
 1464+ 'leftbracket' => array( 1, 14 ),
 1465+ 'leftsquare' => array( 1, 14 ),
 1466+ 'self' => array( 1, 14 ),
 1467+ 'isset' => array( 1, 14 ),
 1468+ 'delete' => array( 1, 14 ),
 1469+ 'string' => array( 1, 14 ),
 1470+ 'int' => array( 1, 14 ),
 1471+ 'float' => array( 1, 14 ),
 1472+ 'true' => array( 1, 14 ),
 1473+ 'false' => array( 1, 14 ),
 1474+ 'null' => array( 1, 14 ),
 1475+ 'else' => array( 1, 14 ),
 1476+ 'catch' => array( 1, 14 ),
14941477 ),
14951478 100 => array(
1496 - 'id' => array( 0, 73 ),
 1479+ 'return' => array( 0, 20 ),
 1480+ 'append' => array( 0, 21 ),
 1481+ 'yield' => array( 0, 22 ),
 1482+ 'id' => array( 0, 14 ),
 1483+ 'invert' => array( 0, 24 ),
 1484+ 'sum' => array( 0, 23 ),
 1485+ 'self' => array( 0, 30 ),
 1486+ 'isset' => array( 0, 28 ),
 1487+ 'delete' => array( 0, 29 ),
 1488+ 'break' => array( 0, 25 ),
 1489+ 'continue' => array( 0, 26 ),
 1490+ 'leftbracket' => array( 0, 15 ),
 1491+ 'leftsquare' => array( 0, 27 ),
 1492+ 'leftcurly' => array( 0, 59 ),
 1493+ 'string' => array( 0, 31 ),
 1494+ 'int' => array( 0, 32 ),
 1495+ 'float' => array( 0, 33 ),
 1496+ 'true' => array( 0, 34 ),
 1497+ 'false' => array( 0, 35 ),
 1498+ 'null' => array( 0, 36 ),
14971499 ),
14981500 101 => array(
1499 - 'id' => array( 0, 73 ),
 1501+ 'in' => array( 1, 54 ),
 1502+ 'pow' => array( 1, 54 ),
 1503+ 'equalsto' => array( 1, 54 ),
 1504+ 'trinary' => array( 1, 54 ),
 1505+ 'semicolon' => array( 1, 54 ),
 1506+ 'rightbracket' => array( 1, 54 ),
 1507+ 'colon' => array( 1, 54 ),
 1508+ 'logicop' => array( 1, 54 ),
 1509+ 'compareop' => array( 1, 54 ),
 1510+ 'sum' => array( 1, 54 ),
 1511+ 'mul' => array( 1, 54 ),
 1512+ 'contains' => array( 1, 54 ),
 1513+ 'doublecolon' => array( 1, 54 ),
 1514+ 'rightsquare' => array( 1, 54 ),
 1515+ 'comma' => array( 1, 54 ),
 1516+ 'rightcurly' => array( 1, 54 ),
15001517 ),
15011518 102 => array(
1502 - 'rightcurly' => array( 1, 50 ),
1503 - 'comma' => array( 1, 50 ),
 1519+ 'return' => array( 0, 20 ),
 1520+ 'append' => array( 0, 21 ),
 1521+ 'yield' => array( 0, 22 ),
 1522+ 'id' => array( 0, 14 ),
 1523+ 'invert' => array( 0, 24 ),
 1524+ 'sum' => array( 0, 23 ),
 1525+ 'self' => array( 0, 30 ),
 1526+ 'isset' => array( 0, 28 ),
 1527+ 'delete' => array( 0, 29 ),
 1528+ 'break' => array( 0, 25 ),
 1529+ 'continue' => array( 0, 26 ),
 1530+ 'leftbracket' => array( 0, 15 ),
 1531+ 'leftsquare' => array( 0, 27 ),
 1532+ 'leftcurly' => array( 0, 59 ),
 1533+ 'string' => array( 0, 31 ),
 1534+ 'int' => array( 0, 32 ),
 1535+ 'float' => array( 0, 33 ),
 1536+ 'true' => array( 0, 34 ),
 1537+ 'false' => array( 0, 35 ),
 1538+ 'null' => array( 0, 36 ),
15041539 ),
15051540 103 => array(
1506 - 'rightcurly' => array( 1, 48 ),
1507 - 'comma' => array( 1, 48 ),
 1541+ 'rightbracket' => array( 0, 130 ),
15081542 ),
15091543 104 => array(
1510 - 'in' => array( 1, 33 ),
1511 - 'pow' => array( 1, 33 ),
 1544+ 'rightbracket' => array( 1, 71 ),
 1545+ 'setto' => array( 1, 71 ),
 1546+ 'in' => array( 1, 71 ),
 1547+ 'pow' => array( 1, 71 ),
 1548+ 'equalsto' => array( 1, 71 ),
 1549+ 'trinary' => array( 1, 71 ),
 1550+ 'semicolon' => array( 1, 71 ),
 1551+ 'colon' => array( 1, 71 ),
 1552+ 'logicop' => array( 1, 71 ),
 1553+ 'compareop' => array( 1, 71 ),
 1554+ 'sum' => array( 1, 71 ),
 1555+ 'mul' => array( 1, 71 ),
 1556+ 'contains' => array( 1, 71 ),
 1557+ 'leftsquare' => array( 1, 71 ),
 1558+ 'doublecolon' => array( 1, 71 ),
 1559+ 'rightsquare' => array( 1, 71 ),
 1560+ 'comma' => array( 1, 71 ),
 1561+ 'rightcurly' => array( 1, 71 ),
 1562+ ),
 1563+ 105 => array(
 1564+ 'in' => array( 0, 131 ),
 1565+ ),
 1566+ 106 => array(
 1567+ 'in' => array( 1, 75 ),
 1568+ 'colon' => array( 0, 132 ),
 1569+ 'leftsquare' => array( 0, 82 ),
 1570+ ),
 1571+ 107 => array(
 1572+ 'leftbracket' => array( 0, 133 ),
 1573+ ),
 1574+ 108 => array(
 1575+ 'return' => array( 0, 20 ),
 1576+ 'append' => array( 0, 21 ),
 1577+ 'yield' => array( 0, 22 ),
 1578+ 'id' => array( 0, 14 ),
 1579+ 'invert' => array( 0, 24 ),
 1580+ 'sum' => array( 0, 23 ),
 1581+ 'self' => array( 0, 30 ),
 1582+ 'isset' => array( 0, 28 ),
 1583+ 'delete' => array( 0, 29 ),
 1584+ 'break' => array( 0, 25 ),
 1585+ 'continue' => array( 0, 26 ),
 1586+ 'leftbracket' => array( 0, 15 ),
 1587+ 'leftsquare' => array( 0, 27 ),
 1588+ 'leftcurly' => array( 0, 59 ),
 1589+ 'string' => array( 0, 31 ),
 1590+ 'int' => array( 0, 32 ),
 1591+ 'float' => array( 0, 33 ),
 1592+ 'true' => array( 0, 34 ),
 1593+ 'false' => array( 0, 35 ),
 1594+ 'null' => array( 0, 36 ),
 1595+ ),
 1596+ 109 => array(
 1597+ 'in' => array( 1, 53 ),
 1598+ 'pow' => array( 1, 53 ),
 1599+ 'equalsto' => array( 1, 53 ),
 1600+ 'trinary' => array( 1, 53 ),
 1601+ 'semicolon' => array( 1, 53 ),
 1602+ 'rightbracket' => array( 1, 53 ),
 1603+ 'colon' => array( 1, 53 ),
 1604+ 'logicop' => array( 1, 53 ),
 1605+ 'compareop' => array( 1, 53 ),
 1606+ 'sum' => array( 1, 53 ),
 1607+ 'mul' => array( 1, 53 ),
 1608+ 'contains' => array( 1, 53 ),
 1609+ 'doublecolon' => array( 1, 53 ),
 1610+ 'rightsquare' => array( 1, 53 ),
 1611+ 'comma' => array( 1, 53 ),
 1612+ 'rightcurly' => array( 1, 53 ),
 1613+ ),
 1614+ 110 => array(
 1615+ 'leftbracket' => array( 1, 59 ),
 1616+ ),
 1617+ 111 => array(
 1618+ 'semicolon' => array( 1, 21 ),
 1619+ 'rightbracket' => array( 1, 21 ),
 1620+ 'rightsquare' => array( 1, 21 ),
 1621+ 'comma' => array( 1, 21 ),
 1622+ 'colon' => array( 1, 21 ),
 1623+ 'rightcurly' => array( 1, 21 ),
 1624+ ),
 1625+ 112 => array(
 1626+ 'rightbracket' => array( 1, 74 ),
 1627+ 'setto' => array( 1, 74 ),
 1628+ 'in' => array( 1, 74 ),
 1629+ 'pow' => array( 1, 74 ),
 1630+ 'equalsto' => array( 1, 74 ),
 1631+ 'trinary' => array( 1, 74 ),
 1632+ 'semicolon' => array( 1, 74 ),
 1633+ 'colon' => array( 1, 74 ),
 1634+ 'logicop' => array( 1, 74 ),
 1635+ 'compareop' => array( 1, 74 ),
 1636+ 'sum' => array( 1, 74 ),
 1637+ 'mul' => array( 1, 74 ),
 1638+ 'contains' => array( 1, 74 ),
 1639+ 'leftsquare' => array( 1, 74 ),
 1640+ 'doublecolon' => array( 1, 74 ),
 1641+ 'rightsquare' => array( 1, 74 ),
 1642+ 'comma' => array( 1, 74 ),
 1643+ 'rightcurly' => array( 1, 74 ),
 1644+ ),
 1645+ 113 => array(
 1646+ 'rightsquare' => array( 0, 135 ),
 1647+ ),
 1648+ 114 => array(
 1649+ 'colon' => array( 0, 136 ),
 1650+ ),
 1651+ 115 => array(
 1652+ 'trinary' => array( 1, 25 ),
 1653+ 'semicolon' => array( 1, 25 ),
 1654+ 'rightbracket' => array( 1, 25 ),
 1655+ 'colon' => array( 1, 25 ),
 1656+ 'logicop' => array( 1, 25 ),
 1657+ 'rightsquare' => array( 1, 25 ),
 1658+ 'comma' => array( 1, 25 ),
 1659+ 'rightcurly' => array( 1, 25 ),
 1660+ 'compareop' => array( 0, 86 ),
 1661+ ),
 1662+ 116 => array(
 1663+ 'trinary' => array( 1, 27 ),
 1664+ 'semicolon' => array( 1, 27 ),
 1665+ 'rightbracket' => array( 1, 27 ),
 1666+ 'colon' => array( 1, 27 ),
 1667+ 'logicop' => array( 1, 27 ),
 1668+ 'compareop' => array( 1, 27 ),
 1669+ 'rightsquare' => array( 1, 27 ),
 1670+ 'comma' => array( 1, 27 ),
 1671+ 'rightcurly' => array( 1, 27 ),
 1672+ ),
 1673+ 117 => array(
 1674+ 'trinary' => array( 1, 29 ),
 1675+ 'semicolon' => array( 1, 29 ),
 1676+ 'rightbracket' => array( 1, 29 ),
 1677+ 'colon' => array( 1, 29 ),
 1678+ 'logicop' => array( 1, 29 ),
 1679+ 'compareop' => array( 1, 29 ),
 1680+ 'rightsquare' => array( 1, 29 ),
 1681+ 'comma' => array( 1, 29 ),
 1682+ 'rightcurly' => array( 1, 29 ),
 1683+ 'sum' => array( 0, 88 ),
 1684+ ),
 1685+ 118 => array(
 1686+ 'equalsto' => array( 1, 31 ),
 1687+ 'trinary' => array( 1, 31 ),
 1688+ 'semicolon' => array( 1, 31 ),
 1689+ 'rightbracket' => array( 1, 31 ),
 1690+ 'colon' => array( 1, 31 ),
 1691+ 'logicop' => array( 1, 31 ),
 1692+ 'compareop' => array( 1, 31 ),
 1693+ 'sum' => array( 1, 31 ),
 1694+ 'rightsquare' => array( 1, 31 ),
 1695+ 'comma' => array( 1, 31 ),
 1696+ 'rightcurly' => array( 1, 31 ),
 1697+ 'mul' => array( 0, 89 ),
 1698+ ),
 1699+ 119 => array(
15121700 'equalsto' => array( 1, 33 ),
15131701 'trinary' => array( 1, 33 ),
15141702 'semicolon' => array( 1, 33 ),
——@@ -1517,56 +1705,11 @@
15181706 'compareop' => array( 1, 33 ),
15191707 'sum' => array( 1, 33 ),
15201708 'mul' => array( 1, 33 ),
1521 - 'contains' => array( 1, 33 ),
15221709 'rightsquare' => array( 1, 33 ),
15231710 'comma' => array( 1, 33 ),
15241711 'rightcurly' => array( 1, 33 ),
15251712 ),
1526 - 105 => array(
1527 - 'rightbracket' => array( 1, 46 ),
1528 - 'rightsquare' => array( 1, 46 ),
1529 - 'comma' => array( 1, 46 ),
1530 - ),
1531 - 106 => array(
1532 - 'rightbracket' => array( 1, 59 ),
1533 - 'setto' => array( 1, 59 ),
1534 - 'in' => array( 1, 59 ),
1535 - 'pow' => array( 1, 59 ),
1536 - 'equalsto' => array( 1, 59 ),
1537 - 'trinary' => array( 1, 59 ),
1538 - 'semicolon' => array( 1, 59 ),
1539 - 'colon' => array( 1, 59 ),
1540 - 'logicop' => array( 1, 59 ),
1541 - 'compareop' => array( 1, 59 ),
1542 - 'sum' => array( 1, 59 ),
1543 - 'mul' => array( 1, 59 ),
1544 - 'contains' => array( 1, 59 ),
1545 - 'leftsquare' => array( 1, 59 ),
1546 - 'rightsquare' => array( 1, 59 ),
1547 - 'comma' => array( 1, 59 ),
1548 - 'rightcurly' => array( 1, 59 ),
1549 - ),
1550 - 107 => array(
1551 - 'invert' => array( 0, 7 ),
1552 - 'sum' => array( 0, 6 ),
1553 - 'id' => array( 0, 48 ),
1554 - 'isset' => array( 0, 12 ),
1555 - 'delete' => array( 0, 13 ),
1556 - 'break' => array( 0, 9 ),
1557 - 'continue' => array( 0, 10 ),
1558 - 'leftbracket' => array( 0, 2 ),
1559 - 'leftsquare' => array( 0, 11 ),
1560 - 'leftcurly' => array( 0, 40 ),
1561 - 'string' => array( 0, 14 ),
1562 - 'int' => array( 0, 15 ),
1563 - 'float' => array( 0, 16 ),
1564 - 'true' => array( 0, 17 ),
1565 - 'false' => array( 0, 18 ),
1566 - 'null' => array( 0, 19 ),
1567 - ),
1568 - 108 => array(
1569 - 'in' => array( 1, 35 ),
1570 - 'pow' => array( 1, 35 ),
 1713+ 120 => array(
15711714 'equalsto' => array( 1, 35 ),
15721715 'trinary' => array( 1, 35 ),
15731716 'semicolon' => array( 1, 35 ),
——@@ -1576,224 +1719,448 @@
15771720 'compareop' => array( 1, 35 ),
15781721 'sum' => array( 1, 35 ),
15791722 'mul' => array( 1, 35 ),
1580 - 'contains' => array( 1, 35 ),
15811723 'rightsquare' => array( 1, 35 ),
15821724 'comma' => array( 1, 35 ),
15831725 'rightcurly' => array( 1, 35 ),
15841726 ),
1585 - 109 => array(
1586 - '$' => array( 1, 4 ),
1587 - 'if' => array( 1, 4 ),
1588 - 'for' => array( 1, 4 ),
1589 - 'try' => array( 1, 4 ),
1590 - 'leftcurly' => array( 1, 4 ),
1591 - 'id' => array( 1, 4 ),
1592 - 'invert' => array( 1, 4 ),
1593 - 'sum' => array( 1, 4 ),
1594 - 'isset' => array( 1, 4 ),
1595 - 'delete' => array( 1, 4 ),
1596 - 'break' => array( 1, 4 ),
1597 - 'continue' => array( 1, 4 ),
1598 - 'leftbracket' => array( 1, 4 ),
1599 - 'leftsquare' => array( 1, 4 ),
1600 - 'string' => array( 1, 4 ),
1601 - 'int' => array( 1, 4 ),
1602 - 'float' => array( 1, 4 ),
1603 - 'true' => array( 1, 4 ),
1604 - 'false' => array( 1, 4 ),
1605 - 'null' => array( 1, 4 ),
1606 - 'else' => array( 0, 114 ),
1607 - 'catch' => array( 1, 4 ),
1608 - 'rightcurly' => array( 1, 4 ),
 1727+ 121 => array(
 1728+ 'pow' => array( 1, 39 ),
 1729+ 'equalsto' => array( 1, 39 ),
 1730+ 'trinary' => array( 1, 39 ),
 1731+ 'semicolon' => array( 1, 39 ),
 1732+ 'rightbracket' => array( 1, 39 ),
 1733+ 'colon' => array( 1, 39 ),
 1734+ 'logicop' => array( 1, 39 ),
 1735+ 'compareop' => array( 1, 39 ),
 1736+ 'sum' => array( 1, 39 ),
 1737+ 'mul' => array( 1, 39 ),
 1738+ 'rightsquare' => array( 1, 39 ),
 1739+ 'comma' => array( 1, 39 ),
 1740+ 'rightcurly' => array( 1, 39 ),
16091741 ),
1610 - 110 => array(
1611 - 'rightbracket' => array( 0, 115 ),
 1742+ 122 => array(
 1743+ 'pow' => array( 1, 40 ),
 1744+ 'equalsto' => array( 1, 40 ),
 1745+ 'trinary' => array( 1, 40 ),
 1746+ 'semicolon' => array( 1, 40 ),
 1747+ 'rightbracket' => array( 1, 40 ),
 1748+ 'colon' => array( 1, 40 ),
 1749+ 'logicop' => array( 1, 40 ),
 1750+ 'compareop' => array( 1, 40 ),
 1751+ 'sum' => array( 1, 40 ),
 1752+ 'mul' => array( 1, 40 ),
 1753+ 'rightsquare' => array( 1, 40 ),
 1754+ 'comma' => array( 1, 40 ),
 1755+ 'rightcurly' => array( 1, 40 ),
16121756 ),
1613 - 111 => array(
1614 - 'in' => array( 1, 62 ),
1615 - 'leftsquare' => array( 0, 58 ),
 1757+ 123 => array(
 1758+ 'in' => array( 1, 45 ),
 1759+ 'pow' => array( 1, 45 ),
 1760+ 'equalsto' => array( 1, 45 ),
 1761+ 'trinary' => array( 1, 45 ),
 1762+ 'semicolon' => array( 1, 45 ),
 1763+ 'rightbracket' => array( 1, 45 ),
 1764+ 'colon' => array( 1, 45 ),
 1765+ 'logicop' => array( 1, 45 ),
 1766+ 'compareop' => array( 1, 45 ),
 1767+ 'sum' => array( 1, 45 ),
 1768+ 'mul' => array( 1, 45 ),
 1769+ 'contains' => array( 1, 45 ),
 1770+ 'rightsquare' => array( 1, 45 ),
 1771+ 'comma' => array( 1, 45 ),
 1772+ 'rightcurly' => array( 1, 45 ),
16161773 ),
1617 - 112 => array(
1618 - 'rightbracket' => array( 0, 116 ),
1619 - 'leftsquare' => array( 0, 58 ),
 1774+ 124 => array(
 1775+ 'rightbracket' => array( 0, 137 ),
 1776+ 'comma' => array( 0, 108 ),
16201777 ),
1621 - 113 => array(
1622 - 'semicolon' => array( 1, 12 ),
1623 - 'rightbracket' => array( 1, 12 ),
1624 - 'colon' => array( 1, 12 ),
1625 - 'rightsquare' => array( 1, 12 ),
1626 - 'comma' => array( 1, 12 ),
1627 - 'rightcurly' => array( 1, 12 ),
 1778+ 125 => array(
 1779+ 'rightbracket' => array( 0, 138 ),
 1780+ 'leftsquare' => array( 0, 82 ),
16281781 ),
1629 - 114 => array(
1630 - 'if' => array( 0, 1 ),
1631 - 'for' => array( 0, 3 ),
1632 - 'try' => array( 0, 4 ),
1633 - 'leftcurly' => array( 0, 5 ),
1634 - 'id' => array( 0, 8 ),
1635 - 'invert' => array( 0, 7 ),
1636 - 'sum' => array( 0, 6 ),
1637 - 'isset' => array( 0, 12 ),
1638 - 'delete' => array( 0, 13 ),
1639 - 'break' => array( 0, 9 ),
1640 - 'continue' => array( 0, 10 ),
1641 - 'leftbracket' => array( 0, 2 ),
1642 - 'leftsquare' => array( 0, 11 ),
1643 - 'string' => array( 0, 14 ),
1644 - 'int' => array( 0, 15 ),
1645 - 'float' => array( 0, 16 ),
1646 - 'true' => array( 0, 17 ),
1647 - 'false' => array( 0, 18 ),
1648 - 'null' => array( 0, 19 ),
 1782+ 126 => array(
 1783+ 'leftbracket' => array( 1, 58 ),
16491784 ),
1650 - 115 => array(
1651 - 'if' => array( 0, 1 ),
1652 - 'for' => array( 0, 3 ),
1653 - 'try' => array( 0, 4 ),
1654 - 'leftcurly' => array( 0, 5 ),
1655 - 'id' => array( 0, 8 ),
1656 - 'invert' => array( 0, 7 ),
1657 - 'sum' => array( 0, 6 ),
1658 - 'isset' => array( 0, 12 ),
1659 - 'delete' => array( 0, 13 ),
1660 - 'break' => array( 0, 9 ),
1661 - 'continue' => array( 0, 10 ),
1662 - 'leftbracket' => array( 0, 2 ),
1663 - 'leftsquare' => array( 0, 11 ),
1664 - 'string' => array( 0, 14 ),
1665 - 'int' => array( 0, 15 ),
1666 - 'float' => array( 0, 16 ),
1667 - 'true' => array( 0, 17 ),
1668 - 'false' => array( 0, 18 ),
1669 - 'null' => array( 0, 19 ),
 1785+ 127 => array(
 1786+ 'function' => array( 1, 3 ),
 1787+ '$' => array( 1, 3 ),
16701788 ),
1671 - 116 => array(
1672 - 'if' => array( 0, 1 ),
1673 - 'for' => array( 0, 3 ),
1674 - 'try' => array( 0, 4 ),
1675 - 'leftcurly' => array( 0, 5 ),
1676 - 'id' => array( 0, 8 ),
1677 - 'invert' => array( 0, 7 ),
1678 - 'sum' => array( 0, 6 ),
1679 - 'isset' => array( 0, 12 ),
1680 - 'delete' => array( 0, 13 ),
1681 - 'break' => array( 0, 9 ),
1682 - 'continue' => array( 0, 10 ),
1683 - 'leftbracket' => array( 0, 2 ),
1684 - 'leftsquare' => array( 0, 11 ),
1685 - 'string' => array( 0, 14 ),
1686 - 'int' => array( 0, 15 ),
1687 - 'float' => array( 0, 16 ),
1688 - 'true' => array( 0, 17 ),
1689 - 'false' => array( 0, 18 ),
1690 - 'null' => array( 0, 19 ),
 1789+ 128 => array(
 1790+ 'rightcurly' => array( 1, 64 ),
 1791+ 'comma' => array( 1, 64 ),
16911792 ),
1692 - 117 => array(
1693 - '$' => array( 1, 5 ),
1694 - 'if' => array( 1, 5 ),
1695 - 'for' => array( 1, 5 ),
1696 - 'try' => array( 1, 5 ),
1697 - 'leftcurly' => array( 1, 5 ),
1698 - 'id' => array( 1, 5 ),
1699 - 'invert' => array( 1, 5 ),
1700 - 'sum' => array( 1, 5 ),
1701 - 'isset' => array( 1, 5 ),
1702 - 'delete' => array( 1, 5 ),
1703 - 'break' => array( 1, 5 ),
1704 - 'continue' => array( 1, 5 ),
1705 - 'leftbracket' => array( 1, 5 ),
1706 - 'leftsquare' => array( 1, 5 ),
1707 - 'string' => array( 1, 5 ),
1708 - 'int' => array( 1, 5 ),
1709 - 'float' => array( 1, 5 ),
1710 - 'true' => array( 1, 5 ),
1711 - 'false' => array( 1, 5 ),
1712 - 'null' => array( 1, 5 ),
1713 - 'else' => array( 1, 5 ),
1714 - 'catch' => array( 1, 5 ),
1715 - 'rightcurly' => array( 1, 5 ),
 1793+ 129 => array(
 1794+ 'rightcurly' => array( 1, 62 ),
 1795+ 'comma' => array( 1, 62 ),
17161796 ),
1717 - 118 => array(
1718 - '$' => array( 1, 6 ),
1719 - 'if' => array( 1, 6 ),
1720 - 'for' => array( 1, 6 ),
1721 - 'try' => array( 1, 6 ),
1722 - 'leftcurly' => array( 1, 6 ),
1723 - 'id' => array( 1, 6 ),
1724 - 'invert' => array( 1, 6 ),
1725 - 'sum' => array( 1, 6 ),
1726 - 'isset' => array( 1, 6 ),
1727 - 'delete' => array( 1, 6 ),
1728 - 'break' => array( 1, 6 ),
1729 - 'continue' => array( 1, 6 ),
1730 - 'leftbracket' => array( 1, 6 ),
1731 - 'leftsquare' => array( 1, 6 ),
1732 - 'string' => array( 1, 6 ),
1733 - 'int' => array( 1, 6 ),
1734 - 'float' => array( 1, 6 ),
1735 - 'true' => array( 1, 6 ),
1736 - 'false' => array( 1, 6 ),
1737 - 'null' => array( 1, 6 ),
1738 - 'else' => array( 1, 6 ),
1739 - 'catch' => array( 1, 6 ),
1740 - 'rightcurly' => array( 1, 6 ),
 1797+ 130 => array(
 1798+ 'if' => array( 0, 17 ),
 1799+ 'for' => array( 0, 18 ),
 1800+ 'try' => array( 0, 19 ),
 1801+ 'leftcurly' => array( 0, 16 ),
 1802+ 'return' => array( 0, 20 ),
 1803+ 'append' => array( 0, 21 ),
 1804+ 'yield' => array( 0, 22 ),
 1805+ 'id' => array( 0, 14 ),
 1806+ 'invert' => array( 0, 24 ),
 1807+ 'sum' => array( 0, 23 ),
 1808+ 'self' => array( 0, 30 ),
 1809+ 'isset' => array( 0, 28 ),
 1810+ 'delete' => array( 0, 29 ),
 1811+ 'break' => array( 0, 25 ),
 1812+ 'continue' => array( 0, 26 ),
 1813+ 'leftbracket' => array( 0, 15 ),
 1814+ 'leftsquare' => array( 0, 27 ),
 1815+ 'string' => array( 0, 31 ),
 1816+ 'int' => array( 0, 32 ),
 1817+ 'float' => array( 0, 33 ),
 1818+ 'true' => array( 0, 34 ),
 1819+ 'false' => array( 0, 35 ),
 1820+ 'null' => array( 0, 36 ),
17411821 ),
1742 - 119 => array(
1743 - '$' => array( 1, 7 ),
1744 - 'if' => array( 1, 7 ),
1745 - 'for' => array( 1, 7 ),
1746 - 'try' => array( 1, 7 ),
1747 - 'leftcurly' => array( 1, 7 ),
1748 - 'id' => array( 1, 7 ),
1749 - 'invert' => array( 1, 7 ),
1750 - 'sum' => array( 1, 7 ),
1751 - 'isset' => array( 1, 7 ),
1752 - 'delete' => array( 1, 7 ),
1753 - 'break' => array( 1, 7 ),
1754 - 'continue' => array( 1, 7 ),
1755 - 'leftbracket' => array( 1, 7 ),
1756 - 'leftsquare' => array( 1, 7 ),
1757 - 'string' => array( 1, 7 ),
1758 - 'int' => array( 1, 7 ),
1759 - 'float' => array( 1, 7 ),
1760 - 'true' => array( 1, 7 ),
1761 - 'false' => array( 1, 7 ),
1762 - 'null' => array( 1, 7 ),
1763 - 'else' => array( 1, 7 ),
1764 - 'catch' => array( 1, 7 ),
1765 - 'rightcurly' => array( 1, 7 ),
 1822+ 131 => array(
 1823+ 'return' => array( 0, 20 ),
 1824+ 'append' => array( 0, 21 ),
 1825+ 'yield' => array( 0, 22 ),
 1826+ 'id' => array( 0, 14 ),
 1827+ 'invert' => array( 0, 24 ),
 1828+ 'sum' => array( 0, 23 ),
 1829+ 'self' => array( 0, 30 ),
 1830+ 'isset' => array( 0, 28 ),
 1831+ 'delete' => array( 0, 29 ),
 1832+ 'break' => array( 0, 25 ),
 1833+ 'continue' => array( 0, 26 ),
 1834+ 'leftbracket' => array( 0, 15 ),
 1835+ 'leftsquare' => array( 0, 27 ),
 1836+ 'leftcurly' => array( 0, 59 ),
 1837+ 'string' => array( 0, 31 ),
 1838+ 'int' => array( 0, 32 ),
 1839+ 'float' => array( 0, 33 ),
 1840+ 'true' => array( 0, 34 ),
 1841+ 'false' => array( 0, 35 ),
 1842+ 'null' => array( 0, 36 ),
17661843 ),
 1844+ 132 => array(
 1845+ 'id' => array( 0, 104 ),
 1846+ ),
 1847+ 133 => array(
 1848+ 'id' => array( 0, 104 ),
 1849+ ),
 1850+ 134 => array(
 1851+ 'rightbracket' => array( 1, 60 ),
 1852+ 'rightsquare' => array( 1, 60 ),
 1853+ 'comma' => array( 1, 60 ),
 1854+ ),
 1855+ 135 => array(
 1856+ 'rightbracket' => array( 1, 73 ),
 1857+ 'setto' => array( 1, 73 ),
 1858+ 'in' => array( 1, 73 ),
 1859+ 'pow' => array( 1, 73 ),
 1860+ 'equalsto' => array( 1, 73 ),
 1861+ 'trinary' => array( 1, 73 ),
 1862+ 'semicolon' => array( 1, 73 ),
 1863+ 'colon' => array( 1, 73 ),
 1864+ 'logicop' => array( 1, 73 ),
 1865+ 'compareop' => array( 1, 73 ),
 1866+ 'sum' => array( 1, 73 ),
 1867+ 'mul' => array( 1, 73 ),
 1868+ 'contains' => array( 1, 73 ),
 1869+ 'leftsquare' => array( 1, 73 ),
 1870+ 'doublecolon' => array( 1, 73 ),
 1871+ 'rightsquare' => array( 1, 73 ),
 1872+ 'comma' => array( 1, 73 ),
 1873+ 'rightcurly' => array( 1, 73 ),
 1874+ ),
 1875+ 136 => array(
 1876+ 'invert' => array( 0, 24 ),
 1877+ 'sum' => array( 0, 23 ),
 1878+ 'id' => array( 0, 71 ),
 1879+ 'self' => array( 0, 30 ),
 1880+ 'isset' => array( 0, 28 ),
 1881+ 'delete' => array( 0, 29 ),
 1882+ 'break' => array( 0, 25 ),
 1883+ 'continue' => array( 0, 26 ),
 1884+ 'leftbracket' => array( 0, 15 ),
 1885+ 'leftsquare' => array( 0, 27 ),
 1886+ 'leftcurly' => array( 0, 59 ),
 1887+ 'string' => array( 0, 31 ),
 1888+ 'int' => array( 0, 32 ),
 1889+ 'float' => array( 0, 33 ),
 1890+ 'true' => array( 0, 34 ),
 1891+ 'false' => array( 0, 35 ),
 1892+ 'null' => array( 0, 36 ),
 1893+ ),
 1894+ 137 => array(
 1895+ 'in' => array( 1, 44 ),
 1896+ 'pow' => array( 1, 44 ),
 1897+ 'equalsto' => array( 1, 44 ),
 1898+ 'trinary' => array( 1, 44 ),
 1899+ 'semicolon' => array( 1, 44 ),
 1900+ 'rightbracket' => array( 1, 44 ),
 1901+ 'colon' => array( 1, 44 ),
 1902+ 'logicop' => array( 1, 44 ),
 1903+ 'compareop' => array( 1, 44 ),
 1904+ 'sum' => array( 1, 44 ),
 1905+ 'mul' => array( 1, 44 ),
 1906+ 'contains' => array( 1, 44 ),
 1907+ 'rightsquare' => array( 1, 44 ),
 1908+ 'comma' => array( 1, 44 ),
 1909+ 'rightcurly' => array( 1, 44 ),
 1910+ ),
 1911+ 138 => array(
 1912+ 'in' => array( 1, 46 ),
 1913+ 'pow' => array( 1, 46 ),
 1914+ 'equalsto' => array( 1, 46 ),
 1915+ 'trinary' => array( 1, 46 ),
 1916+ 'semicolon' => array( 1, 46 ),
 1917+ 'rightbracket' => array( 1, 46 ),
 1918+ 'colon' => array( 1, 46 ),
 1919+ 'logicop' => array( 1, 46 ),
 1920+ 'compareop' => array( 1, 46 ),
 1921+ 'sum' => array( 1, 46 ),
 1922+ 'mul' => array( 1, 46 ),
 1923+ 'contains' => array( 1, 46 ),
 1924+ 'rightsquare' => array( 1, 46 ),
 1925+ 'comma' => array( 1, 46 ),
 1926+ 'rightcurly' => array( 1, 46 ),
 1927+ ),
 1928+ 139 => array(
 1929+ 'rightcurly' => array( 1, 10 ),
 1930+ 'if' => array( 1, 10 ),
 1931+ 'for' => array( 1, 10 ),
 1932+ 'try' => array( 1, 10 ),
 1933+ 'leftcurly' => array( 1, 10 ),
 1934+ 'return' => array( 1, 10 ),
 1935+ 'append' => array( 1, 10 ),
 1936+ 'yield' => array( 1, 10 ),
 1937+ 'id' => array( 1, 10 ),
 1938+ 'invert' => array( 1, 10 ),
 1939+ 'sum' => array( 1, 10 ),
 1940+ 'break' => array( 1, 10 ),
 1941+ 'continue' => array( 1, 10 ),
 1942+ 'leftbracket' => array( 1, 10 ),
 1943+ 'leftsquare' => array( 1, 10 ),
 1944+ 'self' => array( 1, 10 ),
 1945+ 'isset' => array( 1, 10 ),
 1946+ 'delete' => array( 1, 10 ),
 1947+ 'string' => array( 1, 10 ),
 1948+ 'int' => array( 1, 10 ),
 1949+ 'float' => array( 1, 10 ),
 1950+ 'true' => array( 1, 10 ),
 1951+ 'false' => array( 1, 10 ),
 1952+ 'null' => array( 1, 10 ),
 1953+ 'else' => array( 0, 144 ),
 1954+ 'catch' => array( 1, 10 ),
 1955+ ),
 1956+ 140 => array(
 1957+ 'rightbracket' => array( 0, 145 ),
 1958+ ),
 1959+ 141 => array(
 1960+ 'in' => array( 1, 76 ),
 1961+ 'leftsquare' => array( 0, 82 ),
 1962+ ),
 1963+ 142 => array(
 1964+ 'rightbracket' => array( 0, 146 ),
 1965+ 'leftsquare' => array( 0, 82 ),
 1966+ ),
 1967+ 143 => array(
 1968+ 'semicolon' => array( 1, 23 ),
 1969+ 'rightbracket' => array( 1, 23 ),
 1970+ 'colon' => array( 1, 23 ),
 1971+ 'rightsquare' => array( 1, 23 ),
 1972+ 'comma' => array( 1, 23 ),
 1973+ 'rightcurly' => array( 1, 23 ),
 1974+ ),
 1975+ 144 => array(
 1976+ 'if' => array( 0, 17 ),
 1977+ 'for' => array( 0, 18 ),
 1978+ 'try' => array( 0, 19 ),
 1979+ 'leftcurly' => array( 0, 16 ),
 1980+ 'return' => array( 0, 20 ),
 1981+ 'append' => array( 0, 21 ),
 1982+ 'yield' => array( 0, 22 ),
 1983+ 'id' => array( 0, 14 ),
 1984+ 'invert' => array( 0, 24 ),
 1985+ 'sum' => array( 0, 23 ),
 1986+ 'self' => array( 0, 30 ),
 1987+ 'isset' => array( 0, 28 ),
 1988+ 'delete' => array( 0, 29 ),
 1989+ 'break' => array( 0, 25 ),
 1990+ 'continue' => array( 0, 26 ),
 1991+ 'leftbracket' => array( 0, 15 ),
 1992+ 'leftsquare' => array( 0, 27 ),
 1993+ 'string' => array( 0, 31 ),
 1994+ 'int' => array( 0, 32 ),
 1995+ 'float' => array( 0, 33 ),
 1996+ 'true' => array( 0, 34 ),
 1997+ 'false' => array( 0, 35 ),
 1998+ 'null' => array( 0, 36 ),
 1999+ ),
 2000+ 145 => array(
 2001+ 'if' => array( 0, 17 ),
 2002+ 'for' => array( 0, 18 ),
 2003+ 'try' => array( 0, 19 ),
 2004+ 'leftcurly' => array( 0, 16 ),
 2005+ 'return' => array( 0, 20 ),
 2006+ 'append' => array( 0, 21 ),
 2007+ 'yield' => array( 0, 22 ),
 2008+ 'id' => array( 0, 14 ),
 2009+ 'invert' => array( 0, 24 ),
 2010+ 'sum' => array( 0, 23 ),
 2011+ 'self' => array( 0, 30 ),
 2012+ 'isset' => array( 0, 28 ),
 2013+ 'delete' => array( 0, 29 ),
 2014+ 'break' => array( 0, 25 ),
 2015+ 'continue' => array( 0, 26 ),
 2016+ 'leftbracket' => array( 0, 15 ),
 2017+ 'leftsquare' => array( 0, 27 ),
 2018+ 'string' => array( 0, 31 ),
 2019+ 'int' => array( 0, 32 ),
 2020+ 'float' => array( 0, 33 ),
 2021+ 'true' => array( 0, 34 ),
 2022+ 'false' => array( 0, 35 ),
 2023+ 'null' => array( 0, 36 ),
 2024+ ),
 2025+ 146 => array(
 2026+ 'if' => array( 0, 17 ),
 2027+ 'for' => array( 0, 18 ),
 2028+ 'try' => array( 0, 19 ),
 2029+ 'leftcurly' => array( 0, 16 ),
 2030+ 'return' => array( 0, 20 ),
 2031+ 'append' => array( 0, 21 ),
 2032+ 'yield' => array( 0, 22 ),
 2033+ 'id' => array( 0, 14 ),
 2034+ 'invert' => array( 0, 24 ),
 2035+ 'sum' => array( 0, 23 ),
 2036+ 'self' => array( 0, 30 ),
 2037+ 'isset' => array( 0, 28 ),
 2038+ 'delete' => array( 0, 29 ),
 2039+ 'break' => array( 0, 25 ),
 2040+ 'continue' => array( 0, 26 ),
 2041+ 'leftbracket' => array( 0, 15 ),
 2042+ 'leftsquare' => array( 0, 27 ),
 2043+ 'string' => array( 0, 31 ),
 2044+ 'int' => array( 0, 32 ),
 2045+ 'float' => array( 0, 33 ),
 2046+ 'true' => array( 0, 34 ),
 2047+ 'false' => array( 0, 35 ),
 2048+ 'null' => array( 0, 36 ),
 2049+ ),
 2050+ 147 => array(
 2051+ 'rightcurly' => array( 1, 11 ),
 2052+ 'if' => array( 1, 11 ),
 2053+ 'for' => array( 1, 11 ),
 2054+ 'try' => array( 1, 11 ),
 2055+ 'leftcurly' => array( 1, 11 ),
 2056+ 'return' => array( 1, 11 ),
 2057+ 'append' => array( 1, 11 ),
 2058+ 'yield' => array( 1, 11 ),
 2059+ 'id' => array( 1, 11 ),
 2060+ 'invert' => array( 1, 11 ),
 2061+ 'sum' => array( 1, 11 ),
 2062+ 'break' => array( 1, 11 ),
 2063+ 'continue' => array( 1, 11 ),
 2064+ 'leftbracket' => array( 1, 11 ),
 2065+ 'leftsquare' => array( 1, 11 ),
 2066+ 'self' => array( 1, 11 ),
 2067+ 'isset' => array( 1, 11 ),
 2068+ 'delete' => array( 1, 11 ),
 2069+ 'string' => array( 1, 11 ),
 2070+ 'int' => array( 1, 11 ),
 2071+ 'float' => array( 1, 11 ),
 2072+ 'true' => array( 1, 11 ),
 2073+ 'false' => array( 1, 11 ),
 2074+ 'null' => array( 1, 11 ),
 2075+ 'else' => array( 1, 11 ),
 2076+ 'catch' => array( 1, 11 ),
 2077+ ),
 2078+ 148 => array(
 2079+ 'rightcurly' => array( 1, 12 ),
 2080+ 'if' => array( 1, 12 ),
 2081+ 'for' => array( 1, 12 ),
 2082+ 'try' => array( 1, 12 ),
 2083+ 'leftcurly' => array( 1, 12 ),
 2084+ 'return' => array( 1, 12 ),
 2085+ 'append' => array( 1, 12 ),
 2086+ 'yield' => array( 1, 12 ),
 2087+ 'id' => array( 1, 12 ),
 2088+ 'invert' => array( 1, 12 ),
 2089+ 'sum' => array( 1, 12 ),
 2090+ 'break' => array( 1, 12 ),
 2091+ 'continue' => array( 1, 12 ),
 2092+ 'leftbracket' => array( 1, 12 ),
 2093+ 'leftsquare' => array( 1, 12 ),
 2094+ 'self' => array( 1, 12 ),
 2095+ 'isset' => array( 1, 12 ),
 2096+ 'delete' => array( 1, 12 ),
 2097+ 'string' => array( 1, 12 ),
 2098+ 'int' => array( 1, 12 ),
 2099+ 'float' => array( 1, 12 ),
 2100+ 'true' => array( 1, 12 ),
 2101+ 'false' => array( 1, 12 ),
 2102+ 'null' => array( 1, 12 ),
 2103+ 'else' => array( 1, 12 ),
 2104+ 'catch' => array( 1, 12 ),
 2105+ ),
 2106+ 149 => array(
 2107+ 'rightcurly' => array( 1, 13 ),
 2108+ 'if' => array( 1, 13 ),
 2109+ 'for' => array( 1, 13 ),
 2110+ 'try' => array( 1, 13 ),
 2111+ 'leftcurly' => array( 1, 13 ),
 2112+ 'return' => array( 1, 13 ),
 2113+ 'append' => array( 1, 13 ),
 2114+ 'yield' => array( 1, 13 ),
 2115+ 'id' => array( 1, 13 ),
 2116+ 'invert' => array( 1, 13 ),
 2117+ 'sum' => array( 1, 13 ),
 2118+ 'break' => array( 1, 13 ),
 2119+ 'continue' => array( 1, 13 ),
 2120+ 'leftbracket' => array( 1, 13 ),
 2121+ 'leftsquare' => array( 1, 13 ),
 2122+ 'self' => array( 1, 13 ),
 2123+ 'isset' => array( 1, 13 ),
 2124+ 'delete' => array( 1, 13 ),
 2125+ 'string' => array( 1, 13 ),
 2126+ 'int' => array( 1, 13 ),
 2127+ 'float' => array( 1, 13 ),
 2128+ 'true' => array( 1, 13 ),
 2129+ 'false' => array( 1, 13 ),
 2130+ 'null' => array( 1, 13 ),
 2131+ 'else' => array( 1, 13 ),
 2132+ 'catch' => array( 1, 13 ),
 2133+ ),
17672134 );
17682135
17692136 static $goto = array(
1770 - 0 => array( 1 => 20, 2 => 21, 3 => 22, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
 2137+ 0 => array( 1 => 2, 2 => 3 ),
17712138 1 => array(),
1772 - 2 => array( 3 => 41, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1773 - 3 => array(),
1774 - 4 => array( 2 => 43, 3 => 22, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1775 - 5 => array( 1 => 44, 22 => 46, 2 => 21, 23 => 47, 3 => 45, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1776 - 6 => array( 17 => 50, 19 => 36, 20 => 37, 5 => 49, 21 => 38 ),
1777 - 7 => array( 15 => 51, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 5 => 49, 21 => 38 ),
 2139+ 2 => array(),
 2140+ 3 => array( 1 => 5, 2 => 3 ),
 2141+ 4 => array(),
 2142+ 5 => array(),
 2143+ 6 => array( 3 => 9 ),
 2144+ 7 => array(),
17782145 8 => array(),
17792146 9 => array(),
1780 - 10 => array(),
1781 - 11 => array( 18 => 54, 3 => 53, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
 2147+ 10 => array( 3 => 13 ),
 2148+ 11 => array( 4 => 37, 5 => 38, 6 => 39, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
17822149 12 => array(),
17832150 13 => array(),
17842151 14 => array(),
1785 - 15 => array(),
1786 - 16 => array(),
 2152+ 15 => array( 6 => 60, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2153+ 16 => array( 4 => 61, 27 => 63, 5 => 38, 28 => 64, 6 => 62, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
17872154 17 => array(),
17882155 18 => array(),
1789 - 19 => array(),
1790 - 20 => array( 2 => 55, 3 => 22, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1791 - 21 => array(),
1792 - 22 => array(),
1793 - 23 => array( 24 => 59 ),
1794 - 24 => array(),
 2156+ 19 => array( 5 => 67, 6 => 39, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2157+ 20 => array( 10 => 68, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2158+ 21 => array( 10 => 69, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2159+ 22 => array( 10 => 70, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2160+ 23 => array( 21 => 73, 22 => 54, 24 => 55, 25 => 56, 8 => 72, 26 => 57 ),
 2161+ 24 => array( 19 => 74, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 8 => 72, 26 => 57 ),
17952162 25 => array(),
17962163 26 => array(),
1797 - 27 => array(),
 2164+ 27 => array( 23 => 76, 6 => 75, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
17982165 28 => array(),
17992166 29 => array(),
18002167 30 => array(),
——@@ -1803,89 +2170,119 @@
18042171 34 => array(),
18052172 35 => array(),
18062173 36 => array(),
1807 - 37 => array(),
 2174+ 37 => array( 5 => 79, 6 => 39, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
18082175 38 => array(),
1809 - 39 => array( 3 => 70, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1810 - 40 => array( 22 => 46, 23 => 47, 3 => 71, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
 2176+ 39 => array(),
 2177+ 40 => array( 29 => 83 ),
18112178 41 => array(),
1812 - 42 => array( 4 => 74, 5 => 75 ),
 2179+ 42 => array(),
18132180 43 => array(),
1814 - 44 => array( 2 => 55, 3 => 22, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
 2181+ 44 => array(),
18152182 45 => array(),
18162183 46 => array(),
18172184 47 => array(),
18182185 48 => array(),
1819 - 49 => array( 24 => 59 ),
 2186+ 49 => array(),
18202187 50 => array(),
18212188 51 => array(),
1822 - 52 => array( 18 => 82, 3 => 53, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
 2189+ 52 => array(),
18232190 53 => array(),
18242191 54 => array(),
18252192 55 => array(),
18262193 56 => array(),
1827 - 57 => array( 6 => 85, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1828 - 58 => array( 3 => 87, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1829 - 59 => array(),
1830 - 60 => array( 7 => 88, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 5 => 49, 21 => 38 ),
1831 - 61 => array( 9 => 89, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 5 => 49, 21 => 38 ),
1832 - 62 => array( 10 => 90, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 5 => 49, 21 => 38 ),
1833 - 63 => array( 11 => 91, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 5 => 49, 21 => 38 ),
1834 - 64 => array( 12 => 92, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 5 => 49, 21 => 38 ),
1835 - 65 => array( 13 => 93, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 5 => 49, 21 => 38 ),
1836 - 66 => array( 13 => 94, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 5 => 49, 21 => 38 ),
1837 - 67 => array( 16 => 95, 17 => 35, 19 => 36, 20 => 37, 5 => 49, 21 => 38 ),
1838 - 68 => array( 16 => 96, 17 => 35, 19 => 36, 20 => 37, 5 => 49, 21 => 38 ),
1839 - 69 => array( 5 => 97 ),
 2194+ 57 => array(),
 2195+ 58 => array( 4 => 96, 5 => 38, 6 => 39, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2196+ 59 => array( 27 => 63, 28 => 64, 6 => 97, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2197+ 60 => array(),
 2198+ 61 => array( 5 => 79, 6 => 39, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2199+ 62 => array(),
 2200+ 63 => array(),
 2201+ 64 => array(),
 2202+ 65 => array( 6 => 103, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2203+ 66 => array( 7 => 105, 8 => 106 ),
 2204+ 67 => array(),
 2205+ 68 => array(),
 2206+ 69 => array(),
18402207 70 => array(),
18412208 71 => array(),
1842 - 72 => array(),
 2209+ 72 => array( 29 => 83 ),
18432210 73 => array(),
18442211 74 => array(),
1845 - 75 => array( 24 => 59 ),
 2212+ 75 => array(),
18462213 76 => array(),
18472214 77 => array(),
1848 - 78 => array( 3 => 102, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
 2215+ 78 => array(),
18492216 79 => array(),
1850 - 80 => array( 23 => 103, 3 => 71, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1851 - 81 => array(),
1852 - 82 => array(),
 2217+ 80 => array(),
 2218+ 81 => array( 10 => 111, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2219+ 82 => array( 6 => 113, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
18532220 83 => array(),
1854 - 84 => array( 3 => 105, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1855 - 85 => array(),
1856 - 86 => array(),
1857 - 87 => array(),
1858 - 88 => array(),
1859 - 89 => array(),
1860 - 90 => array(),
1861 - 91 => array(),
1862 - 92 => array(),
1863 - 93 => array(),
1864 - 94 => array(),
 2221+ 84 => array( 11 => 114, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 8 => 72, 26 => 57 ),
 2222+ 85 => array( 13 => 115, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 8 => 72, 26 => 57 ),
 2223+ 86 => array( 14 => 116, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 8 => 72, 26 => 57 ),
 2224+ 87 => array( 15 => 117, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 8 => 72, 26 => 57 ),
 2225+ 88 => array( 16 => 118, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 8 => 72, 26 => 57 ),
 2226+ 89 => array( 17 => 119, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 8 => 72, 26 => 57 ),
 2227+ 90 => array( 17 => 120, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 8 => 72, 26 => 57 ),
 2228+ 91 => array( 20 => 121, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 8 => 72, 26 => 57 ),
 2229+ 92 => array( 20 => 122, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 8 => 72, 26 => 57 ),
 2230+ 93 => array( 23 => 124, 6 => 75, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2231+ 94 => array( 8 => 125 ),
18652232 95 => array(),
1866 - 96 => array(),
1867 - 97 => array( 24 => 59 ),
1868 - 98 => array( 2 => 109, 3 => 22, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1869 - 99 => array( 3 => 110, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1870 - 100 => array( 5 => 111 ),
1871 - 101 => array( 5 => 112 ),
1872 - 102 => array(),
 2233+ 96 => array( 5 => 79, 6 => 39, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2234+ 97 => array(),
 2235+ 98 => array(),
 2236+ 99 => array(),
 2237+ 100 => array( 6 => 128, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2238+ 101 => array(),
 2239+ 102 => array( 28 => 129, 6 => 97, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
18732240 103 => array(),
18742241 104 => array(),
18752242 105 => array(),
1876 - 106 => array(),
1877 - 107 => array( 7 => 113, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 5 => 49, 21 => 38 ),
1878 - 108 => array(),
 2243+ 106 => array( 29 => 83 ),
 2244+ 107 => array(),
 2245+ 108 => array( 6 => 134, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
18792246 109 => array(),
18802247 110 => array(),
1881 - 111 => array( 24 => 59 ),
1882 - 112 => array( 24 => 59 ),
 2248+ 111 => array(),
 2249+ 112 => array(),
18832250 113 => array(),
1884 - 114 => array( 2 => 117, 3 => 22, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1885 - 115 => array( 2 => 118, 3 => 22, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
1886 - 116 => array( 2 => 119, 3 => 22, 6 => 24, 5 => 23, 7 => 25, 8 => 26, 9 => 27, 10 => 28, 11 => 29, 12 => 30, 13 => 31, 14 => 32, 15 => 33, 16 => 34, 17 => 35, 19 => 36, 20 => 37, 21 => 38 ),
 2251+ 114 => array(),
 2252+ 115 => array(),
 2253+ 116 => array(),
18872254 117 => array(),
18882255 118 => array(),
18892256 119 => array(),
 2257+ 120 => array(),
 2258+ 121 => array(),
 2259+ 122 => array(),
 2260+ 123 => array(),
 2261+ 124 => array(),
 2262+ 125 => array( 29 => 83 ),
 2263+ 126 => array(),
 2264+ 127 => array(),
 2265+ 128 => array(),
 2266+ 129 => array(),
 2267+ 130 => array( 5 => 139, 6 => 39, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2268+ 131 => array( 6 => 140, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2269+ 132 => array( 8 => 141 ),
 2270+ 133 => array( 8 => 142 ),
 2271+ 134 => array(),
 2272+ 135 => array(),
 2273+ 136 => array( 11 => 143, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 8 => 72, 26 => 57 ),
 2274+ 137 => array(),
 2275+ 138 => array(),
 2276+ 139 => array(),
 2277+ 140 => array(),
 2278+ 141 => array( 29 => 83 ),
 2279+ 142 => array( 29 => 83 ),
 2280+ 143 => array(),
 2281+ 144 => array( 5 => 147, 6 => 39, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2282+ 145 => array( 5 => 148, 6 => 39, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2283+ 146 => array( 5 => 149, 6 => 39, 9 => 41, 10 => 42, 8 => 40, 11 => 43, 12 => 44, 13 => 45, 14 => 46, 15 => 47, 16 => 48, 17 => 49, 18 => 50, 19 => 51, 20 => 52, 21 => 53, 22 => 54, 24 => 55, 25 => 56, 26 => 57 ),
 2284+ 147 => array(),
 2285+ 148 => array(),
 2286+ 149 => array(),
18902287 );
18912288
18922289 }
Index: trunk/extensions/InlineScripts/interpreter/Shared.php
——@@ -1,16 +1,36 @@
22 <?php
3 -
43 /**
5 - * This file contains implementation-independent interface files for
6 - * inline scripts interpreter.
 4+ * Built-in scripting language for MediaWiki: implementation-independent interface
 5+ * for scripts parser.
 6+ * Copyright (C) 2009-2011 Victor Vasiliev <vasilvv@gmail.com>
 7+ * http://www.mediawiki.org/
 8+ *
 9+ * This program is free software; you can redistribute it and/or modify
 10+ * it under the terms of the GNU General Public License as published by
 11+ * the Free Software Foundation; either version 2 of the License, or
 12+ * (at your option) any later version.
 13+ *
 14+ * This program is distributed in the hope that it will be useful,
 15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 17+ * GNU General Public License for more details.
 18+ *
 19+ * You should have received a copy of the GNU General Public License along
 20+ * with this program; if not, write to the Free Software Foundation, Inc.,
 21+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 22+ * http://www.gnu.org/copyleft/gpl.html
723 */
824
 25+if( !defined( 'MEDIAWIKI' ) )
 26+ die();
 27+
928 /**
1029 * This class represents a terminal of the script grammar.
1130 */
1231 class ISToken {
1332 // Constant values should match ones in syntax.txt
1433 const TEnd = '$';
 34+ const TAppend = 'append';
1535 const TBreak = 'break';
1636 const TCatch = 'catch';
1737 const TColon = 'colon'; // :
——@@ -19,6 +39,7 @@
2040 const TContains = 'contains';
2141 const TContinue = 'continue';
2242 const TDelete = 'delete';
 43+ const TDoubleColon = 'doublecolon';
2344 const TElse = 'else';
2445 const TEqualsToOperator = 'equalsto'; // ==, ===, != or !==
2546 const TFalse = 'false';
——@@ -37,16 +58,19 @@
3859 const TMulOperator = 'mul'; // *, / or %
3960 const TNull = 'null';
4061 const TPow = 'pow'; // **
 62+ const TReturn = 'return';
4163 const TRightBracket = 'rightbracket'; // )
4264 const TRightCurly = 'rightcurly'; // }
4365 const TRightSquare = 'rightsquare'; // ]
4466 const TSemicolon = 'semicolon'; // ;
4567 const TSet = 'setto'; // =
 68+ const TSelf = 'self';
4669 const TString = 'string';
4770 const TSumOperator = 'sum'; // + or -
4871 const TTrinary = 'trinary'; // ?
4972 const TTrue = 'true';
5073 const TTry = 'try';
 74+ const TYield = 'yield';
5175
5276 var $type;
5377 var $value;
——@@ -92,6 +116,14 @@
93117 return $this->mChildren;
94118 }
95119
 120+ public function getChildrenCount() {
 121+ return count( $this->mChildren );
 122+ }
 123+
 124+ public function hasSingleChild() {
 125+ return count( $this->mChildren ) == 1;
 126+ }
 127+
96128 public function getType() {
97129 return $this->mType;
98130 }
——@@ -117,6 +149,9 @@
118150 }
119151 }
120152
 153+/**
 154+ * Generalized script parser.
 155+ */
121156 interface ISParser {
122157 /**
123158 * If this function returns true, code scanner is passed to parse().
——@@ -130,7 +165,7 @@
131166 * @param maxTokens int Maximal amount of tokens
132167 * @return ISParserTreeNode
133168 */
134 - public function parse( $input, $maxTokens );
 169+ public function parse( $input, $module, $maxTokens );
135170 }
136171
137172 class ISException extends MWException {}
——@@ -138,12 +173,14 @@
139174 // Exceptions that we might conceivably want to report to ordinary users
140175 // (i.e. exceptions that don't represent bugs in the extension itself)
141176 class ISUserVisibleException extends ISException {
142 - function __construct( $exception_id, $line, $params = array() ) {
143 - $msg = wfMsgExt( 'inlinescripts-exception-' . $exception_id, array(), array_merge( array($line), $params ) );
 177+ function __construct( $exception_id, $module, $line, $params = array() ) {
 178+ $codelocation = wfMsg( 'inlinescripts-codelocation', $module, $line );
 179+ $msg = wfMsgExt( 'inlinescripts-exception-' . $exception_id, array(), array_merge( array( $codelocation ), $params ) );
144180 parent::__construct( $msg );
145181
146182 $this->mExceptionID = $exception_id;
147183 $this->mLine = $line;
 184+ $this->mModule = $module;
148185 $this->mParams = $params;
149186 }
150187
——@@ -152,6 +189,46 @@
153190 }
154191 }
155192
 193+/**
 194+ * Exceptions caused by the error on script transclusion error, i.e. not in script.
 195+ */
 196+class ISTransclusionException extends ISException {
 197+ function __construct( $exception_id, $params = array() ) {
 198+ $msg = wfMsgExt( 'inlinescripts-transerror-' . $exception_id, array(), $params );
 199+ parent::__construct( $msg );
 200+
 201+ $this->mExceptionID = $exception_id;
 202+ $this->mParams = $params;
 203+ }
 204+}
 205+
 206+/**
 207+ * Exceptions used for control structures that need to break out of deep function
 208+ * nesting level (e.g. break or continue).
 209+ */
 210+class ISControlException extends ISUserVisibleException {}
 211+
 212+/**
 213+ * Exception that allows to return from a function.
 214+ */
 215+class ISReturnException extends ISControlException {
 216+ function __construct( $result, $empty ) {
 217+ $this->mResult = $result;
 218+ $this->mEmpty = $empty;
 219+ }
 220+
 221+ function getResult() {
 222+ return $this->mResult;
 223+ }
 224+
 225+ function isEmpty() {
 226+ return $this->mEmpty;
 227+ }
 228+}
 229+
 230+/**
 231+ * Code parser output.
 232+ */
156233 class ISParserOutput {
157234 var $mTree, $mTokensCount, $mVersion;
158235
——@@ -166,17 +243,9 @@
167244 return $this->mTree;
168245 }
169246
170 - public function isOutOfDate() {
171 - global $wgInlineScriptsParserClass;
172 - return $wgInlineScriptsParserClass::getVersion() > $this->mVersion;
 247+ public function getVersion() {
 248+ return $this->mVersion;
173249 }
174 -
175 - public function appendTokenCount( &$interpr ) {
176 - global $wgInlineScriptsLimits;
177 - $interpr->mTokens += @$this->mTokensCount;
178 - if( $interpr->mTokens > $wgInlineScriptsLimits['tokens'] )
179 - throw new ISUserVisibleException( 'toomanytokens', 0 );
180 - }
181250 }
182251
183252 // Used by ISEvaluationContext::setVar
Index: trunk/extensions/InlineScripts/interpreter/buildLRTables.php
——@@ -462,8 +462,8 @@
463463 return 'array( ' . implode( ', ', $result ) . ' )';
464464 }
465465
466 - public function buildPHPFile() {
467 - $date = gmdate( 'Y-m-d H:i' );
 466+ public function buildPHPFile( $ts ) {
 467+ $date = $ts;
468468 $s = <<<ENDOFHEADER
469469 <?php
470470
——@@ -534,10 +534,28 @@
535535 $s .= "}\n";
536536 return $s;
537537 }
 538+
 539+ public function buildPHPVersionFile( $ts ) {
 540+ return <<<EOF
 541+<?php
 542+
 543+/**
 544+ * This file includes timestamp which indicates the version of LRTable.php file.
 545+ * Since the file is too large, loading it every time is expensive and we store the
 546+ * version in separate file.
 547+ */
 548+
 549+define( 'IS_LR_VERSION', "{$ts}" );
 550+
 551+EOF;
 552+ }
538553 }
539554
 555+$ts = gmdate( 'Y-m-d H:i:s' );
 556+
540557 $definition = file_get_contents( dirname( __FILE__ ) . '/syntax.txt' );
541558 $grammar = Grammar::parse( $definition );
542559 $grammar->buildLRTable();
543560 file_put_contents( 'LRTableBuildReport.html', $grammar->buildHTMLDump() );
544 -file_put_contents( 'LRTable.php', $grammar->buildPHPFile() );
 561+file_put_contents( 'LRTable.php', $grammar->buildPHPFile( $ts ) );
 562+file_put_contents( 'LRTableVersion.php', $grammar->buildPHPVersionFile( $ts ) );
Index: trunk/extensions/InlineScripts/inlinescripts.sql
——@@ -0,0 +1,16 @@
 2+--
 3+-- Track script inclusions.
 4+--
 5+CREATE TABLE /*_*/scriptlinks (
 6+ -- Key to the page_id of the page containing the link.
 7+ sl_from int unsigned NOT NULL default 0,
 8+
 9+ -- Key to page_title of the target page.
 10+ -- The target page may or may not exist, and due to renames
 11+ -- and deletions may refer to different page records as time
 12+ -- goes by.
 13+ sl_to varchar(255) binary NOT NULL default ''
 14+) /*$wgDBTableOptions*/;
 15+
 16+CREATE UNIQUE INDEX /*i*/sl_from ON /*_*/scriptlinks (sl_from,sl_to);
 17+CREATE UNIQUE INDEX /*i*/sl_title ON /*_*/scriptlinks (sl_to,sl_from);
Index: trunk/extensions/InlineScripts/Hooks.php
——@@ -0,0 +1,178 @@
 2+<?php
 3+/**
 4+ * Built-in scripting language for MediaWiki: hooks.
 5+ * Copyright (C) 2009-2011 Victor Vasiliev <vasilvv@gmail.com>
 6+ * http://www.mediawiki.org/
 7+ *
 8+ * This program is free software; you can redistribute it and/or modify
 9+ * it under the terms of the GNU General Public License as published by
 10+ * the Free Software Foundation; either version 2 of the License, or
 11+ * (at your option) any later version.
 12+ *
 13+ * This program is distributed in the hope that it will be useful,
 14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 16+ * GNU General Public License for more details.
 17+ *
 18+ * You should have received a copy of the GNU General Public License along
 19+ * with this program; if not, write to the Free Software Foundation, Inc.,
 20+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 21+ * http://www.gnu.org/copyleft/gpl.html
 22+ */
 23+
 24+/**
 25+ * Hooks for InlineScripts extension.
 26+ */
 27+class ISHooks {
 28+ /**
 29+ * Returns the interpreter for a given parser.
 30+ *
 31+ * @static
 32+ * @return InlineScriptInterpreter
 33+ */
 34+ public static function getInterpreter( $parser ) {
 35+ if( !isset( $parser->is_interpreter ) || !$parser->is_interpreter ) {
 36+ $parser->is_interpreter = new ISInterpreter( $parser );
 37+ }
 38+ return $parser->is_interpreter;
 39+ }
 40+
 41+ /**
 42+ * Register parser hooks.
 43+ * @param $parser Parser
 44+ */
 45+ public static function setupParserHook( &$parser ) {
 46+ $parser->setFunctionHook( 'i', 'ISHooks::callHook', SFH_NO_HASH | SFH_OBJECT_ARGS );
 47+ return true;
 48+ }
 49+
 50+ /**
 51+ * Called when interpreter is to be reset.
 52+ *
 53+ * @static
 54+ * @param $parser Parser
 55+ * @return bool
 56+ */
 57+ public static function clearState( &$parser ) {
 58+ $parser->is_interpreter = null;
 59+ return true;
 60+ }
 61+
 62+ /**
 63+ * Adds scriptlinks table to parser tests.
 64+ */
 65+ public static function addTestTables( &$tables ) {
 66+ $tables[] = 'scriptlinks';
 67+ return true;
 68+ }
 69+
 70+ /**
 71+ * Handles the {{i:module|func}} construction.
 72+ *
 73+ * @static
 74+ * @param $parser Parser
 75+ * @param $frame
 76+ * @param $args
 77+ * @return string
 78+ */
 79+ public static function callHook( &$parser, $frame, $args ) {
 80+ wfProfileIn( __METHOD__ );
 81+ $i = self::getInterpreter( $parser );
 82+
 83+ try {
 84+ if( count( $args ) < 2 ) {
 85+ throw new ISTransclusionException( 'nofunction' );
 86+ }
 87+
 88+ $moduleName = $parser->mStripState->unstripBoth( array_shift( $args ) );
 89+ $funcName = $frame->expand( array_shift( $args ) );
 90+ foreach( $args as &$arg ) {
 91+ $arg = $frame->expand( $arg );
 92+ }
 93+
 94+ $result = $i->invokeUserFunctionFromWikitext( $moduleName, $funcName, $args, $frame );
 95+ } catch( ISException $e ) {
 96+ $msg = nl2br( htmlspecialchars( $e->getMessage() ) );
 97+ wfProfileOut( __METHOD__ );
 98+ return "<strong class=\"error\">{$msg}</strong>";
 99+ }
 100+
 101+ wfProfileOut( __METHOD__ );
 102+ return trim( $result );
 103+ }
 104+
 105+ /**
 106+ * Overrides the standard view for modules. Enables syntax highlighting when
 107+ * possible.
 108+ *
 109+ * @static
 110+ * @param $text
 111+ * @param $title Title
 112+ * @param $output OutputPage
 113+ * @return bool
 114+ */
 115+ public static function handleScriptView( $text, $title, $output ) {
 116+ global $wgInlineScriptsUseGeSHi;
 117+
 118+ if( $title->getNamespace() == NS_MODULE ) {
 119+ if( $wgInlineScriptsUseGeSHi ) {
 120+ $geshi = SyntaxHighlight_GeSHi::prepare( $text, 'wikiscript' );
 121+ $geshi->set_language_path( dirname( __FILE__ ) . '/geshi' );
 122+ $geshi->set_language( 'wikiscript' );
 123+ if( $geshi instanceof GeSHi && !$geshi->error() ) {
 124+ $code = $geshi->parse_code();
 125+ if( $code ) {
 126+ $output->addHeadItem( "source-wikiscript", SyntaxHighlight_GeSHi::buildHeadItem( $geshi ) );
 127+ $output->addHTML( "<div dir=\"ltr\">{$code}</div>" );
 128+ return false;
 129+ }
 130+ }
 131+ }
 132+
 133+ // No GeSHi, or GeSHi can't parse it, use plain <pre>
 134+ $output->addHTML( "<pre class=\"mw-code mw-script\" dir=\"ltr\">\n" );
 135+ $output->addHTML( htmlspecialchars( $text ) );
 136+ $output->addHTML( "\n</pre>\n" );
 137+ return false;
 138+ } else {
 139+ return true;
 140+ }
 141+ }
 142+
 143+ /**
 144+ * Indicates that modules are not wikitext.
 145+ */
 146+ public static function isWikitextPage( $title, &$result ) {
 147+ if( $title->getNamespace() == NS_MODULE ) {
 148+ $result = false;
 149+ return false;
 150+ }
 151+ return true;
 152+ }
 153+
 154+ /**
 155+ * Adds report of number of evaluations by the single wikitext page.
 156+ *
 157+ * @static
 158+ * @param $parser Parser
 159+ * @param $report
 160+ * @return bool
 161+ */
 162+ public static function reportLimits( $parser, &$report ) {
 163+ global $wgInlineScriptsLimits;
 164+ $i = self::getInterpreter( $parser );
 165+ $report .=
 166+ "Inline scripts parser evaluations: {$i->mEvaluations}/{$wgInlineScriptsLimits['evaluations']}\n" .
 167+ "Inline scripts AST maximal depth: {$i->mMaxRecursion}/{$wgInlineScriptsLimits['depth']}\n";
 168+ return true;
 169+ }
 170+
 171+ /**
 172+ * Adds the module namespaces.
 173+ */
 174+ public static function addCanonicalNamespaces( &$list ) {
 175+ $list[NS_MODULE] = 'Module';
 176+ $list[NS_MODULE_TALK] = 'Module_talk';
 177+ return true;
 178+ }
 179+}
Index: trunk/extensions/InlineScripts/LinksUpdate.php
——@@ -0,0 +1,195 @@
 2+<?php
 3+/**
 4+ * Built-in scripting language for MediaWiki: link updating code
 5+ * Copyright (C) 2011 Victor Vasiliev <vasilvv@gmail.com> et al
 6+ * Based on MediaWiki file LinksUpdate.php
 7+ * http://www.mediawiki.org/
 8+ *
 9+ * This program is free software; you can redistribute it and/or modify
 10+ * it under the terms of the GNU General Public License as published by
 11+ * the Free Software Foundation; either version 2 of the License, or
 12+ * (at your option) any later version.
 13+ *
 14+ * This program is distributed in the hope that it will be useful,
 15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 17+ * GNU General Public License for more details.
 18+ *
 19+ * You should have received a copy of the GNU General Public License along
 20+ * with this program; if not, write to the Free Software Foundation, Inc.,
 21+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 22+ * http://www.gnu.org/copyleft/gpl.html
 23+ */
 24+
 25+if( !defined( 'MEDIAWIKI' ) )
 26+ die();
 27+
 28+
 29+/**
 30+ * Class that contains hooks related to tracking links to scripts and invalidating
 31+ * pages on script change.
 32+ */
 33+class ISLinksUpdateHooks {
 34+ /**
 35+ * Appends script links to the output.
 36+ */
 37+ public static function appendToOutput( &$parser, &$text ) {
 38+ if( isset( $parser->is_interpreter ) ) {
 39+ $parser->mOutput->is_links = $parser->is_interpreter->mUsedModules;
 40+ }
 41+ return true;
 42+ }
 43+
 44+ /**
 45+ * Runs the link updater.
 46+ */
 47+ public static function updateLinks( &$update ) {
 48+ $output = $update->mParserOutput;
 49+ if( isset( $output->is_links ) ) {
 50+ $new = $output->is_links;
 51+ } else {
 52+ $new = array();
 53+ }
 54+
 55+ $isupdate = new ISLinksUpdate( $update, $new );
 56+ $isupdate->run();
 57+ return true;
 58+ }
 59+
 60+ /**
 61+ * Purges cache for all the pages where the script is used.
 62+ */
 63+ public static function purgeCache( &$article, &$editInfo, $changed ) {
 64+ global $wgDeferredUpdateList;
 65+
 66+ // Invalidate caches of articles which include the script
 67+ if( $article->mTitle->getNamespace() == NS_MODULE )
 68+ $wgDeferredUpdateList[] = new HTMLCacheUpdate( $article->mTitle, 'scriptlinks' );
 69+
 70+ return true;
 71+ }
 72+
 73+ /**
 74+ * Adds scriptlinks to the list of tables supported by BacklinkCache.
 75+ */
 76+ public static function getBacklinkCachePrefix( $table, &$prefix ) {
 77+ if( $table == 'scriptlinks' ) {
 78+ $prefix = 'sl';
 79+ return false;
 80+ } else {
 81+ return true;
 82+ }
 83+ }
 84+
 85+ /**
 86+ * Adds scriptlinks to the list of tables supported by BacklinkCache.
 87+ */
 88+ public static function getBacklinkCacheConditions( $table, $title, &$conds ) {
 89+ if( $table == 'scriptlinks' ) {
 90+ $conds = array(
 91+ 'sl_to' => $title->getDBkey(),
 92+ 'page_id=sl_from'
 93+ );
 94+ return false;
 95+ } else {
 96+ return true;
 97+ }
 98+ }
 99+}
 100+
 101+/**
 102+ * A class that updates links on scripts like phase3/includes/LinksUpdate.php does that
 103+ * with templates.
 104+ */
 105+class ISLinksUpdate {
 106+ var $mUpdate, $mId, $mNew;
 107+
 108+ public function __construct( $update, $new ) {
 109+ $this->mUpdate = $update;
 110+ $this->mId = $update->mId;
 111+ $this->mNew = $new;
 112+ }
 113+
 114+ public function run() {
 115+ global $wgUseDumbLinkUpdate;
 116+
 117+ wfProfileIn( __METHOD__ );
 118+
 119+ if( $wgUseDumbLinkUpdate ) {
 120+ $this->mUpdate->dumbTableUpdate( 'scriptlinks', $this->getScriptInsertions(), 'sl_from' );
 121+ } else {
 122+ $existing = $this->getExistingScripts();
 123+ $this->mUpdate->incrTableUpdate( 'scriptlinks', 'sl', $this->getScriptDeletions( $existing ),
 124+ $this->getScriptInsertions( $existing ) );
 125+ }
 126+
 127+ if( $this->mUpdate->mRecursive && $this->mUpdate->mTitle->getNamespace() == NS_MODULE ) {
 128+ $this->queueRecursiveJobs();
 129+ }
 130+
 131+ wfProfileOut( __METHOD__ );
 132+ }
 133+
 134+ protected function getExistingScripts() {
 135+ $result = array();
 136+
 137+ $res = $this->mUpdate->mDb->select( 'scriptlinks', array( 'sl_to' ),
 138+ array( 'sl_from' => $this->mId ), __METHOD__, $this->mUpdate->mOptions );
 139+ foreach ( $res as $row ) {
 140+ $result[] = $row->sl_to;
 141+ }
 142+
 143+ return $result;
 144+ }
 145+
 146+ protected function getScriptInsertions( $existing = array() ) {
 147+ $result = array();
 148+
 149+ foreach( array_diff( $this->mNew, $existing ) as $module ) {
 150+ $result[] = array(
 151+ 'sl_from' => $this->mId,
 152+ 'sl_to' => $module,
 153+ );
 154+ }
 155+
 156+ return $result;
 157+ }
 158+
 159+ protected function getScriptDeletions( $existing = array() ) {
 160+ $result = array();
 161+
 162+ foreach( array_diff( $existing, $this->mNew ) as $module ) {
 163+ $result[] = array(
 164+ 'sl_from' => $this->mId,
 165+ 'sl_to' => $module,
 166+ );
 167+ }
 168+
 169+ return $result;
 170+ }
 171+
 172+ protected function queueRecursiveJobs() {
 173+ global $wgUpdateRowsPerJob;
 174+ wfProfileIn( __METHOD__ );
 175+
 176+ $cache = $this->mUpdate->mTitle->getBacklinkCache();
 177+ $batches = $cache->partition( 'scriptlinks', $wgUpdateRowsPerJob );
 178+ if ( !$batches ) {
 179+ wfProfileOut( __METHOD__ );
 180+ return;
 181+ }
 182+ $jobs = array();
 183+ foreach ( $batches as $batch ) {
 184+ list( $start, $end ) = $batch;
 185+ $params = array(
 186+ 'table' => 'scriptlinks',
 187+ 'start' => $start,
 188+ 'end' => $end,
 189+ );
 190+ $jobs[] = new RefreshLinksJob2( $this->mUpdate->mTitle, $params );
 191+ }
 192+ Job::batchInsert( $jobs );
 193+
 194+ wfProfileOut( __METHOD__ );
 195+ }
 196+}
Index: trunk/extensions/InlineScripts/InlineScripts.php
——@@ -1,7 +1,7 @@
22 <?php
33 /**
4 - * Built-in scripting language for MediaWiki
5 - * Copyright (C) 2009 Victor Vasiliev <vasilvv@gmail.com>
 4+ * Built-in scripting language for MediaWiki.
 5+ * Copyright (C) 2009-2011 Victor Vasiliev <vasilvv@gmail.com>
66 * http://www.mediawiki.org/
77 *
88 * This program is free software; you can redistribute it and/or modify
——@@ -27,140 +27,103 @@
2828 'path' => __FILE__,
2929 'name' => 'InlineScripts',
3030 'author' => 'Victor Vasiliev',
31 - 'descriptionmsg' => 'inlinescriprs-desc',
 31+ 'descriptionmsg' => 'inlinescripts-desc',
3232 'url' => 'http://www.mediawiki.org/wiki/Extension:InlineScripts',
3333 );
3434
3535 $dir = dirname(__FILE__) . '/';
36 -$wgExtensionMessagesFiles['InlineScripts'] = $dir . 'InlineScripts.i18n.php';
 36+$wgExtensionMessagesFiles['InlineScripts'] = $dir . 'i18n/Messages.php';
 37+$wgExtensionMessagesFiles['InlineScriptsMagic'] = $dir . 'i18n/Magic.php';
 38+$wgExtensionMessagesFiles['InlineScriptsNamespaces'] = $dir . 'i18n/Namespaces.php';
 39+
 40+$wgAutoloadClasses['ISHooks'] = $dir . '/Hooks.php';
 41+$wgAutoloadClasses['ISLinksUpdateHooks'] = $dir . '/LinksUpdate.php';
 42+
3743 $wgAutoloadClasses['ISInterpreter'] = $dir . 'interpreter/Interpreter.php';
3844 $wgAutoloadClasses['ISScanner'] = $dir . 'interpreter/Scanner.php';
3945 $wgAutoloadClasses['ISLRParser'] = $dir . 'interpreter/LRParser.php';
 46+
4047 $wgParserTestFiles[] = $dir . 'interpreterTests.txt';
41 -$wgHooks['ParserFirstCallInit'][] = 'InlineScriptsHooks::setupParserHook';
42 -$wgHooks['ParserClearState'][] = 'InlineScriptsHooks::clearState';
43 -//$wgHooks['ParserLimitReport'][] = 'InlineScriptsHooks::reportLimits';
 48+$wgHooks['ParserFirstCallInit'][] = 'ISHooks::setupParserHook';
 49+$wgHooks['ParserLimitReport'][] = 'ISHooks::reportLimits';
 50+$wgHooks['ParserClearState'][] = 'ISHooks::clearState';
 51+$wgHooks['ParserTestTables'][] = 'ISHooks::addTestTables';
4452
 53+$wgHooks['CanonicalNamespaces'][] = 'ISHooks::addCanonicalNamespaces';
 54+$wgHooks['ArticleViewCustom'][] = 'ISHooks::handleScriptView';
 55+$wgHooks['TitleIsWikitextPage'][] = 'ISHooks::isWikitextPage';
 56+
 57+$wgHooks['LinksUpdate'][] = 'ISLinksUpdateHooks::updateLinks';
 58+$wgHooks['ArticleEditUpdates'][] = 'ISLinksUpdateHooks::purgeCache';
 59+$wgHooks['ParserAfterTidy'][] = 'ISLinksUpdateHooks::appendToOutput';
 60+$wgHooks['BacklinkCacheGetPrefix'][] = 'ISLinksUpdateHooks::getBacklinkCachePrefix';
 61+$wgHooks['BacklinkCacheGetConditions'][] = 'ISLinksUpdateHooks::getBacklinkCacheConditions';
 62+
 63+/** Configuration */
 64+
 65+/**
 66+ * Script namespace numbers. Should be redefined before
 67+ * the inlcusion of the extension.
 68+ */
 69+if( !isset( $wgScriptsNamespaceNumbers ) ) {
 70+ $wgScriptsNamespaceNumbers = array(
 71+ 'Module' => 20,
 72+ 'Module_talk' => 21,
 73+ );
 74+}
 75+
 76+/**
 77+ * Different limits of the scripts.
 78+ */
4579 $wgInlineScriptsLimits = array(
4680 /**
4781 * Maximal amount of tokens (strings, keywords, numbers, operators,
48 - * but not whitespace) to be parsed.
 82+ * but not whitespace) in a single module to be parsed.
4983 */
50 - 'tokens' => 100000,
 84+ 'tokens' => 1000000,
 85+
5186 /**
5287 * Maximal amount of operations (multiplications, comarsions, function
5388 * calls) to be done.
5489 */
55 - 'evaluations' => 10000,
 90+ 'evaluations' => 300000,
 91+
5692 /**
57 - * Maximal depth of recursion when evaluating the parser tree. For
 93+ * Maximal depth of recursion when evaluating the parser tree in a single function. For
5894 * example 2 + 2 * 2 ** 2 is parsed to (2 + (2 * (2 ** 2))) and needs
5995 * depth 3 to be parsed.
6096 */
61 - 'depth' => 250,
 97+ 'depth' => 100,
6298 );
6399
 100+/**
 101+ * Turn on to true if you have linked or copied wikiscripts.php and
 102+ * SyntaxHighlight_GeSHi extension is enabled.
 103+ */
 104+$wgInlineScriptsUseGeSHi = false;
 105+
 106+/**
 107+ * Class of the actual parser. Must implement ISParser interface, as well as
 108+ * static getVersion() method.
 109+ */
64110 $wgInlineScriptsParserClass = 'ISLRParser';
65 -$wgInlineScriptsUseCache = false;
66111
67 -class InlineScriptsHooks {
68 - static $scriptParser = null;
 112+/**
 113+ * Should be enabled unless you are debugging or just have sado-masochistic
 114+ * attitude towards your server.
 115+ */
 116+$wgInlineScriptsUseCache = true;
69117
70 - /**
71 - * Register parser hook
72 - * @param $parser Parser
73 - */
74 - public static function setupParserHook( &$parser ) {
75 - $parser->setFunctionTagHook( 'wikiscript', 'InlineScriptsHooks::scriptHook', SFH_OBJECT_ARGS );
76 - $parser->setFunctionHook( 'inline', 'InlineScriptsHooks::inlineHook', SFH_OBJECT_ARGS );
77 - return true;
78 - }
 118+/**
 119+ * Indicates whether the function recursion is enabled. If it is, then users may
 120+ * build a Turing-complete machinge and do nice things like parsers, etc in wikitext!
 121+ */
 122+$wgInlineScriptsAllowRecursion = false;
79123
80 - /**
81 - * @static
82 - * @param $parser Parser
83 - * @return bool
84 - */
85 - public static function clearState( &$parser ) {
86 - $parser->is_evalsCount = 0;
87 - $parser->is_tokensCount = 0;
88 - $parser->is_maxDepth = 0;
89 - return true;
90 - }
 124+/**
 125+ * Maximun call stack depth. Includes functions and invokations of parse() function.
 126+ */
 127+$wgInlineScriptsMaxCallStackDepth = 25;
91128
92 - /**
93 - * @static
94 - * @param $parser Parser
95 - * @param $frame
96 - * @param $args
97 - * @return string
98 - */
99 - public static function inlineHook( &$parser, $frame, $args ) {
100 - wfProfileIn( __METHOD__ );
101 - $scriptParser = self::getInterpreter();
102 - try {
103 - $result = $scriptParser->evaluate( $parser->mStripState->unstripBoth( $args[0] ),
104 - $parser, $frame );
105 - } catch( ISException $e ) {
106 - $msg = nl2br( htmlspecialchars( $e->getMessage() ) );
107 - wfProfileOut( __METHOD__ );
108 - return "<strong class=\"error\">{$msg}</strong>";
109 - }
110 - wfProfileOut( __METHOD__ );
111 - return trim( $result );
112 - }
113 -
114 - /**
115 - * @static
116 - * @param $parser Parser
117 - * @param $frame
118 - * @param $code
119 - * @param $attribs
120 - * @return string
121 - */
122 - public static function scriptHook( &$parser, $frame, $code, $attribs ) {
123 - wfProfileIn( __METHOD__ );
124 - $scriptParser = self::getInterpreter();
125 - try {
126 - $result = $scriptParser->execute( $code, $parser, $frame );
127 - } catch( ISException $e ) {
128 - $msg = nl2br( htmlspecialchars( $e->getMessage() ) );
129 - wfProfileOut( __METHOD__ );
130 - return "<strong class=\"error\">{$msg}</strong>";
131 - }
132 - if( !(isset( $attribs['noparse'] ) && $attribs['noparse']) ) {
133 - wfProfileIn( __METHOD__ . '-replacevars' );
134 - $result = $parser->replaceVariables( $result, $frame );
135 - wfProfileOut( __METHOD__ . '-replacevars' );
136 - }
137 - wfProfileOut( __METHOD__ );
138 - return trim( $result );
139 - }
140 -
141 - /**
142 - * @static
143 - * @param $parser Parser
144 - * @param $report
145 - * @return bool
146 - */
147 - public static function reportLimits( $parser, &$report ) {
148 - global $wgInlineScriptsLimits;
149 - $i = self::getInterpreter();
150 - $report .=
151 - "Inline scripts parser evaluations: {$i->mEvaluations}/{$wgInlineScriptsLimits['evaluations']}\n" .
152 - "Inline scripts tokens: {$i->mTokens}/{$wgInlineScriptsLimits['tokens']}\n" .
153 - "Inline scripts AST maximal depth: {$i->mMaxRecursion}/{$wgInlineScriptsLimits['depth']}\n";
154 - return true;
155 - }
156 -
157 - /**
158 - * @static
159 - * @return InlineScriptInterpreter
160 - */
161 - public static function getInterpreter() {
162 - if( !self::$scriptParser ) {
163 - self::$scriptParser = new ISInterpreter();
164 - }
165 - return self::$scriptParser;
166 - }
167 -}
 129+define( 'NS_MODULE', $wgScriptsNamespaceNumbers['Module'] );
 130+define( 'NS_MODULE_TALK', $wgScriptsNamespaceNumbers['Module_talk'] );

Status & tagging log