PHP Класс Haanga_Compiler_Parser

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$yyExpectedTokens
$yyFallback %fallback ID X Y Z. appears in the grammer, then ID becomes a fallback token for X, Y, and Z. Whenever one of the tokens X, Y, or Z is input to the parser but it does not parse, the type of the token is changed to ID and the parse is retried before an error is thrown.
$yyReduceMap If a rule is not set, it has no handler.
$yyRuleInfo
array(
 array(
  int $lhs;         Symbol on the left-hand side of the rule
  int $nrhs;     Number of right-hand side symbols in the rule
 ),...
);
$yyRuleName array For tracing reduce actions, the names of all rules are required.
$yyTokenName array For tracing shifts, the names of all terminals and nonterminals are required. The following table supplies these names
$yyTraceFILE resource | 0
$yyTracePrompt string | 0 String to prepend to debug output
$yy_action
$yy_default
$yy_lookahead
$yy_reduce_ofst
$yy_shift_ofst
$yyerrcnt integer
$yyidx integer
$yystack array

Защищенные свойства (Protected)

Свойство Тип Описание
$file
$lex #line 40 "lib/Haanga/Compiler/Parser.y"

Открытые методы

Метод Описание
Error ( $text )
PrintTrace ( ) Output debug information to output (php://output stream)
Trace ( $TraceFILE, $zTracePrompt ) Turn parser tracing on by giving a stream to which to write the trace and a prompt to preface each trace message. Tracing is turned off by making either argument NULL
__construct ( $lex, $file = '' )
__destruct ( ) Deallocate and destroy a parser. Destructors are all called for all stack elements before shutting the parser down.
doParse ( integer $yymajor, mixed $yytokenvalue ) : void The main parser program.
tokenName ( $tokenType ) : string This function returns the symbolic name associated with a token value.
yy_accept ( ) The following is executed when the parser accepts
yy_destructor ( $yymajor, $yypminor ) The following function deletes the value associated with a symbol. The symbol can be either a terminal or nonterminal.
yy_find_reduce_action ( $stateno, $iLookAhead ) Find the appropriate action for a parser given the non-terminal look-ahead token $iLookAhead.
yy_find_shift_action ( $iLookAhead ) Find the appropriate action for a parser given the terminal look-ahead token iLookAhead.
yy_get_expected_tokens ( $token ) : array Based on the current state and parser stack, get a list of all possible lookahead tokens
yy_is_expected_token ( $token ) : boolean Based on the parser state and current parser stack, determine whether the lookahead token is possible.
yy_parse_failed ( ) The following code executes when the parse fails
yy_pop_parser_stack ( ) : integer Pop the parser's stack once.
yy_r0 ( ) #line 81 "lib/Haanga/Compiler/Parser.y"
yy_r1 ( ) #line 83 "lib/Haanga/Compiler/Parser.y"
yy_r14 ( ) #line 108 "lib/Haanga/Compiler/Parser.y"
yy_r18 ( ) #line 112 "lib/Haanga/Compiler/Parser.y"
yy_r19 ( ) #line 126 "lib/Haanga/Compiler/Parser.y"
yy_r2 ( ) #line 84 "lib/Haanga/Compiler/Parser.y"
yy_r20 ( ) #line 129 "lib/Haanga/Compiler/Parser.y"
yy_r21 ( ) #line 132 "lib/Haanga/Compiler/Parser.y"
yy_r22 ( ) #line 135 "lib/Haanga/Compiler/Parser.y"
yy_r23 ( ) #line 140 "lib/Haanga/Compiler/Parser.y"
yy_r24 ( ) #line 146 "lib/Haanga/Compiler/Parser.y"
yy_r25 ( ) #line 154 "lib/Haanga/Compiler/Parser.y"
yy_r26 ( ) #line 162 "lib/Haanga/Compiler/Parser.y"
yy_r27 ( ) #line 170 "lib/Haanga/Compiler/Parser.y"
yy_r29 ( ) #line 172 "lib/Haanga/Compiler/Parser.y"
yy_r3 ( ) #line 87 "lib/Haanga/Compiler/Parser.y"
yy_r30 ( ) #line 186 "lib/Haanga/Compiler/Parser.y"
yy_r31 ( ) #line 194 "lib/Haanga/Compiler/Parser.y"
yy_r32 ( ) #line 204 "lib/Haanga/Compiler/Parser.y"
yy_r33 ( ) #line 212 "lib/Haanga/Compiler/Parser.y"
yy_r34 ( ) #line 219 "lib/Haanga/Compiler/Parser.y"
yy_r35 ( ) #line 226 "lib/Haanga/Compiler/Parser.y"
yy_r36 ( ) #line 235 "lib/Haanga/Compiler/Parser.y"
yy_r37 ( ) #line 241 "lib/Haanga/Compiler/Parser.y"
yy_r38 ( ) #line 249 "lib/Haanga/Compiler/Parser.y"
yy_r39 ( ) #line 256 "lib/Haanga/Compiler/Parser.y"
yy_r4 ( ) #line 89 "lib/Haanga/Compiler/Parser.y"
yy_r40 ( ) #line 262 "lib/Haanga/Compiler/Parser.y"
yy_r41 ( ) #line 269 "lib/Haanga/Compiler/Parser.y"
yy_r42 ( ) #line 277 "lib/Haanga/Compiler/Parser.y"
yy_r43 ( ) #line 283 "lib/Haanga/Compiler/Parser.y"
yy_r44 ( ) #line 289 "lib/Haanga/Compiler/Parser.y"
yy_r45 ( ) #line 295 "lib/Haanga/Compiler/Parser.y"
yy_r46 ( ) #line 303 "lib/Haanga/Compiler/Parser.y"
yy_r47 ( ) #line 310 "lib/Haanga/Compiler/Parser.y"
yy_r48 ( ) #line 317 "lib/Haanga/Compiler/Parser.y"
yy_r5 ( ) #line 93 "lib/Haanga/Compiler/Parser.y"
yy_r50 ( ) #line 332 "lib/Haanga/Compiler/Parser.y"
yy_r51 ( ) #line 340 "lib/Haanga/Compiler/Parser.y"
yy_r52 ( ) #line 343 "lib/Haanga/Compiler/Parser.y"
yy_r53 ( ) #line 344 "lib/Haanga/Compiler/Parser.y"
yy_r54 ( ) #line 345 "lib/Haanga/Compiler/Parser.y"
yy_r55 ( ) #line 347 "lib/Haanga/Compiler/Parser.y"
yy_r57 ( ) #line 351 "lib/Haanga/Compiler/Parser.y"
yy_r6 ( ) #line 97 "lib/Haanga/Compiler/Parser.y"
yy_r60 ( ) #line 357 "lib/Haanga/Compiler/Parser.y"
yy_r61 ( ) #line 358 "lib/Haanga/Compiler/Parser.y"
yy_r62 ( ) #line 359 "lib/Haanga/Compiler/Parser.y"
yy_r63 ( ) #line 360 "lib/Haanga/Compiler/Parser.y"
yy_r64 ( ) #line 363 "lib/Haanga/Compiler/Parser.y"
yy_r7 ( ) #line 101 "lib/Haanga/Compiler/Parser.y"
yy_r70 ( ) #line 375 "lib/Haanga/Compiler/Parser.y"
yy_r71 ( ) #line 378 "lib/Haanga/Compiler/Parser.y"
yy_r72 ( ) #line 379 "lib/Haanga/Compiler/Parser.y"
yy_r75 ( ) #line 382 "lib/Haanga/Compiler/Parser.y"
yy_r77 ( ) #line 384 "lib/Haanga/Compiler/Parser.y"
yy_r78 ( ) #line 385 "lib/Haanga/Compiler/Parser.y"
yy_r79 ( ) #line 386 "lib/Haanga/Compiler/Parser.y"
yy_r8 ( ) #line 102 "lib/Haanga/Compiler/Parser.y"
yy_r81 ( ) #line 391 "lib/Haanga/Compiler/Parser.y"
yy_r82 ( ) #line 395 "lib/Haanga/Compiler/Parser.y"
yy_r83 ( ) #line 401 "lib/Haanga/Compiler/Parser.y"
yy_r84 ( ) #line 403 "lib/Haanga/Compiler/Parser.y"
yy_r85 ( ) #line 408 "lib/Haanga/Compiler/Parser.y"
yy_r86 ( ) #line 413 "lib/Haanga/Compiler/Parser.y"
yy_r89 ( ) #line 422 "lib/Haanga/Compiler/Parser.y"
yy_r9 ( ) #line 103 "lib/Haanga/Compiler/Parser.y"
yy_r93 ( ) #line 428 "lib/Haanga/Compiler/Parser.y"
yy_reduce ( $yyruleno ) Perform a reduce action and the shift that must immediately follow the reduce.
yy_shift ( $yyNewState, $yyMajor, $yypMinor ) Perform a shift action.
yy_syntax_error ( $yymajor, $TOKEN ) The following code executes when a syntax error first occurs.

Описание методов

Error() публичный Метод

public Error ( $text )

PrintTrace() статический публичный Метод

Output debug information to output (php://output stream)
static public PrintTrace ( )

Trace() статический публичный Метод

Inputs: - A stream resource to which trace output should be written. If NULL, then tracing is turned off. - A prefix string written at the beginning of every line of trace output. If NULL, then tracing is turned off. Outputs: - None.
static public Trace ( $TraceFILE, $zTracePrompt )

__construct() публичный Метод

public __construct ( $lex, $file = '' )

__destruct() публичный Метод

Deallocate and destroy a parser. Destructors are all called for all stack elements before shutting the parser down.
public __destruct ( )

doParse() публичный Метод

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
Результат void

tokenName() публичный Метод

This function returns the symbolic name associated with a token value.
public tokenName ( $tokenType ) : string
Результат string

yy_accept() публичный Метод

%parse_accept code is inserted here
public yy_accept ( )

yy_destructor() статический публичный Метод

The following function deletes the value associated with a symbol. The symbol can be either a terminal or nonterminal.
static public yy_destructor ( $yymajor, $yypminor )

yy_find_reduce_action() публичный Метод

If the look-ahead token is self::YYNOCODE, then check to see if the action is independent of the look-ahead. If it is, return the action, otherwise return self::YY_NO_ACTION.
public yy_find_reduce_action ( $stateno, $iLookAhead )

yy_find_shift_action() публичный Метод

If the look-ahead token is YYNOCODE, then check to see if the action is independent of the look-ahead. If it is, return the action, otherwise return YY_NO_ACTION.
public yy_find_shift_action ( $iLookAhead )

yy_get_expected_tokens() публичный Метод

Based on the current state and parser stack, get a list of all possible lookahead tokens
public yy_get_expected_tokens ( $token ) : array
Результат array

yy_is_expected_token() публичный Метод

The parser will convert the token value to an error token if not. This catches some unusual edge cases where the parser would fail.
public yy_is_expected_token ( $token ) : boolean
Результат boolean

yy_parse_failed() публичный Метод

Code from %parse_fail is inserted here
public yy_parse_failed ( )

yy_pop_parser_stack() публичный Метод

If there is a destructor routine associated with the token which is popped from the stack, then call it. Return the major token number for the symbol popped.
public yy_pop_parser_stack ( ) : integer
Результат integer

yy_r0() публичный Метод

#line 81 "lib/Haanga/Compiler/Parser.y"
public yy_r0 ( )

yy_r1() публичный Метод

#line 83 "lib/Haanga/Compiler/Parser.y"
public yy_r1 ( )

yy_r14() публичный Метод

#line 108 "lib/Haanga/Compiler/Parser.y"
public yy_r14 ( )

yy_r18() публичный Метод

#line 112 "lib/Haanga/Compiler/Parser.y"
public yy_r18 ( )

yy_r19() публичный Метод

#line 126 "lib/Haanga/Compiler/Parser.y"
public yy_r19 ( )

yy_r2() публичный Метод

#line 84 "lib/Haanga/Compiler/Parser.y"
public yy_r2 ( )

yy_r20() публичный Метод

#line 129 "lib/Haanga/Compiler/Parser.y"
public yy_r20 ( )

yy_r21() публичный Метод

#line 132 "lib/Haanga/Compiler/Parser.y"
public yy_r21 ( )

yy_r22() публичный Метод

#line 135 "lib/Haanga/Compiler/Parser.y"
public yy_r22 ( )

yy_r23() публичный Метод

#line 140 "lib/Haanga/Compiler/Parser.y"
public yy_r23 ( )

yy_r24() публичный Метод

#line 146 "lib/Haanga/Compiler/Parser.y"
public yy_r24 ( )

yy_r25() публичный Метод

#line 154 "lib/Haanga/Compiler/Parser.y"
public yy_r25 ( )

yy_r26() публичный Метод

#line 162 "lib/Haanga/Compiler/Parser.y"
public yy_r26 ( )

yy_r27() публичный Метод

#line 170 "lib/Haanga/Compiler/Parser.y"
public yy_r27 ( )

yy_r29() публичный Метод

#line 172 "lib/Haanga/Compiler/Parser.y"
public yy_r29 ( )

yy_r3() публичный Метод

#line 87 "lib/Haanga/Compiler/Parser.y"
public yy_r3 ( )

yy_r30() публичный Метод

#line 186 "lib/Haanga/Compiler/Parser.y"
public yy_r30 ( )

yy_r31() публичный Метод

#line 194 "lib/Haanga/Compiler/Parser.y"
public yy_r31 ( )

yy_r32() публичный Метод

#line 204 "lib/Haanga/Compiler/Parser.y"
public yy_r32 ( )

yy_r33() публичный Метод

#line 212 "lib/Haanga/Compiler/Parser.y"
public yy_r33 ( )

yy_r34() публичный Метод

#line 219 "lib/Haanga/Compiler/Parser.y"
public yy_r34 ( )

yy_r35() публичный Метод

#line 226 "lib/Haanga/Compiler/Parser.y"
public yy_r35 ( )

yy_r36() публичный Метод

#line 235 "lib/Haanga/Compiler/Parser.y"
public yy_r36 ( )

yy_r37() публичный Метод

#line 241 "lib/Haanga/Compiler/Parser.y"
public yy_r37 ( )

yy_r38() публичный Метод

#line 249 "lib/Haanga/Compiler/Parser.y"
public yy_r38 ( )

yy_r39() публичный Метод

#line 256 "lib/Haanga/Compiler/Parser.y"
public yy_r39 ( )

yy_r4() публичный Метод

#line 89 "lib/Haanga/Compiler/Parser.y"
public yy_r4 ( )

yy_r40() публичный Метод

#line 262 "lib/Haanga/Compiler/Parser.y"
public yy_r40 ( )

yy_r41() публичный Метод

#line 269 "lib/Haanga/Compiler/Parser.y"
public yy_r41 ( )

yy_r42() публичный Метод

#line 277 "lib/Haanga/Compiler/Parser.y"
public yy_r42 ( )

yy_r43() публичный Метод

#line 283 "lib/Haanga/Compiler/Parser.y"
public yy_r43 ( )

yy_r44() публичный Метод

#line 289 "lib/Haanga/Compiler/Parser.y"
public yy_r44 ( )

yy_r45() публичный Метод

#line 295 "lib/Haanga/Compiler/Parser.y"
public yy_r45 ( )

yy_r46() публичный Метод

#line 303 "lib/Haanga/Compiler/Parser.y"
public yy_r46 ( )

yy_r47() публичный Метод

#line 310 "lib/Haanga/Compiler/Parser.y"
public yy_r47 ( )

yy_r48() публичный Метод

#line 317 "lib/Haanga/Compiler/Parser.y"
public yy_r48 ( )

yy_r5() публичный Метод

#line 93 "lib/Haanga/Compiler/Parser.y"
public yy_r5 ( )

yy_r50() публичный Метод

#line 332 "lib/Haanga/Compiler/Parser.y"
public yy_r50 ( )

yy_r51() публичный Метод

#line 340 "lib/Haanga/Compiler/Parser.y"
public yy_r51 ( )

yy_r52() публичный Метод

#line 343 "lib/Haanga/Compiler/Parser.y"
public yy_r52 ( )

yy_r53() публичный Метод

#line 344 "lib/Haanga/Compiler/Parser.y"
public yy_r53 ( )

yy_r54() публичный Метод

#line 345 "lib/Haanga/Compiler/Parser.y"
public yy_r54 ( )

yy_r55() публичный Метод

#line 347 "lib/Haanga/Compiler/Parser.y"
public yy_r55 ( )

yy_r57() публичный Метод

#line 351 "lib/Haanga/Compiler/Parser.y"
public yy_r57 ( )

yy_r6() публичный Метод

#line 97 "lib/Haanga/Compiler/Parser.y"
public yy_r6 ( )

yy_r60() публичный Метод

#line 357 "lib/Haanga/Compiler/Parser.y"
public yy_r60 ( )

yy_r61() публичный Метод

#line 358 "lib/Haanga/Compiler/Parser.y"
public yy_r61 ( )

yy_r62() публичный Метод

#line 359 "lib/Haanga/Compiler/Parser.y"
public yy_r62 ( )

yy_r63() публичный Метод

#line 360 "lib/Haanga/Compiler/Parser.y"
public yy_r63 ( )

yy_r64() публичный Метод

#line 363 "lib/Haanga/Compiler/Parser.y"
public yy_r64 ( )

yy_r7() публичный Метод

#line 101 "lib/Haanga/Compiler/Parser.y"
public yy_r7 ( )

yy_r70() публичный Метод

#line 375 "lib/Haanga/Compiler/Parser.y"
public yy_r70 ( )

yy_r71() публичный Метод

#line 378 "lib/Haanga/Compiler/Parser.y"
public yy_r71 ( )

yy_r72() публичный Метод

#line 379 "lib/Haanga/Compiler/Parser.y"
public yy_r72 ( )

yy_r75() публичный Метод

#line 382 "lib/Haanga/Compiler/Parser.y"
public yy_r75 ( )

yy_r77() публичный Метод

#line 384 "lib/Haanga/Compiler/Parser.y"
public yy_r77 ( )

yy_r78() публичный Метод

#line 385 "lib/Haanga/Compiler/Parser.y"
public yy_r78 ( )

yy_r79() публичный Метод

#line 386 "lib/Haanga/Compiler/Parser.y"
public yy_r79 ( )

yy_r8() публичный Метод

#line 102 "lib/Haanga/Compiler/Parser.y"
public yy_r8 ( )

yy_r81() публичный Метод

#line 391 "lib/Haanga/Compiler/Parser.y"
public yy_r81 ( )

yy_r82() публичный Метод

#line 395 "lib/Haanga/Compiler/Parser.y"
public yy_r82 ( )

yy_r83() публичный Метод

#line 401 "lib/Haanga/Compiler/Parser.y"
public yy_r83 ( )

yy_r84() публичный Метод

#line 403 "lib/Haanga/Compiler/Parser.y"
public yy_r84 ( )

yy_r85() публичный Метод

#line 408 "lib/Haanga/Compiler/Parser.y"
public yy_r85 ( )

yy_r86() публичный Метод

#line 413 "lib/Haanga/Compiler/Parser.y"
public yy_r86 ( )

yy_r89() публичный Метод

#line 422 "lib/Haanga/Compiler/Parser.y"
public yy_r89 ( )

yy_r9() публичный Метод

#line 103 "lib/Haanga/Compiler/Parser.y"
public yy_r9 ( )

yy_r93() публичный Метод

#line 428 "lib/Haanga/Compiler/Parser.y"
public yy_r93 ( )

yy_reduce() публичный Метод

For a rule such as:
A ::= B blah C. { dosomething(); }
This function will first call the action, if any, ("dosomething();" in our example), and then it will pop three states from the stack, one for each entry on the right-hand side of the expression (B, blah, and C in our example rule), and then push the result of the action back on to the stack with the resulting state reduced to (as described in the .out file)
public yy_reduce ( $yyruleno )

yy_shift() публичный Метод

Perform a shift action.
public yy_shift ( $yyNewState, $yyMajor, $yypMinor )

yy_syntax_error() публичный Метод

%syntax_error code is inserted here
public yy_syntax_error ( $yymajor, $TOKEN )

Описание свойств

$file защищенное свойство

protected $file

$lex защищенное свойство

#line 40 "lib/Haanga/Compiler/Parser.y"
protected $lex

$yyExpectedTokens публичное статическое свойство

public static $yyExpectedTokens

$yyFallback публичное статическое свойство

%fallback ID X Y Z. appears in the grammer, then ID becomes a fallback token for X, Y, and Z. Whenever one of the tokens X, Y, or Z is input to the parser but it does not parse, the type of the token is changed to ID and the parse is retried before an error is thrown.
public static $yyFallback

$yyReduceMap публичное статическое свойство

If a rule is not set, it has no handler.
public static $yyReduceMap

$yyRuleInfo публичное статическое свойство

array(
 array(
  int $lhs;         Symbol on the left-hand side of the rule
  int $nrhs;     Number of right-hand side symbols in the rule
 ),...
);
public static $yyRuleInfo

$yyRuleName публичное статическое свойство

For tracing reduce actions, the names of all rules are required.
public static array $yyRuleName
Результат array

$yyTokenName публичное статическое свойство

For tracing shifts, the names of all terminals and nonterminals are required. The following table supplies these names
public static array $yyTokenName
Результат array

$yyTraceFILE публичное статическое свойство

public static resource|0 $yyTraceFILE
Результат resource | 0

$yyTracePrompt публичное статическое свойство

String to prepend to debug output
public static string|0 $yyTracePrompt
Результат string | 0

$yy_action публичное статическое свойство

public static $yy_action

$yy_default публичное статическое свойство

public static $yy_default

$yy_lookahead публичное статическое свойство

public static $yy_lookahead

$yy_reduce_ofst публичное статическое свойство

public static $yy_reduce_ofst

$yy_shift_ofst публичное статическое свойство

public static $yy_shift_ofst

$yyerrcnt публичное свойство

public int $yyerrcnt
Результат integer

$yyidx публичное свойство

public int $yyidx
Результат integer

$yystack публичное свойство

public array $yystack
Результат array