Detailed Description

Represents a fixed text string in the code. (e.g. "hello").

Inheritance diagram for Nitro.StringFragment:
Nitro.CodeFragment

Public Member Functions

 StringFragment (CodeLexer sr)
 Creates a new string fragment by reading it from the given lexer. More...
 
 StringFragment (string value)
 
override CompiledFragment Compile (CompiledMethod parent)
 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...
 
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 bool WillHandle (char character)
 Checks if a string can be read from a stream by seeing if the current character is a quote. More...
 
static int IsQuote (char character)
 Checks if the given character is a quote (",'). 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

string Value =""
 The literal string text. It does not contain the quotes and has reversed any delimiters within it. 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 Delimiter ='\\'
 The character used to delimit any quotes found within a string. More...
 
static char[] Quotes =new char[]{'"','\''}
 A set of quotes (", ') that can mark the start and end of a string. More...
 

Additional Inherited Members

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

Constructor & Destructor Documentation

Nitro.StringFragment.StringFragment ( CodeLexer  sr)
inline

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

Parameters
srThe lexer to read it from.
Nitro.StringFragment.StringFragment ( string  value)
inline

Member Function Documentation

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

Attempts to compile this fragment into the given method.

Parameters
methodThe method to compile it into.

Reimplemented from Nitro.CodeFragment.

static int Nitro.StringFragment.IsQuote ( char  character)
inlinestatic

Checks if the given character is a quote (",').

Parameters
characterThe character to check.
Returns
The index of the quote if it is one. " is 0, ' is 1. -1 otherwise.
override string Nitro.StringFragment.ToString ( )
inline
static bool Nitro.StringFragment.WillHandle ( char  character)
inlinestatic

Checks if a string can be read from a stream by seeing if the current character is a quote.

Parameters
characterThe character to check.
Returns
True if the character is a quote; false otherwise.

Member Data Documentation

char Nitro.StringFragment.Delimiter ='\\'
static

The character used to delimit any quotes found within a string.

char [] Nitro.StringFragment.Quotes =new char[]{'"','\''}
static

A set of quotes (", ') that can mark the start and end of a string.

string Nitro.StringFragment.Value =""

The literal string text. It does not contain the quotes and has reversed any delimiters within it.