public final SubtypeContext subtype() throws RecognitionException { SubtypeContext _localctx = new SubtypeContext(_ctx, getState()); enterRule(_localctx, 10, RULE_subtype); try { enterOuterAlt(_localctx, 1); { setState(273); identifier(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
@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; }
public final SubtypeContext subtype() throws RecognitionException { SubtypeContext _localctx = new SubtypeContext(_ctx, getState()); enterRule(_localctx, 10, RULE_subtype); try { enterOuterAlt(_localctx, 1); { setState(273); identifier(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
@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_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()); }
public IdentifierContext identifier() { return getRuleContext(IdentifierContext.class,0); } public SubtypeContext(ParserRuleContext parent, int invokingState) {
public IdentifierContext identifier() { return getRuleContext(IdentifierContext.class,0); } public SubtypeContext(ParserRuleContext parent, int invokingState) {
@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 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; }