Commit d648f48b authored by gmantele's avatar gmantele
Browse files

ADQLObject has now a new function: getPosition(). To allow it, the parser and...

ADQLObject has now a new function: getPosition(). To allow it, the parser and all ADQL query tree item have been modified to define this function properly. The parser is setting this position for all parsed items. The test class/main function "TestGetPositionInAllADQLObject" aims to check that after a parsing all items really have a defined position.
parent 509d669c
Loading
Loading
Loading
Loading
+1479 −1305

File changed.

Preview size limit exceeded, changes collapsed.

+305 −200
Original line number Diff line number Diff line
/* Generated By:JavaCC: Do not edit this line. ADQLParserConstants.java */
package adql.parser;


/**
 * Token literal values and constants.
 * Generated by org.javacc.parser.OtherFilesGen#start()
@@ -208,6 +209,110 @@ public interface ADQLParserConstants {
  int WithinDelimitedId = 3;

  /** Literal token values. */
	String[] tokenImage = {"<EOF>","<token of kind 1>","\"(\"","\")\"","\".\"","\",\"","\";\"","\"||\"","\"+\"","\"-\"","\"*\"","\"/\"","\"=\"","<NOT_EQUAL>","\"<\"","\"<=\"","\">\"","\">=\"","\"SELECT\"","<QUANTIFIER>","\"TOP\"","\"FROM\"","\"AS\"","\"NATURAL\"","\"INNER\"","\"OUTER\"","\"RIGHT\"","\"LEFT\"","\"FULL\"","\"JOIN\"","\"ON\"","\"USING\"","\"WHERE\"","\"AND\"","\"OR\"","\"NOT\"","\"IS\"","\"NULL\"","\"BETWEEN\"","\"LIKE\"","\"IN\"","\"EXISTS\"","\"GROUP BY\"","\"HAVING\"","\"ORDER BY\"","\"ASC\"","\"DESC\"","\"AVG\"","\"MAX\"","\"MIN\"","\"SUM\"","\"COUNT\"","\"BOX\"","\"CENTROID\"","\"CIRCLE\"","\"POINT\"","\"POLYGON\"","\"REGION\"","\"CONTAINS\"","\"INTERSECTS\"","\"AREA\"","\"COORD1\"","\"COORD2\"","\"COORDSYS\"","\"DISTANCE\"","\"ABS\"","\"CEILING\"","\"DEGREES\"","\"EXP\"","\"FLOOR\"","\"LOG\"","\"LOG10\"","\"MOD\"","\"PI\"","\"POWER\"","\"RADIANS\"","\"RAND\"","\"ROUND\"","\"SQRT\"","\"TRUNCATE\"","\"ACOS\"","\"ASIN\"","\"ATAN\"","\"ATAN2\"","\"COS\"","\"COT\"","\"SIN\"","\"TAN\"","<token of kind 88>","<token of kind 89>","<token of kind 90>","\"\\\'\"","<token of kind 92>","\"\\\'\"","\"\\\"\"","<token of kind 95>","\"\\\"\"","<REGULAR_IDENTIFIER>","<Letter>","<SCIENTIFIC_NUMBER>","<UNSIGNED_FLOAT>","<UNSIGNED_INTEGER>","<DIGIT>",};
  String[] tokenImage = {
    "<EOF>",
    "<token of kind 1>",
    "\"(\"",
    "\")\"",
    "\".\"",
    "\",\"",
    "\";\"",
    "\"||\"",
    "\"+\"",
    "\"-\"",
    "\"*\"",
    "\"/\"",
    "\"=\"",
    "<NOT_EQUAL>",
    "\"<\"",
    "\"<=\"",
    "\">\"",
    "\">=\"",
    "\"SELECT\"",
    "<QUANTIFIER>",
    "\"TOP\"",
    "\"FROM\"",
    "\"AS\"",
    "\"NATURAL\"",
    "\"INNER\"",
    "\"OUTER\"",
    "\"RIGHT\"",
    "\"LEFT\"",
    "\"FULL\"",
    "\"JOIN\"",
    "\"ON\"",
    "\"USING\"",
    "\"WHERE\"",
    "\"AND\"",
    "\"OR\"",
    "\"NOT\"",
    "\"IS\"",
    "\"NULL\"",
    "\"BETWEEN\"",
    "\"LIKE\"",
    "\"IN\"",
    "\"EXISTS\"",
    "\"GROUP BY\"",
    "\"HAVING\"",
    "\"ORDER BY\"",
    "\"ASC\"",
    "\"DESC\"",
    "\"AVG\"",
    "\"MAX\"",
    "\"MIN\"",
    "\"SUM\"",
    "\"COUNT\"",
    "\"BOX\"",
    "\"CENTROID\"",
    "\"CIRCLE\"",
    "\"POINT\"",
    "\"POLYGON\"",
    "\"REGION\"",
    "\"CONTAINS\"",
    "\"INTERSECTS\"",
    "\"AREA\"",
    "\"COORD1\"",
    "\"COORD2\"",
    "\"COORDSYS\"",
    "\"DISTANCE\"",
    "\"ABS\"",
    "\"CEILING\"",
    "\"DEGREES\"",
    "\"EXP\"",
    "\"FLOOR\"",
    "\"LOG\"",
    "\"LOG10\"",
    "\"MOD\"",
    "\"PI\"",
    "\"POWER\"",
    "\"RADIANS\"",
    "\"RAND\"",
    "\"ROUND\"",
    "\"SQRT\"",
    "\"TRUNCATE\"",
    "\"ACOS\"",
    "\"ASIN\"",
    "\"ATAN\"",
    "\"ATAN2\"",
    "\"COS\"",
    "\"COT\"",
    "\"SIN\"",
    "\"TAN\"",
    "<token of kind 88>",
    "<token of kind 89>",
    "<token of kind 90>",
    "\"\\\'\"",
    "<token of kind 92>",
    "\"\\\'\"",
    "\"\\\"\"",
    "<token of kind 95>",
    "\"\\\"\"",
    "<REGULAR_IDENTIFIER>",
    "<Letter>",
    "<SCIENTIFIC_NUMBER>",
    "<UNSIGNED_FLOAT>",
    "<UNSIGNED_INTEGER>",
    "<DIGIT>",
  };

}
+1820 −1695

File changed.

Preview size limit exceeded, changes collapsed.

+22 −17
Original line number Diff line number Diff line
@@ -16,7 +16,8 @@ package adql.parser;
 * You should have received a copy of the GNU Lesser General Public License
 * along with ADQLLibrary.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Copyright 2012 - UDS/Centre de Données astronomiques de Strasbourg (CDS)
 * Copyright 2012-2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
 *                       Astronomishes Rechen Institute (ARI)
 */

import java.util.Collection;
@@ -30,26 +31,24 @@ import adql.query.ColumnReference;
import adql.query.IdentifierField;
import adql.query.SelectItem;
import adql.query.TextPosition;
import adql.query.constraint.ADQLConstraint;
import adql.query.constraint.Between;
import adql.query.constraint.Comparison;
import adql.query.constraint.ADQLConstraint;
import adql.query.constraint.ConstraintsGroup;
import adql.query.constraint.ComparisonOperator;
import adql.query.constraint.ConstraintsGroup;
import adql.query.constraint.Exists;
import adql.query.constraint.In;
import adql.query.constraint.IsNull;
import adql.query.constraint.NotConstraint;

import adql.query.from.ADQLJoin;
import adql.query.from.ADQLTable;
import adql.query.from.FromContent;
import adql.query.from.CrossJoin;
import adql.query.from.FromContent;
import adql.query.from.InnerJoin;
import adql.query.from.OuterJoin;
import adql.query.from.OuterJoin.OuterType;

import adql.query.operand.ADQLOperand;
import adql.query.operand.ADQLColumn;
import adql.query.operand.ADQLOperand;
import adql.query.operand.Concatenation;
import adql.query.operand.NegativeOperand;
import adql.query.operand.NumericConstant;
@@ -57,14 +56,12 @@ import adql.query.operand.Operation;
import adql.query.operand.OperationType;
import adql.query.operand.StringConstant;
import adql.query.operand.WrappedOperand;

import adql.query.operand.function.DefaultUDF;
import adql.query.operand.function.MathFunction;
import adql.query.operand.function.MathFunctionType;
import adql.query.operand.function.SQLFunction;
import adql.query.operand.function.SQLFunctionType;
import adql.query.operand.function.UserDefinedFunction;
import adql.query.operand.function.geometry.GeometryFunction.GeometryValue;
import adql.query.operand.function.geometry.AreaFunction;
import adql.query.operand.function.geometry.BoxFunction;
import adql.query.operand.function.geometry.CentroidFunction;
@@ -74,6 +71,7 @@ import adql.query.operand.function.geometry.DistanceFunction;
import adql.query.operand.function.geometry.ExtractCoord;
import adql.query.operand.function.geometry.ExtractCoordSys;
import adql.query.operand.function.geometry.GeometryFunction;
import adql.query.operand.function.geometry.GeometryFunction.GeometryValue;
import adql.query.operand.function.geometry.IntersectsFunction;
import adql.query.operand.function.geometry.PointFunction;
import adql.query.operand.function.geometry.PolygonFunction;
@@ -84,8 +82,8 @@ import adql.query.operand.function.geometry.RegionFunction;
 * 
 * <p>To customize the object representation you merely have to extends the appropriate functions of this class.</p>
 * 
 * @author Gr&eacute;gory Mantelet (CDS)
 * @version 08/2011
 * @author Gr&eacute;gory Mantelet (CDS;ARI)
 * @version 1.3 (05/2014)
 * 
 * @see ADQLParser
 */
@@ -122,9 +120,6 @@ public class ADQLQueryFactory {
			caseSensitivity = IdentifierField.ALIAS.setCaseSensitive(caseSensitivity, alias.caseSensitivity);
		t.setCaseSensitive(caseSensitivity);

		// Set the position in the query:
		t.setPosition(idItems.getPosition());

		return t;
	}

@@ -378,6 +373,18 @@ public class ADQLQueryFactory {
		return new IntersectsFunction(left, right);
	}

	/**
	 * Replace {@link #createOrder(int, boolean, TextPosition)}.
	 * @since 1.3
	 */
	public ADQLOrder createOrder(final int ind, final boolean desc) throws Exception{
		return new ADQLOrder(ind, desc);
	}

	/**
	 * @deprecated since 1.3 ; Replaced by {@link #createOrder(int, boolean)}
	 */
	@Deprecated
	public ADQLOrder createOrder(final int ind, final boolean desc, final TextPosition position) throws Exception{
		ADQLOrder order = new ADQLOrder(ind, desc);
		if (order != null)
@@ -387,10 +394,8 @@ public class ADQLQueryFactory {

	public ADQLOrder createOrder(final IdentifierItems idItems, final boolean desc) throws Exception{
		ADQLOrder order = new ADQLOrder(idItems.join("."), desc);
		if (order != null){
			order.setPosition(idItems.getPosition());
		if (order != null)
			order.setCaseSensitive(idItems.getColumnCaseSensitivity());
		}
		return order;
	}

+323 −146

File changed.

Preview size limit exceeded, changes collapsed.

Loading