12 private readonly
int start;
33 public int Length => this.expression.Position - this.start;
38 public int Position => this.expression.Position;
50 get => this.expression.CanSkipWhitespace;
51 set => this.expression.CanSkipWhitespace = value;
59 public char NextChar() => this.expression.NextChar();
74 while (ch != 0 &&
char.IsWhiteSpace(ch));
84 this.expression.UndoChar();
94 return this.expression.PeekNextChars(NrChars);
104 return this.expression.IsNextChars(Token);
116 return this.expression.IsNextChars(ch, Count);
124 this.expression.SkipChars(NrChars);
139 public string NextToken() => this.expression.NextToken();
298 public Unit ParseUnit(
bool PermitPrefix) => this.expression.ParseUnit(PermitPrefix);
321 public bool HasCharacters(
int NrCharacters) => this.expression.Position <= this.expression.Script.Length - NrCharacters;
330 return new SyntaxException(Message, this.Position, this.expression.Script);
Class managing a script expression.
Base class for all nodes in a parsed script tree.
Script parser, for custom parsers.
SyntaxException SyntaxError(string Message)
Returns a Syntax Error Exception object.
ScriptNode ParseAssignments()
Parses an assignment.
ScriptNode ParseIntersections()
Parses intersections.
ScriptNode ParseStatement()
Parses a statement.
string PeekNextToken()
Returns the next token to be parsed, without moving the position forward. If at the end of the expres...
ScriptNode ParsePowers()
Parses powers.
bool HasCharacters(int NrCharacters)
If there are a given number of characters left to parse.
bool IsNextChars(string Token)
If the next characters to be parsed is a given token.
ScriptNode ParseFactors()
Parses factors.
string NextToken()
Returns the next token to be parsed, and moves the position forward correspondingly....
ScriptNode ParseLambdaExpression()
Parses a lambda expression.
ScriptNode ParseBinomialCoefficients()
Parses binomial coefficients.
ScriptNode ParseTerms()
Parses terms.
int Length
Length of script parsed
ScriptNode ParseOrs()
Parses ORs.
ScriptNode ParseInterval()
Parses an interval.
ScriptNode ParseMembership()
Parses a membership operator.
ScriptNode AssertOperandNotNull(ScriptNode Node)
Throws an exception if an operand is not null.
ScriptNode ParseEquivalence()
Parses an equivalence.
int Start
Start position in expression
int Position
Current parsing position.
ScriptNode ParseComparison()
Parses a comparison.
ScriptNode ParseUnions()
Parses unions.
ScriptNode ParseIf()
Parses a conditional statement.
bool InScript
If position is in script.
ScriptNode ParseUnaryPrefixOperator()
Parses unary prefix operatorrs.
Expression Expression
Expression being parsed.
void UndoChar()
Undoes a character in the parsing of an expression.
Unit ParseUnit(bool PermitPrefix)
Parses a unit.
string PeekNextChars(int NrChars)
Returns the next given number of characters to be parsed, without moving the position forward one cha...
void SkipChars(int NrChars)
Skips a predefined number of characters.
char PeekNextChar()
Returns the next character to be parsed, without moving the position forward one character....
ScriptNode ParseSuffixOperator()
Parses suffix operators.
bool CanSkipWhitespace
If whitespace can be skipped (true), or if it has semantic meaning to the custom parser (false).
bool EndOfScript
If position is at end of script.
void SkipWhiteSpace()
If current position is whitespace, moves the current position forward to the first non-whitespace cha...
char NextChar()
Returns the next character to be parsed, and moves the position forward one character....
ScriptNode AssertRightOperandNotNull(ScriptNode Node)
Throws an exception if a right-hand side operand is not null.
ScriptNode ParseObject()
Parses an object ex nihilo.
ScriptNode ParseSequence()
Parses a sequence of statements.
ScriptNode ParseShifts()
Parses a shift operator.
char NextNonWhitespaceChar()
Returns the next non-whitespace character to be parsed, and moves the position forward accordingly....
bool IsNextChars(char ch, int Count)
If the next characters to be parsed is a given token consisting of a character being repeated a given...
ScriptNode ParseList()
Parses an element list.
ScriptNode ParseAnds()
Parses ANDs.