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

Class: PHP_ParserGenerator_Symbol

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

Class Overview


Symbols (terminals and nonterminals) of the grammar are stored in this class


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2006 Gregory Beaver

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 61]
Symbols (terminals and nonterminals) of the grammar are stored in this class


[ Top ]


Class Variables

$assoc =

[line 138]

Associativity if precedence is defined.

One of PHP_ParserGenerator_Symbol::LEFT, PHP_ParserGenerator_Symbol::RIGHT, PHP_ParserGenerator_Symbol::NONE or PHP_ParserGenerator_Symbol::UNK

  • Access: public

Type:   unknown_type


[ Top ]

$datatype =

[line 172]

Unused relic of the C version of Lemon.

The data type of information held by this object. Only used if this is a non-terminal

  • Access: public

Type:   string


[ Top ]

$destructor =  0

[line 159]

Code that executes whenever this symbol is popped from the stack during error processing.
  • Access: public

Type:   string|0


[ Top ]

$destructorln =

[line 164]

Line number of destructor code
  • Access: public

Type:   int


[ Top ]

$dtnum =

[line 181]

Unused relic of the C version of Lemon.

The data type number. In the parser, the value stack is a union. The .yy%d element of this union is the correct data type for this object

  • Access: public

Type:   string


[ Top ]

$fallback =

[line 122]

Fallback token in case this token doesn't parse
  • Access: public



[ Top ]

$firstset =

[line 144]

First-set for all rules of this symbol
  • Access: public

Type:   array


[ Top ]

$index =

[line 103]

Index of this symbol.

This will ultimately end up representing the symbol in the generated parser

  • Access: public

Type:   int


[ Top ]

$lambda =

[line 152]

True if this symbol is a non-terminal and can generate an empty result.

For instance "foo ::= ."

  • Access: public

Type:   boolean


[ Top ]

$name =

[line 95]

Name of the symbol
  • Access: public

Type:   string


[ Top ]

$nsubsym =

[line 191]

Number of terminal symbols in the MULTITERMINAL

The following fields are used by MULTITERMINALs only This is of course the same as count($this->subsym)

  • Access: public

Type:   int


[ Top ]

$prec =  -1

[line 129]

Precendence, if defined.

-1 if no unusual precedence

  • Access: public

Type:   int


[ Top ]

$rule =

[line 117]

Linked list of rules that use this symbol, if it is a non-terminal.
  • Access: public



[ Top ]

$subsym = array()

[line 196]

Array of terminal symbols in the MULTITERMINAL

The following fields are used by MULTITERMINALs only


Type:   array


[ Top ]

$type =

[line 112]

Symbol type

One of PHP_ParserGenerator_Symbol::TERMINAL, PHP_ParserGenerator_Symbol::NONTERMINAL or PHP_ParserGenerator_Symbol::MULTITERMINAL

  • Access: public

Type:   int


[ Top ]



Method Detail

same_symbol   [line 277]

void same_symbol( PHP_ParserGenerator_Symbol $a, PHP_ParserGenerator_Symbol $b)

Return true if two symbols are the same.
  • Access: public

Parameters:

PHP_ParserGenerator_Symbol   $a   — 
PHP_ParserGenerator_Symbol   $b   — 

[ Top ]

sortSymbols   [line 267]

void sortSymbols( PHP_ParserGenerator_Symbol $a, PHP_ParserGenerator_Symbol $b)

Sort function helper for symbols

Symbols that begin with upper case letters (terminals or tokens) must sort before symbols that begin with lower case letters (non-terminals). Other than that, the order does not matter.

We find experimentally that leaving the symbols in their original order (the order they appeared in the grammar file) gives the smallest parser tables in SQLite.

  • Access: public

Parameters:

PHP_ParserGenerator_Symbol   $a   — 
PHP_ParserGenerator_Symbol   $b   — 

[ Top ]

Symbol_arrayof   [line 241]

void Symbol_arrayof( )

  • Access: public

[ Top ]

Symbol_count   [line 236]

int Symbol_count( )

Return the number of unique symbols
  • Access: public

[ Top ]

Symbol_find   [line 246]

void Symbol_find( $x)

  • Access: public

Parameters:

   $x   — 

[ Top ]

Symbol_new   [line 211]

PHP_ParserGenerator_Symbol Symbol_new( string $x)

Return a pointer to the (terminal or nonterminal) symbol "x".

Create a new symbol if this is the first time "x" has been seen. (this is a singleton)

  • Access: public

Parameters:

string   $x   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:41:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.