doParse() public method

The first argument is the major token number. The second is the token value string as scanned from the input.
public doParse ( integer $yymajor, mixed $yytokenvalue ) : void
$yymajor integer the token number
$yytokenvalue mixed the token value
return void
コード例 #1
0
 static function init($template, $compiler, $file = '')
 {
     $lexer = new Haanga_Compiler_Lexer($template, $compiler);
     $parser = new Haanga_Compiler_Parser($lexer, $file);
     $parser->compiler = $compiler;
     try {
         for ($i = 0;; $i++) {
             if (!$lexer->yylex()) {
                 break;
             }
             $parser->doParse($lexer->token, $lexer->value);
         }
     } catch (Exception $e) {
         throw new Haanga_Compiler_Exception($e->getMessage() . ' on line ' . $lexer->getLine());
     }
     $parser->doParse(0, 0);
     return (array) $parser->body;
 }
コード例 #2
0
ファイル: Tokenizer.php プロジェクト: GallardoAlba/Meneame
 static function init($template, $compiler, $file = '')
 {
     $lexer = new Haanga_Compiler_Tokenizer($template, $compiler, $file);
     $parser = new Haanga_Compiler_Parser($lexer, $file);
     $parser->compiler = $compiler;
     try {
         for ($i = 0;; $i++) {
             if (!$lexer->yylex()) {
                 break;
             }
             $parser->doParse($lexer->token, $lexer->value);
         }
     } catch (Exception $e) {
         /* destroy the parser */
         try {
             $parser->doParse(0, 0);
         } catch (Exception $y) {
         }
         throw $e;
         /* re-throw exception */
     }
     $parser->doParse(0, 0);
     return (array) $parser->body;
 }