phpDocumentor PHP_LexerGenerator
[ class tree: PHP_LexerGenerator ] [ index: PHP_LexerGenerator ] [ all elements ]

Class: PHP_LexerGenerator_Parser

Source Location: /LexerGenerator/Parser.php

Class PHP_LexerGenerator_Parser

Property Summary
static mixed   $yyExpectedTokens  
static mixed   $yyFallback   The next table maps tokens into fallback tokens. If a construct like the following:
static mixed   $yyReduceMap   The following table contains a mapping of reduce action to method name that handles the reduction.
static mixed   $yyRuleInfo   The following table contains information about every rule that is used during the reduce.
static array   $yyRuleName   For tracing reduce actions, the names of all rules are required.
static array   $yyTokenName   For tracing shifts, the names of all terminals and nonterminals
static resource|0   $yyTraceFILE  
static string|0   $yyTracePrompt   String to prepend to debug output
static mixed   $yy_action  
static mixed   $yy_default  
static mixed   $yy_lookahead  
static mixed   $yy_reduce_ofst  
static mixed   $yy_shift_ofst  
mixed   $transTable  
int   $yyerrcnt  
int   $yyidx  
array   $yystack  

[ Top ]
Method Summary
static void   PrintTrace()   Output debug information to output (php://output stream)
static void   Trace()   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
static void   yy_destructor()   The following function deletes the value associated with a symbol. The symbol can be either a terminal or nonterminal.
PHP_LexerGenerator_Parser   __construct()  
void   __destruct()   Deallocate and destroy a parser. Destructors are all called for all stack elements before shutting the parser down.
void   doParse()   The main parser program.
void   error()  
void   outputRules()  
string   tokenName()   This function returns the symbolic name associated with a token value.
void   yy_accept()   The following is executed when the parser accepts
void   yy_find_reduce_action()   Find the appropriate action for a parser given the non-terminal look-ahead token $iLookAhead.
void   yy_find_shift_action()   Find the appropriate action for a parser given the terminal look-ahead token iLookAhead.
array   yy_get_expected_tokens()   Based on the current state and parser stack, get a list of all
bool   yy_is_expected_token()   Based on the parser state and current parser stack, determine whether the lookahead token is possible.
void   yy_parse_failed()   The following code executes when the parse fails
int   yy_pop_parser_stack()   Pop the parser's stack once.
void   yy_r1()  
void   yy_r2()  
void   yy_r3()  
void   yy_r4()  
void   yy_r5()  
void   yy_r6()  
void   yy_r7()  
void   yy_r9()  
void   yy_r11()  
void   yy_r12()  
void   yy_r13()  
void   yy_r14()  
void   yy_r15()  
void   yy_r16()  
void   yy_r17()  
void   yy_r18()  
void   yy_r19()  
void   yy_r20()  
void   yy_r21()  
void   yy_r22()  
void   yy_r23()  
void   yy_r24()  
void   yy_r25()  
void   yy_r26()  
void   yy_r27()  
void   yy_r28()  
void   yy_r29()  
void   yy_r30()  
void   yy_r31()  
void   yy_reduce()   Perform a reduce action and the shift that must immediately follow the reduce.
void   yy_shift()   Perform a shift action.
void   yy_syntax_error()   The following code executes when a syntax error first occurs.
void   _validatePattern()  

[ Top ]
Properties
static mixed   $yyExpectedTokens = array(
/* 0 */ array(1, 2, ),/* 1 */array(4,5,8,),/* 2 */array(4,5,8,),/* 3 */array(5,8,),/* 4 */array(1,2,),/* 5 */array(5,8,),/* 6 */array(1,2,),/* 7 */array(2,),/* 8 */array(4,),/* 9 */array(2,),/* 10 */array(3,5,8,),/* 11 */array(3,5,8,),/* 12 */array(3,5,8,),/* 13 */array(3,5,8,),/* 14 */array(4,7,),/* 15 */array(5,8,),/* 16 */array(5,8,),/* 17 */array(2,),/* 18 */array(5,6,8,),/* 19 */array(5,6,8,),/* 20 */array(5,6,),/* 21 */array(5,8,),/* 22 */array(5,8,),/* 23 */array(5,6,),/* 24 */array(1,),/* 25 */array(2,),/* 26 */array(7,),/* 27 */array(2,),/* 28 */array(3,),/* 29 */array(5,),/* 30 */array(1,),/* 31 */array(2,),/* 32 */array(1,),/* 33 */array(2,),/* 34 */array(5,),/* 35 */array(1,),/* 36 */array(),/* 37 */array(),/* 38 */array(),/* 39 */array(),/* 40 */array(),/* 41 */array(),/* 42 */array(),/* 43 */array(),/* 44 */array(),/* 45 */array(),/* 46 */array(),/* 47 */array(),/* 48 */array(),/* 49 */array(),/* 50 */array(),/* 51 */array(),/* 52 */array(),/* 53 */array(),/* 54 */array(),/* 55 */array(),/* 56 */array(),)
[line 463]
API Tags:
Access:  public


[ Top ]
static mixed   $yyFallback = array(
)
[line 562]

The next table maps tokens into fallback tokens. If a construct like the following:

%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.

API Tags:
Access:  public


[ Top ]
static mixed   $yyReduceMap = array(
1 => 1,
2 => 2,
3 => 3,
4 => 4,
5 => 5,
6 => 6,
7 => 7,
8 => 7,
9 => 9,
10 => 9,
11 => 11,
12 => 12,
13 => 13,
14 => 14,
15 => 15,
16 => 16,
17 => 17,
18 => 18,
19 => 19,
20 => 20,
21 => 21,
22 => 22,
23 => 23,
24 => 24,
25 => 25,
26 => 26,
27 => 27,
28 => 28,
29 => 29,
30 => 30,
31 => 31,
)
[line 1078]

The following table contains a mapping of reduce action to method name that handles the reduction.

If a rule is not set, it has no handler.

API Tags:
Access:  public


[ Top ]
static mixed   $yyRuleInfo = array(
array( 'lhs' => 10, 'rhs' => 1 ),array('lhs'=>11,'rhs'=>2),array('lhs'=>11,'rhs'=>3),array('lhs'=>11,'rhs'=>3),array('lhs'=>11,'rhs'=>4),array('lhs'=>12,'rhs'=>3),array('lhs'=>14,'rhs'=>2),array('lhs'=>15,'rhs'=>2),array('lhs'=>15,'rhs'=>2),array('lhs'=>15,'rhs'=>3),array('lhs'=>15,'rhs'=>3),array('lhs'=>16,'rhs'=>2),array('lhs'=>16,'rhs'=>3),array('lhs'=>13,'rhs'=>3),array('lhs'=>13,'rhs'=>5),array('lhs'=>13,'rhs'=>4),array('lhs'=>13,'rhs'=>6),array('lhs'=>13,'rhs'=>3),array('lhs'=>13,'rhs'=>5),array('lhs'=>13,'rhs'=>4),array('lhs'=>13,'rhs'=>6),array('lhs'=>19,'rhs'=>2),array('lhs'=>18,'rhs'=>2),array('lhs'=>18,'rhs'=>3),array('lhs'=>20,'rhs'=>1),array('lhs'=>20,'rhs'=>1),array('lhs'=>20,'rhs'=>2),array('lhs'=>20,'rhs'=>2),array('lhs'=>17,'rhs'=>1),array('lhs'=>17,'rhs'=>1),array('lhs'=>17,'rhs'=>2),array('lhs'=>17,'rhs'=>2),)
[line 1037]

The following table contains information about every rule that is used during the reduce.

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

API Tags:
Access:  public


[ Top ]
static array   $yyRuleName = array(
/* 0 */ "start ::= lexfile",
/* 1 */ "lexfile ::= declare rules",
/* 2 */ "lexfile ::= declare PHPCODE rules",
/* 3 */ "lexfile ::= PHPCODE declare rules",
/* 4 */ "lexfile ::= PHPCODE declare PHPCODE rules",
/* 5 */ "declare ::= COMMENTSTART declarations COMMENTEND",
/* 6 */ "declarations ::= processing_instructions pattern_declarations",
/* 7 */ "processing_instructions ::= PI SUBPATTERN",
/* 8 */ "processing_instructions ::= PI CODE",
/* 9 */ "processing_instructions ::= processing_instructions PI SUBPATTERN",
/* 10 */ "processing_instructions ::= processing_instructions PI CODE",
/* 11 */ "pattern_declarations ::= PATTERN subpattern",
/* 12 */ "pattern_declarations ::= pattern_declarations PATTERN subpattern",
/* 13 */ "rules ::= COMMENTSTART rule COMMENTEND",
/* 14 */ "rules ::= COMMENTSTART PI SUBPATTERN rule COMMENTEND",
/* 15 */ "rules ::= COMMENTSTART rule COMMENTEND PHPCODE",
/* 16 */ "rules ::= COMMENTSTART PI SUBPATTERN rule COMMENTEND PHPCODE",
/* 17 */ "rules ::= reset_rules rule COMMENTEND",
/* 18 */ "rules ::= reset_rules PI SUBPATTERN rule COMMENTEND",
/* 19 */ "rules ::= reset_rules rule COMMENTEND PHPCODE",
/* 20 */ "rules ::= reset_rules PI SUBPATTERN rule COMMENTEND PHPCODE",
/* 21 */ "reset_rules ::= rules COMMENTSTART",
/* 22 */ "rule ::= rule_subpattern CODE",
/* 23 */ "rule ::= rule rule_subpattern CODE",
/* 24 */ "rule_subpattern ::= QUOTE",
/* 25 */ "rule_subpattern ::= SUBPATTERN",
/* 26 */ "rule_subpattern ::= rule_subpattern QUOTE",
/* 27 */ "rule_subpattern ::= rule_subpattern SUBPATTERN",
/* 28 */ "subpattern ::= QUOTE",
/* 29 */ "subpattern ::= SUBPATTERN",
/* 30 */ "subpattern ::= subpattern QUOTE",
/* 31 */ "subpattern ::= subpattern SUBPATTERN",
)
[line 643]

For tracing reduce actions, the names of all rules are required.

API Tags:
Access:  public


[ Top ]
static array   $yyTokenName = array(
'$', 'PHPCODE', 'COMMENTSTART', 'COMMENTEND',
'PI', 'SUBPATTERN', 'CODE', 'PATTERN',
'QUOTE', 'error', 'start', 'lexfile',
'declare', 'rules', 'declarations', 'processing_instructions',
'pattern_declarations', 'subpattern', 'rule', 'reset_rules',
'rule_subpattern',
)
[line 630]

For tracing shifts, the names of all terminals and nonterminals

are required. The following table supplies these names

API Tags:
Access:  public


[ Top ]
static resource|0   $yyTraceFILE [line 606]
API Tags:
Access:  public


[ Top ]
static string|0   $yyTracePrompt [line 611]

String to prepend to debug output

API Tags:
Access:  public


[ Top ]
static mixed   $yy_action = array(
/* 0 */ 35, 24, 50, 50, 48, 51, 51, 54, 47, 43,
/* 10 */ 53, 54, 45, 31, 53, 32, 30, 50, 50, 1,
/* 20 */ 51, 51, 34, 50, 17, 8, 51, 90, 52, 6,
/* 30 */ 3, 29, 50, 50, 25, 51, 51, 11, 38, 18,
/* 40 */ 1, 41, 42, 39, 10, 36, 18, 12, 37, 18,
/* 50 */ 20, 7, 2, 16, 13, 15, 18, 27, 9, 2,
/* 60 */ 5, 28, 14, 1, 44, 40, 33, 49, 56, 46,
/* 70 */ 26, 19, 1, 55, 2, 21, 4, 23, 22, 8,
)
[line 429]
API Tags:
Access:  public


[ Top ]
static mixed   $yy_default = array(
/* 0 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
/* 10 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
/* 20 */ 89, 69, 68, 89, 75, 60, 63, 61, 89, 89,
/* 30 */ 71, 59, 70, 58, 89, 74, 86, 85, 88, 65,
/* 40 */ 67, 87, 64, 78, 66, 80, 73, 79, 77, 76,
/* 50 */ 82, 81, 57, 83, 84, 62, 72,
)
[line 522]
API Tags:
Access:  public


[ Top ]
static mixed   $yy_lookahead = array(
/* 0 */ 3, 3, 5, 5, 1, 8, 8, 5, 6, 2,
/* 10 */ 8, 5, 6, 13, 8, 3, 3, 5, 5, 19,
/* 20 */ 8, 8, 4, 5, 1, 2, 8, 10, 11, 12,
/* 30 */ 5, 4, 5, 5, 13, 8, 8, 18, 5, 20,
/* 40 */ 19, 8, 5, 6, 18, 5, 20, 18, 8, 20,
/* 50 */ 4, 1, 2, 7, 18, 7, 20, 13, 1, 2,
/* 60 */ 5, 14, 15, 19, 5, 6, 13, 1, 1, 1,
/* 70 */ 16, 20, 19, 3, 2, 17, 12, 4, 17, 2,
)
[line 439]
API Tags:
Access:  public


[ Top ]
static mixed   $yy_reduce_ofst = array(
/* 0 */ 17, 29, 19, 26, 21, 36, 53, 44, 47, 0,
/* 10 */ 51, 51, 51, 51, 54, 58, 61, 64,
)
[line 459]
API Tags:
Access:  public


[ Top ]
static mixed   $yy_shift_ofst = array(
/* 0 */ 23, 27, 18, 28, 50, 28, 57, 72, 73, 72,
/* 10 */ 13, 12, -3, -2, 46, 40, 40, 77, 2, 6,
/* 20 */ 59, 33, 33, 37, 3, 7, 48, 7, 70, 55,
/* 30 */ 68, 7, 67, 7, 25, 66,
)
[line 451]
API Tags:
Access:  public


[ Top ]
mixed   $transTable = array(
1 => self::PHPCODE,
2 => self::COMMENTSTART,
3 => self::COMMENTEND,
4 => self::QUOTE,
5 => self::PATTERN,
6 => self::CODE,
7 => self::SUBPATTERN,
8 => self::PI,
)
[line 186]
API Tags:
Access:  public


[ Top ]
int   $yyerrcnt [line 619]
API Tags:
Access:  public


[ Top ]
int   $yyidx [line 615]
API Tags:
Access:  public


[ Top ]
array   $yystack = array() [line 623]
API Tags:
Access:  public


[ Top ]
Methods
static method PrintTrace  [line 597]

  static void PrintTrace( )

Output debug information to output (php://output stream)



[ Top ]
static method Trace  [line 583]

  static void Trace( resource $TraceFILE, string $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

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.

Parameters:
resource   $TraceFILE: 
string   $zTracePrompt: 


[ Top ]
static method yy_destructor  [line 702]

  static void yy_destructor( int $yymajor, mixed $yypminor  )

The following function deletes the value associated with a symbol. The symbol can be either a terminal or nonterminal.

Parameters:
int   $yymajor:  the symbol code
mixed   $yypminor:  the symbol's value


[ Top ]
Constructor __construct  [line 197]

  PHP_LexerGenerator_Parser __construct( $outfile, $lex  )

Parameters:
   $outfile: 
   $lex: 


[ Top ]
Destructor __destruct  [line 750]

  void __destruct( )

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



[ Top ]
doParse  [line 1650]

  void doParse( int $yymajor, mixed $yytokenvalue, mixed 2  )

The main parser program.

The first argument is the major token number. The second is the token value string as scanned from the input.

Parameters:
mixed   2:  any extra arguments that should be passed to handlers
int   $yymajor:  the token number
mixed   $yytokenvalue:  the token value


[ Top ]
error  [line 334]

  void error( $msg  )

Parameters:
   $msg: 


[ Top ]
outputRules  [line 208]

  void outputRules( $rules, $statename  )

Parameters:
   $rules: 
   $statename: 


[ Top ]
tokenName  [line 684]

  string tokenName( int $tokenType  )

This function returns the symbolic name associated with a token value.

Parameters:
int   $tokenType: 


[ Top ]
yy_accept  [line 1628]

  void yy_accept( )

The following is executed when the parser accepts

%parse_accept code is inserted here



[ Top ]
yy_find_reduce_action  [line 963]

  void yy_find_reduce_action( int $stateno, int $iLookAhead  )

Find the appropriate action for a parser given the non-terminal look-ahead token $iLookAhead.

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.

Parameters:
int   $stateno:  Current state number
int   $iLookAhead:  The look-ahead token


[ Top ]
yy_find_shift_action  [line 919]

  void yy_find_shift_action( int $iLookAhead  )

Find the appropriate action for a parser given the terminal look-ahead token iLookAhead.

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.

Parameters:
int   $iLookAhead:  The look-ahead token


[ Top ]
yy_get_expected_tokens  [line 766]

  array yy_get_expected_tokens( int $token  )

Based on the current state and parser stack, get a list of all

possible lookahead tokens

Parameters:
int   $token: 


[ Top ]
yy_is_expected_token  [line 841]

  bool yy_is_expected_token( int $token  )

Based on the parser state and current parser stack, determine whether the lookahead token is possible.

The parser will convert the token value to an error token if not. This catches some unusual edge cases where the parser would fail.

Parameters:
int   $token: 


[ Top ]
yy_parse_failed  [line 1587]

  void yy_parse_failed( )

The following code executes when the parse fails

Code from %parse_fail is inserted here



[ Top ]
yy_pop_parser_stack  [line 729]

  int yy_pop_parser_stack( PHP_LexerGenerator_ParseryyParser 0  )

Pop the parser's stack once.

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.

Parameters:
PHP_LexerGenerator_ParseryyParser   0: 


[ Top ]
yy_r1  [line 1118]

  void yy_r1( )



[ Top ]
yy_r2  [line 1154]

  void yy_r2( )



[ Top ]
yy_r3  [line 1193]

  void yy_r3( )



[ Top ]
yy_r4  [line 1232]

  void yy_r4( )



[ Top ]
yy_r5  [line 1274]

  void yy_r5( )



[ Top ]
yy_r6  [line 1281]

  void yy_r6( )



[ Top ]
yy_r7  [line 1319]

  void yy_r7( )



[ Top ]
yy_r9  [line 1324]

  void yy_r9( )



[ Top ]
yy_r11  [line 1330]

  void yy_r11( )



[ Top ]
yy_r12  [line 1337]

  void yy_r12( )



[ Top ]
yy_r13  [line 1349]

  void yy_r13( )



[ Top ]
yy_r14  [line 1354]

  void yy_r14( )



[ Top ]
yy_r15  [line 1363]

  void yy_r15( )



[ Top ]
yy_r16  [line 1368]

  void yy_r16( )



[ Top ]
yy_r17  [line 1378]

  void yy_r17( )



[ Top ]
yy_r18  [line 1385]

  void yy_r18( )



[ Top ]
yy_r19  [line 1395]

  void yy_r19( )



[ Top ]
yy_r20  [line 1401]

  void yy_r20( )



[ Top ]
yy_r21  [line 1411]

  void yy_r21( )



[ Top ]
yy_r22  [line 1417]

  void yy_r22( )



[ Top ]
yy_r23  [line 1429]

  void yy_r23( )



[ Top ]
yy_r24  [line 1442]

  void yy_r24( )



[ Top ]
yy_r25  [line 1447]

  void yy_r25( )



[ Top ]
yy_r26  [line 1456]

  void yy_r26( )



[ Top ]
yy_r27  [line 1461]

  void yy_r27( )



[ Top ]
yy_r28  [line 1470]

  void yy_r28( )



[ Top ]
yy_r29  [line 1475]

  void yy_r29( )



[ Top ]
yy_r30  [line 1484]

  void yy_r30( )



[ Top ]
yy_r31  [line 1489]

  void yy_r31( )



[ Top ]
yy_reduce  [line 1532]

  void yy_reduce( int $yyruleno  )

Perform a reduce action and the shift that must immediately follow the 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)

Parameters:
int   $yyruleno:  Number of the rule by which to reduce


[ Top ]
yy_shift  [line 992]

  void yy_shift( int $yyNewState, int $yyMajor, mixed $yypMinor  )

Perform a shift action.

Parameters:
int   $yyNewState:  The new state to shift in
int   $yyMajor:  The major token to shift in
mixed   $yypMinor:  the minor token to shift in


[ Top ]
yy_syntax_error  [line 1606]

  void yy_syntax_error( int $yymajor, mixed $TOKEN  )

The following code executes when a syntax error first occurs.

%syntax_error code is inserted here

Parameters:
int   $yymajor:  The major type of the error token
mixed   $TOKEN:  The minor type of the error token


[ Top ]
_validatePattern  [line 339]

  void _validatePattern( $pattern, [ $update = false]  )

Parameters:
   $pattern: 
   $update: 


[ Top ]
Constants
CODE = 6 [line 371]

[ Top ]
COMMENTEND = 3 [line 368]

[ Top ]
COMMENTSTART = 2 [line 367]

[ Top ]
PATTERN = 7 [line 372]

[ Top ]
PHPCODE = 1 [line 366]

[ Top ]
PI = 4 [line 369]

[ Top ]
QUOTE = 8 [line 373]

[ Top ]
SUBPATTERN = 5 [line 370]

[ Top ]
YYERRORSYMBOL = 9 [line 549]

[ Top ]
YYERRSYMDT = 'yy0' [line 550]

[ Top ]
YYFALLBACK = 0 [line 551]

[ Top ]
YYNOCODE = 22 [line 545]

[ Top ]
YYNRULE = 32 [line 548]

[ Top ]
YYNSTATE = 57 [line 547]

[ Top ]
YYSTACKDEPTH = 100 [line 546]

[ Top ]
YY_ACCEPT_ACTION = 90 [line 375]

[ Top ]
YY_ERROR_ACTION = 89 [line 376]

[ Top ]
YY_NO_ACTION = 91 [line 374]

[ Top ]
YY_REDUCE_MAX = 17 [line 458]

[ Top ]
YY_REDUCE_USE_DFLT = -1 [line 457]

[ Top ]
YY_SHIFT_MAX = 35 [line 450]

[ Top ]
YY_SHIFT_USE_DFLT = -4 [line 449]

[ Top ]
YY_SZ_ACTTAB = 80 [line 428]

[ Top ]

Documentation generated on Sun, 02 Jul 2006 08:51:39 -0400 by phpDocumentor 1.3.0