Class MacroElement
- Namespace
- CMS.MacroEngine
- Assembly
- CMS.MacroEngine.dll
Macro expression element. Lexical analysis of the K# expression.
public class MacroElement
- Inheritance
-
objectMacroElement
- Extension Methods
Constructors
MacroElement(ElementType, string, object, int)
Constructor.
public MacroElement(ElementType type, string expression, object value, int startIndex)
Parameters
typeElementTypeElement type
expressionstringExpression
valueobjectValue
startIndexintStart index in the source string
Properties
Expression
Element expression (as was parsed).
public string Expression { get; }
Property Value
- string
StartIndex
Index of the expression start in the source expression.
public int StartIndex { get; }
Property Value
- int
Type
Element type.
public ElementType Type { get; }
Property Value
Value
Element value (of the element type).
public object Value { get; }
Property Value
- object
Methods
EscapeSpecialChars(string)
Escapes special characters in the string to create a string literal.
public static string EscapeSpecialChars(string text)
Parameters
textstringString to create literal from
Returns
- string
IsBoolConst(string)
Returns true if the given string is a boolean constant "true" or "false".
public static bool IsBoolConst(string op)
Parameters
opstringOperator to check
Returns
- bool
IsOperatorChar(char)
Returns true if the character is operator character.
public static bool IsOperatorChar(char ch)
Parameters
chcharCharacter to check
Returns
- bool
IsValidOperator(string)
Returns true if the operator is valid.
public static bool IsValidOperator(string op)
Parameters
opstringOperator to check
Returns
- bool
IsWordOperator(string)
Returns true if the given string is a word operator.
public static bool IsWordOperator(string op)
Parameters
opstringOperator to check
Returns
- bool
ParseExpression(string)
Parses the expression.
public static List<MacroElement> ParseExpression(string expression)
Parameters
expressionstringExpression to parse
Returns
- List<MacroElement>
ParseExpression(string, bool)
Parses the expression.
public static List<MacroElement> ParseExpression(string expression, bool supressError)
Parameters
expressionstringExpression to parse
supressErrorboolIf true no exceptions are thrown
Returns
- List<MacroElement>
ToString()
Returns the expression of the element.
public override string ToString()
Returns
- string
UnescapeSpecialChars(string)
Unescapes special characters in the string constant.
public static string UnescapeSpecialChars(string text)
Parameters
textstringText of the string constant
Returns
- string