Represents a variable. These are essentially text in the code that are not keywords. (e.g. hello=14;)
Public Member Functions | |
VariableFragment (string value) | |
Creates a new variable fragment from the given variable text. More... | |
VariableFragment (CodeLexer sr) | |
Creates a new variable fragment by reading it from the given lexer. More... | |
bool | IsKeyword () |
Checks if this is a keyword (e.g. return, break). More... | |
override int | GetLineNumber () |
Returns the line number this fragment came from. More... | |
override bool | Typeable () |
Defines if a fragment can be given a :TYPE. E.g. Brackets (for casting, (A):TYPE) and variables can. More... | |
override AddResult | AddTo (CodeFragment to, CodeLexer sr) |
Adds this fragment as a child to the given fragment. It may be overriden by some types of fragment as they may wish to handle it differently. More... | |
override CompiledFragment | Compile (CompiledMethod function) |
Attempts to compile this fragment into the given method. More... | |
override string | ToString () |
Public Member Functions inherited from Nitro.CodeFragment | |
void | Error (string message) |
Throws an error, outputting the line number it occured on. More... | |
virtual bool | IsMemberAccessor () |
A value which states if this fragment accesses members (methods/fields) of something. More... | |
void | AddToStart (CodeFragment parent) |
Adds this code fragment to the beginning of the given parents child set. More... | |
void | AddBefore (CodeFragment frag) |
Adds this code fragment as a child before the given one. More... | |
void | AddAfter (CodeFragment frag) |
Adds this code fragment as a child after the given one. More... | |
void | Remove () |
Removes this fragment from its parent. More... | |
void | AddChild (CodeFragment child) |
Adds the given fragment as a child of this one. More... | |
int | ChildCount () |
How many children does this fragment have? More... | |
override string | ToString () |
Converts this fragment into a code string. More... | |
Public Attributes | |
bool | AfterVar |
True if "var" was defined before this fragment. More... | |
string | Value ="" |
The raw variables name. More... | |
int | LineNumber =-1 |
The line that this variable was found on. More... | |
Public Attributes inherited from Nitro.CodeFragment | |
TypeFragment | GivenType |
A type (:TYPE) which was explicitly given to this block. More... | |
CodeFragment | NextChild |
The child after this one. More... | |
CodeFragment | LastChild |
The last child of this fragment, stored as a linked list. More... | |
CodeFragment | FirstChild |
The first child of this fragment, stored as a linked list. More... | |
CodeFragment | PreviousChild |
The child before this one. More... | |
CodeFragment | ParentFragment |
The parent fragment of this, if any. More... | |
Static Public Attributes | |
static string[] | Keywords =new string[]{"return","continue","break","using"} |
The set of all keywords used by Nitro. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Nitro.CodeFragment | |
static int | IsOfType (char[] arrayToSearch, char charToFind) |
Returns the index in the given array of the given character if it's found in it. More... | |
Properties inherited from Nitro.CodeFragment | |
bool | IsParent [get] |
Is this fragment a parent or not? More... | |
|
inline |
Creates a new variable fragment from the given variable text.
value | The raw variables name. |
|
inline |
Creates a new variable fragment by reading it from the given lexer.
sr | The lexer to read the variable from. |
|
inlinevirtual |
Adds this fragment as a child to the given fragment. It may be overriden by some types of fragment as they may wish to handle it differently.
to | The parent to add this fragment to. |
sr | The lexer containing the original text code. |
Reimplemented from Nitro.CodeFragment.
|
inlinevirtual |
Attempts to compile this fragment into the given method.
method | The method to compile it into. |
Reimplemented from Nitro.CodeFragment.
|
inlinevirtual |
Returns the line number this fragment came from.
Reimplemented from Nitro.CodeFragment.
|
inline |
Checks if this is a keyword (e.g. return, break).
|
inline |
|
inlinevirtual |
Defines if a fragment can be given a :TYPE. E.g. Brackets (for casting, (A):TYPE) and variables can.
Reimplemented from Nitro.CodeFragment.
bool Nitro.VariableFragment.AfterVar |
True if "var" was defined before this fragment.
|
static |
The set of all keywords used by Nitro.
int Nitro.VariableFragment.LineNumber =-1 |
The line that this variable was found on.
string Nitro.VariableFragment.Value ="" |
The raw variables name.