Detailed Description

Represents a type. (e.g. new TYPE or :TYPE).

Inheritance diagram for Nitro.TypeFragment:
Nitro.CodeFragment

Public Member Functions

 TypeFragment (CodeLexer sr)
 Creates a new type fragment by reading it and a preceeding colon from the given lexer. More...
 
 TypeFragment (CodeLexer sr, bool hasColon)
 Creates a new type fragment by reading it from the given lexer. 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...
 
Type FindType (NitroCode script)
 Attempts to find the type named here and resolve it to a system type. 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 int GetLineNumber ()
 Gets the line number if there is one. More...
 
virtual bool IsMemberAccessor ()
 A value which states if this fragment accesses members (methods/fields) of something. 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...
 
override string ToString ()
 Converts this fragment into a code string. More...
 

Static Public Member Functions

static bool WillHandle (char character)
 Checks if a type fragment can be read from a lexer by checking if the current character is a colon. 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

bool IsArray
 True if this is an array type. More...
 
bool HasColon
 True if this type was read with a colon before it. More...
 
string Value =""
 The type as a string. More...
 
int Dimensions =1
 If it's an array, this is how many dimensions the array has. More...
 
TypeFragment[] GenericSet
 Generic values may be generics themselves, so this is the set of nested generics. (e.g. List<List<List<List<string>>>>). 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...
 

Private Member Functions

void SetArray (CodeLexer sr)
 Reads array indices (array[,,,] = 3 dimensions) from the given lexer and sets the dimensions from the number of them. More...
 

Additional Inherited Members

- Properties inherited from Nitro.CodeFragment
bool IsParent [get]
 Is this fragment a parent or not? More...
 

Constructor & Destructor Documentation

Nitro.TypeFragment.TypeFragment ( CodeLexer  sr)
inline

Creates a new type fragment by reading it and a preceeding colon from the given lexer.

Parameters
srThe lexer to read from.
Nitro.TypeFragment.TypeFragment ( CodeLexer  sr,
bool  hasColon 
)
inline

Creates a new type fragment by reading it from the given lexer.

Parameters
srThe lexer to read it from.
hasColonTrue if a colon (:) should be read from the lexer.

Member Function Documentation

override AddResult Nitro.TypeFragment.AddTo ( CodeFragment  to,
CodeLexer  sr 
)
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.

Parameters
toThe parent to add this fragment to.
srThe lexer containing the original text code.

Reimplemented from Nitro.CodeFragment.

Type Nitro.TypeFragment.FindType ( NitroCode  script)
inline

Attempts to find the type named here and resolve it to a system type.

Parameters
scriptThe script that should also be checked for types and acts as the security domain.
Returns
A system type if the type could be resolved and allowed successfully; null otherwise.
void Nitro.TypeFragment.SetArray ( CodeLexer  sr)
inlineprivate

Reads array indices (array[,,,] = 3 dimensions) from the given lexer and sets the dimensions from the number of them.

Parameters
srThe lexer to read the indices from.
override string Nitro.TypeFragment.ToString ( )
inline
static bool Nitro.TypeFragment.WillHandle ( char  character)
inlinestatic

Checks if a type fragment can be read from a lexer by checking if the current character is a colon.

Parameters
characterThe character to check.
Returns
True if the character is a colon (:); false otherwise.

Member Data Documentation

int Nitro.TypeFragment.Dimensions =1

If it's an array, this is how many dimensions the array has.

TypeFragment [] Nitro.TypeFragment.GenericSet

Generic values may be generics themselves, so this is the set of nested generics. (e.g. List<List<List<List<string>>>>).

bool Nitro.TypeFragment.HasColon

True if this type was read with a colon before it.

bool Nitro.TypeFragment.IsArray

True if this is an array type.

string Nitro.TypeFragment.Value =""

The type as a string.