Nitro.IfFragment Class Reference

Detailed Description

Represents an if statement.

Inheritance diagram for Nitro.IfFragment:
Nitro.CodeFragment

Public Member Functions

 IfFragment (CodeLexer sr)
 Creates and reads a new if(){} fragment. Note that the else section is not read. More...
 
void SetIfFalse (BracketFragment ifFalse)
 
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 method)
 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 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...
 
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...
 

Public Attributes

IfFragment ApplyElseTo
 The fragment that any following else or else if conditions should be applied to. More...
 
BracketFragment IfTrue
 The block to run if the conditions are true. More...
 
BracketFragment IfFalse
 The block to run if the conditions are false. More...
 
BracketFragment Condition
 The conditions to check if true/false. 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...
 

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...
 

Constructor & Destructor Documentation

Nitro.IfFragment.IfFragment ( CodeLexer  sr)
inline

Creates and reads a new if(){} fragment. Note that the else section is not read.

Parameters
srThe lexer to read the if condition and its true bracket block from.

Member Function Documentation

override AddResult Nitro.IfFragment.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.

override CompiledFragment Nitro.IfFragment.Compile ( CompiledMethod  method)
inlinevirtual

Attempts to compile this fragment into the given method.

Parameters
methodThe method to compile it into.

Reimplemented from Nitro.CodeFragment.

void Nitro.IfFragment.SetIfFalse ( BracketFragment  ifFalse)
inline
override string Nitro.IfFragment.ToString ( )
inline

Member Data Documentation

IfFragment Nitro.IfFragment.ApplyElseTo

The fragment that any following else or else if conditions should be applied to.

BracketFragment Nitro.IfFragment.Condition

The conditions to check if true/false.

BracketFragment Nitro.IfFragment.IfFalse

The block to run if the conditions are false.

BracketFragment Nitro.IfFragment.IfTrue

The block to run if the conditions are true.