Commit 55670a30 authored by gmantele's avatar gmantele
Browse files

[ADQL] Fix DEBUG mode in the ADQL parser. It is still by default disabled, but...

[ADQL] Fix DEBUG mode in the ADQL parser. It is still by default disabled, but now, it is possible again to enable it using the function 'setDebug(boolean)'.
parent 843c9960
Loading
Loading
Loading
Loading
+2791 −2481
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ public class ADQLParser implements ADQLParserConstants {
	*/
	public ADQLParser(){
		this(new java.io.ByteArrayInputStream("".getBytes()));
		setDebug(false);
	}

	/**
@@ -135,6 +136,7 @@ public class ADQLParser implements ADQLParserConstants {
	*/
	public ADQLParser(java.io.InputStream stream, QueryChecker checker, ADQLQueryFactory factory){
		this(stream);
		setDebug(false);

		queryChecker = checker;

@@ -172,6 +174,7 @@ public class ADQLParser implements ADQLParserConstants {
	*/
	public ADQLParser(java.io.InputStream stream, String encoding, QueryChecker checker, ADQLQueryFactory factory){
		this(stream, encoding);
		setDebug(false);

		queryChecker = checker;

@@ -210,6 +213,7 @@ public class ADQLParser implements ADQLParserConstants {
	*/
	public ADQLParser(java.io.Reader reader, QueryChecker checker, ADQLQueryFactory factory){
		this(reader);
		setDebug(false);

		queryChecker = checker;

@@ -246,6 +250,7 @@ public class ADQLParser implements ADQLParserConstants {
	*/
	public ADQLParser(ADQLParserTokenManager tm, QueryChecker checker, ADQLQueryFactory factory){
		this(tm);
		setDebug(false);

		queryChecker = checker;

@@ -478,6 +483,8 @@ public class ADQLParser implements ADQLParserConstants {
	* @throws ParseException	If the query syntax is incorrect.
	*/
	final public ADQLQuery Query() throws ParseException{
		trace_call("Query");
		try{
			ADQLQuery q = null;
			q = QueryExpression();
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
@@ -501,9 +508,14 @@ public class ADQLParser implements ADQLParserConstants {
					return q;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("Query");
		}
	}

	final public ADQLQuery QueryExpression() throws ParseException{
		trace_call("QueryExpression");
		try{
			TextPosition endPos = null;
			try{
				// create the query:
@@ -569,9 +581,14 @@ public class ADQLParser implements ADQLParserConstants {
					return previousQuery;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("QueryExpression");
		}
	}

	final public ADQLQuery SubQueryExpression() throws ParseException{
		trace_call("SubQueryExpression");
		try{
			ADQLQuery q = null;
			Token start, end;
			start = jj_consume_token(LEFT_PAR);
@@ -583,9 +600,14 @@ public class ADQLParser implements ADQLParserConstants {
					return q;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("SubQueryExpression");
		}
	}

	final public void Select() throws ParseException{
		trace_call("Select");
		try{
			ClauseSelect select = query.getSelect();
			SelectItem item = null;
			Token start, t = null;
@@ -633,9 +655,14 @@ public class ADQLParser implements ADQLParserConstants {
			}
			TextPosition lastItemPos = query.getSelect().get(query.getSelect().size() - 1).getPosition();
			select.setPosition(new TextPosition(start.beginLine, start.beginColumn, lastItemPos.endLine, lastItemPos.endColumn));
		}finally{
			trace_return("Select");
		}
	}

	final public SelectItem SelectItem() throws ParseException{
		trace_call("SelectItem");
		try{
			IdentifierItems identifiers = new IdentifierItems(true);
			IdentifierItem id = null, label = null;
			ADQLOperand op = null;
@@ -782,9 +809,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("SelectItem");
		}
	}

	final public void From() throws ParseException{
		trace_call("From");
		try{
			FromContent content = null, content2 = null;
			try{
				jj_consume_token(FROM);
@@ -811,9 +843,14 @@ public class ADQLParser implements ADQLParserConstants {
						throw generateParseException(ex);
				}
			}
		}finally{
			trace_return("From");
		}
	}

	final public void Where() throws ParseException{
		trace_call("Where");
		try{
			ClauseConstraints where = query.getWhere();
			ADQLConstraint condition;
			Token start;
@@ -821,9 +858,14 @@ public class ADQLParser implements ADQLParserConstants {
			ConditionsList(where);
			TextPosition endPosition = where.getPosition();
			where.setPosition(new TextPosition(start.beginLine, start.beginColumn, endPosition.endLine, endPosition.endColumn));
		}finally{
			trace_return("Where");
		}
	}

	final public void GroupBy() throws ParseException{
		trace_call("GroupBy");
		try{
			ClauseADQL<ColumnReference> groupBy = query.getGroupBy();
			ColumnReference colRef = null;
			Token start;
@@ -844,18 +886,28 @@ public class ADQLParser implements ADQLParserConstants {
				groupBy.add(colRef);
			}
			groupBy.setPosition(new TextPosition(start.beginLine, start.beginColumn, colRef.getPosition().endLine, colRef.getPosition().endColumn));
		}finally{
			trace_return("GroupBy");
		}
	}

	final public void Having() throws ParseException{
		trace_call("Having");
		try{
			ClauseConstraints having = query.getHaving();
			Token start;
			start = jj_consume_token(HAVING);
			ConditionsList(having);
			TextPosition endPosition = having.getPosition();
			having.setPosition(new TextPosition(start.beginLine, start.beginColumn, endPosition.endLine, endPosition.endColumn));
		}finally{
			trace_return("Having");
		}
	}

	final public void OrderBy() throws ParseException{
		trace_call("OrderBy");
		try{
			ClauseADQL<ADQLOrder> orderBy = query.getOrderBy();
			ADQLOrder order = null;
			Token start;
@@ -876,12 +928,17 @@ public class ADQLParser implements ADQLParserConstants {
				orderBy.add(order);
			}
			orderBy.setPosition(new TextPosition(start.beginLine, start.beginColumn, order.getPosition().endLine, order.getPosition().endColumn));
		}finally{
			trace_return("OrderBy");
		}
	}

	/* *************************** */
	/* COLUMN AND TABLE REFERENCES */
	/* *************************** */
	final public IdentifierItem Identifier() throws ParseException{
		trace_call("Identifier");
		try{
			Token t;
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
				case REGULAR_IDENTIFIER:
@@ -904,6 +961,9 @@ public class ADQLParser implements ADQLParserConstants {
					throw new ParseException();
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("Identifier");
		}
	}

	/**
@@ -912,6 +972,8 @@ public class ADQLParser implements ADQLParserConstants {
	 * @return A {@link IdentifierItems} which contains at most three items: catalogName, schemaName and tableName.
	 */
	final public IdentifierItems TableName() throws ParseException{
		trace_call("TableName");
		try{
			IdentifierItems identifiers = new IdentifierItems(true);
			IdentifierItem id = null;
			id = Identifier();
@@ -941,6 +1003,9 @@ public class ADQLParser implements ADQLParserConstants {
					return identifiers;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("TableName");
		}
	}

	/**
@@ -949,6 +1014,8 @@ public class ADQLParser implements ADQLParserConstants {
	 * @return A {@link IdentifierItems} which contains at most four items: catalogName, schemaName, tableName and columnName.
	 */
	final public IdentifierItems ColumnName() throws ParseException{
		trace_call("ColumnName");
		try{
			IdentifierItem id;
			IdentifierItems table = null, identifiers = new IdentifierItems(false);
			id = Identifier();
@@ -971,9 +1038,14 @@ public class ADQLParser implements ADQLParserConstants {
					return identifiers;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("ColumnName");
		}
	}

	final public ADQLColumn Column() throws ParseException{
		trace_call("Column");
		try{
			IdentifierItems identifiers;
			identifiers = ColumnName();
			try{
@@ -988,9 +1060,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("Column");
		}
	}

	final public ColumnReference ColumnRef() throws ParseException{
		trace_call("ColumnRef");
		try{
			IdentifierItems identifiers = null;
			Token ind = null;
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
@@ -1023,9 +1100,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("ColumnRef");
		}
	}

	final public ADQLOrder OrderItem() throws ParseException{
		trace_call("OrderItem");
		try{
			IdentifierItems identifiers = null;
			Token ind = null, desc = null;
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
@@ -1081,9 +1163,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("OrderItem");
		}
	}

	final public FromContent SimpleTableRef() throws ParseException{
		trace_call("SimpleTableRef");
		try{
			IdentifierItem alias = null;
			IdentifierItems identifiers = null;
			ADQLQuery subQuery = null;
@@ -1170,9 +1257,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("SimpleTableRef");
		}
	}

	final public FromContent TableRef() throws ParseException{
		trace_call("TableRef");
		try{
			FromContent content;
			content = SimpleTableRef();
			label_5: while(true){
@@ -1188,9 +1280,14 @@ public class ADQLParser implements ADQLParserConstants {
					return content;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("TableRef");
		}
	}

	final public FromContent JoinedTable() throws ParseException{
		trace_call("JoinedTable");
		try{
			FromContent content;
			content = SimpleTableRef();
			label_6: while(true){
@@ -1214,9 +1311,14 @@ public class ADQLParser implements ADQLParserConstants {
					return content;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("JoinedTable");
		}
	}

	final public ADQLJoin JoinSpecification(FromContent leftTable) throws ParseException{
		trace_call("JoinSpecification");
		try{
			boolean natural = false;
			JoinType type = JoinType.INNER;
			ClauseConstraints condition = new ClauseConstraints("ON");
@@ -1399,12 +1501,17 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("JoinSpecification");
		}
	}

	/* ****** */
	/* STRING */
	/* ****** */
	final public StringConstant String() throws ParseException{
		trace_call("String");
		try{
			Token t;
			String str = "";
			StringConstant cst;
@@ -1435,12 +1542,17 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("String");
		}
	}

	/* ************* */
	/* NUMERIC TYPES */
	/* ************* */
	final public NumericConstant UnsignedNumeric() throws ParseException{
		trace_call("UnsignedNumeric");
		try{
			Token t;
			NumericConstant cst;
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
@@ -1472,9 +1584,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("UnsignedNumeric");
		}
	}

	final public NumericConstant UnsignedFloat() throws ParseException{
		trace_call("UnsignedFloat");
		try{
			Token t;
			NumericConstant cst;
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
@@ -1503,9 +1620,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("UnsignedFloat");
		}
	}

	final public NumericConstant SignedInteger() throws ParseException{
		trace_call("SignedInteger");
		try{
			Token sign = null, number;
			NumericConstant cst;
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
@@ -1548,12 +1670,17 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("SignedInteger");
		}
	}

	/* *********** */
	/* EXPRESSIONS */
	/* *********** */
	final public ADQLOperand NumericValueExpressionPrimary() throws ParseException{
		trace_call("NumericValueExpressionPrimary");
		try{
			String expr;
			ADQLColumn column;
			ADQLOperand op;
@@ -1613,9 +1740,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("NumericValueExpressionPrimary");
		}
	}

	final public ADQLOperand StringValueExpressionPrimary() throws ParseException{
		trace_call("StringValueExpressionPrimary");
		try{
			StringConstant expr;
			ADQLColumn column;
			ADQLOperand op;
@@ -1659,9 +1791,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("StringValueExpressionPrimary");
		}
	}

	final public ADQLOperand ValueExpression() throws ParseException{
		trace_call("ValueExpression");
		try{
			ADQLOperand valueExpr = null;
			try{
				if (jj_2_4(2147483647)){
@@ -1756,9 +1893,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("ValueExpression");
		}
	}

	final public ADQLOperand NumericExpression() throws ParseException{
		trace_call("NumericExpression");
		try{
			Token sign = null;
			ADQLOperand leftOp, rightOp = null;
			leftOp = NumericTerm();
@@ -1802,9 +1944,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("NumericExpression");
		}
	}

	final public ADQLOperand NumericTerm() throws ParseException{
		trace_call("NumericTerm");
		try{
			Token sign = null;
			ADQLOperand leftOp, rightOp = null;
			leftOp = Factor();
@@ -1848,9 +1995,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("NumericTerm");
		}
	}

	final public ADQLOperand Factor() throws ParseException{
		trace_call("Factor");
		try{
			boolean negative = false;
			Token minusSign = null;
			ADQLOperand op;
@@ -1916,9 +2068,14 @@ public class ADQLParser implements ADQLParserConstants {
					return op;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("Factor");
		}
	}

	final public ADQLOperand StringExpression() throws ParseException{
		trace_call("StringExpression");
		try{
			ADQLOperand leftOp;
			ADQLOperand rightOp = null;
			leftOp = StringFactor();
@@ -1956,9 +2113,14 @@ public class ADQLParser implements ADQLParserConstants {
					return leftOp;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("StringExpression");
		}
	}

	final public ADQLOperand StringFactor() throws ParseException{
		trace_call("StringFactor");
		try{
			ADQLOperand op;
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
				case COORDSYS:
@@ -1989,9 +2151,14 @@ public class ADQLParser implements ADQLParserConstants {
					return op;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("StringFactor");
		}
	}

	final public GeometryValue<GeometryFunction> GeometryExpression() throws ParseException{
		trace_call("GeometryExpression");
		try{
			ADQLColumn col = null;
			GeometryFunction gf = null;
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
@@ -2023,12 +2190,17 @@ public class ADQLParser implements ADQLParserConstants {
					return new GeometryValue<GeometryFunction>(gf);
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("GeometryExpression");
		}
	}

	/* ********************************** */
	/* BOOLEAN EXPRESSIONS (WHERE clause) */
	/* ********************************** */
	final public ClauseConstraints ConditionsList(ClauseConstraints clause) throws ParseException{
		trace_call("ConditionsList");
		try{
			ADQLConstraint constraint = null;
			Token op = null;
			boolean notOp = false;
@@ -2114,9 +2286,14 @@ public class ADQLParser implements ADQLParserConstants {
					return clause;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("ConditionsList");
		}
	}

	final public ADQLConstraint Constraint() throws ParseException{
		trace_call("Constraint");
		try{
			ADQLConstraint constraint = null;
			Token start, end;
			if (jj_2_12(2147483647)){
@@ -2148,9 +2325,14 @@ public class ADQLParser implements ADQLParserConstants {
					return constraint;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("Constraint");
		}
	}

	final public ADQLConstraint Predicate() throws ParseException{
		trace_call("Predicate");
		try{
			ADQLQuery q = null;
			ADQLColumn column = null;
			ADQLOperand strExpr1 = null, strExpr2 = null;
@@ -2305,9 +2487,14 @@ public class ADQLParser implements ADQLParserConstants {
					return constraint;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("Predicate");
		}
	}

	final public Comparison ComparisonEnd(ADQLOperand leftOp) throws ParseException{
		trace_call("ComparisonEnd");
		try{
			Token comp;
			ADQLOperand rightOp;
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
@@ -2349,9 +2536,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("ComparisonEnd");
		}
	}

	final public Between BetweenEnd(ADQLOperand leftOp) throws ParseException{
		trace_call("BetweenEnd");
		try{
			Token start, notToken = null;
			ADQLOperand min, max;
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
@@ -2382,9 +2574,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("BetweenEnd");
		}
	}

	final public In InEnd(ADQLOperand leftOp) throws ParseException{
		trace_call("InEnd");
		try{
			Token not = null, start;
			ADQLQuery q = null;
			ADQLOperand item;
@@ -2452,12 +2649,17 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("InEnd");
		}
	}

	/* ************* */
	/* SQL FUNCTIONS */
	/* ************* */
	final public SQLFunction SqlFunction() throws ParseException{
		trace_call("SqlFunction");
		try{
			Token fct, all = null, distinct = null, end;
			ADQLOperand op = null;
			SQLFunction funct = null;
@@ -2591,12 +2793,17 @@ public class ADQLParser implements ADQLParserConstants {
					return funct;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("SqlFunction");
		}
	}

	/* ************** */
	/* ADQL FUNCTIONS */
	/* ************** */
	final public ADQLOperand[] Coordinates() throws ParseException{
		trace_call("Coordinates");
		try{
			ADQLOperand[] ops = new ADQLOperand[2];
			ops[0] = NumericExpression();
			jj_consume_token(COMMA);
@@ -2606,9 +2813,14 @@ public class ADQLParser implements ADQLParserConstants {
					return ops;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("Coordinates");
		}
	}

	final public GeometryFunction GeometryFunction() throws ParseException{
		trace_call("GeometryFunction");
		try{
			Token fct = null, end;
			GeometryValue<GeometryFunction> gvf1, gvf2;
			GeometryValue<PointFunction> gvp1, gvp2;
@@ -2752,9 +2964,14 @@ public class ADQLParser implements ADQLParserConstants {
					return gf;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("GeometryFunction");
		}
	}

	final public ADQLOperand CoordinateSystem() throws ParseException{
		trace_call("CoordinateSystem");
		try{
			ADQLOperand coordSys = null;
			coordSys = StringExpression();
			{
@@ -2762,9 +2979,14 @@ public class ADQLParser implements ADQLParserConstants {
					return coordSys;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("CoordinateSystem");
		}
	}

	final public GeometryFunction GeometryValueFunction() throws ParseException{
		trace_call("GeometryValueFunction");
		try{
			Token fct = null, end = null;
			ADQLOperand coordSys;
			ADQLOperand width, height;
@@ -2868,9 +3090,14 @@ public class ADQLParser implements ADQLParserConstants {
					return gf;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("GeometryValueFunction");
		}
	}

	final public PointFunction Point() throws ParseException{
		trace_call("Point");
		try{
			Token start, end;
			ADQLOperand coordSys;
			ADQLOperand[] coords;
@@ -2894,9 +3121,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("Point");
		}
	}

	final public GeometryFunction ExtractCoordSys() throws ParseException{
		trace_call("ExtractCoordSys");
		try{
			Token start, end;
			GeometryValue<GeometryFunction> gvf;
			start = jj_consume_token(COORDSYS);
@@ -2917,12 +3149,17 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("ExtractCoordSys");
		}
	}

	/* ***************** */
	/* NUMERIC FUNCTIONS */
	/* ***************** */
	final public ADQLFunction NumericFunction() throws ParseException{
		trace_call("NumericFunction");
		try{
			ADQLFunction fct;
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
				case ABS:
@@ -2974,9 +3211,14 @@ public class ADQLParser implements ADQLParserConstants {
					return fct;
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("NumericFunction");
		}
	}

	final public MathFunction MathFunction() throws ParseException{
		trace_call("MathFunction");
		try{
			Token fct = null, end;
			ADQLOperand param1 = null, param2 = null;
			NumericConstant integerValue = null;
@@ -3164,9 +3406,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("MathFunction");
		}
	}

	final public MathFunction TrigFunction() throws ParseException{
		trace_call("TrigFunction");
		try{
			Token fct = null, end;
			ADQLOperand param1 = null, param2 = null;
			switch((jj_ntk == -1) ? jj_ntk() : jj_ntk){
@@ -3244,9 +3491,14 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("TrigFunction");
		}
	}

	final public UserDefinedFunction UserDefinedFunction() throws ParseException{
		trace_call("UserDefinedFunction");
		try{
			Token fct, end;
			Vector<ADQLOperand> params = new Vector<ADQLOperand>();
			ADQLOperand op;
@@ -3352,6 +3604,9 @@ public class ADQLParser implements ADQLParserConstants {
				}
			}
			throw new Error("Missing return statement in function");
		}finally{
			trace_return("UserDefinedFunction");
		}
	}

	private boolean jj_2_1(int xla){
@@ -3546,26 +3801,6 @@ public class ADQLParser implements ADQLParserConstants {
		}
	}

	private boolean jj_3R_138(){
		if (jj_scan_token(CIRCLE))
			return true;
		if (jj_scan_token(LEFT_PAR))
			return true;
		if (jj_3R_169())
			return true;
		if (jj_scan_token(COMMA))
			return true;
		if (jj_3R_170())
			return true;
		if (jj_scan_token(COMMA))
			return true;
		if (jj_3R_108())
			return true;
		if (jj_scan_token(RIGHT_PAR))
			return true;
		return false;
	}

	private boolean jj_3R_126(){
		if (jj_scan_token(LEFT_PAR))
			return true;
@@ -5819,6 +6054,26 @@ public class ADQLParser implements ADQLParserConstants {
		return false;
	}

	private boolean jj_3R_138(){
		if (jj_scan_token(CIRCLE))
			return true;
		if (jj_scan_token(LEFT_PAR))
			return true;
		if (jj_3R_169())
			return true;
		if (jj_scan_token(COMMA))
			return true;
		if (jj_3R_170())
			return true;
		if (jj_scan_token(COMMA))
			return true;
		if (jj_3R_108())
			return true;
		if (jj_scan_token(RIGHT_PAR))
			return true;
		return false;
	}

	/** Generated Token Manager. */
	public ADQLParserTokenManager token_source;
	SimpleCharStream jj_input_stream;
@@ -5976,6 +6231,7 @@ public class ADQLParser implements ADQLParserConstants {
					}
				}
			}
			trace_token(token, "");
			return token;
		}
		token = oldToken;
@@ -6023,6 +6279,7 @@ public class ADQLParser implements ADQLParserConstants {
			token = token.next = token_source.getNextToken();
		jj_ntk = -1;
		jj_gen++;
		trace_token(token, " (in getNextToken)");
		return token;
	}

@@ -6121,11 +6378,64 @@ public class ADQLParser implements ADQLParserConstants {
		return new ParseException(token, exptokseq, tokenImage);
	}

	private int trace_indent = 0;
	private boolean trace_enabled = true;

	/** Enable tracing. */
	final public void enable_tracing(){}
	final public void enable_tracing(){
		trace_enabled = true;
	}

	/** Disable tracing. */
	final public void disable_tracing(){}
	final public void disable_tracing(){
		trace_enabled = false;
	}

	private void trace_call(String s){
		if (trace_enabled){
			for(int i = 0; i < trace_indent; i++){
				System.out.print(" ");
			}
			System.out.println("Call:   " + s);
		}
		trace_indent = trace_indent + 2;
	}

	private void trace_return(String s){
		trace_indent = trace_indent - 2;
		if (trace_enabled){
			for(int i = 0; i < trace_indent; i++){
				System.out.print(" ");
			}
			System.out.println("Return: " + s);
		}
	}

	private void trace_token(Token t, String where){
		if (trace_enabled){
			for(int i = 0; i < trace_indent; i++){
				System.out.print(" ");
			}
			System.out.print("Consumed token: <" + tokenImage[t.kind]);
			if (t.kind != 0 && !tokenImage[t.kind].equals("\"" + t.image + "\"")){
				System.out.print(": \"" + t.image + "\"");
			}
			System.out.println(" at line " + t.beginLine + " column " + t.beginColumn + ">" + where);
		}
	}

	private void trace_scan(Token t1, int t2){
		if (trace_enabled){
			for(int i = 0; i < trace_indent; i++){
				System.out.print(" ");
			}
			System.out.print("Visited token: <" + tokenImage[t1.kind]);
			if (t1.kind != 0 && !tokenImage[t1.kind].equals("\"" + t1.image + "\"")){
				System.out.print(": \"" + t1.image + "\"");
			}
			System.out.println(" at line " + t1.beginLine + " column " + t1.beginColumn + ">; Expected token: <" + tokenImage[t2] + ">");
		}
	}

	private void jj_rescan_token(){
		jj_rescan = true;
+6 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@
options {
	STATIC = false;
	IGNORE_CASE = true;
	DEBUG_PARSER = false;
	DEBUG_PARSER = true;
}

							/* ########## */
@@ -113,6 +113,7 @@ public class ADQLParser {
	*/
	public ADQLParser(){
		this(new java.io.ByteArrayInputStream("".getBytes()));
		setDebug(false);
	}
	
	/**
@@ -157,6 +158,7 @@ public class ADQLParser {
	*/
	public ADQLParser(java.io.InputStream stream, QueryChecker checker, ADQLQueryFactory factory) {
		this(stream);
		setDebug(false);
		
		queryChecker = checker;
		
@@ -194,6 +196,7 @@ public class ADQLParser {
	*/
	public ADQLParser(java.io.InputStream stream, String encoding, QueryChecker checker, ADQLQueryFactory factory) {
		this(stream, encoding);
		setDebug(false);
		
		queryChecker = checker;
		
@@ -232,6 +235,7 @@ public class ADQLParser {
	*/
	public ADQLParser(java.io.Reader reader, QueryChecker checker, ADQLQueryFactory factory) {
		this(reader);
		setDebug(false);
		
		queryChecker = checker;

@@ -268,6 +272,7 @@ public class ADQLParser {
	*/
	public ADQLParser(ADQLParserTokenManager tm, QueryChecker checker, ADQLQueryFactory factory) {
		this(tm);
		setDebug(false);
		
		queryChecker = checker;