Methods

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

PrintTrace() 

Turn parser tracing on by giving a stream to which to write the trace and a prompt to preface each trace message.

Trace($TraceFILE, $zTracePrompt) 

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

$TraceFILE

resource

$zTracePrompt

string

Deallocate and destroy a parser.

__destruct() 

Destructors are all called for all stack elements before shutting the parser down.

The main parser program.

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

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

Parameters

$yymajor

int

the token number

$yytokenvalue

mixed

the token value

getOutput()

getOutput() 

setLineNumber()

setLineNumber($lineNumber) 

Parameters

$lineNumber

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

tokenName($tokenType) : string

Parameters

$tokenType

int

Returns

string

The following is executed when the parser accepts

yy_accept() 

%parse_accept code is inserted here

The following function deletes the value associated with a symbol.

yy_destructor(int $yymajor, mixed $yypminor) 

The symbol can be either a terminal or nonterminal.

Parameters

$yymajor

int

the symbol code

$yypminor

mixed

the symbol's value

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

yy_find_reduce_action(int $stateno, int $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

$stateno

int

Current state number

$iLookAhead

int

The look-ahead token

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

yy_find_shift_action(int $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

$iLookAhead

int

The look-ahead token

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

yy_get_expected_tokens($token) : array

Parameters

$token

int

Returns

array

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

yy_is_expected_token($token) : bool

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

$token

int

Returns

bool

The following code executes when the parse fails

yy_parse_failed() 

Code from %parse_fail is inserted here

Pop the parser's stack once.

yy_pop_parser_stack() : int

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.

Returns

int

yy_r1()

yy_r1() 

yy_r12()

yy_r12() 

yy_r14()

yy_r14() 

yy_r15()

yy_r15() 

yy_r18()

yy_r18() 

yy_r19()

yy_r19() 

yy_r26()

yy_r26() 

yy_r28()

yy_r28() 

yy_r3()

yy_r3() 

yy_r5()

yy_r5() 

yy_r7()

yy_r7() 

yy_r8()

yy_r8() 

yy_r9()

yy_r9() 

Perform a reduce action and the shift that must immediately follow the reduce.

yy_reduce(int $yyruleno) 

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

$yyruleno

int

Number of the rule by which to reduce

Perform a shift action.

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

Parameters

$yyNewState

int

The new state to shift in

$yyMajor

int

The major token to shift in

$yypMinor

mixed

the minor token to shift in

The following code executes when a syntax error first occurs.

yy_syntax_error(int $yymajor, mixed $TOKEN) 

%syntax_error code is inserted here

Parameters

$yymajor

int

The major type of the error token

$TOKEN

mixed

The minor type of the error token

_addOp()

_addOp($op) 

Parameters

$op

_getSimpleVariable()

_getSimpleVariable($var) 

Parameters

$var

_popTagContext()

_popTagContext($tag) 

Parameters

$tag

_pushTagContext()

_pushTagContext($tag) 

Parameters

$tag

 Properties

 

$yyExpectedTokens

$yyExpectedTokens 

 

The next table maps tokens into fallback tokens.

$yyFallback 

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.

 

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

$yyReduceMap 

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

 

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

$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
 ),...
);

 

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

$yyRuleName : array

 

For tracing shifts, the names of all terminals and nonterminals are required.

$yyTokenName : array

The following table supplies these names

 

$yyTraceFILE

$yyTraceFILE : resource | \global\0

 

String to prepend to debug output

$yyTracePrompt : string | \global\0

 

$yy_action

$yy_action 

 

$yy_default

$yy_default 

 

$yy_lookahead

$yy_lookahead 

 

$yy_reduce_ofst

$yy_reduce_ofst 

 

$yy_shift_ofst

$yy_shift_ofst 

 

$yyerrcnt

$yyerrcnt : int

 

$yyidx

$yyidx : int

 

$yystack

$yystack : array

 

$_context

$_context 

 

$_contextKey

$_contextKey 

 

$_lastPlainText

$_lastPlainText 

 

$_lineNumber

$_lineNumber 

 

$_tagList

$_tagList 

 

placeholder for the left hand side in a reduce operation.

$_retvalue 

For a parser with a rule like this:

rule(A) ::= B. { A = 1; }

The parser will translate to something like:

function yy_r0(){$this->_retvalue = 1;}

 Constants

 

CURLY_ARG_SEP

CURLY_ARG_SEP 

 

CURLY_ARRAY_DIM

CURLY_ARRAY_DIM 

 

CURLY_END

CURLY_END 

 

CURLY_FUNCTION

CURLY_FUNCTION 

 

CURLY_VAR

CURLY_VAR 

 

CURLY_VAR_KEY

CURLY_VAR_KEY 

 

DOUBLE_QUOTE

DOUBLE_QUOTE 

 

LITERAL

LITERAL 

 

PLAIN_TEXT

PLAIN_TEXT 

 

SIMPLE_VARIABLE

SIMPLE_VARIABLE 

 

SINGLE_QUOTE

SINGLE_QUOTE 

 

TAG_ATTRIBUTE

TAG_ATTRIBUTE 

 

TAG_CLOSE

TAG_CLOSE 

 

TAG_COMMENT

TAG_COMMENT 

 

TAG_END

TAG_END 

 

TAG_OPEN

TAG_OPEN 

 

TAG_SELF_CLOSE

TAG_SELF_CLOSE 

 

YYERRORSYMBOL

YYERRORSYMBOL 

 

YYERRSYMDT

YYERRSYMDT 

 

YYFALLBACK

YYFALLBACK 

 

YYNOCODE

YYNOCODE 

 

YYNRULE

YYNRULE 

 

YYNSTATE

YYNSTATE 

 

YYSTACKDEPTH

YYSTACKDEPTH 

 

YY_ACCEPT_ACTION

YY_ACCEPT_ACTION 

 

YY_ERROR_ACTION

YY_ERROR_ACTION 

 

YY_NO_ACTION

YY_NO_ACTION 

 

YY_REDUCE_MAX

YY_REDUCE_MAX 

 

YY_REDUCE_USE_DFLT

YY_REDUCE_USE_DFLT 

 

YY_SHIFT_MAX

YY_SHIFT_MAX 

 

YY_SHIFT_USE_DFLT

YY_SHIFT_USE_DFLT 

 

YY_SZ_ACTTAB

YY_SZ_ACTTAB