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

Class: PHP_ParserGenerator_Data

Source Location: /PHP_ParserGenerator-0.1.7/ParserGenerator/Data.php

Class Overview


The state vector for the entire parser generator is recorded in this class.


Author(s):

Version:

  • @package_version@

Copyright:

  • 2006 Gregory Beaver

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 61]
The state vector for the entire parser generator is recorded in this class.
  • Author: Gregory Beaver <cellog@php.net>
  • Version: @package_version@
  • Copyright: 2006 Gregory Beaver
  • Since: Class available since Release 0.1.0
  • License: New BSD License


[ Top ]


Class Variables

$accept =

[line 225]

Code to execute when the parser acccepts (completes parsing)

This is set by the %parse_accept directive

  • Access: public

Type:   string


[ Top ]

$acceptln =

[line 230]

Line number for the start of accept code
  • Access: public

Type:   int


[ Top ]

$argv0 =

[line 310]

Name of the program
  • Access: public

Type:   string


[ Top ]

$basisflag =

[line 300]

Public only basis configurations
  • Access: public

Type:   mixed


[ Top ]

$declare_classcode =

[line 178]

Line number for class declaration code
  • Access: public

Type:   int


[ Top ]

$declare_classln =

[line 183]

Line number for start of class declaration code
  • Access: public

Type:   int


[ Top ]

$error =

[line 190]

Code to execute when a syntax error is seen

This is set by the %syntax_error directive

  • Access: public

Type:   string


[ Top ]

$errorcnt =

[line 107]

Number of errors
  • Access: public

Type:   int


[ Top ]

$errorln =

[line 195]

Line number for start of error code
  • Access: public

Type:   int


[ Top ]

$errsym =

[line 112]

The error symbol
  • Access: public



[ Top ]

$extracode =

[line 237]

Code appended to the generated file

This is set by the %code directive

  • Access: public

Type:   string


[ Top ]

$extracodeln =

[line 242]

Line number for the start of the extra code
  • Access: public

Type:   int


[ Top ]

$failure =

[line 213]

Code to execute on parser failure

This is set by the %parse_failure directive

  • Access: public

Type:   string


[ Top ]

$failureln =

[line 218]

Line number for start of failure code
  • Access: public

Type:   int


[ Top ]

$filename =

[line 271]

Name of the input file
  • Access: public

Type:   string


[ Top ]

$filenosuffix =

[line 276]

Name of the input file without its extension
  • Access: public

Type:   string


[ Top ]

$has_fallback =

[line 305]

True if any %fallback is seen in the grammer
  • Access: public

Type:   boolean


[ Top ]

$includeln =

[line 155]

Line number for start of include code
  • Access: public

Type:   int


[ Top ]

$include_classcode =

[line 162]

Code to put in the parser class

This is set by the %include_class directive

  • Access: public

Type:   string


[ Top ]

$include_classln =

[line 167]

Line number for start of include code
  • Access: public

Type:   int


[ Top ]

$include_code =

[line 150]

Code to put at the start of the parser file

This is set by the %include directive

  • Access: public

Type:   string


[ Top ]

$name =

[line 117]

Name of the generated parser
  • Access: public

Type:   string


[ Top ]

$nconflict =

[line 291]

Number of parsing conflicts
  • Access: public

Type:   int


[ Top ]

$nrule =

[line 87]

Number of rules
  • Access: public

Type:   int


[ Top ]

$nstate =

[line 82]

Number of states
  • Access: public

Type:   int


[ Top ]

$nsymbol =

[line 92]

Number of terminal and nonterminal symbols
  • Access: public

Type:   int


[ Top ]

$nterminal =

[line 97]

Number of terminal symbols (tokens)
  • Access: public

Type:   int


[ Top ]

$outname =

[line 281]

Name of the current output file
  • Access: public

Type:   string


[ Top ]

$overflow =

[line 201]

Code to execute on a stack overflow

This is set by the %stack_overflow directive

  • Access: public

Type:   mixed


[ Top ]

$overflowln =

[line 206]

Line number for start of overflow code
  • Access: public

Type:   int


[ Top ]

$parser_template =  ""

[line 316]

Alternate parser template file
  • Access: public

Type:   string


[ Top ]

$rule =

[line 77]

List of all rules
  • Access: public



[ Top ]

$sorted =

[line 72]

Table of states sorted by state number

Type:   array


[ Top ]

$stacksize =

[line 143]

Size of the parser stack

This is 100 by default, but is set with the %stack_size directive

  • Access: public

Type:   int


[ Top ]

$start =

[line 136]

Name of the start symbol for the grammar
  • Access: public

Type:   string


[ Top ]

$symbols = array()

[line 102]

Sorted array of pointers to symbols

Type:   array


[ Top ]

$tablesize =

[line 296]

Size of the parse tables
  • Access: public

Type:   int


[ Top ]

$tokendest =

[line 249]

Code to execute to destroy token data

This is set by the %token_destructor directive

  • Access: public

Type:   string


[ Top ]

$tokendestln =

[line 254]

Line number for token destroyer code
  • Access: public

Type:   int


[ Top ]

$tokenprefix =

[line 286]

A prefix added to token names
  • Access: public

Type:   string


[ Top ]

$tokentype =

[line 124]

Unused relic from the C version

Type of terminal symbols in the parser stack

  • Access: public

Type:   string


[ Top ]

$vardest =

[line 261]

Code for the default non-terminal destructor

This is set by the %default_destructor directive

  • Access: public

Type:   string


[ Top ]

$vardestln =

[line 266]

Line number for default non-terminal destructor code
  • Access: public

Type:   int


[ Top ]

$vartype =

[line 131]

Unused relic from the C version

The default type of non-terminal symbols

  • Access: public

Type:   string


[ Top ]



Method Detail

append_str   [line 1682]

void append_str( string $zText, int $n)

Append text to a dynamically allocated string. If zText is 0 then reset the string to be empty again. Always return the complete text of the string (which is overwritten with each call).

n bytes of zText are stored. If n==0 then all of zText is stored.

If n==-1, then the previous character is overwritten.


Parameters:

string   $zText     
int   $n     

[ Top ]

axset_compare   [line 1853]

void axset_compare( $a, $b)

Compare to axset structures for sorting purposes

Parameters:

   $a     
   $b     

[ Top ]

CompressTables   [line 798]

void CompressTables( )

Reduce the size of the action tables, if possible, by making use of defaults.

In this version, we take the most frequent REDUCE action and make it the default.


[ Top ]

compute_action   [line 898]

void compute_action( PHP_ParserGenerator_Action $ap)

Given an action, compute the integer value for that action which is to be put in the action table of the generated machine.

Return negative if no action should be generated.


Parameters:

PHP_ParserGenerator_Action   $ap     

[ Top ]

emit_code   [line 1656]

void emit_code( $out, PHP_ParserGenerator_Rule $rp, &$lineno)

Generate code which executes when the rule "rp" is reduced. Write the code to "out". Make sure lineno stays up-to-date.

Parameters:

   $out     
PHP_ParserGenerator_Rule   $rp     
   &$lineno     

[ Top ]

emit_destructor_code   [line 1804]

void emit_destructor_code( $out, PHP_ParserGenerator_Symbol $sp, &$lineno)

The following routine emits code for the destructor for the

symbol sp


Parameters:

   $out     
PHP_ParserGenerator_Symbol   $sp     
   &$lineno     

[ Top ]

FindActions   [line 632]

void FindActions( )

Compute the reduce actions, and resolve conflicts.

[ Top ]

FindFirstSets   [line 354]

void FindFirstSets( )

Find all nonterminals which will generate the empty string.

Then go back and compute the first sets of every nonterminal. The first set is the set of all terminal symbols which can begin a string generated by that nonterminal.


[ Top ]

FindFollowSets   [line 1066]

void FindFollowSets( )

Compute all followsets.

A followset is the set of all symbols which can come immediately after a configuration.


[ Top ]

FindLinks   [line 607]

void FindLinks( )

Construct the propagation links

[ Top ]

FindRulePrecedences   [line 327]

void FindRulePrecedences( )


[ Top ]

FindStates   [line 427]

void FindStates( )

Compute all LR(0) states for the grammar. Links are added to between some states so that the LR(1) follow sets can be computed later.

[ Top ]

ReportOutput   [line 923]

void ReportOutput( )

Generate the "Parse.out" log file

[ Top ]

ReportTable   [line 1099]

void ReportTable( int $mhflag)

Generate C source code for the parser

Parameters:

int   $mhflag     Output in makeheaders format if true

[ Top ]

resolve_conflict   [line 728]

void resolve_conflict( PHP_ParserGenerator_Action $apx, PHP_ParserGenerator_Action $apy, PHP_ParserGenerator_Symbol|null $errsym)

Resolve a conflict between the two given actions. If the conflict can't be resolve, return non-zero.

NO LONGER TRUE: To resolve a conflict, first look to see if either action is on an error rule. In that case, take the action which is not associated with the error rule. If neither or both actions are associated with an error rule, then try to use precedence to resolve the conflict.

If either action is a SHIFT, then it must be apx. This function won't work if apx->type==REDUCE and apy->type==SHIFT.


Parameters:

PHP_ParserGenerator_Action   $apx     
PHP_ParserGenerator_Action   $apy     
PHP_ParserGenerator_Symbol|null   $errsym     The error symbol (if defined. NULL otherwise)

[ Top ]

ResortStates   [line 862]

void ResortStates( )

Renumber and resort states so that states with fewer choices occur at the end. Except, keep state 0 as the first state.

[ Top ]

translate_code   [line 1714]

void translate_code( PHP_ParserGenerator_Rule $rp)

zCode is a string that is the action associated with a rule. Expand the symbols in this string so that the refer to elements of the parser stack.

Parameters:

PHP_ParserGenerator_Rule   $rp     

[ Top ]


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