org.apache.asterix.aql.parser.AQLParser Maven / Gradle / Ivy
The newest version!
/* Generated By:JavaCC: Do not edit this line. AQLParser.java */
package org.apache.asterix.aql.parser;
// For AQLParserTokenManager
import org.apache.xerces.util.IntStack;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.asterix.aql.base.Clause;
import org.apache.asterix.aql.base.Expression;
import org.apache.asterix.aql.base.Literal;
import org.apache.asterix.aql.base.Statement;
import org.apache.asterix.aql.context.RootScopeFactory;
import org.apache.asterix.aql.context.Scope;
import org.apache.asterix.aql.expression.AbstractAccessor;
import org.apache.asterix.aql.expression.CallExpr;
import org.apache.asterix.aql.expression.CompactStatement;
import org.apache.asterix.aql.expression.ConnectFeedStatement;
import org.apache.asterix.aql.expression.CreateFeedPolicyStatement;
import org.apache.asterix.aql.expression.CreatePrimaryFeedStatement;
import org.apache.asterix.aql.expression.CreateSecondaryFeedStatement;
import org.apache.asterix.aql.expression.CreateDataverseStatement;
import org.apache.asterix.aql.expression.CreateFeedStatement;
import org.apache.asterix.aql.expression.CreateFunctionStatement;
import org.apache.asterix.aql.expression.CreateIndexStatement;
import org.apache.asterix.aql.expression.DatasetDecl;
import org.apache.asterix.aql.expression.DataverseDecl;
import org.apache.asterix.aql.expression.DataverseDropStatement;
import org.apache.asterix.aql.expression.DeleteStatement;
import org.apache.asterix.aql.expression.DisconnectFeedStatement;
import org.apache.asterix.aql.expression.DistinctClause;
import org.apache.asterix.aql.expression.DropStatement;
import org.apache.asterix.aql.expression.ExternalDetailsDecl;
import org.apache.asterix.aql.expression.FLWOGRExpression;
import org.apache.asterix.aql.expression.FeedDropStatement;
import org.apache.asterix.aql.expression.FieldAccessor;
import org.apache.asterix.aql.expression.FieldBinding;
import org.apache.asterix.aql.expression.ForClause;
import org.apache.asterix.aql.expression.FunctionDecl;
import org.apache.asterix.aql.expression.FunctionDropStatement;
import org.apache.asterix.aql.expression.GbyVariableExpressionPair;
import org.apache.asterix.aql.expression.GroupbyClause;
import org.apache.asterix.aql.expression.Identifier;
import org.apache.asterix.aql.expression.IfExpr;
import org.apache.asterix.aql.expression.IndexAccessor;
import org.apache.asterix.aql.expression.IndexDropStatement;
import org.apache.asterix.aql.expression.InsertStatement;
import org.apache.asterix.aql.expression.InternalDetailsDecl;
import org.apache.asterix.aql.expression.LetClause;
import org.apache.asterix.aql.expression.LimitClause;
import org.apache.asterix.aql.expression.ListConstructor;
import org.apache.asterix.aql.expression.LiteralExpr;
import org.apache.asterix.aql.expression.LoadStatement;
import org.apache.asterix.aql.expression.NodeGroupDropStatement;
import org.apache.asterix.aql.expression.NodegroupDecl;
import org.apache.asterix.aql.expression.OperatorExpr;
import org.apache.asterix.aql.expression.OrderbyClause;
import org.apache.asterix.aql.expression.OrderedListTypeDefinition;
import org.apache.asterix.aql.expression.QuantifiedExpression;
import org.apache.asterix.aql.expression.QuantifiedPair;
import org.apache.asterix.aql.expression.Query;
import org.apache.asterix.aql.expression.RecordConstructor;
import org.apache.asterix.aql.expression.RecordTypeDefinition;
import org.apache.asterix.aql.expression.RefreshExternalDatasetStatement;
import org.apache.asterix.aql.expression.RunStatement;
import org.apache.asterix.aql.expression.SetStatement;
import org.apache.asterix.aql.expression.TypeDecl;
import org.apache.asterix.aql.expression.TypeDropStatement;
import org.apache.asterix.aql.expression.TypeExpression;
import org.apache.asterix.aql.expression.TypeReferenceExpression;
import org.apache.asterix.aql.expression.UnaryExpr;
import org.apache.asterix.aql.expression.UnaryExpr.Sign;
import org.apache.asterix.aql.expression.UnionExpr;
import org.apache.asterix.aql.expression.UnorderedListTypeDefinition;
import org.apache.asterix.aql.expression.UpdateClause;
import org.apache.asterix.aql.expression.UpdateStatement;
import org.apache.asterix.aql.expression.VarIdentifier;
import org.apache.asterix.aql.expression.VariableExpr;
import org.apache.asterix.aql.expression.WhereClause;
import org.apache.asterix.aql.expression.WriteStatement;
import org.apache.asterix.aql.literal.DoubleLiteral;
import org.apache.asterix.aql.literal.FalseLiteral;
import org.apache.asterix.aql.literal.FloatLiteral;
import org.apache.asterix.aql.literal.LongIntegerLiteral;
import org.apache.asterix.aql.literal.NullLiteral;
import org.apache.asterix.aql.literal.StringLiteral;
import org.apache.asterix.aql.literal.TrueLiteral;
import org.apache.asterix.aql.util.RangeMapBuilder;
import org.apache.asterix.common.annotations.AutoDataGen;
import org.apache.asterix.common.annotations.DateBetweenYearsDataGen;
import org.apache.asterix.common.annotations.DatetimeAddRandHoursDataGen;
import org.apache.asterix.common.annotations.DatetimeBetweenYearsDataGen;
import org.apache.asterix.common.annotations.FieldIntervalDataGen;
import org.apache.asterix.common.annotations.FieldValFileDataGen;
import org.apache.asterix.common.annotations.FieldValFileSameIndexDataGen;
import org.apache.asterix.common.annotations.IRecordFieldDataGen;
import org.apache.asterix.common.annotations.InsertRandIntDataGen;
import org.apache.asterix.common.annotations.ListDataGen;
import org.apache.asterix.common.annotations.ListValFileDataGen;
import org.apache.asterix.common.annotations.SkipSecondaryIndexSearchExpressionAnnotation;
import org.apache.asterix.common.annotations.TypeDataGen;
import org.apache.asterix.common.annotations.UndeclaredFieldsDataGen;
import org.apache.asterix.common.config.DatasetConfig.DatasetType;
import org.apache.asterix.common.config.DatasetConfig.IndexType;
import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.asterix.common.functions.FunctionSignature;
import org.apache.asterix.metadata.bootstrap.MetadataConstants;
import org.apache.hyracks.algebricks.common.utils.Pair;
import org.apache.hyracks.algebricks.common.utils.Triple;
import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionAnnotation;
import org.apache.hyracks.algebricks.core.algebra.expressions.IndexedNLJoinExpressionAnnotation;
import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
import org.apache.hyracks.dataflow.common.data.partition.range.IRangeMap;
public class AQLParser extends ScopeChecker implements AQLParserConstants {
// optimizer hints
private static final String AUTO_HINT = "auto";
private static final String BROADCAST_JOIN_HINT = "bcast";
private static final String COMPOSE_VAL_FILES_HINT = "compose-val-files";
private static final String DATE_BETWEEN_YEARS_HINT = "date-between-years";
private static final String DATETIME_ADD_RAND_HOURS_HINT = "datetime-add-rand-hours";
private static final String DATETIME_BETWEEN_YEARS_HINT = "datetime-between-years";
private static final String HASH_GROUP_BY_HINT = "hash";
private static final String INDEXED_NESTED_LOOP_JOIN_HINT = "indexnl";
private static final String INMEMORY_HINT = "inmem";
private static final String INSERT_RAND_INT_HINT = "insert-rand-int";
private static final String INTERVAL_HINT = "interval";
private static final String LIST_HINT = "list";
private static final String LIST_VAL_FILE_HINT = "list-val-file";
private static final String RANGE_HINT = "range";
private static final String SKIP_SECONDARY_INDEX_SEARCH_HINT = "skip-index";
private static final String VAL_FILE_HINT = "val-files";
private static final String VAL_FILE_SAME_INDEX_HINT = "val-file-same-idx";
private static final String GEN_FIELDS_HINT = "gen-fields";
// data generator hints
private static final String DGEN_HINT = "dgen";
private static class IndexParams {
public IndexType type;
public int gramLength;
public IndexParams(IndexType type, int gramLength) {
this.type = type;
this.gramLength = gramLength;
}
};
private static class FunctionName {
public String dataverse = null;
public String library = null;
public String function = null;
}
private static String getHint(Token t) {
if (t.specialToken == null) {
return null;
}
String s = t.specialToken.image;
int n = s.length();
if (n < 2) {
return null;
}
return s.substring(1).trim();
}
private static IRecordFieldDataGen parseFieldDataGen(String hint) throws ParseException {
IRecordFieldDataGen rfdg = null;
String splits[] = hint.split(" +");
if (splits[0].equals(VAL_FILE_HINT)) {
File[] valFiles = new File[splits.length - 1];
for (int k=1; k st = parser.parse();
//st.accept(new AQLPrintVisitor(), 0);
}
public List parse() throws ParseException {
try {
return Statement();
} catch (Error e) {
// this is here as the JavaCharStream that's below the lexer somtimes throws Errors that are not handled
// by the ANTLR-generated lexer or parser (e.g it does this for invalid backslash u + 4 hex digits escapes)
throw new ParseException(e.getMessage());
}
}
final public List Statement() throws ParseException, ParseException {
scopeStack.push(RootScopeFactory.createRootScope(this));
List decls = new ArrayList();
Statement stmt = null;
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 2:
case 4:
case 18:
case 19:
case 39:
case 41:
case 43:
case 44:
case 45:
case 46:
case 48:
case 50:
case 51:
case 52:
case 56:
case DATASET:
case EVERY:
case FOR:
case FROM:
case IF:
case LET:
case SOME:
case WITH:
case MINUS:
case PLUS:
case LEFTPAREN:
case LEFTBRACKET:
case LEFTBRACE:
case LEFTDBLBRACE:
case INTEGER_LITERAL:
case NULL:
case TRUE:
case FALSE:
case DOUBLE_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
case IDENTIFIER:
case VARIABLE:
;
break;
default:
jj_la1[0] = jj_gen;
break label_1;
}
stmt = SingleStatement();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 1:
jj_consume_token(1);
break;
default:
jj_la1[1] = jj_gen;
;
}
decls.add(stmt);
}
jj_consume_token(0);
{if (true) return decls;}
throw new Error("Missing return statement in function");
}
final public Statement SingleStatement() throws ParseException, ParseException {
Statement stmt = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 2:
stmt = DataverseDeclaration();
break;
case 56:
stmt = FunctionDeclaration();
break;
case 4:
stmt = CreateStatement();
break;
case 48:
stmt = LoadStatement();
break;
case 39:
stmt = DropStatement();
break;
case 46:
stmt = WriteStatement();
break;
case 45:
stmt = SetStatement();
break;
case 41:
stmt = InsertStatement();
break;
case 43:
stmt = DeleteStatement();
break;
case 44:
stmt = UpdateStatement();
break;
case 51:
case 52:
stmt = FeedStatement();
break;
case 50:
stmt = CompactStatement();
break;
case DATASET:
case EVERY:
case FOR:
case FROM:
case IF:
case LET:
case SOME:
case WITH:
case MINUS:
case PLUS:
case LEFTPAREN:
case LEFTBRACKET:
case LEFTBRACE:
case LEFTDBLBRACE:
case INTEGER_LITERAL:
case NULL:
case TRUE:
case FALSE:
case DOUBLE_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
case IDENTIFIER:
case VARIABLE:
stmt = Query();
break;
case 18:
stmt = RefreshExternalDatasetStatement();
break;
case 19:
stmt = RunStatement();
break;
default:
jj_la1[2] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return stmt;}
throw new Error("Missing return statement in function");
}
final public DataverseDecl DataverseDeclaration() throws ParseException, ParseException {
String dvName = null;
jj_consume_token(2);
jj_consume_token(3);
dvName = Identifier();
defaultDataverse = dvName;
{if (true) return new DataverseDecl(new Identifier(dvName));}
throw new Error("Missing return statement in function");
}
final public Statement CreateStatement() throws ParseException, ParseException {
String hint = null;
boolean dgen = false;
Statement stmt = null;
jj_consume_token(4);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 5:
hint = getHint(token);
if (hint != null && hint.startsWith(DGEN_HINT)) {
dgen = true;
}
stmt = TypeSpecification(hint, dgen);
break;
case 7:
stmt = NodegroupSpecification();
break;
case 9:
case 14:
case 15:
case DATASET:
stmt = DatasetSpecification();
break;
case 21:
stmt = IndexSpecification();
break;
case 3:
stmt = DataverseSpecification();
break;
case 28:
stmt = FunctionSpecification();
break;
case 29:
case 30:
case 31:
stmt = FeedSpecification();
break;
case 32:
stmt = FeedPolicySpecification();
break;
default:
jj_la1[3] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return stmt;}
throw new Error("Missing return statement in function");
}
final public TypeDecl TypeSpecification(String hint, boolean dgen) throws ParseException, ParseException {
Pair nameComponents = null;
boolean ifNotExists = false;
TypeExpression typeExpr = null;
jj_consume_token(5);
nameComponents = TypeName();
ifNotExists = IfNotExists();
jj_consume_token(6);
typeExpr = TypeExpr();
long numValues = -1;
String filename = null;
if (dgen) {
String splits[] = hint.split(" +");
if (splits.length != 3) {
{if (true) throw new ParseException("Expecting /*+ dgen */");}
}
filename = splits[1];
numValues = Long.parseLong(splits[2]);
}
TypeDataGen tddg = new TypeDataGen(dgen, filename, numValues);
{if (true) return new TypeDecl(nameComponents.first, nameComponents.second, typeExpr, tddg, ifNotExists);}
throw new Error("Missing return statement in function");
}
final public NodegroupDecl NodegroupSpecification() throws ParseException, ParseException {
String name = null;
String tmp = null;
boolean ifNotExists = false;
ListncNames = null;
jj_consume_token(7);
name = Identifier();
ifNotExists = IfNotExists();
jj_consume_token(8);
tmp = Identifier();
ncNames = new ArrayList();
ncNames.add(new Identifier(tmp));
label_2:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[4] = jj_gen;
break label_2;
}
jj_consume_token(COMMA);
tmp = Identifier();
ncNames.add(new Identifier(tmp));
}
{if (true) return new NodegroupDecl(new Identifier(name), ncNames, ifNotExists);}
throw new Error("Missing return statement in function");
}
final public DatasetDecl DatasetSpecification() throws ParseException, ParseException {
Pair nameComponents = null;
boolean ifNotExists = false;
String typeName = null;
String adapterName = null;
Map properties = null;
Map compactionPolicyProperties = null;
FunctionSignature appliedFunction = null;
List> primaryKeyFields = null;
String nodeGroupName = null;
Map hints = new HashMap();
DatasetDecl dsetDecl = null;
boolean autogenerated = false;
String compactionPolicy = null;
boolean temp = false;
List filterField = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 9:
jj_consume_token(9);
jj_consume_token(DATASET);
nameComponents = QualifiedName();
jj_consume_token(LEFTPAREN);
typeName = Identifier();
jj_consume_token(RIGHTPAREN);
ifNotExists = IfNotExists();
jj_consume_token(10);
adapterName = AdapterName();
properties = Configuration();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 8:
jj_consume_token(8);
nodeGroupName = Identifier();
break;
default:
jj_la1[5] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 11:
jj_consume_token(11);
hints = Properties();
break;
default:
jj_la1[6] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 10:
jj_consume_token(10);
jj_consume_token(12);
jj_consume_token(13);
compactionPolicy = CompactionPolicy();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LEFTPAREN:
compactionPolicyProperties = Configuration();
break;
default:
jj_la1[7] = jj_gen;
;
}
break;
default:
jj_la1[8] = jj_gen;
;
}
ExternalDetailsDecl edd = new ExternalDetailsDecl();
edd.setAdapter(adapterName);
edd.setProperties(properties);
dsetDecl = new DatasetDecl(nameComponents.first,
nameComponents.second,
new Identifier(typeName),
nodeGroupName != null? new Identifier(nodeGroupName): null,
compactionPolicy,
compactionPolicyProperties,
hints,
DatasetType.EXTERNAL,
edd,
ifNotExists);
break;
case 14:
case 15:
case DATASET:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 14:
case 15:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 14:
jj_consume_token(14);
break;
case 15:
jj_consume_token(15);
temp = token.image.toLowerCase().equals("temporary");
break;
default:
jj_la1[9] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
default:
jj_la1[10] = jj_gen;
;
}
jj_consume_token(DATASET);
nameComponents = QualifiedName();
jj_consume_token(LEFTPAREN);
typeName = Identifier();
jj_consume_token(RIGHTPAREN);
ifNotExists = IfNotExists();
primaryKeyFields = PrimaryKey();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 16:
jj_consume_token(16);
autogenerated = true;
break;
default:
jj_la1[11] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 8:
jj_consume_token(8);
nodeGroupName = Identifier();
break;
default:
jj_la1[12] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 11:
jj_consume_token(11);
hints = Properties();
break;
default:
jj_la1[13] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 10:
jj_consume_token(10);
jj_consume_token(12);
jj_consume_token(13);
compactionPolicy = CompactionPolicy();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LEFTPAREN:
compactionPolicyProperties = Configuration();
break;
default:
jj_la1[14] = jj_gen;
;
}
break;
default:
jj_la1[15] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 17:
jj_consume_token(17);
filterField = NestedField();
break;
default:
jj_la1[16] = jj_gen;
;
}
InternalDetailsDecl idd = new InternalDetailsDecl(primaryKeyFields,
autogenerated,
filterField,
temp);
dsetDecl = new DatasetDecl(nameComponents.first,
nameComponents.second,
new Identifier(typeName),
nodeGroupName != null ? new Identifier(nodeGroupName) : null,
compactionPolicy,
compactionPolicyProperties,
hints,
DatasetType.INTERNAL,
idd,
ifNotExists);
break;
default:
jj_la1[17] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return dsetDecl;}
throw new Error("Missing return statement in function");
}
final public RefreshExternalDatasetStatement RefreshExternalDatasetStatement() throws ParseException, ParseException {
RefreshExternalDatasetStatement redss = new RefreshExternalDatasetStatement();
Pair nameComponents = null;
String datasetName = null;
jj_consume_token(18);
jj_consume_token(DATASET);
nameComponents = QualifiedName();
redss.setDataverseName(nameComponents.first);
redss.setDatasetName(nameComponents.second);
{if (true) return redss;}
throw new Error("Missing return statement in function");
}
final public RunStatement RunStatement() throws ParseException, ParseException {
String system = null;
String tmp;
ArrayList parameters = new ArrayList();
Pair nameComponentsFrom = null;
Pair nameComponentsTo = null;
jj_consume_token(19);
system = Identifier();
jj_consume_token(LEFTPAREN);
label_3:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case STRING_LITERAL:
case IDENTIFIER:
;
break;
default:
jj_la1[18] = jj_gen;
break label_3;
}
tmp = Identifier();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
jj_consume_token(COMMA);
break;
default:
jj_la1[19] = jj_gen;
;
}
parameters.add(tmp);
}
jj_consume_token(RIGHTPAREN);
jj_consume_token(FROM);
jj_consume_token(DATASET);
nameComponentsFrom = QualifiedName();
jj_consume_token(20);
jj_consume_token(DATASET);
nameComponentsTo = QualifiedName();
{if (true) return new RunStatement(system, parameters, nameComponentsFrom.first, nameComponentsFrom.second, nameComponentsTo.first, nameComponentsTo.second);}
throw new Error("Missing return statement in function");
}
final public CreateIndexStatement IndexSpecification() throws ParseException, ParseException {
CreateIndexStatement cis = new CreateIndexStatement();
String indexName = null;
boolean ifNotExists = false;
Pair nameComponents = null;
Pair, TypeExpression> fieldPair = null;
IndexParams indexType = null;
boolean enforced = false;
jj_consume_token(21);
indexName = Identifier();
ifNotExists = IfNotExists();
jj_consume_token(8);
nameComponents = QualifiedName();
jj_consume_token(LEFTPAREN);
fieldPair = OpenField();
cis.addFieldExprPair(fieldPair);
label_4:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[20] = jj_gen;
break label_4;
}
jj_consume_token(COMMA);
fieldPair = OpenField();
cis.addFieldExprPair(fieldPair);
}
jj_consume_token(RIGHTPAREN);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 5:
jj_consume_token(5);
indexType = IndexType();
break;
default:
jj_la1[21] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 22:
jj_consume_token(22);
enforced = true;
break;
default:
jj_la1[22] = jj_gen;
;
}
cis.setIndexName(new Identifier(indexName));
cis.setIfNotExists(ifNotExists);
cis.setDataverseName(nameComponents.first);
cis.setDatasetName(nameComponents.second);
if (indexType != null) {
cis.setIndexType(indexType.type);
cis.setGramLength(indexType.gramLength);
}
cis.setEnforced(enforced);
{if (true) return cis;}
throw new Error("Missing return statement in function");
}
final public String CompactionPolicy() throws ParseException, ParseException {
String compactionPolicy = null;
compactionPolicy = Identifier();
{if (true) return compactionPolicy;}
throw new Error("Missing return statement in function");
}
final public String FilterField() throws ParseException, ParseException {
String filterField = null;
filterField = Identifier();
{if (true) return filterField;}
throw new Error("Missing return statement in function");
}
final public IndexParams IndexType() throws ParseException, ParseException {
IndexType type = null;
int gramLength = 0;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 23:
jj_consume_token(23);
type = IndexType.BTREE;
break;
case 24:
jj_consume_token(24);
type = IndexType.RTREE;
break;
case 25:
jj_consume_token(25);
type = IndexType.LENGTH_PARTITIONED_WORD_INVIX;
break;
case 26:
jj_consume_token(26);
jj_consume_token(LEFTPAREN);
jj_consume_token(INTEGER_LITERAL);
type = IndexType.LENGTH_PARTITIONED_NGRAM_INVIX;
gramLength = Integer.valueOf(token.image);
jj_consume_token(RIGHTPAREN);
break;
default:
jj_la1[23] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return new IndexParams(type, gramLength);}
throw new Error("Missing return statement in function");
}
final public CreateDataverseStatement DataverseSpecification() throws ParseException, ParseException {
String dvName = null;
boolean ifNotExists = false;
String format = null;
jj_consume_token(3);
dvName = Identifier();
ifNotExists = IfNotExists();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 27:
jj_consume_token(27);
format = StringLiteral();
break;
default:
jj_la1[24] = jj_gen;
;
}
{if (true) return new CreateDataverseStatement(new Identifier(dvName), format, ifNotExists);}
throw new Error("Missing return statement in function");
}
final public CreateFunctionStatement FunctionSpecification() throws ParseException, ParseException {
FunctionSignature signature;
boolean ifNotExists = false;
List paramList = new ArrayList();
String functionBody;
VarIdentifier var = null;
Expression functionBodyExpr;
Token beginPos;
Token endPos;
FunctionName fctName = null;
createNewScope();
jj_consume_token(28);
fctName = FunctionName();
ifNotExists = IfNotExists();
paramList = ParameterList();
jj_consume_token(LEFTBRACE);
beginPos = token;
functionBodyExpr = Expression();
jj_consume_token(RIGHTBRACE);
endPos = token;
functionBody = extractFragment(beginPos.beginLine, beginPos.beginColumn, endPos.beginLine, endPos.beginColumn);
// TODO use fctName.library
signature = new FunctionSignature(fctName.dataverse, fctName.function, paramList.size());
getCurrentScope().addFunctionDescriptor(signature, false);
removeCurrentScope();
{if (true) return new CreateFunctionStatement(signature, paramList, functionBody, ifNotExists);}
throw new Error("Missing return statement in function");
}
final public CreateFeedStatement FeedSpecification() throws ParseException, ParseException {
Pair nameComponents = null;
boolean ifNotExists = false;
String adapterName = null;
Map properties = null;
FunctionSignature appliedFunction = null;
CreateFeedStatement cfs = null;
Pair sourceNameComponents = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 29:
jj_consume_token(29);
jj_consume_token(30);
nameComponents = QualifiedName();
ifNotExists = IfNotExists();
jj_consume_token(FROM);
jj_consume_token(30);
sourceNameComponents = QualifiedName();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 36:
appliedFunction = ApplyFunction();
break;
default:
jj_la1[25] = jj_gen;
;
}
cfs = new CreateSecondaryFeedStatement(nameComponents,
sourceNameComponents, appliedFunction, ifNotExists);
break;
case 30:
case 31:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 31:
jj_consume_token(31);
break;
default:
jj_la1[26] = jj_gen;
;
}
jj_consume_token(30);
nameComponents = QualifiedName();
ifNotExists = IfNotExists();
jj_consume_token(10);
adapterName = AdapterName();
properties = Configuration();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 36:
appliedFunction = ApplyFunction();
break;
default:
jj_la1[27] = jj_gen;
;
}
cfs = new CreatePrimaryFeedStatement(nameComponents,
adapterName, properties, appliedFunction, ifNotExists);
break;
default:
jj_la1[28] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return cfs;}
throw new Error("Missing return statement in function");
}
final public CreateFeedPolicyStatement FeedPolicySpecification() throws ParseException, ParseException {
String policyName = null;
String basePolicyName = null;
String sourcePolicyFile = null;
String definition = null;
boolean ifNotExists = false;
Map properties = null;
CreateFeedPolicyStatement cfps = null;
jj_consume_token(32);
jj_consume_token(13);
policyName = Identifier();
ifNotExists = IfNotExists();
jj_consume_token(FROM);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 13:
jj_consume_token(13);
basePolicyName = Identifier();
properties = Configuration();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 33:
jj_consume_token(33);
definition = StringLiteral();
break;
default:
jj_la1[29] = jj_gen;
;
}
cfps = new CreateFeedPolicyStatement(policyName,
basePolicyName, properties, definition, ifNotExists);
break;
case 34:
jj_consume_token(34);
sourcePolicyFile = Identifier();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 33:
jj_consume_token(33);
definition = StringLiteral();
break;
default:
jj_la1[30] = jj_gen;
;
}
cfps = new CreateFeedPolicyStatement(policyName, sourcePolicyFile, definition, ifNotExists);
break;
default:
jj_la1[31] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return cfps;}
throw new Error("Missing return statement in function");
}
final public List ParameterList() throws ParseException, ParseException {
List paramList = new ArrayList();
VarIdentifier var = null;
jj_consume_token(LEFTPAREN);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case VARIABLE:
jj_consume_token(VARIABLE);
var = new VarIdentifier();
var.setValue(token.image);
paramList.add(var);
getCurrentScope().addNewVarSymbolToScope(var);
label_5:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[32] = jj_gen;
break label_5;
}
jj_consume_token(COMMA);
jj_consume_token(VARIABLE);
var = new VarIdentifier();
var.setValue(token.image);
paramList.add(var);
getCurrentScope().addNewVarSymbolToScope(var);
}
break;
default:
jj_la1[33] = jj_gen;
;
}
jj_consume_token(RIGHTPAREN);
{if (true) return paramList;}
throw new Error("Missing return statement in function");
}
final public boolean IfNotExists() throws ParseException, ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 35:
jj_consume_token(35);
{if (true) return true;}
break;
default:
jj_la1[34] = jj_gen;
;
}
{if (true) return false;}
throw new Error("Missing return statement in function");
}
final public FunctionSignature ApplyFunction() throws ParseException, ParseException {
FunctionName functioName = null;
FunctionSignature funcSig = null;
jj_consume_token(36);
jj_consume_token(28);
functioName = FunctionName();
String fqFunctionName = functioName.library == null ? functioName.function : functioName.library + "#" + functioName.function;
{if (true) return new FunctionSignature(functioName.dataverse, fqFunctionName, 1);}
throw new Error("Missing return statement in function");
}
final public String GetPolicy() throws ParseException, ParseException {
String policy = null;
jj_consume_token(10);
jj_consume_token(13);
policy = Identifier();
{if (true) return policy;}
throw new Error("Missing return statement in function");
}
final public FunctionSignature FunctionSignature() throws ParseException, ParseException {
FunctionName fctName = null;
int arity = 0;
fctName = FunctionName();
jj_consume_token(37);
jj_consume_token(INTEGER_LITERAL);
arity = new Integer(token.image);
if (arity < 0 && arity != FunctionIdentifier.VARARGS) {
{if (true) throw new ParseException(" invalid arity:" + arity);}
}
// TODO use fctName.library
String fqFunctionName = fctName.library == null ? fctName.function : fctName.library + "#" + fctName.function;
{if (true) return new FunctionSignature(fctName.dataverse, fqFunctionName, arity);}
throw new Error("Missing return statement in function");
}
final public List> PrimaryKey() throws ParseException, ParseException {
List tmp = null;
List> primaryKeyFields = new ArrayList>();
jj_consume_token(31);
jj_consume_token(38);
tmp = NestedField();
primaryKeyFields.add(tmp);
label_6:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[35] = jj_gen;
break label_6;
}
jj_consume_token(COMMA);
tmp = NestedField();
primaryKeyFields.add(tmp);
}
{if (true) return primaryKeyFields;}
throw new Error("Missing return statement in function");
}
final public Statement DropStatement() throws ParseException, ParseException {
String id = null;
Pair pairId = null;
Triple tripleId = null;
FunctionSignature funcSig = null;
boolean ifExists = false;
Statement stmt = null;
jj_consume_token(39);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DATASET:
jj_consume_token(DATASET);
pairId = QualifiedName();
ifExists = IfExists();
stmt = new DropStatement(pairId.first, pairId.second, ifExists);
break;
case 21:
jj_consume_token(21);
tripleId = DoubleQualifiedName();
ifExists = IfExists();
stmt = new IndexDropStatement(tripleId.first, tripleId.second, tripleId.third, ifExists);
break;
case 7:
jj_consume_token(7);
id = Identifier();
ifExists = IfExists();
stmt = new NodeGroupDropStatement(new Identifier(id), ifExists);
break;
case 5:
jj_consume_token(5);
pairId = TypeName();
ifExists = IfExists();
stmt = new TypeDropStatement(pairId.first, pairId.second, ifExists);
break;
case 3:
jj_consume_token(3);
id = Identifier();
ifExists = IfExists();
stmt = new DataverseDropStatement(new Identifier(id), ifExists);
break;
case 28:
jj_consume_token(28);
funcSig = FunctionSignature();
ifExists = IfExists();
stmt = new FunctionDropStatement(funcSig, ifExists);
break;
case 30:
jj_consume_token(30);
pairId = QualifiedName();
ifExists = IfExists();
stmt = new FeedDropStatement(pairId.first, pairId.second, ifExists);
break;
default:
jj_la1[36] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return stmt;}
throw new Error("Missing return statement in function");
}
final public boolean IfExists() throws ParseException, ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IF:
jj_consume_token(IF);
jj_consume_token(40);
{if (true) return true;}
break;
default:
jj_la1[37] = jj_gen;
;
}
{if (true) return false;}
throw new Error("Missing return statement in function");
}
final public InsertStatement InsertStatement() throws ParseException, ParseException {
Pair nameComponents = null;
Query query;
jj_consume_token(41);
jj_consume_token(42);
jj_consume_token(DATASET);
nameComponents = QualifiedName();
query = Query();
{if (true) return new InsertStatement(nameComponents.first, nameComponents.second, query, getVarCounter());}
throw new Error("Missing return statement in function");
}
final public DeleteStatement DeleteStatement() throws ParseException, ParseException {
VariableExpr var = null;
Expression condition = null;
Pair nameComponents;
// This is related to the new metadata lock management
setDataverses(new ArrayList());
setDatasets(new ArrayList());
jj_consume_token(43);
var = Variable();
getCurrentScope().addNewVarSymbolToScope(var.getVar());
jj_consume_token(FROM);
jj_consume_token(DATASET);
nameComponents = QualifiedName();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case WHERE:
jj_consume_token(WHERE);
condition = Expression();
break;
default:
jj_la1[38] = jj_gen;
;
}
// First we get the dataverses and datasets that we want to lock
List dataverses = getDataverses();
List datasets = getDatasets();
// we remove the pointer to the dataverses and datasets
setDataverses(null);
setDatasets(null);
{if (true) return new DeleteStatement(var, nameComponents.first, nameComponents.second,
condition, getVarCounter(), dataverses, datasets);}
throw new Error("Missing return statement in function");
}
final public UpdateStatement UpdateStatement() throws ParseException, ParseException {
VariableExpr vars;
Expression target;
Expression condition;
UpdateClause uc;
List ucs = new ArrayList();
jj_consume_token(44);
vars = Variable();
jj_consume_token(IN);
target = Expression();
jj_consume_token(WHERE);
condition = Expression();
jj_consume_token(LEFTPAREN);
uc = UpdateClause();
ucs.add(uc);
label_7:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[39] = jj_gen;
break label_7;
}
jj_consume_token(COMMA);
uc = UpdateClause();
ucs.add(uc);
}
jj_consume_token(RIGHTPAREN);
{if (true) return new UpdateStatement(vars, target, condition, ucs);}
throw new Error("Missing return statement in function");
}
final public UpdateClause UpdateClause() throws ParseException, ParseException {
Expression target = null;
Expression value = null ;
InsertStatement is = null;
DeleteStatement ds = null;
UpdateStatement us = null;
Expression condition = null;
UpdateClause ifbranch = null;
UpdateClause elsebranch = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 45:
jj_consume_token(45);
target = Expression();
jj_consume_token(ASSIGN);
value = Expression();
break;
case 41:
is = InsertStatement();
break;
case 43:
ds = DeleteStatement();
break;
case 44:
us = UpdateStatement();
break;
case IF:
jj_consume_token(IF);
jj_consume_token(LEFTPAREN);
condition = Expression();
jj_consume_token(RIGHTPAREN);
jj_consume_token(THEN);
ifbranch = UpdateClause();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ELSE:
jj_consume_token(ELSE);
elsebranch = UpdateClause();
break;
default:
jj_la1[40] = jj_gen;
;
}
{if (true) return new UpdateClause(target, value, is, ds, us, condition, ifbranch, elsebranch);}
break;
default:
jj_la1[41] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
throw new Error("Missing return statement in function");
}
final public Statement SetStatement() throws ParseException, ParseException {
String pn = null;
String pv = null;
jj_consume_token(45);
pn = Identifier();
pv = StringLiteral();
{if (true) return new SetStatement(pn, pv);}
throw new Error("Missing return statement in function");
}
final public Statement WriteStatement() throws ParseException, ParseException {
String nodeName = null;
String fileName = null;
Query query;
String writerClass = null;
Pair nameComponents = null;
jj_consume_token(46);
jj_consume_token(47);
jj_consume_token(20);
nodeName = Identifier();
jj_consume_token(COLON);
fileName = StringLiteral();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 10:
jj_consume_token(10);
writerClass = StringLiteral();
break;
default:
jj_la1[42] = jj_gen;
;
}
{if (true) return new WriteStatement(new Identifier(nodeName), fileName, writerClass);}
throw new Error("Missing return statement in function");
}
final public LoadStatement LoadStatement() throws ParseException, ParseException {
Identifier dataverseName = null;
Identifier datasetName = null;
boolean alreadySorted = false;
String adapterName;
Map properties;
Pair nameComponents = null;
jj_consume_token(48);
jj_consume_token(DATASET);
nameComponents = QualifiedName();
dataverseName = nameComponents.first;
datasetName = nameComponents.second;
jj_consume_token(10);
adapterName = AdapterName();
properties = Configuration();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 49:
jj_consume_token(49);
alreadySorted = true;
break;
default:
jj_la1[43] = jj_gen;
;
}
{if (true) return new LoadStatement(dataverseName, datasetName, adapterName, properties, alreadySorted);}
throw new Error("Missing return statement in function");
}
final public String AdapterName() throws ParseException, ParseException {
String adapterName = null;
adapterName = Identifier();
{if (true) return adapterName;}
throw new Error("Missing return statement in function");
}
final public Statement CompactStatement() throws ParseException, ParseException {
Pair nameComponents = null;
Statement stmt = null;
jj_consume_token(50);
jj_consume_token(DATASET);
nameComponents = QualifiedName();
stmt = new CompactStatement(nameComponents.first, nameComponents.second);
{if (true) return stmt;}
throw new Error("Missing return statement in function");
}
final public Statement FeedStatement() throws ParseException, ParseException {
Pair feedNameComponents = null;
Pair datasetNameComponents = null;
Map configuration = null;
Statement stmt = null;
String policy = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 51:
jj_consume_token(51);
jj_consume_token(30);
feedNameComponents = QualifiedName();
jj_consume_token(20);
jj_consume_token(DATASET);
datasetNameComponents = QualifiedName();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 10:
policy = GetPolicy();
break;
default:
jj_la1[44] = jj_gen;
;
}
stmt = new ConnectFeedStatement(feedNameComponents, datasetNameComponents, policy, getVarCounter());
break;
case 52:
jj_consume_token(52);
jj_consume_token(30);
feedNameComponents = QualifiedName();
jj_consume_token(FROM);
jj_consume_token(DATASET);
datasetNameComponents = QualifiedName();
stmt = new DisconnectFeedStatement(feedNameComponents, datasetNameComponents);
break;
default:
jj_la1[45] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return stmt;}
throw new Error("Missing return statement in function");
}
final public Map Configuration() throws ParseException, ParseException {
Map configuration = new LinkedHashMap();
Pair keyValuePair = null;
jj_consume_token(LEFTPAREN);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LEFTPAREN:
keyValuePair = KeyValuePair();
configuration.put(keyValuePair.first, keyValuePair.second);
label_8:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[46] = jj_gen;
break label_8;
}
jj_consume_token(COMMA);
keyValuePair = KeyValuePair();
configuration.put(keyValuePair.first, keyValuePair.second);
}
break;
default:
jj_la1[47] = jj_gen;
;
}
jj_consume_token(RIGHTPAREN);
{if (true) return configuration;}
throw new Error("Missing return statement in function");
}
final public Pair KeyValuePair() throws ParseException, ParseException {
String key;
String value;
jj_consume_token(LEFTPAREN);
key = StringLiteral();
jj_consume_token(EQ);
value = StringLiteral();
jj_consume_token(RIGHTPAREN);
{if (true) return new Pair(key, value);}
throw new Error("Missing return statement in function");
}
final public Map Properties() throws ParseException, ParseException {
Map properties = new HashMap();
Pair property;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LEFTPAREN:
jj_consume_token(LEFTPAREN);
property = Property();
properties.put(property.first, property.second);
label_9:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[48] = jj_gen;
break label_9;
}
jj_consume_token(COMMA);
property = Property();
properties.put(property.first, property.second);
}
jj_consume_token(RIGHTPAREN);
break;
default:
jj_la1[49] = jj_gen;
;
}
{if (true) return properties;}
throw new Error("Missing return statement in function");
}
final public Pair Property() throws ParseException, ParseException {
String key;
String value;
key = Identifier();
jj_consume_token(EQ);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case STRING_LITERAL:
value = StringLiteral();
break;
case INTEGER_LITERAL:
jj_consume_token(INTEGER_LITERAL);
try {
value = "" + Long.valueOf(token.image);
} catch (NumberFormatException nfe) {
{if (true) throw new ParseException("inapproriate value: " + token.image);}
}
break;
default:
jj_la1[50] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return new Pair(key.toUpperCase(), value);}
throw new Error("Missing return statement in function");
}
final public TypeExpression IndexedTypeExpr() throws ParseException, ParseException {
TypeExpression typeExpr = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case STRING_LITERAL:
case IDENTIFIER:
typeExpr = TypeReference();
break;
case LEFTBRACKET:
typeExpr = OrderedListTypeDef();
break;
case LEFTDBLBRACE:
typeExpr = UnorderedListTypeDef();
break;
default:
jj_la1[51] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return typeExpr;}
throw new Error("Missing return statement in function");
}
final public TypeExpression TypeExpr() throws ParseException, ParseException {
TypeExpression typeExpr = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 53:
case 54:
case LEFTBRACE:
typeExpr = RecordTypeDef();
break;
case STRING_LITERAL:
case IDENTIFIER:
typeExpr = TypeReference();
break;
case LEFTBRACKET:
typeExpr = OrderedListTypeDef();
break;
case LEFTDBLBRACE:
typeExpr = UnorderedListTypeDef();
break;
default:
jj_la1[52] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return typeExpr;}
throw new Error("Missing return statement in function");
}
final public RecordTypeDefinition RecordTypeDef() throws ParseException, ParseException {
RecordTypeDefinition recType = new RecordTypeDefinition();
RecordTypeDefinition.RecordKind recordKind = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 53:
case 54:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 53:
jj_consume_token(53);
recordKind = RecordTypeDefinition.RecordKind.CLOSED;
break;
case 54:
jj_consume_token(54);
recordKind = RecordTypeDefinition.RecordKind.OPEN;
break;
default:
jj_la1[53] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
default:
jj_la1[54] = jj_gen;
;
}
jj_consume_token(LEFTBRACE);
String hint = getHint(token);
if (hint != null) {
String splits[] = hint.split(" +");
if (splits[0].equals(GEN_FIELDS_HINT)) {
if (splits.length != 5) {
{if (true) throw new ParseException("Expecting: /*+ gen-fields */");}
}
if (!splits[1].equals("int")) {
{if (true) throw new ParseException("The only supported type for gen-fields is int.");}
}
UndeclaredFieldsDataGen ufdg = new UndeclaredFieldsDataGen(UndeclaredFieldsDataGen.Type.INT,
Integer.parseInt(splits[2]), Integer.parseInt(splits[3]), splits[4]);
recType.setUndeclaredFieldsDataGen(ufdg);
}
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case STRING_LITERAL:
case IDENTIFIER:
RecordField(recType);
label_10:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[55] = jj_gen;
break label_10;
}
jj_consume_token(COMMA);
RecordField(recType);
}
break;
default:
jj_la1[56] = jj_gen;
;
}
jj_consume_token(RIGHTBRACE);
if (recordKind == null) {
recordKind = RecordTypeDefinition.RecordKind.OPEN;
}
recType.setRecordKind(recordKind);
{if (true) return recType;}
throw new Error("Missing return statement in function");
}
final public void RecordField(RecordTypeDefinition recType) throws ParseException, ParseException {
String fieldName;
TypeExpression type = null;
boolean nullable = false;
fieldName = Identifier();
String hint = getHint(token);
IRecordFieldDataGen rfdg = hint != null ? parseFieldDataGen(hint) : null;
jj_consume_token(COLON);
type = TypeExpr();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case QUES:
jj_consume_token(QUES);
nullable = true;
break;
default:
jj_la1[57] = jj_gen;
;
}
recType.addField(fieldName, type, nullable, rfdg);
}
final public TypeReferenceExpression TypeReference() throws ParseException, ParseException {
String id = null;
id = Identifier();
if (id.equalsIgnoreCase("int")) {
id = "int64";
}
{if (true) return new TypeReferenceExpression(new Identifier(id));}
throw new Error("Missing return statement in function");
}
final public OrderedListTypeDefinition OrderedListTypeDef() throws ParseException, ParseException {
TypeExpression type = null;
jj_consume_token(LEFTBRACKET);
type = TypeExpr();
jj_consume_token(RIGHTBRACKET);
{if (true) return new OrderedListTypeDefinition(type);}
throw new Error("Missing return statement in function");
}
final public UnorderedListTypeDefinition UnorderedListTypeDef() throws ParseException, ParseException {
TypeExpression type = null;
jj_consume_token(LEFTDBLBRACE);
type = TypeExpr();
jj_consume_token(RIGHTDBLBRACE);
{if (true) return new UnorderedListTypeDefinition(type);}
throw new Error("Missing return statement in function");
}
final public FunctionName FunctionName() throws ParseException, ParseException {
String first = null;
String second = null;
String third = null;
boolean secondAfterDot = false;
first = Identifier();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 55:
case DOT:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DOT:
jj_consume_token(DOT);
second = Identifier();
secondAfterDot = true;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 55:
jj_consume_token(55);
third = Identifier();
break;
default:
jj_la1[58] = jj_gen;
;
}
break;
case 55:
jj_consume_token(55);
second = Identifier();
break;
default:
jj_la1[59] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
default:
jj_la1[60] = jj_gen;
;
}
FunctionName result = new FunctionName();
if (second == null) {
result.dataverse = defaultDataverse;
result.library = null;
result.function = first;
} else if (third == null) {
if (secondAfterDot) {
result.dataverse = first;
result.library = null;
result.function = second;
} else {
result.dataverse = defaultDataverse;
result.library = first;
result.function = second;
}
} else {
result.dataverse = first;
result.library = second;
result.function = third;
}
if (result.function.equalsIgnoreCase("int")) {
result.function = "int64";
}
{if (true) return result;}
throw new Error("Missing return statement in function");
}
final public Pair TypeName() throws ParseException, ParseException {
Pair name = null;
name = QualifiedName();
if (name.first == null) {
name.first = new Identifier(defaultDataverse);
}
{if (true) return name;}
throw new Error("Missing return statement in function");
}
final public String Identifier() throws ParseException, ParseException {
String lit = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IDENTIFIER:
jj_consume_token(IDENTIFIER);
{if (true) return token.image;}
break;
case STRING_LITERAL:
lit = StringLiteral();
{if (true) return lit;}
break;
default:
jj_la1[61] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
throw new Error("Missing return statement in function");
}
final public Pair, TypeExpression> OpenField() throws ParseException, ParseException {
TypeExpression fieldType = null;
List fieldList = null;
fieldList = NestedField();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COLON:
jj_consume_token(COLON);
fieldType = IndexedTypeExpr();
break;
default:
jj_la1[62] = jj_gen;
;
}
{if (true) return new Pair, TypeExpression>(fieldList, fieldType);}
throw new Error("Missing return statement in function");
}
final public List NestedField() throws ParseException, ParseException {
List exprList = new ArrayList();
String lit = null;
lit = Identifier();
exprList.add(lit);
label_11:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DOT:
;
break;
default:
jj_la1[63] = jj_gen;
break label_11;
}
jj_consume_token(DOT);
lit = Identifier();
exprList.add(lit);
}
{if (true) return exprList;}
throw new Error("Missing return statement in function");
}
final public String StringLiteral() throws ParseException, ParseException {
jj_consume_token(STRING_LITERAL);
{if (true) return removeQuotesAndEscapes(token.image);}
throw new Error("Missing return statement in function");
}
final public Pair QualifiedName() throws ParseException, ParseException {
String first = null;
String second = null;
first = Identifier();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DOT:
jj_consume_token(DOT);
second = Identifier();
break;
default:
jj_la1[64] = jj_gen;
;
}
Identifier id1 = null;
Identifier id2 = null;
if (second == null) {
id2 = new Identifier(first);
} else
{
id1 = new Identifier(first);
id2 = new Identifier(second);
}
{if (true) return new Pair(id1, id2);}
throw new Error("Missing return statement in function");
}
final public Triple DoubleQualifiedName() throws ParseException, ParseException {
String first = null;
String second = null;
String third = null;
first = Identifier();
jj_consume_token(DOT);
second = Identifier();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DOT:
jj_consume_token(DOT);
third = Identifier();
break;
default:
jj_la1[65] = jj_gen;
;
}
Identifier id1 = null;
Identifier id2 = null;
Identifier id3 = null;
if (third == null) {
id2 = new Identifier(first);
id3 = new Identifier(second);
} else {
id1 = new Identifier(first);
id2 = new Identifier(second);
id3 = new Identifier(third);
}
{if (true) return new Triple(id1, id2, id3);}
throw new Error("Missing return statement in function");
}
final public FunctionDecl FunctionDeclaration() throws ParseException, ParseException {
FunctionDecl funcDecl;
FunctionSignature signature;
String functionName;
List paramList = new ArrayList();
Expression funcBody;
createNewScope();
jj_consume_token(56);
jj_consume_token(28);
functionName = Identifier();
paramList = ParameterList();
jj_consume_token(LEFTBRACE);
funcBody = Expression();
jj_consume_token(RIGHTBRACE);
signature = new FunctionSignature(defaultDataverse, functionName, paramList.size());
getCurrentScope().addFunctionDescriptor(signature, false);
funcDecl = new FunctionDecl(signature, paramList, funcBody);
removeCurrentScope();
{if (true) return funcDecl;}
throw new Error("Missing return statement in function");
}
final public Query Query() throws ParseException, ParseException {
Query query = new Query();
// we set the pointers to the dataverses and datasets lists to fill them with entities to be locked
setDataverses(query.getDataverses());
setDatasets(query.getDatasets());
Expression expr;
expr = Expression();
query.setBody(expr);
query.setVarCounter(getVarCounter());
// we remove the pointers to the locked entities before we return the query object
setDataverses(null);
setDatasets(null);
{if (true) return query;}
throw new Error("Missing return statement in function");
}
final public Expression Expression() throws ParseException {
Expression expr = null;
Expression exprP = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DATASET:
case MINUS:
case PLUS:
case LEFTPAREN:
case LEFTBRACKET:
case LEFTBRACE:
case LEFTDBLBRACE:
case INTEGER_LITERAL:
case NULL:
case TRUE:
case FALSE:
case DOUBLE_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
case IDENTIFIER:
case VARIABLE:
//OperatorExpr | IfThenElse | FLWOGRExpression | QuantifiedExpression
expr = OperatorExpr();
break;
case IF:
expr = IfThenElse();
break;
case FOR:
case FROM:
case LET:
case WITH:
expr = FLWOGR();
break;
case EVERY:
case SOME:
expr = QuantifiedExpression();
break;
default:
jj_la1[66] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return (exprP==null) ? expr : exprP;}
throw new Error("Missing return statement in function");
}
final public Expression OperatorExpr() throws ParseException, ParseException {
OperatorExpr op = null;
Expression operand = null;
operand = AndExpr();
label_12:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case OR:
;
break;
default:
jj_la1[67] = jj_gen;
break label_12;
}
jj_consume_token(OR);
if (op == null) {
op = new OperatorExpr();
op.addOperand(operand);
op.setCurrentop(true);
}
op.addOperator(token.image);
operand = AndExpr();
op.addOperand(operand);
}
{if (true) return op==null? operand: op;}
throw new Error("Missing return statement in function");
}
final public Expression AndExpr() throws ParseException, ParseException {
OperatorExpr op = null;
Expression operand = null;
operand = RelExpr();
label_13:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case AND:
;
break;
default:
jj_la1[68] = jj_gen;
break label_13;
}
jj_consume_token(AND);
if (op == null) {
op = new OperatorExpr();
op.addOperand(operand);
op.setCurrentop(true);
}
op.addOperator(token.image);
operand = RelExpr();
op.addOperand(operand);
}
{if (true) return op==null? operand: op;}
throw new Error("Missing return statement in function");
}
final public Expression RelExpr() throws ParseException, ParseException {
OperatorExpr op = null;
Expression operand = null;
boolean broadcast = false;
IExpressionAnnotation annotation = null;
operand = AddExpr();
if (operand instanceof VariableExpr) {
String hint = getHint(token);
if (hint != null && hint.equals(BROADCAST_JOIN_HINT)) {
broadcast = true;
}
}
if (jj_2_1(2)) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LT:
jj_consume_token(LT);
break;
case GT:
jj_consume_token(GT);
break;
case LE:
jj_consume_token(LE);
break;
case GE:
jj_consume_token(GE);
break;
case EQ:
jj_consume_token(EQ);
break;
case NE:
jj_consume_token(NE);
break;
case SIMILAR:
jj_consume_token(SIMILAR);
break;
default:
jj_la1[69] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
String mhint = getHint(token);
if (mhint != null) {
if (mhint.equals(INDEXED_NESTED_LOOP_JOIN_HINT)) {
annotation = IndexedNLJoinExpressionAnnotation.INSTANCE;
} else if (mhint.equals(SKIP_SECONDARY_INDEX_SEARCH_HINT)) {
annotation = SkipSecondaryIndexSearchExpressionAnnotation.INSTANCE;
}
}
if (op == null) {
op = new OperatorExpr();
op.addOperand(operand, broadcast);
op.setCurrentop(true);
broadcast = false;
}
op.addOperator(token.image);
operand = AddExpr();
broadcast = false;
if (operand instanceof VariableExpr) {
String hint = getHint(token);
if (hint != null && hint.equals(BROADCAST_JOIN_HINT)) {
broadcast = true;
}
}
op.addOperand(operand, broadcast);
} else {
;
}
if (annotation != null) {
op.addHint(annotation);
}
{if (true) return op==null? operand: op;}
throw new Error("Missing return statement in function");
}
final public Expression AddExpr() throws ParseException, ParseException {
OperatorExpr op = null;
Expression operand = null;
operand = MultExpr();
label_14:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case MINUS:
case PLUS:
;
break;
default:
jj_la1[70] = jj_gen;
break label_14;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PLUS:
jj_consume_token(PLUS);
break;
case MINUS:
jj_consume_token(MINUS);
break;
default:
jj_la1[71] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
if (op == null) {
op = new OperatorExpr();
op.addOperand(operand);
op.setCurrentop(true);
}
((OperatorExpr)op).addOperator(token.image);
operand = MultExpr();
op.addOperand(operand);
}
{if (true) return op==null? operand: op;}
throw new Error("Missing return statement in function");
}
final public Expression MultExpr() throws ParseException, ParseException {
OperatorExpr op = null;
Expression operand = null;
operand = UnionExpr();
label_15:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CARET:
case DIV:
case IDIV:
case MOD:
case MUL:
;
break;
default:
jj_la1[72] = jj_gen;
break label_15;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case MUL:
jj_consume_token(MUL);
break;
case DIV:
jj_consume_token(DIV);
break;
case MOD:
jj_consume_token(MOD);
break;
case CARET:
jj_consume_token(CARET);
break;
case IDIV:
jj_consume_token(IDIV);
break;
default:
jj_la1[73] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
if (op == null) {
op = new OperatorExpr();
op.addOperand(operand);
op.setCurrentop(true);
}
op.addOperator(token.image);
operand = UnionExpr();
op.addOperand(operand);
}
{if (true) return op==null?operand:op;}
throw new Error("Missing return statement in function");
}
final public Expression UnionExpr() throws ParseException, ParseException {
UnionExpr union = null;
Expression operand1 = null;
Expression operand2 = null;
operand1 = UnaryExpr();
label_16:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case UNION:
;
break;
default:
jj_la1[74] = jj_gen;
break label_16;
}
jj_consume_token(UNION);
operand2 = UnaryExpr();
if (union == null) {
union = new UnionExpr();
union.addExpr(operand1);
}
union.addExpr(operand2);
}
{if (true) return (union == null)? operand1: union;}
throw new Error("Missing return statement in function");
}
final public Expression UnaryExpr() throws ParseException, ParseException {
Expression uexpr = null;
Expression expr = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case MINUS:
case PLUS:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PLUS:
jj_consume_token(PLUS);
break;
case MINUS:
jj_consume_token(MINUS);
break;
default:
jj_la1[75] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
uexpr = new UnaryExpr();
if("+".equals(token.image))
((UnaryExpr)uexpr).setSign(Sign.POSITIVE);
else if("-".equals(token.image))
((UnaryExpr)uexpr).setSign(Sign.NEGATIVE);
else
{if (true) throw new ParseException();}
break;
default:
jj_la1[76] = jj_gen;
;
}
expr = ValueExpr();
if(uexpr!=null){
((UnaryExpr)uexpr).setExpr(expr);
{if (true) return uexpr;}
}
else{
{if (true) return expr;}
}
throw new Error("Missing return statement in function");
}
final public Expression ValueExpr() throws ParseException, ParseException {
Expression expr = null;
Identifier ident = null;
AbstractAccessor fa = null;
Expression indexExpr = null;
expr = PrimaryExpr();
label_17:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LEFTBRACKET:
case DOT:
;
break;
default:
jj_la1[77] = jj_gen;
break label_17;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DOT:
ident = Field();
fa = (fa == null ? new FieldAccessor(expr, ident)
: new FieldAccessor(fa, ident));
break;
case LEFTBRACKET:
indexExpr = Index();
fa = (fa == null ? new IndexAccessor(expr, indexExpr)
: new IndexAccessor(fa, indexExpr));
break;
default:
jj_la1[78] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if (true) return fa == null ? expr : fa;}
throw new Error("Missing return statement in function");
}
final public Identifier Field() throws ParseException, ParseException {
String ident = null;
jj_consume_token(DOT);
ident = Identifier();
{if (true) return new Identifier(ident);}
throw new Error("Missing return statement in function");
}
final public Expression Index() throws ParseException, ParseException {
Expression expr = null;
jj_consume_token(LEFTBRACKET);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DATASET:
case EVERY:
case FOR:
case FROM:
case IF:
case LET:
case SOME:
case WITH:
case MINUS:
case PLUS:
case LEFTPAREN:
case LEFTBRACKET:
case LEFTBRACE:
case LEFTDBLBRACE:
case INTEGER_LITERAL:
case NULL:
case TRUE:
case FALSE:
case DOUBLE_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
case IDENTIFIER:
case VARIABLE:
expr = Expression();
if(expr.getKind() == Expression.Kind.LITERAL_EXPRESSION)
{
Literal lit = ((LiteralExpr)expr).getValue();
if(lit.getLiteralType() != Literal.Type.INTEGER &&
lit.getLiteralType() != Literal.Type.LONG) {
{if (true) throw new ParseException("Index should be an INTEGER");}
}
}
break;
case QUES:
jj_consume_token(QUES);
break;
default:
jj_la1[79] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
jj_consume_token(RIGHTBRACKET);
{if (true) return expr;}
throw new Error("Missing return statement in function");
}
final public Expression PrimaryExpr() throws ParseException, ParseException {
Expression expr = null;
if (jj_2_2(2)) {
expr = FunctionCallExpr();
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case INTEGER_LITERAL:
case NULL:
case TRUE:
case FALSE:
case DOUBLE_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
expr = Literal();
break;
case DATASET:
expr = DatasetAccessExpression();
break;
case VARIABLE:
expr = VariableRef();
if(((VariableExpr)expr).getIsNewVar() == true)
{if (true) throw new ParseException("can't find variable " + ((VariableExpr)expr).getVar());}
break;
case LEFTBRACKET:
case LEFTDBLBRACE:
expr = ListConstructor();
break;
case LEFTBRACE:
expr = RecordConstructor();
break;
case LEFTPAREN:
expr = ParenthesizedExpression();
break;
default:
jj_la1[80] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if (true) return expr;}
throw new Error("Missing return statement in function");
}
final public Expression Literal() throws ParseException, ParseException {
LiteralExpr lit = new LiteralExpr();
String str = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case STRING_LITERAL:
str = StringLiteral();
lit.setValue(new StringLiteral(str));
break;
case INTEGER_LITERAL:
jj_consume_token(INTEGER_LITERAL);
lit.setValue(new LongIntegerLiteral(new Long(token.image)));
break;
case FLOAT_LITERAL:
jj_consume_token(FLOAT_LITERAL);
lit.setValue(new FloatLiteral(new Float(token.image)));
break;
case DOUBLE_LITERAL:
jj_consume_token(DOUBLE_LITERAL);
lit.setValue(new DoubleLiteral(new Double(token.image)));
break;
case NULL:
jj_consume_token(NULL);
lit.setValue(NullLiteral.INSTANCE);
break;
case TRUE:
jj_consume_token(TRUE);
lit.setValue(TrueLiteral.INSTANCE);
break;
case FALSE:
jj_consume_token(FALSE);
lit.setValue(FalseLiteral.INSTANCE);
break;
default:
jj_la1[81] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return lit;}
throw new Error("Missing return statement in function");
}
final public VariableExpr VariableRef() throws ParseException, ParseException {
VariableExpr varExp = new VariableExpr();
VarIdentifier var = new VarIdentifier();
jj_consume_token(VARIABLE);
String varName = token.image;
Identifier ident = lookupSymbol(varName);
if (isInForbiddenScopes(varName)) {
{if (true) throw new ParseException("Inside limit clauses, it is disallowed to reference a variable having the same name as any variable bound in the same scope as the limit clause.");}
}
if(ident != null) { // exist such ident
varExp.setIsNewVar(false);
varExp.setVar((VarIdentifier)ident);
} else {
varExp.setVar(var);
}
var.setValue(varName);
{if (true) return varExp;}
throw new Error("Missing return statement in function");
}
final public VariableExpr Variable() throws ParseException, ParseException {
VariableExpr varExp = new VariableExpr();
VarIdentifier var = new VarIdentifier();
jj_consume_token(VARIABLE);
Identifier ident = lookupSymbol(token.image);
if(ident != null) { // exist such ident
varExp.setIsNewVar(false);
}
varExp.setVar(var);
var.setValue(token.image);
{if (true) return varExp;}
throw new Error("Missing return statement in function");
}
final public Expression ListConstructor() throws ParseException, ParseException {
Expression expr = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LEFTBRACKET:
expr = OrderedListConstructor();
break;
case LEFTDBLBRACE:
expr = UnorderedListConstructor();
break;
default:
jj_la1[82] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return expr;}
throw new Error("Missing return statement in function");
}
final public ListConstructor OrderedListConstructor() throws ParseException, ParseException {
ListConstructor expr = new ListConstructor();
Expression tmp = null;
List exprList = new ArrayList();
expr.setType(ListConstructor.Type.ORDERED_LIST_CONSTRUCTOR);
jj_consume_token(LEFTBRACKET);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DATASET:
case EVERY:
case FOR:
case FROM:
case IF:
case LET:
case SOME:
case WITH:
case MINUS:
case PLUS:
case LEFTPAREN:
case LEFTBRACKET:
case LEFTBRACE:
case LEFTDBLBRACE:
case INTEGER_LITERAL:
case NULL:
case TRUE:
case FALSE:
case DOUBLE_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
case IDENTIFIER:
case VARIABLE:
tmp = Expression();
exprList.add(tmp);
label_18:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[83] = jj_gen;
break label_18;
}
jj_consume_token(COMMA);
tmp = Expression();
exprList.add(tmp);
}
break;
default:
jj_la1[84] = jj_gen;
;
}
jj_consume_token(RIGHTBRACKET);
expr.setExprList(exprList);
{if (true) return expr;}
throw new Error("Missing return statement in function");
}
final public ListConstructor UnorderedListConstructor() throws ParseException, ParseException {
ListConstructor expr = new ListConstructor();
Expression tmp = null;
List exprList = new ArrayList();
expr.setType(ListConstructor.Type.UNORDERED_LIST_CONSTRUCTOR);
jj_consume_token(LEFTDBLBRACE);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DATASET:
case EVERY:
case FOR:
case FROM:
case IF:
case LET:
case SOME:
case WITH:
case MINUS:
case PLUS:
case LEFTPAREN:
case LEFTBRACKET:
case LEFTBRACE:
case LEFTDBLBRACE:
case INTEGER_LITERAL:
case NULL:
case TRUE:
case FALSE:
case DOUBLE_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
case IDENTIFIER:
case VARIABLE:
tmp = Expression();
exprList.add(tmp);
label_19:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[85] = jj_gen;
break label_19;
}
jj_consume_token(COMMA);
tmp = Expression();
exprList.add(tmp);
}
break;
default:
jj_la1[86] = jj_gen;
;
}
jj_consume_token(RIGHTDBLBRACE);
expr.setExprList(exprList);
{if (true) return expr;}
throw new Error("Missing return statement in function");
}
final public RecordConstructor RecordConstructor() throws ParseException, ParseException {
RecordConstructor expr = new RecordConstructor();
FieldBinding tmp = null;
List fbList = new ArrayList();
jj_consume_token(LEFTBRACE);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DATASET:
case EVERY:
case FOR:
case FROM:
case IF:
case LET:
case SOME:
case WITH:
case MINUS:
case PLUS:
case LEFTPAREN:
case LEFTBRACKET:
case LEFTBRACE:
case LEFTDBLBRACE:
case INTEGER_LITERAL:
case NULL:
case TRUE:
case FALSE:
case DOUBLE_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
case IDENTIFIER:
case VARIABLE:
tmp = FieldBinding();
fbList.add(tmp);
label_20:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[87] = jj_gen;
break label_20;
}
jj_consume_token(COMMA);
tmp = FieldBinding();
fbList.add(tmp);
}
break;
default:
jj_la1[88] = jj_gen;
;
}
jj_consume_token(RIGHTBRACE);
expr.setFbList(fbList);
{if (true) return expr;}
throw new Error("Missing return statement in function");
}
final public FieldBinding FieldBinding() throws ParseException, ParseException {
FieldBinding fb = new FieldBinding();
Expression left, right;
left = Expression();
jj_consume_token(COLON);
right = Expression();
fb.setLeftExpr(left);
fb.setRightExpr(right);
{if (true) return fb;}
throw new Error("Missing return statement in function");
}
final public Expression FunctionCallExpr() throws ParseException, ParseException {
CallExpr callExpr;
List argList = new ArrayList();
Expression tmp;
int arity = 0;
FunctionName funcName = null;
String hint = null;
funcName = FunctionName();
hint = getHint(token);
jj_consume_token(LEFTPAREN);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DATASET:
case EVERY:
case FOR:
case FROM:
case IF:
case LET:
case SOME:
case WITH:
case MINUS:
case PLUS:
case LEFTPAREN:
case LEFTBRACKET:
case LEFTBRACE:
case LEFTDBLBRACE:
case INTEGER_LITERAL:
case NULL:
case TRUE:
case FALSE:
case DOUBLE_LITERAL:
case FLOAT_LITERAL:
case STRING_LITERAL:
case IDENTIFIER:
case VARIABLE:
tmp = Expression();
argList.add(tmp);
arity ++;
label_21:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[89] = jj_gen;
break label_21;
}
jj_consume_token(COMMA);
tmp = Expression();
argList.add(tmp);
arity++;
}
break;
default:
jj_la1[90] = jj_gen;
;
}
jj_consume_token(RIGHTPAREN);
// TODO use funcName.library
String fqFunctionName = funcName.library == null ? funcName.function : funcName.library + "#" + funcName.function;
FunctionSignature signature
= lookupFunctionSignature(funcName.dataverse, fqFunctionName, arity);
if (signature == null) {
signature = new FunctionSignature(funcName.dataverse, fqFunctionName, arity);
}
callExpr = new CallExpr(signature,argList);
if (hint != null) {
if (hint.startsWith(INDEXED_NESTED_LOOP_JOIN_HINT)) {
callExpr.addHint(IndexedNLJoinExpressionAnnotation.INSTANCE);
} else if (hint.startsWith(SKIP_SECONDARY_INDEX_SEARCH_HINT)) {
callExpr.addHint(SkipSecondaryIndexSearchExpressionAnnotation.INSTANCE);
}
}
{if (true) return callExpr;}
throw new Error("Missing return statement in function");
}
final public Expression DatasetAccessExpression() throws ParseException, ParseException {
String funcName;
String arg1 = null;
String arg2 = null;
Expression nameArg;
jj_consume_token(DATASET);
funcName = token.image;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case STRING_LITERAL:
case IDENTIFIER:
arg1 = Identifier();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DOT:
jj_consume_token(DOT);
arg2 = Identifier();
break;
default:
jj_la1[91] = jj_gen;
;
}
String name = arg2 == null ? arg1 : arg1 + "." + arg2;
LiteralExpr ds = new LiteralExpr();
ds.setValue( new StringLiteral(name) );
nameArg = ds;
if(arg2 != null){
addDataverse(arg1.toString());
addDataset(name);
} else {
addDataset(defaultDataverse + "." + name);
}
break;
case LEFTPAREN:
jj_consume_token(LEFTPAREN);
nameArg = Expression();
jj_consume_token(RIGHTPAREN);
break;
default:
jj_la1[92] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
String dataverse = MetadataConstants.METADATA_DATAVERSE_NAME;
FunctionSignature signature = lookupFunctionSignature(dataverse, funcName, 1);
if (signature == null) {
signature = new FunctionSignature(dataverse, funcName, 1);
}
List argList = new ArrayList();
argList.add(nameArg);
{if (true) return new CallExpr(signature, argList);}
throw new Error("Missing return statement in function");
}
final public Expression ParenthesizedExpression() throws ParseException, ParseException {
Expression expr;
jj_consume_token(LEFTPAREN);
expr = Expression();
jj_consume_token(RIGHTPAREN);
{if (true) return expr;}
throw new Error("Missing return statement in function");
}
final public Expression IfThenElse() throws ParseException, ParseException {
Expression condExpr;
Expression thenExpr;
Expression elseExpr;
IfExpr ifExpr = new IfExpr();
jj_consume_token(IF);
jj_consume_token(LEFTPAREN);
condExpr = Expression();
jj_consume_token(RIGHTPAREN);
jj_consume_token(THEN);
thenExpr = Expression();
jj_consume_token(ELSE);
elseExpr = Expression();
ifExpr.setCondExpr(condExpr);
ifExpr.setThenExpr(thenExpr);
ifExpr.setElseExpr(elseExpr);
{if (true) return ifExpr;}
throw new Error("Missing return statement in function");
}
final public Expression FLWOGR() throws ParseException, ParseException {
FLWOGRExpression flworg = new FLWOGRExpression();
List clauseList = new ArrayList();
Expression returnExpr;
Clause tmp;
createNewScope();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case FOR:
case FROM:
tmp = ForClause();
clauseList.add(tmp);
break;
case LET:
case WITH:
tmp = LetClause();
clauseList.add(tmp);
break;
default:
jj_la1[93] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
label_22:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DISTINCT:
case FOR:
case FROM:
case GROUP:
case LET:
case LIMIT:
case ORDER:
case WHERE:
case WITH:
;
break;
default:
jj_la1[94] = jj_gen;
break label_22;
}
tmp = Clause();
clauseList.add(tmp);
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case RETURN:
jj_consume_token(RETURN);
break;
case SELECT:
jj_consume_token(SELECT);
break;
default:
jj_la1[95] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
returnExpr = Expression();
flworg.setClauseList(clauseList);
flworg.setReturnExpr(returnExpr);
removeCurrentScope();
{if (true) return flworg;}
throw new Error("Missing return statement in function");
}
final public Clause Clause() throws ParseException, ParseException {
Clause clause;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case FOR:
case FROM:
clause = ForClause();
break;
case LET:
case WITH:
clause = LetClause();
break;
case WHERE:
clause = WhereClause();
break;
case ORDER:
clause = OrderbyClause();
break;
case GROUP:
clause = GroupClause();
break;
case LIMIT:
clause = LimitClause();
break;
case DISTINCT:
clause = DistinctClause();
break;
default:
jj_la1[96] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return clause;}
throw new Error("Missing return statement in function");
}
final public Clause ForClause() throws ParseException, ParseException {
ForClause fc = new ForClause();
VariableExpr varExp;
VariableExpr varPos = null;
Expression inExp;
extendCurrentScope();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case FOR:
jj_consume_token(FOR);
break;
case FROM:
jj_consume_token(FROM);
break;
default:
jj_la1[97] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
varExp = Variable();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case AT:
jj_consume_token(AT);
varPos = Variable();
break;
default:
jj_la1[98] = jj_gen;
;
}
jj_consume_token(IN);
inExp = Expression();
fc.setVarExpr(varExp);
getCurrentScope().addNewVarSymbolToScope(varExp.getVar());
fc.setInExpr(inExp);
if (varPos != null) {
fc.setPosExpr(varPos);
getCurrentScope().addNewVarSymbolToScope(varPos.getVar());
}
{if (true) return fc;}
throw new Error("Missing return statement in function");
}
final public Clause LetClause() throws ParseException, ParseException {
LetClause lc = new LetClause();
VariableExpr varExp;
Expression beExp;
extendCurrentScope();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LET:
jj_consume_token(LET);
break;
case WITH:
jj_consume_token(WITH);
break;
default:
jj_la1[99] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
varExp = Variable();
jj_consume_token(ASSIGN);
beExp = Expression();
getCurrentScope().addNewVarSymbolToScope(varExp.getVar());
lc.setVarExpr(varExp);
lc.setBeExpr(beExp);
{if (true) return lc;}
throw new Error("Missing return statement in function");
}
final public Clause WhereClause() throws ParseException, ParseException {
WhereClause wc = new WhereClause();
Expression whereExpr;
jj_consume_token(WHERE);
whereExpr = Expression();
wc.setWhereExpr(whereExpr);
{if (true) return wc;}
throw new Error("Missing return statement in function");
}
final public Clause OrderbyClause() throws ParseException, ParseException {
OrderbyClause oc = new OrderbyClause();
Expression orderbyExpr;
List orderbyList = new ArrayList();
List modifierList = new ArrayList();
int numOfOrderby = 0;
jj_consume_token(ORDER);
String hint = getHint(token);
if (hint != null) {
if (hint.startsWith(INMEMORY_HINT)) {
String splits[] = hint.split(" +");
int numFrames = Integer.parseInt(splits[1]);
int numTuples = Integer.parseInt(splits[2]);
oc.setNumFrames(numFrames);
oc.setNumTuples(numTuples);
}
if (hint.startsWith(RANGE_HINT)) {
oc.setRangeMap(RangeMapBuilder.parseHint(hint.substring(RANGE_HINT.length())));
}
}
jj_consume_token(BY);
orderbyExpr = Expression();
orderbyList.add(orderbyExpr);
OrderbyClause.OrderModifier modif = OrderbyClause.OrderModifier.ASC;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ASC:
case DESC:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ASC:
jj_consume_token(ASC);
modif = OrderbyClause.OrderModifier.ASC;
break;
case DESC:
jj_consume_token(DESC);
modif = OrderbyClause.OrderModifier.DESC;
break;
default:
jj_la1[100] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
default:
jj_la1[101] = jj_gen;
;
}
modifierList.add(modif);
label_23:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[102] = jj_gen;
break label_23;
}
jj_consume_token(COMMA);
orderbyExpr = Expression();
orderbyList.add(orderbyExpr);
modif = OrderbyClause.OrderModifier.ASC;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ASC:
case DESC:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ASC:
jj_consume_token(ASC);
modif = OrderbyClause.OrderModifier.ASC;
break;
case DESC:
jj_consume_token(DESC);
modif = OrderbyClause.OrderModifier.DESC;
break;
default:
jj_la1[103] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
default:
jj_la1[104] = jj_gen;
;
}
modifierList.add(modif);
}
oc.setModifierList(modifierList);
oc.setOrderbyList(orderbyList);
{if (true) return oc;}
throw new Error("Missing return statement in function");
}
final public Clause GroupClause() throws ParseException, ParseException {
GroupbyClause gbc = new GroupbyClause();
// GbyVariableExpressionPair pair = new GbyVariableExpressionPair();
List vePairList = new ArrayList();
List decorPairList = new ArrayList();
List withVarList= new ArrayList();
VariableExpr var = null;
VariableExpr withVar = null;
Expression expr = null;
VariableExpr decorVar = null;
Expression decorExpr = null;
Scope newScope = extendCurrentScopeNoPush(true);
// extendCurrentScope(true);
jj_consume_token(GROUP);
String hint = getHint(token);
if (hint != null && hint.equals(HASH_GROUP_BY_HINT)) {
gbc.setHashGroupByHint(true);
}
jj_consume_token(BY);
if (jj_2_3(2)) {
var = Variable();
newScope.addNewVarSymbolToScope(var.getVar());
jj_consume_token(ASSIGN);
} else {
;
}
expr = Expression();
GbyVariableExpressionPair pair1 = new GbyVariableExpressionPair(var, expr);
vePairList.add(pair1);
label_24:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[105] = jj_gen;
break label_24;
}
jj_consume_token(COMMA);
if (jj_2_4(2)) {
var = Variable();
newScope.addNewVarSymbolToScope(var.getVar());
jj_consume_token(ASSIGN);
} else {
;
}
expr = Expression();
GbyVariableExpressionPair pair2 = new GbyVariableExpressionPair(var, expr);
vePairList.add(pair2);
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DECOR:
jj_consume_token(DECOR);
decorVar = Variable();
jj_consume_token(ASSIGN);
decorExpr = Expression();
newScope.addNewVarSymbolToScope(decorVar.getVar());
GbyVariableExpressionPair pair3 = new GbyVariableExpressionPair(decorVar, decorExpr);
decorPairList.add(pair3);
label_25:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[106] = jj_gen;
break label_25;
}
jj_consume_token(COMMA);
jj_consume_token(DECOR);
decorVar = Variable();
jj_consume_token(ASSIGN);
decorExpr = Expression();
newScope.addNewVarSymbolToScope(decorVar.getVar());
GbyVariableExpressionPair pair4 = new GbyVariableExpressionPair(decorVar, decorExpr);
decorPairList.add(pair4);
}
break;
default:
jj_la1[107] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case WITH:
jj_consume_token(WITH);
break;
case KEEPING:
jj_consume_token(KEEPING);
break;
default:
jj_la1[108] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
withVar = VariableRef();
if(withVar.getIsNewVar()==true)
{if (true) throw new ParseException("can't find variable " + withVar.getVar());}
withVarList.add(withVar);
newScope.addNewVarSymbolToScope(withVar.getVar());
label_26:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[109] = jj_gen;
break label_26;
}
jj_consume_token(COMMA);
withVar = VariableRef();
if(withVar.getIsNewVar()==true)
{if (true) throw new ParseException("can't find variable " + withVar.getVar());}
withVarList.add(withVar);
newScope.addNewVarSymbolToScope(withVar.getVar());
}
gbc.setGbyPairList(vePairList);
gbc.setDecorPairList(decorPairList);
gbc.setWithVarList(withVarList);
replaceCurrentScope(newScope);
{if (true) return gbc;}
throw new Error("Missing return statement in function");
}
final public LimitClause LimitClause() throws ParseException, ParseException {
LimitClause lc = new LimitClause();
Expression expr;
pushForbiddenScope(getCurrentScope());
jj_consume_token(LIMIT);
expr = Expression();
lc.setLimitExpr(expr);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case OFFSET:
jj_consume_token(OFFSET);
expr = Expression();
lc.setOffset(expr);
break;
default:
jj_la1[110] = jj_gen;
;
}
popForbiddenScope();
{if (true) return lc;}
throw new Error("Missing return statement in function");
}
final public DistinctClause DistinctClause() throws ParseException, ParseException {
List exprs = new ArrayList();
Expression expr;
jj_consume_token(DISTINCT);
jj_consume_token(BY);
expr = Expression();
exprs.add(expr);
label_27:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[111] = jj_gen;
break label_27;
}
jj_consume_token(COMMA);
expr = Expression();
exprs.add(expr);
}
{if (true) return new DistinctClause(exprs);}
throw new Error("Missing return statement in function");
}
final public QuantifiedExpression QuantifiedExpression() throws ParseException, ParseException {
QuantifiedExpression qc = new QuantifiedExpression();
List quantifiedList = new ArrayList();
Expression satisfiesExpr;
VariableExpr var;
Expression inExpr;
QuantifiedPair pair;
createNewScope();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SOME:
jj_consume_token(SOME);
qc.setQuantifier(QuantifiedExpression.Quantifier.SOME);
break;
case EVERY:
jj_consume_token(EVERY);
qc.setQuantifier(QuantifiedExpression.Quantifier.EVERY);
break;
default:
jj_la1[112] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
var = Variable();
jj_consume_token(IN);
inExpr = Expression();
pair = new QuantifiedPair(var, inExpr);
getCurrentScope().addNewVarSymbolToScope(var.getVar());
quantifiedList.add(pair);
label_28:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[113] = jj_gen;
break label_28;
}
jj_consume_token(COMMA);
var = Variable();
jj_consume_token(IN);
inExpr = Expression();
pair = new QuantifiedPair(var, inExpr);
getCurrentScope().addNewVarSymbolToScope(var.getVar());
quantifiedList.add(pair);
}
jj_consume_token(SATISFIES);
satisfiesExpr = Expression();
qc.setSatisfiesExpr(satisfiesExpr);
qc.setQuantifiedList(quantifiedList);
removeCurrentScope();
{if (true) return qc;}
throw new Error("Missing return statement in function");
}
private boolean jj_2_1(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_1(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(0, xla); }
}
private boolean jj_2_2(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_2(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(1, xla); }
}
private boolean jj_2_3(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_3(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(2, xla); }
}
private boolean jj_2_4(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_4(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(3, xla); }
}
private boolean jj_3R_54() {
if (jj_scan_token(VARIABLE)) return true;
return false;
}
private boolean jj_3R_53() {
if (jj_scan_token(DATASET)) return true;
return false;
}
private boolean jj_3R_68() {
if (jj_scan_token(LEFTDBLBRACE)) return true;
return false;
}
private boolean jj_3R_44() {
if (jj_scan_token(STRING_LITERAL)) return true;
return false;
}
private boolean jj_3R_66() {
if (jj_3R_68()) return true;
return false;
}
private boolean jj_3R_32() {
if (jj_3R_34()) return true;
return false;
}
private boolean jj_3R_64() {
if (jj_scan_token(FALSE)) return true;
return false;
}
private boolean jj_3R_33() {
if (jj_3R_35()) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3R_36()) jj_scanpos = xsp;
return false;
}
private boolean jj_3R_63() {
if (jj_scan_token(TRUE)) return true;
return false;
}
private boolean jj_3R_62() {
if (jj_scan_token(NULL)) return true;
return false;
}
private boolean jj_3R_61() {
if (jj_scan_token(DOUBLE_LITERAL)) return true;
return false;
}
private boolean jj_3R_43() {
if (jj_3R_45()) return true;
return false;
}
private boolean jj_3R_60() {
if (jj_scan_token(FLOAT_LITERAL)) return true;
return false;
}
private boolean jj_3R_67() {
if (jj_scan_token(LEFTBRACKET)) return true;
return false;
}
private boolean jj_3R_59() {
if (jj_scan_token(INTEGER_LITERAL)) return true;
return false;
}
private boolean jj_3_4() {
if (jj_3R_31()) return true;
if (jj_scan_token(ASSIGN)) return true;
return false;
}
private boolean jj_3R_58() {
if (jj_3R_44()) return true;
return false;
}
private boolean jj_3R_52() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_58()) {
jj_scanpos = xsp;
if (jj_3R_59()) {
jj_scanpos = xsp;
if (jj_3R_60()) {
jj_scanpos = xsp;
if (jj_3R_61()) {
jj_scanpos = xsp;
if (jj_3R_62()) {
jj_scanpos = xsp;
if (jj_3R_63()) {
jj_scanpos = xsp;
if (jj_3R_64()) return true;
}
}
}
}
}
}
return false;
}
private boolean jj_3R_29() {
if (jj_3R_32()) return true;
return false;
}
private boolean jj_3R_65() {
if (jj_3R_67()) return true;
return false;
}
private boolean jj_3R_30() {
if (jj_3R_33()) return true;
if (jj_scan_token(LEFTPAREN)) return true;
return false;
}
private boolean jj_3R_55() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_65()) {
jj_scanpos = xsp;
if (jj_3R_66()) return true;
}
return false;
}
private boolean jj_3R_51() {
if (jj_3R_57()) return true;
return false;
}
private boolean jj_3_3() {
if (jj_3R_31()) return true;
if (jj_scan_token(ASSIGN)) return true;
return false;
}
private boolean jj_3R_39() {
if (jj_3R_44()) return true;
return false;
}
private boolean jj_3R_50() {
if (jj_3R_56()) return true;
return false;
}
private boolean jj_3R_49() {
if (jj_3R_55()) return true;
return false;
}
private boolean jj_3R_42() {
Token xsp;
xsp = jj_scanpos;
if (jj_scan_token(90)) {
jj_scanpos = xsp;
if (jj_scan_token(87)) return true;
}
return false;
}
private boolean jj_3R_38() {
if (jj_scan_token(IDENTIFIER)) return true;
return false;
}
private boolean jj_3R_35() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_38()) {
jj_scanpos = xsp;
if (jj_3R_39()) return true;
}
return false;
}
private boolean jj_3R_48() {
if (jj_3R_54()) return true;
return false;
}
private boolean jj_3R_37() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_42()) jj_scanpos = xsp;
if (jj_3R_43()) return true;
return false;
}
private boolean jj_3R_47() {
if (jj_3R_53()) return true;
return false;
}
private boolean jj_3R_46() {
if (jj_3R_52()) return true;
return false;
}
private boolean jj_3_2() {
if (jj_3R_30()) return true;
return false;
}
private boolean jj_3R_57() {
if (jj_scan_token(LEFTPAREN)) return true;
return false;
}
private boolean jj_3R_45() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_2()) {
jj_scanpos = xsp;
if (jj_3R_46()) {
jj_scanpos = xsp;
if (jj_3R_47()) {
jj_scanpos = xsp;
if (jj_3R_48()) {
jj_scanpos = xsp;
if (jj_3R_49()) {
jj_scanpos = xsp;
if (jj_3R_50()) {
jj_scanpos = xsp;
if (jj_3R_51()) return true;
}
}
}
}
}
}
return false;
}
private boolean jj_3R_31() {
if (jj_scan_token(VARIABLE)) return true;
return false;
}
private boolean jj_3R_41() {
if (jj_scan_token(55)) return true;
return false;
}
private boolean jj_3R_34() {
if (jj_3R_37()) return true;
return false;
}
private boolean jj_3R_56() {
if (jj_scan_token(LEFTBRACE)) return true;
return false;
}
private boolean jj_3_1() {
Token xsp;
xsp = jj_scanpos;
if (jj_scan_token(99)) {
jj_scanpos = xsp;
if (jj_scan_token(100)) {
jj_scanpos = xsp;
if (jj_scan_token(101)) {
jj_scanpos = xsp;
if (jj_scan_token(102)) {
jj_scanpos = xsp;
if (jj_scan_token(103)) {
jj_scanpos = xsp;
if (jj_scan_token(104)) {
jj_scanpos = xsp;
if (jj_scan_token(105)) return true;
}
}
}
}
}
}
if (jj_3R_29()) return true;
return false;
}
private boolean jj_3R_40() {
if (jj_scan_token(DOT)) return true;
return false;
}
private boolean jj_3R_36() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_40()) {
jj_scanpos = xsp;
if (jj_3R_41()) return true;
}
return false;
}
/** Generated Token Manager. */
public AQLParserTokenManager token_source;
JavaCharStream jj_input_stream;
/** Current token. */
public Token token;
/** Next token. */
public Token jj_nt;
private int jj_ntk;
private Token jj_scanpos, jj_lastpos;
private int jj_la;
private int jj_gen;
final private int[] jj_la1 = new int[114];
static private int[] jj_la1_0;
static private int[] jj_la1_1;
static private int[] jj_la1_2;
static private int[] jj_la1_3;
static private int[] jj_la1_4;
static {
jj_la1_init_0();
jj_la1_init_1();
jj_la1_init_2();
jj_la1_init_3();
jj_la1_init_4();
}
private static void jj_la1_init_0() {
jj_la1_0 = new int[] {0xc0014,0x2,0xc0014,0xf020c2a8,0x0,0x100,0x800,0x0,0x400,0xc000,0xc000,0x10000,0x100,0x800,0x0,0x400,0x20000,0xc200,0x0,0x0,0x0,0x20,0x400000,0x7800000,0x8000000,0x0,0x80000000,0x0,0xe0000000,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x502000a8,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
}
private static void jj_la1_init_1() {
jj_la1_1 = new int[] {0x111d7a80,0x0,0x111d7a80,0x10000001,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x10,0x0,0x2,0x2,0x4,0x0,0x0,0x8,0x0,0x10000000,0x0,0x0,0x0,0x0,0x3a00,0x0,0x20000,0x0,0x180000,0x0,0x0,0x0,0x0,0x0,0x0,0x600000,0x600000,0x600000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x10000000,0x0,0x0,0x0,0x10000000,0x0,0x10000000,0x0,0x10000000,0x0,0x10000000,0x0,0x0,0x0,0x80000000,0x0,0x80000000,0x0,0x4000000,0x0,0x42000000,0x42000000,0x0,0x42000000,0x42000000,0x0,0x0,0x20000000,0x0,0x0,0x0,0x0,0x0,0x0,};
}
private static void jj_la1_init_2() {
jj_la1_2 = new int[] {0x2c8440ae,0x0,0x2c8440ae,0x0,0x0,0x0,0x0,0x8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20000,0x0,0x1,0x20,0x0,0x0,0x0,0x0,0x0,0x8000000,0x0,0x8000000,0x0,0x20000000,0x20000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x2c8440ae,0x0,0x0,0x0,0x4800000,0x4800000,0x3700000,0x3700000,0x10000,0x4800000,0x4800000,0x20000000,0x20000000,0x2c8440ae,0x28000000,0x0,0x20000000,0x0,0x2c8440ae,0x0,0x2c8440ae,0x0,0x2c8440ae,0x0,0x2c8440ae,0x0,0x8000000,0x4008c,0x6059c,0x2800,0x6059c,0xc,0x0,0x40080,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0000,0x0,0x200,0x0,0x4002,0x0,};
}
private static void jj_la1_init_3() {
jj_la1_3 = new int[] {0x8dea000,0x0,0x8dea000,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x8020000,0x8008000,0x800a000,0x0,0x0,0x1,0x8000000,0x4,0x0,0x2,0x2,0x8000000,0x0,0x2,0x2,0x2,0x8dea000,0x1000,0x800,0x3f8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x8dea004,0x8dea000,0x8de0000,0x8000,0x1,0x8dea000,0x1,0x8dea000,0x1,0x8dea000,0x1,0x8dea000,0x2,0x8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x0,0x1,0x0,0x1,};
}
private static void jj_la1_init_4() {
jj_la1_4 = new int[] {0x60,0x0,0x60,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x60,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x60,0x40,0x0,0x0,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x60,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
}
final private JJCalls[] jj_2_rtns = new JJCalls[4];
private boolean jj_rescan = false;
private int jj_gc = 0;
/** Constructor with InputStream. */
public AQLParser(java.io.InputStream stream) {
this(stream, null);
}
/** Constructor with InputStream and supplied encoding */
public AQLParser(java.io.InputStream stream, String encoding) {
try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
token_source = new AQLParserTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 114; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
/** Reinitialise. */
public void ReInit(java.io.InputStream stream) {
ReInit(stream, null);
}
/** Reinitialise. */
public void ReInit(java.io.InputStream stream, String encoding) {
try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
token_source.ReInit(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 114; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
/** Constructor. */
public AQLParser(java.io.Reader stream) {
jj_input_stream = new JavaCharStream(stream, 1, 1);
token_source = new AQLParserTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 114; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
/** Reinitialise. */
public void ReInit(java.io.Reader stream) {
jj_input_stream.ReInit(stream, 1, 1);
token_source.ReInit(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 114; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
/** Constructor with generated Token Manager. */
public AQLParser(AQLParserTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 114; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
/** Reinitialise. */
public void ReInit(AQLParserTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 114; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
private Token jj_consume_token(int kind) throws ParseException {
Token oldToken;
if ((oldToken = token).next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
if (token.kind == kind) {
jj_gen++;
if (++jj_gc > 100) {
jj_gc = 0;
for (int i = 0; i < jj_2_rtns.length; i++) {
JJCalls c = jj_2_rtns[i];
while (c != null) {
if (c.gen < jj_gen) c.first = null;
c = c.next;
}
}
}
return token;
}
token = oldToken;
jj_kind = kind;
throw generateParseException();
}
static private final class LookaheadSuccess extends java.lang.Error { }
final private LookaheadSuccess jj_ls = new LookaheadSuccess();
private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpos = jj_scanpos.next;
}
if (jj_rescan) {
int i = 0; Token tok = token;
while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
if (tok != null) jj_add_error_token(kind, i);
}
if (jj_scanpos.kind != kind) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
return false;
}
/** Get the next Token. */
final public Token getNextToken() {
if (token.next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
jj_gen++;
return token;
}
/** Get the specific Token. */
final public Token getToken(int index) {
Token t = token;
for (int i = 0; i < index; i++) {
if (t.next != null) t = t.next;
else t = t.next = token_source.getNextToken();
}
return t;
}
private int jj_ntk() {
if ((jj_nt=token.next) == null)
return (jj_ntk = (token.next=token_source.getNextToken()).kind);
else
return (jj_ntk = jj_nt.kind);
}
private java.util.List jj_expentries = new java.util.ArrayList();
private int[] jj_expentry;
private int jj_kind = -1;
private int[] jj_lasttokens = new int[100];
private int jj_endpos;
private void jj_add_error_token(int kind, int pos) {
if (pos >= 100) return;
if (pos == jj_endpos + 1) {
jj_lasttokens[jj_endpos++] = kind;
} else if (jj_endpos != 0) {
jj_expentry = new int[jj_endpos];
for (int i = 0; i < jj_endpos; i++) {
jj_expentry[i] = jj_lasttokens[i];
}
jj_entries_loop: for (java.util.Iterator> it = jj_expentries.iterator(); it.hasNext();) {
int[] oldentry = (int[])(it.next());
if (oldentry.length == jj_expentry.length) {
for (int i = 0; i < jj_expentry.length; i++) {
if (oldentry[i] != jj_expentry[i]) {
continue jj_entries_loop;
}
}
jj_expentries.add(jj_expentry);
break jj_entries_loop;
}
}
if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
}
}
/** Generate ParseException. */
public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[146];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 114; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if ((jj_la1_0[i] & (1< jj_gen) {
jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
switch (i) {
case 0: jj_3_1(); break;
case 1: jj_3_2(); break;
case 2: jj_3_3(); break;
case 3: jj_3_4(); break;
}
}
p = p.next;
} while (p != null);
} catch(LookaheadSuccess ls) { }
}
jj_rescan = false;
}
private void jj_save(int index, int xla) {
JJCalls p = jj_2_rtns[index];
while (p.gen > jj_gen) {
if (p.next == null) { p = p.next = new JJCalls(); break; }
p = p.next;
}
p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
}
static final class JJCalls {
int gen;
Token first;
int arg;
JJCalls next;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy