@Override public Expression visitTreated_subpath(Treated_subpathContext ctx) { TreatExpression treatExpression = new TreatExpression(ctx.general_subpath().accept(this), ctx.subtype().getText()); List<General_path_elementContext> followingPaths = ctx.general_path_element(); Expression finalExpression = treatExpression; if (followingPaths.size() > 0) { List<PathElementExpression> pathProperties = new ArrayList<PathElementExpression>(followingPaths.size() + 1); PathExpression path = new PathExpression(pathProperties); pathProperties.add(treatExpression); for (int i = 0; i < followingPaths.size(); i++) { // TODO: Can here be arrays or is it just path elements? pathProperties.add((PathElementExpression) followingPaths.get(i).accept(this)); } finalExpression = path; } return finalExpression; }
@Override public Expression visitTreated_subpath(Treated_subpathContext ctx) { TreatExpression treatExpression = new TreatExpression(ctx.general_subpath().accept(this), ctx.subtype().getText()); List<General_path_elementContext> followingPaths = ctx.general_path_element(); Expression finalExpression = treatExpression; if (followingPaths.size() > 0) { List<PathElementExpression> pathProperties = new ArrayList<PathElementExpression>(followingPaths.size() + 1); PathExpression path = new PathExpression(pathProperties); pathProperties.add(treatExpression); for (int i = 0; i < followingPaths.size(); i++) { // TODO: Can here be arrays or is it just path elements? pathProperties.add((PathElementExpression) followingPaths.get(i).accept(this)); } finalExpression = path; } return finalExpression; }
@Override public Expression visitTreatedRootPath(TreatedRootPathContext ctx) { TreatExpression treatExpression = new TreatExpression(wrapPath(new PropertyExpression(ctx.identifier().getText())), ctx.subtype().getText()); PathExpression path = (PathExpression) ctx.simple_subpath().accept(this); path.getExpressions().add(0, treatExpression); return path; }
@Override public Expression visitTreated_key_value_expression(Treated_key_value_expressionContext ctx) { return new TreatExpression(ctx.key_value_expression().accept(this), ctx.subtype().getText()); }
@Override public Expression visitTreatJoinPathExpression(TreatJoinPathExpressionContext ctx) { return new TreatExpression(ctx.join_path_expression().accept(this), ctx.subtype().getText()); }
@Override public Expression visitTreated_key_value_expression(Treated_key_value_expressionContext ctx) { return new TreatExpression(ctx.key_value_expression().accept(this), ctx.subtype().getText()); }
@Override public Expression visitTreatJoinPathExpression(TreatJoinPathExpressionContext ctx) { return new TreatExpression(ctx.join_path_expression().accept(this), ctx.subtype().getText()); }
@Override public Expression visitTreatedRootPath(TreatedRootPathContext ctx) { TreatExpression treatExpression = new TreatExpression(wrapPath(new PropertyExpression(ctx.identifier().getText())), ctx.subtype().getText()); PathExpression path = (PathExpression) ctx.simple_subpath().accept(this); path.getExpressions().add(0, treatExpression); return path; }