Merge branch 'yingyi/asterix_fix'
diff --git a/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.3.query.aql
index 6b09eec..eee12d3 100644
--- a/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/distinct/query-issue443-2/query-issue443-2.3.query.aql
@@ -1,11 +1,10 @@
/*
* Description : This test case is to verify the fix for issue443
- : https://code.google.com/p/asterixdb/issues/detail?id=443
- * Expected Res : Fail
+ * https://code.google.com/p/asterixdb/issues/detail?id=443
+ * Expected Res : Success
* Date : 22th May 2013
*/
-
-for $a in [ {"f" : 19, "g": 1} , {"f" : 12, "g": 2} , {"f" : 10, "g": 1} , {"f" : 17, "g": 1}, {"f" : 12, "g": 4} ]
+for $a in [ {"f" : 19, "g": 1} , {"f" : 12, "g": 4} , {"f" : 10, "g": 1} , {"f" : 17, "g": 1}, {"f" : 12, "g": 4} ]
distinct by $a.f
-return $a
\ No newline at end of file
+return $a
diff --git a/asterix-app/src/test/resources/runtimets/queries/nestrecords/nestrecord/nestrecord.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/nestrecords/nestrecord/nestrecord.2.update.aql
index bca3929..ac1a9f1 100644
--- a/asterix-app/src/test/resources/runtimets/queries/nestrecords/nestrecord/nestrecord.2.update.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/nestrecords/nestrecord/nestrecord.2.update.aql
@@ -7,7 +7,7 @@
use dataverse testdv2;
insert into dataset testds (
-{ "id": "001", "name": "Person One", "address": {"street": "3019 DBH", "city": "Irvine", "zip": 92697} }
+{ "id": "001", "name": "Person One", "address": {"street": "3019 DBH", "city": "Irvine", "zip": 92697}}
);
insert into dataset testds (
@@ -15,10 +15,10 @@
);
insert into dataset testds (
-{ "id": "003", "name": "Person Three", "address": {"street": "2019 DBH", "city": "Irvine"} }
+{ "id": "003", "name": "Person Three", "address": {"street": "2019 DBH", "city": "Irvine"}}
);
insert into dataset testds (
-{ "id": "004", "name": "Person Four", "home": {"street": "2019 DBH", "city": {"name": "Irvine", "zip": 92697} } }
+{ "id": "004", "name": "Person Four", "home": {"street": "2019 DBH", "city": {"name": "Irvine", "zip": 92697}}}
);
diff --git a/asterix-aql/src/main/javacc/AQL.jj b/asterix-aql/src/main/javacc/AQL.jj
index fdbcc71..cb6336b 100644
--- a/asterix-aql/src/main/javacc/AQL.jj
+++ b/asterix-aql/src/main/javacc/AQL.jj
@@ -13,11 +13,12 @@
import java.io.*;
import java.util.List;
import java.util.ArrayList;
-import java.util.Stack;
-
import java.util.Map;
import java.util.HashMap;
import java.util.LinkedHashMap;
+
+import org.apache.xerces.util.IntStack;
+
import edu.uci.ics.asterix.aql.literal.FloatLiteral;
import edu.uci.ics.asterix.aql.literal.DoubleLiteral;
import edu.uci.ics.asterix.aql.literal.FalseLiteral;
@@ -278,7 +279,7 @@
ncNames = new ArrayList<Identifier>();
ncNames.add(new Identifier(tmp));
}
- ( "," tmp = Identifier()
+ ( <COMMA> tmp = Identifier()
{
ncNames.add(new Identifier(tmp));
}
@@ -385,7 +386,7 @@
{
cis.addFieldExpr(fieldExpr);
}
- ) ("," fieldExpr = Identifier()
+ ) (<COMMA> fieldExpr = Identifier()
{
cis.addFieldExpr(fieldExpr);
}
@@ -464,11 +465,11 @@
"function" nameComponents = FunctionOrTypeName()
ifNotExists = IfNotExists()
paramList = ParameterList()
- "{"
+ <LEFTBRACE>
{
beginPos = token;
}
- functionBodyExpr = Expression() "}"
+ functionBodyExpr = Expression() <RIGHTBRACE>
{
endPos = token;
functionBody = extractFragment(beginPos.beginLine, beginPos.beginColumn, endPos.beginLine, endPos.beginColumn);
@@ -493,7 +494,7 @@
paramList.add(var);
getCurrentScope().addNewVarSymbolToScope(var);
}
- ("," <VARIABLE>
+ (<COMMA> <VARIABLE>
{
var = new VarIdentifier();
var.setValue(token.image);
@@ -560,7 +561,7 @@
{
primaryKeyFields.add(tmp);
}
- ( "," tmp = Identifier()
+ ( <COMMA> tmp = Identifier()
{
primaryKeyFields.add(tmp);
}
@@ -616,7 +617,7 @@
{
}
{
- ( "if" "exists"
+ ( <IF> "exists"
{
return true;
}
@@ -650,7 +651,7 @@
getCurrentScope().addNewVarSymbolToScope(var.getVar());
}
"from" <DATASET> nameComponents = QualifiedName()
- ("where" condition = Expression())?
+ (<WHERE> condition = Expression())?
{
return new DeleteStatement(var, nameComponents.first, nameComponents.second, condition, getVarCounter());
}
@@ -665,13 +666,13 @@
List<UpdateClause> ucs = new ArrayList<UpdateClause>();
}
{
- "update" vars = Variable() "in" target = Expression()
- "where" condition = Expression()
+ "update" vars = Variable() <IN> target = Expression()
+ <WHERE> condition = Expression()
<LEFTPAREN> (uc = UpdateClause()
{
ucs.add(uc);
}
- ("," uc = UpdateClause()
+ (<COMMA> uc = UpdateClause()
{
ucs.add(uc);
}
@@ -693,13 +694,13 @@
UpdateClause elsebranch = null;
}
{
- "set" target = Expression() ":=" value = Expression()
+ "set" target = Expression() <ASSIGN> value = Expression()
| is = InsertStatement()
| ds = DeleteStatement()
| us = UpdateStatement()
- | "if" <LEFTPAREN> condition = Expression() <RIGHTPAREN>
- "then" ifbranch = UpdateClause()
- [LOOKAHEAD(1) "else" elsebranch = UpdateClause()]
+ | <IF> <LEFTPAREN> condition = Expression() <RIGHTPAREN>
+ <THEN> ifbranch = UpdateClause()
+ [LOOKAHEAD(1) <ELSE> elsebranch = UpdateClause()]
{
return new UpdateClause(target, value, is, ds, us, condition, ifbranch, elsebranch);
}
@@ -726,7 +727,7 @@
Pair<Identifier,Identifier> nameComponents = null;
}
{
- "write" "output" "to" nodeName = Identifier() ":" fileName = StringLiteral()
+ "write" "output" "to" nodeName = Identifier() <COLON> fileName = StringLiteral()
( "using" writerClass = StringLiteral() )?
{
return new WriteStatement(new Identifier(nodeName), fileName, writerClass);
@@ -815,7 +816,7 @@
{
configuration.put(keyValuePair.first, keyValuePair.second);
}
- ( "," keyValuePair = KeyValuePair()
+ ( <COMMA> keyValuePair = KeyValuePair()
{
configuration.put(keyValuePair.first, keyValuePair.second);
}
@@ -831,7 +832,7 @@
String value;
}
{
- <LEFTPAREN> key = StringLiteral() "=" value = StringLiteral() <RIGHTPAREN>
+ <LEFTPAREN> key = StringLiteral() <EQ> value = StringLiteral() <RIGHTPAREN>
{
return new Pair<String, String>(key, value);
}
@@ -847,7 +848,7 @@
{
properties.put(property.first, property.second);
}
- ( "," property = Property()
+ ( <COMMA> property = Property()
{
properties.put(property.first, property.second);
}
@@ -863,7 +864,7 @@
String value;
}
{
- key = Identifier() "=" ( value = StringLiteral() | <INTEGER_LITERAL>
+ key = Identifier() <EQ> ( value = StringLiteral() | <INTEGER_LITERAL>
{
try {
value = "" + Long.valueOf(token.image);
@@ -901,7 +902,7 @@
{
( "closed" { recordKind = RecordTypeDefinition.RecordKind.CLOSED; }
| "open" { recordKind = RecordTypeDefinition.RecordKind.OPEN; } )?
- "{"
+ <LEFTBRACE>
{
String hint = getHint(token);
if (hint != null) {
@@ -922,9 +923,9 @@
}
(
RecordField(recType)
- ( "," RecordField(recType) )*
+ ( <COMMA> RecordField(recType) )*
)?
- "}"
+ <RIGHTBRACE>
{
if (recordKind == null) {
recordKind = RecordTypeDefinition.RecordKind.OPEN;
@@ -946,7 +947,7 @@
String hint = getHint(token);
IRecordFieldDataGen rfdg = hint != null ? parseFieldDataGen(hint) : null;
}
- ":" type = TypeExpr() ("?" { nullable = true; } )?
+ <COLON> type = TypeExpr() (<QUES> { nullable = true; } )?
{
recType.addField(fieldName, type, nullable, rfdg);
}
@@ -968,9 +969,9 @@
TypeExpression type = null;
}
{
- "["
+ <LEFTBRACKET>
( type = TypeExpr() )
- "]"
+ <RIGHTBRACKET>
{
return new OrderedListTypeDefinition(type);
}
@@ -982,9 +983,9 @@
TypeExpression type = null;
}
{
- "{{"
+ <LEFTDBLBRACE>
( type = TypeExpr() )
- "}}"
+ <RIGHTDBLBRACE>
{
return new UnorderedListTypeDefinition(type);
}
@@ -1036,7 +1037,7 @@
String second = null;
}
{
- first = Identifier() ("." second = Identifier())?
+ first = Identifier() (<DOT> second = Identifier())?
{
Identifier id1 = null;
Identifier id2 = null;
@@ -1058,7 +1059,7 @@
String third = null;
}
{
- first = Identifier() "." second = Identifier() ("." third = Identifier())?
+ first = Identifier() <DOT> second = Identifier() (<DOT> third = Identifier())?
{
Identifier id1 = null;
Identifier id2 = null;
@@ -1087,7 +1088,7 @@
{
"declare" "function" functionName = Identifier()
paramList = ParameterList()
- "{" funcBody = Expression() "}"
+ <LEFTBRACE> funcBody = Expression() <RIGHTBRACE>
{
signature = new FunctionSignature(defaultDataverse, functionName, paramList.size());
getCurrentScope().addFunctionDescriptor(signature, false);
@@ -1147,7 +1148,7 @@
operand = AndExpr()
(
- "or"
+ <OR>
{
if (op == null) {
op = new OperatorExpr();
@@ -1178,7 +1179,7 @@
operand = RelExpr()
(
- "and"
+ <AND>
{
if (op == null) {
op = new OperatorExpr();
@@ -1221,7 +1222,7 @@
}
(
- LOOKAHEAD(2)( "<" | ">" | "<=" | ">=" | "=" | "!=" |"~=")
+ LOOKAHEAD(2)( <LT> | <GT> | <LE> | <GE> | <EQ> | <NE> |<SIMILAR>)
{
String mhint = getHint(token);
if (mhint != null && mhint.equals(INDEXED_NESTED_LOOP_JOIN_HINT)) {
@@ -1265,7 +1266,7 @@
{
operand = MultExpr()
- ( ("+" | "-")
+ ( (<PLUS> | <MINUS>)
{
if (op == null) {
op = new OperatorExpr();
@@ -1294,7 +1295,7 @@
{
operand = UnionExpr()
- (( "*" | "/" | "%" | <CARET> | "idiv")
+ (( <MUL> | <DIV> | <MOD> | <CARET> | <IDIV>)
{
if (op == null) {
op = new OperatorExpr();
@@ -1322,7 +1323,7 @@
}
{
operand1 = UnaryExpr()
- ("union"
+ (<UNION>
(operand2 = UnaryExpr()) {
if (union == null) {
union = new UnionExpr();
@@ -1341,7 +1342,7 @@
Expression expr = null;
}
{
- (( "+"|"-")
+ ( (<PLUS> | <MINUS>)
{
uexpr = new UnaryExpr();
if("+".equals(token.image))
@@ -1394,7 +1395,7 @@
String ident = null;
}
{
- "." ident = Identifier()
+ <DOT> ident = Identifier()
{
return new Identifier(ident);
}
@@ -1406,7 +1407,7 @@
int idx = -2;
}
{
- "[" ( expr = Expression()
+ <LEFTBRACKET> ( expr = Expression()
{
if(expr.getKind() == Expression.Kind.LITERAL_EXPRESSION)
{
@@ -1422,7 +1423,7 @@
}
- | "?"
+ | <QUES>
{
idx = IndexAccessor.ANY;
// ANY
@@ -1430,7 +1431,7 @@
)
- "]"
+ <RIGHTBRACKET>
{
return idx;
}
@@ -1572,16 +1573,16 @@
}
{
- "["
+ <LEFTBRACKET>
( tmp = Expression()
{
exprList.add(tmp);
}
- ("," tmp = Expression() { exprList.add(tmp); })*
+ (<COMMA> tmp = Expression() { exprList.add(tmp); })*
)?
- "]"
+ <RIGHTBRACKET>
{
expr.setExprList(exprList);
@@ -1598,11 +1599,11 @@
}
{
- "{{" ( tmp = Expression()
+ <LEFTDBLBRACE> ( tmp = Expression()
{
exprList.add(tmp);
}
- ("," tmp = Expression() { exprList.add(tmp); })*)? "}}"
+ (<COMMA> tmp = Expression() { exprList.add(tmp); })*)? <RIGHTDBLBRACE>
{
expr.setExprList(exprList);
return expr;
@@ -1616,11 +1617,11 @@
List<FieldBinding> fbList = new ArrayList<FieldBinding>();
}
{
- "{" (tmp = FieldBinding()
+ <LEFTBRACE> (tmp = FieldBinding()
{
fbList.add(tmp);
}
- ("," tmp = FieldBinding() { fbList.add(tmp); })*)? "}"
+ (<COMMA> tmp = FieldBinding() { fbList.add(tmp); })*)? <RIGHTBRACE>
{
expr.setFbList(fbList);
return expr;
@@ -1633,7 +1634,7 @@
Expression left, right;
}
{
- left = Expression() ":" right = Expression()
+ left = Expression() <COLON> right = Expression()
{
fb.setLeftExpr(left);
fb.setRightExpr(right);
@@ -1667,7 +1668,7 @@
argList.add(tmp);
arity ++;
}
- ("," tmp = Expression()
+ (<COMMA> tmp = Expression()
{
argList.add(tmp);
arity++;
@@ -1698,7 +1699,7 @@
{
funcName = token.image;
}
- ( ( arg1 = Identifier() ( "." arg2 = Identifier() )? )
+ ( ( arg1 = Identifier() ( <DOT> arg2 = Identifier() )? )
{
String name = arg2 == null ? arg1 : arg1 + "." + arg2;
LiteralExpr ds = new LiteralExpr();
@@ -1737,7 +1738,7 @@
IfExpr ifExpr = new IfExpr();
}
{
- "if" <LEFTPAREN> condExpr = Expression() <RIGHTPAREN> "then" thenExpr = Expression() "else" elseExpr = Expression()
+ <IF> <LEFTPAREN> condExpr = Expression() <RIGHTPAREN> <THEN> thenExpr = Expression() <ELSE> elseExpr = Expression()
{
ifExpr.setCondExpr(condExpr);
@@ -1757,7 +1758,7 @@
}
{
(tmp = ForClause() {clauseList.add(tmp);} | tmp = LetClause() {clauseList.add(tmp);})
- (tmp = Clause() {clauseList.add(tmp);})* "return" returnExpr = Expression()
+ (tmp = Clause() {clauseList.add(tmp);})* <RETURN> returnExpr = Expression()
{
flworg.setClauseList(clauseList);
@@ -1795,7 +1796,7 @@
extendCurrentScope();
}
{
- "for" varExp = Variable() ("at" varPos = Variable())? "in" ( inExp = Expression() )
+ <FOR> varExp = Variable() (<AT> varPos = Variable())? <IN> ( inExp = Expression() )
{
fc.setVarExpr(varExp);
getCurrentScope().addNewVarSymbolToScope(varExp.getVar());
@@ -1816,7 +1817,7 @@
extendCurrentScope();
}
{
- "let" varExp = Variable() ":=" beExp = Expression()
+ <LET> varExp = Variable() <ASSIGN> beExp = Expression()
{
getCurrentScope().addNewVarSymbolToScope(varExp.getVar());
lc.setVarExpr(varExp);
@@ -1831,7 +1832,7 @@
Expression whereExpr;
}
{
- "where" whereExpr = Expression()
+ <WHERE> whereExpr = Expression()
{
wc.setWhereExpr(whereExpr);
return wc;
@@ -1848,7 +1849,7 @@
}
{
(
- "order"
+ <ORDER>
{
String hint = getHint(token);
if (hint != null && hint.startsWith(INMEMORY_HINT)) {
@@ -1859,24 +1860,24 @@
oc.setNumTuples(numTuples);
}
}
- "by" orderbyExpr = Expression()
+ <BY> orderbyExpr = Expression()
{
orderbyList.add(orderbyExpr);
OrderbyClause.OrderModifier modif = OrderbyClause.OrderModifier.ASC;
}
- ( ("asc" { modif = OrderbyClause.OrderModifier.ASC; })
- | ("desc" { modif = OrderbyClause.OrderModifier.DESC; }))?
+ ( (<ASC> { modif = OrderbyClause.OrderModifier.ASC; })
+ | (<DESC> { modif = OrderbyClause.OrderModifier.DESC; }))?
{
modifierList.add(modif);
}
- ("," orderbyExpr = Expression()
+ (<COMMA> orderbyExpr = Expression()
{
orderbyList.add(orderbyExpr);
modif = OrderbyClause.OrderModifier.ASC;
}
- ( ("asc" { modif = OrderbyClause.OrderModifier.ASC; })
- | ("desc" { modif = OrderbyClause.OrderModifier.DESC; }))?
+ ( (<ASC> { modif = OrderbyClause.OrderModifier.ASC; })
+ | (<DESC> { modif = OrderbyClause.OrderModifier.DESC; }))?
{
modifierList.add(modif);
}
@@ -1906,39 +1907,39 @@
Scope newScope = extendCurrentScopeNoPush(true);
// extendCurrentScope(true);
}
- "group"
+ <GROUP>
{
String hint = getHint(token);
if (hint != null && hint.equals(HASH_GROUP_BY_HINT)) {
gbc.setHashGroupByHint(true);
}
}
- "by" (LOOKAHEAD(2) var = Variable()
+ <BY> (LOOKAHEAD(2) var = Variable()
{
newScope.addNewVarSymbolToScope(var.getVar());
- } ":=")?
+ } <ASSIGN>)?
expr = Expression()
{
GbyVariableExpressionPair pair1 = new GbyVariableExpressionPair(var, expr);
vePairList.add(pair1);
}
- ("," ( LOOKAHEAD(2) var = Variable()
+ (<COMMA> ( LOOKAHEAD(2) var = Variable()
{
newScope.addNewVarSymbolToScope(var.getVar());
- } ":=")?
+ } <ASSIGN>)?
expr = Expression()
{
GbyVariableExpressionPair pair2 = new GbyVariableExpressionPair(var, expr);
vePairList.add(pair2);
}
)*
- ("decor" decorVar = Variable() ":=" decorExpr = Expression()
+ (<DECOR> decorVar = Variable() <ASSIGN> decorExpr = Expression()
{
newScope.addNewVarSymbolToScope(decorVar.getVar());
GbyVariableExpressionPair pair3 = new GbyVariableExpressionPair(decorVar, decorExpr);
decorPairList.add(pair3);
}
- ("," "decor" decorVar = Variable() ":=" decorExpr = Expression()
+ (<COMMA> <DECOR> decorVar = Variable() <ASSIGN> decorExpr = Expression()
{
newScope.addNewVarSymbolToScope(decorVar.getVar());
GbyVariableExpressionPair pair4 = new GbyVariableExpressionPair(decorVar, decorExpr);
@@ -1946,14 +1947,14 @@
}
)*
)?
- "with" withVar = VariableRef()
+ <WITH> withVar = VariableRef()
{
if(withVar.getIsNewVar()==true)
throw new ParseException("can't find variable " + withVar.getVar());
withVarList.add(withVar);
newScope.addNewVarSymbolToScope(withVar.getVar());
}
- ("," withVar = VariableRef()
+ (<COMMA> withVar = VariableRef()
{
if(withVar.getIsNewVar()==true)
throw new ParseException("can't find variable " + withVar.getVar());
@@ -1977,8 +1978,8 @@
pushForbiddenScope(getCurrentScope());
}
{
- "limit" expr = Expression() { lc.setLimitExpr(expr); }
- ("offset" expr = Expression() { lc.setOffset(expr); })?
+ <LIMIT> expr = Expression() { lc.setLimitExpr(expr); }
+ (<OFFSET> expr = Expression() { lc.setOffset(expr); })?
{
popForbiddenScope();
@@ -1992,11 +1993,11 @@
Expression expr;
}
{
- "distinct" "by" expr = Expression()
+ <DISTINCT> <BY> expr = Expression()
{
exprs.add(expr);
}
- ("," expr = Expression()
+ (<COMMA> expr = Expression()
{
exprs.add(expr);
}
@@ -2020,23 +2021,23 @@
createNewScope();
}
- ( ("some" { qc.setQuantifier(QuantifiedExpression.Quantifier.SOME); })
- | ("every" { qc.setQuantifier(QuantifiedExpression.Quantifier.EVERY); }))
- var = Variable() "in" inExpr = Expression()
+ ( (<SOME> { qc.setQuantifier(QuantifiedExpression.Quantifier.SOME); })
+ | (<EVERY> { qc.setQuantifier(QuantifiedExpression.Quantifier.EVERY); }))
+ var = Variable() <IN> inExpr = Expression()
{
pair = new QuantifiedPair(var, inExpr);
getCurrentScope().addNewVarSymbolToScope(var.getVar());
quantifiedList.add(pair);
}
(
- "," var = Variable() "in" inExpr = Expression()
+ <COMMA> var = Variable() <IN> inExpr = Expression()
{
pair = new QuantifiedPair(var, inExpr);
getCurrentScope().addNewVarSymbolToScope(var.getVar());
quantifiedList.add(pair);
}
)*
- "satisfies" satisfiesExpr = Expression()
+ <SATISFIES> satisfiesExpr = Expression()
{
qc.setSatisfiesExpr(satisfiesExpr);
qc.setQuantifiedList(quantifiedList);
@@ -2047,155 +2048,212 @@
TOKEN_MGR_DECLS:
{
- public int commentDepth = 0;
+ public int commentDepth = 0;
+ public IntStack lexerStateStack = new IntStack();
+
+ public void pushState() {
+ lexerStateStack.push( curLexState );
+ }
+
+ public void popState() {
+ if (lexerStateStack.size() > 0) {
+ SwitchTo( lexerStateStack.pop() );
+ } else {
+ throw new RuntimeException();
+ }
+ }
+}
+
+<DEFAULT,IN_DBL_BRACE>
+TOKEN :
+{
+ <ASC : "asc">
+ | <AT : "at">
+ | <BY : "by">
+ | <DATASET : "dataset">
+ | <DECOR : "decor">
+ | <DESC : "desc">
+ | <DISTINCT : "distinct">
+ | <ELSE : "else">
+ | <EVERY : "every">
+ | <FOR : "for">
+ | <GROUP : "group">
+ | <IF : "if">
+ | <IN : "in">
+ | <LET : "let">
+ | <LIMIT : "limit">
+ | <OFFSET : "offset">
+ | <ORDER : "order">
+ | <RETURN : "return">
+ | <SATISFIES : "satisfies">
+ | <SOME : "some">
+ | <THEN : "then">
+ | <UNION : "union">
+ | <WHERE : "where">
+ | <WITH : "with">
+}
+
+<DEFAULT,IN_DBL_BRACE>
+TOKEN :
+{
+ <CARET : "^">
+ | <DIV : "/">
+ | <IDIV : "idiv">
+ | <MINUS : "-">
+ | <MOD : "%">
+ | <MUL : "*">
+ | <PLUS : "+">
+
+ | <LEFTPAREN : "(">
+ | <RIGHTPAREN : ")">
+ | <LEFTBRACKET : "[">
+ | <RIGHTBRACKET : "]">
+
+ | <COLON : ":">
+ | <COMMA : ",">
+ | <DOT : ".">
+ | <QUES : "?">
+
+ | <LT : "<">
+ | <GT : ">">
+ | <LE : "<=">
+ | <GE : ">=">
+ | <EQ : "=">
+ | <NE : "!=">
+ | <SIMILAR : "~=">
+ | <ASSIGN : ":=">
+
+ | <AND : "and">
+ | <OR : "or">
+}
+
+<DEFAULT,IN_DBL_BRACE>
+TOKEN :
+{
+ <LEFTBRACE : "{"> { pushState(); } : DEFAULT
}
<DEFAULT>
TOKEN :
{
- <CARET : "^" >
+ <RIGHTBRACE : "}"> { popState(); }
}
-<DEFAULT>
+<DEFAULT,IN_DBL_BRACE>
TOKEN :
{
- <DATASET : "dataset" >
+ <LEFTDBLBRACE : "{{"> { pushState(); } : IN_DBL_BRACE
}
-<DEFAULT>
+<IN_DBL_BRACE>
TOKEN :
{
- <LEFTPAREN : "(" >
+ <RIGHTDBLBRACE : "}}"> { popState(); }
}
-<DEFAULT>
+<DEFAULT,IN_DBL_BRACE>
TOKEN :
{
- <RIGHTPAREN : ")" >
+ <INTEGER_LITERAL : (<DIGIT>)+ >
}
-
-<DEFAULT>
+<DEFAULT,IN_DBL_BRACE>
TOKEN :
{
- <INTEGER_LITERAL : (<DIGIT>)+ >
+ <NULL : "null">
+ | <TRUE : "true">
+ | <FALSE : "false">
}
-
-<DEFAULT>
+<DEFAULT,IN_DBL_BRACE>
TOKEN :
{
- <NULL : "null">
+ <#DIGIT : ["0" - "9"]>
}
-<DEFAULT>
-TOKEN :
-{
- <TRUE : "true">
-}
-
-<DEFAULT>
-TOKEN :
-{
- <FALSE : "false">
-}
-
-<DEFAULT>
-TOKEN :
-{
- <#DIGIT : ["0" - "9"]>
-}
-
-
+<DEFAULT,IN_DBL_BRACE>
TOKEN:
{
- < DOUBLE_LITERAL: <DIGITS>
+ < DOUBLE_LITERAL: <DIGITS>
| <DIGITS> ( "." <DIGITS> )?
| "." <DIGITS>
- >
- |
- < FLOAT_LITERAL: <DIGITS> ( "f" | "F" )
+ >
+ | < FLOAT_LITERAL: <DIGITS> ( "f" | "F" )
| <DIGITS> ( "." <DIGITS> ( "f" | "F" ) )?
| "." <DIGITS> ( "f" | "F" )
- >
- |
- <DIGITS : (<DIGIT>)+ >
+ >
+ | <DIGITS : (<DIGIT>)+ >
}
-<DEFAULT>
+<DEFAULT,IN_DBL_BRACE>
TOKEN :
{
- <#LETTER : ["A" - "Z", "a" - "z"]>
+ <#LETTER : ["A" - "Z", "a" - "z"]>
+ | <SPECIALCHARS : ["$", "_", "-"]>
}
-<DEFAULT>
+<DEFAULT,IN_DBL_BRACE>
TOKEN :
{
- <SPECIALCHARS : ["$", "_", "-"] >
+ <STRING_LITERAL : ("\"" (<EscapeQuot> | ~["\""])* "\"") | ("\'"(<EscapeApos> | ~["\'"])* "\'")>
+ | < #EscapeQuot: "\\\"" >
+ | < #EscapeApos: "\\\'" >
}
-<DEFAULT>
+<DEFAULT,IN_DBL_BRACE>
TOKEN :
{
- <STRING_LITERAL : ("\"" (<EscapeQuot> | ~["\""])* "\"") | ("\'"(<EscapeApos> | ~["\'"])* "\'")>
- |
- < #EscapeQuot: "\\\"" >
- |
- < #EscapeApos: "\\\'" >
+ <IDENTIFIER : <LETTER> (<LETTER> | <DIGIT> | <SPECIALCHARS>)*>
}
-<DEFAULT>
+<DEFAULT,IN_DBL_BRACE>
TOKEN :
{
- <IDENTIFIER : <LETTER> (<LETTER> | <DIGIT> | <SPECIALCHARS>)*>
+ <VARIABLE : "$" <LETTER> (<LETTER> | <DIGIT> | "_")*>
}
-
-<DEFAULT>
-TOKEN :
-{
- <VARIABLE : "$" <LETTER> (<LETTER> | <DIGIT> | "_")*>
-}
-
+<DEFAULT,IN_DBL_BRACE>
SKIP:
{
" "
-| "\t"
-| "\r"
-| "\n"
+ | "\t"
+ | "\r"
+ | "\n"
}
+<DEFAULT,IN_DBL_BRACE>
SKIP:
{
- <"//" (~["\n"])* "\n">
+ <"//" (~["\n"])* "\n">
}
+<DEFAULT,IN_DBL_BRACE>
SKIP:
{
- <"//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")?>
+ <"//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")?>
}
-
+<DEFAULT,IN_DBL_BRACE>
SKIP:
{
- <"/*"> {commentDepth=1;}: INSIDE_COMMENT
+ <"/*"> { pushState(); } : INSIDE_COMMENT
}
<INSIDE_COMMENT>
SPECIAL_TOKEN:
{
- <"+"(" ")*(~["*"])*>
+ <"+"(" ")*(~["*"])*>
}
<INSIDE_COMMENT>
SKIP:
{
- <"/*"> {commentDepth++;}
+ <"/*"> { pushState(); }
}
<INSIDE_COMMENT>
SKIP:
{
- <"*/"> {commentDepth--; if (commentDepth == 0) SwitchTo(DEFAULT);}
-| <~[]>
+ <"*/"> { popState(); }
+ | <~[]>
}