m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/interpreter
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2019-11-17 11:29:05 +0100
committerMartin <marcin.j.chrzanowski@gmail.com>2019-11-17 11:28:25 +0100
commit42eef2f0804100728451afcc085f0940cbbc44c4 (patch)
treec4c6a95b4747fdba9bae07a74754812cb7ad67c8 /src/main/java/pl/edu/mimuw/cloudatlas/interpreter
parent7e205586a8351b27323b26c9c6499718283c1995 (diff)
Cleanup whitespace
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/interpreter')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Environment.java2
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/EnvironmentRow.java30
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/EnvironmentTable.java12
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Functions.java768
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InsideQueryException.java34
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InternalInterpreterException.java6
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Interpreter.java800
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InterpreterException.java6
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InvalidTypeException.java26
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Main.java388
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/NoSuchAttributeException.java16
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/QueryResult.java36
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Result.java460
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/ResultColumn.java124
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/ResultSingle.java138
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Table.java134
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/TableRow.java20
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/PrettyPrinter.java2
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/Yylex.java1404
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/parser.java366
20 files changed, 2386 insertions, 2386 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Environment.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Environment.java
index dd94631..d33280c 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Environment.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Environment.java
@@ -25,5 +25,5 @@
package pl.edu.mimuw.cloudatlas.interpreter;
abstract class Environment {
- abstract public Result getIdent(String ident);
+ abstract public Result getIdent(String ident);
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/EnvironmentRow.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/EnvironmentRow.java
index 76a9cf2..afed3d2 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/EnvironmentRow.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/EnvironmentRow.java
@@ -7,22 +7,22 @@ import java.util.Map;
import pl.edu.mimuw.cloudatlas.model.ValueNull;
class EnvironmentRow extends Environment {
- private final TableRow row;
- private final Map<String, Integer> columns = new HashMap<String, Integer>();
+ private final TableRow row;
+ private final Map<String, Integer> columns = new HashMap<String, Integer>();
- public EnvironmentRow(TableRow row, List<String> columns) {
- this.row = row;
- int i = 0;
- for(String c : columns)
- this.columns.put(c, i++);
- }
+ public EnvironmentRow(TableRow row, List<String> columns) {
+ this.row = row;
+ int i = 0;
+ for(String c : columns)
+ this.columns.put(c, i++);
+ }
- public Result getIdent(String ident) {
- try {
- return new ResultSingle(row.getIth(columns.get(ident)));
- } catch(NullPointerException exception) {
- return new ResultSingle(ValueNull.getInstance());
- }
- }
+ public Result getIdent(String ident) {
+ try {
+ return new ResultSingle(row.getIth(columns.get(ident)));
+ } catch(NullPointerException exception) {
+ return new ResultSingle(ValueNull.getInstance());
+ }
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/EnvironmentTable.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/EnvironmentTable.java
index bfaeb79..8d5c634 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/EnvironmentTable.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/EnvironmentTable.java
@@ -7,13 +7,13 @@ import java.util.Map;
import pl.edu.mimuw.cloudatlas.model.ValueNull;
class EnvironmentTable extends Environment {
- private final Table table;
+ private final Table table;
- public EnvironmentTable(Table table) {
- this.table = table;
- }
+ public EnvironmentTable(Table table) {
+ this.table = table;
+ }
- public Result getIdent(String ident) {
+ public Result getIdent(String ident) {
return new ResultColumn(table.getColumn(ident).getValue());
- }
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Functions.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Functions.java
index 2b44633..c8be260 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Functions.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Functions.java
@@ -48,415 +48,415 @@ import pl.edu.mimuw.cloudatlas.model.ValueSet;
import pl.edu.mimuw.cloudatlas.model.ValueTime;
class Functions {
- private static Functions instance = null;
+ private static Functions instance = null;
- private static final UnaryOperation ROUND = new UnaryOperation() {
- @Override
- public Value perform(Value v) {
- if(v.getType().isCompatible(TypePrimitive.DOUBLE)) {
- if(v.isNull())
- return new ValueDouble(null);
- return new ValueDouble((double)Math.round(((ValueDouble)v).getValue()));
- }
- throw new IllegalArgumentException("Value must have type " + TypePrimitive.DOUBLE + ".");
- }
- };
+ private static final UnaryOperation ROUND = new UnaryOperation() {
+ @Override
+ public Value perform(Value v) {
+ if(v.getType().isCompatible(TypePrimitive.DOUBLE)) {
+ if(v.isNull())
+ return new ValueDouble(null);
+ return new ValueDouble((double)Math.round(((ValueDouble)v).getValue()));
+ }
+ throw new IllegalArgumentException("Value must have type " + TypePrimitive.DOUBLE + ".");
+ }
+ };
- private static final UnaryOperation FLOOR = new UnaryOperation() {
- @Override
- public Value perform(Value v) {
- if(v.getType().isCompatible(TypePrimitive.DOUBLE)) {
- if(v.isNull())
- return new ValueDouble(null);
- return new ValueDouble((double)Math.floor(((ValueDouble)v).getValue()));
- }
- throw new IllegalArgumentException("Value must have type " + TypePrimitive.DOUBLE + ".");
- }
- };
+ private static final UnaryOperation FLOOR = new UnaryOperation() {
+ @Override
+ public Value perform(Value v) {
+ if(v.getType().isCompatible(TypePrimitive.DOUBLE)) {
+ if(v.isNull())
+ return new ValueDouble(null);
+ return new ValueDouble((double)Math.floor(((ValueDouble)v).getValue()));
+ }
+ throw new IllegalArgumentException("Value must have type " + TypePrimitive.DOUBLE + ".");
+ }
+ };
- private static final UnaryOperation CEIL = new UnaryOperation() {
- @Override
- public Value perform(Value v) {
- if(v.getType().isCompatible(TypePrimitive.DOUBLE)) {
- if(v.isNull())
- return new ValueDouble(null);
- return new ValueDouble((double)Math.ceil(((ValueDouble)v).getValue()));
- }
- throw new IllegalArgumentException("Value must have type " + TypePrimitive.DOUBLE + ".");
- }
- };
+ private static final UnaryOperation CEIL = new UnaryOperation() {
+ @Override
+ public Value perform(Value v) {
+ if(v.getType().isCompatible(TypePrimitive.DOUBLE)) {
+ if(v.isNull())
+ return new ValueDouble(null);
+ return new ValueDouble((double)Math.ceil(((ValueDouble)v).getValue()));
+ }
+ throw new IllegalArgumentException("Value must have type " + TypePrimitive.DOUBLE + ".");
+ }
+ };
- private static final AggregationOperation COUNT = new AggregationOperation() {
- @Override
- public ValueInt perform(ValueList values) {
- ValueList nlist = Result.filterNullsList(values);
- if(nlist.getValue() == null) {
- return new ValueInt(null);
- }
- return new ValueInt((long)nlist.size());
- }
- };
+ private static final AggregationOperation COUNT = new AggregationOperation() {
+ @Override
+ public ValueInt perform(ValueList values) {
+ ValueList nlist = Result.filterNullsList(values);
+ if(nlist.getValue() == null) {
+ return new ValueInt(null);
+ }
+ return new ValueInt((long)nlist.size());
+ }
+ };
- private static final AggregationOperation SUM = new AggregationOperation() {
- @Override
- public Value perform(ValueList values) {
- Type elementType = ((TypeCollection)values.getType()).getElementType();
- PrimaryType primaryType = elementType.getPrimaryType();
+ private static final AggregationOperation SUM = new AggregationOperation() {
+ @Override
+ public Value perform(ValueList values) {
+ Type elementType = ((TypeCollection)values.getType()).getElementType();
+ PrimaryType primaryType = elementType.getPrimaryType();
- if(primaryType != PrimaryType.INT && primaryType != PrimaryType.DOUBLE && primaryType != PrimaryType.DURATION
- && primaryType != PrimaryType.NULL) {
- throw new IllegalArgumentException("Aggregation doesn't support type: " + elementType + ".");
- }
+ if(primaryType != PrimaryType.INT && primaryType != PrimaryType.DOUBLE && primaryType != PrimaryType.DURATION
+ && primaryType != PrimaryType.NULL) {
+ throw new IllegalArgumentException("Aggregation doesn't support type: " + elementType + ".");
+ }
- ValueList nlist = Result.filterNullsList(values);
- if(nlist.getValue() == null || nlist.isEmpty()) {
- return ValueNull.getInstance();
- }
+ ValueList nlist = Result.filterNullsList(values);
+ if(nlist.getValue() == null || nlist.isEmpty()) {
+ return ValueNull.getInstance();
+ }
- Value result = nlist.get(0).getDefaultValue();
+ Value result = nlist.get(0).getDefaultValue();
- for(Value v : nlist) {
- result = result.addValue(v);
- }
+ for(Value v : nlist) {
+ result = result.addValue(v);
+ }
return result;
- }
- };
+ }
+ };
- private static final AggregationOperation AVERAGE = new AggregationOperation() {
- @Override
- public Value perform(ValueList values) {
- Type elementType = ((TypeCollection)values.getType()).getElementType();
- PrimaryType primaryType = elementType.getPrimaryType();
+ private static final AggregationOperation AVERAGE = new AggregationOperation() {
+ @Override
+ public Value perform(ValueList values) {
+ Type elementType = ((TypeCollection)values.getType()).getElementType();
+ PrimaryType primaryType = elementType.getPrimaryType();
- if(primaryType != PrimaryType.INT && primaryType != PrimaryType.DOUBLE && primaryType != PrimaryType.DURATION
- && primaryType != PrimaryType.NULL) {
- throw new IllegalArgumentException("Aggregation doesn't support type: " + elementType + ".");
- }
+ if(primaryType != PrimaryType.INT && primaryType != PrimaryType.DOUBLE && primaryType != PrimaryType.DURATION
+ && primaryType != PrimaryType.NULL) {
+ throw new IllegalArgumentException("Aggregation doesn't support type: " + elementType + ".");
+ }
- ValueList nlist = Result.filterNullsList(values);
- if(nlist.getValue() == null || nlist.isEmpty()) {
- return ValueNull.getInstance();
- }
+ ValueList nlist = Result.filterNullsList(values);
+ if(nlist.getValue() == null || nlist.isEmpty()) {
+ return ValueNull.getInstance();
+ }
- Value result = nlist.get(0).getDefaultValue();
+ Value result = nlist.get(0).getDefaultValue();
- for(Value v : nlist) {
- result = result.addValue(v);
- }
- Value size = primaryType == PrimaryType.DOUBLE? new ValueDouble((double)nlist.size()) : new ValueInt(
- (long)nlist.size());
- return result.divide(size);
- }
- };
+ for(Value v : nlist) {
+ result = result.addValue(v);
+ }
+ Value size = primaryType == PrimaryType.DOUBLE? new ValueDouble((double)nlist.size()) : new ValueInt(
+ (long)nlist.size());
+ return result.divide(size);
+ }
+ };
- private static final AggregationOperation AND = new AggregationOperation() {
- @Override
- public ValueBoolean perform(ValueList values) { // lazy
- ValueList nlist = Result.filterNullsList(values);
- if(nlist.getValue() == null) {
- return new ValueBoolean(null);
- } else if(values.isEmpty()) {
- return new ValueBoolean(true);
- }
- for(Value v : nlist) {
- if(v.getType().isCompatible(TypePrimitive.BOOLEAN)) {
- if(v.isNull() || !((ValueBoolean)v).getValue())
- return new ValueBoolean(false);
- } else
- throw new IllegalArgumentException("Aggregation doesn't support type: " + v.getType() + ".");
- }
- return new ValueBoolean(true);
- }
- };
+ private static final AggregationOperation AND = new AggregationOperation() {
+ @Override
+ public ValueBoolean perform(ValueList values) { // lazy
+ ValueList nlist = Result.filterNullsList(values);
+ if(nlist.getValue() == null) {
+ return new ValueBoolean(null);
+ } else if(values.isEmpty()) {
+ return new ValueBoolean(true);
+ }
+ for(Value v : nlist) {
+ if(v.getType().isCompatible(TypePrimitive.BOOLEAN)) {
+ if(v.isNull() || !((ValueBoolean)v).getValue())
+ return new ValueBoolean(false);
+ } else
+ throw new IllegalArgumentException("Aggregation doesn't support type: " + v.getType() + ".");
+ }
+ return new ValueBoolean(true);
+ }
+ };
- private static final AggregationOperation OR = new AggregationOperation() {
- @Override
- public ValueBoolean perform(ValueList values) { // lazy
- ValueList nlist = Result.filterNullsList(values);
- if(nlist.getValue() == null) {
- return new ValueBoolean(null);
- } else if(values.isEmpty()) {
- return new ValueBoolean(false);
- }
- for(Value v : nlist) {
- if(v.getType().isCompatible(TypePrimitive.BOOLEAN)) {
- if(v.isNull() || ((ValueBoolean)v).getValue())
- return new ValueBoolean(true);
- } else
- throw new IllegalArgumentException("Aggregation doesn't support type: " + v.getType() + ".");
- }
- return new ValueBoolean(false);
- }
- };
+ private static final AggregationOperation OR = new AggregationOperation() {
+ @Override
+ public ValueBoolean perform(ValueList values) { // lazy
+ ValueList nlist = Result.filterNullsList(values);
+ if(nlist.getValue() == null) {
+ return new ValueBoolean(null);
+ } else if(values.isEmpty()) {
+ return new ValueBoolean(false);
+ }
+ for(Value v : nlist) {
+ if(v.getType().isCompatible(TypePrimitive.BOOLEAN)) {
+ if(v.isNull() || ((ValueBoolean)v).getValue())
+ return new ValueBoolean(true);
+ } else
+ throw new IllegalArgumentException("Aggregation doesn't support type: " + v.getType() + ".");
+ }
+ return new ValueBoolean(false);
+ }
+ };
- private static final AggregationOperation MIN = new AggregationOperation() {
- @Override
- public Value perform(ValueList values) {
- ValueList nlist = Result.filterNullsList(values);
- if(nlist.getValue() == null || nlist.isEmpty()) {
- return ValueNull.getInstance();
- }
- Value result = nlist.get(0);
- for(Value v : nlist) {
- if(((ValueBoolean)v.isLowerThan(result)).getValue()) {
- result = v;
- }
- }
- return result;
- }
- };
+ private static final AggregationOperation MIN = new AggregationOperation() {
+ @Override
+ public Value perform(ValueList values) {
+ ValueList nlist = Result.filterNullsList(values);
+ if(nlist.getValue() == null || nlist.isEmpty()) {
+ return ValueNull.getInstance();
+ }
+ Value result = nlist.get(0);
+ for(Value v : nlist) {
+ if(((ValueBoolean)v.isLowerThan(result)).getValue()) {
+ result = v;
+ }
+ }
+ return result;
+ }
+ };
- private static final AggregationOperation MAX = new AggregationOperation() {
- @Override
- public Value perform(ValueList values) {
- ValueList nlist = Result.filterNullsList(values);
- if(nlist.getValue() == null || nlist.isEmpty()) {
- return ValueNull.getInstance();
- }
- Value result = nlist.get(0);
- for(Value v : nlist) {
- if(((ValueBoolean)v.isLowerThan(result)).negate().and(v.isEqual(result).negate()).getValue()) {
- result = v;
- }
- }
- return result;
- }
- };
+ private static final AggregationOperation MAX = new AggregationOperation() {
+ @Override
+ public Value perform(ValueList values) {
+ ValueList nlist = Result.filterNullsList(values);
+ if(nlist.getValue() == null || nlist.isEmpty()) {
+ return ValueNull.getInstance();
+ }
+ Value result = nlist.get(0);
+ for(Value v : nlist) {
+ if(((ValueBoolean)v.isLowerThan(result)).negate().and(v.isEqual(result).negate()).getValue()) {
+ result = v;
+ }
+ }
+ return result;
+ }
+ };
- private static final TransformOperation UNFOLD = new TransformOperation() {
- @Override
- public ValueList perform(ValueList values) {
- if(!((TypeCollection)values.getType()).getElementType().isCollection()) {
- throw new IllegalArgumentException("All elements must have a collection compatible type.");
- }
- ValueList nlist = Result.filterNullsList(values);
- if(nlist.getValue() == null) {
- return new ValueList(null,
- ((TypeCollection)((TypeCollection)values.getType()).getElementType()).getElementType());
- } else if(nlist.isEmpty()) {
- return new ValueList(
- ((TypeCollection)((TypeCollection)values.getType()).getElementType()).getElementType());
- }
- List<Value> ret = new ArrayList<Value>();
- for(Value v : nlist) {
- if(v.getType().getPrimaryType() == Type.PrimaryType.SET) {
- ret.addAll((ValueSet)v);
- } else if(v.getType().getPrimaryType() == Type.PrimaryType.LIST) {
- ret.addAll((ValueList)v);
- }
- }
- return new ValueList(ret,
- ((TypeCollection)((TypeCollection)values.getType()).getElementType()).getElementType());
- }
- };
+ private static final TransformOperation UNFOLD = new TransformOperation() {
+ @Override
+ public ValueList perform(ValueList values) {
+ if(!((TypeCollection)values.getType()).getElementType().isCollection()) {
+ throw new IllegalArgumentException("All elements must have a collection compatible type.");
+ }
+ ValueList nlist = Result.filterNullsList(values);
+ if(nlist.getValue() == null) {
+ return new ValueList(null,
+ ((TypeCollection)((TypeCollection)values.getType()).getElementType()).getElementType());
+ } else if(nlist.isEmpty()) {
+ return new ValueList(
+ ((TypeCollection)((TypeCollection)values.getType()).getElementType()).getElementType());
+ }
+ List<Value> ret = new ArrayList<Value>();
+ for(Value v : nlist) {
+ if(v.getType().getPrimaryType() == Type.PrimaryType.SET) {
+ ret.addAll((ValueSet)v);
+ } else if(v.getType().getPrimaryType() == Type.PrimaryType.LIST) {
+ ret.addAll((ValueList)v);
+ }
+ }
+ return new ValueList(ret,
+ ((TypeCollection)((TypeCollection)values.getType()).getElementType()).getElementType());
+ }
+ };
- private static final TransformOperation DISTINCT = new TransformOperation() {
- @Override
- public ValueList perform(ValueList values) {
- if(values.isEmpty())
- return new ValueList(((TypeCollection)values.getType()).getElementType());
- List<Value> ret = new ArrayList<Value>();
- for(Value v : values) {
- if(!ret.contains(v)) {
- ret.add(v);
- }
- }
- return new ValueList(ret, ((TypeCollection)values.getType()).getElementType());
- }
- };
+ private static final TransformOperation DISTINCT = new TransformOperation() {
+ @Override
+ public ValueList perform(ValueList values) {
+ if(values.isEmpty())
+ return new ValueList(((TypeCollection)values.getType()).getElementType());
+ List<Value> ret = new ArrayList<Value>();
+ for(Value v : values) {
+ if(!ret.contains(v)) {
+ ret.add(v);
+ }
+ }
+ return new ValueList(ret, ((TypeCollection)values.getType()).getElementType());
+ }
+ };
- private static final TransformOperation SORT = new TransformOperation() {
- @Override
- public ValueList perform(ValueList values) {
- if(values.isEmpty())
- return new ValueList(((TypeCollection)values.getType()).getElementType());
- List<Value> ret = new ArrayList<Value>();
- ret.addAll(values);
- Collections.sort(ret, new Comparator<Value>() {
- public int compare(Value v1, Value v2) {
- if(((ValueBoolean)v1.isLowerThan(v2)).getValue()) {
- return -1;
- } else if(((ValueBoolean)v1.isEqual(v2)).getValue()) {
- return 0;
- } else {
- return 1;
- }
- }
- });
- return new ValueList(ret, ((TypeCollection)values.getType()).getElementType());
- }
- };
+ private static final TransformOperation SORT = new TransformOperation() {
+ @Override
+ public ValueList perform(ValueList values) {
+ if(values.isEmpty())
+ return new ValueList(((TypeCollection)values.getType()).getElementType());
+ List<Value> ret = new ArrayList<Value>();
+ ret.addAll(values);
+ Collections.sort(ret, new Comparator<Value>() {
+ public int compare(Value v1, Value v2) {
+ if(((ValueBoolean)v1.isLowerThan(v2)).getValue()) {
+ return -1;
+ } else if(((ValueBoolean)v1.isEqual(v2)).getValue()) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+ });
+ return new ValueList(ret, ((TypeCollection)values.getType()).getElementType());
+ }
+ };
- private final ValueTime EPOCH;
+ private final ValueTime EPOCH;
- private Functions() {
- try {
- EPOCH = new ValueTime("2000/01/01 00:00:00.000");
- } catch(ParseException exception) {
- throw new InternalInterpreterException("Cannot parse time when creating an EPOCH object.\n"
- + exception.getMessage());
- }
- }
+ private Functions() {
+ try {
+ EPOCH = new ValueTime("2000/01/01 00:00:00.000");
+ } catch(ParseException exception) {
+ throw new InternalInterpreterException("Cannot parse time when creating an EPOCH object.\n"
+ + exception.getMessage());
+ }
+ }
- public static Functions getInstance() {
- if(instance == null)
- instance = new Functions();
- return instance;
- }
+ public static Functions getInstance() {
+ if(instance == null)
+ instance = new Functions();
+ return instance;
+ }
- public Result evaluate(String name, List<Result> arguments) {
- switch(name) {
- case "round":
- if(arguments.size() == 1)
- return arguments.get(0).unaryOperation(ROUND);
- break;
- case "floor":
- if(arguments.size() == 1)
- return arguments.get(0).unaryOperation(FLOOR);
- break;
- case "ceil":
- if(arguments.size() == 1)
- return arguments.get(0).unaryOperation(CEIL);
- break;
- case "now":
- if(arguments.size() == 0)
- return new ResultSingle(new ValueTime(Calendar.getInstance().getTimeInMillis()));
- break;
- case "epoch":
- if(arguments.size() == 0)
- return new ResultSingle(EPOCH);
- break;
- case "count":
- if(arguments.size() == 1)
- return arguments.get(0).aggregationOperation(COUNT);
- break;
- case "size":
- if(arguments.size() == 1)
- return arguments.get(0).valueSize();
- break;
- case "sum":
- if(arguments.size() == 1)
- return arguments.get(0).aggregationOperation(SUM);
- break;
- case "avg":
- if(arguments.size() == 1)
- return arguments.get(0).aggregationOperation(AVERAGE);
- break;
- case "land":
- if(arguments.size() == 1)
- return arguments.get(0).aggregationOperation(AND);
- break;
- case "lor":
- if(arguments.size() == 1)
- return arguments.get(0).aggregationOperation(OR);
- break;
- case "min":
- if(arguments.size() == 1)
- return arguments.get(0).aggregationOperation(MIN);
- break;
- case "max":
- if(arguments.size() == 1)
- return arguments.get(0).aggregationOperation(MAX);
- break;
- case "unfold":
- if(arguments.size() == 1)
- return arguments.get(0).transformOperation(UNFOLD);
- break;
- case "distinct":
- if(arguments.size() == 1)
- return arguments.get(0).transformOperation(DISTINCT);
- break;
- case "sort":
- if(arguments.size() == 1)
- return arguments.get(0).transformOperation(SORT);
- break;
- case "filterNulls":
- if(arguments.size() == 1)
- return arguments.get(0).filterNulls();
- break;
- case "first":
- if(arguments.size() == 2) {
- Value size = arguments.get(0).getValue();
- if(size.getType().isCompatible(TypePrimitive.INTEGER) && ((ValueInt)size).getValue().intValue() >= 0)
- return arguments.get(1).first(((ValueInt)size).getValue().intValue());
- throw new IllegalArgumentException("First argument must have type " + TypePrimitive.INTEGER
- + " and be >= 0.");
- }
- break;
- case "last":
- if(arguments.size() == 2) {
- Value size = arguments.get(0).getValue();
- if(size.getType().isCompatible(TypePrimitive.INTEGER) && ((ValueInt)size).getValue().intValue() >= 0)
- return arguments.get(1).last(((ValueInt)size).getValue().intValue());
- throw new IllegalArgumentException("First argument must have type " + TypePrimitive.INTEGER
- + " and be >= 0.");
- }
- break;
- case "random":
- if(arguments.size() == 2) {
- Value size = arguments.get(0).getValue();
- if(size.getType().isCompatible(TypePrimitive.INTEGER) && ((ValueInt)size).getValue().intValue() >= 0)
- return arguments.get(1).random(((ValueInt)size).getValue().intValue());
- throw new IllegalArgumentException("First argument must have type " + TypePrimitive.INTEGER
- + " and be >= 0.");
- }
- break;
- case "to_boolean":
- if(arguments.size() == 1)
- return arguments.get(0).convertTo(TypePrimitive.BOOLEAN);
- break;
- case "to_contact":
- if(arguments.size() == 1)
- return arguments.get(0).convertTo(TypePrimitive.CONTACT);
- break;
- case "to_double":
- if(arguments.size() == 1)
- return arguments.get(0).convertTo(TypePrimitive.DOUBLE);
- break;
- case "to_duration":
- if(arguments.size() == 1)
- return arguments.get(0).convertTo(TypePrimitive.DURATION);
- break;
- case "to_integer":
- if(arguments.size() == 1)
- return arguments.get(0).convertTo(TypePrimitive.INTEGER);
- break;
- case "to_string":
- if(arguments.size() == 1)
- return arguments.get(0).convertTo(TypePrimitive.STRING);
- break;
- case "to_time":
- if(arguments.size() == 1)
- return arguments.get(0).convertTo(TypePrimitive.TIME);
- break;
- case "to_set":
- if(arguments.size() == 1) {
- Type t = arguments.get(0).getType();
- if(t.isCollection()) {
- Type elementType = ((TypeCollection)t).getElementType();
- return arguments.get(0).convertTo(new TypeCollection(Type.PrimaryType.SET, elementType));
- }
- throw new IllegalArgumentException("First argument must be a collection.");
- }
- break;
- case "to_list":
- if(arguments.size() == 1) {
- Type t = arguments.get(0).getType();
- if(t.isCollection()) {
- Type elementType = ((TypeCollection)t).getElementType();
- return arguments.get(0).convertTo(new TypeCollection(Type.PrimaryType.LIST, elementType));
- }
- throw new IllegalArgumentException("First argument must be a collection.");
- }
- break;
- case "isNull":
- if(arguments.size() == 1)
- return arguments.get(0).isNull();
- break;
- default:
- throw new IllegalArgumentException("Illegal function name.");
- }
- throw new IllegalArgumentException("Illegal number of arguments.");
- }
+ public Result evaluate(String name, List<Result> arguments) {
+ switch(name) {
+ case "round":
+ if(arguments.size() == 1)
+ return arguments.get(0).unaryOperation(ROUND);
+ break;
+ case "floor":
+ if(arguments.size() == 1)
+ return arguments.get(0).unaryOperation(FLOOR);
+ break;
+ case "ceil":
+ if(arguments.size() == 1)
+ return arguments.get(0).unaryOperation(CEIL);
+ break;
+ case "now":
+ if(arguments.size() == 0)
+ return new ResultSingle(new ValueTime(Calendar.getInstance().getTimeInMillis()));
+ break;
+ case "epoch":
+ if(arguments.size() == 0)
+ return new ResultSingle(EPOCH);
+ break;
+ case "count":
+ if(arguments.size() == 1)
+ return arguments.get(0).aggregationOperation(COUNT);
+ break;
+ case "size":
+ if(arguments.size() == 1)
+ return arguments.get(0).valueSize();
+ break;
+ case "sum":
+ if(arguments.size() == 1)
+ return arguments.get(0).aggregationOperation(SUM);
+ break;
+ case "avg":
+ if(arguments.size() == 1)
+ return arguments.get(0).aggregationOperation(AVERAGE);
+ break;
+ case "land":
+ if(arguments.size() == 1)
+ return arguments.get(0).aggregationOperation(AND);
+ break;
+ case "lor":
+ if(arguments.size() == 1)
+ return arguments.get(0).aggregationOperation(OR);
+ break;
+ case "min":
+ if(arguments.size() == 1)
+ return arguments.get(0).aggregationOperation(MIN);
+ break;
+ case "max":
+ if(arguments.size() == 1)
+ return arguments.get(0).aggregationOperation(MAX);
+ break;
+ case "unfold":
+ if(arguments.size() == 1)
+ return arguments.get(0).transformOperation(UNFOLD);
+ break;
+ case "distinct":
+ if(arguments.size() == 1)
+ return arguments.get(0).transformOperation(DISTINCT);
+ break;
+ case "sort":
+ if(arguments.size() == 1)
+ return arguments.get(0).transformOperation(SORT);
+ break;
+ case "filterNulls":
+ if(arguments.size() == 1)
+ return arguments.get(0).filterNulls();
+ break;
+ case "first":
+ if(arguments.size() == 2) {
+ Value size = arguments.get(0).getValue();
+ if(size.getType().isCompatible(TypePrimitive.INTEGER) && ((ValueInt)size).getValue().intValue() >= 0)
+ return arguments.get(1).first(((ValueInt)size).getValue().intValue());
+ throw new IllegalArgumentException("First argument must have type " + TypePrimitive.INTEGER
+ + " and be >= 0.");
+ }
+ break;
+ case "last":
+ if(arguments.size() == 2) {
+ Value size = arguments.get(0).getValue();
+ if(size.getType().isCompatible(TypePrimitive.INTEGER) && ((ValueInt)size).getValue().intValue() >= 0)
+ return arguments.get(1).last(((ValueInt)size).getValue().intValue());
+ throw new IllegalArgumentException("First argument must have type " + TypePrimitive.INTEGER
+ + " and be >= 0.");
+ }
+ break;
+ case "random":
+ if(arguments.size() == 2) {
+ Value size = arguments.get(0).getValue();
+ if(size.getType().isCompatible(TypePrimitive.INTEGER) && ((ValueInt)size).getValue().intValue() >= 0)
+ return arguments.get(1).random(((ValueInt)size).getValue().intValue());
+ throw new IllegalArgumentException("First argument must have type " + TypePrimitive.INTEGER
+ + " and be >= 0.");
+ }
+ break;
+ case "to_boolean":
+ if(arguments.size() == 1)
+ return arguments.get(0).convertTo(TypePrimitive.BOOLEAN);
+ break;
+ case "to_contact":
+ if(arguments.size() == 1)
+ return arguments.get(0).convertTo(TypePrimitive.CONTACT);
+ break;
+ case "to_double":
+ if(arguments.size() == 1)
+ return arguments.get(0).convertTo(TypePrimitive.DOUBLE);
+ break;
+ case "to_duration":
+ if(arguments.size() == 1)
+ return arguments.get(0).convertTo(TypePrimitive.DURATION);
+ break;
+ case "to_integer":
+ if(arguments.size() == 1)
+ return arguments.get(0).convertTo(TypePrimitive.INTEGER);
+ break;
+ case "to_string":
+ if(arguments.size() == 1)
+ return arguments.get(0).convertTo(TypePrimitive.STRING);
+ break;
+ case "to_time":
+ if(arguments.size() == 1)
+ return arguments.get(0).convertTo(TypePrimitive.TIME);
+ break;
+ case "to_set":
+ if(arguments.size() == 1) {
+ Type t = arguments.get(0).getType();
+ if(t.isCollection()) {
+ Type elementType = ((TypeCollection)t).getElementType();
+ return arguments.get(0).convertTo(new TypeCollection(Type.PrimaryType.SET, elementType));
+ }
+ throw new IllegalArgumentException("First argument must be a collection.");
+ }
+ break;
+ case "to_list":
+ if(arguments.size() == 1) {
+ Type t = arguments.get(0).getType();
+ if(t.isCollection()) {
+ Type elementType = ((TypeCollection)t).getElementType();
+ return arguments.get(0).convertTo(new TypeCollection(Type.PrimaryType.LIST, elementType));
+ }
+ throw new IllegalArgumentException("First argument must be a collection.");
+ }
+ break;
+ case "isNull":
+ if(arguments.size() == 1)
+ return arguments.get(0).isNull();
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal function name.");
+ }
+ throw new IllegalArgumentException("Illegal number of arguments.");
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InsideQueryException.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InsideQueryException.java
index d591c35..c5bb6c7 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InsideQueryException.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InsideQueryException.java
@@ -26,25 +26,25 @@ package pl.edu.mimuw.cloudatlas.interpreter;
@SuppressWarnings("serial")
public class InsideQueryException extends InterpreterException {
- private final String fragment;
- private final Exception exception;
+ private final String fragment;
+ private final Exception exception;
- protected InsideQueryException(String fragment, Exception exception) {
- super(exception.getMessage() + "\nin: " + fragment);
- this.fragment = fragment;
- this.exception = exception;
- }
+ protected InsideQueryException(String fragment, Exception exception) {
+ super(exception.getMessage() + "\nin: " + fragment);
+ this.fragment = fragment;
+ this.exception = exception;
+ }
- public String getFragment() {
- return fragment;
- }
+ public String getFragment() {
+ return fragment;
+ }
- public Exception getException() {
- return exception;
- }
+ public Exception getException() {
+ return exception;
+ }
- @Override
- public StackTraceElement[] getStackTrace() {
- return exception.getStackTrace();
- }
+ @Override
+ public StackTraceElement[] getStackTrace() {
+ return exception.getStackTrace();
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InternalInterpreterException.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InternalInterpreterException.java
index 8010df2..d30aba0 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InternalInterpreterException.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InternalInterpreterException.java
@@ -26,7 +26,7 @@ package pl.edu.mimuw.cloudatlas.interpreter;
@SuppressWarnings("serial")
public class InternalInterpreterException extends InterpreterException {
- protected InternalInterpreterException(String message) {
- super(message);
- }
+ protected InternalInterpreterException(String message) {
+ super(message);
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Interpreter.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Interpreter.java
index 4241ce2..289f99d 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Interpreter.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Interpreter.java
@@ -93,409 +93,409 @@ import pl.edu.mimuw.cloudatlas.model.ValueString;
import pl.edu.mimuw.cloudatlas.model.ZMI;
public class Interpreter {
- private static class ValuesPair {
- public final Result left;
- public final Result right;
-
- public ValuesPair(Result left, Result right) {
- this.left = left;
- this.right = right;
- }
- }
-
- private final ZMI zmi;
-
- public Interpreter(ZMI zmi) {
- this.zmi = zmi;
- }
-
- private static Boolean getBoolean(Value value) {
- if(value.getType().isCompatible(TypePrimitive.BOOLEAN)) {
- Boolean b = ((ValueBoolean)value).getValue();
- return b == null? false : b.booleanValue();
- }
- throw new InvalidTypeException(TypePrimitive.BOOLEAN, value.getType());
- }
-
- public List<QueryResult> interpretProgram(Program program) {
- return program.accept(new ProgramInterpreter(), zmi);
- }
-
- public List<QueryResult> interpretStatement(Statement statement) {
- return statement.accept(new StatementInterpreter(), zmi);
- }
-
- public class ProgramInterpreter implements Program.Visitor<List<QueryResult>, ZMI> {
- public List<QueryResult> visit(ProgramC program, ZMI zmi) {
- List<QueryResult> results = new ArrayList<QueryResult>();
- for(Statement s : program.liststatement_) {
- try {
- List<QueryResult> l = s.accept(new StatementInterpreter(), zmi);
- for(QueryResult qr : l)
- if(qr.getName() == null)
- throw new IllegalArgumentException("All items in top-level SELECT must be aliased.");
- results.addAll(l);
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(s), exception);
- }
- }
- return results;
- }
- }
-
- public class StatementInterpreter implements Statement.Visitor<List<QueryResult>, ZMI> {
- public List<QueryResult> visit(StatementC statement, ZMI zmi) {
- Table table = new Table(zmi);
- try {
- table = statement.where_.accept(new WhereInterpreter(), table);
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(statement.where_), exception);
- }
- try {
- table = statement.orderby_.accept(new OrderByInterpreter(), table);
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(statement.orderby_), exception);
- }
- List<QueryResult> ret = new ArrayList<QueryResult>();
-
- for(SelItem selItem : statement.listselitem_) {
- try {
- QueryResult qr = selItem.accept(new SelItemInterpreter(), table);
- if(qr.getName() != null) {
- for(QueryResult qrRet : ret)
- if(qr.getName().getName().equals(qrRet.getName().getName()))
- throw new IllegalArgumentException("Alias collision.");
- }
- ret.add(qr);
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(selItem), exception);
- }
- }
-
- return ret;
- }
- }
-
- public class WhereInterpreter implements Where.Visitor<Table, Table> {
- public Table visit(NoWhereC where, Table table) {
- return table;
- }
-
- public Table visit(WhereC where, Table table) {
- Table result = new Table(table);
- for(TableRow row : table) {
- Environment env = new EnvironmentRow(row, table.getColumns());
- Value value = where.condexpr_.accept(new CondExprInterpreter(), env).getValue();
- if(getBoolean(value))
- result.appendRow(row);
- }
- return result;
- }
- }
-
- public class OrderByInterpreter implements OrderBy.Visitor<Table, Table> {
- public Table visit(NoOrderByC orderBy, Table table) {
- return table;
- }
-
- public Table visit(OrderByC orderBy, Table table) {
- for(OrderItem item : orderBy.listorderitem_) {
- try {
- table = item.accept(new OrderItemInterpreter(), table);
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(item), exception);
- }
- }
- return table;
- }
- }
-
- public class OrderItemInterpreter implements OrderItem.Visitor<Table, Table> {
- public Table visit(final OrderItemC orderItem, final Table table) {
- Comparator<TableRow> comparator = new Comparator<TableRow>() {
- @Override
- public int compare(TableRow row1, TableRow row2) {
- Environment env1 = new EnvironmentRow(row1, table.getColumns());
- Result expr1 = orderItem.condexpr_.accept(new CondExprInterpreter(), env1);
- Environment env2 = new EnvironmentRow(row2, table.getColumns());
- Result expr2 = orderItem.condexpr_.accept(new CondExprInterpreter(), env2);
- ValuesPair pair = new ValuesPair(expr1, expr2);
- int result = orderItem.nulls_.accept(new NullsInterpreter(), pair);
- if(result == 0)
- result = orderItem.order_.accept(new OrderInterpreter(), pair);
- return result;
- }
- };
- table.sort(comparator);
- return table;
- }
- }
-
- public class OrderInterpreter implements Order.Visitor<Integer, ValuesPair> {
- private int compareAsc(ValuesPair pair) {
- if(getBoolean(pair.left.isEqual(pair.right).getValue()))
- return 0;
- if(getBoolean(pair.left.isLowerThan(pair.right).getValue()))
- return -1;
- return 1;
- }
-
- public Integer visit(AscOrderC order, ValuesPair pair) {
- return compareAsc(pair);
- }
-
- public Integer visit(DescOrderC order, ValuesPair pair) {
- return -compareAsc(pair);
- }
-
- public Integer visit(NoOrderC order, ValuesPair pair) {
- return compareAsc(pair);
- }
- }
-
- public class NullsInterpreter implements Nulls.Visitor<Integer, ValuesPair> {
- private Integer nullsFirst(ValuesPair pair) {
- if(pair.left.getValue().isNull()) {
- if(pair.right.getValue().isNull())
- return 0;
- return -1;
- }
- if(pair.right.getValue().isNull())
- return 1;
- return 0;
- }
-
- public Integer visit(NoNullsC nulls, ValuesPair pair) {
- return nullsFirst(pair);
- }
-
- public Integer visit(NullFirstsC nulls, ValuesPair pair) {
- return nullsFirst(pair);
- }
-
- public Integer visit(NullsLastC nulls, ValuesPair pair) {
- return -nullsFirst(pair);
- }
- }
-
- public class SelItemInterpreter implements SelItem.Visitor<QueryResult, Table> {
- public QueryResult visit(SelItemC selItem, Table table) {
- Environment env = new EnvironmentTable(table);
- Result result = selItem.condexpr_.accept(new CondExprInterpreter(), env);
- return new QueryResult(result.getValue());
- }
-
- public QueryResult visit(AliasedSelItemC selItem, Table table) {
- Environment env = new EnvironmentTable(table);
- Result result = selItem.condexpr_.accept(new CondExprInterpreter(), env);
- return new QueryResult(new Attribute(selItem.qident_), result.getValue());
- }
- }
-
- public class BoolExprInterpreter implements BoolExpr.Visitor<Result, Environment> {
- public Result visit(BoolExprCmpC expr, Environment env) {
- try {
- Result left = expr.basicexpr_1.accept(new BasicExprInterpreter(), env);
- Result right = expr.basicexpr_2.accept(new BasicExprInterpreter(), env);
- return expr.relop_.accept(new RelOpInterpreter(), new ValuesPair(left, right));
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(expr), exception);
- }
- }
-
- public Result visit(BoolExprRegExpC expr, Environment env) {
- try {
- Result left = expr.basicexpr_.accept(new BasicExprInterpreter(), env);
- return (new ResultSingle(new ValueString(expr.string_))).regExpr(left);
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(expr), exception);
- }
- }
-
- public Result visit(BoolExprBasicExprC expr, Environment env) {
- return expr.basicexpr_.accept(new BasicExprInterpreter(), env);
- }
- }
-
- public class CondExprInterpreter implements CondExpr.Visitor<Result, Environment> {
- public Result visit(CondExprOrC expr, Environment env) {
- try {
- Result left = expr.condexpr_1.accept(new CondExprInterpreter(), env);
- Result right = expr.condexpr_2.accept(new CondExprInterpreter(), env);
- return left.or(right);
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(expr), exception);
- }
- }
-
- public Result visit(CondExprAndC expr, Environment env) {
- // TODO
- throw new UnsupportedOperationException("CondExprAndC Not yet implemented");
- }
-
- public Result visit(CondExprNotC expr, Environment env) {
- try {
- return expr.condexpr_.accept(new CondExprInterpreter(), env).negate();
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(expr), exception);
- }
- }
-
- public Result visit(CondExprBoolExprC expr, Environment env) {
- return expr.boolexpr_.accept(new BoolExprInterpreter(), env);
- }
- }
-
- public class BasicExprInterpreter implements BasicExpr.Visitor<Result, Environment> {
- public Result visit(BasicExprAddC expr, Environment env) {
- try {
- Result left = expr.basicexpr_1.accept(new BasicExprInterpreter(), env);
- Result right = expr.basicexpr_2.accept(new BasicExprInterpreter(), env);
- return left.addValue(right);
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(expr), exception);
- }
- }
-
- public Result visit(BasicExprSubC expr, Environment env) {
- try {
- Result left = expr.basicexpr_1.accept(new BasicExprInterpreter(), env);
- Result right = expr.basicexpr_2.accept(new BasicExprInterpreter(), env);
- return left.subtract(right);
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(expr), exception);
- }
- }
-
- public Result visit(BasicExprMulC expr, Environment env) {
- try {
- Result left = expr.basicexpr_1.accept(new BasicExprInterpreter(), env);
- Result right = expr.basicexpr_2.accept(new BasicExprInterpreter(), env);
- return left.multiply(right);
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(expr), exception);
- }
- }
-
- public Result visit(BasicExprDivC expr, Environment env) {
- try {
- Result left = expr.basicexpr_1.accept(new BasicExprInterpreter(), env);
- Result right = expr.basicexpr_2.accept(new BasicExprInterpreter(), env);
- return left.divide(right);
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(expr), exception);
- }
- }
-
- public Result visit(BasicExprModC expr, Environment env) {
- try {
- Result left = expr.basicexpr_1.accept(new BasicExprInterpreter(), env);
- Result right = expr.basicexpr_2.accept(new BasicExprInterpreter(), env);
- return left.modulo(right);
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(expr), exception);
- }
- }
-
- public Result visit(BasicExprNegC expr, Environment env) {
- try {
- return expr.basicexpr_.accept(new BasicExprInterpreter(), env).negate();
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(expr), exception);
- }
- }
-
- public Result visit(EIdentC expr, Environment env) {
- Result res = env.getIdent(expr.qident_);
+ private static class ValuesPair {
+ public final Result left;
+ public final Result right;
+
+ public ValuesPair(Result left, Result right) {
+ this.left = left;
+ this.right = right;
+ }
+ }
+
+ private final ZMI zmi;
+
+ public Interpreter(ZMI zmi) {
+ this.zmi = zmi;
+ }
+
+ private static Boolean getBoolean(Value value) {
+ if(value.getType().isCompatible(TypePrimitive.BOOLEAN)) {
+ Boolean b = ((ValueBoolean)value).getValue();
+ return b == null? false : b.booleanValue();
+ }
+ throw new InvalidTypeException(TypePrimitive.BOOLEAN, value.getType());
+ }
+
+ public List<QueryResult> interpretProgram(Program program) {
+ return program.accept(new ProgramInterpreter(), zmi);
+ }
+
+ public List<QueryResult> interpretStatement(Statement statement) {
+ return statement.accept(new StatementInterpreter(), zmi);
+ }
+
+ public class ProgramInterpreter implements Program.Visitor<List<QueryResult>, ZMI> {
+ public List<QueryResult> visit(ProgramC program, ZMI zmi) {
+ List<QueryResult> results = new ArrayList<QueryResult>();
+ for(Statement s : program.liststatement_) {
+ try {
+ List<QueryResult> l = s.accept(new StatementInterpreter(), zmi);
+ for(QueryResult qr : l)
+ if(qr.getName() == null)
+ throw new IllegalArgumentException("All items in top-level SELECT must be aliased.");
+ results.addAll(l);
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(s), exception);
+ }
+ }
+ return results;
+ }
+ }
+
+ public class StatementInterpreter implements Statement.Visitor<List<QueryResult>, ZMI> {
+ public List<QueryResult> visit(StatementC statement, ZMI zmi) {
+ Table table = new Table(zmi);
+ try {
+ table = statement.where_.accept(new WhereInterpreter(), table);
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(statement.where_), exception);
+ }
+ try {
+ table = statement.orderby_.accept(new OrderByInterpreter(), table);
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(statement.orderby_), exception);
+ }
+ List<QueryResult> ret = new ArrayList<QueryResult>();
+
+ for(SelItem selItem : statement.listselitem_) {
+ try {
+ QueryResult qr = selItem.accept(new SelItemInterpreter(), table);
+ if(qr.getName() != null) {
+ for(QueryResult qrRet : ret)
+ if(qr.getName().getName().equals(qrRet.getName().getName()))
+ throw new IllegalArgumentException("Alias collision.");
+ }
+ ret.add(qr);
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(selItem), exception);
+ }
+ }
+
+ return ret;
+ }
+ }
+
+ public class WhereInterpreter implements Where.Visitor<Table, Table> {
+ public Table visit(NoWhereC where, Table table) {
+ return table;
+ }
+
+ public Table visit(WhereC where, Table table) {
+ Table result = new Table(table);
+ for(TableRow row : table) {
+ Environment env = new EnvironmentRow(row, table.getColumns());
+ Value value = where.condexpr_.accept(new CondExprInterpreter(), env).getValue();
+ if(getBoolean(value))
+ result.appendRow(row);
+ }
+ return result;
+ }
+ }
+
+ public class OrderByInterpreter implements OrderBy.Visitor<Table, Table> {
+ public Table visit(NoOrderByC orderBy, Table table) {
+ return table;
+ }
+
+ public Table visit(OrderByC orderBy, Table table) {
+ for(OrderItem item : orderBy.listorderitem_) {
+ try {
+ table = item.accept(new OrderItemInterpreter(), table);
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(item), exception);
+ }
+ }
+ return table;
+ }
+ }
+
+ public class OrderItemInterpreter implements OrderItem.Visitor<Table, Table> {
+ public Table visit(final OrderItemC orderItem, final Table table) {
+ Comparator<TableRow> comparator = new Comparator<TableRow>() {
+ @Override
+ public int compare(TableRow row1, TableRow row2) {
+ Environment env1 = new EnvironmentRow(row1, table.getColumns());
+ Result expr1 = orderItem.condexpr_.accept(new CondExprInterpreter(), env1);
+ Environment env2 = new EnvironmentRow(row2, table.getColumns());
+ Result expr2 = orderItem.condexpr_.accept(new CondExprInterpreter(), env2);
+ ValuesPair pair = new ValuesPair(expr1, expr2);
+ int result = orderItem.nulls_.accept(new NullsInterpreter(), pair);
+ if(result == 0)
+ result = orderItem.order_.accept(new OrderInterpreter(), pair);
+ return result;
+ }
+ };
+ table.sort(comparator);
+ return table;
+ }
+ }
+
+ public class OrderInterpreter implements Order.Visitor<Integer, ValuesPair> {
+ private int compareAsc(ValuesPair pair) {
+ if(getBoolean(pair.left.isEqual(pair.right).getValue()))
+ return 0;
+ if(getBoolean(pair.left.isLowerThan(pair.right).getValue()))
+ return -1;
+ return 1;
+ }
+
+ public Integer visit(AscOrderC order, ValuesPair pair) {
+ return compareAsc(pair);
+ }
+
+ public Integer visit(DescOrderC order, ValuesPair pair) {
+ return -compareAsc(pair);
+ }
+
+ public Integer visit(NoOrderC order, ValuesPair pair) {
+ return compareAsc(pair);
+ }
+ }
+
+ public class NullsInterpreter implements Nulls.Visitor<Integer, ValuesPair> {
+ private Integer nullsFirst(ValuesPair pair) {
+ if(pair.left.getValue().isNull()) {
+ if(pair.right.getValue().isNull())
+ return 0;
+ return -1;
+ }
+ if(pair.right.getValue().isNull())
+ return 1;
+ return 0;
+ }
+
+ public Integer visit(NoNullsC nulls, ValuesPair pair) {
+ return nullsFirst(pair);
+ }
+
+ public Integer visit(NullFirstsC nulls, ValuesPair pair) {
+ return nullsFirst(pair);
+ }
+
+ public Integer visit(NullsLastC nulls, ValuesPair pair) {
+ return -nullsFirst(pair);
+ }
+ }
+
+ public class SelItemInterpreter implements SelItem.Visitor<QueryResult, Table> {
+ public QueryResult visit(SelItemC selItem, Table table) {
+ Environment env = new EnvironmentTable(table);
+ Result result = selItem.condexpr_.accept(new CondExprInterpreter(), env);
+ return new QueryResult(result.getValue());
+ }
+
+ public QueryResult visit(AliasedSelItemC selItem, Table table) {
+ Environment env = new EnvironmentTable(table);
+ Result result = selItem.condexpr_.accept(new CondExprInterpreter(), env);
+ return new QueryResult(new Attribute(selItem.qident_), result.getValue());
+ }
+ }
+
+ public class BoolExprInterpreter implements BoolExpr.Visitor<Result, Environment> {
+ public Result visit(BoolExprCmpC expr, Environment env) {
+ try {
+ Result left = expr.basicexpr_1.accept(new BasicExprInterpreter(), env);
+ Result right = expr.basicexpr_2.accept(new BasicExprInterpreter(), env);
+ return expr.relop_.accept(new RelOpInterpreter(), new ValuesPair(left, right));
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(expr), exception);
+ }
+ }
+
+ public Result visit(BoolExprRegExpC expr, Environment env) {
+ try {
+ Result left = expr.basicexpr_.accept(new BasicExprInterpreter(), env);
+ return (new ResultSingle(new ValueString(expr.string_))).regExpr(left);
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(expr), exception);
+ }
+ }
+
+ public Result visit(BoolExprBasicExprC expr, Environment env) {
+ return expr.basicexpr_.accept(new BasicExprInterpreter(), env);
+ }
+ }
+
+ public class CondExprInterpreter implements CondExpr.Visitor<Result, Environment> {
+ public Result visit(CondExprOrC expr, Environment env) {
+ try {
+ Result left = expr.condexpr_1.accept(new CondExprInterpreter(), env);
+ Result right = expr.condexpr_2.accept(new CondExprInterpreter(), env);
+ return left.or(right);
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(expr), exception);
+ }
+ }
+
+ public Result visit(CondExprAndC expr, Environment env) {
+ // TODO
+ throw new UnsupportedOperationException("CondExprAndC Not yet implemented");
+ }
+
+ public Result visit(CondExprNotC expr, Environment env) {
+ try {
+ return expr.condexpr_.accept(new CondExprInterpreter(), env).negate();
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(expr), exception);
+ }
+ }
+
+ public Result visit(CondExprBoolExprC expr, Environment env) {
+ return expr.boolexpr_.accept(new BoolExprInterpreter(), env);
+ }
+ }
+
+ public class BasicExprInterpreter implements BasicExpr.Visitor<Result, Environment> {
+ public Result visit(BasicExprAddC expr, Environment env) {
+ try {
+ Result left = expr.basicexpr_1.accept(new BasicExprInterpreter(), env);
+ Result right = expr.basicexpr_2.accept(new BasicExprInterpreter(), env);
+ return left.addValue(right);
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(expr), exception);
+ }
+ }
+
+ public Result visit(BasicExprSubC expr, Environment env) {
+ try {
+ Result left = expr.basicexpr_1.accept(new BasicExprInterpreter(), env);
+ Result right = expr.basicexpr_2.accept(new BasicExprInterpreter(), env);
+ return left.subtract(right);
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(expr), exception);
+ }
+ }
+
+ public Result visit(BasicExprMulC expr, Environment env) {
+ try {
+ Result left = expr.basicexpr_1.accept(new BasicExprInterpreter(), env);
+ Result right = expr.basicexpr_2.accept(new BasicExprInterpreter(), env);
+ return left.multiply(right);
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(expr), exception);
+ }
+ }
+
+ public Result visit(BasicExprDivC expr, Environment env) {
+ try {
+ Result left = expr.basicexpr_1.accept(new BasicExprInterpreter(), env);
+ Result right = expr.basicexpr_2.accept(new BasicExprInterpreter(), env);
+ return left.divide(right);
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(expr), exception);
+ }
+ }
+
+ public Result visit(BasicExprModC expr, Environment env) {
+ try {
+ Result left = expr.basicexpr_1.accept(new BasicExprInterpreter(), env);
+ Result right = expr.basicexpr_2.accept(new BasicExprInterpreter(), env);
+ return left.modulo(right);
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(expr), exception);
+ }
+ }
+
+ public Result visit(BasicExprNegC expr, Environment env) {
+ try {
+ return expr.basicexpr_.accept(new BasicExprInterpreter(), env).negate();
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(expr), exception);
+ }
+ }
+
+ public Result visit(EIdentC expr, Environment env) {
+ Result res = env.getIdent(expr.qident_);
return res;
- }
+ }
- public Result visit(EFunC expr, Environment env) {
- try {
- List<Result> arguments = new ArrayList<Result>(expr.listcondexpr_.size());
- for(CondExpr arg : expr.listcondexpr_) {
- arguments.add(arg.accept(new CondExprInterpreter(), env));
+ public Result visit(EFunC expr, Environment env) {
+ try {
+ List<Result> arguments = new ArrayList<Result>(expr.listcondexpr_.size());
+ for(CondExpr arg : expr.listcondexpr_) {
+ arguments.add(arg.accept(new CondExprInterpreter(), env));
}
- Result res = Functions.getInstance().evaluate(expr.qident_, arguments);
+ Result res = Functions.getInstance().evaluate(expr.qident_, arguments);
return res;
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(expr), exception);
- }
- }
-
- public ResultSingle visit(EStrC expr, Environment env) {
- return new ResultSingle(new ValueString(expr.string_));
- }
-
- public ResultSingle visit(EBoolC expr, Environment env) {
- ValueBoolean value;
- if(expr.qbool_.compareTo("true") == 0)
- value = new ValueBoolean(true);
- else if(expr.qbool_.compareTo("false") == 0)
- value = new ValueBoolean(false);
- else
- throw new InternalInterpreterException("Incorrect boolean constant: " + PrettyPrinter.print(expr));
- return new ResultSingle(value);
- }
-
- public ResultSingle visit(EIntC expr, Environment env) {
- try {
- return new ResultSingle(new ValueInt(Long.parseLong(expr.qinteger_)));
- } catch(NumberFormatException exception) {
- throw new InternalInterpreterException(exception.getMessage());
- }
- }
-
- public ResultSingle visit(EDblC expr, Environment env) {
- try {
- return new ResultSingle(new ValueDouble(Double.parseDouble(expr.qdouble_)));
- } catch(NumberFormatException exception) {
- throw new InternalInterpreterException(exception.getMessage());
- }
- }
-
- public Result visit(ECondExprC expr, Environment env) {
- return expr.condexpr_.accept(new CondExprInterpreter(), env);
- }
-
- public ResultSingle visit(EStmtC expr, Environment env) {
- try {
- List<QueryResult> l = expr.statement_.accept(new StatementInterpreter(), zmi);
- if(l.size() != 1)
- throw new IllegalArgumentException("Nested queries must SELECT exactly one item.");
- return new ResultSingle(l.get(0).getValue());
- } catch(Exception exception) {
- throw new InsideQueryException(PrettyPrinter.print(expr), exception);
- }
- }
- }
-
- public class RelOpInterpreter implements RelOp.Visitor<Result, ValuesPair> {
- public Result visit(RelOpGtC op, ValuesPair pair) {
- return pair.left.isLowerThan(pair.right).negate().and(pair.left.isEqual(pair.right).negate());
- }
-
- public Result visit(RelOpEqC op, ValuesPair pair) {
- // TODO
- throw new UnsupportedOperationException("RelOpEqC Not yet implemented");
- }
-
- public Result visit(RelOpNeC op, ValuesPair pair) {
- return pair.left.isEqual(pair.right).negate();
- }
-
- public Result visit(RelOpLtC op, ValuesPair pair) {
- return pair.left.isLowerThan(pair.right);
- }
-
- public Result visit(RelOpLeC op, ValuesPair pair) {
- // TODO
- throw new UnsupportedOperationException("RelOpLeC Not yet implemented");
- }
-
- public Result visit(RelOpGeC op, ValuesPair pair) {
- return pair.left.isLowerThan(pair.right).negate();
- }
- }
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(expr), exception);
+ }
+ }
+
+ public ResultSingle visit(EStrC expr, Environment env) {
+ return new ResultSingle(new ValueString(expr.string_));
+ }
+
+ public ResultSingle visit(EBoolC expr, Environment env) {
+ ValueBoolean value;
+ if(expr.qbool_.compareTo("true") == 0)
+ value = new ValueBoolean(true);
+ else if(expr.qbool_.compareTo("false") == 0)
+ value = new ValueBoolean(false);
+ else
+ throw new InternalInterpreterException("Incorrect boolean constant: " + PrettyPrinter.print(expr));
+ return new ResultSingle(value);
+ }
+
+ public ResultSingle visit(EIntC expr, Environment env) {
+ try {
+ return new ResultSingle(new ValueInt(Long.parseLong(expr.qinteger_)));
+ } catch(NumberFormatException exception) {
+ throw new InternalInterpreterException(exception.getMessage());
+ }
+ }
+
+ public ResultSingle visit(EDblC expr, Environment env) {
+ try {
+ return new ResultSingle(new ValueDouble(Double.parseDouble(expr.qdouble_)));
+ } catch(NumberFormatException exception) {
+ throw new InternalInterpreterException(exception.getMessage());
+ }
+ }
+
+ public Result visit(ECondExprC expr, Environment env) {
+ return expr.condexpr_.accept(new CondExprInterpreter(), env);
+ }
+
+ public ResultSingle visit(EStmtC expr, Environment env) {
+ try {
+ List<QueryResult> l = expr.statement_.accept(new StatementInterpreter(), zmi);
+ if(l.size() != 1)
+ throw new IllegalArgumentException("Nested queries must SELECT exactly one item.");
+ return new ResultSingle(l.get(0).getValue());
+ } catch(Exception exception) {
+ throw new InsideQueryException(PrettyPrinter.print(expr), exception);
+ }
+ }
+ }
+
+ public class RelOpInterpreter implements RelOp.Visitor<Result, ValuesPair> {
+ public Result visit(RelOpGtC op, ValuesPair pair) {
+ return pair.left.isLowerThan(pair.right).negate().and(pair.left.isEqual(pair.right).negate());
+ }
+
+ public Result visit(RelOpEqC op, ValuesPair pair) {
+ // TODO
+ throw new UnsupportedOperationException("RelOpEqC Not yet implemented");
+ }
+
+ public Result visit(RelOpNeC op, ValuesPair pair) {
+ return pair.left.isEqual(pair.right).negate();
+ }
+
+ public Result visit(RelOpLtC op, ValuesPair pair) {
+ return pair.left.isLowerThan(pair.right);
+ }
+
+ public Result visit(RelOpLeC op, ValuesPair pair) {
+ // TODO
+ throw new UnsupportedOperationException("RelOpLeC Not yet implemented");
+ }
+
+ public Result visit(RelOpGeC op, ValuesPair pair) {
+ return pair.left.isLowerThan(pair.right).negate();
+ }
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InterpreterException.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InterpreterException.java
index 5dbe921..5610251 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InterpreterException.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InterpreterException.java
@@ -26,7 +26,7 @@ package pl.edu.mimuw.cloudatlas.interpreter;
@SuppressWarnings("serial")
public abstract class InterpreterException extends RuntimeException {
- protected InterpreterException(String message) {
- super(message);
- }
+ protected InterpreterException(String message) {
+ super(message);
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InvalidTypeException.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InvalidTypeException.java
index 23a325f..ba79359 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InvalidTypeException.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/InvalidTypeException.java
@@ -28,20 +28,20 @@ import pl.edu.mimuw.cloudatlas.model.Type;
@SuppressWarnings("serial")
public class InvalidTypeException extends InterpreterException {
- private final Type expected;
- private final Type got;
+ private final Type expected;
+ private final Type got;
- protected InvalidTypeException(Type expected, Type got) {
- super("Invalid type. Expected " + expected + ", got " + got + ".");
- this.expected = expected;
- this.got = got;
- }
+ protected InvalidTypeException(Type expected, Type got) {
+ super("Invalid type. Expected " + expected + ", got " + got + ".");
+ this.expected = expected;
+ this.got = got;
+ }
- public Type getExpected() {
- return expected;
- }
+ public Type getExpected() {
+ return expected;
+ }
- public Type getGot() {
- return got;
- }
+ public Type getGot() {
+ return got;
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Main.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Main.java
index 76ea1e6..6e0d5fe 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Main.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Main.java
@@ -52,203 +52,203 @@ import pl.edu.mimuw.cloudatlas.model.ValueTime;
import pl.edu.mimuw.cloudatlas.model.ZMI;
public class Main {
- private static ZMI root;
-
- public static void main(String[] args) throws Exception {
+ private static ZMI root;
+
+ public static void main(String[] args) throws Exception {
runTest(System.in, System.out);
- }
+ }
public static void runTest(InputStream in, PrintStream out) throws Exception {
- root = createTestHierarchy();
- Scanner scanner = new Scanner(in);
- scanner.useDelimiter("\\n");
- while(scanner.hasNext()) {
- executeQueries(root, scanner.next(), out);
+ root = createTestHierarchy();
+ Scanner scanner = new Scanner(in);
+ scanner.useDelimiter("\\n");
+ while(scanner.hasNext()) {
+ executeQueries(root, scanner.next(), out);
}
- scanner.close();
+ scanner.close();
+ }
+
+ private static PathName getPathName(ZMI zmi) {
+ String name = ((ValueString)zmi.getAttributes().get("name")).getValue();
+ return zmi.getFather() == null? PathName.ROOT : getPathName(zmi.getFather()).levelDown(name);
+ }
+
+ private static void executeQueries(ZMI zmi, String query, PrintStream out) throws Exception {
+ if(!zmi.getSons().isEmpty()) {
+ for(ZMI son : zmi.getSons())
+ executeQueries(son, query, out);
+ Interpreter interpreter = new Interpreter(zmi);
+ Yylex lex = new Yylex(new ByteArrayInputStream(query.getBytes()));
+ try {
+ List<QueryResult> result = interpreter.interpretProgram((new parser(lex)).pProgram());
+ PathName zone = getPathName(zmi);
+ for(QueryResult r : result) {
+ out.println(zone + ": " + r);
+ zmi.getAttributes().addOrChange(r.getName(), r.getValue());
+ }
+ } catch(InterpreterException exception) {}
+ }
+ }
+
+ private static ValueContact createContact(String path, byte ip1, byte ip2, byte ip3, byte ip4)
+ throws UnknownHostException {
+ return new ValueContact(new PathName(path), InetAddress.getByAddress(new byte[] {
+ ip1, ip2, ip3, ip4
+ }));
+ }
+
+ private static ZMI createTestHierarchy() throws ParseException, UnknownHostException {
+ ValueContact violet07Contact = createContact("/uw/violet07", (byte)10, (byte)1, (byte)1, (byte)10);
+ ValueContact khaki13Contact = createContact("/uw/khaki13", (byte)10, (byte)1, (byte)1, (byte)38);
+ ValueContact khaki31Contact = createContact("/uw/khaki31", (byte)10, (byte)1, (byte)1, (byte)39);
+ ValueContact whatever01Contact = createContact("/uw/whatever01", (byte)82, (byte)111, (byte)52, (byte)56);
+ ValueContact whatever02Contact = createContact("/uw/whatever02", (byte)82, (byte)111, (byte)52, (byte)57);
+
+ List<Value> list;
+
+ root = new ZMI();
+ root.getAttributes().add("level", new ValueInt(0l));
+ root.getAttributes().add("name", new ValueString(null));
+ root.getAttributes().add("owner", new ValueString("/uw/violet07"));
+ root.getAttributes().add("timestamp", new ValueTime("2012/11/09 20:10:17.342"));
+ root.getAttributes().add("contacts", new ValueSet(TypePrimitive.CONTACT));
+ root.getAttributes().add("cardinality", new ValueInt(0l));
+
+ ZMI uw = new ZMI(root);
+ root.addSon(uw);
+ uw.getAttributes().add("level", new ValueInt(1l));
+ uw.getAttributes().add("name", new ValueString("uw"));
+ uw.getAttributes().add("owner", new ValueString("/uw/violet07"));
+ uw.getAttributes().add("timestamp", new ValueTime("2012/11/09 20:8:13.123"));
+ uw.getAttributes().add("contacts", new ValueSet(TypePrimitive.CONTACT));
+ uw.getAttributes().add("cardinality", new ValueInt(0l));
+
+ ZMI pjwstk = new ZMI(root);
+ root.addSon(pjwstk);
+ pjwstk.getAttributes().add("level", new ValueInt(1l));
+ pjwstk.getAttributes().add("name", new ValueString("pjwstk"));
+ pjwstk.getAttributes().add("owner", new ValueString("/pjwstk/whatever01"));
+ pjwstk.getAttributes().add("timestamp", new ValueTime("2012/11/09 20:8:13.123"));
+ pjwstk.getAttributes().add("contacts", new ValueSet(TypePrimitive.CONTACT));
+ pjwstk.getAttributes().add("cardinality", new ValueInt(0l));
+
+ ZMI violet07 = new ZMI(uw);
+ uw.addSon(violet07);
+ violet07.getAttributes().add("level", new ValueInt(2l));
+ violet07.getAttributes().add("name", new ValueString("violet07"));
+ violet07.getAttributes().add("owner", new ValueString("/uw/violet07"));
+ violet07.getAttributes().add("timestamp", new ValueTime("2012/11/09 18:00:00.000"));
+ list = Arrays.asList(new Value[] {
+ khaki31Contact, whatever01Contact
+ });
+ violet07.getAttributes().add("contacts", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
+ violet07.getAttributes().add("cardinality", new ValueInt(1l));
+ list = Arrays.asList(new Value[] {
+ violet07Contact,
+ });
+ violet07.getAttributes().add("members", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
+ violet07.getAttributes().add("creation", new ValueTime("2011/11/09 20:8:13.123"));
+ violet07.getAttributes().add("cpu_usage", new ValueDouble(0.9));
+ violet07.getAttributes().add("num_cores", new ValueInt(3l));
+ violet07.getAttributes().add("has_ups", new ValueBoolean(null));
+ list = Arrays.asList(new Value[] {
+ new ValueString("tola"), new ValueString("tosia"),
+ });
+ violet07.getAttributes().add("some_names", new ValueList(list, TypePrimitive.STRING));
+ violet07.getAttributes().add("expiry", new ValueDuration(13l, 12l, 0l, 0l, 0l));
+
+ ZMI khaki31 = new ZMI(uw);
+ uw.addSon(khaki31);
+ khaki31.getAttributes().add("level", new ValueInt(2l));
+ khaki31.getAttributes().add("name", new ValueString("khaki31"));
+ khaki31.getAttributes().add("owner", new ValueString("/uw/khaki31"));
+ khaki31.getAttributes().add("timestamp", new ValueTime("2012/11/09 20:03:00.000"));
+ list = Arrays.asList(new Value[] {
+ violet07Contact, whatever02Contact,
+ });
+ khaki31.getAttributes().add("contacts", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
+ khaki31.getAttributes().add("cardinality", new ValueInt(1l));
+ list = Arrays.asList(new Value[] {
+ khaki31Contact
+ });
+ khaki31.getAttributes().add("members", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
+ khaki31.getAttributes().add("creation", new ValueTime("2011/11/09 20:12:13.123"));
+ khaki31.getAttributes().add("cpu_usage", new ValueDouble(null));
+ khaki31.getAttributes().add("num_cores", new ValueInt(3l));
+ khaki31.getAttributes().add("has_ups", new ValueBoolean(false));
+ list = Arrays.asList(new Value[] {
+ new ValueString("agatka"), new ValueString("beatka"), new ValueString("celina"),
+ });
+ khaki31.getAttributes().add("some_names", new ValueList(list, TypePrimitive.STRING));
+ khaki31.getAttributes().add("expiry", new ValueDuration(-13l, -11l, 0l, 0l, 0l));
+
+ ZMI khaki13 = new ZMI(uw);
+ uw.addSon(khaki13);
+ khaki13.getAttributes().add("level", new ValueInt(2l));
+ khaki13.getAttributes().add("name", new ValueString("khaki13"));
+ khaki13.getAttributes().add("owner", new ValueString("/uw/khaki13"));
+ khaki13.getAttributes().add("timestamp", new ValueTime("2012/11/09 21:03:00.000"));
+ list = Arrays.asList(new Value[] {});
+ khaki13.getAttributes().add("contacts", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
+ khaki13.getAttributes().add("cardinality", new ValueInt(1l));
+ list = Arrays.asList(new Value[] {
+ khaki13Contact,
+ });
+ khaki13.getAttributes().add("members", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
+ khaki13.getAttributes().add("creation", new ValueTime((Long)null));
+ khaki13.getAttributes().add("cpu_usage", new ValueDouble(0.1));
+ khaki13.getAttributes().add("num_cores", new ValueInt(null));
+ khaki13.getAttributes().add("has_ups", new ValueBoolean(true));
+ list = Arrays.asList(new Value[] {});
+ khaki13.getAttributes().add("some_names", new ValueList(list, TypePrimitive.STRING));
+ khaki13.getAttributes().add("expiry", new ValueDuration((Long)null));
+
+ ZMI whatever01 = new ZMI(pjwstk);
+ pjwstk.addSon(whatever01);
+ whatever01.getAttributes().add("level", new ValueInt(2l));
+ whatever01.getAttributes().add("name", new ValueString("whatever01"));
+ whatever01.getAttributes().add("owner", new ValueString("/uw/whatever01"));
+ whatever01.getAttributes().add("timestamp", new ValueTime("2012/11/09 21:12:00.000"));
+ list = Arrays.asList(new Value[] {
+ violet07Contact, whatever02Contact,
+ });
+ whatever01.getAttributes().add("contacts", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
+ whatever01.getAttributes().add("cardinality", new ValueInt(1l));
+ list = Arrays.asList(new Value[] {
+ whatever01Contact,
+ });
+ whatever01.getAttributes().add("members", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
+ whatever01.getAttributes().add("creation", new ValueTime("2012/10/18 07:03:00.000"));
+ whatever01.getAttributes().add("cpu_usage", new ValueDouble(0.1));
+ whatever01.getAttributes().add("num_cores", new ValueInt(7l));
+ list = Arrays.asList(new Value[] {
+ new ValueString("rewrite")
+ });
+ whatever01.getAttributes().add("php_modules", new ValueList(list, TypePrimitive.STRING));
+
+ ZMI whatever02 = new ZMI(pjwstk);
+ pjwstk.addSon(whatever02);
+ whatever02.getAttributes().add("level", new ValueInt(2l));
+ whatever02.getAttributes().add("name", new ValueString("whatever02"));
+ whatever02.getAttributes().add("owner", new ValueString("/uw/whatever02"));
+ whatever02.getAttributes().add("timestamp", new ValueTime("2012/11/09 21:13:00.000"));
+ list = Arrays.asList(new Value[] {
+ khaki31Contact, whatever01Contact,
+ });
+ whatever02.getAttributes().add("contacts", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
+ whatever02.getAttributes().add("cardinality", new ValueInt(1l));
+ list = Arrays.asList(new Value[] {
+ whatever02Contact,
+ });
+ whatever02.getAttributes().add("members", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
+ whatever02.getAttributes().add("creation", new ValueTime("2012/10/18 07:04:00.000"));
+ whatever02.getAttributes().add("cpu_usage", new ValueDouble(0.4));
+ whatever02.getAttributes().add("num_cores", new ValueInt(13l));
+ list = Arrays.asList(new Value[] {
+ new ValueString("odbc")
+ });
+ whatever02.getAttributes().add("php_modules", new ValueList(list, TypePrimitive.STRING));
+
+ return root;
}
-
- private static PathName getPathName(ZMI zmi) {
- String name = ((ValueString)zmi.getAttributes().get("name")).getValue();
- return zmi.getFather() == null? PathName.ROOT : getPathName(zmi.getFather()).levelDown(name);
- }
-
- private static void executeQueries(ZMI zmi, String query, PrintStream out) throws Exception {
- if(!zmi.getSons().isEmpty()) {
- for(ZMI son : zmi.getSons())
- executeQueries(son, query, out);
- Interpreter interpreter = new Interpreter(zmi);
- Yylex lex = new Yylex(new ByteArrayInputStream(query.getBytes()));
- try {
- List<QueryResult> result = interpreter.interpretProgram((new parser(lex)).pProgram());
- PathName zone = getPathName(zmi);
- for(QueryResult r : result) {
- out.println(zone + ": " + r);
- zmi.getAttributes().addOrChange(r.getName(), r.getValue());
- }
- } catch(InterpreterException exception) {}
- }
- }
-
- private static ValueContact createContact(String path, byte ip1, byte ip2, byte ip3, byte ip4)
- throws UnknownHostException {
- return new ValueContact(new PathName(path), InetAddress.getByAddress(new byte[] {
- ip1, ip2, ip3, ip4
- }));
- }
-
- private static ZMI createTestHierarchy() throws ParseException, UnknownHostException {
- ValueContact violet07Contact = createContact("/uw/violet07", (byte)10, (byte)1, (byte)1, (byte)10);
- ValueContact khaki13Contact = createContact("/uw/khaki13", (byte)10, (byte)1, (byte)1, (byte)38);
- ValueContact khaki31Contact = createContact("/uw/khaki31", (byte)10, (byte)1, (byte)1, (byte)39);
- ValueContact whatever01Contact = createContact("/uw/whatever01", (byte)82, (byte)111, (byte)52, (byte)56);
- ValueContact whatever02Contact = createContact("/uw/whatever02", (byte)82, (byte)111, (byte)52, (byte)57);
-
- List<Value> list;
-
- root = new ZMI();
- root.getAttributes().add("level", new ValueInt(0l));
- root.getAttributes().add("name", new ValueString(null));
- root.getAttributes().add("owner", new ValueString("/uw/violet07"));
- root.getAttributes().add("timestamp", new ValueTime("2012/11/09 20:10:17.342"));
- root.getAttributes().add("contacts", new ValueSet(TypePrimitive.CONTACT));
- root.getAttributes().add("cardinality", new ValueInt(0l));
-
- ZMI uw = new ZMI(root);
- root.addSon(uw);
- uw.getAttributes().add("level", new ValueInt(1l));
- uw.getAttributes().add("name", new ValueString("uw"));
- uw.getAttributes().add("owner", new ValueString("/uw/violet07"));
- uw.getAttributes().add("timestamp", new ValueTime("2012/11/09 20:8:13.123"));
- uw.getAttributes().add("contacts", new ValueSet(TypePrimitive.CONTACT));
- uw.getAttributes().add("cardinality", new ValueInt(0l));
-
- ZMI pjwstk = new ZMI(root);
- root.addSon(pjwstk);
- pjwstk.getAttributes().add("level", new ValueInt(1l));
- pjwstk.getAttributes().add("name", new ValueString("pjwstk"));
- pjwstk.getAttributes().add("owner", new ValueString("/pjwstk/whatever01"));
- pjwstk.getAttributes().add("timestamp", new ValueTime("2012/11/09 20:8:13.123"));
- pjwstk.getAttributes().add("contacts", new ValueSet(TypePrimitive.CONTACT));
- pjwstk.getAttributes().add("cardinality", new ValueInt(0l));
-
- ZMI violet07 = new ZMI(uw);
- uw.addSon(violet07);
- violet07.getAttributes().add("level", new ValueInt(2l));
- violet07.getAttributes().add("name", new ValueString("violet07"));
- violet07.getAttributes().add("owner", new ValueString("/uw/violet07"));
- violet07.getAttributes().add("timestamp", new ValueTime("2012/11/09 18:00:00.000"));
- list = Arrays.asList(new Value[] {
- khaki31Contact, whatever01Contact
- });
- violet07.getAttributes().add("contacts", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
- violet07.getAttributes().add("cardinality", new ValueInt(1l));
- list = Arrays.asList(new Value[] {
- violet07Contact,
- });
- violet07.getAttributes().add("members", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
- violet07.getAttributes().add("creation", new ValueTime("2011/11/09 20:8:13.123"));
- violet07.getAttributes().add("cpu_usage", new ValueDouble(0.9));
- violet07.getAttributes().add("num_cores", new ValueInt(3l));
- violet07.getAttributes().add("has_ups", new ValueBoolean(null));
- list = Arrays.asList(new Value[] {
- new ValueString("tola"), new ValueString("tosia"),
- });
- violet07.getAttributes().add("some_names", new ValueList(list, TypePrimitive.STRING));
- violet07.getAttributes().add("expiry", new ValueDuration(13l, 12l, 0l, 0l, 0l));
-
- ZMI khaki31 = new ZMI(uw);
- uw.addSon(khaki31);
- khaki31.getAttributes().add("level", new ValueInt(2l));
- khaki31.getAttributes().add("name", new ValueString("khaki31"));
- khaki31.getAttributes().add("owner", new ValueString("/uw/khaki31"));
- khaki31.getAttributes().add("timestamp", new ValueTime("2012/11/09 20:03:00.000"));
- list = Arrays.asList(new Value[] {
- violet07Contact, whatever02Contact,
- });
- khaki31.getAttributes().add("contacts", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
- khaki31.getAttributes().add("cardinality", new ValueInt(1l));
- list = Arrays.asList(new Value[] {
- khaki31Contact
- });
- khaki31.getAttributes().add("members", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
- khaki31.getAttributes().add("creation", new ValueTime("2011/11/09 20:12:13.123"));
- khaki31.getAttributes().add("cpu_usage", new ValueDouble(null));
- khaki31.getAttributes().add("num_cores", new ValueInt(3l));
- khaki31.getAttributes().add("has_ups", new ValueBoolean(false));
- list = Arrays.asList(new Value[] {
- new ValueString("agatka"), new ValueString("beatka"), new ValueString("celina"),
- });
- khaki31.getAttributes().add("some_names", new ValueList(list, TypePrimitive.STRING));
- khaki31.getAttributes().add("expiry", new ValueDuration(-13l, -11l, 0l, 0l, 0l));
-
- ZMI khaki13 = new ZMI(uw);
- uw.addSon(khaki13);
- khaki13.getAttributes().add("level", new ValueInt(2l));
- khaki13.getAttributes().add("name", new ValueString("khaki13"));
- khaki13.getAttributes().add("owner", new ValueString("/uw/khaki13"));
- khaki13.getAttributes().add("timestamp", new ValueTime("2012/11/09 21:03:00.000"));
- list = Arrays.asList(new Value[] {});
- khaki13.getAttributes().add("contacts", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
- khaki13.getAttributes().add("cardinality", new ValueInt(1l));
- list = Arrays.asList(new Value[] {
- khaki13Contact,
- });
- khaki13.getAttributes().add("members", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
- khaki13.getAttributes().add("creation", new ValueTime((Long)null));
- khaki13.getAttributes().add("cpu_usage", new ValueDouble(0.1));
- khaki13.getAttributes().add("num_cores", new ValueInt(null));
- khaki13.getAttributes().add("has_ups", new ValueBoolean(true));
- list = Arrays.asList(new Value[] {});
- khaki13.getAttributes().add("some_names", new ValueList(list, TypePrimitive.STRING));
- khaki13.getAttributes().add("expiry", new ValueDuration((Long)null));
-
- ZMI whatever01 = new ZMI(pjwstk);
- pjwstk.addSon(whatever01);
- whatever01.getAttributes().add("level", new ValueInt(2l));
- whatever01.getAttributes().add("name", new ValueString("whatever01"));
- whatever01.getAttributes().add("owner", new ValueString("/uw/whatever01"));
- whatever01.getAttributes().add("timestamp", new ValueTime("2012/11/09 21:12:00.000"));
- list = Arrays.asList(new Value[] {
- violet07Contact, whatever02Contact,
- });
- whatever01.getAttributes().add("contacts", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
- whatever01.getAttributes().add("cardinality", new ValueInt(1l));
- list = Arrays.asList(new Value[] {
- whatever01Contact,
- });
- whatever01.getAttributes().add("members", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
- whatever01.getAttributes().add("creation", new ValueTime("2012/10/18 07:03:00.000"));
- whatever01.getAttributes().add("cpu_usage", new ValueDouble(0.1));
- whatever01.getAttributes().add("num_cores", new ValueInt(7l));
- list = Arrays.asList(new Value[] {
- new ValueString("rewrite")
- });
- whatever01.getAttributes().add("php_modules", new ValueList(list, TypePrimitive.STRING));
-
- ZMI whatever02 = new ZMI(pjwstk);
- pjwstk.addSon(whatever02);
- whatever02.getAttributes().add("level", new ValueInt(2l));
- whatever02.getAttributes().add("name", new ValueString("whatever02"));
- whatever02.getAttributes().add("owner", new ValueString("/uw/whatever02"));
- whatever02.getAttributes().add("timestamp", new ValueTime("2012/11/09 21:13:00.000"));
- list = Arrays.asList(new Value[] {
- khaki31Contact, whatever01Contact,
- });
- whatever02.getAttributes().add("contacts", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
- whatever02.getAttributes().add("cardinality", new ValueInt(1l));
- list = Arrays.asList(new Value[] {
- whatever02Contact,
- });
- whatever02.getAttributes().add("members", new ValueSet(new HashSet<Value>(list), TypePrimitive.CONTACT));
- whatever02.getAttributes().add("creation", new ValueTime("2012/10/18 07:04:00.000"));
- whatever02.getAttributes().add("cpu_usage", new ValueDouble(0.4));
- whatever02.getAttributes().add("num_cores", new ValueInt(13l));
- list = Arrays.asList(new Value[] {
- new ValueString("odbc")
- });
- whatever02.getAttributes().add("php_modules", new ValueList(list, TypePrimitive.STRING));
-
- return root;
- }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/NoSuchAttributeException.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/NoSuchAttributeException.java
index b85438c..800bd09 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/NoSuchAttributeException.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/NoSuchAttributeException.java
@@ -26,14 +26,14 @@ package pl.edu.mimuw.cloudatlas.interpreter;
@SuppressWarnings("serial")
public class NoSuchAttributeException extends InterpreterException {
- private final String attribute;
+ private final String attribute;
- protected NoSuchAttributeException(String attribute) {
- super("Attribute " + attribute + " does not exist.");
- this.attribute = attribute;
- }
+ protected NoSuchAttributeException(String attribute) {
+ super("Attribute " + attribute + " does not exist.");
+ this.attribute = attribute;
+ }
- public String getAttribute() {
- return attribute;
- }
+ public String getAttribute() {
+ return attribute;
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/QueryResult.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/QueryResult.java
index 2fc0cce..130d287 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/QueryResult.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/QueryResult.java
@@ -29,27 +29,27 @@ import pl.edu.mimuw.cloudatlas.model.Value;
// immutable
public class QueryResult {
- private final Attribute name;
- private final Value value;
+ private final Attribute name;
+ private final Value value;
- public QueryResult(Attribute name, Value value) {
- this.name = name;
- this.value = value;
- }
+ public QueryResult(Attribute name, Value value) {
+ this.name = name;
+ this.value = value;
+ }
- public QueryResult(Value value) {
- this(null, value);
- }
+ public QueryResult(Value value) {
+ this(null, value);
+ }
- public Attribute getName() {
- return name;
- }
+ public Attribute getName() {
+ return name;
+ }
- public Value getValue() {
- return value;
- }
+ public Value getValue() {
+ return value;
+ }
- public String toString() {
- return name + ": " + value;
- }
+ public String toString() {
+ return name + ": " + value;
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Result.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Result.java
index 0089504..5c1a494 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Result.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Result.java
@@ -33,234 +33,234 @@ import pl.edu.mimuw.cloudatlas.model.Value;
import pl.edu.mimuw.cloudatlas.model.ValueList;
abstract class Result {
- public interface BinaryOperation {
- public Value perform(Value v1, Value v2);
- }
-
- public interface UnaryOperation {
- public Value perform(Value v);
- }
-
- public interface AggregationOperation {
- public Value perform(ValueList values);
- }
-
- public interface TransformOperation {
- public ValueList perform(ValueList values);
- }
-
- private static final BinaryOperation IS_EQUAL = new BinaryOperation() {
- @Override
- public Value perform(Value v1, Value v2) {
- return v1.isEqual(v2);
- }
- };
-
- private static final BinaryOperation IS_LOWER_THAN = new BinaryOperation() {
- @Override
- public Value perform(Value v1, Value v2) {
- return v1.isLowerThan(v2);
- }
- };
-
- private static final BinaryOperation ADD_VALUE = new BinaryOperation() {
- @Override
- public Value perform(Value v1, Value v2) {
- return v1.addValue(v2);
- }
- };
-
- private static final BinaryOperation SUBTRACT = new BinaryOperation() {
- @Override
- public Value perform(Value v1, Value v2) {
- return v1.subtract(v2);
- }
- };
-
- private static final BinaryOperation MULTIPLY = new BinaryOperation() {
- @Override
- public Value perform(Value v1, Value v2) {
- return v1.multiply(v2);
- }
- };
-
- private static final BinaryOperation DIVIDE = new BinaryOperation() {
- @Override
- public Value perform(Value v1, Value v2) {
- return v1.divide(v2);
- }
- };
-
- private static final BinaryOperation MODULO = new BinaryOperation() {
- @Override
- public Value perform(Value v1, Value v2) {
- return v1.modulo(v2);
- }
- };
-
- private static final BinaryOperation AND = new BinaryOperation() {
- @Override
- public Value perform(Value v1, Value v2) {
- return v1.and(v2);
- }
- };
-
- private static final BinaryOperation OR = new BinaryOperation() {
- @Override
- public Value perform(Value v1, Value v2) {
- return v1.or(v2);
- }
- };
-
- private static final BinaryOperation REG_EXPR = new BinaryOperation() {
- @Override
- public Value perform(Value v1, Value v2) {
- return v2.regExpr(v1);
- }
- };
-
- private static final UnaryOperation NEGATE = new UnaryOperation() {
- @Override
- public Value perform(Value v) {
- return v.negate();
- }
- };
-
- private static final UnaryOperation VALUE_SIZE = new UnaryOperation() {
- @Override
- public Value perform(Value v) {
- return v.valueSize();
- }
- };
-
- protected abstract Result binaryOperationTyped(BinaryOperation operation, ResultSingle right);
- protected abstract Result binaryOperationTyped(BinaryOperation operation, ResultColumn right);
-
- public Result binaryOperation(BinaryOperation operation, Result right) {
- return right.callMe(operation, this);
- }
-
- public abstract Result unaryOperation(UnaryOperation operation);
-
- protected abstract Result callMe(BinaryOperation operation, Result left);
-
- public abstract Value getValue();
-
- public abstract ValueList getList();
-
- public abstract ValueList getColumn();
-
- public ResultSingle aggregationOperation(AggregationOperation operation) {
- // TODO
- throw new UnsupportedOperationException("aggregation Not yet implemented");
- }
-
- public Result transformOperation(TransformOperation operation) {
- // TODO
- throw new UnsupportedOperationException("transformation Not yet implemented");
- }
-
- public Result isEqual(Result right) {
- return right.callMe(IS_EQUAL, this);
- }
-
- public Result isLowerThan(Result right) {
- return right.callMe(IS_LOWER_THAN, this);
- }
-
- public Result addValue(Result right) {
- return right.callMe(ADD_VALUE, this);
- }
-
- public Result subtract(Result right) {
- return right.callMe(SUBTRACT, this);
- }
-
- public Result multiply(Result right) {
- return right.callMe(MULTIPLY, this);
- }
-
- public Result divide(Result right) {
- return right.callMe(DIVIDE, this);
- }
-
- public Result modulo(Result right) {
- return right.callMe(MODULO, this);
- }
-
- public Result and(Result right) {
- return right.callMe(AND, this);
- }
-
- public Result or(Result right) {
- return right.callMe(OR, this);
- }
-
- public Result regExpr(Result right) {
- return right.callMe(REG_EXPR, this);
- }
-
- public Result negate() {
- return unaryOperation(NEGATE);
- }
-
- public Result valueSize() {
- return unaryOperation(VALUE_SIZE);
- }
-
- protected static ValueList filterNullsList(ValueList list) {
- List<Value> result = new ArrayList<Value>();
- if(list.isEmpty())
- return new ValueList(result, ((TypeCollection)list.getType()).getElementType());
- for(Value v : list)
- if(!v.isNull())
- result.add(v);
- return new ValueList(result.isEmpty()? null : result, ((TypeCollection)list.getType()).getElementType());
- }
-
- public abstract Result filterNulls();
-
- protected static ValueList firstList(ValueList list, int size) {
- ValueList nlist = filterNullsList(list);
- if(nlist.getValue() == null)
- return nlist;
- List<Value> result = new ArrayList<Value>(size);
- int i = 0;
- for(Value v : nlist) {
- result.add(v);
- if(++i == size)
- break;
- }
- return new ValueList(result, ((TypeCollection)list.getType()).getElementType());
- }
-
- public abstract Result first(int size);
-
- protected static ValueList lastList(ValueList list, int size) {
- ValueList nlist = filterNullsList(list);
- if(nlist.getValue() == null)
- return nlist;
- List<Value> result = new ArrayList<Value>(size);
- for(int i = Math.max(0, list.size() - size); i < list.size(); ++i)
- result.add(list.get(i));
- return new ValueList(result, ((TypeCollection)list.getType()).getElementType());
- }
-
- public abstract Result last(int size);
-
- protected static ValueList randomList(ValueList list, int size) {
- ValueList nlist = filterNullsList(list);
- if(nlist.getValue() == null || list.size() <= size)
- return nlist;
- Collections.shuffle(nlist);
- return new ValueList(nlist.getValue().subList(0, size), ((TypeCollection)list.getType()).getElementType());
- }
-
- public abstract Result random(int size);
-
- public abstract Result convertTo(Type to);
-
- public abstract ResultSingle isNull();
-
- public abstract Type getType();
+ public interface BinaryOperation {
+ public Value perform(Value v1, Value v2);
+ }
+
+ public interface UnaryOperation {
+ public Value perform(Value v);
+ }
+
+ public interface AggregationOperation {
+ public Value perform(ValueList values);
+ }
+
+ public interface TransformOperation {
+ public ValueList perform(ValueList values);
+ }
+
+ private static final BinaryOperation IS_EQUAL = new BinaryOperation() {
+ @Override
+ public Value perform(Value v1, Value v2) {
+ return v1.isEqual(v2);
+ }
+ };
+
+ private static final BinaryOperation IS_LOWER_THAN = new BinaryOperation() {
+ @Override
+ public Value perform(Value v1, Value v2) {
+ return v1.isLowerThan(v2);
+ }
+ };
+
+ private static final BinaryOperation ADD_VALUE = new BinaryOperation() {
+ @Override
+ public Value perform(Value v1, Value v2) {
+ return v1.addValue(v2);
+ }
+ };
+
+ private static final BinaryOperation SUBTRACT = new BinaryOperation() {
+ @Override
+ public Value perform(Value v1, Value v2) {
+ return v1.subtract(v2);
+ }
+ };
+
+ private static final BinaryOperation MULTIPLY = new BinaryOperation() {
+ @Override
+ public Value perform(Value v1, Value v2) {
+ return v1.multiply(v2);
+ }
+ };
+
+ private static final BinaryOperation DIVIDE = new BinaryOperation() {
+ @Override
+ public Value perform(Value v1, Value v2) {
+ return v1.divide(v2);
+ }
+ };
+
+ private static final BinaryOperation MODULO = new BinaryOperation() {
+ @Override
+ public Value perform(Value v1, Value v2) {
+ return v1.modulo(v2);
+ }
+ };
+
+ private static final BinaryOperation AND = new BinaryOperation() {
+ @Override
+ public Value perform(Value v1, Value v2) {
+ return v1.and(v2);
+ }
+ };
+
+ private static final BinaryOperation OR = new BinaryOperation() {
+ @Override
+ public Value perform(Value v1, Value v2) {
+ return v1.or(v2);
+ }
+ };
+
+ private static final BinaryOperation REG_EXPR = new BinaryOperation() {
+ @Override
+ public Value perform(Value v1, Value v2) {
+ return v2.regExpr(v1);
+ }
+ };
+
+ private static final UnaryOperation NEGATE = new UnaryOperation() {
+ @Override
+ public Value perform(Value v) {
+ return v.negate();
+ }
+ };
+
+ private static final UnaryOperation VALUE_SIZE = new UnaryOperation() {
+ @Override
+ public Value perform(Value v) {
+ return v.valueSize();
+ }
+ };
+
+ protected abstract Result binaryOperationTyped(BinaryOperation operation, ResultSingle right);
+ protected abstract Result binaryOperationTyped(BinaryOperation operation, ResultColumn right);
+
+ public Result binaryOperation(BinaryOperation operation, Result right) {
+ return right.callMe(operation, this);
+ }
+
+ public abstract Result unaryOperation(UnaryOperation operation);
+
+ protected abstract Result callMe(BinaryOperation operation, Result left);
+
+ public abstract Value getValue();
+
+ public abstract ValueList getList();
+
+ public abstract ValueList getColumn();
+
+ public ResultSingle aggregationOperation(AggregationOperation operation) {
+ // TODO
+ throw new UnsupportedOperationException("aggregation Not yet implemented");
+ }
+
+ public Result transformOperation(TransformOperation operation) {
+ // TODO
+ throw new UnsupportedOperationException("transformation Not yet implemented");
+ }
+
+ public Result isEqual(Result right) {
+ return right.callMe(IS_EQUAL, this);
+ }
+
+ public Result isLowerThan(Result right) {
+ return right.callMe(IS_LOWER_THAN, this);
+ }
+
+ public Result addValue(Result right) {
+ return right.callMe(ADD_VALUE, this);
+ }
+
+ public Result subtract(Result right) {
+ return right.callMe(SUBTRACT, this);
+ }
+
+ public Result multiply(Result right) {
+ return right.callMe(MULTIPLY, this);
+ }
+
+ public Result divide(Result right) {
+ return right.callMe(DIVIDE, this);
+ }
+
+ public Result modulo(Result right) {
+ return right.callMe(MODULO, this);
+ }
+
+ public Result and(Result right) {
+ return right.callMe(AND, this);
+ }
+
+ public Result or(Result right) {
+ return right.callMe(OR, this);
+ }
+
+ public Result regExpr(Result right) {
+ return right.callMe(REG_EXPR, this);
+ }
+
+ public Result negate() {
+ return unaryOperation(NEGATE);
+ }
+
+ public Result valueSize() {
+ return unaryOperation(VALUE_SIZE);
+ }
+
+ protected static ValueList filterNullsList(ValueList list) {
+ List<Value> result = new ArrayList<Value>();
+ if(list.isEmpty())
+ return new ValueList(result, ((TypeCollection)list.getType()).getElementType());
+ for(Value v : list)
+ if(!v.isNull())
+ result.add(v);
+ return new ValueList(result.isEmpty()? null : result, ((TypeCollection)list.getType()).getElementType());
+ }
+
+ public abstract Result filterNulls();
+
+ protected static ValueList firstList(ValueList list, int size) {
+ ValueList nlist = filterNullsList(list);
+ if(nlist.getValue() == null)
+ return nlist;
+ List<Value> result = new ArrayList<Value>(size);
+ int i = 0;
+ for(Value v : nlist) {
+ result.add(v);
+ if(++i == size)
+ break;
+ }
+ return new ValueList(result, ((TypeCollection)list.getType()).getElementType());
+ }
+
+ public abstract Result first(int size);
+
+ protected static ValueList lastList(ValueList list, int size) {
+ ValueList nlist = filterNullsList(list);
+ if(nlist.getValue() == null)
+ return nlist;
+ List<Value> result = new ArrayList<Value>(size);
+ for(int i = Math.max(0, list.size() - size); i < list.size(); ++i)
+ result.add(list.get(i));
+ return new ValueList(result, ((TypeCollection)list.getType()).getElementType());
+ }
+
+ public abstract Result last(int size);
+
+ protected static ValueList randomList(ValueList list, int size) {
+ ValueList nlist = filterNullsList(list);
+ if(nlist.getValue() == null || list.size() <= size)
+ return nlist;
+ Collections.shuffle(nlist);
+ return new ValueList(nlist.getValue().subList(0, size), ((TypeCollection)list.getType()).getElementType());
+ }
+
+ public abstract Result random(int size);
+
+ public abstract Result convertTo(Type to);
+
+ public abstract ResultSingle isNull();
+
+ public abstract Type getType();
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/ResultColumn.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/ResultColumn.java
index a0d5ecd..b551955 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/ResultColumn.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/ResultColumn.java
@@ -12,20 +12,20 @@ import pl.edu.mimuw.cloudatlas.model.ValueList;
class ResultColumn extends Result {
private final List<Value> column;
- public ResultColumn(List<Value> column) {
- this.column = column;
- }
+ public ResultColumn(List<Value> column) {
+ this.column = column;
+ }
@Override
- protected ResultColumn binaryOperationTyped(BinaryOperation operation, ResultSingle right) {
+ protected ResultColumn binaryOperationTyped(BinaryOperation operation, ResultSingle right) {
List<Value> results = new ArrayList<Value>();
for (Value value : column) {
results.add(operation.perform(value, right.getValue()));
}
- return new ResultColumn(results);
- }
+ return new ResultColumn(results);
+ }
protected ResultColumn binaryOperationTyped(BinaryOperation operation, ResultColumn right) {
List<Value> results = new ArrayList<Value>();
@@ -34,72 +34,72 @@ class ResultColumn extends Result {
results.add(operation.perform(column.get(i), right.column.get(i)));
}
- return new ResultColumn(results);
+ return new ResultColumn(results);
}
- @Override
- public ResultColumn unaryOperation(UnaryOperation operation) {
+ @Override
+ public ResultColumn unaryOperation(UnaryOperation operation) {
List<Value> results = new ArrayList<Value>();
for (Value value : column) {
results.add(operation.perform(value));
}
- return new ResultColumn(results);
- }
-
- @Override
- protected Result callMe(BinaryOperation operation, Result left) {
- return left.binaryOperationTyped(operation, this);
- }
-
- @Override
- public Value getValue() {
- throw new UnsupportedOperationException("Not a ResultSingle.");
- }
-
- @Override
- public ValueList getList() {
- throw new UnsupportedOperationException("Not a ResultList.");
- }
-
- @Override
- public ValueList getColumn() {
+ return new ResultColumn(results);
+ }
+
+ @Override
+ protected Result callMe(BinaryOperation operation, Result left) {
+ return left.binaryOperationTyped(operation, this);
+ }
+
+ @Override
+ public Value getValue() {
+ throw new UnsupportedOperationException("Not a ResultSingle.");
+ }
+
+ @Override
+ public ValueList getList() {
+ throw new UnsupportedOperationException("Not a ResultList.");
+ }
+
+ @Override
+ public ValueList getColumn() {
return new ValueList(column, TypeCollection.computeElementType(column));
- }
+ }
@Override
- public ResultSingle aggregationOperation(AggregationOperation operation) {
+ public ResultSingle aggregationOperation(AggregationOperation operation) {
return new ResultSingle(operation.perform(getColumn()));
- }
+ }
@Override
- public Result transformOperation(TransformOperation operation) {
+ public Result transformOperation(TransformOperation operation) {
// TODO: this should be a ResultList
- return new ResultColumn(operation.perform(getColumn()));
- }
+ return new ResultColumn(operation.perform(getColumn()));
+ }
- @Override
- public Result filterNulls() {
- throw new UnsupportedOperationException("Operation filterNulls not supported yet.");
- }
+ @Override
+ public Result filterNulls() {
+ throw new UnsupportedOperationException("Operation filterNulls not supported yet.");
+ }
- @Override
- public Result first(int size) {
+ @Override
+ public Result first(int size) {
List<Value> subList = column.subList(0, Math.min(size, column.size()));
return new ResultSingle(new ValueList(subList, TypeCollection.computeElementType(subList)));
- }
+ }
- @Override
- public Result last(int size) {
+ @Override
+ public Result last(int size) {
List<Value> subList = column.subList(
Math.max(0, column.size() - size),
column.size()
);
return new ResultSingle(new ValueList(subList, TypeCollection.computeElementType(subList)));
- }
+ }
- @Override
- public Result random(int size) {
+ @Override
+ public Result random(int size) {
return new ResultColumn(
randomList(
new ValueList(
@@ -109,28 +109,28 @@ class ResultColumn extends Result {
size
)
);
- }
+ }
- @Override
- public ResultColumn convertTo(Type to) {
+ @Override
+ public ResultColumn convertTo(Type to) {
List<Value> results = new ArrayList<Value>();
for (Value value : column) {
results.add(value.convertTo(to));
}
- return new ResultColumn(results);
- }
+ return new ResultColumn(results);
+ }
- @Override
- public ResultSingle isNull() {
- throw new UnsupportedOperationException("Operation isNull not supported yet.");
- // return new ResultSingle(new ValueBoolean(value.isNull()));
- }
+ @Override
+ public ResultSingle isNull() {
+ throw new UnsupportedOperationException("Operation isNull not supported yet.");
+ // return new ResultSingle(new ValueBoolean(value.isNull()));
+ }
- @Override
- public Type getType() {
- throw new UnsupportedOperationException("Operation getType not supported yet.");
- // return value.getType();
- }
+ @Override
+ public Type getType() {
+ throw new UnsupportedOperationException("Operation getType not supported yet.");
+ // return value.getType();
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/ResultSingle.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/ResultSingle.java
index b77858b..3d88bb0 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/ResultSingle.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/ResultSingle.java
@@ -33,16 +33,16 @@ import pl.edu.mimuw.cloudatlas.model.ValueBoolean;
import pl.edu.mimuw.cloudatlas.model.ValueList;
class ResultSingle extends Result {
- private final Value value;
+ private final Value value;
- public ResultSingle(Value value) {
- this.value = value;
- }
-
- @Override
- protected ResultSingle binaryOperationTyped(BinaryOperation operation, ResultSingle right) {
- return new ResultSingle(operation.perform(value, right.value));
- }
+ public ResultSingle(Value value) {
+ this.value = value;
+ }
+
+ @Override
+ protected ResultSingle binaryOperationTyped(BinaryOperation operation, ResultSingle right) {
+ return new ResultSingle(operation.perform(value, right.value));
+ }
@Override
protected ResultColumn binaryOperationTyped(BinaryOperation operation, ResultColumn right) {
@@ -52,66 +52,66 @@ class ResultSingle extends Result {
results.add(operation.perform(this.value, value));
}
- return new ResultColumn(results);
+ return new ResultColumn(results);
+ }
+
+ @Override
+ public ResultSingle unaryOperation(UnaryOperation operation) {
+ return new ResultSingle(operation.perform(value));
+ }
+
+ @Override
+ protected Result callMe(BinaryOperation operation, Result left) {
+ return left.binaryOperationTyped(operation, this);
+ }
+
+ @Override
+ public Value getValue() {
+ return value;
+ }
+
+ @Override
+ public ValueList getList() {
+ throw new UnsupportedOperationException("Not a ResultList.");
}
- @Override
- public ResultSingle unaryOperation(UnaryOperation operation) {
- return new ResultSingle(operation.perform(value));
- }
-
- @Override
- protected Result callMe(BinaryOperation operation, Result left) {
- return left.binaryOperationTyped(operation, this);
- }
-
- @Override
- public Value getValue() {
- return value;
- }
-
- @Override
- public ValueList getList() {
- throw new UnsupportedOperationException("Not a ResultList.");
- }
-
- @Override
- public ValueList getColumn() {
- throw new UnsupportedOperationException("Not a ResultColumn.");
- }
-
- @Override
- public Result filterNulls() {
- throw new UnsupportedOperationException("Operation filterNulls not supported on ResultSingle.");
- }
-
- @Override
- public Result first(int size) {
- throw new UnsupportedOperationException("Operation first not supported on ResultSingle.");
- }
-
- @Override
- public Result last(int size) {
- throw new UnsupportedOperationException("Operation last not supported on ResultSingle.");
- }
-
- @Override
- public Result random(int size) {
- throw new UnsupportedOperationException("Operation random not supported on ResultSingle.");
- }
-
- @Override
- public ResultSingle convertTo(Type to) {
- return new ResultSingle(value.convertTo(to));
- }
-
- @Override
- public ResultSingle isNull() {
- return new ResultSingle(new ValueBoolean(value.isNull()));
- }
-
- @Override
- public Type getType() {
- return value.getType();
- }
+ @Override
+ public ValueList getColumn() {
+ throw new UnsupportedOperationException("Not a ResultColumn.");
+ }
+
+ @Override
+ public Result filterNulls() {
+ throw new UnsupportedOperationException("Operation filterNulls not supported on ResultSingle.");
+ }
+
+ @Override
+ public Result first(int size) {
+ throw new UnsupportedOperationException("Operation first not supported on ResultSingle.");
+ }
+
+ @Override
+ public Result last(int size) {
+ throw new UnsupportedOperationException("Operation last not supported on ResultSingle.");
+ }
+
+ @Override
+ public Result random(int size) {
+ throw new UnsupportedOperationException("Operation random not supported on ResultSingle.");
+ }
+
+ @Override
+ public ResultSingle convertTo(Type to) {
+ return new ResultSingle(value.convertTo(to));
+ }
+
+ @Override
+ public ResultSingle isNull() {
+ return new ResultSingle(new ValueBoolean(value.isNull()));
+ }
+
+ @Override
+ public Type getType() {
+ return value.getType();
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Table.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Table.java
index 9f2e1d9..c120171 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Table.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/Table.java
@@ -44,80 +44,80 @@ import pl.edu.mimuw.cloudatlas.model.ValueNull;
import pl.edu.mimuw.cloudatlas.model.ZMI;
public class Table implements Iterable<TableRow> {
- private final List<String> columns = new ArrayList<String>();
- private final Map<String, Integer> headersMap = new HashMap<String, Integer>();
- private final List<TableRow> rows = new ArrayList<TableRow>();
+ private final List<String> columns = new ArrayList<String>();
+ private final Map<String, Integer> headersMap = new HashMap<String, Integer>();
+ private final List<TableRow> rows = new ArrayList<TableRow>();
- // creates whole table based on a given ZMI
- public Table(ZMI zmi) {
- Set<String> allColumns = new HashSet<String>();
- for(ZMI z : zmi.getSons())
- for(Entry<Attribute, Value> e : z.getAttributes())
- allColumns.add(e.getKey().getName());
+ // creates whole table based on a given ZMI
+ public Table(ZMI zmi) {
+ Set<String> allColumns = new HashSet<String>();
+ for(ZMI z : zmi.getSons())
+ for(Entry<Attribute, Value> e : z.getAttributes())
+ allColumns.add(e.getKey().getName());
- columns.addAll(allColumns);
- int i = 0;
- for(String c : columns)
- headersMap.put(c, i++);
- for(ZMI z : zmi.getSons()) {
- Value[] row = new Value[columns.size()];
- for(int j = 0; j < row.length; ++j)
- row[j] = ValueNull.getInstance();
- for(Entry<Attribute, Value> e : z.getAttributes())
- row[getColumnIndex(e.getKey().getName())] = e.getValue();
- appendRow(new TableRow(row));
- }
- }
+ columns.addAll(allColumns);
+ int i = 0;
+ for(String c : columns)
+ headersMap.put(c, i++);
+ for(ZMI z : zmi.getSons()) {
+ Value[] row = new Value[columns.size()];
+ for(int j = 0; j < row.length; ++j)
+ row[j] = ValueNull.getInstance();
+ for(Entry<Attribute, Value> e : z.getAttributes())
+ row[getColumnIndex(e.getKey().getName())] = e.getValue();
+ appendRow(new TableRow(row));
+ }
+ }
- // creates an empty table with same columns as given
- public Table(Table table) {
- this.columns.addAll(table.columns);
- this.headersMap.putAll(table.headersMap);
- }
+ // creates an empty table with same columns as given
+ public Table(Table table) {
+ this.columns.addAll(table.columns);
+ this.headersMap.putAll(table.headersMap);
+ }
- public List<String> getColumns() {
- return Collections.unmodifiableList(columns);
- }
+ public List<String> getColumns() {
+ return Collections.unmodifiableList(columns);
+ }
- public void appendRow(TableRow row) {
- if(row.getSize() != columns.size())
- throw new InternalInterpreterException("Cannot append row. Length expected: " + columns.size() + ", got: "
- + row.getSize() + ".");
- rows.add(row);
- }
+ public void appendRow(TableRow row) {
+ if(row.getSize() != columns.size())
+ throw new InternalInterpreterException("Cannot append row. Length expected: " + columns.size() + ", got: "
+ + row.getSize() + ".");
+ rows.add(row);
+ }
- public int getColumnIndex(String column) {
- try {
- return headersMap.get(column).intValue();
- } catch(NullPointerException exception) {
- throw new NoSuchAttributeException(column);
- }
- }
+ public int getColumnIndex(String column) {
+ try {
+ return headersMap.get(column).intValue();
+ } catch(NullPointerException exception) {
+ throw new NoSuchAttributeException(column);
+ }
+ }
- public ValueList getColumn(String column) {
- if(column.startsWith("&")) {
- throw new NoSuchAttributeException(column);
- }
- try {
- int position = headersMap.get(column);
- List<Value> result = new ArrayList<Value>();
- for(TableRow row : rows) {
- Value v = row.getIth(position);
- result.add(v);
- }
- Type elementType = TypeCollection.computeElementType(result);
- return new ValueList(result, elementType);
- } catch(NullPointerException exception) {
- throw new NoSuchAttributeException(column);
- }
- }
+ public ValueList getColumn(String column) {
+ if(column.startsWith("&")) {
+ throw new NoSuchAttributeException(column);
+ }
+ try {
+ int position = headersMap.get(column);
+ List<Value> result = new ArrayList<Value>();
+ for(TableRow row : rows) {
+ Value v = row.getIth(position);
+ result.add(v);
+ }
+ Type elementType = TypeCollection.computeElementType(result);
+ return new ValueList(result, elementType);
+ } catch(NullPointerException exception) {
+ throw new NoSuchAttributeException(column);
+ }
+ }
- @Override
- public Iterator<TableRow> iterator() {
- return rows.iterator();
- }
+ @Override
+ public Iterator<TableRow> iterator() {
+ return rows.iterator();
+ }
- public void sort(Comparator<TableRow> comparator) {
- Collections.sort(rows, comparator);
- }
+ public void sort(Comparator<TableRow> comparator) {
+ Collections.sort(rows, comparator);
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/TableRow.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/TableRow.java
index 23fd2dd..b0657c4 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/TableRow.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/TableRow.java
@@ -30,17 +30,17 @@ import pl.edu.mimuw.cloudatlas.model.Value;
// immutable
public class TableRow {
- private final Value[] columns;
+ private final Value[] columns;
- public TableRow(Value[] values) {
- this.columns = Arrays.copyOf(values, values.length);
- }
+ public TableRow(Value[] values) {
+ this.columns = Arrays.copyOf(values, values.length);
+ }
- public int getSize() {
- return columns.length;
- }
+ public int getSize() {
+ return columns.length;
+ }
- public Value getIth(int i) {
- return columns[i];
- }
+ public Value getIth(int i) {
+ return columns[i];
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/PrettyPrinter.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/PrettyPrinter.java
index ed1276d..ccead1d 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/PrettyPrinter.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/PrettyPrinter.java
@@ -1132,7 +1132,7 @@ public class PrettyPrinter
private static void trim()
{
while (buf_.length() > 0 && buf_.charAt(0) == ' ')
- buf_.deleteCharAt(0);
+ buf_.deleteCharAt(0);
while (buf_.length() > 0 && buf_.charAt(buf_.length()-1) == ' ')
buf_.deleteCharAt(buf_.length()-1);
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/Yylex.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/Yylex.java
index 2fb69d7..74227e8 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/Yylex.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/Yylex.java
@@ -4,321 +4,321 @@ import java_cup.runtime.*;
public class Yylex implements java_cup.runtime.Scanner {
- private final int YY_BUFFER_SIZE = 512;
- private final int YY_F = -1;
- private final int YY_NO_STATE = -1;
- private final int YY_NOT_ACCEPT = 0;
- private final int YY_END = 2;
- private final int YY_NO_ANCHOR = 4;
- private final int YY_BOL = 65536;
- private final int YY_EOF = 65537;
+ private final int YY_BUFFER_SIZE = 512;
+ private final int YY_F = -1;
+ private final int YY_NO_STATE = -1;
+ private final int YY_NOT_ACCEPT = 0;
+ private final int YY_END = 2;
+ private final int YY_NO_ANCHOR = 4;
+ private final int YY_BOL = 65536;
+ private final int YY_EOF = 65537;
String pstring = new String();
public int line_num() { return (yyline+1); }
public String buff() { return new String(yy_buffer,yy_buffer_index,10).trim(); }
- private java.io.BufferedReader yy_reader;
- private int yy_buffer_index;
- private int yy_buffer_read;
- private int yy_buffer_start;
- private int yy_buffer_end;
- private char yy_buffer[];
- private int yyline;
- private boolean yy_at_bol;
- private int yy_lexical_state;
+ private java.io.BufferedReader yy_reader;
+ private int yy_buffer_index;
+ private int yy_buffer_read;
+ private int yy_buffer_start;
+ private int yy_buffer_end;
+ private char yy_buffer[];
+ private int yyline;
+ private boolean yy_at_bol;
+ private int yy_lexical_state;
- public Yylex (java.io.Reader reader) {
- this ();
- if (null == reader) {
- throw (new Error("Error: Bad input stream initializer."));
- }
- yy_reader = new java.io.BufferedReader(reader);
- }
+ public Yylex (java.io.Reader reader) {
+ this ();
+ if (null == reader) {
+ throw (new Error("Error: Bad input stream initializer."));
+ }
+ yy_reader = new java.io.BufferedReader(reader);
+ }
- public Yylex (java.io.InputStream instream) {
- this ();
- if (null == instream) {
- throw (new Error("Error: Bad input stream initializer."));
- }
- yy_reader = new java.io.BufferedReader(new java.io.InputStreamReader(instream));
- }
+ public Yylex (java.io.InputStream instream) {
+ this ();
+ if (null == instream) {
+ throw (new Error("Error: Bad input stream initializer."));
+ }
+ yy_reader = new java.io.BufferedReader(new java.io.InputStreamReader(instream));
+ }
- private Yylex () {
- yy_buffer = new char[YY_BUFFER_SIZE];
- yy_buffer_read = 0;
- yy_buffer_index = 0;
- yy_buffer_start = 0;
- yy_buffer_end = 0;
- yyline = 0;
- yy_at_bol = true;
- yy_lexical_state = YYINITIAL;
- }
+ private Yylex () {
+ yy_buffer = new char[YY_BUFFER_SIZE];
+ yy_buffer_read = 0;
+ yy_buffer_index = 0;
+ yy_buffer_start = 0;
+ yy_buffer_end = 0;
+ yyline = 0;
+ yy_at_bol = true;
+ yy_lexical_state = YYINITIAL;
+ }
- private final int STRING = 5;
- private final int ESCAPED = 6;
- private final int YYINITIAL = 0;
- private final int yy_state_dtrans[] = {
- 0,
- 57,
- 57,
- 57,
- 57,
- 59,
- 61
- };
- private void yybegin (int state) {
- yy_lexical_state = state;
- }
- private int yy_advance ()
- throws java.io.IOException {
- int next_read;
- int i;
- int j;
+ private final int STRING = 5;
+ private final int ESCAPED = 6;
+ private final int YYINITIAL = 0;
+ private final int yy_state_dtrans[] = {
+ 0,
+ 57,
+ 57,
+ 57,
+ 57,
+ 59,
+ 61
+ };
+ private void yybegin (int state) {
+ yy_lexical_state = state;
+ }
+ private int yy_advance ()
+ throws java.io.IOException {
+ int next_read;
+ int i;
+ int j;
- if (yy_buffer_index < yy_buffer_read) {
- return yy_buffer[yy_buffer_index++];
- }
+ if (yy_buffer_index < yy_buffer_read) {
+ return yy_buffer[yy_buffer_index++];
+ }
- if (0 != yy_buffer_start) {
- i = yy_buffer_start;
- j = 0;
- while (i < yy_buffer_read) {
- yy_buffer[j] = yy_buffer[i];
- ++i;
- ++j;
- }
- yy_buffer_end = yy_buffer_end - yy_buffer_start;
- yy_buffer_start = 0;
- yy_buffer_read = j;
- yy_buffer_index = j;
- next_read = yy_reader.read(yy_buffer,
- yy_buffer_read,
- yy_buffer.length - yy_buffer_read);
- if (-1 == next_read) {
- return YY_EOF;
- }
- yy_buffer_read = yy_buffer_read + next_read;
- }
+ if (0 != yy_buffer_start) {
+ i = yy_buffer_start;
+ j = 0;
+ while (i < yy_buffer_read) {
+ yy_buffer[j] = yy_buffer[i];
+ ++i;
+ ++j;
+ }
+ yy_buffer_end = yy_buffer_end - yy_buffer_start;
+ yy_buffer_start = 0;
+ yy_buffer_read = j;
+ yy_buffer_index = j;
+ next_read = yy_reader.read(yy_buffer,
+ yy_buffer_read,
+ yy_buffer.length - yy_buffer_read);
+ if (-1 == next_read) {
+ return YY_EOF;
+ }
+ yy_buffer_read = yy_buffer_read + next_read;
+ }
- while (yy_buffer_index >= yy_buffer_read) {
- if (yy_buffer_index >= yy_buffer.length) {
- yy_buffer = yy_double(yy_buffer);
- }
- next_read = yy_reader.read(yy_buffer,
- yy_buffer_read,
- yy_buffer.length - yy_buffer_read);
- if (-1 == next_read) {
- return YY_EOF;
- }
- yy_buffer_read = yy_buffer_read + next_read;
- }
- return yy_buffer[yy_buffer_index++];
- }
- private void yy_move_end () {
- if (yy_buffer_end > yy_buffer_start &&
- '\n' == yy_buffer[yy_buffer_end-1])
- yy_buffer_end--;
- if (yy_buffer_end > yy_buffer_start &&
- '\r' == yy_buffer[yy_buffer_end-1])
- yy_buffer_end--;
- }
- private boolean yy_last_was_cr=false;
- private void yy_mark_start () {
- int i;
- for (i = yy_buffer_start; i < yy_buffer_index; ++i) {
- if ('\n' == yy_buffer[i] && !yy_last_was_cr) {
- ++yyline;
- }
- if ('\r' == yy_buffer[i]) {
- ++yyline;
- yy_last_was_cr=true;
- } else yy_last_was_cr=false;
- }
- yy_buffer_start = yy_buffer_index;
- }
- private void yy_mark_end () {
- yy_buffer_end = yy_buffer_index;
- }
- private void yy_to_mark () {
- yy_buffer_index = yy_buffer_end;
- yy_at_bol = (yy_buffer_end > yy_buffer_start) &&
- ('\r' == yy_buffer[yy_buffer_end-1] ||
- '\n' == yy_buffer[yy_buffer_end-1] ||
- 2028/*LS*/ == yy_buffer[yy_buffer_end-1] ||
- 2029/*PS*/ == yy_buffer[yy_buffer_end-1]);
- }
- private java.lang.String yytext () {
- return (new java.lang.String(yy_buffer,
- yy_buffer_start,
- yy_buffer_end - yy_buffer_start));
- }
- private char[] yy_double (char buf[]) {
- int i;
- char newbuf[];
- newbuf = new char[2*buf.length];
- for (i = 0; i < buf.length; ++i) {
- newbuf[i] = buf[i];
- }
- return newbuf;
- }
- private final int YY_E_INTERNAL = 0;
- private java.lang.String yy_error_string[] = {
- "Error: Internal error.\n",
- "Error: Unmatched input.\n"
- };
- private void yy_error (int code,boolean fatal) {
- java.lang.System.out.print(yy_error_string[code]);
- java.lang.System.out.flush();
- if (fatal) {
- throw new Error("Fatal Error.\n");
- }
- }
- private int[][] unpackFromString(int size1, int size2, String st) {
- int colonIndex = -1;
- String lengthString;
- int sequenceLength = 0;
- int sequenceInteger = 0;
+ while (yy_buffer_index >= yy_buffer_read) {
+ if (yy_buffer_index >= yy_buffer.length) {
+ yy_buffer = yy_double(yy_buffer);
+ }
+ next_read = yy_reader.read(yy_buffer,
+ yy_buffer_read,
+ yy_buffer.length - yy_buffer_read);
+ if (-1 == next_read) {
+ return YY_EOF;
+ }
+ yy_buffer_read = yy_buffer_read + next_read;
+ }
+ return yy_buffer[yy_buffer_index++];
+ }
+ private void yy_move_end () {
+ if (yy_buffer_end > yy_buffer_start &&
+ '\n' == yy_buffer[yy_buffer_end-1])
+ yy_buffer_end--;
+ if (yy_buffer_end > yy_buffer_start &&
+ '\r' == yy_buffer[yy_buffer_end-1])
+ yy_buffer_end--;
+ }
+ private boolean yy_last_was_cr=false;
+ private void yy_mark_start () {
+ int i;
+ for (i = yy_buffer_start; i < yy_buffer_index; ++i) {
+ if ('\n' == yy_buffer[i] && !yy_last_was_cr) {
+ ++yyline;
+ }
+ if ('\r' == yy_buffer[i]) {
+ ++yyline;
+ yy_last_was_cr=true;
+ } else yy_last_was_cr=false;
+ }
+ yy_buffer_start = yy_buffer_index;
+ }
+ private void yy_mark_end () {
+ yy_buffer_end = yy_buffer_index;
+ }
+ private void yy_to_mark () {
+ yy_buffer_index = yy_buffer_end;
+ yy_at_bol = (yy_buffer_end > yy_buffer_start) &&
+ ('\r' == yy_buffer[yy_buffer_end-1] ||
+ '\n' == yy_buffer[yy_buffer_end-1] ||
+ 2028/*LS*/ == yy_buffer[yy_buffer_end-1] ||
+ 2029/*PS*/ == yy_buffer[yy_buffer_end-1]);
+ }
+ private java.lang.String yytext () {
+ return (new java.lang.String(yy_buffer,
+ yy_buffer_start,
+ yy_buffer_end - yy_buffer_start));
+ }
+ private char[] yy_double (char buf[]) {
+ int i;
+ char newbuf[];
+ newbuf = new char[2*buf.length];
+ for (i = 0; i < buf.length; ++i) {
+ newbuf[i] = buf[i];
+ }
+ return newbuf;
+ }
+ private final int YY_E_INTERNAL = 0;
+ private java.lang.String yy_error_string[] = {
+ "Error: Internal error.\n",
+ "Error: Unmatched input.\n"
+ };
+ private void yy_error (int code,boolean fatal) {
+ java.lang.System.out.print(yy_error_string[code]);
+ java.lang.System.out.flush();
+ if (fatal) {
+ throw new Error("Fatal Error.\n");
+ }
+ }
+ private int[][] unpackFromString(int size1, int size2, String st) {
+ int colonIndex = -1;
+ String lengthString;
+ int sequenceLength = 0;
+ int sequenceInteger = 0;
- int commaIndex;
- String workString;
+ int commaIndex;
+ String workString;
- int res[][] = new int[size1][size2];
- for (int i= 0; i < size1; i++) {
- for (int j= 0; j < size2; j++) {
- if (sequenceLength != 0) {
- res[i][j] = sequenceInteger;
- sequenceLength--;
- continue;
- }
- commaIndex = st.indexOf(',');
- workString = (commaIndex==-1) ? st :
- st.substring(0, commaIndex);
- st = st.substring(commaIndex+1);
- colonIndex = workString.indexOf(':');
- if (colonIndex == -1) {
- res[i][j]=Integer.parseInt(workString);
- continue;
- }
- lengthString =
- workString.substring(colonIndex+1);
- sequenceLength=Integer.parseInt(lengthString);
- workString=workString.substring(0,colonIndex);
- sequenceInteger=Integer.parseInt(workString);
- res[i][j] = sequenceInteger;
- sequenceLength--;
- }
- }
- return res;
- }
- private int yy_acpt[] = {
- /* 0 */ YY_NOT_ACCEPT,
- /* 1 */ YY_NO_ANCHOR,
- /* 2 */ YY_NO_ANCHOR,
- /* 3 */ YY_NO_ANCHOR,
- /* 4 */ YY_NO_ANCHOR,
- /* 5 */ YY_NO_ANCHOR,
- /* 6 */ YY_NO_ANCHOR,
- /* 7 */ YY_NO_ANCHOR,
- /* 8 */ YY_NO_ANCHOR,
- /* 9 */ YY_NO_ANCHOR,
- /* 10 */ YY_NO_ANCHOR,
- /* 11 */ YY_NO_ANCHOR,
- /* 12 */ YY_NO_ANCHOR,
- /* 13 */ YY_NO_ANCHOR,
- /* 14 */ YY_NO_ANCHOR,
- /* 15 */ YY_NO_ANCHOR,
- /* 16 */ YY_NO_ANCHOR,
- /* 17 */ YY_NO_ANCHOR,
- /* 18 */ YY_NO_ANCHOR,
- /* 19 */ YY_NO_ANCHOR,
- /* 20 */ YY_NO_ANCHOR,
- /* 21 */ YY_NO_ANCHOR,
- /* 22 */ YY_NO_ANCHOR,
- /* 23 */ YY_NO_ANCHOR,
- /* 24 */ YY_NO_ANCHOR,
- /* 25 */ YY_NO_ANCHOR,
- /* 26 */ YY_NO_ANCHOR,
- /* 27 */ YY_NO_ANCHOR,
- /* 28 */ YY_NO_ANCHOR,
- /* 29 */ YY_NO_ANCHOR,
- /* 30 */ YY_NO_ANCHOR,
- /* 31 */ YY_NO_ANCHOR,
- /* 32 */ YY_NO_ANCHOR,
- /* 33 */ YY_NO_ANCHOR,
- /* 34 */ YY_NO_ANCHOR,
- /* 35 */ YY_NO_ANCHOR,
- /* 36 */ YY_NO_ANCHOR,
- /* 37 */ YY_NO_ANCHOR,
- /* 38 */ YY_NO_ANCHOR,
- /* 39 */ YY_NO_ANCHOR,
- /* 40 */ YY_NO_ANCHOR,
- /* 41 */ YY_NO_ANCHOR,
- /* 42 */ YY_NO_ANCHOR,
- /* 43 */ YY_NO_ANCHOR,
- /* 44 */ YY_NO_ANCHOR,
- /* 45 */ YY_NOT_ACCEPT,
- /* 46 */ YY_NO_ANCHOR,
- /* 47 */ YY_NO_ANCHOR,
- /* 48 */ YY_NO_ANCHOR,
- /* 49 */ YY_NOT_ACCEPT,
- /* 50 */ YY_NO_ANCHOR,
- /* 51 */ YY_NOT_ACCEPT,
- /* 52 */ YY_NO_ANCHOR,
- /* 53 */ YY_NOT_ACCEPT,
- /* 54 */ YY_NO_ANCHOR,
- /* 55 */ YY_NOT_ACCEPT,
- /* 56 */ YY_NO_ANCHOR,
- /* 57 */ YY_NOT_ACCEPT,
- /* 58 */ YY_NO_ANCHOR,
- /* 59 */ YY_NOT_ACCEPT,
- /* 60 */ YY_NO_ANCHOR,
- /* 61 */ YY_NOT_ACCEPT,
- /* 62 */ YY_NO_ANCHOR,
- /* 63 */ YY_NO_ANCHOR,
- /* 64 */ YY_NO_ANCHOR,
- /* 65 */ YY_NO_ANCHOR,
- /* 66 */ YY_NO_ANCHOR,
- /* 67 */ YY_NO_ANCHOR,
- /* 68 */ YY_NO_ANCHOR,
- /* 69 */ YY_NO_ANCHOR,
- /* 70 */ YY_NO_ANCHOR,
- /* 71 */ YY_NO_ANCHOR,
- /* 72 */ YY_NO_ANCHOR,
- /* 73 */ YY_NO_ANCHOR,
- /* 74 */ YY_NO_ANCHOR,
- /* 75 */ YY_NO_ANCHOR,
- /* 76 */ YY_NO_ANCHOR,
- /* 77 */ YY_NO_ANCHOR,
- /* 78 */ YY_NO_ANCHOR,
- /* 79 */ YY_NO_ANCHOR,
- /* 80 */ YY_NO_ANCHOR,
- /* 81 */ YY_NO_ANCHOR,
- /* 82 */ YY_NO_ANCHOR,
- /* 83 */ YY_NO_ANCHOR,
- /* 84 */ YY_NO_ANCHOR,
- /* 85 */ YY_NO_ANCHOR,
- /* 86 */ YY_NO_ANCHOR,
- /* 87 */ YY_NO_ANCHOR,
- /* 88 */ YY_NO_ANCHOR,
- /* 89 */ YY_NO_ANCHOR,
- /* 90 */ YY_NO_ANCHOR,
- /* 91 */ YY_NO_ANCHOR,
- /* 92 */ YY_NO_ANCHOR,
- /* 93 */ YY_NO_ANCHOR,
- /* 94 */ YY_NO_ANCHOR,
- /* 95 */ YY_NO_ANCHOR
- };
- private int yy_cmap[] = unpackFromString(1,65538,
+ int res[][] = new int[size1][size2];
+ for (int i= 0; i < size1; i++) {
+ for (int j= 0; j < size2; j++) {
+ if (sequenceLength != 0) {
+ res[i][j] = sequenceInteger;
+ sequenceLength--;
+ continue;
+ }
+ commaIndex = st.indexOf(',');
+ workString = (commaIndex==-1) ? st :
+ st.substring(0, commaIndex);
+ st = st.substring(commaIndex+1);
+ colonIndex = workString.indexOf(':');
+ if (colonIndex == -1) {
+ res[i][j]=Integer.parseInt(workString);
+ continue;
+ }
+ lengthString =
+ workString.substring(colonIndex+1);
+ sequenceLength=Integer.parseInt(lengthString);
+ workString=workString.substring(0,colonIndex);
+ sequenceInteger=Integer.parseInt(workString);
+ res[i][j] = sequenceInteger;
+ sequenceLength--;
+ }
+ }
+ return res;
+ }
+ private int yy_acpt[] = {
+ /* 0 */ YY_NOT_ACCEPT,
+ /* 1 */ YY_NO_ANCHOR,
+ /* 2 */ YY_NO_ANCHOR,
+ /* 3 */ YY_NO_ANCHOR,
+ /* 4 */ YY_NO_ANCHOR,
+ /* 5 */ YY_NO_ANCHOR,
+ /* 6 */ YY_NO_ANCHOR,
+ /* 7 */ YY_NO_ANCHOR,
+ /* 8 */ YY_NO_ANCHOR,
+ /* 9 */ YY_NO_ANCHOR,
+ /* 10 */ YY_NO_ANCHOR,
+ /* 11 */ YY_NO_ANCHOR,
+ /* 12 */ YY_NO_ANCHOR,
+ /* 13 */ YY_NO_ANCHOR,
+ /* 14 */ YY_NO_ANCHOR,
+ /* 15 */ YY_NO_ANCHOR,
+ /* 16 */ YY_NO_ANCHOR,
+ /* 17 */ YY_NO_ANCHOR,
+ /* 18 */ YY_NO_ANCHOR,
+ /* 19 */ YY_NO_ANCHOR,
+ /* 20 */ YY_NO_ANCHOR,
+ /* 21 */ YY_NO_ANCHOR,
+ /* 22 */ YY_NO_ANCHOR,
+ /* 23 */ YY_NO_ANCHOR,
+ /* 24 */ YY_NO_ANCHOR,
+ /* 25 */ YY_NO_ANCHOR,
+ /* 26 */ YY_NO_ANCHOR,
+ /* 27 */ YY_NO_ANCHOR,
+ /* 28 */ YY_NO_ANCHOR,
+ /* 29 */ YY_NO_ANCHOR,
+ /* 30 */ YY_NO_ANCHOR,
+ /* 31 */ YY_NO_ANCHOR,
+ /* 32 */ YY_NO_ANCHOR,
+ /* 33 */ YY_NO_ANCHOR,
+ /* 34 */ YY_NO_ANCHOR,
+ /* 35 */ YY_NO_ANCHOR,
+ /* 36 */ YY_NO_ANCHOR,
+ /* 37 */ YY_NO_ANCHOR,
+ /* 38 */ YY_NO_ANCHOR,
+ /* 39 */ YY_NO_ANCHOR,
+ /* 40 */ YY_NO_ANCHOR,
+ /* 41 */ YY_NO_ANCHOR,
+ /* 42 */ YY_NO_ANCHOR,
+ /* 43 */ YY_NO_ANCHOR,
+ /* 44 */ YY_NO_ANCHOR,
+ /* 45 */ YY_NOT_ACCEPT,
+ /* 46 */ YY_NO_ANCHOR,
+ /* 47 */ YY_NO_ANCHOR,
+ /* 48 */ YY_NO_ANCHOR,
+ /* 49 */ YY_NOT_ACCEPT,
+ /* 50 */ YY_NO_ANCHOR,
+ /* 51 */ YY_NOT_ACCEPT,
+ /* 52 */ YY_NO_ANCHOR,
+ /* 53 */ YY_NOT_ACCEPT,
+ /* 54 */ YY_NO_ANCHOR,
+ /* 55 */ YY_NOT_ACCEPT,
+ /* 56 */ YY_NO_ANCHOR,
+ /* 57 */ YY_NOT_ACCEPT,
+ /* 58 */ YY_NO_ANCHOR,
+ /* 59 */ YY_NOT_ACCEPT,
+ /* 60 */ YY_NO_ANCHOR,
+ /* 61 */ YY_NOT_ACCEPT,
+ /* 62 */ YY_NO_ANCHOR,
+ /* 63 */ YY_NO_ANCHOR,
+ /* 64 */ YY_NO_ANCHOR,
+ /* 65 */ YY_NO_ANCHOR,
+ /* 66 */ YY_NO_ANCHOR,
+ /* 67 */ YY_NO_ANCHOR,
+ /* 68 */ YY_NO_ANCHOR,
+ /* 69 */ YY_NO_ANCHOR,
+ /* 70 */ YY_NO_ANCHOR,
+ /* 71 */ YY_NO_ANCHOR,
+ /* 72 */ YY_NO_ANCHOR,
+ /* 73 */ YY_NO_ANCHOR,
+ /* 74 */ YY_NO_ANCHOR,
+ /* 75 */ YY_NO_ANCHOR,
+ /* 76 */ YY_NO_ANCHOR,
+ /* 77 */ YY_NO_ANCHOR,
+ /* 78 */ YY_NO_ANCHOR,
+ /* 79 */ YY_NO_ANCHOR,
+ /* 80 */ YY_NO_ANCHOR,
+ /* 81 */ YY_NO_ANCHOR,
+ /* 82 */ YY_NO_ANCHOR,
+ /* 83 */ YY_NO_ANCHOR,
+ /* 84 */ YY_NO_ANCHOR,
+ /* 85 */ YY_NO_ANCHOR,
+ /* 86 */ YY_NO_ANCHOR,
+ /* 87 */ YY_NO_ANCHOR,
+ /* 88 */ YY_NO_ANCHOR,
+ /* 89 */ YY_NO_ANCHOR,
+ /* 90 */ YY_NO_ANCHOR,
+ /* 91 */ YY_NO_ANCHOR,
+ /* 92 */ YY_NO_ANCHOR,
+ /* 93 */ YY_NO_ANCHOR,
+ /* 94 */ YY_NO_ANCHOR,
+ /* 95 */ YY_NO_ANCHOR
+ };
+ private int yy_cmap[] = unpackFromString(1,65538,
"49:9,51,52,49,51,52,49:18,51,49,47,49:2,7,42,49,8,9,5,3,2,4,45,6,46,43:9,49" +
",1,12,11,10,49:2,13,18,17,15,20,21,28,32,22,41:2,25,41,14,26,30,41,23,16,24" +
",27,41,31,29,19,41,49,48,49:2,44,49,38,41:3,36,37,41:5,39,41,50,41:3,34,40," +
"33,35,41:5,49:69,41:23,49,41:31,49,41:8,49:65280,0:2")[0];
- private int yy_rmap[] = unpackFromString(1,96,
+ private int yy_rmap[] = unpackFromString(1,96,
"0,1:10,2,1,3,4,5,1:5,6,7,8,9,7:12,1:8,10,11,12,13,14,15,12,16,13,17,14,18,1" +
"9,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,4" +
"4,45,46,47,48,49,7,50,51,52,53,54,55,56")[0];
- private int yy_nxt[][] = unpackFromString(57,53,
+ private int yy_nxt[][] = unpackFromString(57,53,
"1,2,3,4,5,6,7,8,9,10,11,12,13,14,46,81,85,88,50,88:2,90,88,91,88,92,52,88:4" +
",93,88,94,88:3,95,88:5,15,-1,45,47,16,-1:2,88,17:2,-1:64,18,-1:51,19,20,-1:" +
"54,88,54,88,21,88:25,-1,88:2,-1,88,-1:3,88,-1:22,49,-1:15,49,-1:6,15,-1,45," +
@@ -350,414 +350,414 @@ public class Yylex implements java_cup.runtime.Scanner {
"-1:3,88,-1:15,88:19,64,88:9,-1,88:2,-1,88,-1:3,88,-1:15,88:21,65,88:7,-1,88" +
":2,-1,88,-1:3,88,-1:15,88:25,66,88:3,-1,88:2,-1,88,-1:3,88,-1:2");
- public java_cup.runtime.Symbol next_token ()
- throws java.io.IOException {
- int yy_lookahead;
- int yy_anchor = YY_NO_ANCHOR;
- int yy_state = yy_state_dtrans[yy_lexical_state];
- int yy_next_state = YY_NO_STATE;
- int yy_last_accept_state = YY_NO_STATE;
- boolean yy_initial = true;
- int yy_this_accept;
+ public java_cup.runtime.Symbol next_token ()
+ throws java.io.IOException {
+ int yy_lookahead;
+ int yy_anchor = YY_NO_ANCHOR;
+ int yy_state = yy_state_dtrans[yy_lexical_state];
+ int yy_next_state = YY_NO_STATE;
+ int yy_last_accept_state = YY_NO_STATE;
+ boolean yy_initial = true;
+ int yy_this_accept;
- yy_mark_start();
- yy_this_accept = yy_acpt[yy_state];
- if (YY_NOT_ACCEPT != yy_this_accept) {
- yy_last_accept_state = yy_state;
- yy_mark_end();
- }
- while (true) {
- if (yy_initial && yy_at_bol) yy_lookahead = YY_BOL;
- else yy_lookahead = yy_advance();
- yy_next_state = YY_F;
- yy_next_state = yy_nxt[yy_rmap[yy_state]][yy_cmap[yy_lookahead]];
- if (YY_EOF == yy_lookahead && true == yy_initial) {
- return null;
- }
- if (YY_F != yy_next_state) {
- yy_state = yy_next_state;
- yy_initial = false;
- yy_this_accept = yy_acpt[yy_state];
- if (YY_NOT_ACCEPT != yy_this_accept) {
- yy_last_accept_state = yy_state;
- yy_mark_end();
- }
- }
- else {
- if (YY_NO_STATE == yy_last_accept_state) {
- throw (new Error("Lexical Error: Unmatched Input."));
- }
- else {
- yy_anchor = yy_acpt[yy_last_accept_state];
- if (0 != (YY_END & yy_anchor)) {
- yy_move_end();
- }
- yy_to_mark();
- switch (yy_last_accept_state) {
- case 1:
-
- case -2:
- break;
- case 2:
- { return new Symbol(sym._SYMB_0); }
- case -3:
- break;
- case 3:
- { return new Symbol(sym._SYMB_1); }
- case -4:
- break;
- case 4:
- { return new Symbol(sym._SYMB_2); }
- case -5:
- break;
- case 5:
- { return new Symbol(sym._SYMB_3); }
- case -6:
- break;
- case 6:
- { return new Symbol(sym._SYMB_4); }
- case -7:
- break;
- case 7:
- { return new Symbol(sym._SYMB_5); }
- case -8:
- break;
- case 8:
- { return new Symbol(sym._SYMB_6); }
- case -9:
- break;
- case 9:
- { return new Symbol(sym._SYMB_7); }
- case -10:
- break;
- case 10:
- { return new Symbol(sym._SYMB_8); }
- case -11:
- break;
- case 11:
- { return new Symbol(sym._SYMB_9); }
- case -12:
- break;
- case 12:
- { return new Symbol(sym._SYMB_10); }
- case -13:
- break;
- case 13:
- { return new Symbol(sym._SYMB_12); }
- case -14:
- break;
- case 14:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -15:
- break;
- case 15:
- { return new Symbol(sym.QInteger, yytext().intern()); }
- case -16:
- break;
- case 16:
- { yybegin(STRING); }
- case -17:
- break;
- case 17:
- { /* ignore white space. */ }
- case -18:
- break;
- case 18:
- { return new Symbol(sym._SYMB_14); }
- case -19:
- break;
- case 19:
- { return new Symbol(sym._SYMB_11); }
- case -20:
- break;
- case 20:
- { return new Symbol(sym._SYMB_13); }
- case -21:
- break;
- case 21:
- { return new Symbol(sym._SYMB_16); }
- case -22:
- break;
- case 22:
- { return new Symbol(sym._SYMB_18); }
- case -23:
- break;
- case 23:
- { return new Symbol(sym._SYMB_24); }
- case -24:
- break;
- case 24:
- { return new Symbol(sym.QDouble, yytext().intern()); }
- case -25:
- break;
- case 25:
- { return new Symbol(sym._SYMB_15); }
- case -26:
- break;
- case 26:
- { return new Symbol(sym._SYMB_17); }
- case -27:
- break;
- case 27:
- { return new Symbol(sym._SYMB_22); }
- case -28:
- break;
- case 28:
- { return new Symbol(sym._SYMB_19); }
- case -29:
- break;
- case 29:
- { return new Symbol(sym._SYMB_21); }
- case -30:
- break;
- case 30:
- { return new Symbol(sym.QBool, yytext().intern()); }
- case -31:
- break;
- case 31:
- { return new Symbol(sym._SYMB_23); }
- case -32:
- break;
- case 32:
- { return new Symbol(sym._SYMB_20); }
- case -33:
- break;
- case 33:
- { return new Symbol(sym._SYMB_25); }
- case -34:
- break;
- case 34:
- { return new Symbol(sym._SYMB_28); }
- case -35:
- break;
- case 35:
- { return new Symbol(sym._SYMB_27); }
- case -36:
- break;
- case 36:
- { return new Symbol(sym._SYMB_26); }
- case -37:
- break;
- case 37:
- { pstring += yytext(); }
- case -38:
- break;
- case 38:
- { String foo = pstring; pstring = new String(); yybegin(YYINITIAL); return new Symbol(sym._STRING_, foo.intern()); }
- case -39:
- break;
- case 39:
- { yybegin(ESCAPED); }
- case -40:
- break;
- case 40:
- { pstring += yytext(); yybegin(STRING); }
- case -41:
- break;
- case 41:
- { pstring += "\t"; yybegin(STRING); }
- case -42:
- break;
- case 42:
- { pstring += "\""; yybegin(STRING); }
- case -43:
- break;
- case 43:
- { pstring += "\\"; yybegin(STRING); }
- case -44:
- break;
- case 44:
- { pstring += "\n"; yybegin(STRING); }
- case -45:
- break;
- case 46:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -46:
- break;
- case 47:
- { return new Symbol(sym.QInteger, yytext().intern()); }
- case -47:
- break;
- case 48:
- { return new Symbol(sym.QDouble, yytext().intern()); }
- case -48:
- break;
- case 50:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -49:
- break;
- case 52:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -50:
- break;
- case 54:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -51:
- break;
- case 56:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -52:
- break;
- case 58:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -53:
- break;
- case 60:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -54:
- break;
- case 62:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -55:
- break;
- case 63:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -56:
- break;
- case 64:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -57:
- break;
- case 65:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -58:
- break;
- case 66:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -59:
- break;
- case 67:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -60:
- break;
- case 68:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -61:
- break;
- case 69:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -62:
- break;
- case 70:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -63:
- break;
- case 71:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -64:
- break;
- case 72:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -65:
- break;
- case 73:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -66:
- break;
- case 74:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -67:
- break;
- case 75:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -68:
- break;
- case 76:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -69:
- break;
- case 77:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -70:
- break;
- case 78:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -71:
- break;
- case 79:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -72:
- break;
- case 80:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -73:
- break;
- case 81:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -74:
- break;
- case 82:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -75:
- break;
- case 83:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -76:
- break;
- case 84:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -77:
- break;
- case 85:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -78:
- break;
- case 86:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -79:
- break;
- case 87:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -80:
- break;
- case 88:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -81:
- break;
- case 89:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -82:
- break;
- case 90:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -83:
- break;
- case 91:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -84:
- break;
- case 92:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -85:
- break;
- case 93:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -86:
- break;
- case 94:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -87:
- break;
- case 95:
- { return new Symbol(sym.QIdent, yytext().intern()); }
- case -88:
- break;
- default:
- yy_error(YY_E_INTERNAL,false);
- case -1:
- }
- yy_initial = true;
- yy_state = yy_state_dtrans[yy_lexical_state];
- yy_next_state = YY_NO_STATE;
- yy_last_accept_state = YY_NO_STATE;
- yy_mark_start();
- yy_this_accept = yy_acpt[yy_state];
- if (YY_NOT_ACCEPT != yy_this_accept) {
- yy_last_accept_state = yy_state;
- yy_mark_end();
- }
- }
- }
- }
- }
+ yy_mark_start();
+ yy_this_accept = yy_acpt[yy_state];
+ if (YY_NOT_ACCEPT != yy_this_accept) {
+ yy_last_accept_state = yy_state;
+ yy_mark_end();
+ }
+ while (true) {
+ if (yy_initial && yy_at_bol) yy_lookahead = YY_BOL;
+ else yy_lookahead = yy_advance();
+ yy_next_state = YY_F;
+ yy_next_state = yy_nxt[yy_rmap[yy_state]][yy_cmap[yy_lookahead]];
+ if (YY_EOF == yy_lookahead && true == yy_initial) {
+ return null;
+ }
+ if (YY_F != yy_next_state) {
+ yy_state = yy_next_state;
+ yy_initial = false;
+ yy_this_accept = yy_acpt[yy_state];
+ if (YY_NOT_ACCEPT != yy_this_accept) {
+ yy_last_accept_state = yy_state;
+ yy_mark_end();
+ }
+ }
+ else {
+ if (YY_NO_STATE == yy_last_accept_state) {
+ throw (new Error("Lexical Error: Unmatched Input."));
+ }
+ else {
+ yy_anchor = yy_acpt[yy_last_accept_state];
+ if (0 != (YY_END & yy_anchor)) {
+ yy_move_end();
+ }
+ yy_to_mark();
+ switch (yy_last_accept_state) {
+ case 1:
+
+ case -2:
+ break;
+ case 2:
+ { return new Symbol(sym._SYMB_0); }
+ case -3:
+ break;
+ case 3:
+ { return new Symbol(sym._SYMB_1); }
+ case -4:
+ break;
+ case 4:
+ { return new Symbol(sym._SYMB_2); }
+ case -5:
+ break;
+ case 5:
+ { return new Symbol(sym._SYMB_3); }
+ case -6:
+ break;
+ case 6:
+ { return new Symbol(sym._SYMB_4); }
+ case -7:
+ break;
+ case 7:
+ { return new Symbol(sym._SYMB_5); }
+ case -8:
+ break;
+ case 8:
+ { return new Symbol(sym._SYMB_6); }
+ case -9:
+ break;
+ case 9:
+ { return new Symbol(sym._SYMB_7); }
+ case -10:
+ break;
+ case 10:
+ { return new Symbol(sym._SYMB_8); }
+ case -11:
+ break;
+ case 11:
+ { return new Symbol(sym._SYMB_9); }
+ case -12:
+ break;
+ case 12:
+ { return new Symbol(sym._SYMB_10); }
+ case -13:
+ break;
+ case 13:
+ { return new Symbol(sym._SYMB_12); }
+ case -14:
+ break;
+ case 14:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -15:
+ break;
+ case 15:
+ { return new Symbol(sym.QInteger, yytext().intern()); }
+ case -16:
+ break;
+ case 16:
+ { yybegin(STRING); }
+ case -17:
+ break;
+ case 17:
+ { /* ignore white space. */ }
+ case -18:
+ break;
+ case 18:
+ { return new Symbol(sym._SYMB_14); }
+ case -19:
+ break;
+ case 19:
+ { return new Symbol(sym._SYMB_11); }
+ case -20:
+ break;
+ case 20:
+ { return new Symbol(sym._SYMB_13); }
+ case -21:
+ break;
+ case 21:
+ { return new Symbol(sym._SYMB_16); }
+ case -22:
+ break;
+ case 22:
+ { return new Symbol(sym._SYMB_18); }
+ case -23:
+ break;
+ case 23:
+ { return new Symbol(sym._SYMB_24); }
+ case -24:
+ break;
+ case 24:
+ { return new Symbol(sym.QDouble, yytext().intern()); }
+ case -25:
+ break;
+ case 25:
+ { return new Symbol(sym._SYMB_15); }
+ case -26:
+ break;
+ case 26:
+ { return new Symbol(sym._SYMB_17); }
+ case -27:
+ break;
+ case 27:
+ { return new Symbol(sym._SYMB_22); }
+ case -28:
+ break;
+ case 28:
+ { return new Symbol(sym._SYMB_19); }
+ case -29:
+ break;
+ case 29:
+ { return new Symbol(sym._SYMB_21); }
+ case -30:
+ break;
+ case 30:
+ { return new Symbol(sym.QBool, yytext().intern()); }
+ case -31:
+ break;
+ case 31:
+ { return new Symbol(sym._SYMB_23); }
+ case -32:
+ break;
+ case 32:
+ { return new Symbol(sym._SYMB_20); }
+ case -33:
+ break;
+ case 33:
+ { return new Symbol(sym._SYMB_25); }
+ case -34:
+ break;
+ case 34:
+ { return new Symbol(sym._SYMB_28); }
+ case -35:
+ break;
+ case 35:
+ { return new Symbol(sym._SYMB_27); }
+ case -36:
+ break;
+ case 36:
+ { return new Symbol(sym._SYMB_26); }
+ case -37:
+ break;
+ case 37:
+ { pstring += yytext(); }
+ case -38:
+ break;
+ case 38:
+ { String foo = pstring; pstring = new String(); yybegin(YYINITIAL); return new Symbol(sym._STRING_, foo.intern()); }
+ case -39:
+ break;
+ case 39:
+ { yybegin(ESCAPED); }
+ case -40:
+ break;
+ case 40:
+ { pstring += yytext(); yybegin(STRING); }
+ case -41:
+ break;
+ case 41:
+ { pstring += "\t"; yybegin(STRING); }
+ case -42:
+ break;
+ case 42:
+ { pstring += "\""; yybegin(STRING); }
+ case -43:
+ break;
+ case 43:
+ { pstring += "\\"; yybegin(STRING); }
+ case -44:
+ break;
+ case 44:
+ { pstring += "\n"; yybegin(STRING); }
+ case -45:
+ break;
+ case 46:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -46:
+ break;
+ case 47:
+ { return new Symbol(sym.QInteger, yytext().intern()); }
+ case -47:
+ break;
+ case 48:
+ { return new Symbol(sym.QDouble, yytext().intern()); }
+ case -48:
+ break;
+ case 50:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -49:
+ break;
+ case 52:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -50:
+ break;
+ case 54:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -51:
+ break;
+ case 56:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -52:
+ break;
+ case 58:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -53:
+ break;
+ case 60:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -54:
+ break;
+ case 62:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -55:
+ break;
+ case 63:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -56:
+ break;
+ case 64:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -57:
+ break;
+ case 65:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -58:
+ break;
+ case 66:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -59:
+ break;
+ case 67:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -60:
+ break;
+ case 68:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -61:
+ break;
+ case 69:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -62:
+ break;
+ case 70:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -63:
+ break;
+ case 71:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -64:
+ break;
+ case 72:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -65:
+ break;
+ case 73:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -66:
+ break;
+ case 74:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -67:
+ break;
+ case 75:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -68:
+ break;
+ case 76:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -69:
+ break;
+ case 77:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -70:
+ break;
+ case 78:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -71:
+ break;
+ case 79:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -72:
+ break;
+ case 80:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -73:
+ break;
+ case 81:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -74:
+ break;
+ case 82:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -75:
+ break;
+ case 83:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -76:
+ break;
+ case 84:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -77:
+ break;
+ case 85:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -78:
+ break;
+ case 86:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -79:
+ break;
+ case 87:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -80:
+ break;
+ case 88:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -81:
+ break;
+ case 89:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -82:
+ break;
+ case 90:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -83:
+ break;
+ case 91:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -84:
+ break;
+ case 92:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -85:
+ break;
+ case 93:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -86:
+ break;
+ case 94:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -87:
+ break;
+ case 95:
+ { return new Symbol(sym.QIdent, yytext().intern()); }
+ case -88:
+ break;
+ default:
+ yy_error(YY_E_INTERNAL,false);
+ case -1:
+ }
+ yy_initial = true;
+ yy_state = yy_state_dtrans[yy_lexical_state];
+ yy_next_state = YY_NO_STATE;
+ yy_last_accept_state = YY_NO_STATE;
+ yy_mark_start();
+ yy_this_accept = yy_acpt[yy_state];
+ if (YY_NOT_ACCEPT != yy_this_accept) {
+ yy_last_accept_state = yy_state;
+ yy_mark_end();
+ }
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/parser.java b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/parser.java
index 85a196b..cae6b9a 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/parser.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/parser.java
@@ -22,7 +22,7 @@ public class parser extends java_cup.runtime.lr_parser {
public parser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}
/** Production table. */
- protected static final short _production_table[][] =
+ protected static final short _production_table[][] =
unpackFromStrings(new String[] {
"\000\071\000\002\002\004\000\002\002\003\000\002\002" +
"\005\000\002\003\003\000\002\003\005\000\002\004\003" +
@@ -47,7 +47,7 @@ public class parser extends java_cup.runtime.lr_parser {
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
- protected static final short[][] _action_table =
+ protected static final short[][] _action_table =
unpackFromStrings(new String[] {
"\000\124\000\004\037\006\001\002\000\004\002\126\001" +
"\002\000\006\002\000\004\124\001\002\000\022\007\024" +
@@ -206,7 +206,7 @@ public class parser extends java_cup.runtime.lr_parser {
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
- protected static final short[][] _reduce_table =
+ protected static final short[][] _reduce_table =
unpackFromStrings(new String[] {
"\000\124\000\010\002\006\006\003\007\004\001\001\000" +
"\002\001\001\000\002\001\001\000\026\004\016\015\026" +
@@ -293,20 +293,20 @@ public class parser extends java_cup.runtime.lr_parser {
public pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Program pProgram() throws Exception
{
- java_cup.runtime.Symbol res = parse();
- return (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Program) res.value;
+ java_cup.runtime.Symbol res = parse();
+ return (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Program) res.value;
}
public <B,A extends java.util.LinkedList<? super B>> A cons_(B x, A xs) { xs.addFirst(x); return xs; }
public void syntax_error(java_cup.runtime.Symbol cur_token)
{
- report_error("Syntax Error, trying to recover and continue parse...", cur_token);
+ report_error("Syntax Error, trying to recover and continue parse...", cur_token);
}
public void unrecovered_syntax_error(java_cup.runtime.Symbol cur_token) throws java.lang.Exception
{
- throw new Exception("Unrecoverable Syntax Error");
+ throw new Exception("Unrecoverable Syntax Error");
}
@@ -336,576 +336,576 @@ class CUP$parser$actions {
switch (CUP$parser$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
- case 56: // RelOp ::= _SYMB_14
+ case 56: // RelOp ::= _SYMB_14
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOp RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOpGeC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOpGeC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("RelOp",20, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 55: // RelOp ::= _SYMB_13
+ case 55: // RelOp ::= _SYMB_13
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOp RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOpLeC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOpLeC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("RelOp",20, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 54: // RelOp ::= _SYMB_12
+ case 54: // RelOp ::= _SYMB_12
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOp RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOpLtC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOpLtC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("RelOp",20, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 53: // RelOp ::= _SYMB_11
+ case 53: // RelOp ::= _SYMB_11
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOp RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOpNeC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOpNeC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("RelOp",20, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 52: // RelOp ::= _SYMB_10
+ case 52: // RelOp ::= _SYMB_10
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOp RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOpEqC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOpEqC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("RelOp",20, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 51: // RelOp ::= _SYMB_9
+ case 51: // RelOp ::= _SYMB_9
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOp RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOpGtC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOpGtC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("RelOp",20, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 50: // BasicExpr3 ::= _SYMB_7 Statement _SYMB_8
+ case 50: // BasicExpr3 ::= _SYMB_7 Statement _SYMB_8
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EStmtC(p_2);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EStmtC(p_2);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr3",19, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 49: // BasicExpr3 ::= _SYMB_7 CondExpr _SYMB_8
+ case 49: // BasicExpr3 ::= _SYMB_7 CondExpr _SYMB_8
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ECondExprC(p_2);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ECondExprC(p_2);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr3",19, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 48: // BasicExpr3 ::= QDouble
+ case 48: // BasicExpr3 ::= QDouble
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EDblC(p_1);
+ String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EDblC(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr3",19, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 47: // BasicExpr3 ::= QInteger
+ case 47: // BasicExpr3 ::= QInteger
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EIntC(p_1);
+ String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EIntC(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr3",19, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 46: // BasicExpr3 ::= _STRING_
+ case 46: // BasicExpr3 ::= _STRING_
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EStrC(p_1);
+ String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EStrC(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr3",19, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 45: // BasicExpr3 ::= QIdent _SYMB_7 ListCondExpr _SYMB_8
+ case 45: // BasicExpr3 ::= QIdent _SYMB_7 ListCondExpr _SYMB_8
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EFunC(p_1,p_3);
+ String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EFunC(p_1,p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr3",19, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 44: // BasicExpr3 ::= QIdent
+ case 44: // BasicExpr3 ::= QIdent
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EIdentC(p_1);
+ String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EIdentC(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr3",19, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 43: // BasicExpr3 ::= QBool
+ case 43: // BasicExpr3 ::= QBool
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EBoolC(p_1);
+ String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.EBoolC(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr3",19, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 42: // BasicExpr2 ::= BasicExpr3
+ case 42: // BasicExpr2 ::= BasicExpr3
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = p_1;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = p_1;
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr2",18, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 41: // BasicExpr2 ::= _SYMB_3 BasicExpr2
+ case 41: // BasicExpr2 ::= _SYMB_3 BasicExpr2
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExprNegC(p_2);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExprNegC(p_2);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr2",18, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 40: // BasicExpr1 ::= BasicExpr2
+ case 40: // BasicExpr1 ::= BasicExpr2
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = p_1;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = p_1;
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr1",17, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 39: // BasicExpr1 ::= BasicExpr1 _SYMB_6 BasicExpr2
+ case 39: // BasicExpr1 ::= BasicExpr1 _SYMB_6 BasicExpr2
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExprModC(p_1,p_3);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExprModC(p_1,p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr1",17, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 38: // BasicExpr1 ::= BasicExpr1 _SYMB_5 BasicExpr2
+ case 38: // BasicExpr1 ::= BasicExpr1 _SYMB_5 BasicExpr2
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExprDivC(p_1,p_3);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExprDivC(p_1,p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr1",17, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 37: // BasicExpr1 ::= BasicExpr1 _SYMB_4 BasicExpr2
+ case 37: // BasicExpr1 ::= BasicExpr1 _SYMB_4 BasicExpr2
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExprMulC(p_1,p_3);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExprMulC(p_1,p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr1",17, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 36: // BasicExpr ::= BasicExpr1
+ case 36: // BasicExpr ::= BasicExpr1
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = p_1;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = p_1;
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr",16, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 35: // BasicExpr ::= BasicExpr _SYMB_3 BasicExpr1
+ case 35: // BasicExpr ::= BasicExpr _SYMB_3 BasicExpr1
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExprSubC(p_1,p_3);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExprSubC(p_1,p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr",16, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 34: // BasicExpr ::= BasicExpr _SYMB_2 BasicExpr1
+ case 34: // BasicExpr ::= BasicExpr _SYMB_2 BasicExpr1
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExprAddC(p_1,p_3);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExprAddC(p_1,p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BasicExpr",16, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 33: // CondExpr2 ::= BoolExpr
+ case 33: // CondExpr2 ::= BoolExpr
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExprBoolExprC(p_1);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExprBoolExprC(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("CondExpr2",15, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 32: // CondExpr2 ::= _SYMB_22 CondExpr2
+ case 32: // CondExpr2 ::= _SYMB_22 CondExpr2
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExprNotC(p_2);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExprNotC(p_2);
CUP$parser$result = parser.getSymbolFactory().newSymbol("CondExpr2",15, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 31: // CondExpr1 ::= CondExpr2
+ case 31: // CondExpr1 ::= CondExpr2
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = p_1;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = p_1;
CUP$parser$result = parser.getSymbolFactory().newSymbol("CondExpr1",14, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 30: // CondExpr1 ::= CondExpr1 _SYMB_15 CondExpr2
+ case 30: // CondExpr1 ::= CondExpr1 _SYMB_15 CondExpr2
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExprAndC(p_1,p_3);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExprAndC(p_1,p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("CondExpr1",14, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 29: // CondExpr ::= CondExpr1
+ case 29: // CondExpr ::= CondExpr1
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = p_1;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = p_1;
CUP$parser$result = parser.getSymbolFactory().newSymbol("CondExpr",13, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 28: // CondExpr ::= CondExpr _SYMB_24 CondExpr1
+ case 28: // CondExpr ::= CondExpr _SYMB_24 CondExpr1
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExprOrC(p_1,p_3);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExprOrC(p_1,p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("CondExpr",13, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 27: // BoolExpr ::= BasicExpr
+ case 27: // BoolExpr ::= BasicExpr
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExprBasicExprC(p_1);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExprBasicExprC(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BoolExpr",12, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 26: // BoolExpr ::= BasicExpr _SYMB_26 _STRING_
+ case 26: // BoolExpr ::= BasicExpr _SYMB_26 _STRING_
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- String p_3 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExprRegExpC(p_1,p_3);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ String p_3 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExprRegExpC(p_1,p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BoolExpr",12, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 25: // BoolExpr ::= BasicExpr RelOp BasicExpr
+ case 25: // BoolExpr ::= BasicExpr RelOp BasicExpr
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOp p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOp)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExprCmpC(p_1,p_2,p_3);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOp p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.RelOp)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BasicExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.BoolExprCmpC(p_1,p_2,p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("BoolExpr",12, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 24: // SelItem ::= CondExpr _SYMB_16 QIdent
+ case 24: // SelItem ::= CondExpr _SYMB_16 QIdent
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.SelItem RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- String p_3 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.AliasedSelItemC(p_1,p_3);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ String p_3 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.AliasedSelItemC(p_1,p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("SelItem",11, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 23: // SelItem ::= CondExpr
+ case 23: // SelItem ::= CondExpr
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.SelItem RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.SelItemC(p_1);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.SelItemC(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("SelItem",11, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 22: // Nulls ::= _SYMB_23 _SYMB_21
+ case 22: // Nulls ::= _SYMB_23 _SYMB_21
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Nulls RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.NullsLastC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.NullsLastC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("Nulls",10, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 21: // Nulls ::= _SYMB_23 _SYMB_20
+ case 21: // Nulls ::= _SYMB_23 _SYMB_20
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Nulls RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.NullFirstsC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.NullFirstsC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("Nulls",10, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 20: // Nulls ::=
+ case 20: // Nulls ::=
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Nulls RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.NoNullsC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.NoNullsC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("Nulls",10, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 19: // Order ::=
+ case 19: // Order ::=
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Order RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.NoOrderC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.NoOrderC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("Order",9, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 18: // Order ::= _SYMB_19
+ case 18: // Order ::= _SYMB_19
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Order RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.DescOrderC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.DescOrderC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("Order",9, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 17: // Order ::= _SYMB_17
+ case 17: // Order ::= _SYMB_17
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Order RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.AscOrderC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.AscOrderC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("Order",9, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 16: // OrderItem ::= CondExpr Order Nulls
+ case 16: // OrderItem ::= CondExpr Order Nulls
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderItem RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Order p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Order)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Nulls p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Nulls)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderItemC(p_1,p_2,p_3);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Order p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Order)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Nulls p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Nulls)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderItemC(p_1,p_2,p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("OrderItem",8, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 15: // OrderBy ::= _SYMB_25 _SYMB_18 ListOrderItem
+ case 15: // OrderBy ::= _SYMB_25 _SYMB_18 ListOrderItem
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderBy RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListOrderItem p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListOrderItem)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderByC(p_3);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListOrderItem p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListOrderItem)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderByC(p_3);
CUP$parser$result = parser.getSymbolFactory().newSymbol("OrderBy",7, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 14: // OrderBy ::=
+ case 14: // OrderBy ::=
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderBy RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.NoOrderByC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.NoOrderByC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("OrderBy",7, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 13: // Where ::= _SYMB_28 CondExpr
+ case 13: // Where ::= _SYMB_28 CondExpr
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Where RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.WhereC(p_2);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.WhereC(p_2);
CUP$parser$result = parser.getSymbolFactory().newSymbol("Where",6, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 12: // Where ::=
+ case 12: // Where ::=
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Where RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.NoWhereC();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.NoWhereC();
CUP$parser$result = parser.getSymbolFactory().newSymbol("Where",6, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 11: // Statement ::= _SYMB_27 ListSelItem Where OrderBy
+ case 11: // Statement ::= _SYMB_27 ListSelItem Where OrderBy
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListSelItem p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListSelItem)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Where p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Where)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderBy p_4 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderBy)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.StatementC(p_2,p_3,p_4);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListSelItem p_2 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListSelItem)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Where p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Where)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderBy p_4 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderBy)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.StatementC(p_2,p_3,p_4);
CUP$parser$result = parser.getSymbolFactory().newSymbol("Statement",5, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 10: // Program ::= ListStatement
+ case 10: // Program ::= ListStatement
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Program RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListStatement p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListStatement)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ProgramC(p_1);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListStatement p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListStatement)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ProgramC(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("Program",4, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 9: // ListCondExpr ::= CondExpr _SYMB_1 ListCondExpr
+ case 9: // ListCondExpr ::= CondExpr _SYMB_1 ListCondExpr
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = p_3; p_3.addFirst(p_1);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = p_3; p_3.addFirst(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("ListCondExpr",3, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 8: // ListCondExpr ::= CondExpr
+ case 8: // ListCondExpr ::= CondExpr
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr(); RESULT.addLast(p_1);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.CondExpr)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr(); RESULT.addLast(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("ListCondExpr",3, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 7: // ListCondExpr ::=
+ case 7: // ListCondExpr ::=
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr RESULT =null;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr();
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListCondExpr();
CUP$parser$result = parser.getSymbolFactory().newSymbol("ListCondExpr",3, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 6: // ListSelItem ::= SelItem _SYMB_1 ListSelItem
+ case 6: // ListSelItem ::= SelItem _SYMB_1 ListSelItem
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListSelItem RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.SelItem p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.SelItem)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListSelItem p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListSelItem)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = p_3; p_3.addFirst(p_1);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.SelItem p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.SelItem)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListSelItem p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListSelItem)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = p_3; p_3.addFirst(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("ListSelItem",2, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 5: // ListSelItem ::= SelItem
+ case 5: // ListSelItem ::= SelItem
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListSelItem RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.SelItem p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.SelItem)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListSelItem(); RESULT.addLast(p_1);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.SelItem p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.SelItem)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListSelItem(); RESULT.addLast(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("ListSelItem",2, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 4: // ListOrderItem ::= OrderItem _SYMB_1 ListOrderItem
+ case 4: // ListOrderItem ::= OrderItem _SYMB_1 ListOrderItem
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListOrderItem RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderItem p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderItem)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListOrderItem p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListOrderItem)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = p_3; p_3.addFirst(p_1);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderItem p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderItem)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListOrderItem p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListOrderItem)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = p_3; p_3.addFirst(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("ListOrderItem",1, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 3: // ListOrderItem ::= OrderItem
+ case 3: // ListOrderItem ::= OrderItem
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListOrderItem RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderItem p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderItem)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListOrderItem(); RESULT.addLast(p_1);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderItem p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.OrderItem)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListOrderItem(); RESULT.addLast(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("ListOrderItem",1, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 2: // ListStatement ::= Statement _SYMB_0 ListStatement
+ case 2: // ListStatement ::= Statement _SYMB_0 ListStatement
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListStatement RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListStatement p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListStatement)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = p_3; p_3.addFirst(p_1);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListStatement p_3 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListStatement)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = p_3; p_3.addFirst(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("ListStatement",0, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 1: // ListStatement ::= Statement
+ case 1: // ListStatement ::= Statement
{
pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListStatement RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
- RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListStatement(); RESULT.addLast(p_1);
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement p_1 = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Statement)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
+ RESULT = new pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.ListStatement(); RESULT.addLast(p_1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("ListStatement",0, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 0: // $START ::= Program EOF
+ case 0: // $START ::= Program EOF
{
Object RESULT =null;
- pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Program start_val = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Program)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
- RESULT = start_val;
+ pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Program start_val = (pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Program)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
+ RESULT = start_val;
CUP$parser$result = parser.getSymbolFactory().newSymbol("$START",0, RESULT);
}
/* ACCEPT */