@@ -310,6 +310,7 @@ protected function parseJsonMethod($method)
310310 {
311311 if ($ method ->type === 'variable ' && ($ function = $ this ->jsonMethodToPhpFunction ($ method ->value ))) {
312312 $ this ->skip (2 );
313+
313314 if (($ next = $ this ->get (0 )) && $ next ->is ('( ' )) {
314315 $ this ->skip ();
315316
@@ -370,6 +371,7 @@ protected function parseKeywordStatement($token)
370371 {
371372 $ name = $ token ->value ;
372373 $ keyword = new Block ($ name );
374+
373375 switch ($ name ) {
374376 case 'typeof ' :
375377 throw new Exception ('typeof keyword not supported ' , 26 );
@@ -384,9 +386,11 @@ protected function parseKeywordStatement($token)
384386 'clone ' => 'Object ' ,
385387 ];
386388 $ value = $ this ->get (0 );
389+
387390 if (isset ($ expects [$ name ]) && !$ value ) {
388391 throw new Exception ($ expects [$ name ] . " expected after ' " . $ name . "' " , 25 );
389392 }
393+
390394 $ this ->handleOptionalValue ($ keyword , $ value , $ name );
391395 break ;
392396 case 'case ' :
@@ -407,6 +411,7 @@ protected function parseKeywordStatement($token)
407411 protected function parseKeyword ($ token )
408412 {
409413 $ keyword = $ this ->parseKeywordStatement ($ token );
414+
410415 if ($ keyword ->handleInstructions ()) {
411416 $ this ->parseBlock ($ keyword );
412417 }
@@ -417,6 +422,7 @@ protected function parseKeyword($token)
417422 protected function parseLet ()
418423 {
419424 $ letVariable = $ this ->get (0 );
425+
420426 if ($ letVariable ->type !== 'variable ' ) {
421427 throw $ this ->unexpected ($ letVariable );
422428 }
@@ -486,15 +492,19 @@ protected function parseInstructions($block)
486492 public function parseBlock ($ block )
487493 {
488494 $ this ->stack [] = $ block ;
495+
489496 if (!$ block ->multipleInstructions ) {
490497 $ next = $ this ->get (0 );
498+
491499 if ($ next && $ next ->is ('{ ' )) {
492500 $ block ->enableMultipleInstructions ();
493501 }
502+
494503 if ($ block ->multipleInstructions ) {
495504 $ this ->skip ();
496505 }
497506 }
507+
498508 $ this ->parseInstructions ($ block );
499509 array_pop ($ this ->stack );
500510 }
0 commit comments