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

Class: PHP_ParserGenerator_Data

Source Location: /ParserGenerator/Data.php

Class PHP_ParserGenerator_Data

Constant Summary
NO_OFFSET   Used for terminal and non-terminal offsets into the action table

[ Top ]
Property Summary
string   $accept   Code to execute when the parser acccepts (completes parsing)
int   $acceptln   Line number for the start of accept code
string   $argv0   Name of the program
mixed   $basisflag   Public only basis configurations
int   $declare_classcode   Line number for class declaration code
int   $declare_classln   Line number for start of class declaration code
string   $error   Code to execute when a syntax error is seen
int   $errorcnt   Number of errors
int   $errorln   Line number for start of error code
PHP_ParserGenerator_Symbol   $errsym   The error symbol
string   $extracode   Code appended to the generated file
int   $extracodeln   Line number for the start of the extra code
string   $failure   Code to execute on parser failure
int   $failureln   Line number for start of failure code
string   $filename   Name of the input file
string   $filenosuffix   Name of the input file without its extension
boolean   $has_fallback   True if any %fallback is seen in the grammer
int   $includeln   Line number for start of include code
string   $include_classcode   Code to put in the parser class
int   $include_classln   Line number for start of include code
string   $include_code   Code to put at the start of the parser file
string   $name   Name of the generated parser
int   $nconflict   Number of parsing conflicts
int   $nrule   Number of rules
int   $nstate   Number of states
int   $nsymbol   Number of terminal and nonterminal symbols
int   $nterminal   Number of terminal symbols (tokens)
string   $outname   Name of the current output file
mixed   $overflow   Code to execute on a stack overflow
int   $overflowln   Line number for start of overflow code
PHP_ParserGenerator_Rule   $rule   List of all rules
array   $sorted   Table of states sorted by state number
int   $stacksize   Size of the parser stack
string   $start   Name of the start symbol for the grammar
array   $symbols   Sorted array of pointers to symbols
int   $tablesize   Size of the parse tables
string   $tokendest   Code to execute to destroy token data
int   $tokendestln   Line number for token destroyer code
string   $tokenprefix   A prefix added to token names
string   $tokentype   Unused relic from the C version
string   $vardest   Code for the default non-terminal destructor
int   $vardestln   Line number for default non-terminal destructor code
string   $vartype   Unused relic from the C version

[ Top ]
Method Summary
static void   axset_compare()   Compare to axset structures for sorting purposes
void   append_str()   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).
void   CompressTables()   Reduce the size of the action tables, if possible, by making use of defaults.
void   compute_action()   Given an action, compute the integer value for that action which is to be put in the action table of the generated machine.
void   emit_code()   Generate code which executes when the rule "rp" is reduced. Write the code to "out". Make sure lineno stays up-to-date.
void   emit_destructor_code()   The following routine emits code for the destructor for the
void   FindActions()   Compute the reduce actions, and resolve conflicts.
void   FindFirstSets()   Find all nonterminals which will generate the empty string.
void   FindFollowSets()   Compute all followsets.
void   FindLinks()   Construct the propagation links
void   FindRulePrecedences()  
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.
void   ReportOutput()   Generate the "Parse.out" log file
void   ReportTable()   Generate C source code for the parser
void   resolve_conflict()   Resolve a conflict between the two given actions. If the conflict can't be resolve, return non-zero.
void   ResortStates()   Renumber and resort states so that states with fewer choices occur at the end. Except, keep state 0 as the first state.
void   translate_code()   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.

[ Top ]
Properties
string   $accept [line 225]

Code to execute when the parser acccepts (completes parsing)

This is set by the %parse_accept directive

API Tags:
Access:  public


[ Top ]
int   $acceptln [line 230]

Line number for the start of accept code

API Tags:
Access:  public


[ Top ]
string   $argv0 [line 310]

Name of the program

API Tags:
Access:  public


[ Top ]
mixed   $basisflag [line 300]

Public only basis configurations

API Tags:
Access:  public


[ Top ]
int   $declare_classcode [line 178]

Line number for class declaration code

API Tags:
Access:  public


[ Top ]
int   $declare_classln [line 183]

Line number for start of class declaration code

API Tags:
Access:  public


[ Top ]
string   $error [line 190]

Code to execute when a syntax error is seen

This is set by the %syntax_error directive

API Tags:
Access:  public


[ Top ]
int   $errorcnt [line 107]

Number of errors

API Tags:
Access:  public


[ Top ]
int   $errorln [line 195]

Line number for start of error code

API Tags:
Access:  public


[ Top ]
PHP_ParserGenerator_Symbol   $errsym [line 112]

The error symbol

API Tags:
Access:  public


[ Top ]
string   $extracode [line 237]

Code appended to the generated file

This is set by the %code directive

API Tags:
Access:  public


[ Top ]
int   $extracodeln [line 242]

Line number for the start of the extra code

API Tags:
Access:  public


[ Top ]
string   $failure [line 213]

Code to execute on parser failure

This is set by the %parse_failure directive

API Tags:
Access:  public


[ Top ]
int   $failureln [line 218]

Line number for start of failure code

API Tags:
Access:  public


[ Top ]
string   $filename [line 271]

Name of the input file

API Tags:
Access:  public


[ Top ]
string   $filenosuffix [line 276]

Name of the input file without its extension

API Tags:
Access:  public


[ Top ]
boolean   $has_fallback [line 305]

True if any %fallback is seen in the grammer

API Tags:
Access:  public


[ Top ]
int   $includeln [line 155]

Line number for start of include code

API Tags:
Access:  public


[ Top ]
string   $include_classcode [line 162]

Code to put in the parser class

This is set by the %include_class directive

API Tags:
Access:  public


[ Top ]
int   $include_classln [line 167]

Line number for start of include code

API Tags:
Access:  public


[ Top ]
string   $include_code [line 150]

Code to put at the start of the parser file

This is set by the %include directive

API Tags:
Access:  public


[ Top ]
string   $name [line 117]

Name of the generated parser

API Tags:
Access:  public


[ Top ]
int   $nconflict [line 291]

Number of parsing conflicts

API Tags:
Access:  public


[ Top ]
int   $nrule [line 87]

Number of rules

API Tags:
Access:  public


[ Top ]
int   $nstate [line 82]

Number of states

API Tags:
Access:  public


[ Top ]
int   $nsymbol [line 92]

Number of terminal and nonterminal symbols

API Tags:
Access:  public


[ Top ]
int   $nterminal [line 97]

Number of terminal symbols (tokens)

API Tags:
Access:  public


[ Top ]
string   $outname [line 281]

Name of the current output file

API Tags:
Access:  public


[ Top ]
mixed   $overflow [line 201]

Code to execute on a stack overflow

This is set by the %stack_overflow directive

API Tags:
Access:  public


[ Top ]
int   $overflowln [line 206]

Line number for start of overflow code

API Tags:
Access:  public


[ Top ]
PHP_ParserGenerator_Rule   $rule [line 77]

List of all rules

API Tags:
Access:  public


[ Top ]
array   $sorted [line 72]

Table of states sorted by state number

API Tags:
Access:  public


[ Top ]
int   $stacksize [line 143]

Size of the parser stack

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

API Tags:
Access:  public


[ Top ]
string   $start [line 136]

Name of the start symbol for the grammar

API Tags:
Access:  public


[ Top ]
array   $symbols = array() [line 102]

Sorted array of pointers to symbols

API Tags:
Access:  public


[ Top ]
int   $tablesize [line 296]

Size of the parse tables

API Tags:
Access:  public


[ Top ]
string   $tokendest [line 249]

Code to execute to destroy token data

This is set by the %token_destructor directive

API Tags:
Access:  public


[ Top ]
int   $tokendestln [line 254]

Line number for token destroyer code

API Tags:
Access:  public


[ Top ]
string   $tokenprefix [line 286]

A prefix added to token names

API Tags:
Access:  public


[ Top ]
string   $tokentype [line 124]

Unused relic from the C version

Type of terminal symbols in the parser stack

API Tags:
Access:  public


[ Top ]
string   $vardest [line 261]

Code for the default non-terminal destructor

This is set by the %default_destructor directive

API Tags:
Access:  public


[ Top ]
int   $vardestln [line 266]

Line number for default non-terminal destructor code

API Tags:
Access:  public


[ Top ]
string   $vartype [line 131]

Unused relic from the C version

The default type of non-terminal symbols

API Tags:
Access:  public


[ Top ]
Methods
static method axset_compare  [line 1845]

  static void axset_compare( $a, $b  )

Compare to axset structures for sorting purposes

Parameters:
   $a: 
   $b: 


[ Top ]
append_str  [line 1670]

  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 ]
CompressTables  [line 787]

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

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

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

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

  void FindActions( )

Compute the reduce actions, and resolve conflicts.



[ Top ]
FindFirstSets  [line 348]

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

  void FindFollowSets( )

Compute all followsets.

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



[ Top ]
FindLinks  [line 601]

  void FindLinks( )

Construct the propagation links



[ Top ]
FindRulePrecedences  [line 321]

  void FindRulePrecedences( )



[ Top ]
FindStates  [line 421]

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

  void ReportOutput( )

Generate the "Parse.out" log file



[ Top ]
ReportTable  [line 1087]

  void ReportTable( int $mhflag  )

Generate C source code for the parser

Parameters:
int   $mhflag:  Output in makeheaders format if true


[ Top ]
resolve_conflict  [line 717]

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

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

  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 ]
Constants
NO_OFFSET = -2147483647 [line 67]

Used for terminal and non-terminal offsets into the action table

when their default should be used instead


[ Top ]

Documentation generated on Sun, 02 Jul 2006 09:11:00 -0400 by phpDocumentor 1.3.0