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

Class: PHP_ParserGenerator_Symbol

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

Class Overview


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


Author(s):

Version:

  • 0.1.5

Copyright:

  • 2006 Gregory Beaver

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 58]
Symbols (terminals and nonterminals) of the grammar are stored in this class
  • Author: Gregory Beaver <cellog@php.net>
  • Version: 0.1.5
  • Copyright: 2006 Gregory Beaver
  • Since: Class available since Release 0.1.0
  • License: New BSD License


[ Top ]


Class Variables

$assoc =

[line 135]

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

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

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

Type:   string|0


[ Top ]

$destructorln =

[line 161]

Line number of destructor code
  • Access: public

Type:   int


[ Top ]

$dtnum =

[line 178]

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

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



[ Top ]

$firstset =

[line 141]

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

Type:   array


[ Top ]

$index =

[line 100]

Index of this symbol.

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

  • Access: public

Type:   int


[ Top ]

$lambda =

[line 149]

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

For instance "foo ::= ."

  • Access: public

Type:   boolean


[ Top ]

$name =

[line 92]

Name of the symbol
  • Access: public

Type:   string


[ Top ]

$nsubsym =

[line 188]

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

Precendence, if defined.

-1 if no unusual precedence

  • Access: public

Type:   int


[ Top ]

$rule =

[line 114]

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



[ Top ]

$subsym = array()

[line 193]

Array of terminal symbols in the MULTITERMINAL

The following fields are used by MULTITERMINALs only


Type:   array


[ Top ]

$type =

[line 109]

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

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

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

void Symbol_arrayof( )

  • Access: public

[ Top ]

Symbol_count   [line 232]

int Symbol_count( )

Return the number of unique symbols
  • Access: public

[ Top ]

Symbol_find   [line 242]

void Symbol_find( $x)

  • Access: public

Parameters:

   $x   — 

[ Top ]

Symbol_new   [line 208]

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 Thu, 10 Dec 2015 05:43:59 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.