Hoa central
Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Hoa\Compiler\Llk\Rule\Token Class Reference
Inheritance diagram for Hoa\Compiler\Llk\Rule\Token:

Public Member Functions

 __construct ($name, $tokenName, $nodeId, $unification)
 
 getTokenName ()
 
 setNamespace ($namespace)
 
 getNamespace ()
 
 setRepresentation ($regex)
 
 getRepresentation ()
 
 getAST ()
 
 setValue ($value)
 
 getValue ()
 
 setKept ($kept)
 
 isKept ()
 
 getUnificationIndex ()
 
- Public Member Functions inherited from Hoa\Compiler\Llk\Rule\Rule
 __construct ($name, $content, $nodeId=null)
 
 setName ($name)
 
 getName ()
 
 getContent ()
 
 setNodeId ($nodeId)
 
 getNodeId ()
 
 getNodeOptions ()
 
 setDefaultId ($defaultId)
 
 getDefaultId ()
 
 getDefaultOptions ()
 
 setPPRepresentation ($pp)
 
 getPPRepresentation ()
 
 isTransitional ()
 

Protected Attributes

 $_tokenName = null
 
 $_namespace = null
 
 $_regex = null
 
 $_ast = null
 
 $_value = null
 
 $_kept = false
 
 $_unification = -1
 
- Protected Attributes inherited from Hoa\Compiler\Llk\Rule\Rule
 $_name = null
 
 $_content = null
 
 $_nodeId = null
 
 $_nodeOptions = []
 
 $_defaultId = null
 
 $_defaultOptions = []
 
 $_pp = null
 
 $_transitional = true
 

Static Protected Attributes

static $_regexCompiler = null
 

Additional Inherited Members

- Protected Member Functions inherited from Hoa\Compiler\Llk\Rule\Rule
 setContent ($content)
 

Detailed Description

Class .

The token rule.

Definition at line 50 of file Token.php.

Constructor & Destructor Documentation

Hoa\Compiler\Llk\Rule\Token::__construct (   $name,
  $tokenName,
  $nodeId,
  $unification 
)

Constructor.

Parameters
string$nameName.
string$tokenNameToken name.
string$nodeIdNode ID.
int$unificationUnification index.
Returns
void

Definition at line 119 of file Token.php.

120  {
121  parent::__construct($name, null, $nodeId);
122  $this->_tokenName = $tokenName;
123  $this->_unification = $unification;
124 
125  return;
126  }

Member Function Documentation

Hoa\Compiler\Llk\Rule\Token::getAST ( )

Get AST of the token representation.

Returns

Definition at line 191 of file Token.php.

192  {
193  if (null === static::$_regexCompiler) {
194  $stream = new File\Read('hoa://Library/Regex/Grammar.pp');
195  $stream->rewind();
196 
197  static::$_regexCompiler = Compiler\Llk::load($stream);
198  }
199 
200  if (null === $this->_ast) {
201  $this->_ast = static::$_regexCompiler->parse(
202  $this->getRepresentation()
203  );
204  }
205 
206  return $this->_ast;
207  }

Here is the call graph for this function:

Hoa\Compiler\Llk\Rule\Token::getNamespace ( )

Get token namespace.

Returns
string

Definition at line 157 of file Token.php.

158  {
159  return $this->_namespace;
160  }
Hoa\Compiler\Llk\Rule\Token::getRepresentation ( )

Get token representation.

Returns
string

Definition at line 181 of file Token.php.

182  {
183  return $this->_regex;
184  }

Here is the caller graph for this function:

Hoa\Compiler\Llk\Rule\Token::getTokenName ( )

Get token name.

Returns
string

Definition at line 133 of file Token.php.

134  {
135  return $this->_tokenName;
136  }
Hoa\Compiler\Llk\Rule\Token::getUnificationIndex ( )

Get unification index.

Returns
int

Definition at line 262 of file Token.php.

263  {
264  return $this->_unification;
265  }
Hoa\Compiler\Llk\Rule\Token::getValue ( )

Get token value.

Returns
string

Definition at line 228 of file Token.php.

229  {
230  return $this->_value;
231  }
Hoa\Compiler\Llk\Rule\Token::isKept ( )

Check whether the token is kept in the AST or not.

Returns
bool

Definition at line 252 of file Token.php.

253  {
254  return $this->_kept;
255  }
Hoa\Compiler\Llk\Rule\Token::setKept (   $kept)

Set whether the token is kept or not in the AST.

Parameters
bool$keptKept.
Returns
bool

Definition at line 239 of file Token.php.

240  {
241  $old = $this->_kept;
242  $this->_kept = $kept;
243 
244  return $old;
245  }
Hoa\Compiler\Llk\Rule\Token::setNamespace (   $namespace)

Set token namespace.

Parameters
string$namespaceNamespace.
Returns
string

Definition at line 144 of file Token.php.

145  {
146  $old = $this->_namespace;
147  $this->_namespace = $namespace;
148 
149  return $old;
150  }
Hoa\Compiler\Llk\Rule\Token::setRepresentation (   $regex)

Set representation.

Parameters
string$regexRepresentation.
Returns
string

Definition at line 168 of file Token.php.

169  {
170  $old = $this->_regex;
171  $this->_regex = $regex;
172 
173  return $old;
174  }
Hoa\Compiler\Llk\Rule\Token::setValue (   $value)

Set token value.

Parameters
string$valueValue.
Returns
string

Definition at line 215 of file Token.php.

216  {
217  $old = $this->_value;
218  $this->_value = $value;
219 
220  return $old;
221  }

Member Data Documentation

Hoa\Compiler\Llk\Rule\Token::$_ast = null
protected

Definition at line 85 of file Token.php.

Hoa\Compiler\Llk\Rule\Token::$_kept = false
protected

Definition at line 99 of file Token.php.

Hoa\Compiler\Llk\Rule\Token::$_namespace = null
protected

Definition at line 71 of file Token.php.

Hoa\Compiler\Llk\Rule\Token::$_regex = null
protected

Definition at line 78 of file Token.php.

Hoa\Compiler\Llk\Rule\Token::$_regexCompiler = null
staticprotected

Definition at line 57 of file Token.php.

Hoa\Compiler\Llk\Rule\Token::$_tokenName = null
protected

Definition at line 64 of file Token.php.

Hoa\Compiler\Llk\Rule\Token::$_unification = -1
protected

Definition at line 106 of file Token.php.

Hoa\Compiler\Llk\Rule\Token::$_value = null
protected

Definition at line 92 of file Token.php.


The documentation for this class was generated from the following file: