public NCalcParser.shiftExpression_return shiftExpression()
{
NCalcParser.shiftExpression_return retval = new NCalcParser.shiftExpression_return();
retval.Start = input.LT(1);
CommonTree root_0 = null;
IToken string_literal16 = null;
IToken string_literal17 = null;
NCalcParser.additiveExpression_return left = null;
NCalcParser.additiveExpression_return right = null;
CommonTree string_literal16_tree=null;
CommonTree string_literal17_tree=null;
BinaryExpressionType type = BinaryExpressionType.Unknown;
try
{
// C:\\Users\\s.ros\\Documents\\Développement\\NCalc\\Grammar\\NCalc.g:163:2: (left= additiveExpression ( ( '<<' | '>>' ) right= additiveExpression )* )
// C:\\Users\\s.ros\\Documents\\Développement\\NCalc\\Grammar\\NCalc.g:163:4: left= additiveExpression ( ( '<<' | '>>' ) right= additiveExpression )*
{
root_0 = (CommonTree)adaptor.GetNilNode();
PushFollow(FOLLOW_additiveExpression_in_shiftExpression560);
left = additiveExpression();
state.followingStackPointer--;
adaptor.AddChild(root_0, left.Tree);
retval.value = ((left != null) ? left.value : null);
// C:\\Users\\s.ros\\Documents\\Développement\\NCalc\\Grammar\\NCalc.g:163:54: ( ( '<<' | '>>' ) right= additiveExpression )*
do
{
int alt12 = 2;
int LA12_0 = input.LA(1);
if ( ((LA12_0 >= 36 && LA12_0 <= 37)) )
{
alt12 = 1;
}
switch (alt12)
{
case 1 :
// C:\\Users\\s.ros\\Documents\\Développement\\NCalc\\Grammar\\NCalc.g:164:4: ( '<<' | '>>' ) right= additiveExpression
{
// C:\\Users\\s.ros\\Documents\\Développement\\NCalc\\Grammar\\NCalc.g:164:4: ( '<<' | '>>' )
int alt11 = 2;
int LA11_0 = input.LA(1);
if ( (LA11_0 == 36) )
{
alt11 = 1;
}
else if ( (LA11_0 == 37) )
{
alt11 = 2;
}
else
{
NoViableAltException nvae_d11s0 =
new NoViableAltException("", 11, 0, input);
throw nvae_d11s0;
}
switch (alt11)
{
case 1 :
// C:\\Users\\s.ros\\Documents\\Développement\\NCalc\\Grammar\\NCalc.g:164:6: '<<'
{
string_literal16=(IToken)Match(input,36,FOLLOW_36_in_shiftExpression571);
string_literal16_tree = (CommonTree)adaptor.Create(string_literal16);
adaptor.AddChild(root_0, string_literal16_tree);
type = BinaryExpressionType.LeftShift;
}
break;
case 2 :
// C:\\Users\\s.ros\\Documents\\Développement\\NCalc\\Grammar\\NCalc.g:165:6: '>>'
{
string_literal17=(IToken)Match(input,37,FOLLOW_37_in_shiftExpression581);
string_literal17_tree = (CommonTree)adaptor.Create(string_literal17);
adaptor.AddChild(root_0, string_literal17_tree);
type = BinaryExpressionType.RightShift;
}
break;
}
PushFollow(FOLLOW_additiveExpression_in_shiftExpression593);
right = additiveExpression();
state.followingStackPointer--;
adaptor.AddChild(root_0, right.Tree);
retval.value = new BinaryExpression(type, retval.value, ((right != null) ? right.value : null));
}
break;
default:
goto loop12;
}
} while (true);
loop12:
; // Stops C# compiler whining that label 'loop12' has no statements
}
retval.Stop = input.LT(-1);
retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
// Conversion of the second argument necessary, but harmless
retval.Tree = (CommonTree)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re);
}
finally
{
}
return retval;
}