allow StringLiteral() as one alternative in Identifier()
diff --git a/asterix-app/src/test/resources/AQLTS/queries/fieldAccessor.aql b/asterix-app/src/test/resources/AQLTS/queries/fieldAccessor.aql
new file mode 100644
index 0000000..3995374
--- /dev/null
+++ b/asterix-app/src/test/resources/AQLTS/queries/fieldAccessor.aql
@@ -0,0 +1,3 @@
+let $bla := { "name" : "value" }
+return
+ $bla."name" = $bla.name
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/AQLTS/queries/functionDecl3.aql b/asterix-app/src/test/resources/AQLTS/queries/functionDecl3.aql
new file mode 100644
index 0000000..80629be5
--- /dev/null
+++ b/asterix-app/src/test/resources/AQLTS/queries/functionDecl3.aql
@@ -0,0 +1,5 @@
+declare function "function with spaces"($a, $b) {
+ "string with spaces"
+};
+
+"function with spaces" (1, 2)
\ No newline at end of file
diff --git a/asterix-aql/src/main/javacc/AQL.jj b/asterix-aql/src/main/javacc/AQL.jj
index ab58c6a..71a8b19 100644
--- a/asterix-aql/src/main/javacc/AQL.jj
+++ b/asterix-aql/src/main/javacc/AQL.jj
@@ -735,7 +735,7 @@
String adapterName = null;
}
{
- ( adapterName = Identifier() | adapterName = StringLiteral() )
+ adapterName = Identifier()
{
return adapterName;
}
@@ -1020,12 +1020,17 @@
String Identifier() throws ParseException:
{
+ String lit = null;
}
{
<IDENTIFIER>
{
return token.image;
}
+ | lit = StringLiteral()
+ {
+ return lit;
+ }
}
String StringLiteral() throws ParseException:
@@ -1494,24 +1499,22 @@
Expression expr = null;
}
{
- //Literal | VariableRef | ListConstructor | RecordConstructor | FunctionCallExpr | DatasetAccessExpression | ParenthesizedExpression
- (
- expr =Literal()
- | expr = FunctionCallExpr()
- | expr = DatasetAccessExpression()
- | expr =VariableRef()
-
+ ( LOOKAHEAD(2)
+ expr = FunctionCallExpr()
+ | expr = Literal()
+ | expr = DatasetAccessExpression()
+ | expr = VariableRef()
{
if(((VariableExpr)expr).getIsNewVar() == true)
- throw new ParseException("can't find variable " + ((VariableExpr)expr).getVar());
+ throw new ParseException("can't find variable " + ((VariableExpr)expr).getVar());
}
- | expr = ListConstructor()
- | expr = RecordConstructor()
- | expr = ParenthesizedExpression()
- )
- {
- return expr;
- }
+ | expr = ListConstructor()
+ | expr = RecordConstructor()
+ | expr = ParenthesizedExpression()
+ )
+ {
+ return expr;
+ }
}
Expression Literal() throws ParseException: