protected Expression sum()
{
Expression e;
IToken add = null;
IToken sub = null;
IToken bitor = null;
IToken eo = null;
e = null;
Expression r = null;
IToken op = null;
BinaryOperatorType bOperator = BinaryOperatorType.None;
try { // for error handling
e=term();
{ // ( ... )*
for (;;)
{
if ((tokenSet_116_.member(LA(1))) && (tokenSet_114_.member(LA(2))))
{
{
switch ( LA(1) )
{
case ADD:
{
add = LT(1);
match(ADD);
if (0==inputState.guessing)
{
op=add; bOperator = BinaryOperatorType.Addition;
}
break;
}
case SUBTRACT:
{
sub = LT(1);
match(SUBTRACT);
if (0==inputState.guessing)
{
op=sub; bOperator = BinaryOperatorType.Subtraction;
}
break;
}
case BITWISE_OR:
{
bitor = LT(1);
match(BITWISE_OR);
if (0==inputState.guessing)
{
op=bitor; bOperator = BinaryOperatorType.BitwiseOr;
}
break;
}
case EXCLUSIVE_OR:
{
eo = LT(1);
match(EXCLUSIVE_OR);
if (0==inputState.guessing)
{
op=eo; bOperator = BinaryOperatorType.ExclusiveOr;
}
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
r=term();
if (0==inputState.guessing)
{
BinaryExpression be = new BinaryExpression(ToLexicalInfo(op));
be.Operator = bOperator;
be.Left = e;
be.Right = r;
e = be;
}
}
else
{
goto _loop527_breakloop;
}
}
_loop527_breakloop: ;
} // ( ... )*
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex, "sum");
recover(ex,tokenSet_117_);
}
else
{
throw ex;
}
}
return e;
}