PHP_ParserGenerator
[ class tree: PHP_ParserGenerator ] [ index: PHP_ParserGenerator ] [ all elements ]

File: Lempar.php

Source Location: /PHP_ParserGenerator-0.1.7/Lempar.php

Classes:

ParseyyToken
This can be used to store both the string representation of a token, and any useful meta-data associated with the token.
ParseyyStackEntry
The following structure represents a single element of the parser's stack. Information stored includes:

Page Details:


doParse [line 803]

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

int   $yymajor   the token number
mixed   $yytokenvalue   the token value
mixed   2   ... any extra arguments that should be passed to handlers
[ Top ]



PrintTrace [line 230]

void PrintTrace( )

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


[ Top ]



tokenName [line 281]

string tokenName( int $tokenType)

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


Parameters

int   $tokenType  
[ Top ]



Trace [line 216]

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 ]



yy_accept [line 778]

void yy_accept( )

The following is executed when the parser accepts

%parse_accept code is inserted here



[ Top ]



yy_destructor [line 299]

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 ]



yy_find_reduce_action [line 563]

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 519]

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 364]

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 439]

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 748]

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 327]

int yy_pop_parser_stack( ParseyyParser 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

ParseyyParser   0  
[ Top ]



yy_reduce [line 693]

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 592]

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 768]

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 ]



__destruct [line 348]

void __destruct( )

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


[ Top ]



Documentation generated on Mon, 25 Oct 2010 14:00:44 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.