Represents any pair of brackets.
Public Member Functions | |
BracketFragment () | |
BracketFragment (CodeLexer sr) | |
Creates a new BracketFragment. More... | |
BracketFragment (CodeLexer sr, bool readBracket) | |
Creates a new BracketFragment. 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 CompiledFragment | Compile (CompiledMethod method) |
Attempts to compile this fragment into the given method. More... | |
bool | CompileBody (CompiledMethod method) |
Attempts to compile this bracket to IL, assuming it is the body of a method. 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 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... | |
virtual int | GetLineNumber () |
Returns the line number this fragment came from. 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... | |
Static Public Member Functions | |
static bool | WillHandle (char character) |
Checks if the given character can be handled by a bracket fragment. More... | |
static int | IsBracket (char character) |
Checks if the given character is an opening bracket. More... | |
static int | IsEndBracket (char character) |
Checks if the given character is an closing bracket. More... | |
static bool | AnyBracket (char character) |
Checks if the given character is either an opening or closing bracket. More... | |
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... | |
Public Attributes | |
char | Bracket =StringReader.NULL |
The opening bracket character. E.g. (,{,[. More... | |
char | CloseBracket =StringReader.NULL |
The closing bracket character. E.g. ),},]. 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 char[] | Brackets =new char[]{'(','[','{'} |
The set of opening brackets. More... | |
static char[] | EndBrackets =new char[]{')',']','}'} |
The set of closing brackets. More... | |
Additional Inherited Members | |
Properties inherited from Nitro.CodeFragment | |
bool | IsParent [get] |
Is this fragment a parent or not? More... | |
|
inline |
|
inline |
Creates a new BracketFragment.
sr | The lexer to read the bracket content from. |
|
inline |
Creates a new BracketFragment.
sr | The lexer to read the bracket content from. |
readBracket | True if the brackets should be read off (i.e. the first thing done is read a single character). False otherwise. |
|
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.
|
inlinestatic |
Checks if the given character is either an opening or closing bracket.
character | The character to check. |
|
inlinevirtual |
Attempts to compile this fragment into the given method.
method | The method to compile it into. |
Reimplemented from Nitro.CodeFragment.
|
inline |
Attempts to compile this bracket to IL, assuming it is the body of a method.
method | The method that is being compiled. |
|
inlinestatic |
Checks if the given character is an opening bracket.
character | The character to check. |
|
inlinestatic |
Checks if the given character is an closing bracket.
character | The character to check. |
|
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.
|
inlinestatic |
Checks if the given character can be handled by a bracket fragment.
character | The character to check. |
char Nitro.BracketFragment.Bracket =StringReader.NULL |
The opening bracket character. E.g. (,{,[.
|
static |
The set of opening brackets.
char Nitro.BracketFragment.CloseBracket =StringReader.NULL |
The closing bracket character. E.g. ),},].
|
static |
The set of closing brackets.