Represents a fragment of the text input code. Once compiled, it becomes a CompiledFragment. CompiledFragments are also types of CodeFragment as this allows them to be parented into the original structure.
Public Member Functions | |
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... | |
virtual int | GetLineNumber () |
Returns the line number this fragment came from. More... | |
virtual CompiledFragment | Compile (CompiledMethod method) |
Attempts to compile this fragment into the given method. 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... | |
virtual bool | Typeable () |
Defines if a fragment can be given a :TYPE. E.g. Brackets (for casting, (A):TYPE) and variables can. More... | |
int | ChildCount () |
How many children does this fragment have? More... | |
virtual 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 string | ToString () |
Converts this fragment into a code string. More... | |
Static Public Member Functions | |
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... | |
Public Attributes | |
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... | |
Properties | |
bool | IsParent [get] |
Is this fragment a parent or not? More... | |
|
inline |
Adds this code fragment as a child after the given one.
frag | The fragment to add this one after. |
|
inline |
Adds this code fragment as a child before the given one.
frag | The fragment to add this before. |
|
inline |
Adds the given fragment as a child of this one.
child | The fragment to add as a child. |
|
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 in Nitro.BracketFragment, Nitro.TypeFragment, Nitro.VariableFragment, Nitro.PropertyFragment, Nitro.IfFragment, Nitro.MethodFragment, Nitro.ForFragment, and Nitro.SwitchFragment.
|
inline |
Adds this code fragment to the beginning of the given parents child set.
parent | The parent to parent this fragment to. |
|
inline |
How many children does this fragment have?
|
inlinevirtual |
Attempts to compile this fragment into the given method.
method | The method to compile it into. |
Reimplemented in Nitro.VariableFragment, Nitro.BracketFragment, Nitro.OperationFragment, Nitro.StringFragment, Nitro.CompiledFragment, Nitro.PropertyFragment, Nitro.NumberFragment, Nitro.IfFragment, Nitro.MethodFragment, Nitro.ForFragment, Nitro.ConstructorFragment, Nitro.SwitchFragment, Nitro.ArrayFragment, and Nitro.IndexFragment.
|
inline |
Throws an error, outputting the line number it occured on.
message | A message saying why this error occured. |
|
inlinevirtual |
Returns the line number this fragment came from.
Reimplemented in Nitro.OperationFragment, Nitro.VariableFragment, and Nitro.Operation.
|
inlinevirtual |
A value which states if this fragment accesses members (methods/fields) of something.
Reimplemented in Nitro.MethodOperation, and Nitro.PropertyOperation.
|
inlinestatic |
Returns the index in the given array of the given character if it's found in it.
arrayToSearch | The set of characters to look through. |
charToFind | The character to find in the set. |
|
inline |
Removes this fragment from its parent.
|
inline |
Converts this fragment into a code string.
|
inlinevirtual |
Defines if a fragment can be given a :TYPE. E.g. Brackets (for casting, (A):TYPE) and variables can.
Reimplemented in Nitro.BracketFragment, Nitro.VariableFragment, and Nitro.MethodFragment.
CodeFragment Nitro.CodeFragment.FirstChild |
The first child of this fragment, stored as a linked list.
TypeFragment Nitro.CodeFragment.GivenType |
A type (:TYPE) which was explicitly given to this block.
CodeFragment Nitro.CodeFragment.LastChild |
The last child of this fragment, stored as a linked list.
CodeFragment Nitro.CodeFragment.NextChild |
The child after this one.
CodeFragment Nitro.CodeFragment.ParentFragment |
The parent fragment of this, if any.
CodeFragment Nitro.CodeFragment.PreviousChild |
The child before this one.
|
get |
Is this fragment a parent or not?