Class Var<T>
- Type Parameters:
T- the type wrapped by this Var
- Direct Known Subclasses:
StringBuilderVar, StringVar
This class provides a "local variable"-like construct for action expressions in parser rule methods.
Var
Var
When rule method A() passes a Var defined in its scope to another rule method B() as a parameter and an action
in rule method B() writes to this Var all actions in rule method A() running after B() will "see" this newly written
value (since values in Var
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanProvides a new frame for the variable.booleanExits a frame previously entered withenterFrame().intgetLevel()Returns the current frame level of this variable, the very first level corresponding to zero.getName()Gets the name of this Var.voidSets the name of this Var.toString()
-
Constructor Details
-
Var
public Var()Initializes a new Var with a null initial value. -
Var
Initializes a new Var with the given initial value.- Parameters:
value- the value
-
Var
-
-
Method Details
-
getName
-
setName
-
getLevel
public int getLevel()Returns the current frame level of this variable, the very first level corresponding to zero.- Returns:
- the current level
-
enterFrame
public boolean enterFrame()Provides a new frame for the variable. Potentially existing previous frames are saved. Normally you do not have to call this method manually as parboiled provides for automatic Var frame management.- Returns:
- true
-
exitFrame
public boolean exitFrame()Exits a frame previously entered withenterFrame(). Normally you do not have to call this method manually as parboiled provides for automatic Var frame management.- Returns:
- true
-
toString
-