public static bool AcceptExpression(Dictionary<string, Expression> Variables, string Text, ref int Index, ref Expression Expression, out int ErrorIndex)
{
ErrorIndex = Index;
if (AcceptTerm(Variables, Text, ref Index, ref Expression, out ErrorIndex))
{
_OpTree curtree = new _OpTree(Expression);
int cur = Index;
while (true)
{
AcceptExtendedWhitespace(Text, ref cur);
Operator op = null;
if (AcceptOperator(Text, ref cur, ref op))
{
AcceptExtendedWhitespace(Text, ref cur);
if (AcceptTerm(Variables, Text, ref cur, ref Expression, out ErrorIndex))
{
curtree = _OpTree.Combine(curtree, op, Expression);
Index = cur;
continue;
}
return false;
}
break;
}
Expression = curtree.Expression;
return true;
}
return false;
}