C# Class CSE.Exps.LiteralExp

Used to parse literal expressions
Mostra file Open project: kcherr1/CSharp-Eval Class Usage Examples

Public Methods

Method Description
IsIntType ( CseObject data ) : bool

Determines if value passed in is an integral-type

NarrowIntType ( CseObject xdata ) : CseObject

Changes the given integral-type object to the smallest integral data type that can contain its value. If xdata has a CompileTimeType that is unsigned, then the smallest unsigned integral type is used. Otherwise the smallest signed type is used. The only current exception to this is byte vs. sbyte as they are considered special cases and therefore, regardless if the original type is unsigned or not, byte is always attempted in place of sbyte.

ParseEscSeqs ( string &data, bool isVerbatim ) : void

Parses escape sequences found in char or string literals

Private Methods

Method Description
IsUnsignedType ( CseObject xdata ) : bool

Determines whether the xdata's CompileTimeType is an unsigned integral type or not

ParseBool ( string data ) : CseObject

Parses bool literals

ParseChar ( string data ) : CseObject

Parses char literals

ParseEType ( string data ) : CseObject

Parses literals that contain the exponential 'e' character

ParseFloatType ( string data, bool hasSuffix ) : CseObject

Parses float-type literals

ParseFloatType ( string data, string suffix ) : CseObject

Parses float-type literals

ParseIntType ( string data, bool hasSuffix ) : CseObject

Parses integral-type literals

ParseIntType ( string data, string suffix ) : CseObject

Parses integral-type literals

ParseStr ( string data ) : CseObject

Parses string literals

Method Details

IsIntType() public static method

Determines if value passed in is an integral-type
public static IsIntType ( CseObject data ) : bool
data CseObject Value to examine
return bool

NarrowIntType() public static method

Changes the given integral-type object to the smallest integral data type that can contain its value. If xdata has a CompileTimeType that is unsigned, then the smallest unsigned integral type is used. Otherwise the smallest signed type is used. The only current exception to this is byte vs. sbyte as they are considered special cases and therefore, regardless if the original type is unsigned or not, byte is always attempted in place of sbyte.
public static NarrowIntType ( CseObject xdata ) : CseObject
xdata CseObject Integral-type value to narrow
return CseObject

ParseEscSeqs() public static method

Parses escape sequences found in char or string literals
public static ParseEscSeqs ( string &data, bool isVerbatim ) : void
data string String containing the literal that may have escape sequences
isVerbatim bool /// Used to tell if the literal passed is a verbatim string. /// True if data represents verbatim string, false otherwise ///
return void