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

Class: PHP_ParserGenerator_Parser

Source Location: /ParserGenerator/Parser.php

Class PHP_ParserGenerator_Parser

Class Overview

The grammar parser for lemon grammar files.

Located in /ParserGenerator/Parser.php [line 33]



		
				Author(s):
		
		
		
Information Tags:
Since:  Class available since Release 0.1.0
License:  PHP License 3.01
Copyright:  2006 Gregory Beaver

Properties

Methods

[ Top ]
Property Summary
array   $alias   Aliases for each RHS symbol name (or NULL)
mixed   $declargslot   Where the declaration argument should be put
mixed   $declassoc  
string   $declkeyword   Keyword of a declaration
mixed   $decllnslot   Where the declaration linenumber is put
int   $errorcnt   Number of parsing errors so far
PHP_ParserGenerator_Symbol   $fallback   The fallback token
string   $filename   Name of the input file
PHP_ParserGenerator_Rule   $firstrule  
PHP_ParserGenerator_Data   $gp   Global state vector
PHP_ParserGenerator_Rule   $lastrule  
PHP_ParserGenerator_Symbol   $lhs   Left-hand side of the current rule
string   $lhsalias   Alias for the LHS
int   $nrhs   Number of right-hand side symbols seen
mixed   $preccounter  
PHP_ParserGenerator_Rule   $prevrule   Previous rule parsed
array   $rhs   Right-hand side symbols
int   $state   Parser state (one of the class constants for this class)
int   $tokenlineno   Linenumber at which current token starts
int   $tokenstart   Index of current token within the input string

[ Top ]
Method Summary
PHP_ParserGenerator_Parser   __construct()  
void   Parse()   In spite of its name, this function is really a scanner.
void   parseonetoken()   Parse a single token

[ Top ]
Properties
array   $alias = array() [line 135]

Aliases for each RHS symbol name (or NULL)

API Tags:
Access:  public


[ Top ]
mixed   $declargslot = array() [line 154]

Where the declaration argument should be put

This is assigned as a reference to an internal variable

API Tags:
Access:  public


[ Top ]
mixed   $declassoc [line 163]
API Tags:
Access:  public


[ Top ]
string   $declkeyword [line 147]

Keyword of a declaration

This is one of the %keyword keywords in the grammar file

API Tags:
Access:  public


[ Top ]
mixed   $decllnslot [line 161]

Where the declaration linenumber is put

This is assigned as a reference to an internal variable

API Tags:
Access:  public


[ Top ]
int   $errorcnt [line 70]

Number of parsing errors so far

API Tags:
Access:  public


[ Top ]
PHP_ParserGenerator_Symbol   $fallback [line 110]

The fallback token

API Tags:
Access:  public


[ Top ]
string   $filename [line 60]

Name of the input file

API Tags:
Access:  public


[ Top ]
PHP_ParserGenerator_Rule   $firstrule [line 168]
API Tags:
Access:  public


[ Top ]
PHP_ParserGenerator_Data   $gp [line 80]

Global state vector

API Tags:
Access:  public


[ Top ]
PHP_ParserGenerator_Rule   $lastrule [line 172]
API Tags:
Access:  public


[ Top ]

Left-hand side of the current rule

API Tags:
Access:  public


[ Top ]
string   $lhsalias [line 120]

Alias for the LHS

API Tags:
Access:  public


[ Top ]
int   $nrhs [line 125]

Number of right-hand side symbols seen

API Tags:
Access:  public


[ Top ]
mixed   $preccounter [line 164]
API Tags:
Access:  public


[ Top ]
PHP_ParserGenerator_Rule   $prevrule [line 140]

Previous rule parsed

API Tags:
Access:  public


[ Top ]
array   $rhs = array() [line 130]

Right-hand side symbols

API Tags:
Access:  public


[ Top ]
int   $state [line 105]

Parser state (one of the class constants for this class)

  • PHP_ParserGenerator_Parser::INITIALIZE,
  • PHP_ParserGenerator_Parser::WAITING_FOR_DECL_OR_RULE,
  • PHP_ParserGenerator_Parser::WAITING_FOR_DECL_KEYWORD,
  • PHP_ParserGenerator_Parser::WAITING_FOR_DECL_ARG,
  • PHP_ParserGenerator_Parser::WAITING_FOR_PRECEDENCE_SYMBOL,
  • PHP_ParserGenerator_Parser::WAITING_FOR_ARROW,
  • PHP_ParserGenerator_Parser::IN_RHS,
  • PHP_ParserGenerator_Parser::LHS_ALIAS_1,
  • PHP_ParserGenerator_Parser::LHS_ALIAS_2,
  • PHP_ParserGenerator_Parser::LHS_ALIAS_3,
  • PHP_ParserGenerator_Parser::RHS_ALIAS_1,
  • PHP_ParserGenerator_Parser::RHS_ALIAS_2,
  • PHP_ParserGenerator_Parser::PRECEDENCE_MARK_1,
  • PHP_ParserGenerator_Parser::PRECEDENCE_MARK_2,
  • PHP_ParserGenerator_Parser::RESYNC_AFTER_RULE_ERROR,
  • PHP_ParserGenerator_Parser::RESYNC_AFTER_DECL_ERROR,
  • PHP_ParserGenerator_Parser::WAITING_FOR_DESTRUCTOR_SYMBOL,
  • PHP_ParserGenerator_Parser::WAITING_FOR_DATATYPE_SYMBOL,
  • PHP_ParserGenerator_Parser::WAITING_FOR_FALLBACK_ID

API Tags:
Access:  public


[ Top ]
int   $tokenlineno [line 65]

Linenumber at which current token starts

API Tags:
Access:  public


[ Top ]
int   $tokenstart [line 75]

Index of current token within the input string

API Tags:
Access:  public


[ Top ]
Methods
Constructor __construct  [line 179]

  PHP_ParserGenerator_Parser __construct( PHP_ParserGenerator $lem  )

Parameters:
PHP_ParserGenerator   $lem: 


[ Top ]
Parse  [line 255]

  void Parse( PHP_ParserGenerator_Data $gp  )

In spite of its name, this function is really a scanner.

It reads in the entire input file (all at once) then tokenizes it. Each token is passed to the function "parseonetoken" which builds all the appropriate data structures in the global state vector "gp".

Parameters:
PHP_ParserGenerator_Data   $gp: 


[ Top ]
parseonetoken  [line 412]

  void parseonetoken( string $token  )

Parse a single token

Parameters:
string   $token:  token


[ Top ]
Constants
INITIALIZE = 1 [line 35]

[ Top ]
IN_RHS = 7 [line 41]

[ Top ]
LHS_ALIAS_1 = 8 [line 42]

[ Top ]
LHS_ALIAS_2 = 9 [line 43]

[ Top ]
LHS_ALIAS_3 = 10 [line 44]

[ Top ]
PRECEDENCE_MARK_1 = 13 [line 47]

[ Top ]
PRECEDENCE_MARK_2 = 14 [line 48]

[ Top ]
RESYNC_AFTER_DECL_ERROR = 16 [line 50]

[ Top ]
RESYNC_AFTER_RULE_ERROR = 15 [line 49]

[ Top ]
RHS_ALIAS_1 = 11 [line 45]

[ Top ]
RHS_ALIAS_2 = 12 [line 46]

[ Top ]
WAITING_FOR_ARROW = 6 [line 40]

[ Top ]
WAITING_FOR_DATATYPE_SYMBOL = 18 [line 52]

[ Top ]
WAITING_FOR_DECL_ARG = 4 [line 38]

[ Top ]
WAITING_FOR_DECL_KEYWORD = 3 [line 37]

[ Top ]
WAITING_FOR_DECL_OR_RULE = 2 [line 36]

[ Top ]
WAITING_FOR_DESTRUCTOR_SYMBOL = 17 [line 51]

[ Top ]
WAITING_FOR_FALLBACK_ID = 19 [line 53]

[ Top ]
WAITING_FOR_PRECEDENCE_SYMBOL = 5 [line 39]

[ Top ]

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