r94056 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94055‎ | r94056 | r94057 >
Date:11:56, 8 August 2011
Author:vasilievvv
Status:deferred
Tags:
Comment:
Commit my current work on inline scripts:
* Add associative arrays to the language. Includes complete rewrite of variable getting, setting and isset(), and some tests
* A lot of different clean-up and docs
* Added more profiling
Modified paths:
  • /trunk/extensions/InlineScripts/InlineScripts.i18n.php (modified) (history)
  • /trunk/extensions/InlineScripts/InlineScripts.php (modified) (history)
  • /trunk/extensions/InlineScripts/interpreter/Data.php (modified) (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/Shared.php (modified) (history)
  • /trunk/extensions/InlineScripts/interpreter/benchmark/benchmark.php (modified) (history)
  • /trunk/extensions/InlineScripts/interpreter/buildLRTables.php (modified) (history)
  • /trunk/extensions/InlineScripts/interpreter/syntax.txt (modified) (history)
  • /trunk/extensions/InlineScripts/interpreterTests.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/InlineScripts/interpreter/Data.php
@@ -1,5 +1,8 @@
22 <?php
33
 4+/**
 5+ * Class implementing data in the scripts.
 6+ */
47 class ISData {
58 // Data types
69 const DInt = 'int';
@@ -8,9 +11,10 @@
912 const DBool = 'bool';
1013 const DFloat = 'float';
1114 const DList = 'list'; // int -> value
 15+ const DAssoc = 'assoc'; // associative array
1216
13 - var $type;
14 - var $data;
 17+ public $type;
 18+ public $data;
1519
1620 public function __construct( $type = self::DNull, $val = null ) {
1721 $this->type = $type;
@@ -52,7 +56,7 @@
5357 return new ISData();
5458 }
5559
56 - if( $orig->type == self::DList ) {
 60+ if( $orig->isArray() ) {
5761 if( $target == self::DBool )
5862 return new ISData( self::DBool, (bool)count( $orig->data ) );
5963 if( $target == self::DFloat ) {
@@ -99,7 +103,7 @@
100104
101105 // Checks whether a is in b
102106 public static function keywordIn( $a, $b ) {
103 - if( $b->type == self::DList ) {
 107+ if( $b->isArray() ) {
104108 foreach( $b->data as $elem ) {
105109 if( self::equals( $elem, $a ) )
106110 return new ISData( self::DBool, true );
@@ -109,7 +113,7 @@
110114 $a = $a->toString();
111115 $b = $b->toString();
112116
113 - if ($a == '' || $b == '') {
 117+ if( $a == '' || $b == '' ) {
114118 return new ISData( self::DBool, false );
115119 }
116120
@@ -164,7 +168,7 @@
165169 $b = $b->toFloat();
166170 }
167171
168 - if ($op != '*' && $b == 0) {
 172+ if( $op != '*' && $b == 0 ) {
169173 throw new ISUserVisibleException( 'dividebyzero', $pos, array($a) );
170174 }
171175
@@ -178,10 +182,10 @@
179183 else
180184 throw new ISException( "Invalid multiplication-related operation: {$op}" ); // Should never happen
181185
182 - if ($type == self::DInt)
183 - $data = intval($data);
 186+ if( $type == self::DInt )
 187+ $data = intval( $data );
184188 else
185 - $data = doubleval($data);
 189+ $data = doubleval( $data );
186190
187191 return new ISData( $type, $data );
188192 }
@@ -203,38 +207,12 @@
204208 else
205209 return new ISData( self::DFloat, $a->toFloat() - $b->toFloat() );
206210 }
207 -
208 - public function setValueByIndices( $val, $indices, $line ) {
209 - if( $this->type == self::DNull && $indices[0] === null ) {
210 - $this->type = self::DList;
211 - $this->value = array();
212 - $this->setValueByIndices( $val, $indices, $line );
213 - } elseif( $this->type == self::DList ) {
214 - if( $indices[0] === null ) {
215 - $this->data[] = $val;
216 - } else {
217 - $idx = $indices[0]->toInt();
218 - if( $idx < 0 || $idx >= count( $this->data ) )
219 - throw new ISUserVisibleException( 'outofbounds', $line, array( count( $this->data ), $idx ) );
220 - if( count( $indices ) > 1 )
221 - $this->data[$idx]->setValueByIndices( $val, array_slice( $indices, 1 ), $line );
222 - else
223 - $this->data[$idx] = $val;
224 - }
225 - }
226 - }
227211
228 - public function checkIssetByIndices( $indices ) {
229 - if( $indices ) {
230 - $idx = array_shift( $indices );
231 - if( $this->type != self::DList || $idx >= count( $this->data ) )
232 - return false;
233 - return $this->checkIssetByIndices( $indices );
234 - } else {
235 - return true;
236 - }
 212+ public function isArray() {
 213+ return $this->type == self::DList || $this->type == self::DAssoc;
237214 }
238215
 216+
239217 /** Convert shorteners */
240218 public function toBool() {
241219 return self::castTypes( $this, self::DBool )->data;
@@ -255,4 +233,8 @@
256234 public function toList() {
257235 return self::castTypes( $this, self::DList )->data;
258236 }
 237+
 238+ public function toAssoc() {
 239+ return self::castTypes( $this, self::DAssoc )->data;
 240+ }
259241 }
Index: trunk/extensions/InlineScripts/interpreter/LRParser.php
@@ -4,28 +4,36 @@
55 * LR parser for inline scripts.
66 * Inputs tokens and LR table (ACTION/GOTO).
77 * Outputs parser tree.
 8+ *
 9+ * See http://en.wikipedia.org/wiki/LR_parser for details of how does that works.
810 */
911
1012 class ISLRParser implements ISParser {
11 - const Version = 1;
12 -
1313 const Shift = 0;
1414 const Reduce = 1;
1515 const Accept = 2;
1616
1717 var $mNonterminals, $mProductions, $mAction, $mGoto;
1818
 19+ public static function getVersion() {
 20+ return ISLRTable::Timestamp;
 21+ }
 22+
1923 public function __construct() {
2024 $this->loadGrammar();
2125 }
2226
2327 private function loadGrammar() {
 28+ wfProfileIn( __METHOD__ );
 29+
2430 require_once( 'LRTable.php' );
2531
2632 $this->mNonterminals = ISLRTable::$nonterminals;
2733 $this->mProductions = ISLRTable::$productions;
2834 $this->mAction = ISLRTable::$action;
2935 $this->mGoto = ISLRTable::$goto;
 36+
 37+ wfProfileOut( __METHOD__ );
3038 }
3139
3240 public function needsScanner() {
@@ -37,19 +45,26 @@
3846 $scanner->rewind();
3947 $tokenCount = 0;
4048
 49+ wfProfileIn( __METHOD__ );
 50+
4151 for( ; ; ) {
4252 $token = $scanner->current();
4353 $cur = $token->type;
44 - if( !$token )
 54+ if( !$token ) {
 55+ wfProfileOut( __METHOD__ );
4556 throw new ISException( 'Non-token input in LRParser::parse' );
 57+ }
4658
4759 $tokenCount++;
48 - if( $tokenCount > $maxTokens )
 60+ if( $tokenCount > $maxTokens ) {
 61+ wfProfileOut( __METHOD__ );
4962 throw new ISUserVisibleException( 'toomanytokens', $token->line );
 63+ }
5064
5165 list( $stateval, $state ) = end( $states );
5266 $act = @$this->mAction[$state][$cur];
5367 if( !$act ) {
 68+ wfProfileOut( __METHOD__ );
5469 throw new ISUserVisibleException( 'unexceptedtoken', $token->line,
5570 array( $token, implode( ', ', array_keys( @$this->mAction[$state] ) ) ) );
5671 }
@@ -78,6 +93,8 @@
7994 }
8095 }
8196
 97+ wfProfileOut( __METHOD__ );
 98+
8299 return new ISParserOutput( $states[1][0], $tokenCount );
83100 }
84101 }
Index: trunk/extensions/InlineScripts/interpreter/syntax.txt
@@ -4,7 +4,7 @@
55 <stmt> ::= <expr> semicolon
66 <stmt> ::= if leftbracket <expr> rightbracket <stmt>
77 <stmt> ::= if leftbracket <expr> rightbracket <stmt> else <stmt>
8 -<stmt> ::= for leftbracket <lvalue> in <expr> rightbracket <stmt>
 8+<stmt> ::= for leftbracket <forlvalue> in <expr> rightbracket <stmt>
99 <stmt> ::= try <stmt> catch leftbracket <lvalue> rightbracket <stmt>
1010 <stmt> ::= leftcurly <stmts> rightcurly
1111
@@ -23,14 +23,14 @@
2424 <exprFunction> ::= id leftbracket <commaListPlain> rightbracket | id leftbracket rightbracket
2525 <exprFunction> ::= <varfunc> leftbracket <lvalue> rightbracket | <exprAtom>
2626 <exprAtom> ::= <lvalue> | <atom> | break | continue
27 -<exprAtom> ::= leftbracket <expr> rightbracket | leftsquare <commaList> rightsquare
 27+<exprAtom> ::= leftbracket <expr> rightbracket
 28+<exprAtom> ::= leftsquare <commaListPlain> rightsquare | leftcurly <commaListAssoc> rightcurly
2829
2930 <varfunc> ::= isset | delete
30 -<commaList> ::= <commaListAssoc> | <commaListPlain>
3131 <commaListPlain> ::= <commaListPlain> comma <expr> | <expr>
3232 <commaListAssoc> ::= <commaListAssoc> comma <keyValue> | <keyValue>
3333 <keyValue> ::= <expr> colon <expr>
3434 <atom> ::= string | int | float | true | false | null
35 -<lvalue> ::= id <arrayIdxs> | id
36 -<arrayIdxs> ::= <arrayIdx> <arrayIdxs> | <arrayIdx>
 35+<lvalue> ::= id | <lvalue> <arrayIdx>
3736 <arrayIdx> ::= leftsquare <expr> rightsquare | leftsquare rightsquare
 37+<forlvalue> ::= <lvalue> | <lvalue> colon <lvalue>
Index: trunk/extensions/InlineScripts/interpreter/Interpreter.php
@@ -8,20 +8,30 @@
99 require_once( 'Shared.php' );
1010 require_once( 'Data.php' );
1111
12 -class InlineScriptInterpreter {
 12+/**
 13+ * The global interpreter object.
 14+ */
 15+class ISInterpreter {
1316 const ParserVersion = 1;
1417
15 - var $mCodeParser, $mMaxRecursion, $mEvaluations, $mTokens;
 18+ var $mCodeParser, $mMaxRecursion, $mEvaluations, $mTokens, $mUseCache;
1619
1720 public function __construct() {
18 - global $wgInlineScriptsParserClass;
 21+ global $wgInlineScriptsParserClass, $wgInlineScriptsUseCache;
 22+
1923 $this->mCodeParser = new $wgInlineScriptsParserClass( $this );
2024 $this->mMaxRecursion =
2125 $this->mEvaluations =
2226 $this->mTokens =
2327 0;
 28+
 29+ $this->mUseCache = $wgInlineScriptsUseCache;
2430 }
2531
 32+ public function disableCache() {
 33+ $this->mUseCache = false;
 34+ }
 35+
2636 public function checkRecursionLimit( $rec ) {
2737 global $wgInlineScriptsLimits;
2838 if( $rec > $this->mMaxRecursion )
@@ -43,18 +53,26 @@
4454
4555 public function execute( $code, $parser, $frame ) {
4656 wfProfileIn( __METHOD__ );
47 - $context = new InlineScriptEvaluationContext( $this, $parser, $frame );
 57+ $context = new ISEvaluationContext( $this, $parser, $frame );
4858 $ast = $this->parseCode( $code );
 59+
 60+ wfProfileIn( __METHOD__ . '-evaluation' );
4961 $context->evaluateNode( $ast, 0 )->toString();
 62+ wfProfileOut( __METHOD__ . '-evaluation' );
 63+
5064 wfProfileOut( __METHOD__ );
5165 return $context->mOut;
5266 }
5367
5468 public function evaluate( $code, $parser, $frame ) {
5569 wfProfileIn( __METHOD__ );
56 - $context = new InlineScriptEvaluationContext( $this, $parser, $frame );
 70+ $context = new ISEvaluationContext( $this, $parser, $frame );
5771 $ast = $this->parseCode( $code );
 72+
 73+ wfProfileIn( __METHOD__ . '-evaluation' );
5874 $result = $context->evaluateNode( $ast, 0 )->toString();
 75+ wfProfileOut( __METHOD__ . '-evaluation' );
 76+
5977 wfProfileOut( __METHOD__ );
6078 return $result;
6179 }
@@ -68,13 +86,13 @@
6987
7088 $memcKey = 'isparser:ast:' . md5( $code );
7189
72 - if( isset( $parserCache[$memcKey] ) ) {
 90+ if( $this->mUseCache && isset( $parserCache[$memcKey] ) ) {
7391 wfProfileOut( __METHOD__ );
7492 return $parserCache[$memcKey];
7593 }
7694
7795 $cached = $parserMemc->get( $memcKey );
78 - if( @$cached instanceof ISParserOutput && !$cached->isOutOfDate() ) {
 96+ if( $this->mUseCache && @$cached instanceof ISParserOutput && !$cached->isOutOfDate() ) {
7997 $cached->appendTokenCount( $this );
8098 $parserCache[$memcKey] = $cached->getParserTree();
8199 wfProfileOut( __METHOD__ );
@@ -97,7 +115,7 @@
98116 * An internal class used by InlineScript. Used to evaluate a parsed code
99117 * in a sepereate context with its own output, variables and parser frame.
100118 */
101 -class InlineScriptEvaluationContext {
 119+class ISEvaluationContext {
102120 var $mVars, $mOut, $mParser, $mFrame, $mInterpreter;
103121
104122 static $mFunctions = array(
@@ -141,6 +159,11 @@
142160 $this->mFrame = $frame;
143161 }
144162
 163+ /**
 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.
 167+ */
145168 public function evaluateNode( $node, $rec ) {
146169 if( !$node instanceof ISParserTreeNode ) {
147170 throw new ISException( 'evaluateNode() accepts only nonterminals' );
@@ -180,11 +203,19 @@
181204 }
182205 case 'for':
183206 $array = $this->evaluateNode( $c[4], $rec + 1 );
184 - if( $array->type != ISData::DList )
 207+ if( !$array->isArray() )
185208 throw new ISUserVisibleException( 'invalidforeach', $c[0]->type );
186209 $last = new ISData();
187 - foreach( $array->data as $item ) {
188 - $this->setVar( $c[2], $item, $rec );
 210+ $lvalues = $c[2]->getChildren();
 211+
 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+ }
189220 try {
190221 $last = $this->evaluateNode( $c[6], $rec + 1 );
191222 } catch( ISUserVisibleException $e ) {
@@ -312,7 +343,7 @@
313344 throw new ISUserVisibleException( 'unknownfunction', $c[0]->line );
314345 $func = self::$mFunctions[$funcname];
315346 if( $c[2] instanceof ISParserTreeNode ) {
316 - $args = $this->parseArray( $c[2], $rec );
 347+ $args = $this->parseArray( $c[2], $rec, $dummy );
317348 } else {
318349 $args = array();
319350 }
@@ -321,7 +352,8 @@
322353 $type = $c[0]->mChildren[0]->value;
323354 switch( $type ) {
324355 case 'isset':
325 - return new ISData( ISData::DBool, $this->checkIsset( $c[2], $rec ) );
 356+ $val = $this->getVar( $c[2], $rec, true );
 357+ return new ISData( ISData::DBool, $val !== null );
326358 case 'delete':
327359 $this->deleteVar( $c[2], $rec );
328360 return new ISData();
@@ -355,7 +387,10 @@
356388 case 'leftbracket':
357389 return $this->evaluateNode( $c[1], $rec + 1 );
358390 case 'leftsquare':
359 - return new ISData( ISData::DList, $this->parseArray( $c[1], $rec + 1 ) );
 391+ case 'leftcurly':
 392+ $arraytype = null;
 393+ $array = $this->parseArray( $c[1], $rec + 1, $arraytype );
 394+ return new ISData( $arraytype, $array );
360395 case 'break':
361396 throw new ISUserVisibleException( 'break', $c[0]->line );
362397 case 'continue':
@@ -371,89 +406,190 @@
372407 /*
373408 * Converts commaList* to a PHP array.
374409 */
375 - protected function parseArray( $node, $rec ) {
 410+ protected function parseArray( $node, $rec, &$arraytype ) {
376411 $c = $node->getChildren();
377 - switch( $node->getType() ) {
378 - case 'commalist':
379 - return $this->parseArray( $c[0], $rec );
 412+ $type = $node->getType();
 413+ if( $type == 'commalist' ) {
 414+ return $this->parseArray( $c[0], $rec, $arraytype );
 415+ }
 416+
 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();
 424+ }
 425+ array_unshift( $elements, $c[0] );
 426+
 427+ switch( $type ) {
380428 case 'commalistplain':
381 - $elements = $result = array();
382 - while( isset( $c[2] ) ) {
383 - array_unshift( $elements, $c[2] );
384 - $c = $c[0]->getChildren();
 429+ foreach( $elements as $elem ) {
 430+ $result[] = $this->evaluateNode( $elem, $rec + 1 );
385431 }
386 - array_unshift( $elements, $c[0] );
387 - foreach( $elements as $elem )
388 - $result[] = $this->evaluateNode( $elem, $rec + 1 );
 432+
 433+ $arraytype = ISData::DList;
 434+ wfProfileOut( __METHOD__ );
389435 return $result;
 436+
390437 case 'commalistassoc':
391 - throw new ISException( 'Not implemented' );
 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;
392449 }
393450 }
394451
395 - protected function getVar( $lval, $rec ) {
 452+ /**
 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.
 455+ */
 456+ protected function getVar( $lval, $rec, $nullIfNotSet = false ) {
 457+ // <lvalue> ::= id | <lvalue> <arrayIdx>
 458+ // <arrayIdx> ::= leftsquare <expr> rightsquare | leftsquare rightsquare
 459+
 460+ if( !$this->mInterpreter->checkRecursionLimit( $rec ) ) {
 461+ throw new ISUserVisibleException( 'recoverflow', 0 );
 462+ }
 463+
396464 $c = $lval->getChildren();
397 - $line = $c[0]->line;
398 - $varname = $c[0]->value;
399 - if( !isset( $this->mVars[$varname] ) ) {
400 - throw new ISUserVisibleException( 'unknownvar', $line, array( $varname ) );
401 - }
402 - if( isset( $c[1] ) ) {
403 - $indices = array();
404 - $c = $c[1]->getChildren();
405 - while( isset( $c[1] ) ) {
406 - array_unshift( $indices, $c[1] );
407 - $c = $c[0]->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 ) );
408472 }
409 - array_unshift( $indices, $c[0] );
410 - foreach( $indices as &$idx ) {
411 - $c = $idx->getChildren();
412 - if( !$c[1] instanceof ISParserTreeNode )
413 - throw new ISUserVisibleException( 'emptyidx', $line );
414 - $idx = $this->evaluateNode( $c[1], $rec + 1 );
 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 );
415483 }
416484
417 - $val = $this->mVars[$varname];
418 - foreach( $indices as $idx ) {
419 - if( $val->type == ISData::DList ) {
420 - $idx = $idx->toInt();
421 - if( count( $val->data ) <= $idx )
422 - throw new ISUserVisibleException( 'outofbounds', $line );
423 - $val = $val->data[$idx];
424 - } else {
425 - throw new ISUserVisibleException( 'notanarray', $line );
426 - }
 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 );
427506 }
428 - return $val;
429 - } else {
430 - return $this->mVars[$varname];
431507 }
432508 }
433509
 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];
 517+ }
 518+ return $node->line;
 519+ }
 520+
 521+ /**
 522+ * Changes the value of variable or array element specified in $lval to $newval.
 523+ */
434524 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 );
 537+ }
 538+
435539 $c = $lval->getChildren();
436 - $varname = $c[0]->value;
437 - if( isset( $c[1] ) ) {
438 - $lineno = 0;
439 - $idxs = array();
440 - while( isset( $c[1] ) && $c[1]->getType() == 'arrayidxs' ) {
441 - $c = $c[1]->getChildren();
442 - $idxs[] = $c[0];
 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+ }
443559 }
444 - if( !isset( $this->mVars[$varname] ) )
445 - $this->mVars[$varname] = new ISData( ISData::DList, array() );
446 - foreach( $idxs as &$idx ) {
447 - $idxchildren = $idx->getChildren();
448 - if( !$lineno )
449 - $lineno = $idxchildren[0]->line;
450 - if( count( $idxchildren ) > 2 )
451 - $idx = $this->evaluateNode( $idxchildren[1], $rec + 1 );
452 - else
453 - $idx = null;
 560+
 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();
 567+
 568+ if( $key < 0 || $key > count( $ref->data ) )
 569+ throw new ISUserVisibleException( 'outofbounds', $idxc[0]->line );
 570+ } else {
 571+ $key = count( $ref->data );
 572+ }
 573+
 574+ if( !isset( $ref->data[$key] ) )
 575+ $ref->data[$key] = new ISPlaceholder();
 576+
 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();
 583+
 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 );
454593 }
455 - $this->mVars[$varname]->setValueByIndices( $newval, $idxs, $lineno );
456 - } else {
457 - $this->mVars[$varname] = $newval;
458594 }
459595 }
460596
@@ -476,45 +612,6 @@
477613 if( count( $args ) < $count )
478614 throw new ISUserVisibleException( 'notenoughargs', $pos );
479615 }
480 -
481 - protected function checkIsset( $lval, $rec ) {
482 - $c = $lval->getChildren();
483 - $line = $c[0]->line;
484 - $varname = $c[0]->value;
485 - if( !isset( $this->mVars[$varname] ) ) {
486 - return false;
487 - }
488 - if( isset( $c[1] ) ) {
489 - $indices = array();
490 - $c = $c[1]->getChildren();
491 - while( isset( $c[1] ) ) {
492 - array_unshift( $indices, $c[1] );
493 - $c = $c[0]->getChildren();
494 - }
495 - array_unshift( $indices, $c[0] );
496 - foreach( $indices as &$idx ) {
497 - $c = $idx->getChildren();
498 - if( !$c[1] instanceof ISParserTreeNode )
499 - throw new ISUserVisibleException( 'emptyidx', $line );
500 - $idx = $this->evaluateNode( $c[1], $rec + 1 );
501 - }
502 -
503 - $val = $this->mVars[$varname];
504 - foreach( $indices as $idx ) {
505 - if( $val->type == ISData::DList ) {
506 - $idx = $idx->toInt();
507 - if( count( $val->data ) <= $idx )
508 - return false;
509 - $val = $val->data[$idx];
510 - } else {
511 - return false;
512 - }
513 - }
514 - return true;
515 - } else {
516 - return true;
517 - }
518 - }
519616
520617 protected function deleteVar( $lval, $rec ) {
521618 $c = $lval->getChildren();
Index: trunk/extensions/InlineScripts/interpreter/benchmark/benchmark.php
@@ -29,7 +29,7 @@
3030 if ($lang == 'php') {
3131 return eval($source);
3232 } else {
33 - $scriptParser = new InlineScriptInterpreter();
 33+ $scriptParser = new ISInterpreter();
3434 $parser = new Parser();
3535 $frame = null; //new Frame();
3636 return $scriptParser->evaluate( $source, $parser, $frame );
Index: trunk/extensions/InlineScripts/interpreter/LRTable.php
@@ -19,38 +19,39 @@
2020 * * $productions is a ID -> array( nonterminal, body ) map.
2121 * * Production body is an array of production symbols
2222 *
23 - * Generated on 2011-08-03 09:33.
 23+ * Generated on 2011-08-06 07:13.
2424 */
2525
2626 class ISLRTable {
2727
 28+const Timestamp = '2011-08-06 07:13';
 29+
2830 static $nonterminals = array(
2931 0 => 'program',
3032 1 => 'stmts',
3133 2 => 'stmt',
3234 3 => 'expr',
33 - 4 => 'lvalue',
34 - 5 => 'exprset',
35 - 6 => 'exprtrinary',
36 - 7 => 'exprlogical',
37 - 8 => 'exprcompare',
38 - 9 => 'exprequals',
39 - 10 => 'exprsum',
40 - 11 => 'exprmul',
41 - 12 => 'exprpow',
42 - 13 => 'exprinvert',
43 - 14 => 'exprkeyword',
44 - 15 => 'exprunary',
45 - 16 => 'exprfunction',
46 - 17 => 'commalistplain',
47 - 18 => 'varfunc',
48 - 19 => 'expratom',
49 - 20 => 'atom',
50 - 21 => 'commalist',
 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',
5153 22 => 'commalistassoc',
5254 23 => 'keyvalue',
53 - 24 => 'arrayidxs',
54 - 25 => 'arrayidx',
 55+ 24 => 'arrayidx',
5556 );
5657
5758 static $productions = array(
@@ -61,63 +62,62 @@
6263 4 => array( 2, array( 'if', 'leftbracket', 3, 'rightbracket', 2 ) ),
6364 5 => array( 2, array( 'if', 'leftbracket', 3, 'rightbracket', 2, 'else', 2 ) ),
6465 6 => array( 2, array( 'for', 'leftbracket', 4, 'in', 3, 'rightbracket', 2 ) ),
65 - 7 => array( 2, array( 'try', 2, 'catch', 'leftbracket', 4, 'rightbracket', 2 ) ),
 66+ 7 => array( 2, array( 'try', 2, 'catch', 'leftbracket', 5, 'rightbracket', 2 ) ),
6667 8 => array( 2, array( 'leftcurly', 1, 'rightcurly' ) ),
67 - 9 => array( 3, array( 5 ) ),
68 - 10 => array( 5, array( 4, 'setto', 5 ) ),
69 - 11 => array( 5, array( 6 ) ),
70 - 12 => array( 6, array( 7, 'trinary', 6, 'colon', 6 ) ),
71 - 13 => array( 6, array( 7 ) ),
72 - 14 => array( 7, array( 7, 'logicop', 8 ) ),
73 - 15 => array( 7, array( 8 ) ),
74 - 16 => array( 8, array( 8, 'compareop', 9 ) ),
75 - 17 => array( 8, array( 9 ) ),
76 - 18 => array( 9, array( 10, 'equalsto', 10 ) ),
77 - 19 => array( 9, array( 10 ) ),
78 - 20 => array( 10, array( 10, 'sum', 11 ) ),
79 - 21 => array( 10, array( 11 ) ),
80 - 22 => array( 11, array( 11, 'mul', 12 ) ),
81 - 23 => array( 11, array( 12 ) ),
82 - 24 => array( 12, array( 13, 'pow', 12 ) ),
83 - 25 => array( 12, array( 13 ) ),
84 - 26 => array( 13, array( 'invert', 14 ) ),
85 - 27 => array( 13, array( 14 ) ),
86 - 28 => array( 14, array( 15, 'in', 15 ) ),
87 - 29 => array( 14, array( 15, 'contains', 15 ) ),
88 - 30 => array( 14, array( 15 ) ),
89 - 31 => array( 15, array( 'sum', 16 ) ),
90 - 32 => array( 15, array( 16 ) ),
91 - 33 => array( 16, array( 'id', 'leftbracket', 17, 'rightbracket' ) ),
92 - 34 => array( 16, array( 'id', 'leftbracket', 'rightbracket' ) ),
93 - 35 => array( 16, array( 18, 'leftbracket', 4, 'rightbracket' ) ),
94 - 36 => array( 16, array( 19 ) ),
95 - 37 => array( 19, array( 4 ) ),
96 - 38 => array( 19, array( 20 ) ),
97 - 39 => array( 19, array( 'break' ) ),
98 - 40 => array( 19, array( 'continue' ) ),
99 - 41 => array( 19, array( 'leftbracket', 3, 'rightbracket' ) ),
100 - 42 => array( 19, array( 'leftsquare', 21, 'rightsquare' ) ),
101 - 43 => array( 18, array( 'isset' ) ),
102 - 44 => array( 18, array( 'delete' ) ),
103 - 45 => array( 21, array( 22 ) ),
104 - 46 => array( 21, array( 17 ) ),
105 - 47 => array( 17, array( 17, 'comma', 3 ) ),
106 - 48 => array( 17, array( 3 ) ),
107 - 49 => array( 22, array( 22, 'comma', 23 ) ),
108 - 50 => array( 22, array( 23 ) ),
109 - 51 => array( 23, array( 3, 'colon', 3 ) ),
110 - 52 => array( 20, array( 'string' ) ),
111 - 53 => array( 20, array( 'int' ) ),
112 - 54 => array( 20, array( 'float' ) ),
113 - 55 => array( 20, array( 'true' ) ),
114 - 56 => array( 20, array( 'false' ) ),
115 - 57 => array( 20, array( 'null' ) ),
116 - 58 => array( 4, array( 'id', 24 ) ),
117 - 59 => array( 4, array( 'id' ) ),
118 - 60 => array( 24, array( 25, 24 ) ),
119 - 61 => array( 24, array( 25 ) ),
120 - 62 => array( 25, array( 'leftsquare', 3, 'rightsquare' ) ),
121 - 63 => array( 25, array( 'leftsquare', 'rightsquare' ) ),
 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 ) ),
122122 );
123123
124124 static $action = array(
@@ -155,6 +155,7 @@
156156 'continue' => array( 0, 10 ),
157157 'leftbracket' => array( 0, 2 ),
158158 'leftsquare' => array( 0, 11 ),
 159+ 'leftcurly' => array( 0, 40 ),
159160 'string' => array( 0, 14 ),
160161 'int' => array( 0, 15 ),
161162 'float' => array( 0, 16 ),
@@ -163,7 +164,7 @@
164165 'null' => array( 0, 19 ),
165166 ),
166167 3 => array(
167 - 'leftbracket' => array( 0, 41 ),
 168+ 'leftbracket' => array( 0, 42 ),
168169 ),
169170 4 => array(
170171 'if' => array( 0, 1 ),
@@ -208,13 +209,14 @@
209210 'null' => array( 0, 19 ),
210211 ),
211212 6 => array(
212 - 'id' => array( 0, 44 ),
 213+ 'id' => array( 0, 48 ),
213214 'isset' => array( 0, 12 ),
214215 'delete' => array( 0, 13 ),
215216 'break' => array( 0, 9 ),
216217 'continue' => array( 0, 10 ),
217218 'leftbracket' => array( 0, 2 ),
218219 'leftsquare' => array( 0, 11 ),
 220+ 'leftcurly' => array( 0, 40 ),
219221 'string' => array( 0, 14 ),
220222 'int' => array( 0, 15 ),
221223 'float' => array( 0, 16 ),
@@ -224,13 +226,14 @@
225227 ),
226228 7 => array(
227229 'sum' => array( 0, 6 ),
228 - 'id' => array( 0, 44 ),
 230+ 'id' => array( 0, 48 ),
229231 'isset' => array( 0, 12 ),
230232 'delete' => array( 0, 13 ),
231233 'break' => array( 0, 9 ),
232234 'continue' => array( 0, 10 ),
233235 'leftbracket' => array( 0, 2 ),
234236 'leftsquare' => array( 0, 11 ),
 237+ 'leftcurly' => array( 0, 40 ),
235238 'string' => array( 0, 14 ),
236239 'int' => array( 0, 15 ),
237240 'float' => array( 0, 16 ),
@@ -239,23 +242,24 @@
240243 'null' => array( 0, 19 ),
241244 ),
242245 8 => array(
243 - 'in' => array( 1, 59 ),
244 - 'rightbracket' => array( 1, 59 ),
245 - 'setto' => array( 1, 59 ),
246 - 'pow' => array( 1, 59 ),
247 - 'equalsto' => array( 1, 59 ),
248 - 'trinary' => array( 1, 59 ),
249 - 'semicolon' => array( 1, 59 ),
250 - 'colon' => array( 1, 59 ),
251 - 'logicop' => array( 1, 59 ),
252 - 'compareop' => array( 1, 59 ),
253 - 'sum' => array( 1, 59 ),
254 - 'mul' => array( 1, 59 ),
255 - 'contains' => array( 1, 59 ),
256 - 'rightsquare' => array( 1, 59 ),
257 - 'comma' => array( 1, 59 ),
258 - 'leftbracket' => array( 0, 48 ),
259 - 'leftsquare' => array( 0, 49 ),
 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 ),
260264 ),
261265 9 => array(
262266 'in' => array( 1, 39 ),
@@ -272,6 +276,7 @@
273277 'contains' => array( 1, 39 ),
274278 'rightsquare' => array( 1, 39 ),
275279 'comma' => array( 1, 39 ),
 280+ 'rightcurly' => array( 1, 39 ),
276281 ),
277282 10 => array(
278283 'in' => array( 1, 40 ),
@@ -288,6 +293,7 @@
289294 'contains' => array( 1, 40 ),
290295 'rightsquare' => array( 1, 40 ),
291296 'comma' => array( 1, 40 ),
 297+ 'rightcurly' => array( 1, 40 ),
292298 ),
293299 11 => array(
294300 'id' => array( 0, 8 ),
@@ -299,6 +305,7 @@
300306 'continue' => array( 0, 10 ),
301307 'leftbracket' => array( 0, 2 ),
302308 'leftsquare' => array( 0, 11 ),
 309+ 'leftcurly' => array( 0, 40 ),
303310 'string' => array( 0, 14 ),
304311 'int' => array( 0, 15 ),
305312 'float' => array( 0, 16 ),
@@ -307,12 +314,29 @@
308315 'null' => array( 0, 19 ),
309316 ),
310317 12 => array(
311 - 'leftbracket' => array( 1, 43 ),
 318+ 'leftbracket' => array( 1, 44 ),
312319 ),
313320 13 => array(
314 - 'leftbracket' => array( 1, 44 ),
 321+ 'leftbracket' => array( 1, 45 ),
315322 ),
316323 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 ),
 339+ ),
 340+ 15 => array(
317341 'in' => array( 1, 52 ),
318342 'pow' => array( 1, 52 ),
319343 'equalsto' => array( 1, 52 ),
@@ -327,8 +351,9 @@
328352 'contains' => array( 1, 52 ),
329353 'rightsquare' => array( 1, 52 ),
330354 'comma' => array( 1, 52 ),
 355+ 'rightcurly' => array( 1, 52 ),
331356 ),
332 - 15 => array(
 357+ 16 => array(
333358 'in' => array( 1, 53 ),
334359 'pow' => array( 1, 53 ),
335360 'equalsto' => array( 1, 53 ),
@@ -343,8 +368,9 @@
344369 'contains' => array( 1, 53 ),
345370 'rightsquare' => array( 1, 53 ),
346371 'comma' => array( 1, 53 ),
 372+ 'rightcurly' => array( 1, 53 ),
347373 ),
348 - 16 => array(
 374+ 17 => array(
349375 'in' => array( 1, 54 ),
350376 'pow' => array( 1, 54 ),
351377 'equalsto' => array( 1, 54 ),
@@ -359,8 +385,9 @@
360386 'contains' => array( 1, 54 ),
361387 'rightsquare' => array( 1, 54 ),
362388 'comma' => array( 1, 54 ),
 389+ 'rightcurly' => array( 1, 54 ),
363390 ),
364 - 17 => array(
 391+ 18 => array(
365392 'in' => array( 1, 55 ),
366393 'pow' => array( 1, 55 ),
367394 'equalsto' => array( 1, 55 ),
@@ -375,8 +402,9 @@
376403 'contains' => array( 1, 55 ),
377404 'rightsquare' => array( 1, 55 ),
378405 'comma' => array( 1, 55 ),
 406+ 'rightcurly' => array( 1, 55 ),
379407 ),
380 - 18 => array(
 408+ 19 => array(
381409 'in' => array( 1, 56 ),
382410 'pow' => array( 1, 56 ),
383411 'equalsto' => array( 1, 56 ),
@@ -391,23 +419,8 @@
392420 'contains' => array( 1, 56 ),
393421 'rightsquare' => array( 1, 56 ),
394422 'comma' => array( 1, 56 ),
 423+ 'rightcurly' => array( 1, 56 ),
395424 ),
396 - 19 => array(
397 - 'in' => array( 1, 57 ),
398 - 'pow' => array( 1, 57 ),
399 - 'equalsto' => array( 1, 57 ),
400 - 'trinary' => array( 1, 57 ),
401 - 'semicolon' => array( 1, 57 ),
402 - 'rightbracket' => array( 1, 57 ),
403 - 'colon' => array( 1, 57 ),
404 - 'logicop' => array( 1, 57 ),
405 - 'compareop' => array( 1, 57 ),
406 - 'sum' => array( 1, 57 ),
407 - 'mul' => array( 1, 57 ),
408 - 'contains' => array( 1, 57 ),
409 - 'rightsquare' => array( 1, 57 ),
410 - 'comma' => array( 1, 57 ),
411 - ),
412425 20 => array(
413426 '$' => array( 2, null ),
414427 'if' => array( 0, 1 ),
@@ -454,10 +467,10 @@
455468 'rightcurly' => array( 1, 2 ),
456469 ),
457470 22 => array(
458 - 'semicolon' => array( 0, 58 ),
 471+ 'semicolon' => array( 0, 56 ),
459472 ),
460473 23 => array(
461 - 'setto' => array( 0, 59 ),
 474+ 'setto' => array( 0, 57 ),
462475 'in' => array( 1, 37 ),
463476 'pow' => array( 1, 37 ),
464477 'equalsto' => array( 1, 37 ),
@@ -472,6 +485,8 @@
473486 'contains' => array( 1, 37 ),
474487 'rightsquare' => array( 1, 37 ),
475488 'comma' => array( 1, 37 ),
 489+ 'rightcurly' => array( 1, 37 ),
 490+ 'leftsquare' => array( 0, 58 ),
476491 ),
477492 24 => array(
478493 'semicolon' => array( 1, 9 ),
@@ -479,6 +494,7 @@
480495 'rightsquare' => array( 1, 9 ),
481496 'comma' => array( 1, 9 ),
482497 'colon' => array( 1, 9 ),
 498+ 'rightcurly' => array( 1, 9 ),
483499 ),
484500 25 => array(
485501 'semicolon' => array( 1, 11 ),
@@ -486,6 +502,7 @@
487503 'rightsquare' => array( 1, 11 ),
488504 'comma' => array( 1, 11 ),
489505 'colon' => array( 1, 11 ),
 506+ 'rightcurly' => array( 1, 11 ),
490507 ),
491508 26 => array(
492509 'trinary' => array( 0, 60 ),
@@ -494,6 +511,7 @@
495512 'colon' => array( 1, 13 ),
496513 'rightsquare' => array( 1, 13 ),
497514 'comma' => array( 1, 13 ),
 515+ 'rightcurly' => array( 1, 13 ),
498516 'logicop' => array( 0, 61 ),
499517 ),
500518 27 => array(
@@ -504,6 +522,7 @@
505523 'logicop' => array( 1, 15 ),
506524 'rightsquare' => array( 1, 15 ),
507525 'comma' => array( 1, 15 ),
 526+ 'rightcurly' => array( 1, 15 ),
508527 'compareop' => array( 0, 62 ),
509528 ),
510529 28 => array(
@@ -515,6 +534,7 @@
516535 'compareop' => array( 1, 17 ),
517536 'rightsquare' => array( 1, 17 ),
518537 'comma' => array( 1, 17 ),
 538+ 'rightcurly' => array( 1, 17 ),
519539 ),
520540 29 => array(
521541 'equalsto' => array( 0, 63 ),
@@ -526,6 +546,7 @@
527547 'compareop' => array( 1, 19 ),
528548 'rightsquare' => array( 1, 19 ),
529549 'comma' => array( 1, 19 ),
 550+ 'rightcurly' => array( 1, 19 ),
530551 'sum' => array( 0, 64 ),
531552 ),
532553 30 => array(
@@ -539,6 +560,7 @@
540561 'sum' => array( 1, 21 ),
541562 'rightsquare' => array( 1, 21 ),
542563 'comma' => array( 1, 21 ),
 564+ 'rightcurly' => array( 1, 21 ),
543565 'mul' => array( 0, 65 ),
544566 ),
545567 31 => array(
@@ -553,6 +575,7 @@
554576 'mul' => array( 1, 23 ),
555577 'rightsquare' => array( 1, 23 ),
556578 'comma' => array( 1, 23 ),
 579+ 'rightcurly' => array( 1, 23 ),
557580 ),
558581 32 => array(
559582 'pow' => array( 0, 66 ),
@@ -567,6 +590,7 @@
568591 'mul' => array( 1, 25 ),
569592 'rightsquare' => array( 1, 25 ),
570593 'comma' => array( 1, 25 ),
 594+ 'rightcurly' => array( 1, 25 ),
571595 ),
572596 33 => array(
573597 'pow' => array( 1, 27 ),
@@ -581,6 +605,7 @@
582606 'mul' => array( 1, 27 ),
583607 'rightsquare' => array( 1, 27 ),
584608 'comma' => array( 1, 27 ),
 609+ 'rightcurly' => array( 1, 27 ),
585610 ),
586611 34 => array(
587612 'in' => array( 0, 67 ),
@@ -597,6 +622,7 @@
598623 'mul' => array( 1, 30 ),
599624 'rightsquare' => array( 1, 30 ),
600625 'comma' => array( 1, 30 ),
 626+ 'rightcurly' => array( 1, 30 ),
601627 ),
602628 35 => array(
603629 'in' => array( 1, 32 ),
@@ -613,6 +639,7 @@
614640 'contains' => array( 1, 32 ),
615641 'rightsquare' => array( 1, 32 ),
616642 'comma' => array( 1, 32 ),
 643+ 'rightcurly' => array( 1, 32 ),
617644 ),
618645 36 => array(
619646 'leftbracket' => array( 0, 69 ),
@@ -632,6 +659,7 @@
633660 'contains' => array( 1, 36 ),
634661 'rightsquare' => array( 1, 36 ),
635662 'comma' => array( 1, 36 ),
 663+ 'rightcurly' => array( 1, 36 ),
636664 ),
637665 38 => array(
638666 'in' => array( 1, 38 ),
@@ -648,6 +676,7 @@
649677 'contains' => array( 1, 38 ),
650678 'rightsquare' => array( 1, 38 ),
651679 'comma' => array( 1, 38 ),
 680+ 'rightcurly' => array( 1, 38 ),
652681 ),
653682 39 => array(
654683 'id' => array( 0, 8 ),
@@ -659,6 +688,7 @@
660689 'continue' => array( 0, 10 ),
661690 'leftbracket' => array( 0, 2 ),
662691 'leftsquare' => array( 0, 11 ),
 692+ 'leftcurly' => array( 0, 40 ),
663693 'string' => array( 0, 14 ),
664694 'int' => array( 0, 15 ),
665695 'float' => array( 0, 16 ),
@@ -667,16 +697,34 @@
668698 'null' => array( 0, 19 ),
669699 ),
670700 40 => array(
671 - 'rightbracket' => array( 0, 71 ),
 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 ),
672717 ),
673718 41 => array(
674 - 'id' => array( 0, 72 ),
 719+ 'rightbracket' => array( 0, 72 ),
675720 ),
676721 42 => array(
677 - 'catch' => array( 0, 74 ),
 722+ 'id' => array( 0, 73 ),
678723 ),
679724 43 => array(
680 - 'rightcurly' => array( 0, 75 ),
 725+ 'catch' => array( 0, 76 ),
 726+ ),
 727+ 44 => array(
 728+ 'rightcurly' => array( 0, 77 ),
681729 'if' => array( 0, 1 ),
682730 'for' => array( 0, 3 ),
683731 'try' => array( 0, 4 ),
@@ -697,26 +745,39 @@
698746 'false' => array( 0, 18 ),
699747 'null' => array( 0, 19 ),
700748 ),
701 - 44 => array(
702 - 'leftbracket' => array( 0, 48 ),
703 - 'in' => array( 1, 59 ),
704 - 'rightbracket' => array( 1, 59 ),
705 - 'setto' => array( 1, 59 ),
706 - 'pow' => array( 1, 59 ),
707 - 'equalsto' => array( 1, 59 ),
708 - 'trinary' => array( 1, 59 ),
709 - 'semicolon' => array( 1, 59 ),
710 - 'colon' => array( 1, 59 ),
711 - 'logicop' => array( 1, 59 ),
712 - 'compareop' => array( 1, 59 ),
713 - 'sum' => array( 1, 59 ),
714 - 'mul' => array( 1, 59 ),
715 - 'contains' => array( 1, 59 ),
716 - 'rightsquare' => array( 1, 59 ),
717 - 'comma' => array( 1, 59 ),
718 - 'leftsquare' => array( 0, 49 ),
 749+ 45 => array(
 750+ 'semicolon' => array( 0, 56 ),
 751+ 'colon' => array( 0, 78 ),
719752 ),
720 - 45 => array(
 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(
721782 'in' => array( 1, 37 ),
722783 'pow' => array( 1, 37 ),
723784 'equalsto' => array( 1, 37 ),
@@ -731,8 +792,10 @@
732793 'contains' => array( 1, 37 ),
733794 'rightsquare' => array( 1, 37 ),
734795 'comma' => array( 1, 37 ),
 796+ 'rightcurly' => array( 1, 37 ),
 797+ 'leftsquare' => array( 0, 58 ),
735798 ),
736 - 46 => array(
 799+ 50 => array(
737800 'in' => array( 1, 31 ),
738801 'pow' => array( 1, 31 ),
739802 'equalsto' => array( 1, 31 ),
@@ -747,8 +810,9 @@
748811 'contains' => array( 1, 31 ),
749812 'rightsquare' => array( 1, 31 ),
750813 'comma' => array( 1, 31 ),
 814+ 'rightcurly' => array( 1, 31 ),
751815 ),
752 - 47 => array(
 816+ 51 => array(
753817 'pow' => array( 1, 26 ),
754818 'equalsto' => array( 1, 26 ),
755819 'trinary' => array( 1, 26 ),
@@ -761,9 +825,10 @@
762826 'mul' => array( 1, 26 ),
763827 'rightsquare' => array( 1, 26 ),
764828 'comma' => array( 1, 26 ),
 829+ 'rightcurly' => array( 1, 26 ),
765830 ),
766 - 48 => array(
767 - 'rightbracket' => array( 0, 76 ),
 831+ 52 => array(
 832+ 'rightbracket' => array( 0, 81 ),
768833 'id' => array( 0, 8 ),
769834 'invert' => array( 0, 7 ),
770835 'sum' => array( 0, 6 ),
@@ -773,6 +838,7 @@
774839 'continue' => array( 0, 10 ),
775840 'leftbracket' => array( 0, 2 ),
776841 'leftsquare' => array( 0, 11 ),
 842+ 'leftcurly' => array( 0, 40 ),
777843 'string' => array( 0, 14 ),
778844 'int' => array( 0, 15 ),
779845 'float' => array( 0, 16 ),
@@ -780,81 +846,16 @@
781847 'false' => array( 0, 18 ),
782848 'null' => array( 0, 19 ),
783849 ),
784 - 49 => array(
785 - 'rightsquare' => array( 0, 79 ),
786 - 'id' => array( 0, 8 ),
787 - 'invert' => array( 0, 7 ),
788 - 'sum' => array( 0, 6 ),
789 - 'isset' => array( 0, 12 ),
790 - 'delete' => array( 0, 13 ),
791 - 'break' => array( 0, 9 ),
792 - 'continue' => array( 0, 10 ),
793 - 'leftbracket' => array( 0, 2 ),
794 - 'leftsquare' => array( 0, 11 ),
795 - 'string' => array( 0, 14 ),
796 - 'int' => array( 0, 15 ),
797 - 'float' => array( 0, 16 ),
798 - 'true' => array( 0, 17 ),
799 - 'false' => array( 0, 18 ),
800 - 'null' => array( 0, 19 ),
801 - ),
802 - 50 => array(
803 - 'in' => array( 1, 58 ),
804 - 'rightbracket' => array( 1, 58 ),
805 - 'setto' => array( 1, 58 ),
806 - 'pow' => array( 1, 58 ),
807 - 'equalsto' => array( 1, 58 ),
808 - 'trinary' => array( 1, 58 ),
809 - 'semicolon' => array( 1, 58 ),
810 - 'colon' => array( 1, 58 ),
811 - 'logicop' => array( 1, 58 ),
812 - 'compareop' => array( 1, 58 ),
813 - 'sum' => array( 1, 58 ),
814 - 'mul' => array( 1, 58 ),
815 - 'contains' => array( 1, 58 ),
816 - 'rightsquare' => array( 1, 58 ),
817 - 'comma' => array( 1, 58 ),
818 - ),
819 - 51 => array(
820 - 'in' => array( 1, 61 ),
821 - 'rightbracket' => array( 1, 61 ),
822 - 'setto' => array( 1, 61 ),
823 - 'pow' => array( 1, 61 ),
824 - 'equalsto' => array( 1, 61 ),
825 - 'trinary' => array( 1, 61 ),
826 - 'semicolon' => array( 1, 61 ),
827 - 'colon' => array( 1, 61 ),
828 - 'logicop' => array( 1, 61 ),
829 - 'compareop' => array( 1, 61 ),
830 - 'sum' => array( 1, 61 ),
831 - 'mul' => array( 1, 61 ),
832 - 'contains' => array( 1, 61 ),
833 - 'rightsquare' => array( 1, 61 ),
834 - 'comma' => array( 1, 61 ),
835 - 'leftsquare' => array( 0, 49 ),
836 - ),
837 - 52 => array(
838 - 'rightbracket' => array( 1, 48 ),
839 - 'rightsquare' => array( 1, 48 ),
840 - 'comma' => array( 1, 48 ),
841 - 'colon' => array( 0, 82 ),
842 - ),
843850 53 => array(
844 - 'rightsquare' => array( 1, 46 ),
845 - 'comma' => array( 0, 83 ),
 851+ 'rightbracket' => array( 1, 47 ),
 852+ 'rightsquare' => array( 1, 47 ),
 853+ 'comma' => array( 1, 47 ),
846854 ),
847855 54 => array(
848 - 'rightsquare' => array( 0, 84 ),
 856+ 'rightsquare' => array( 0, 83 ),
 857+ 'comma' => array( 0, 84 ),
849858 ),
850859 55 => array(
851 - 'rightsquare' => array( 1, 45 ),
852 - 'comma' => array( 0, 85 ),
853 - ),
854 - 56 => array(
855 - 'rightsquare' => array( 1, 50 ),
856 - 'comma' => array( 1, 50 ),
857 - ),
858 - 57 => array(
859860 '$' => array( 1, 1 ),
860861 'if' => array( 1, 1 ),
861862 'for' => array( 1, 1 ),
@@ -877,7 +878,7 @@
878879 'null' => array( 1, 1 ),
879880 'rightcurly' => array( 1, 1 ),
880881 ),
881 - 58 => array(
 882+ 56 => array(
882883 '$' => array( 1, 3 ),
883884 'if' => array( 1, 3 ),
884885 'for' => array( 1, 3 ),
@@ -902,7 +903,7 @@
903904 'catch' => array( 1, 3 ),
904905 'rightcurly' => array( 1, 3 ),
905906 ),
906 - 59 => array(
 907+ 57 => array(
907908 'id' => array( 0, 8 ),
908909 'invert' => array( 0, 7 ),
909910 'sum' => array( 0, 6 ),
@@ -912,6 +913,7 @@
913914 'continue' => array( 0, 10 ),
914915 'leftbracket' => array( 0, 2 ),
915916 'leftsquare' => array( 0, 11 ),
 917+ 'leftcurly' => array( 0, 40 ),
916918 'string' => array( 0, 14 ),
917919 'int' => array( 0, 15 ),
918920 'float' => array( 0, 16 ),
@@ -919,16 +921,55 @@
920922 'false' => array( 0, 18 ),
921923 'null' => array( 0, 19 ),
922924 ),
 925+ 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 ),
 943+ ),
 944+ 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 ),
 962+ ),
923963 60 => array(
924964 'invert' => array( 0, 7 ),
925965 'sum' => array( 0, 6 ),
926 - 'id' => array( 0, 44 ),
 966+ 'id' => array( 0, 48 ),
927967 'isset' => array( 0, 12 ),
928968 'delete' => array( 0, 13 ),
929969 'break' => array( 0, 9 ),
930970 'continue' => array( 0, 10 ),
931971 'leftbracket' => array( 0, 2 ),
932972 'leftsquare' => array( 0, 11 ),
 973+ 'leftcurly' => array( 0, 40 ),
933974 'string' => array( 0, 14 ),
934975 'int' => array( 0, 15 ),
935976 'float' => array( 0, 16 ),
@@ -939,13 +980,14 @@
940981 61 => array(
941982 'invert' => array( 0, 7 ),
942983 'sum' => array( 0, 6 ),
943 - 'id' => array( 0, 44 ),
 984+ 'id' => array( 0, 48 ),
944985 'isset' => array( 0, 12 ),
945986 'delete' => array( 0, 13 ),
946987 'break' => array( 0, 9 ),
947988 'continue' => array( 0, 10 ),
948989 'leftbracket' => array( 0, 2 ),
949990 'leftsquare' => array( 0, 11 ),
 991+ 'leftcurly' => array( 0, 40 ),
950992 'string' => array( 0, 14 ),
951993 'int' => array( 0, 15 ),
952994 'float' => array( 0, 16 ),
@@ -956,13 +998,14 @@
957999 62 => array(
9581000 'invert' => array( 0, 7 ),
9591001 'sum' => array( 0, 6 ),
960 - 'id' => array( 0, 44 ),
 1002+ 'id' => array( 0, 48 ),
9611003 'isset' => array( 0, 12 ),
9621004 'delete' => array( 0, 13 ),
9631005 'break' => array( 0, 9 ),
9641006 'continue' => array( 0, 10 ),
9651007 'leftbracket' => array( 0, 2 ),
9661008 'leftsquare' => array( 0, 11 ),
 1009+ 'leftcurly' => array( 0, 40 ),
9671010 'string' => array( 0, 14 ),
9681011 'int' => array( 0, 15 ),
9691012 'float' => array( 0, 16 ),
@@ -973,13 +1016,14 @@
9741017 63 => array(
9751018 'invert' => array( 0, 7 ),
9761019 'sum' => array( 0, 6 ),
977 - 'id' => array( 0, 44 ),
 1020+ 'id' => array( 0, 48 ),
9781021 'isset' => array( 0, 12 ),
9791022 'delete' => array( 0, 13 ),
9801023 'break' => array( 0, 9 ),
9811024 'continue' => array( 0, 10 ),
9821025 'leftbracket' => array( 0, 2 ),
9831026 'leftsquare' => array( 0, 11 ),
 1027+ 'leftcurly' => array( 0, 40 ),
9841028 'string' => array( 0, 14 ),
9851029 'int' => array( 0, 15 ),
9861030 'float' => array( 0, 16 ),
@@ -990,13 +1034,14 @@
9911035 64 => array(
9921036 'invert' => array( 0, 7 ),
9931037 'sum' => array( 0, 6 ),
994 - 'id' => array( 0, 44 ),
 1038+ 'id' => array( 0, 48 ),
9951039 'isset' => array( 0, 12 ),
9961040 'delete' => array( 0, 13 ),
9971041 'break' => array( 0, 9 ),
9981042 'continue' => array( 0, 10 ),
9991043 'leftbracket' => array( 0, 2 ),
10001044 'leftsquare' => array( 0, 11 ),
 1045+ 'leftcurly' => array( 0, 40 ),
10011046 'string' => array( 0, 14 ),
10021047 'int' => array( 0, 15 ),
10031048 'float' => array( 0, 16 ),
@@ -1007,13 +1052,14 @@
10081053 65 => array(
10091054 'invert' => array( 0, 7 ),
10101055 'sum' => array( 0, 6 ),
1011 - 'id' => array( 0, 44 ),
 1056+ 'id' => array( 0, 48 ),
10121057 'isset' => array( 0, 12 ),
10131058 'delete' => array( 0, 13 ),
10141059 'break' => array( 0, 9 ),
10151060 'continue' => array( 0, 10 ),
10161061 'leftbracket' => array( 0, 2 ),
10171062 'leftsquare' => array( 0, 11 ),
 1063+ 'leftcurly' => array( 0, 40 ),
10181064 'string' => array( 0, 14 ),
10191065 'int' => array( 0, 15 ),
10201066 'float' => array( 0, 16 ),
@@ -1024,13 +1070,14 @@
10251071 66 => array(
10261072 'invert' => array( 0, 7 ),
10271073 'sum' => array( 0, 6 ),
1028 - 'id' => array( 0, 44 ),
 1074+ 'id' => array( 0, 48 ),
10291075 'isset' => array( 0, 12 ),
10301076 'delete' => array( 0, 13 ),
10311077 'break' => array( 0, 9 ),
10321078 'continue' => array( 0, 10 ),
10331079 'leftbracket' => array( 0, 2 ),
10341080 'leftsquare' => array( 0, 11 ),
 1081+ 'leftcurly' => array( 0, 40 ),
10351082 'string' => array( 0, 14 ),
10361083 'int' => array( 0, 15 ),
10371084 'float' => array( 0, 16 ),
@@ -1040,13 +1087,14 @@
10411088 ),
10421089 67 => array(
10431090 'sum' => array( 0, 6 ),
1044 - 'id' => array( 0, 44 ),
 1091+ 'id' => array( 0, 48 ),
10451092 'isset' => array( 0, 12 ),
10461093 'delete' => array( 0, 13 ),
10471094 'break' => array( 0, 9 ),
10481095 'continue' => array( 0, 10 ),
10491096 'leftbracket' => array( 0, 2 ),
10501097 'leftsquare' => array( 0, 11 ),
 1098+ 'leftcurly' => array( 0, 40 ),
10511099 'string' => array( 0, 14 ),
10521100 'int' => array( 0, 15 ),
10531101 'float' => array( 0, 16 ),
@@ -1056,13 +1104,14 @@
10571105 ),
10581106 68 => array(
10591107 'sum' => array( 0, 6 ),
1060 - 'id' => array( 0, 44 ),
 1108+ 'id' => array( 0, 48 ),
10611109 'isset' => array( 0, 12 ),
10621110 'delete' => array( 0, 13 ),
10631111 'break' => array( 0, 9 ),
10641112 'continue' => array( 0, 10 ),
10651113 'leftbracket' => array( 0, 2 ),
10661114 'leftsquare' => array( 0, 11 ),
 1115+ 'leftcurly' => array( 0, 40 ),
10671116 'string' => array( 0, 14 ),
10681117 'int' => array( 0, 15 ),
10691118 'float' => array( 0, 16 ),
@@ -1071,12 +1120,15 @@
10721121 'null' => array( 0, 19 ),
10731122 ),
10741123 69 => array(
1075 - 'id' => array( 0, 72 ),
 1124+ 'id' => array( 0, 73 ),
10761125 ),
10771126 70 => array(
1078 - 'rightbracket' => array( 0, 97 ),
 1127+ 'rightbracket' => array( 0, 98 ),
10791128 ),
10801129 71 => array(
 1130+ 'colon' => array( 0, 78 ),
 1131+ ),
 1132+ 72 => array(
10811133 'in' => array( 1, 41 ),
10821134 'pow' => array( 1, 41 ),
10831135 'equalsto' => array( 1, 41 ),
@@ -1091,32 +1143,39 @@
10921144 'contains' => array( 1, 41 ),
10931145 'rightsquare' => array( 1, 41 ),
10941146 'comma' => array( 1, 41 ),
 1147+ 'rightcurly' => array( 1, 41 ),
10951148 ),
1096 - 72 => array(
1097 - 'in' => array( 1, 59 ),
1098 - 'rightbracket' => array( 1, 59 ),
1099 - 'setto' => array( 1, 59 ),
1100 - 'pow' => array( 1, 59 ),
1101 - 'equalsto' => array( 1, 59 ),
1102 - 'trinary' => array( 1, 59 ),
1103 - 'semicolon' => array( 1, 59 ),
1104 - 'colon' => array( 1, 59 ),
1105 - 'logicop' => array( 1, 59 ),
1106 - 'compareop' => array( 1, 59 ),
1107 - 'sum' => array( 1, 59 ),
1108 - 'mul' => array( 1, 59 ),
1109 - 'contains' => array( 1, 59 ),
1110 - 'rightsquare' => array( 1, 59 ),
1111 - 'comma' => array( 1, 59 ),
1112 - 'leftsquare' => array( 0, 49 ),
1113 - ),
11141149 73 => array(
1115 - 'in' => array( 0, 98 ),
 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 ),
11161167 ),
11171168 74 => array(
1118 - 'leftbracket' => array( 0, 99 ),
 1169+ 'in' => array( 0, 99 ),
11191170 ),
11201171 75 => array(
 1172+ 'in' => array( 1, 61 ),
 1173+ 'colon' => array( 0, 100 ),
 1174+ 'leftsquare' => array( 0, 58 ),
 1175+ ),
 1176+ 76 => array(
 1177+ 'leftbracket' => array( 0, 101 ),
 1178+ ),
 1179+ 77 => array(
11211180 '$' => array( 1, 8 ),
11221181 'if' => array( 1, 8 ),
11231182 'for' => array( 1, 8 ),
@@ -1141,70 +1200,7 @@
11421201 'catch' => array( 1, 8 ),
11431202 'rightcurly' => array( 1, 8 ),
11441203 ),
1145 - 76 => array(
1146 - 'in' => array( 1, 34 ),
1147 - 'pow' => array( 1, 34 ),
1148 - 'equalsto' => array( 1, 34 ),
1149 - 'trinary' => array( 1, 34 ),
1150 - 'semicolon' => array( 1, 34 ),
1151 - 'rightbracket' => array( 1, 34 ),
1152 - 'colon' => array( 1, 34 ),
1153 - 'logicop' => array( 1, 34 ),
1154 - 'compareop' => array( 1, 34 ),
1155 - 'sum' => array( 1, 34 ),
1156 - 'mul' => array( 1, 34 ),
1157 - 'contains' => array( 1, 34 ),
1158 - 'rightsquare' => array( 1, 34 ),
1159 - 'comma' => array( 1, 34 ),
1160 - ),
1161 - 77 => array(
1162 - 'rightbracket' => array( 1, 48 ),
1163 - 'rightsquare' => array( 1, 48 ),
1164 - 'comma' => array( 1, 48 ),
1165 - ),
11661204 78 => array(
1167 - 'rightbracket' => array( 0, 100 ),
1168 - 'comma' => array( 0, 83 ),
1169 - ),
1170 - 79 => array(
1171 - 'leftsquare' => array( 1, 63 ),
1172 - 'in' => array( 1, 63 ),
1173 - 'rightbracket' => array( 1, 63 ),
1174 - 'setto' => array( 1, 63 ),
1175 - 'pow' => array( 1, 63 ),
1176 - 'equalsto' => array( 1, 63 ),
1177 - 'trinary' => array( 1, 63 ),
1178 - 'semicolon' => array( 1, 63 ),
1179 - 'colon' => array( 1, 63 ),
1180 - 'logicop' => array( 1, 63 ),
1181 - 'compareop' => array( 1, 63 ),
1182 - 'sum' => array( 1, 63 ),
1183 - 'mul' => array( 1, 63 ),
1184 - 'contains' => array( 1, 63 ),
1185 - 'rightsquare' => array( 1, 63 ),
1186 - 'comma' => array( 1, 63 ),
1187 - ),
1188 - 80 => array(
1189 - 'rightsquare' => array( 0, 101 ),
1190 - ),
1191 - 81 => array(
1192 - 'in' => array( 1, 60 ),
1193 - 'rightbracket' => array( 1, 60 ),
1194 - 'setto' => array( 1, 60 ),
1195 - 'pow' => array( 1, 60 ),
1196 - 'equalsto' => array( 1, 60 ),
1197 - 'trinary' => array( 1, 60 ),
1198 - 'semicolon' => array( 1, 60 ),
1199 - 'colon' => array( 1, 60 ),
1200 - 'logicop' => array( 1, 60 ),
1201 - 'compareop' => array( 1, 60 ),
1202 - 'sum' => array( 1, 60 ),
1203 - 'mul' => array( 1, 60 ),
1204 - 'contains' => array( 1, 60 ),
1205 - 'rightsquare' => array( 1, 60 ),
1206 - 'comma' => array( 1, 60 ),
1207 - ),
1208 - 82 => array(
12091205 'id' => array( 0, 8 ),
12101206 'invert' => array( 0, 7 ),
12111207 'sum' => array( 0, 6 ),
@@ -1214,6 +1210,7 @@
12151211 'continue' => array( 0, 10 ),
12161212 'leftbracket' => array( 0, 2 ),
12171213 'leftsquare' => array( 0, 11 ),
 1214+ 'leftcurly' => array( 0, 40 ),
12181215 'string' => array( 0, 14 ),
12191216 'int' => array( 0, 15 ),
12201217 'float' => array( 0, 16 ),
@@ -1221,7 +1218,24 @@
12221219 'false' => array( 0, 18 ),
12231220 'null' => array( 0, 19 ),
12241221 ),
1225 - 83 => array(
 1222+ 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 ),
 1238+ ),
 1239+ 80 => array(
12261240 'id' => array( 0, 8 ),
12271241 'invert' => array( 0, 7 ),
12281242 'sum' => array( 0, 6 ),
@@ -1231,6 +1245,7 @@
12321246 'continue' => array( 0, 10 ),
12331247 'leftbracket' => array( 0, 2 ),
12341248 'leftsquare' => array( 0, 11 ),
 1249+ 'leftcurly' => array( 0, 40 ),
12351250 'string' => array( 0, 14 ),
12361251 'int' => array( 0, 15 ),
12371252 'float' => array( 0, 16 ),
@@ -1238,7 +1253,28 @@
12391254 'false' => array( 0, 18 ),
12401255 'null' => array( 0, 19 ),
12411256 ),
1242 - 84 => array(
 1257+ 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 ),
 1273+ ),
 1274+ 82 => array(
 1275+ 'rightbracket' => array( 0, 104 ),
 1276+ 'comma' => array( 0, 84 ),
 1277+ ),
 1278+ 83 => array(
12431279 'in' => array( 1, 42 ),
12441280 'pow' => array( 1, 42 ),
12451281 'equalsto' => array( 1, 42 ),
@@ -1253,8 +1289,9 @@
12541290 'contains' => array( 1, 42 ),
12551291 'rightsquare' => array( 1, 42 ),
12561292 'comma' => array( 1, 42 ),
 1293+ 'rightcurly' => array( 1, 42 ),
12571294 ),
1258 - 85 => array(
 1295+ 84 => array(
12591296 'id' => array( 0, 8 ),
12601297 'invert' => array( 0, 7 ),
12611298 'sum' => array( 0, 6 ),
@@ -1264,6 +1301,7 @@
12651302 'continue' => array( 0, 10 ),
12661303 'leftbracket' => array( 0, 2 ),
12671304 'leftsquare' => array( 0, 11 ),
 1305+ 'leftcurly' => array( 0, 40 ),
12681306 'string' => array( 0, 14 ),
12691307 'int' => array( 0, 15 ),
12701308 'float' => array( 0, 16 ),
@@ -1271,17 +1309,40 @@
12721310 'false' => array( 0, 18 ),
12731311 'null' => array( 0, 19 ),
12741312 ),
1275 - 86 => array(
 1313+ 85 => array(
12761314 'semicolon' => array( 1, 10 ),
12771315 'rightbracket' => array( 1, 10 ),
12781316 'rightsquare' => array( 1, 10 ),
12791317 'comma' => array( 1, 10 ),
12801318 'colon' => array( 1, 10 ),
 1319+ 'rightcurly' => array( 1, 10 ),
12811320 ),
 1321+ 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 ),
 1339+ ),
12821340 87 => array(
1283 - 'colon' => array( 0, 106 ),
 1341+ 'rightsquare' => array( 0, 106 ),
12841342 ),
12851343 88 => array(
 1344+ 'colon' => array( 0, 107 ),
 1345+ ),
 1346+ 89 => array(
12861347 'trinary' => array( 1, 14 ),
12871348 'semicolon' => array( 1, 14 ),
12881349 'rightbracket' => array( 1, 14 ),
@@ -1289,9 +1350,10 @@
12901351 'logicop' => array( 1, 14 ),
12911352 'rightsquare' => array( 1, 14 ),
12921353 'comma' => array( 1, 14 ),
 1354+ 'rightcurly' => array( 1, 14 ),
12931355 'compareop' => array( 0, 62 ),
12941356 ),
1295 - 89 => array(
 1357+ 90 => array(
12961358 'trinary' => array( 1, 16 ),
12971359 'semicolon' => array( 1, 16 ),
12981360 'rightbracket' => array( 1, 16 ),
@@ -1300,8 +1362,9 @@
13011363 'compareop' => array( 1, 16 ),
13021364 'rightsquare' => array( 1, 16 ),
13031365 'comma' => array( 1, 16 ),
 1366+ 'rightcurly' => array( 1, 16 ),
13041367 ),
1305 - 90 => array(
 1368+ 91 => array(
13061369 'trinary' => array( 1, 18 ),
13071370 'semicolon' => array( 1, 18 ),
13081371 'rightbracket' => array( 1, 18 ),
@@ -1310,9 +1373,10 @@
13111374 'compareop' => array( 1, 18 ),
13121375 'rightsquare' => array( 1, 18 ),
13131376 'comma' => array( 1, 18 ),
 1377+ 'rightcurly' => array( 1, 18 ),
13141378 'sum' => array( 0, 64 ),
13151379 ),
1316 - 91 => array(
 1380+ 92 => array(
13171381 'equalsto' => array( 1, 20 ),
13181382 'trinary' => array( 1, 20 ),
13191383 'semicolon' => array( 1, 20 ),
@@ -1323,9 +1387,10 @@
13241388 'sum' => array( 1, 20 ),
13251389 'rightsquare' => array( 1, 20 ),
13261390 'comma' => array( 1, 20 ),
 1391+ 'rightcurly' => array( 1, 20 ),
13271392 'mul' => array( 0, 65 ),
13281393 ),
1329 - 92 => array(
 1394+ 93 => array(
13301395 'equalsto' => array( 1, 22 ),
13311396 'trinary' => array( 1, 22 ),
13321397 'semicolon' => array( 1, 22 ),
@@ -1337,8 +1402,9 @@
13381403 'mul' => array( 1, 22 ),
13391404 'rightsquare' => array( 1, 22 ),
13401405 'comma' => array( 1, 22 ),
 1406+ 'rightcurly' => array( 1, 22 ),
13411407 ),
1342 - 93 => array(
 1408+ 94 => array(
13431409 'equalsto' => array( 1, 24 ),
13441410 'trinary' => array( 1, 24 ),
13451411 'semicolon' => array( 1, 24 ),
@@ -1350,8 +1416,9 @@
13511417 'mul' => array( 1, 24 ),
13521418 'rightsquare' => array( 1, 24 ),
13531419 'comma' => array( 1, 24 ),
 1420+ 'rightcurly' => array( 1, 24 ),
13541421 ),
1355 - 94 => array(
 1422+ 95 => array(
13561423 'pow' => array( 1, 28 ),
13571424 'equalsto' => array( 1, 28 ),
13581425 'trinary' => array( 1, 28 ),
@@ -1364,8 +1431,9 @@
13651432 'mul' => array( 1, 28 ),
13661433 'rightsquare' => array( 1, 28 ),
13671434 'comma' => array( 1, 28 ),
 1435+ 'rightcurly' => array( 1, 28 ),
13681436 ),
1369 - 95 => array(
 1437+ 96 => array(
13701438 'pow' => array( 1, 29 ),
13711439 'equalsto' => array( 1, 29 ),
13721440 'trinary' => array( 1, 29 ),
@@ -1378,11 +1446,13 @@
13791447 'mul' => array( 1, 29 ),
13801448 'rightsquare' => array( 1, 29 ),
13811449 'comma' => array( 1, 29 ),
 1450+ 'rightcurly' => array( 1, 29 ),
13821451 ),
1383 - 96 => array(
1384 - 'rightbracket' => array( 0, 107 ),
 1452+ 97 => array(
 1453+ 'rightbracket' => array( 0, 108 ),
 1454+ 'leftsquare' => array( 0, 58 ),
13851455 ),
1386 - 97 => array(
 1456+ 98 => array(
13871457 'if' => array( 0, 1 ),
13881458 'for' => array( 0, 3 ),
13891459 'try' => array( 0, 4 ),
@@ -1403,7 +1473,7 @@
14041474 'false' => array( 0, 18 ),
14051475 'null' => array( 0, 19 ),
14061476 ),
1407 - 98 => array(
 1477+ 99 => array(
14081478 'id' => array( 0, 8 ),
14091479 'invert' => array( 0, 7 ),
14101480 'sum' => array( 0, 6 ),
@@ -1413,6 +1483,7 @@
14141484 'continue' => array( 0, 10 ),
14151485 'leftbracket' => array( 0, 2 ),
14161486 'leftsquare' => array( 0, 11 ),
 1487+ 'leftcurly' => array( 0, 40 ),
14171488 'string' => array( 0, 14 ),
14181489 'int' => array( 0, 15 ),
14191490 'float' => array( 0, 16 ),
@@ -1420,10 +1491,21 @@
14211492 'false' => array( 0, 18 ),
14221493 'null' => array( 0, 19 ),
14231494 ),
1424 - 99 => array(
1425 - 'id' => array( 0, 72 ),
 1495+ 100 => array(
 1496+ 'id' => array( 0, 73 ),
14261497 ),
1427 - 100 => array(
 1498+ 101 => array(
 1499+ 'id' => array( 0, 73 ),
 1500+ ),
 1501+ 102 => array(
 1502+ 'rightcurly' => array( 1, 50 ),
 1503+ 'comma' => array( 1, 50 ),
 1504+ ),
 1505+ 103 => array(
 1506+ 'rightcurly' => array( 1, 48 ),
 1507+ 'comma' => array( 1, 48 ),
 1508+ ),
 1509+ 104 => array(
14281510 'in' => array( 1, 33 ),
14291511 'pow' => array( 1, 33 ),
14301512 'equalsto' => array( 1, 33 ),
@@ -1438,51 +1520,43 @@
14391521 'contains' => array( 1, 33 ),
14401522 'rightsquare' => array( 1, 33 ),
14411523 'comma' => array( 1, 33 ),
 1524+ 'rightcurly' => array( 1, 33 ),
14421525 ),
1443 - 101 => array(
1444 - 'leftsquare' => array( 1, 62 ),
1445 - 'in' => array( 1, 62 ),
1446 - 'rightbracket' => array( 1, 62 ),
1447 - 'setto' => array( 1, 62 ),
1448 - 'pow' => array( 1, 62 ),
1449 - 'equalsto' => array( 1, 62 ),
1450 - 'trinary' => array( 1, 62 ),
1451 - 'semicolon' => array( 1, 62 ),
1452 - 'colon' => array( 1, 62 ),
1453 - 'logicop' => array( 1, 62 ),
1454 - 'compareop' => array( 1, 62 ),
1455 - 'sum' => array( 1, 62 ),
1456 - 'mul' => array( 1, 62 ),
1457 - 'contains' => array( 1, 62 ),
1458 - 'rightsquare' => array( 1, 62 ),
1459 - 'comma' => array( 1, 62 ),
1460 - ),
1461 - 102 => array(
1462 - 'rightsquare' => array( 1, 51 ),
1463 - 'comma' => array( 1, 51 ),
1464 - ),
1465 - 103 => array(
1466 - 'rightbracket' => array( 1, 47 ),
1467 - 'rightsquare' => array( 1, 47 ),
1468 - 'comma' => array( 1, 47 ),
1469 - ),
1470 - 104 => array(
1471 - 'colon' => array( 0, 82 ),
1472 - ),
14731526 105 => array(
1474 - 'rightsquare' => array( 1, 49 ),
1475 - 'comma' => array( 1, 49 ),
 1527+ 'rightbracket' => array( 1, 46 ),
 1528+ 'rightsquare' => array( 1, 46 ),
 1529+ 'comma' => array( 1, 46 ),
14761530 ),
14771531 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(
14781551 'invert' => array( 0, 7 ),
14791552 'sum' => array( 0, 6 ),
1480 - 'id' => array( 0, 44 ),
 1553+ 'id' => array( 0, 48 ),
14811554 'isset' => array( 0, 12 ),
14821555 'delete' => array( 0, 13 ),
14831556 'break' => array( 0, 9 ),
14841557 'continue' => array( 0, 10 ),
14851558 'leftbracket' => array( 0, 2 ),
14861559 'leftsquare' => array( 0, 11 ),
 1560+ 'leftcurly' => array( 0, 40 ),
14871561 'string' => array( 0, 14 ),
14881562 'int' => array( 0, 15 ),
14891563 'float' => array( 0, 16 ),
@@ -1490,7 +1564,7 @@
14911565 'false' => array( 0, 18 ),
14921566 'null' => array( 0, 19 ),
14931567 ),
1494 - 107 => array(
 1568+ 108 => array(
14951569 'in' => array( 1, 35 ),
14961570 'pow' => array( 1, 35 ),
14971571 'equalsto' => array( 1, 35 ),
@@ -1505,8 +1579,9 @@
15061580 'contains' => array( 1, 35 ),
15071581 'rightsquare' => array( 1, 35 ),
15081582 'comma' => array( 1, 35 ),
 1583+ 'rightcurly' => array( 1, 35 ),
15091584 ),
1510 - 108 => array(
 1585+ 109 => array(
15111586 '$' => array( 1, 4 ),
15121587 'if' => array( 1, 4 ),
15131588 'for' => array( 1, 4 ),
@@ -1527,24 +1602,30 @@
15281603 'true' => array( 1, 4 ),
15291604 'false' => array( 1, 4 ),
15301605 'null' => array( 1, 4 ),
1531 - 'else' => array( 0, 112 ),
 1606+ 'else' => array( 0, 114 ),
15321607 'catch' => array( 1, 4 ),
15331608 'rightcurly' => array( 1, 4 ),
15341609 ),
1535 - 109 => array(
1536 - 'rightbracket' => array( 0, 113 ),
1537 - ),
15381610 110 => array(
1539 - 'rightbracket' => array( 0, 114 ),
 1611+ 'rightbracket' => array( 0, 115 ),
15401612 ),
15411613 111 => array(
 1614+ 'in' => array( 1, 62 ),
 1615+ 'leftsquare' => array( 0, 58 ),
 1616+ ),
 1617+ 112 => array(
 1618+ 'rightbracket' => array( 0, 116 ),
 1619+ 'leftsquare' => array( 0, 58 ),
 1620+ ),
 1621+ 113 => array(
15421622 'semicolon' => array( 1, 12 ),
15431623 'rightbracket' => array( 1, 12 ),
15441624 'colon' => array( 1, 12 ),
15451625 'rightsquare' => array( 1, 12 ),
15461626 'comma' => array( 1, 12 ),
 1627+ 'rightcurly' => array( 1, 12 ),
15471628 ),
1548 - 112 => array(
 1629+ 114 => array(
15491630 'if' => array( 0, 1 ),
15501631 'for' => array( 0, 3 ),
15511632 'try' => array( 0, 4 ),
@@ -1565,7 +1646,7 @@
15661647 'false' => array( 0, 18 ),
15671648 'null' => array( 0, 19 ),
15681649 ),
1569 - 113 => array(
 1650+ 115 => array(
15701651 'if' => array( 0, 1 ),
15711652 'for' => array( 0, 3 ),
15721653 'try' => array( 0, 4 ),
@@ -1586,7 +1667,7 @@
15871668 'false' => array( 0, 18 ),
15881669 'null' => array( 0, 19 ),
15891670 ),
1590 - 114 => array(
 1671+ 116 => array(
15911672 'if' => array( 0, 1 ),
15921673 'for' => array( 0, 3 ),
15931674 'try' => array( 0, 4 ),
@@ -1607,7 +1688,7 @@
16081689 'false' => array( 0, 18 ),
16091690 'null' => array( 0, 19 ),
16101691 ),
1611 - 115 => array(
 1692+ 117 => array(
16121693 '$' => array( 1, 5 ),
16131694 'if' => array( 1, 5 ),
16141695 'for' => array( 1, 5 ),
@@ -1632,7 +1713,7 @@
16331714 'catch' => array( 1, 5 ),
16341715 'rightcurly' => array( 1, 5 ),
16351716 ),
1636 - 116 => array(
 1717+ 118 => array(
16371718 '$' => array( 1, 6 ),
16381719 'if' => array( 1, 6 ),
16391720 'for' => array( 1, 6 ),
@@ -1657,7 +1738,7 @@
16581739 'catch' => array( 1, 6 ),
16591740 'rightcurly' => array( 1, 6 ),
16601741 ),
1661 - 117 => array(
 1742+ 119 => array(
16621743 '$' => array( 1, 7 ),
16631744 'if' => array( 1, 7 ),
16641745 'for' => array( 1, 7 ),
@@ -1685,18 +1766,18 @@
16861767 );
16871768
16881769 static $goto = array(
1689 - 0 => array( 1 => 20, 2 => 21, 3 => 22, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
 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 ),
16901771 1 => array(),
1691 - 2 => array( 3 => 40, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
 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 ),
16921773 3 => array(),
1693 - 4 => array( 2 => 42, 3 => 22, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1694 - 5 => array( 1 => 43, 2 => 21, 3 => 22, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1695 - 6 => array( 16 => 46, 18 => 36, 19 => 37, 4 => 45, 20 => 38 ),
1696 - 7 => array( 14 => 47, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 4 => 45, 20 => 38 ),
1697 - 8 => array( 24 => 50, 25 => 51 ),
 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 ),
 1778+ 8 => array(),
16981779 9 => array(),
16991780 10 => array(),
1700 - 11 => array( 21 => 54, 22 => 55, 17 => 53, 23 => 56, 3 => 52, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
 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 ),
17011782 12 => array(),
17021783 13 => array(),
17031784 14 => array(),
@@ -1705,10 +1786,10 @@
17061787 17 => array(),
17071788 18 => array(),
17081789 19 => array(),
1709 - 20 => array( 2 => 57, 3 => 22, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
 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 ),
17101791 21 => array(),
17111792 22 => array(),
1712 - 23 => array(),
 1793+ 23 => array( 24 => 59 ),
17131794 24 => array(),
17141795 25 => array(),
17151796 26 => array(),
@@ -1724,53 +1805,53 @@
17251806 36 => array(),
17261807 37 => array(),
17271808 38 => array(),
1728 - 39 => array( 3 => 70, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1729 - 40 => array(),
1730 - 41 => array( 4 => 73 ),
1731 - 42 => array(),
1732 - 43 => array( 2 => 57, 3 => 22, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1733 - 44 => array( 24 => 50, 25 => 51 ),
 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 ),
 1811+ 41 => array(),
 1812+ 42 => array( 4 => 74, 5 => 75 ),
 1813+ 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 ),
17341815 45 => array(),
17351816 46 => array(),
17361817 47 => array(),
1737 - 48 => array( 17 => 78, 3 => 77, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1738 - 49 => array( 3 => 80, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
 1818+ 48 => array(),
 1819+ 49 => array( 24 => 59 ),
17391820 50 => array(),
1740 - 51 => array( 24 => 81, 25 => 51 ),
1741 - 52 => array(),
 1821+ 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 ),
17421823 53 => array(),
17431824 54 => array(),
17441825 55 => array(),
17451826 56 => array(),
1746 - 57 => array(),
1747 - 58 => array(),
1748 - 59 => array( 5 => 86, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1749 - 60 => array( 6 => 87, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 4 => 45, 20 => 38 ),
1750 - 61 => array( 8 => 88, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 4 => 45, 20 => 38 ),
1751 - 62 => array( 9 => 89, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 4 => 45, 20 => 38 ),
1752 - 63 => array( 10 => 90, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 4 => 45, 20 => 38 ),
1753 - 64 => array( 11 => 91, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 4 => 45, 20 => 38 ),
1754 - 65 => array( 12 => 92, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 4 => 45, 20 => 38 ),
1755 - 66 => array( 12 => 93, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 4 => 45, 20 => 38 ),
1756 - 67 => array( 15 => 94, 16 => 35, 18 => 36, 19 => 37, 4 => 45, 20 => 38 ),
1757 - 68 => array( 15 => 95, 16 => 35, 18 => 36, 19 => 37, 4 => 45, 20 => 38 ),
1758 - 69 => array( 4 => 96 ),
 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 ),
17591840 70 => array(),
17601841 71 => array(),
1761 - 72 => array( 24 => 50, 25 => 51 ),
 1842+ 72 => array(),
17621843 73 => array(),
17631844 74 => array(),
1764 - 75 => array(),
 1845+ 75 => array( 24 => 59 ),
17651846 76 => array(),
17661847 77 => array(),
1767 - 78 => 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 ),
17681849 79 => array(),
1769 - 80 => 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 ),
17701851 81 => array(),
1771 - 82 => array( 3 => 102, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1772 - 83 => array( 3 => 103, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1773 - 84 => array(),
1774 - 85 => array( 23 => 105, 3 => 104, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
 1852+ 82 => array(),
 1853+ 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(),
17751856 86 => array(),
17761857 87 => array(),
17771858 88 => array(),
@@ -1782,27 +1863,29 @@
17831864 94 => array(),
17841865 95 => array(),
17851866 96 => array(),
1786 - 97 => array( 2 => 108, 3 => 22, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1787 - 98 => array( 3 => 109, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1788 - 99 => array( 4 => 110 ),
1789 - 100 => array(),
1790 - 101 => 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 ),
17911872 102 => array(),
17921873 103 => array(),
17931874 104 => array(),
17941875 105 => array(),
1795 - 106 => array( 6 => 111, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 4 => 45, 20 => 38 ),
1796 - 107 => 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 ),
17971878 108 => array(),
17981879 109 => array(),
17991880 110 => array(),
1800 - 111 => array(),
1801 - 112 => array( 2 => 115, 3 => 22, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1802 - 113 => array( 2 => 116, 3 => 22, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1803 - 114 => array( 2 => 117, 3 => 22, 5 => 24, 4 => 23, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 18 => 36, 19 => 37, 20 => 38 ),
1804 - 115 => array(),
1805 - 116 => array(),
 1881+ 111 => array( 24 => 59 ),
 1882+ 112 => array( 24 => 59 ),
 1883+ 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 ),
18061887 117 => array(),
 1888+ 118 => array(),
 1889+ 119 => array(),
18071890 );
18081891
18091892 }
Index: trunk/extensions/InlineScripts/interpreter/Shared.php
@@ -5,6 +5,9 @@
66 * inline scripts interpreter.
77 */
88
 9+/**
 10+ * This class represents a terminal of the script grammar.
 11+ */
912 class ISToken {
1013 // Constant values should match ones in syntax.txt
1114 const TEnd = '$';
@@ -60,6 +63,9 @@
6164 }
6265 }
6366
 67+/**
 68+ * This class represents a non-terminal of the script grammar.
 69+ */
6470 class ISParserTreeNode {
6571 var $mType, $mChildren;
6672
@@ -68,14 +74,17 @@
6975 }
7076
7177 public function addChild( $node ) {
 78+ // Since we do not want a long chain of "exprSomething -> exprWhatever" in the parser tree,
 79+ // we cut it out at the parsing stage
7280 if( $node instanceof ISParserTreeNode ) {
73 - $children = $node->getChildren();
 81+ $children = $node->getChildren();
7482 if( count( $children ) == 1 && strpos( $node->mType, "expr" ) === 0
7583 && strpos( @$children[0]->mType, "expr" ) === 0 ) {
7684 $this->mChildren[] = $children[0];
7785 return;
7886 }
7987 }
 88+
8089 $this->mChildren[] = $node;
8190 }
8291
@@ -150,7 +159,7 @@
151160 global $wgInlineScriptsParserClass;
152161 $this->mTree = $tree;
153162 $this->mTokensCount = $tokens;
154 - $this->mVersion = constant( "$wgInlineScriptsParserClass::Version" );
 163+ $this->mVersion = $wgInlineScriptsParserClass::getVersion();
155164 }
156165
157166 public function getParserTree() {
@@ -159,7 +168,7 @@
160169
161170 public function isOutOfDate() {
162171 global $wgInlineScriptsParserClass;
163 - return constant( "$wgInlineScriptsParserClass::Version" ) > $this->mVersion;
 172+ return $wgInlineScriptsParserClass::getVersion() > $this->mVersion;
164173 }
165174
166175 public function appendTokenCount( &$interpr ) {
@@ -169,3 +178,6 @@
170179 throw new ISUserVisibleException( 'toomanytokens', 0 );
171180 }
172181 }
 182+
 183+// Used by ISEvaluationContext::setVar
 184+class ISPlaceholder {}
Index: trunk/extensions/InlineScripts/interpreter/buildLRTables.php
@@ -61,9 +61,12 @@
6262 if( !$line )
6363 continue;
6464
65 - list( $name, $vals ) = self::parseLine( $g, $line, $i );
66 - foreach( $vals as $val )
67 - $g->addProduction( $name, $val );
 65+ $namevalpailr = self::parseLine( $g, $line, $i );
 66+ if( $namevalpailr ) {
 67+ list( $name, $vals ) = $namevalpailr;
 68+ foreach( $vals as $val )
 69+ $g->addProduction( $name, $val );
 70+ }
6871 }
6972 foreach( $g->mProductions as $prod ) {
7073 list( $ntid, $prod ) = $prod;
@@ -81,6 +84,8 @@
8285 wfSuppressWarnings(); // @ doesn't help to supress "uninitialized string offset" warning
8386
8487 self::skipWhitespace( $line, $i );
 88+ if( $line[$i] == '#' )
 89+ return null;
8590 if( $line[$i] != '<' )
8691 die( "Invalid BNF at line $lnum" );
8792 $i++;
@@ -486,7 +491,9 @@
487492
488493 class ISLRTable {
489494
 495+const Timestamp = '{$date}';
490496
 497+
491498 ENDOFHEADER;
492499
493500 $s .= "static \$nonterminals = array(\n";
Index: trunk/extensions/InlineScripts/interpreterTests.txt
@@ -377,3 +377,33 @@
378378 <p>2
379379 </p>
380380 !! end
 381+
 382+!! test
 383+Associated arrays: basics
 384+!! input
 385+<wikiscript>
 386+a = { "a" : 2, "b" : 13 };
 387+a["c"] = 21;
 388+
 389+for( k : v in a ) {
 390+ out( k + " = " + v + "\n\n" );
 391+}
 392+</wikiscript>
 393+!! result
 394+<p>a = 2
 395+</p><p>b = 13
 396+</p><p>c = 21
 397+</p>
 398+!! end
 399+
 400+!! test
 401+Mixed arrays
 402+!! input
 403+<wikiscript>
 404+a["b"][][0][]["c"] = 11;
 405+out( a["b"][0][0][0]["c"] );
 406+</wikiscript>
 407+!! result
 408+<p>11
 409+</p>
 410+!! end
Index: trunk/extensions/InlineScripts/InlineScripts.i18n.php
@@ -12,7 +12,7 @@
1313 * @author Victor Vasiliev
1414 */
1515 $messages['en'] = array(
16 - 'inlinescripts-desc' => 'Provides a build into wikitext scripting language',
 16+ 'inlinescriprs-desc' => 'Provides a build into wikitext scripting language',
1717
1818 'inlinescripts-exception-unexceptedtoken' => 'Unexpected token $1 at line $2: expected $3',
1919 'inlinescripts-exception-unclosedstring' => 'Unclosed string at char $1',
@@ -20,7 +20,7 @@
2121 'inlinescripts-exception-toomanytokens' => 'Exceeded tokens limit',
2222 'inlinescripts-exception-toomanyevals' => 'Exceeded evaluations limit',
2323 'inlinescripts-exception-recoverflow' => 'Too deep abstract syntax tree',
24 - 'inlinescripts-exception-notanarray' => 'Tried to get an element of a non-array at line $1',
 24+ 'inlinescripts-exception-notanarray' => 'Tried to get or set an element of a non-array at line $1',
2525 'inlinescripts-exception-outofbounds' => 'Got out of array bounds at line $1',
2626 'inlinescripts-exception-notenoughargs' => 'Not enough arguments for function at line $1',
2727 'inlinescripts-exception-dividebyzero' => 'Division by zero at line $1',
@@ -29,6 +29,7 @@
3030 'inlinescripts-exception-emptyidx' => 'Trying to get a value of an empty index at line $1',
3131 'inlinescripts-exception-unknownvar' => 'Trying to use an undeclared variable at line $1',
3232 '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',
3334 );
3435
3536 // == Magic words ==
Index: trunk/extensions/InlineScripts/InlineScripts.php
@@ -33,7 +33,7 @@
3434
3535 $dir = dirname(__FILE__) . '/';
3636 $wgExtensionMessagesFiles['InlineScripts'] = $dir . 'InlineScripts.i18n.php';
37 -$wgAutoloadClasses['InlineScriptInterpreter'] = $dir . 'interpreter/Interpreter.php';
 37+$wgAutoloadClasses['ISInterpreter'] = $dir . 'interpreter/Interpreter.php';
3838 $wgAutoloadClasses['ISScanner'] = $dir . 'interpreter/Scanner.php';
3939 $wgAutoloadClasses['ISLRParser'] = $dir . 'interpreter/LRParser.php';
4040 $wgParserTestFiles[] = $dir . 'interpreterTests.txt';
@@ -61,6 +61,7 @@
6262 );
6363
6464 $wgInlineScriptsParserClass = 'ISLRParser';
 65+$wgInlineScriptsUseCache = false;
6566
6667 class InlineScriptsHooks {
6768 static $scriptParser = null;
@@ -128,7 +129,9 @@
129130 return "<strong class=\"error\">{$msg}</strong>";
130131 }
131132 if( !(isset( $attribs['noparse'] ) && $attribs['noparse']) ) {
 133+ wfProfileIn( __METHOD__ . '-replacevars' );
132134 $result = $parser->replaceVariables( $result, $frame );
 135+ wfProfileOut( __METHOD__ . '-replacevars' );
133136 }
134137 wfProfileOut( __METHOD__ );
135138 return trim( $result );
@@ -156,7 +159,7 @@
157160 */
158161 public static function getInterpreter() {
159162 if( !self::$scriptParser ) {
160 - self::$scriptParser = new InlineScriptInterpreter();
 163+ self::$scriptParser = new ISInterpreter();
161164 }
162165 return self::$scriptParser;
163166 }

Status & tagging log