/// <summary>
/// Implements the following grammar rules
/// Expression_iCont -> {op_i+1} Expression_i+1 Expression_iCont
/// Expression_iCont -> Epsilon
/// </summary>
/// <param name="expressionLevel">the current level of the expression</param>
/// <param name="expressionLeft">the left part of the current expression</param>
/// <param name="enclosing">the root element for which this expression should be parsed</param>
/// <returns></returns>
private Expression ExpressionContinuation(int expressionLevel, Expression expressionLeft)
{
Expression retVal = expressionLeft;
string[] operators = BinaryExpression.Images(BinaryExpression.OperatorsByLevel[expressionLevel]);
string op = LookAhead(operators);
if (op != null && op.CompareTo("<") == 0)
{
// Avoid <- to be confused with < -1
if (Index < Buffer.Length - 1 && Buffer[Index + 1] == '-')
{
op = null;
}
}
if (op != null) // Expression_iCont -> {op_i+1} Expression_i+1 Expression_iCont
{
Match(op);
BinaryExpression.OPERATOR oper = BinaryExpression.FindOperatorByName(op);
Expression expressionRight = Expression(expressionLevel + 1);
if (expressionRight != null)
{
retVal = new BinaryExpression(Root, expressionLeft, oper, expressionRight); // {op_i+1} Expression_i+1
retVal = ExpressionContinuation(expressionLevel, retVal); // Expression_iCont
}
}
return(retVal);
}