Exemplo n.º 1
0
	public IExpression  term() //throws RecognitionException, TokenStreamException
{
		IExpression exp;
		
		exp = null; IExpression rhs = null; BinaryOp op = BinaryOp.Undefined;
		
		exp=unary();
		{    // ( ... )*
			for (;;)
			{
				if ((tokenSet_14_.member(LA(1))))
				{
					{
						switch ( LA(1) )
						{
						case STAR:
						{
							match(STAR);
							if (0==inputState.guessing)
							{
								op = BinaryOp.Mult;
							}
							break;
						}
						case SLASH:
						{
							match(SLASH);
							if (0==inputState.guessing)
							{
								op = BinaryOp.Div;
							}
							break;
						}
						case PERCENT:
						{
							match(PERCENT);
							if (0==inputState.guessing)
							{
								op = BinaryOp.Mod;
							}
							break;
						}
						default:
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						 }
					}
					rhs=unary();
					if (0==inputState.guessing)
					{
						exp = new BinaryExpression(exp, rhs, op);
					}
				}
				else
				{
					goto _loop129_breakloop;
				}
				
			}
_loop129_breakloop:			;
		}    // ( ... )*
		return exp;
	}
Exemplo n.º 2
0
	public IExpression  and_expr() //throws RecognitionException, TokenStreamException
{
		IExpression exp;
		
		exp = null; IExpression rhs = null;
		
		exp=arith_expr();
		{    // ( ... )*
			for (;;)
			{
				if ((LA(1)==BAND))
				{
					match(BAND);
					rhs=arith_expr();
					if (0==inputState.guessing)
					{
						exp = new BinaryExpression(exp, rhs, BinaryOp.And2);
					}
				}
				else
				{
					goto _loop121_breakloop;
				}
				
			}
_loop121_breakloop:			;
		}    // ( ... )*
		return exp;
	}
Exemplo n.º 3
0
	public IExpression  arith_expr() //throws RecognitionException, TokenStreamException
{
		IExpression exp;
		
		IToken  t = null;
		exp = null; IExpression rhs = null;
		
		exp=term();
		{    // ( ... )*
			for (;;)
			{
				if ((LA(1)==PLUS||LA(1)==MINUS))
				{
					{
						switch ( LA(1) )
						{
						case PLUS:
						{
							t = LT(1);
							match(PLUS);
							break;
						}
						case MINUS:
						{
							match(MINUS);
							break;
						}
						default:
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						 }
					}
					rhs=term();
					if (0==inputState.guessing)
					{
						exp = new BinaryExpression(exp, rhs, t != null ? BinaryOp.Plus : BinaryOp.Minus);
					}
				}
				else
				{
					goto _loop125_breakloop;
				}
				
			}
_loop125_breakloop:			;
		}    // ( ... )*
		return exp;
	}
Exemplo n.º 4
0
	public IExpression  xor_expr() //throws RecognitionException, TokenStreamException
{
		IExpression exp;
		
		exp = null; IExpression rhs = null;
		
		exp=and_expr();
		{    // ( ... )*
			for (;;)
			{
				if ((LA(1)==BOR) && (tokenSet_12_.member(LA(2))))
				{
					match(BOR);
					rhs=and_expr();
					if (0==inputState.guessing)
					{
						exp = new BinaryExpression(exp, rhs, BinaryOp.Or2);
					}
				}
				else
				{
					goto _loop118_breakloop;
				}
				
			}
_loop118_breakloop:			;
		}    // ( ... )*
		return exp;
	}
Exemplo n.º 5
0
	public IExpression  comparison() //throws RecognitionException, TokenStreamException
{
		IExpression exp;
		
		exp = null; IExpression rhs = null; BinaryOp op = BinaryOp.Undefined;
		
		exp=expression();
		{    // ( ... )*
			for (;;)
			{
				if ((tokenSet_13_.member(LA(1))))
				{
					op=comp_op();
					rhs=expression();
					if (0==inputState.guessing)
					{
						exp = new BinaryExpression(exp, rhs, op);
					}
				}
				else
				{
					goto _loop108_breakloop;
				}
				
			}
_loop108_breakloop:			;
		}    // ( ... )*
		return exp;
	}
Exemplo n.º 6
0
	public IExpression  and_test() //throws RecognitionException, TokenStreamException
{
		IExpression exp;
		
		exp = null; IExpression rhs = null;
		
		exp=not_test();
		{    // ( ... )*
			for (;;)
			{
				if ((LA(1)==LITERAL_and))
				{
					match(LITERAL_and);
					rhs=not_test();
					if (0==inputState.guessing)
					{
						exp = new BinaryExpression(exp, rhs, BinaryOp.And);
					}
				}
				else
				{
					goto _loop103_breakloop;
				}
				
			}
_loop103_breakloop:			;
		}    // ( ... )*
		return exp;
	}
Exemplo n.º 7
0
	public IExpression  expression() //throws RecognitionException, TokenStreamException
{
		IExpression exp;
		
		exp = null; IExpression rhs = null;
		
		exp=xor_expr();
		{    // ( ... )*
			for (;;)
			{
				if ((LA(1)==BXOR))
				{
					match(BXOR);
					rhs=xor_expr();
					if (0==inputState.guessing)
					{
						exp = new BinaryExpression(exp, rhs, BinaryOp.Xor);
					}
				}
				else
				{
					goto _loop115_breakloop;
				}
				
			}
_loop115_breakloop:			;
		}    // ( ... )*
		return exp;
	}
Exemplo n.º 8
0
	public IExpression  test() //throws RecognitionException, TokenStreamException
{
		IExpression exp;
		
		exp = null; IExpression rhs = null;
		
		switch ( LA(1) )
		{
		case NUM_INT:
		case NUM_FLOAT:
		case NUM_LONG:
		case IDENT:
		case STATICIDENT:
		case INSTIDENT:
		case LITERAL_self:
		case LPAREN:
		case LCURLY:
		case LITERAL_not:
		case LNOT:
		case PLUS:
		case MINUS:
		case BNOT:
		case LBRACK:
		case LITERAL_base:
		case STRING_LITERAL:
		case CHAR_LITERAL:
		{
			exp=and_test();
			{    // ( ... )*
				for (;;)
				{
					if ((LA(1)==LITERAL_or))
					{
						match(LITERAL_or);
						rhs=and_test();
						if (0==inputState.guessing)
						{
							exp = new BinaryExpression(exp, rhs, BinaryOp.Or);
						}
					}
					else
					{
						goto _loop100_breakloop;
					}
					
				}
_loop100_breakloop:				;
			}    // ( ... )*
			break;
		}
		case LITERAL_lambda:
		{
			exp=lambda();
			break;
		}
		case LITERAL_raise:
		{
			exp=raise();
			break;
		}
		case LITERAL_yield:
		{
			exp=yield();
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		 }
		return exp;
	}