Exemplo n.º 1
0
 function parse(TokenStream $ts)
 {
     try {
         $index = $ts->index();
         $result = $this->parser($ts, ...$this->stack);
     } catch (Halt $e) {
         $ts->jump($index);
         throw $e;
     }
     if ($result instanceof Ast) {
         if (null !== $this->onCommit) {
             ($this->onCommit)($result);
         }
     } else {
         $ts->jump($index);
     }
     return $result;
 }