diff --git a/src/adql/db/STCS.java b/src/adql/db/STCS.java
index b0befa1c..ffeec759 100644
--- a/src/adql/db/STCS.java
+++ b/src/adql/db/STCS.java
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with ADQLLibrary. If not, see .
*
- * Copyright 2014 - Astronomisches Rechen Institut (ARI)
+ * Copyright 2014-2017 - Astronomisches Rechen Institut (ARI)
*/
import java.util.ArrayList;
@@ -78,7 +78,7 @@
*
*
* @author Grégory Mantelet (ARI)
- * @version 1.3 (12/2014)
+ * @version 1.4 (04/2017)
* @since 1.3
*/
public final class STCS {
@@ -143,11 +143,11 @@ private static String buildAllowedRegExp(final String rootRegExp){
*
*
* @author Grégory Mantelet (ARI)
- * @version 1.3 (10/2014)
+ * @version 1.4 (04/2017)
* @since 1.3
*/
public static enum Frame{
- ECLIPTIC, FK4, FK5, GALACTIC, ICRS, UNKNOWNFRAME;
+ ECLIPTIC, FK4, FK5, J2000, GALACTIC, ICRS, UNKNOWNFRAME;
/** Default value for a frame: {@link #UNKNOWNFRAME}. */
public static final Frame DEFAULT = UNKNOWNFRAME;
@@ -1329,7 +1329,7 @@ private void init(final String newStcs){
* @param expectedSyntax Description of the good syntax expected. This description is used only to write the
* {@link ParseException} in case other non-space characters are found among the remaining characters.
*
- * @throws ParseException If other non-space characters remains.
+ * @throws ParseException If other non-space characters remains.
*/
private void end(final String expectedSyntax) throws ParseException{
// Skip all spaces:
@@ -1346,7 +1346,7 @@ private void end(final String expectedSyntax) throws ParseException{
}
/**
- * Tool function which skip all next space characters until the next meaningful characters.
+ * Tool function which skip all next space characters until the next meaningful characters.
*/
private void skipSpaces(){
while(pos < stcs.length() && Character.isWhitespace(stcs.charAt(pos)))
diff --git a/test/adql/db/TestFunctionDef.java b/test/adql/db/TestFunctionDef.java
index ee87a7d7..9f63f787 100644
--- a/test/adql/db/TestFunctionDef.java
+++ b/test/adql/db/TestFunctionDef.java
@@ -257,6 +257,15 @@ public void testParse(){
ex.printStackTrace(System.err);
fail("Unknown types MUST be allowed!");
}
+ try{
+ FunctionDef fct = FunctionDef.parse("INTERSECTION(region1 region, region2 region) -> region");
+ assertEquals(DBType.DBDatatype.REGION, fct.getParam(0).type.type);
+ assertEquals(DBType.DBDatatype.REGION, fct.getParam(1).type.type);
+ assertEquals(DBType.DBDatatype.REGION, fct.returnType.type);
+ }catch(Exception ex){
+ ex.printStackTrace(System.err);
+ fail("Impossible to parse this REGION based FunctionDef! (see console for more details)");
+ }
}
@Test
diff --git a/test/adql/db/TestSTCS.java b/test/adql/db/TestSTCS.java
index 8ff76460..2f7698da 100644
--- a/test/adql/db/TestSTCS.java
+++ b/test/adql/db/TestSTCS.java
@@ -366,7 +366,7 @@ public void parseCoordSys(){
fail();
}catch(Exception e){
assertTrue(e instanceof ParseException);
- assertEquals("Incorrect syntax: \"HOME\" was unexpected! Expected syntax: \"[(ECLIPTIC|FK4|FK5|GALACTIC|ICRS|UNKNOWNFRAME)] [(BARYCENTER|GEOCENTER|HELIOCENTER|LSR|TOPOCENTER|RELOCATABLE|UNKNOWNREFPOS)] [(CARTESIAN2|CARTESIAN3|SPHERICAL2)]\" ; an empty string is also allowed and will be interpreted as the coordinate system locally used.", e.getMessage());
+ assertEquals("Incorrect syntax: \"HOME\" was unexpected! Expected syntax: \"[(ECLIPTIC|FK4|FK5|J2000|GALACTIC|ICRS|UNKNOWNFRAME)] [(BARYCENTER|GEOCENTER|HELIOCENTER|LSR|TOPOCENTER|RELOCATABLE|UNKNOWNREFPOS)] [(CARTESIAN2|CARTESIAN3|SPHERICAL2)]\" ; an empty string is also allowed and will be interpreted as the coordinate system locally used.", e.getMessage());
}
// With wrong reference position:
@@ -375,7 +375,7 @@ public void parseCoordSys(){
fail();
}catch(Exception e){
assertTrue(e instanceof ParseException);
- assertEquals("Incorrect syntax: \"HOME SPHERICAL2\" was unexpected! Expected syntax: \"[(ECLIPTIC|FK4|FK5|GALACTIC|ICRS|UNKNOWNFRAME)] [(BARYCENTER|GEOCENTER|HELIOCENTER|LSR|TOPOCENTER|RELOCATABLE|UNKNOWNREFPOS)] [(CARTESIAN2|CARTESIAN3|SPHERICAL2)]\" ; an empty string is also allowed and will be interpreted as the coordinate system locally used.", e.getMessage());
+ assertEquals("Incorrect syntax: \"HOME SPHERICAL2\" was unexpected! Expected syntax: \"[(ECLIPTIC|FK4|FK5|J2000|GALACTIC|ICRS|UNKNOWNFRAME)] [(BARYCENTER|GEOCENTER|HELIOCENTER|LSR|TOPOCENTER|RELOCATABLE|UNKNOWNREFPOS)] [(CARTESIAN2|CARTESIAN3|SPHERICAL2)]\" ; an empty string is also allowed and will be interpreted as the coordinate system locally used.", e.getMessage());
}
// With a cartesian flavor:
@@ -414,7 +414,7 @@ public void parseCoordSys(){
fail();
}catch(Exception e){
assertTrue(e instanceof ParseException);
- assertEquals("Incorrect syntax: \"icrsGeocentercarteSIAN2\" was unexpected! Expected syntax: \"[(ECLIPTIC|FK4|FK5|GALACTIC|ICRS|UNKNOWNFRAME)] [(BARYCENTER|GEOCENTER|HELIOCENTER|LSR|TOPOCENTER|RELOCATABLE|UNKNOWNREFPOS)] [(CARTESIAN2|CARTESIAN3|SPHERICAL2)]\" ; an empty string is also allowed and will be interpreted as the coordinate system locally used.", e.getMessage());
+ assertEquals("Incorrect syntax: \"icrsGeocentercarteSIAN2\" was unexpected! Expected syntax: \"[(ECLIPTIC|FK4|FK5|J2000|GALACTIC|ICRS|UNKNOWNFRAME)] [(BARYCENTER|GEOCENTER|HELIOCENTER|LSR|TOPOCENTER|RELOCATABLE|UNKNOWNREFPOS)] [(CARTESIAN2|CARTESIAN3|SPHERICAL2)]\" ; an empty string is also allowed and will be interpreted as the coordinate system locally used.", e.getMessage());
}
}
@@ -518,7 +518,7 @@ public void parseRegion(){
fail();
}catch(Exception ex){
assertTrue(ex instanceof ParseException);
- assertTrue(ex.getMessage().startsWith("Incorrect syntax: a coordinates pair (2 numerics separated by one or more spaces) was expected! Expected syntax: \"CIRCLE \", where coordPair=\" \", radius=\"\" and coordSys=\"[(ECLIPTIC|FK4|FK5|GALACTIC|ICRS|UNKNOWNFRAME)] [(BARYCENTER|GEOCENTER|HELIOCENTER|LSR|TOPOCENTER|RELOCATABLE|UNKNOWNREFPOS)] [(CARTESIAN2|CARTESIAN3|SPHERICAL2)]\" ; an empty string is also allowed and will be interpreted as the coordinate system locally used."));
+ assertTrue(ex.getMessage().startsWith("Incorrect syntax: a coordinates pair (2 numerics separated by one or more spaces) was expected! Expected syntax: \"CIRCLE \", where coordPair=\" \", radius=\"\" and coordSys=\"[(ECLIPTIC|FK4|FK5|J2000|GALACTIC|ICRS|UNKNOWNFRAME)] [(BARYCENTER|GEOCENTER|HELIOCENTER|LSR|TOPOCENTER|RELOCATABLE|UNKNOWNREFPOS)] [(CARTESIAN2|CARTESIAN3|SPHERICAL2)]\" ; an empty string is also allowed and will be interpreted as the coordinate system locally used."));
}
// TEST WITH EITHER A WRONG NUMERIC (L in lower case instead of 1) OR A MISSING OPENING PARENTHESIS: