[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Source view] [Print] [Project Stats]
PHP_ParserGenerator, a php 5 parser generator. This is a direct port of the Lemon parser generator, found at {@link http://www.hwaci.com/sw/lemon/}
Author: | Gregory Beaver <[email protected]> |
Copyright: | 2006 Gregory Beaver |
License: | http://www.php.net/license/3_01.txt PHP License 3.01 |
Version: | CVS: $Id$ |
File Size: | 1825 lines (67 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
PHP_ParserGenerator_Data:: (23 methods):
FindRulePrecedences()
FindFirstSets()
FindStates()
getstate()
buildshifts()
FindLinks()
FindActions()
resolve_conflict()
CompressTables()
ResortStates()
compute_action()
ReportOutput()
tplt_open()
tplt_xfer()
tplt_linedir()
tplt_print()
FindFollowSets()
ReportTable()
emit_code()
append_str()
translate_code()
emit_destructor_code()
axset_compare()
Class: PHP_ParserGenerator_Data - X-Ref
The state vector for the entire parser generator is recorded inFindRulePrecedences() X-Ref |
No description |
FindFirstSets() X-Ref |
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. |
FindStates() X-Ref |
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. |
getstate() X-Ref |
return: PHP_ParserGenerator_State |
buildshifts(PHP_ParserGenerator_State $stp) X-Ref |
Construct all successor states to the given state. A "successor" state is any state which can be reached by a shift action. param: PHP_ParserGenerator_Data param: PHP_ParserGenerator_State The state from which successors are computed |
FindLinks() X-Ref |
Construct the propagation links |
FindActions() X-Ref |
Compute the reduce actions, and resolve conflicts. |
resolve_conflict($apx, $apy, $errsym) X-Ref |
No description |
CompressTables() X-Ref |
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. |
ResortStates() X-Ref |
Renumber and resort states so that states with fewer choices occur at the end. Except, keep state 0 as the first state. |
compute_action($ap) X-Ref |
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. param: PHP_ParserGenerator_Action |
ReportOutput() X-Ref |
Generate the "Parse.out" log file |
tplt_open() X-Ref |
The next function finds the template file and opens it, returning a pointer to the opened file. return: resource |
tplt_xfer($name, $in, $out, &$lineno) X-Ref |
The first function transfers data from "in" to "out" until a line is seen which begins with "%%". The line number is tracked. if name!=0, then any word that begin with "Parse" is changed to begin with *name instead. |
tplt_linedir($out, $lineno, $filename) X-Ref |
Print a #line directive line to the output file. |
tplt_print($out, $str, $strln, &$lineno) X-Ref |
Print a string to the file and keep the linenumber up to date |
FindFollowSets() X-Ref |
Compute all followsets. A followset is the set of all symbols which can come immediately after a configuration. |
ReportTable($mhflag) X-Ref |
Generate C source code for the parser param: int Output in makeheaders format if true |
emit_code($out, PHP_ParserGenerator_Rule $rp, &$lineno) X-Ref |
Generate code which executes when the rule "rp" is reduced. Write the code to "out". Make sure lineno stays up-to-date. |
append_str($zText, $n) X-Ref |
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. param: string param: int |
translate_code(PHP_ParserGenerator_Rule $rp) X-Ref |
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. |
emit_destructor_code($out, PHP_ParserGenerator_Symbol $sp, &$lineno) X-Ref |
The following routine emits code for the destructor for the symbol sp |
axset_compare($a, $b) X-Ref |
Compare to axset structures for sorting purposes |
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |