1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-26 20:04:48 +01:00

Do not distribute debug parser anymore

The debug parser (and the debug y.output) can be still built using rebuildParser.php?debug.
This commit is contained in:
nikic 2011-11-27 13:22:29 +01:00
parent b1745ca280
commit 3a4cc1a0f0
4 changed files with 15 additions and 20930 deletions

View File

@ -24,4 +24,7 @@ Building the parser
===================
In order to rebuild the parser, you need [moriyoshi's fork of kmyacc](https://github.com/moriyoshi/kmyacc-forked).
After you compiled/installed it, run the `rebuildParser.php` file.
After you compiled/installed it, run the `rebuildParser.php` file.
By default only the Parser.php is built. If you want to build the Parser/Debug.php and the y.output
file you need to call the file with the debug option: `rebuildParser.php?debug`.

View File

@ -36,17 +36,23 @@ $grammarCode = resolveArrays($grammarCode);
file_put_contents(TMP_FILE, $grammarCode);
echo 'Building parser. Output: "',
echo 'Building parser. Output: "',
trim(shell_exec('kmyacc -l -m kmyacc.php.parser -p PHPParser_Parser ' . TMP_FILE . ' 2>&1')),
'"', "\n";
rename(RESULT_FILE, '../lib/PHPParser/Parser.php');
echo 'Building debug parser. Output: "',
trim(shell_exec('kmyacc -t -l -m kmyacc.php.parser -p PHPParser_Parser ' . TMP_FILE . ' 2>&1')),
'"', "\n";
if (isset($_GET['debug'])) {
echo 'Building debug parser. Output: "',
trim(shell_exec('kmyacc -t -v -l -m kmyacc.php.parser -p PHPParser_Parser ' . TMP_FILE . ' 2>&1')),
'"', "\n";
if (!is_dir('../lib/PHPParser/Parser')) {
mkdir('../lib/PHPParser/Parser');
}
rename(RESULT_FILE, '../lib/PHPParser/Parser/Debug.php');
}
rename(RESULT_FILE, '../lib/PHPParser/Parser/Debug.php');
unlink(TMP_FILE);

File diff suppressed because it is too large Load Diff

View File

@ -1,547 +0,0 @@
<?php
/* Prototype file of an object oriented PHP parser.
* Written by Moriyoshi Koizumi, based on the work by Masato Bito.
* This file is PUBLIC DOMAIN.
*/
class PHPParser_Parser_Debug extends PHPParser_Parser
{
protected static $yyproduction = array(
"start : start",
"start : top_statement_list",
"top_statement_list : top_statement_list top_statement",
"top_statement_list : /* empty */",
"namespace_name : T_STRING",
"namespace_name : namespace_name T_NS_SEPARATOR T_STRING",
"top_statement : statement",
"top_statement : function_declaration_statement",
"top_statement : class_declaration_statement",
"top_statement : T_HALT_COMPILER",
"top_statement : T_NAMESPACE namespace_name ';'",
"top_statement : T_NAMESPACE namespace_name '{' top_statement_list '}'",
"top_statement : T_NAMESPACE '{' top_statement_list '}'",
"top_statement : T_USE use_declarations ';'",
"top_statement : T_CONST constant_declaration_list ';'",
"use_declarations : use_declarations ',' use_declaration",
"use_declarations : use_declaration",
"use_declaration : namespace_name",
"use_declaration : namespace_name T_AS T_STRING",
"use_declaration : T_NS_SEPARATOR namespace_name",
"use_declaration : T_NS_SEPARATOR namespace_name T_AS T_STRING",
"constant_declaration_list : constant_declaration_list ',' constant_declaration",
"constant_declaration_list : constant_declaration",
"constant_declaration : T_STRING '=' static_scalar",
"inner_statement_list : inner_statement_list inner_statement",
"inner_statement_list : /* empty */",
"inner_statement : statement",
"inner_statement : function_declaration_statement",
"inner_statement : class_declaration_statement",
"inner_statement : T_HALT_COMPILER",
"statement : '{' inner_statement_list '}'",
"statement : T_IF '(' expr ')' statement elseif_list else_single",
"statement : T_IF '(' expr ')' ':' inner_statement_list new_elseif_list new_else_single T_ENDIF ';'",
"statement : T_WHILE '(' expr ')' while_statement",
"statement : T_DO statement T_WHILE '(' expr ')' ';'",
"statement : T_FOR '(' for_expr ';' for_expr ';' for_expr ')' for_statement",
"statement : T_SWITCH '(' expr ')' switch_case_list",
"statement : T_BREAK ';'",
"statement : T_BREAK expr ';'",
"statement : T_CONTINUE ';'",
"statement : T_CONTINUE expr ';'",
"statement : T_RETURN ';'",
"statement : T_RETURN expr ';'",
"statement : T_GLOBAL global_var_list ';'",
"statement : T_STATIC static_var_list ';'",
"statement : T_ECHO expr_list ';'",
"statement : T_INLINE_HTML",
"statement : expr ';'",
"statement : T_UNSET '(' variables_list ')' ';'",
"statement : T_FOREACH '(' expr T_AS variable ')' foreach_statement",
"statement : T_FOREACH '(' expr T_AS '&' variable ')' foreach_statement",
"statement : T_FOREACH '(' expr T_AS variable T_DOUBLE_ARROW optional_ref variable ')' foreach_statement",
"statement : T_DECLARE '(' declare_list ')' declare_statement",
"statement : ';'",
"statement : T_TRY '{' inner_statement_list '}' catches",
"statement : T_THROW expr ';'",
"statement : T_GOTO T_STRING ';'",
"statement : T_STRING ':'",
"catches : catch",
"catches : catches catch",
"catch : T_CATCH '(' name T_VARIABLE ')' '{' inner_statement_list '}'",
"variables_list : variable",
"variables_list : variables_list ',' variable",
"optional_ref : /* empty */",
"optional_ref : '&'",
"function_declaration_statement : T_FUNCTION optional_ref T_STRING '(' parameter_list ')' '{' inner_statement_list '}'",
"class_declaration_statement : class_entry_type T_STRING extends_from implements_list '{' class_statement_list '}'",
"class_declaration_statement : T_INTERFACE T_STRING interface_extends_list '{' class_statement_list '}'",
"class_declaration_statement : T_TRAIT T_STRING '{' class_statement_list '}'",
"class_entry_type : T_CLASS",
"class_entry_type : T_ABSTRACT T_CLASS",
"class_entry_type : T_FINAL T_CLASS",
"extends_from : /* empty */",
"extends_from : T_EXTENDS name",
"interface_extends_list : /* empty */",
"interface_extends_list : T_EXTENDS name_list",
"implements_list : /* empty */",
"implements_list : T_IMPLEMENTS name_list",
"name_list : name",
"name_list : name_list ',' name",
"for_statement : statement",
"for_statement : ':' inner_statement_list T_ENDFOR ';'",
"foreach_statement : statement",
"foreach_statement : ':' inner_statement_list T_ENDFOREACH ';'",
"declare_statement : statement",
"declare_statement : ':' inner_statement_list T_ENDDECLARE ';'",
"declare_list : T_STRING '=' static_scalar",
"declare_list : declare_list ',' T_STRING '=' static_scalar",
"switch_case_list : '{' case_list '}'",
"switch_case_list : '{' ';' case_list '}'",
"switch_case_list : ':' case_list T_ENDSWITCH ';'",
"switch_case_list : ':' ';' case_list T_ENDSWITCH ';'",
"case_list : /* empty */",
"case_list : case_list T_CASE expr case_separator inner_statement_list",
"case_list : case_list T_DEFAULT case_separator inner_statement_list",
"case_separator : ':'",
"case_separator : ';'",
"while_statement : statement",
"while_statement : ':' inner_statement_list T_ENDWHILE ';'",
"elseif_list : /* empty */",
"elseif_list : elseif_list T_ELSEIF '(' expr ')' statement",
"new_elseif_list : /* empty */",
"new_elseif_list : new_elseif_list T_ELSEIF '(' expr ')' ':' inner_statement_list",
"else_single : /* empty */",
"else_single : T_ELSE statement",
"new_else_single : /* empty */",
"new_else_single : T_ELSE ':' inner_statement_list",
"parameter_list : non_empty_parameter_list",
"parameter_list : /* empty */",
"non_empty_parameter_list : optional_class_type optional_ref T_VARIABLE",
"non_empty_parameter_list : optional_class_type optional_ref T_VARIABLE '=' static_scalar",
"non_empty_parameter_list : non_empty_parameter_list ',' optional_class_type optional_ref T_VARIABLE",
"non_empty_parameter_list : non_empty_parameter_list ',' optional_class_type optional_ref T_VARIABLE '=' static_scalar",
"optional_class_type : /* empty */",
"optional_class_type : name",
"optional_class_type : T_ARRAY",
"optional_class_type : T_CALLABLE",
"function_call_argument_list : non_empty_function_call_argument_list",
"function_call_argument_list : /* empty */",
"non_empty_function_call_argument_list : expr",
"non_empty_function_call_argument_list : '&' variable",
"non_empty_function_call_argument_list : non_empty_function_call_argument_list ',' expr",
"non_empty_function_call_argument_list : non_empty_function_call_argument_list ',' '&' variable",
"global_var_list : global_var_list ',' global_var",
"global_var_list : global_var",
"global_var : T_VARIABLE",
"global_var : '$' variable",
"global_var : '$' '{' expr '}'",
"static_var_list : static_var_list ',' T_VARIABLE",
"static_var_list : static_var_list ',' T_VARIABLE '=' static_scalar",
"static_var_list : T_VARIABLE",
"static_var_list : T_VARIABLE '=' static_scalar",
"class_statement_list : class_statement_list class_statement",
"class_statement_list : /* empty */",
"class_statement : variable_modifiers class_variable_declaration ';'",
"class_statement : T_CONST constant_declaration_list ';'",
"class_statement : method_modifiers T_FUNCTION optional_ref T_STRING '(' parameter_list ')' method_body",
"class_statement : T_USE name_list trait_adaptations",
"trait_adaptations : ';'",
"trait_adaptations : '{' trait_adaptation_list '}'",
"trait_adaptation_list : /* empty */",
"trait_adaptation_list : trait_adaptation_list trait_adaptation",
"trait_adaptation : trait_method_reference_fully_qualified T_INSTEADOF name_list ';'",
"trait_adaptation : trait_method_reference T_AS member_modifier T_STRING ';'",
"trait_adaptation : trait_method_reference T_AS member_modifier ';'",
"trait_adaptation : trait_method_reference T_AS T_STRING ';'",
"trait_method_reference_fully_qualified : name T_PAAMAYIM_NEKUDOTAYIM T_STRING",
"trait_method_reference : trait_method_reference_fully_qualified",
"trait_method_reference : T_STRING",
"method_body : ';'",
"method_body : '{' inner_statement_list '}'",
"variable_modifiers : non_empty_member_modifiers",
"variable_modifiers : T_VAR",
"method_modifiers : /* empty */",
"method_modifiers : non_empty_member_modifiers",
"non_empty_member_modifiers : member_modifier",
"non_empty_member_modifiers : non_empty_member_modifiers member_modifier",
"member_modifier : T_PUBLIC",
"member_modifier : T_PROTECTED",
"member_modifier : T_PRIVATE",
"member_modifier : T_STATIC",
"member_modifier : T_ABSTRACT",
"member_modifier : T_FINAL",
"class_variable_declaration : class_variable_declaration ',' T_VARIABLE",
"class_variable_declaration : class_variable_declaration ',' T_VARIABLE '=' static_scalar",
"class_variable_declaration : T_VARIABLE",
"class_variable_declaration : T_VARIABLE '=' static_scalar",
"expr_list : expr_list ',' expr",
"expr_list : expr",
"for_expr : /* empty */",
"for_expr : expr_list",
"expr : variable",
"expr : T_LIST '(' assignment_list ')' '=' expr",
"expr : variable '=' expr",
"expr : variable '=' '&' variable",
"expr : variable '=' '&' new_expr",
"expr : new_expr",
"expr : T_CLONE expr",
"expr : variable T_PLUS_EQUAL expr",
"expr : variable T_MINUS_EQUAL expr",
"expr : variable T_MUL_EQUAL expr",
"expr : variable T_DIV_EQUAL expr",
"expr : variable T_CONCAT_EQUAL expr",
"expr : variable T_MOD_EQUAL expr",
"expr : variable T_AND_EQUAL expr",
"expr : variable T_OR_EQUAL expr",
"expr : variable T_XOR_EQUAL expr",
"expr : variable T_SL_EQUAL expr",
"expr : variable T_SR_EQUAL expr",
"expr : variable T_INC",
"expr : T_INC variable",
"expr : variable T_DEC",
"expr : T_DEC variable",
"expr : expr T_BOOLEAN_OR expr",
"expr : expr T_BOOLEAN_AND expr",
"expr : expr T_LOGICAL_OR expr",
"expr : expr T_LOGICAL_AND expr",
"expr : expr T_LOGICAL_XOR expr",
"expr : expr '|' expr",
"expr : expr '&' expr",
"expr : expr '^' expr",
"expr : expr '.' expr",
"expr : expr '+' expr",
"expr : expr '-' expr",
"expr : expr '*' expr",
"expr : expr '/' expr",
"expr : expr '%' expr",
"expr : expr T_SL expr",
"expr : expr T_SR expr",
"expr : '+' expr",
"expr : '-' expr",
"expr : '!' expr",
"expr : '~' expr",
"expr : expr T_IS_IDENTICAL expr",
"expr : expr T_IS_NOT_IDENTICAL expr",
"expr : expr T_IS_EQUAL expr",
"expr : expr T_IS_NOT_EQUAL expr",
"expr : expr '<' expr",
"expr : expr T_IS_SMALLER_OR_EQUAL expr",
"expr : expr '>' expr",
"expr : expr T_IS_GREATER_OR_EQUAL expr",
"expr : expr T_INSTANCEOF class_name_reference",
"expr : '(' expr ')'",
"expr : expr '?' expr ':' expr",
"expr : expr '?' ':' expr",
"expr : T_ISSET '(' variables_list ')'",
"expr : T_EMPTY '(' variable ')'",
"expr : T_INCLUDE expr",
"expr : T_INCLUDE_ONCE expr",
"expr : T_EVAL '(' expr ')'",
"expr : T_REQUIRE expr",
"expr : T_REQUIRE_ONCE expr",
"expr : T_INT_CAST expr",
"expr : T_DOUBLE_CAST expr",
"expr : T_STRING_CAST expr",
"expr : T_ARRAY_CAST expr",
"expr : T_OBJECT_CAST expr",
"expr : T_BOOL_CAST expr",
"expr : T_UNSET_CAST expr",
"expr : T_EXIT exit_expr",
"expr : '@' expr",
"expr : scalar",
"expr : T_ARRAY '(' array_pair_list ')'",
"expr : '[' array_pair_list ']'",
"expr : '`' backticks_expr '`'",
"expr : T_PRINT expr",
"expr : T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars '{' inner_statement_list '}'",
"expr : T_STATIC T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars '{' inner_statement_list '}'",
"new_expr : T_NEW class_name_reference ctor_arguments",
"lexical_vars : /* empty */",
"lexical_vars : T_USE '(' lexical_var_list ')'",
"lexical_var_list : lexical_var_list ',' optional_ref T_VARIABLE",
"lexical_var_list : optional_ref T_VARIABLE",
"function_call : name '(' function_call_argument_list ')'",
"function_call : class_name_or_var T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' function_call_argument_list ')'",
"function_call : class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '{' expr '}' '(' function_call_argument_list ')'",
"function_call : static_property '(' function_call_argument_list ')'",
"function_call : variable_without_objects '(' function_call_argument_list ')'",
"function_call : function_call '[' dim_offset ']'",
"function_call : function_call '{' expr '}'",
"class_name : T_STATIC",
"class_name : name",
"name : namespace_name",
"name : T_NS_SEPARATOR namespace_name",
"name : T_NAMESPACE T_NS_SEPARATOR namespace_name",
"class_name_reference : class_name",
"class_name_reference : dynamic_class_name_reference",
"dynamic_class_name_reference : object_access_for_dcnr",
"dynamic_class_name_reference : base_variable",
"class_name_or_var : class_name",
"class_name_or_var : reference_variable",
"object_access_for_dcnr : /* empty */",
"object_access_for_dcnr : base_variable T_OBJECT_OPERATOR object_property",
"object_access_for_dcnr : object_access_for_dcnr T_OBJECT_OPERATOR object_property",
"object_access_for_dcnr : object_access_for_dcnr '[' dim_offset ']'",
"object_access_for_dcnr : object_access_for_dcnr '{' expr '}'",
"exit_expr : /* empty */",
"exit_expr : '(' ')'",
"exit_expr : '(' expr ')'",
"backticks_expr : /* empty */",
"backticks_expr : T_ENCAPSED_AND_WHITESPACE",
"backticks_expr : encaps_list",
"ctor_arguments : /* empty */",
"ctor_arguments : '(' function_call_argument_list ')'",
"common_scalar : T_LNUMBER",
"common_scalar : T_DNUMBER",
"common_scalar : T_CONSTANT_ENCAPSED_STRING",
"common_scalar : T_LINE",
"common_scalar : T_FILE",
"common_scalar : T_DIR",
"common_scalar : T_CLASS_C",
"common_scalar : T_TRAIT_C",
"common_scalar : T_METHOD_C",
"common_scalar : T_FUNC_C",
"common_scalar : T_NS_C",
"common_scalar : T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC",
"common_scalar : T_START_HEREDOC T_END_HEREDOC",
"common_scalar : name",
"static_scalar : common_scalar",
"static_scalar : class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING",
"static_scalar : '+' static_scalar",
"static_scalar : '-' static_scalar",
"static_scalar : T_ARRAY '(' static_array_pair_list ')'",
"static_scalar : '[' static_array_pair_list ']'",
"scalar : common_scalar",
"scalar : class_name_or_var T_PAAMAYIM_NEKUDOTAYIM T_STRING",
"scalar : '\"' encaps_list '\"'",
"scalar : T_START_HEREDOC encaps_list T_END_HEREDOC",
"static_array_pair_list : /* empty */",
"static_array_pair_list : non_empty_static_array_pair_list optional_comma",
"optional_comma : /* empty */",
"optional_comma : ','",
"non_empty_static_array_pair_list : non_empty_static_array_pair_list ',' static_array_pair",
"non_empty_static_array_pair_list : static_array_pair",
"static_array_pair : static_scalar T_DOUBLE_ARROW static_scalar",
"static_array_pair : static_scalar",
"variable : object_access",
"variable : base_variable",
"variable : function_call",
"variable : new_expr_array_deref",
"new_expr_array_deref : '(' new_expr ')' '[' dim_offset ']'",
"new_expr_array_deref : new_expr_array_deref '[' dim_offset ']'",
"object_access : variable_or_new_expr T_OBJECT_OPERATOR object_property",
"object_access : variable_or_new_expr T_OBJECT_OPERATOR object_property '(' function_call_argument_list ')'",
"object_access : object_access '(' function_call_argument_list ')'",
"object_access : object_access '[' dim_offset ']'",
"object_access : object_access '{' expr '}'",
"variable_or_new_expr : variable",
"variable_or_new_expr : '(' new_expr ')'",
"variable_without_objects : reference_variable",
"variable_without_objects : '$' variable_without_objects",
"base_variable : variable_without_objects",
"base_variable : static_property",
"static_property : class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '$' reference_variable",
"static_property : static_property_with_arrays",
"static_property_with_arrays : class_name_or_var T_PAAMAYIM_NEKUDOTAYIM T_VARIABLE",
"static_property_with_arrays : class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '$' '{' expr '}'",
"static_property_with_arrays : static_property_with_arrays '[' dim_offset ']'",
"static_property_with_arrays : static_property_with_arrays '{' expr '}'",
"reference_variable : reference_variable '[' dim_offset ']'",
"reference_variable : reference_variable '{' expr '}'",
"reference_variable : T_VARIABLE",
"reference_variable : '$' '{' expr '}'",
"dim_offset : /* empty */",
"dim_offset : expr",
"object_property : T_STRING",
"object_property : '{' expr '}'",
"object_property : variable_without_objects",
"assignment_list : assignment_list ',' assignment_list_element",
"assignment_list : assignment_list_element",
"assignment_list_element : variable",
"assignment_list_element : T_LIST '(' assignment_list ')'",
"assignment_list_element : /* empty */",
"array_pair_list : /* empty */",
"array_pair_list : non_empty_array_pair_list optional_comma",
"non_empty_array_pair_list : non_empty_array_pair_list ',' array_pair",
"non_empty_array_pair_list : array_pair",
"array_pair : expr T_DOUBLE_ARROW expr",
"array_pair : expr",
"array_pair : expr T_DOUBLE_ARROW '&' variable",
"array_pair : '&' variable",
"encaps_list : encaps_list encaps_var",
"encaps_list : encaps_list T_ENCAPSED_AND_WHITESPACE",
"encaps_list : encaps_var",
"encaps_list : T_ENCAPSED_AND_WHITESPACE encaps_var",
"encaps_var : T_VARIABLE",
"encaps_var : T_VARIABLE '[' encaps_var_offset ']'",
"encaps_var : T_VARIABLE T_OBJECT_OPERATOR T_STRING",
"encaps_var : T_DOLLAR_OPEN_CURLY_BRACES expr '}'",
"encaps_var : T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}'",
"encaps_var : T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}'",
"encaps_var : T_CURLY_OPEN variable '}'",
"encaps_var_offset : T_STRING",
"encaps_var_offset : T_NUM_STRING",
"encaps_var_offset : T_VARIABLE"
);
protected function yyprintln($msg) {
echo $msg, "\n";
}
protected function YYTRACE_NEWSTATE($state, $sym) {
$this->yyprintln(
'% State ' . $state
. ', Lookahead ' . ($sym < 0 ? '--none--' : self::$yyterminals[$sym])
);
}
protected function YYTRACE_READ($sym) {
$this->yyprintln('% Reading ' . self::$yyterminals[$sym]);
}
protected function YYTRACE_SHIFT($sym) {
$this->yyprintln('% Shift ' . self::$yyterminals[$sym]);
}
protected function YYTRACE_ACCEPT() {
$this->yyprintln('% Accepted.');
}
protected function YYTRACE_REDUCE($n) {
$this->yyprintln('% Reduce by (' . $n . ') ' . self::$yyproduction[$n]);
}
protected function YYTRACE_POP($state) {
$this->yyprintln('% Recovering, uncovers state ' . $state);
}
protected function YYTRACE_DISCARD($sym) {
$this->yyprintln('% Discard ' . self::$yyterminals[$sym]);
}
/**
* Parses PHP code into a node tree and prints out debugging information.
*
* @param PHPParser_Lexer $lexer A lexer
*
* @return array Array of statements
*/
public function parse(PHPParser_Lexer $lexer) {
$this->lexer = $lexer;
$this->yysp = 0; // Stack pos
$yysstk = array($yystate = 0); // State stack
$this->yyastk = array(); // AST stack (?)
$yylstk = array($yyline = 1); // Line stack
$yydstk = array($yyDC = null); // Doc comment stack
$yychar = -1;
for (;;) {
$this->YYTRACE_NEWSTATE($yystate, $yychar);
if (self::$yybase[$yystate] == 0) {
$yyn = self::$yydefault[$yystate];
} else {
if ($yychar < 0) {
if (($yychar = $lexer->lex($yylval, $yyline, $yyDC)) < 0)
$yychar = 0;
$yychar = $yychar < self::YYMAXLEX ?
self::$yytranslate[$yychar] : self::YYBADCH;
$yylstk[$this->yysp] = $yyline;
$yydstk[$this->yysp] = $yyDC;
$this->YYTRACE_READ($yychar);
}
if ((($yyn = self::$yybase[$yystate] + $yychar) >= 0
&& $yyn < self::YYLAST && self::$yycheck[$yyn] == $yychar
|| ($yystate < self::YY2TBLSTATE
&& ($yyn = self::$yybase[$yystate + self::YYNLSTATES]
+ $yychar) >= 0
&& $yyn < self::YYLAST
&& self::$yycheck[$yyn] == $yychar))
&& ($yyn = self::$yyaction[$yyn]) != self::YYDEFAULT) {
/*
* >= YYNLSTATE: shift and reduce
* > 0: shift
* = 0: accept
* < 0: reduce
* = -YYUNEXPECTED: error
*/
if ($yyn > 0) {
/* shift */
$this->YYTRACE_SHIFT($yychar);
++$this->yysp;
$yysstk[$this->yysp] = $yystate = $yyn;
$this->yyastk[$this->yysp] = $yylval;
$yylstk[$this->yysp] = $yyline;
$yydstk[$this->yysp] = $yyDC;
$yychar = -1;
if ($yyn < self::YYNLSTATES)
continue;
/* $yyn >= YYNLSTATES means shift-and-reduce */
$yyn -= self::YYNLSTATES;
} else {
$yyn = -$yyn;
}
} else {
$yyn = self::$yydefault[$yystate];
}
}
for (;;) {
/* reduce/error */
if ($yyn == 0) {
/* accept */
$this->YYTRACE_ACCEPT();
return $this->yyval;
} elseif ($yyn != self::YYUNEXPECTED) {
/* reduce */
$this->YYTRACE_REDUCE($yyn);
try {
$this->{'yyn' . $yyn}(
$yylstk[$this->yysp - self::$yylen[$yyn]],
$yydstk[$this->yysp - self::$yylen[$yyn]]
);
} catch (PHPParser_Error $e) {
if (-1 === $e->getRawLine()) {
$e->setRawLine($yyline);
}
throw $e;
}
/* Goto - shift nonterminal */
$this->yysp -= self::$yylen[$yyn];
$yyn = self::$yylhs[$yyn];
if (($yyp = self::$yygbase[$yyn] + $yysstk[$this->yysp]) >= 0
&& $yyp < self::YYGLAST
&& self::$yygcheck[$yyp] == $yyn) {
$yystate = self::$yygoto[$yyp];
} else {
$yystate = self::$yygdefault[$yyn];
}
++$this->yysp;
$yysstk[$this->yysp] = $yystate;
$this->yyastk[$this->yysp] = $this->yyval;
$yylstk[$this->yysp] = $yyline;
$yydstk[$this->yysp] = $yyDC;
} else {
/* error */
throw new PHPParser_Error(
'Unexpected token ' . self::$yyterminals[$yychar],
$yyline
);
}
if ($yystate < self::YYNLSTATES)
break;
/* >= YYNLSTATES means shift-and-reduce */
$yyn = $yystate - self::YYNLSTATES;
}
}
}
}