@@ -62,15 +62,6 @@ protected function parseLambda(Value $parameters)
6262 return $ lambda ;
6363 }
6464
65- protected function parseValueCompletion (&$ base , $ token )
66- {
67- if ($ token && $ token ->is ('? ' )) {
68- $ base = $ this ->parseTernary ($ base );
69- }
70-
71- $ this ->appendFunctionsCalls ($ base );
72- }
73-
7465 protected function parseParentheses ()
7566 {
7667 $ parentheses = new Parenthesis ();
@@ -291,9 +282,10 @@ protected function parseValue($token)
291282 : new Constant ($ token ->type , $ token ->value );
292283 }
293284
294- protected function parseFunction ($ token )
285+ protected function parseFunction ()
295286 {
296287 $ function = new Block ('function ' );
288+ $ function ->enableMultipleInstructions ();
297289 $ token = $ this ->get (0 );
298290 if ($ token && $ token ->type === 'variable ' ) {
299291 $ this ->skip ();
@@ -313,7 +305,6 @@ protected function parseFunction($token)
313305
314306 $ this ->skip ();
315307 $ this ->parseBlock ($ function );
316- $ this ->skip ();
317308
318309 return $ function ;
319310 }
@@ -367,9 +358,8 @@ protected function parseLet()
367358
368359 protected function parseInstructions ($ block )
369360 {
370- $ endToken = $ this ->getEndTokenFromBlock ($ block );
371361 while ($ token = $ this ->next ()) {
372- if ($ token ->is ($ endToken )) {
362+ if ($ token ->is ($ block -> multipleInstructions ? ' } ' : ' ; ' )) {
373363 break ;
374364 }
375365
@@ -391,16 +381,13 @@ protected function parseInstructions($block)
391381 continue ;
392382 }
393383
394- if ($ token ->isIn ('? ' , '( ' , '[ ' ) || $ token ->isOperator ()) {
395- $ value = $ block ->value ;
396- $ this ->parseValueCompletion ($ value , $ token );
397- $ block ->addInstruction ($ value );
398-
399- continue ;
400- }
401384
402385 if ($ token ->is ('; ' ) || !$ this ->engine ->getOption ('strict ' )) {
403386 $ block ->endInstruction ();
387+ // $next = $this->get(0);
388+ // if ($block->type !== 'function' && $next && $next->is('}')) {
389+ // break;
390+ // }
404391
405392 continue ;
406393 }
@@ -412,11 +399,6 @@ protected function parseInstructions($block)
412399 public function parseBlock ($ block )
413400 {
414401 $ this ->stack [] = $ block ;
415- $ next = $ this ->get (0 );
416- if ($ next && $ next ->is ('( ' ) && !($ block instanceof Main)) {
417- $ this ->skip ();
418- $ block ->setValue ($ this ->parseParentheses ());
419- }
420402 if (!$ block ->multipleInstructions ) {
421403 $ next = $ this ->get (0 );
422404 if ($ next && $ next ->is ('{ ' )) {
0 commit comments