diff --git a/base/src/main/java/com/blazebit/expression/base/BaseContributor.java b/base/src/main/java/com/blazebit/expression/base/BaseContributor.java index 5d0f27df..18319b53 100644 --- a/base/src/main/java/com/blazebit/expression/base/BaseContributor.java +++ b/base/src/main/java/com/blazebit/expression/base/BaseContributor.java @@ -105,7 +105,6 @@ public class BaseContributor implements DomainContributor, ExpressionServiceCont public static final String INTEGER_TYPE_NAME = "Integer"; public static final String NUMERIC_TYPE_NAME = "Numeric"; public static final String TIMESTAMP_TYPE_NAME = "Timestamp"; - public static final Class TIME = LocalTime.class; public static final String TIME_TYPE_NAME = "Time"; public static final String INTERVAL_TYPE_NAME = "Interval"; public static final String STRING_TYPE_NAME = "String"; @@ -170,7 +169,7 @@ public void contribute(DomainBuilder domainBuilder) { domainBuilder.withOperationTypeResolver(TIMESTAMP_TYPE_NAME, DomainOperator.PLUS, StaticDomainOperationTypeResolvers.returning(TIMESTAMP_TYPE_NAME, new String[][]{ { TIMESTAMP_TYPE_NAME }, { INTERVAL_TYPE_NAME }})); domainBuilder.withOperationTypeResolver(TIMESTAMP_TYPE_NAME, DomainOperator.MINUS, StaticDomainOperationTypeResolvers.returning(TIMESTAMP_TYPE_NAME, new String[][]{ { TIMESTAMP_TYPE_NAME }, { INTERVAL_TYPE_NAME }})); - withPredicateTypeResolvers(domainBuilder, TIMESTAMP_TYPE_NAME, TIMESTAMP_TYPE_NAME); + withPredicateTypeResolvers(domainBuilder, TIMESTAMP_TYPE_NAME, TIMESTAMP_TYPE_NAME, DATE_TYPE_NAME); domainBuilder.withOperationTypeResolver(TIME_TYPE_NAME, DomainOperator.PLUS, StaticDomainOperationTypeResolvers.returning(TIME_TYPE_NAME, new String[][]{ { TIME_TYPE_NAME }, { INTERVAL_TYPE_NAME }})); domainBuilder.withOperationTypeResolver(TIME_TYPE_NAME, DomainOperator.MINUS, StaticDomainOperationTypeResolvers.returning(TIME_TYPE_NAME, new String[][]{ { TIME_TYPE_NAME }, { INTERVAL_TYPE_NAME }})); @@ -178,7 +177,7 @@ public void contribute(DomainBuilder domainBuilder) { domainBuilder.withOperationTypeResolver(DATE_TYPE_NAME, DomainOperator.PLUS, StaticDomainOperationTypeResolvers.returning(DATE_TYPE_NAME, new String[][]{ { DATE_TYPE_NAME }, { INTERVAL_TYPE_NAME }})); domainBuilder.withOperationTypeResolver(DATE_TYPE_NAME, DomainOperator.MINUS, StaticDomainOperationTypeResolvers.returning(DATE_TYPE_NAME, new String[][]{ { DATE_TYPE_NAME }, { INTERVAL_TYPE_NAME }})); - withPredicateTypeResolvers(domainBuilder, DATE_TYPE_NAME, DATE_TYPE_NAME); + withPredicateTypeResolvers(domainBuilder, DATE_TYPE_NAME, DATE_TYPE_NAME, TIMESTAMP_TYPE_NAME); domainBuilder.withOperationTypeResolver(INTERVAL_TYPE_NAME, DomainOperator.PLUS, StaticDomainOperationTypeResolvers.widest(TIMESTAMP_TYPE_NAME, TIME_TYPE_NAME, INTERVAL_TYPE_NAME)); domainBuilder.withOperationTypeResolver(INTERVAL_TYPE_NAME, DomainOperator.MINUS, StaticDomainOperationTypeResolvers.widest(TIMESTAMP_TYPE_NAME, TIME_TYPE_NAME, INTERVAL_TYPE_NAME)); @@ -296,6 +295,16 @@ public T serialize(ExpressionService expressionService, TemporalLiteralResol return (T) "\"TemporalLiteralResolver\""; } + @Override + public ResolvedLiteral resolveDateLiteral(ExpressionCompiler.Context context, LocalDate value) { + return new DefaultResolvedLiteral(context.getExpressionService().getDomainModel().getType(DATE_TYPE_NAME), value); + } + + @Override + public ResolvedLiteral resolveTimeLiteral(ExpressionCompiler.Context context, LocalTime value) { + return new DefaultResolvedLiteral(context.getExpressionService().getDomainModel().getType(TIME_TYPE_NAME), value); + } + @Override public ResolvedLiteral resolveTimestampLiteral(ExpressionCompiler.Context context, Instant value) { return new DefaultResolvedLiteral(context.getExpressionService().getDomainModel().getType(TIMESTAMP_TYPE_NAME), value); diff --git a/base/src/main/java/com/blazebit/expression/base/DateOperatorInterpreter.java b/base/src/main/java/com/blazebit/expression/base/DateOperatorInterpreter.java index 7d6d1ddf..38db8ae6 100644 --- a/base/src/main/java/com/blazebit/expression/base/DateOperatorInterpreter.java +++ b/base/src/main/java/com/blazebit/expression/base/DateOperatorInterpreter.java @@ -26,7 +26,10 @@ import com.blazebit.expression.spi.DomainOperatorInterpreter; import java.io.Serializable; +import java.time.Instant; import java.time.LocalDate; +import java.time.ZoneOffset; +import java.time.temporal.Temporal; /** * @author Yevhen Tucha @@ -41,26 +44,36 @@ private DateOperatorInterpreter() { } @Override + @SuppressWarnings("unchecked") public Boolean interpret(ExpressionInterpreter.Context context, DomainType leftType, DomainType rightType, Object leftValue, Object rightValue, ComparisonOperator operator) { - if (leftValue instanceof LocalDate && rightValue instanceof LocalDate) { - LocalDate l = (LocalDate) leftValue; - LocalDate r = (LocalDate) rightValue; - switch (operator) { - case EQUAL: - return l.compareTo(r) == 0; - case NOT_EQUAL: - return l.compareTo(r) != 0; - case GREATER_OR_EQUAL: - return l.compareTo(r) > -1; - case GREATER: - return l.compareTo(r) > 0; - case LOWER_OR_EQUAL: - return l.compareTo(r) < 1; - case LOWER: - return l.compareTo(r) < 0; - default: - break; + if (leftValue instanceof LocalDate) { + Comparable l = (Comparable) leftValue; + Temporal r = null; + if (rightValue instanceof LocalDate) { + r = (LocalDate) rightValue; + } else if (rightValue instanceof Instant) { + //noinspection rawtypes + l = (Comparable) ((LocalDate) leftValue).atStartOfDay().toInstant(ZoneOffset.UTC); + r = (Instant) rightValue; + } + if (r != null) { + switch (operator) { + case EQUAL: + return l.compareTo(r) == 0; + case NOT_EQUAL: + return l.compareTo(r) != 0; + case GREATER_OR_EQUAL: + return l.compareTo(r) > -1; + case GREATER: + return l.compareTo(r) > 0; + case LOWER_OR_EQUAL: + return l.compareTo(r) < 1; + case LOWER: + return l.compareTo(r) < 0; + default: + break; + } } } else { throw new DomainModelException("Illegal arguments [" + leftValue + ", " + rightValue + "]!"); diff --git a/base/src/main/java/com/blazebit/expression/base/TimestampOperatorInterpreter.java b/base/src/main/java/com/blazebit/expression/base/TimestampOperatorInterpreter.java index 1b083224..dfc2ade3 100644 --- a/base/src/main/java/com/blazebit/expression/base/TimestampOperatorInterpreter.java +++ b/base/src/main/java/com/blazebit/expression/base/TimestampOperatorInterpreter.java @@ -27,6 +27,8 @@ import java.io.Serializable; import java.time.Instant; +import java.time.LocalDate; +import java.time.ZoneOffset; /** * @author Christian Beikov @@ -41,27 +43,32 @@ private TimestampOperatorInterpreter() { @Override public Boolean interpret(ExpressionInterpreter.Context context, DomainType leftType, DomainType rightType, Object leftValue, Object rightValue, ComparisonOperator operator) { - if (leftValue instanceof Instant && rightValue instanceof Instant) { + if (leftValue instanceof Instant) { Instant l = (Instant) leftValue; - Instant r = (Instant) rightValue; - switch (operator) { - case EQUAL: - return l.compareTo(r) == 0; - case NOT_EQUAL: - return l.compareTo(r) != 0; - case GREATER_OR_EQUAL: - return l.compareTo(r) > -1; - case GREATER: - return l.compareTo(r) > 0; - case LOWER_OR_EQUAL: - return l.compareTo(r) < 1; - case LOWER: - return l.compareTo(r) < 0; - default: - break; + Instant r = null; + if (rightValue instanceof Instant) { + r = (Instant) rightValue; + } else if (rightValue instanceof LocalDate) { + r = ((LocalDate) rightValue).atStartOfDay().toInstant(ZoneOffset.UTC); + } + if (r != null) { + switch (operator) { + case EQUAL: + return l.compareTo(r) == 0; + case NOT_EQUAL: + return l.compareTo(r) != 0; + case GREATER_OR_EQUAL: + return l.compareTo(r) > -1; + case GREATER: + return l.compareTo(r) > 0; + case LOWER_OR_EQUAL: + return l.compareTo(r) < 1; + case LOWER: + return l.compareTo(r) < 0; + default: + break; + } } - } else { - throw new DomainModelException("Illegal arguments [" + leftValue + ", " + rightValue + "]!"); } throw new DomainModelException("Can't handle the operator " + operator + " for the arguments [" + leftValue + ", " + rightValue + "]!"); diff --git a/base/src/test/java/com/blazebit/expression/base/PredicateInterpreterTest.java b/base/src/test/java/com/blazebit/expression/base/PredicateInterpreterTest.java index 9ac3424c..ac22df9a 100644 --- a/base/src/test/java/com/blazebit/expression/base/PredicateInterpreterTest.java +++ b/base/src/test/java/com/blazebit/expression/base/PredicateInterpreterTest.java @@ -104,4 +104,14 @@ public void testStringly5() { Assert.assertEquals(true, testPredicate("'EUR' = Currency.EUR")); } + @Test + public void testTemporal1() { + Assert.assertEquals(true, testPredicate("TIMESTAMP(2020-01-01) = DATE(2020-01-01)")); + } + + @Test + public void testTemporal2() { + Assert.assertEquals(true, testPredicate("DATE(2020-01-01) = TIMESTAMP(2020-01-01)")); + } + } diff --git a/core/api/src/main/java/com/blazebit/expression/spi/TemporalLiteralResolver.java b/core/api/src/main/java/com/blazebit/expression/spi/TemporalLiteralResolver.java index a6a9e492..2c71762a 100644 --- a/core/api/src/main/java/com/blazebit/expression/spi/TemporalLiteralResolver.java +++ b/core/api/src/main/java/com/blazebit/expression/spi/TemporalLiteralResolver.java @@ -20,6 +20,8 @@ import com.blazebit.expression.ExpressionCompiler; import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalTime; /** * A literal resolver for temporal values. @@ -29,6 +31,24 @@ */ public interface TemporalLiteralResolver { + /** + * Resolves the given local date value to a resolved domain literal. + * + * @param context The compiler context + * @param value The local date value + * @return the resolved literal + */ + ResolvedLiteral resolveDateLiteral(ExpressionCompiler.Context context, LocalDate value); + + /** + * Resolves the given local time value to a resolved domain literal. + * + * @param context The compiler context + * @param value The local time value + * @return the resolved literal + */ + ResolvedLiteral resolveTimeLiteral(ExpressionCompiler.Context context, LocalTime value); + /** * Resolves the given instant value to a resolved domain literal. * diff --git a/core/impl/src/main/antlr4/com/blazebit/expression/impl/PredicateLexer.g4 b/core/impl/src/main/antlr4/com/blazebit/expression/impl/PredicateLexer.g4 index 233d054a..5bae9120 100644 --- a/core/impl/src/main/antlr4/com/blazebit/expression/impl/PredicateLexer.g4 +++ b/core/impl/src/main/antlr4/com/blazebit/expression/impl/PredicateLexer.g4 @@ -47,6 +47,7 @@ LEADING_ZERO_INTEGER_LITERAL AND : [aA] [nN] [dD]; BETWEEN : [bB] [eE] [tT] [wW] [eE] [eE] [nN]; +DATE : [dD] [aA] [tT] [eE]; DAYS : [dD] [aA] [yY] [sS]; EMPTY : [eE] [mM] [pP] [tT] [yY]; FALSE : [fF] [aA] [lL] [sS] [eE]; @@ -60,6 +61,7 @@ NOT : [nN] [oO] [tT]; NULL : [nN] [uU] [lL] [lL]; OR : [oO] [rR]; SECONDS : [sS] [eE] [cC] [oO] [nN] [dD] [sS]; +TIME : [tT] [iI] [mM] [eE]; TIMESTAMP : [tT] [iI] [mM] [eE] [sS] [tT] [aA] [mM] [pP]; TRUE : [tT] [rR] [uU] [eE]; YEARS : [yY] [eE] [aA] [rR] [sS]; diff --git a/core/impl/src/main/antlr4/com/blazebit/expression/impl/PredicateParser.g4 b/core/impl/src/main/antlr4/com/blazebit/expression/impl/PredicateParser.g4 index 7611d100..5c50a2bc 100644 --- a/core/impl/src/main/antlr4/com/blazebit/expression/impl/PredicateParser.g4 +++ b/core/impl/src/main/antlr4/com/blazebit/expression/impl/PredicateParser.g4 @@ -89,6 +89,8 @@ literal | stringLiteral | TRUE | FALSE + | dateLiteral + | timeLiteral | timestampLiteral | temporalIntervalLiteral | collectionLiteral @@ -113,6 +115,14 @@ functionInvocation | name=identifier LP ((predicateOrExpression COMMA)* predicateOrExpression)? RP #IndexedFunctionInvocation ; +dateLiteral + : DATE LP datePart RP + ; + +timeLiteral + : TIME LP timePart (DOT fraction=(INTEGER_LITERAL | LEADING_ZERO_INTEGER_LITERAL))? RP + ; + timestampLiteral : TIMESTAMP LP datePart (timePart (DOT fraction=(INTEGER_LITERAL | LEADING_ZERO_INTEGER_LITERAL))? )? RP ; @@ -141,6 +151,7 @@ identifier | QUOTED_IDENTIFIER | AND | BETWEEN + | DATE | DAYS | HOURS | IN @@ -150,6 +161,7 @@ identifier | NOT | OR | SECONDS + | TIME | TIMESTAMP | YEARS ; \ No newline at end of file diff --git a/core/impl/src/main/java/com/blazebit/expression/impl/LiteralFactory.java b/core/impl/src/main/java/com/blazebit/expression/impl/LiteralFactory.java index 3981588d..911c2dcd 100644 --- a/core/impl/src/main/java/com/blazebit/expression/impl/LiteralFactory.java +++ b/core/impl/src/main/java/com/blazebit/expression/impl/LiteralFactory.java @@ -40,6 +40,8 @@ import java.math.BigInteger; import java.time.Instant; import java.time.LocalDate; +import java.time.LocalTime; +import java.time.OffsetTime; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; @@ -58,6 +60,8 @@ public class LiteralFactory { private static final DateTimeFormatter DATE_LITERAL_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneOffset.UTC); private static final DateTimeFormatter DATE_TIME_LITERAL_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneOffset.UTC); private static final DateTimeFormatter DATE_TIME_MILLISECONDS_LITERAL_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS").withZone(ZoneOffset.UTC); + private static final DateTimeFormatter TIME_LITERAL_FORMAT = DateTimeFormatter.ofPattern("HH:mm:ss").withZone(ZoneOffset.UTC); + private static final DateTimeFormatter TIME_MILLISECONDS_LITERAL_FORMAT = DateTimeFormatter.ofPattern("HH:mm:ss.SSS").withZone(ZoneOffset.UTC); private static final String TEMPORAL_INTERVAL_YEARS_FIELD = "years"; private static final String TEMPORAL_INTERVAL_MONTHS_FIELD = "months"; @@ -327,6 +331,30 @@ public void appendTemplateString(StringBuilder sb, String value) { } } + public ResolvedLiteral ofDateString(ExpressionCompiler.Context context, String dateString) { + try { + return ofLocalDate(context, LocalDate.parse(dateString, DATE_LITERAL_FORMAT)); + } catch (DateTimeParseException e) { + throw new SyntaxErrorException("Invalid datetime literal " + dateString, e); + } + } + + public ResolvedLiteral ofTimeString(ExpressionCompiler.Context context, String timeString) { + boolean hasDot = timeString.indexOf('.') != -1; + + try { + LocalTime localTime; + if (!hasDot) { + localTime = OffsetTime.parse(timeString, TIME_LITERAL_FORMAT).toLocalTime(); + } else { + localTime = OffsetTime.parse(timeString, TIME_MILLISECONDS_LITERAL_FORMAT).toLocalTime(); + } + return ofLocalTime(context, localTime); + } catch (DateTimeParseException e) { + throw new SyntaxErrorException("Invalid datetime literal " + timeString, e); + } + } + public ResolvedLiteral ofDateTimeString(ExpressionCompiler.Context context, String dateTimeString) { boolean hasBlank = dateTimeString.indexOf(' ') != -1; boolean hasDot = dateTimeString.indexOf('.') != -1; @@ -346,6 +374,22 @@ public ResolvedLiteral ofDateTimeString(ExpressionCompiler.Context context, Stri } } + public ResolvedLiteral ofLocalDate(ExpressionCompiler.Context context, LocalDate localDate) { + TemporalLiteralResolver temporalLiteralResolver = expressionService.getTemporalLiteralResolver(); + if (temporalLiteralResolver == null) { + throw new DomainModelException("No literal resolver for temporal literals defined"); + } + return temporalLiteralResolver.resolveDateLiteral(context, localDate); + } + + public ResolvedLiteral ofLocalTime(ExpressionCompiler.Context context, LocalTime localTime) { + TemporalLiteralResolver temporalLiteralResolver = expressionService.getTemporalLiteralResolver(); + if (temporalLiteralResolver == null) { + throw new DomainModelException("No literal resolver for temporal literals defined"); + } + return temporalLiteralResolver.resolveTimeLiteral(context, localTime); + } + public ResolvedLiteral ofInstant(ExpressionCompiler.Context context, Instant instant) { TemporalLiteralResolver temporalLiteralResolver = expressionService.getTemporalLiteralResolver(); if (temporalLiteralResolver == null) { diff --git a/core/impl/src/main/java/com/blazebit/expression/impl/PredicateModelGenerator.java b/core/impl/src/main/java/com/blazebit/expression/impl/PredicateModelGenerator.java index 32f5e384..edda8115 100644 --- a/core/impl/src/main/java/com/blazebit/expression/impl/PredicateModelGenerator.java +++ b/core/impl/src/main/java/com/blazebit/expression/impl/PredicateModelGenerator.java @@ -469,6 +469,24 @@ public Expression visitUnaryPlusExpression(PredicateParser.UnaryPlusExpressionCo // return new CollectionAtom(new Path(ctx.identifier().getText(), TermType.COLLECTION)); // } + @Override + public Expression visitDateLiteral(PredicateParser.DateLiteralContext ctx) { + return new Literal(literalFactory.ofDateString(compileContext, ctx.datePart().getText())); + } + + @Override + public Expression visitTimeLiteral(PredicateParser.TimeLiteralContext ctx) { + StringBuilder sb = new StringBuilder(12); + PredicateParser.TimePartContext timePartContext = ctx.timePart(); + sb.append(timePartContext.getText()); + + if (ctx.fraction != null) { + sb.append('.'); + sb.append(ctx.fraction.getText()); + } + return new Literal(literalFactory.ofTimeString(compileContext, sb.toString())); + } + @Override public Expression visitTimestampLiteral(PredicateParser.TimestampLiteralContext ctx) { StringBuilder sb = new StringBuilder(23); diff --git a/core/impl/src/test/java/com/blazebit/expression/impl/domain/DefaultTemporalLiteralResolver.java b/core/impl/src/test/java/com/blazebit/expression/impl/domain/DefaultTemporalLiteralResolver.java index f2358865..7e017ecf 100644 --- a/core/impl/src/test/java/com/blazebit/expression/impl/domain/DefaultTemporalLiteralResolver.java +++ b/core/impl/src/test/java/com/blazebit/expression/impl/domain/DefaultTemporalLiteralResolver.java @@ -22,12 +22,25 @@ import com.blazebit.expression.spi.TemporalLiteralResolver; import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalTime; +import java.time.ZoneOffset; /** * @author Christian Beikov * @since 1.0.0 */ public class DefaultTemporalLiteralResolver implements TemporalLiteralResolver { + @Override + public ResolvedLiteral resolveDateLiteral(ExpressionCompiler.Context context, LocalDate value) { + return new DefaultResolvedLiteral(context.getExpressionService().getDomainModel().getType(AbstractExpressionCompilerTest.TIMESTAMP), value.atStartOfDay().toInstant(ZoneOffset.UTC)); + } + + @Override + public ResolvedLiteral resolveTimeLiteral(ExpressionCompiler.Context context, LocalTime value) { + return new DefaultResolvedLiteral(context.getExpressionService().getDomainModel().getType(AbstractExpressionCompilerTest.TIMESTAMP), value.atDate(LocalDate.of(1970, 1, 1)).toInstant(ZoneOffset.UTC)); + } + @Override public ResolvedLiteral resolveTimestampLiteral(ExpressionCompiler.Context context, Instant value) { return new DefaultResolvedLiteral(context.getExpressionService().getDomainModel().getType(AbstractExpressionCompilerTest.TIMESTAMP), value); diff --git a/declarative/persistence/src/test/java/com/blazebit/expression/declarative/persistence/ModelTest.java b/declarative/persistence/src/test/java/com/blazebit/expression/declarative/persistence/ModelTest.java index 9e9cbf3b..3c448ffd 100644 --- a/declarative/persistence/src/test/java/com/blazebit/expression/declarative/persistence/ModelTest.java +++ b/declarative/persistence/src/test/java/com/blazebit/expression/declarative/persistence/ModelTest.java @@ -20,6 +20,8 @@ import com.blazebit.domain.declarative.DomainFunction; import com.blazebit.domain.declarative.DomainFunctionParam; import com.blazebit.domain.declarative.DomainFunctions; +import com.blazebit.domain.declarative.Metadata; +import com.blazebit.domain.declarative.MetadataType; import com.blazebit.domain.runtime.model.DomainModel; import com.blazebit.domain.runtime.model.DomainType; import com.blazebit.expression.Expression; @@ -29,6 +31,8 @@ import com.blazebit.expression.ExpressionSerializer; import com.blazebit.expression.ExpressionService; import com.blazebit.expression.Expressions; +import com.blazebit.expression.persistence.PersistenceExpressionRenderer; +import com.blazebit.expression.persistence.PersistenceExpressionSerializer; import com.blazebit.expression.persistence.PersistenceExpressionSerializerContext; import com.blazebit.persistence.BaseWhereBuilder; import com.blazebit.persistence.BetweenBuilder; @@ -49,6 +53,8 @@ import org.junit.Test; import java.math.BigInteger; +import java.time.Instant; +import java.time.LocalDate; import java.util.Collection; import java.util.Collections; @@ -121,6 +127,19 @@ public void test4() { } } + @Test + public void test5() { + ExpressionCompiler compiler = expressionService.createCompiler(); + ExpressionCompiler.Context compilerContext = compiler.createContext(Collections.singletonMap("user", domainType)); + Expression expression = compiler.createPredicate("user.registrationDate < TIMESTAMP(2020-01-01)", compilerContext); + ExpressionSerializer serializer = expressionService.createSerializer(WhereBuilder.class); + ExpressionSerializer.Context serializerContext = new PersistenceExpressionSerializerContext<>(expressionService, null) + .withAlias("user", "u"); + WhereBuilderMock whereBuilderMock = new WhereBuilderMock(); + serializer.serializeTo(serializerContext, expression, whereBuilderMock); + Assert.assertEquals("u.registrationDate < {ts '2020-01-01 00:00:00'}", whereBuilderMock.predicate); + } + @DomainFunctions static class Functions { @DomainFunction("IS_OLD") @@ -134,15 +153,19 @@ static Boolean isOld(ExpressionInterpreter.Context context, @DomainFunctionParam public static interface User { String getName(); long getAge(); + @Metadata(MyExpressionRenderer.class) + LocalDate getRegistrationDate(); } static class UserImpl implements User { private final String name; private final long age; + private final LocalDate registrationDate; public UserImpl(String name, long age) { this.name = name; this.age = age; + this.registrationDate = LocalDate.of(1970, 1, 1); } @Override @@ -154,6 +177,11 @@ public String getName() { public long getAge() { return age; } + + @Override + public LocalDate getRegistrationDate() { + return registrationDate; + } } static class WhereBuilderMock implements WhereBuilder, MultipleSubqueryInitiator, RestrictionBuilder { @@ -721,4 +749,12 @@ public RestrictionBuilderExperimental nonPortable() { return null; } } + + @MetadataType(PersistenceExpressionRenderer.class) + public static class MyExpressionRenderer implements PersistenceExpressionRenderer { + @Override + public void render(StringBuilder sb, PersistenceExpressionSerializer serializer) { + sb.append(".registrationDate"); + } + } } diff --git a/editor/monaco/src/main/typescript/ExpressionService.ts b/editor/monaco/src/main/typescript/ExpressionService.ts index 79779e22..1f7848ce 100644 --- a/editor/monaco/src/main/typescript/ExpressionService.ts +++ b/editor/monaco/src/main/typescript/ExpressionService.ts @@ -257,10 +257,15 @@ export class ExpressionService { }); registerIfAbsent("TemporalLiteralResolver", function(): LiteralResolver { return { resolveLiteral(domainModel: DomainModel, kind: LiteralKind, value: boolean | string | EntityLiteral | EnumLiteral | CollectionLiteral): DomainType { - if (kind == LiteralKind.INTERVAL) { - return domainModel.getType('Interval'); - } else { - return domainModel.getType('Timestamp'); + switch (kind) { + case LiteralKind.INTERVAL: + return domainModel.getType('Interval'); + case LiteralKind.DATE: + return domainModel.getType('Date'); + case LiteralKind.TIME: + return domainModel.getType('Time'); + default: + return domainModel.getType('Timestamp'); } }}; }); diff --git a/editor/monaco/src/main/typescript/LiteralKind.ts b/editor/monaco/src/main/typescript/LiteralKind.ts index f9b20489..0f2c1de9 100644 --- a/editor/monaco/src/main/typescript/LiteralKind.ts +++ b/editor/monaco/src/main/typescript/LiteralKind.ts @@ -37,6 +37,14 @@ export enum LiteralKind { * String literal. */ STRING, + /** + * Date literal. + */ + DATE, + /** + * Time literal. + */ + TIME, /** * Timestamp literal. */ diff --git a/editor/monaco/src/main/typescript/PredicateInlayHintsBlazeExpressionParserVisitor.ts b/editor/monaco/src/main/typescript/PredicateInlayHintsBlazeExpressionParserVisitor.ts index 251682c2..448d4106 100644 --- a/editor/monaco/src/main/typescript/PredicateInlayHintsBlazeExpressionParserVisitor.ts +++ b/editor/monaco/src/main/typescript/PredicateInlayHintsBlazeExpressionParserVisitor.ts @@ -63,6 +63,8 @@ import { TemplateContext, TemporalIntervalLiteralContext, TimePartContext, + DateLiteralContext, + TimeLiteralContext, TimestampLiteralContext, UnaryMinusExpressionContext, UnaryPlusExpressionContext @@ -211,6 +213,12 @@ export class TypeResolvingBlazeExpressionParserVisitor implements BlazeExpressio ctx.expression().accept(this); } + visitDateLiteral(ctx: DateLiteralContext): void { + } + + visitTimeLiteral(ctx: TimeLiteralContext): void { + } + visitTimestampLiteral(ctx: TimestampLiteralContext): void { } diff --git a/editor/monaco/src/main/typescript/TypeResolvingBlazeExpressionParserVisitor.ts b/editor/monaco/src/main/typescript/TypeResolvingBlazeExpressionParserVisitor.ts index 0e24de0e..66c98699 100644 --- a/editor/monaco/src/main/typescript/TypeResolvingBlazeExpressionParserVisitor.ts +++ b/editor/monaco/src/main/typescript/TypeResolvingBlazeExpressionParserVisitor.ts @@ -71,6 +71,8 @@ import { TemplateContext, TemporalIntervalLiteralContext, TimePartContext, + DateLiteralContext, + TimeLiteralContext, TimestampLiteralContext, UnaryMinusExpressionContext, UnaryPlusExpressionContext @@ -481,6 +483,14 @@ export class TypeResolvingBlazeExpressionParserVisitor implements BlazeExpressio } } + visitDateLiteral(ctx: DateLiteralContext): DomainType { + return this.symbolTable.model.temporalLiteralResolver.resolveLiteral(this.symbolTable.model.domainModel, LiteralKind.DATE, ctx.text); + } + + visitTimeLiteral(ctx: TimeLiteralContext): DomainType { + return this.symbolTable.model.temporalLiteralResolver.resolveLiteral(this.symbolTable.model.domainModel, LiteralKind.TIME, ctx.text); + } + visitTimestampLiteral(ctx: TimestampLiteralContext): DomainType { return this.symbolTable.model.temporalLiteralResolver.resolveLiteral(this.symbolTable.model.domainModel, LiteralKind.TIMESTAMP, ctx.text); } diff --git a/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionLexer.interp b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionLexer.interp new file mode 100644 index 00000000..fc1f04df --- /dev/null +++ b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionLexer.interp @@ -0,0 +1,192 @@ +token literal names: +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +'<' +'<=' +'>' +'>=' +'=' +null +'+' +'-' +'*' +'/' +'%' +'(' +')' +'[' +']' +',' +'.' +':' +'!' +null +null +'}' +'#{' +null +null +null +null +null + +token symbolic names: +null +WS +START_QUOTE +START_DOUBLE_QUOTE +INTEGER_LITERAL +NUMERIC_LITERAL +LEADING_ZERO_INTEGER_LITERAL +AND +BETWEEN +DATE +DAYS +EMPTY +FALSE +HOURS +IN +INTERVAL +IS +MINUTES +MONTHS +NOT +NULL +OR +SECONDS +TIME +TIMESTAMP +TRUE +YEARS +LESS +LESS_EQUAL +GREATER +GREATER_EQUAL +EQUAL +NOT_EQUAL +PLUS +MINUS +ASTERISK +SLASH +PERCENT +LP +RP +LB +RB +COMMA +DOT +COLON +EXCLAMATION_MARK +IDENTIFIER +QUOTED_IDENTIFIER +EXPRESSION_END +EXPRESSION_START +TEXT +TEXT_IN_QUOTE +END_QUOTE +TEXT_IN_DOUBLE_QUOTE +END_DOUBLE_QUOTE + +rule names: +WS +EOL +DIGIT +DIGITS +DIGIT_NOT_ZERO +INTEGER +EXPONENT_PART +SIGNED_INTEGER +ESCAPE_SEQUENCE +HEX_DIGIT +UNICODE_ESCAPE +START_QUOTE +START_DOUBLE_QUOTE +INTEGER_LITERAL +NUMERIC_LITERAL +LEADING_ZERO_INTEGER_LITERAL +AND +BETWEEN +DATE +DAYS +EMPTY +FALSE +HOURS +IN +INTERVAL +IS +MINUTES +MONTHS +NOT +NULL +OR +SECONDS +TIME +TIMESTAMP +TRUE +YEARS +LESS +LESS_EQUAL +GREATER +GREATER_EQUAL +EQUAL +NOT_EQUAL +PLUS +MINUS +ASTERISK +SLASH +PERCENT +LP +RP +LB +RB +COMMA +DOT +COLON +EXCLAMATION_MARK +IDENTIFIER +QUOTED_IDENTIFIER +EXPRESSION_END +EXPRESSION_START +TEXT +TEXT_IN_QUOTE +END_QUOTE +TEXT_IN_DOUBLE_QUOTE +END_DOUBLE_QUOTE + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE +TEMPLATE +QUOTE_STRING +DOUBLE_QUOTE_STRING + +atn: +[3, 51485, 51898, 1421, 44986, 20307, 1543, 60043, 49729, 2, 56, 443, 8, 1, 8, 1, 8, 1, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 3, 2, 3, 2, 5, 2, 137, 10, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 5, 3, 144, 10, 3, 3, 4, 3, 4, 3, 5, 6, 5, 149, 10, 5, 13, 5, 14, 5, 150, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 5, 7, 158, 10, 7, 5, 7, 160, 10, 7, 3, 8, 3, 8, 3, 8, 3, 9, 5, 9, 166, 10, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 5, 10, 175, 10, 10, 3, 10, 5, 10, 178, 10, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 5, 16, 203, 10, 16, 3, 16, 3, 16, 3, 16, 5, 16, 208, 10, 16, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 38, 3, 38, 3, 39, 3, 39, 3, 39, 3, 40, 3, 40, 3, 41, 3, 41, 3, 41, 3, 42, 3, 42, 3, 43, 3, 43, 3, 43, 3, 43, 5, 43, 345, 10, 43, 3, 44, 3, 44, 3, 45, 3, 45, 3, 46, 3, 46, 3, 47, 3, 47, 3, 48, 3, 48, 3, 49, 3, 49, 3, 50, 3, 50, 3, 51, 3, 51, 3, 52, 3, 52, 3, 53, 3, 53, 3, 54, 3, 54, 3, 55, 3, 55, 3, 56, 3, 56, 3, 57, 3, 57, 7, 57, 375, 10, 57, 12, 57, 14, 57, 378, 11, 57, 3, 58, 3, 58, 3, 58, 7, 58, 383, 10, 58, 12, 58, 14, 58, 386, 11, 58, 3, 58, 3, 58, 3, 58, 3, 59, 3, 59, 3, 59, 3, 59, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 6, 61, 406, 10, 61, 13, 61, 14, 61, 407, 3, 61, 3, 61, 3, 62, 3, 62, 3, 62, 6, 62, 415, 10, 62, 13, 62, 14, 62, 416, 3, 62, 5, 62, 420, 10, 62, 5, 62, 422, 10, 62, 3, 63, 3, 63, 3, 63, 3, 63, 3, 64, 3, 64, 3, 64, 6, 64, 431, 10, 64, 13, 64, 14, 64, 432, 3, 64, 5, 64, 436, 10, 64, 5, 64, 438, 10, 64, 3, 65, 3, 65, 3, 65, 3, 65, 2, 2, 2, 66, 6, 2, 3, 8, 2, 2, 10, 2, 2, 12, 2, 2, 14, 2, 2, 16, 2, 2, 18, 2, 2, 20, 2, 2, 22, 2, 2, 24, 2, 2, 26, 2, 2, 28, 2, 4, 30, 2, 5, 32, 2, 6, 34, 2, 7, 36, 2, 8, 38, 2, 9, 40, 2, 10, 42, 2, 11, 44, 2, 12, 46, 2, 13, 48, 2, 14, 50, 2, 15, 52, 2, 16, 54, 2, 17, 56, 2, 18, 58, 2, 19, 60, 2, 20, 62, 2, 21, 64, 2, 22, 66, 2, 23, 68, 2, 24, 70, 2, 25, 72, 2, 26, 74, 2, 27, 76, 2, 28, 78, 2, 29, 80, 2, 30, 82, 2, 31, 84, 2, 32, 86, 2, 33, 88, 2, 34, 90, 2, 35, 92, 2, 36, 94, 2, 37, 96, 2, 38, 98, 2, 39, 100, 2, 40, 102, 2, 41, 104, 2, 42, 106, 2, 43, 108, 2, 44, 110, 2, 45, 112, 2, 46, 114, 2, 47, 116, 2, 48, 118, 2, 49, 120, 2, 50, 122, 2, 51, 124, 2, 52, 126, 2, 53, 128, 2, 54, 130, 2, 55, 132, 2, 56, 6, 2, 3, 4, 5, 34, 5, 2, 11, 11, 14, 14, 34, 34, 4, 2, 12, 12, 15, 15, 4, 2, 71, 71, 103, 103, 4, 2, 45, 45, 47, 47, 7, 2, 100, 100, 104, 104, 112, 112, 116, 116, 118, 118, 4, 2, 41, 41, 94, 94, 5, 2, 50, 59, 67, 72, 99, 104, 4, 2, 67, 67, 99, 99, 4, 2, 80, 80, 112, 112, 4, 2, 70, 70, 102, 102, 4, 2, 68, 68, 100, 100, 4, 2, 86, 86, 118, 118, 4, 2, 89, 89, 121, 121, 4, 2, 91, 91, 123, 123, 4, 2, 85, 85, 117, 117, 4, 2, 79, 79, 111, 111, 4, 2, 82, 82, 114, 114, 4, 2, 72, 72, 104, 104, 4, 2, 78, 78, 110, 110, 4, 2, 74, 74, 106, 106, 4, 2, 81, 81, 113, 113, 4, 2, 87, 87, 119, 119, 4, 2, 84, 84, 116, 116, 4, 2, 75, 75, 107, 107, 4, 2, 88, 88, 120, 120, 4, 2, 69, 69, 101, 101, 7, 2, 38, 38, 67, 92, 97, 97, 99, 124, 130, 0, 8, 2, 38, 38, 50, 59, 67, 92, 97, 97, 99, 124, 130, 0, 6, 2, 12, 12, 15, 15, 94, 94, 98, 98, 3, 2, 37, 37, 6, 2, 12, 12, 15, 15, 41, 41, 94, 94, 6, 2, 12, 12, 15, 15, 36, 36, 94, 94, 2, 455, 2, 6, 3, 2, 2, 2, 2, 28, 3, 2, 2, 2, 2, 30, 3, 2, 2, 2, 2, 32, 3, 2, 2, 2, 2, 34, 3, 2, 2, 2, 2, 36, 3, 2, 2, 2, 2, 38, 3, 2, 2, 2, 2, 40, 3, 2, 2, 2, 2, 42, 3, 2, 2, 2, 2, 44, 3, 2, 2, 2, 2, 46, 3, 2, 2, 2, 2, 48, 3, 2, 2, 2, 2, 50, 3, 2, 2, 2, 2, 52, 3, 2, 2, 2, 2, 54, 3, 2, 2, 2, 2, 56, 3, 2, 2, 2, 2, 58, 3, 2, 2, 2, 2, 60, 3, 2, 2, 2, 2, 62, 3, 2, 2, 2, 2, 64, 3, 2, 2, 2, 2, 66, 3, 2, 2, 2, 2, 68, 3, 2, 2, 2, 2, 70, 3, 2, 2, 2, 2, 72, 3, 2, 2, 2, 2, 74, 3, 2, 2, 2, 2, 76, 3, 2, 2, 2, 2, 78, 3, 2, 2, 2, 2, 80, 3, 2, 2, 2, 2, 82, 3, 2, 2, 2, 2, 84, 3, 2, 2, 2, 2, 86, 3, 2, 2, 2, 2, 88, 3, 2, 2, 2, 2, 90, 3, 2, 2, 2, 2, 92, 3, 2, 2, 2, 2, 94, 3, 2, 2, 2, 2, 96, 3, 2, 2, 2, 2, 98, 3, 2, 2, 2, 2, 100, 3, 2, 2, 2, 2, 102, 3, 2, 2, 2, 2, 104, 3, 2, 2, 2, 2, 106, 3, 2, 2, 2, 2, 108, 3, 2, 2, 2, 2, 110, 3, 2, 2, 2, 2, 112, 3, 2, 2, 2, 2, 114, 3, 2, 2, 2, 2, 116, 3, 2, 2, 2, 2, 118, 3, 2, 2, 2, 2, 120, 3, 2, 2, 2, 3, 122, 3, 2, 2, 2, 3, 124, 3, 2, 2, 2, 4, 126, 3, 2, 2, 2, 4, 128, 3, 2, 2, 2, 5, 130, 3, 2, 2, 2, 5, 132, 3, 2, 2, 2, 6, 136, 3, 2, 2, 2, 8, 143, 3, 2, 2, 2, 10, 145, 3, 2, 2, 2, 12, 148, 3, 2, 2, 2, 14, 152, 3, 2, 2, 2, 16, 159, 3, 2, 2, 2, 18, 161, 3, 2, 2, 2, 20, 165, 3, 2, 2, 2, 22, 177, 3, 2, 2, 2, 24, 179, 3, 2, 2, 2, 26, 181, 3, 2, 2, 2, 28, 188, 3, 2, 2, 2, 30, 192, 3, 2, 2, 2, 32, 196, 3, 2, 2, 2, 34, 207, 3, 2, 2, 2, 36, 209, 3, 2, 2, 2, 38, 212, 3, 2, 2, 2, 40, 216, 3, 2, 2, 2, 42, 224, 3, 2, 2, 2, 44, 229, 3, 2, 2, 2, 46, 234, 3, 2, 2, 2, 48, 240, 3, 2, 2, 2, 50, 246, 3, 2, 2, 2, 52, 252, 3, 2, 2, 2, 54, 255, 3, 2, 2, 2, 56, 264, 3, 2, 2, 2, 58, 267, 3, 2, 2, 2, 60, 275, 3, 2, 2, 2, 62, 282, 3, 2, 2, 2, 64, 286, 3, 2, 2, 2, 66, 291, 3, 2, 2, 2, 68, 294, 3, 2, 2, 2, 70, 302, 3, 2, 2, 2, 72, 307, 3, 2, 2, 2, 74, 317, 3, 2, 2, 2, 76, 322, 3, 2, 2, 2, 78, 328, 3, 2, 2, 2, 80, 330, 3, 2, 2, 2, 82, 333, 3, 2, 2, 2, 84, 335, 3, 2, 2, 2, 86, 338, 3, 2, 2, 2, 88, 344, 3, 2, 2, 2, 90, 346, 3, 2, 2, 2, 92, 348, 3, 2, 2, 2, 94, 350, 3, 2, 2, 2, 96, 352, 3, 2, 2, 2, 98, 354, 3, 2, 2, 2, 100, 356, 3, 2, 2, 2, 102, 358, 3, 2, 2, 2, 104, 360, 3, 2, 2, 2, 106, 362, 3, 2, 2, 2, 108, 364, 3, 2, 2, 2, 110, 366, 3, 2, 2, 2, 112, 368, 3, 2, 2, 2, 114, 370, 3, 2, 2, 2, 116, 372, 3, 2, 2, 2, 118, 379, 3, 2, 2, 2, 120, 390, 3, 2, 2, 2, 122, 394, 3, 2, 2, 2, 124, 405, 3, 2, 2, 2, 126, 421, 3, 2, 2, 2, 128, 423, 3, 2, 2, 2, 130, 437, 3, 2, 2, 2, 132, 439, 3, 2, 2, 2, 134, 137, 9, 2, 2, 2, 135, 137, 5, 8, 3, 2, 136, 134, 3, 2, 2, 2, 136, 135, 3, 2, 2, 2, 137, 138, 3, 2, 2, 2, 138, 139, 8, 2, 2, 2, 139, 7, 3, 2, 2, 2, 140, 141, 7, 15, 2, 2, 141, 144, 7, 12, 2, 2, 142, 144, 9, 3, 2, 2, 143, 140, 3, 2, 2, 2, 143, 142, 3, 2, 2, 2, 144, 9, 3, 2, 2, 2, 145, 146, 4, 50, 59, 2, 146, 11, 3, 2, 2, 2, 147, 149, 5, 10, 4, 2, 148, 147, 3, 2, 2, 2, 149, 150, 3, 2, 2, 2, 150, 148, 3, 2, 2, 2, 150, 151, 3, 2, 2, 2, 151, 13, 3, 2, 2, 2, 152, 153, 4, 51, 59, 2, 153, 15, 3, 2, 2, 2, 154, 160, 7, 50, 2, 2, 155, 157, 5, 14, 6, 2, 156, 158, 5, 12, 5, 2, 157, 156, 3, 2, 2, 2, 157, 158, 3, 2, 2, 2, 158, 160, 3, 2, 2, 2, 159, 154, 3, 2, 2, 2, 159, 155, 3, 2, 2, 2, 160, 17, 3, 2, 2, 2, 161, 162, 9, 4, 2, 2, 162, 163, 5, 20, 9, 2, 163, 19, 3, 2, 2, 2, 164, 166, 9, 5, 2, 2, 165, 164, 3, 2, 2, 2, 165, 166, 3, 2, 2, 2, 166, 167, 3, 2, 2, 2, 167, 168, 5, 12, 5, 2, 168, 21, 3, 2, 2, 2, 169, 174, 7, 94, 2, 2, 170, 175, 9, 6, 2, 2, 171, 172, 7, 94, 2, 2, 172, 175, 7, 36, 2, 2, 173, 175, 9, 7, 2, 2, 174, 170, 3, 2, 2, 2, 174, 171, 3, 2, 2, 2, 174, 173, 3, 2, 2, 2, 175, 178, 3, 2, 2, 2, 176, 178, 5, 26, 12, 2, 177, 169, 3, 2, 2, 2, 177, 176, 3, 2, 2, 2, 178, 23, 3, 2, 2, 2, 179, 180, 9, 8, 2, 2, 180, 25, 3, 2, 2, 2, 181, 182, 7, 94, 2, 2, 182, 183, 7, 119, 2, 2, 183, 184, 5, 24, 11, 2, 184, 185, 5, 24, 11, 2, 185, 186, 5, 24, 11, 2, 186, 187, 5, 24, 11, 2, 187, 27, 3, 2, 2, 2, 188, 189, 7, 41, 2, 2, 189, 190, 3, 2, 2, 2, 190, 191, 8, 13, 3, 2, 191, 29, 3, 2, 2, 2, 192, 193, 7, 36, 2, 2, 193, 194, 3, 2, 2, 2, 194, 195, 8, 14, 4, 2, 195, 31, 3, 2, 2, 2, 196, 197, 5, 16, 7, 2, 197, 33, 3, 2, 2, 2, 198, 199, 5, 16, 7, 2, 199, 200, 7, 48, 2, 2, 200, 202, 5, 12, 5, 2, 201, 203, 5, 18, 8, 2, 202, 201, 3, 2, 2, 2, 202, 203, 3, 2, 2, 2, 203, 208, 3, 2, 2, 2, 204, 205, 5, 16, 7, 2, 205, 206, 5, 18, 8, 2, 206, 208, 3, 2, 2, 2, 207, 198, 3, 2, 2, 2, 207, 204, 3, 2, 2, 2, 208, 35, 3, 2, 2, 2, 209, 210, 7, 50, 2, 2, 210, 211, 5, 12, 5, 2, 211, 37, 3, 2, 2, 2, 212, 213, 9, 9, 2, 2, 213, 214, 9, 10, 2, 2, 214, 215, 9, 11, 2, 2, 215, 39, 3, 2, 2, 2, 216, 217, 9, 12, 2, 2, 217, 218, 9, 4, 2, 2, 218, 219, 9, 13, 2, 2, 219, 220, 9, 14, 2, 2, 220, 221, 9, 4, 2, 2, 221, 222, 9, 4, 2, 2, 222, 223, 9, 10, 2, 2, 223, 41, 3, 2, 2, 2, 224, 225, 9, 11, 2, 2, 225, 226, 9, 9, 2, 2, 226, 227, 9, 13, 2, 2, 227, 228, 9, 4, 2, 2, 228, 43, 3, 2, 2, 2, 229, 230, 9, 11, 2, 2, 230, 231, 9, 9, 2, 2, 231, 232, 9, 15, 2, 2, 232, 233, 9, 16, 2, 2, 233, 45, 3, 2, 2, 2, 234, 235, 9, 4, 2, 2, 235, 236, 9, 17, 2, 2, 236, 237, 9, 18, 2, 2, 237, 238, 9, 13, 2, 2, 238, 239, 9, 15, 2, 2, 239, 47, 3, 2, 2, 2, 240, 241, 9, 19, 2, 2, 241, 242, 9, 9, 2, 2, 242, 243, 9, 20, 2, 2, 243, 244, 9, 16, 2, 2, 244, 245, 9, 4, 2, 2, 245, 49, 3, 2, 2, 2, 246, 247, 9, 21, 2, 2, 247, 248, 9, 22, 2, 2, 248, 249, 9, 23, 2, 2, 249, 250, 9, 24, 2, 2, 250, 251, 9, 16, 2, 2, 251, 51, 3, 2, 2, 2, 252, 253, 9, 25, 2, 2, 253, 254, 9, 10, 2, 2, 254, 53, 3, 2, 2, 2, 255, 256, 9, 25, 2, 2, 256, 257, 9, 10, 2, 2, 257, 258, 9, 13, 2, 2, 258, 259, 9, 4, 2, 2, 259, 260, 9, 24, 2, 2, 260, 261, 9, 26, 2, 2, 261, 262, 9, 9, 2, 2, 262, 263, 9, 20, 2, 2, 263, 55, 3, 2, 2, 2, 264, 265, 9, 25, 2, 2, 265, 266, 9, 16, 2, 2, 266, 57, 3, 2, 2, 2, 267, 268, 9, 17, 2, 2, 268, 269, 9, 25, 2, 2, 269, 270, 9, 10, 2, 2, 270, 271, 9, 23, 2, 2, 271, 272, 9, 13, 2, 2, 272, 273, 9, 4, 2, 2, 273, 274, 9, 16, 2, 2, 274, 59, 3, 2, 2, 2, 275, 276, 9, 17, 2, 2, 276, 277, 9, 22, 2, 2, 277, 278, 9, 10, 2, 2, 278, 279, 9, 13, 2, 2, 279, 280, 9, 21, 2, 2, 280, 281, 9, 16, 2, 2, 281, 61, 3, 2, 2, 2, 282, 283, 9, 10, 2, 2, 283, 284, 9, 22, 2, 2, 284, 285, 9, 13, 2, 2, 285, 63, 3, 2, 2, 2, 286, 287, 9, 10, 2, 2, 287, 288, 9, 23, 2, 2, 288, 289, 9, 20, 2, 2, 289, 290, 9, 20, 2, 2, 290, 65, 3, 2, 2, 2, 291, 292, 9, 22, 2, 2, 292, 293, 9, 24, 2, 2, 293, 67, 3, 2, 2, 2, 294, 295, 9, 16, 2, 2, 295, 296, 9, 4, 2, 2, 296, 297, 9, 27, 2, 2, 297, 298, 9, 22, 2, 2, 298, 299, 9, 10, 2, 2, 299, 300, 9, 11, 2, 2, 300, 301, 9, 16, 2, 2, 301, 69, 3, 2, 2, 2, 302, 303, 9, 13, 2, 2, 303, 304, 9, 25, 2, 2, 304, 305, 9, 17, 2, 2, 305, 306, 9, 4, 2, 2, 306, 71, 3, 2, 2, 2, 307, 308, 9, 13, 2, 2, 308, 309, 9, 25, 2, 2, 309, 310, 9, 17, 2, 2, 310, 311, 9, 4, 2, 2, 311, 312, 9, 16, 2, 2, 312, 313, 9, 13, 2, 2, 313, 314, 9, 9, 2, 2, 314, 315, 9, 17, 2, 2, 315, 316, 9, 18, 2, 2, 316, 73, 3, 2, 2, 2, 317, 318, 9, 13, 2, 2, 318, 319, 9, 24, 2, 2, 319, 320, 9, 23, 2, 2, 320, 321, 9, 4, 2, 2, 321, 75, 3, 2, 2, 2, 322, 323, 9, 15, 2, 2, 323, 324, 9, 4, 2, 2, 324, 325, 9, 9, 2, 2, 325, 326, 9, 24, 2, 2, 326, 327, 9, 16, 2, 2, 327, 77, 3, 2, 2, 2, 328, 329, 7, 62, 2, 2, 329, 79, 3, 2, 2, 2, 330, 331, 7, 62, 2, 2, 331, 332, 7, 63, 2, 2, 332, 81, 3, 2, 2, 2, 333, 334, 7, 64, 2, 2, 334, 83, 3, 2, 2, 2, 335, 336, 7, 64, 2, 2, 336, 337, 7, 63, 2, 2, 337, 85, 3, 2, 2, 2, 338, 339, 7, 63, 2, 2, 339, 87, 3, 2, 2, 2, 340, 341, 7, 35, 2, 2, 341, 345, 7, 63, 2, 2, 342, 343, 7, 62, 2, 2, 343, 345, 7, 64, 2, 2, 344, 340, 3, 2, 2, 2, 344, 342, 3, 2, 2, 2, 345, 89, 3, 2, 2, 2, 346, 347, 7, 45, 2, 2, 347, 91, 3, 2, 2, 2, 348, 349, 7, 47, 2, 2, 349, 93, 3, 2, 2, 2, 350, 351, 7, 44, 2, 2, 351, 95, 3, 2, 2, 2, 352, 353, 7, 49, 2, 2, 353, 97, 3, 2, 2, 2, 354, 355, 7, 39, 2, 2, 355, 99, 3, 2, 2, 2, 356, 357, 7, 42, 2, 2, 357, 101, 3, 2, 2, 2, 358, 359, 7, 43, 2, 2, 359, 103, 3, 2, 2, 2, 360, 361, 7, 93, 2, 2, 361, 105, 3, 2, 2, 2, 362, 363, 7, 95, 2, 2, 363, 107, 3, 2, 2, 2, 364, 365, 7, 46, 2, 2, 365, 109, 3, 2, 2, 2, 366, 367, 7, 48, 2, 2, 367, 111, 3, 2, 2, 2, 368, 369, 7, 60, 2, 2, 369, 113, 3, 2, 2, 2, 370, 371, 7, 35, 2, 2, 371, 115, 3, 2, 2, 2, 372, 376, 9, 28, 2, 2, 373, 375, 9, 29, 2, 2, 374, 373, 3, 2, 2, 2, 375, 378, 3, 2, 2, 2, 376, 374, 3, 2, 2, 2, 376, 377, 3, 2, 2, 2, 377, 117, 3, 2, 2, 2, 378, 376, 3, 2, 2, 2, 379, 384, 7, 98, 2, 2, 380, 383, 5, 22, 10, 2, 381, 383, 10, 30, 2, 2, 382, 380, 3, 2, 2, 2, 382, 381, 3, 2, 2, 2, 383, 386, 3, 2, 2, 2, 384, 382, 3, 2, 2, 2, 384, 385, 3, 2, 2, 2, 385, 387, 3, 2, 2, 2, 386, 384, 3, 2, 2, 2, 387, 388, 7, 98, 2, 2, 388, 389, 8, 58, 5, 2, 389, 119, 3, 2, 2, 2, 390, 391, 7, 127, 2, 2, 391, 392, 3, 2, 2, 2, 392, 393, 8, 59, 6, 2, 393, 121, 3, 2, 2, 2, 394, 395, 7, 37, 2, 2, 395, 396, 7, 125, 2, 2, 396, 397, 3, 2, 2, 2, 397, 398, 8, 60, 7, 2, 398, 123, 3, 2, 2, 2, 399, 400, 7, 94, 2, 2, 400, 401, 7, 37, 2, 2, 401, 406, 7, 125, 2, 2, 402, 406, 10, 31, 2, 2, 403, 404, 7, 37, 2, 2, 404, 406, 6, 61, 2, 2, 405, 399, 3, 2, 2, 2, 405, 402, 3, 2, 2, 2, 405, 403, 3, 2, 2, 2, 406, 407, 3, 2, 2, 2, 407, 405, 3, 2, 2, 2, 407, 408, 3, 2, 2, 2, 408, 409, 3, 2, 2, 2, 409, 410, 8, 61, 8, 2, 410, 125, 3, 2, 2, 2, 411, 422, 5, 8, 3, 2, 412, 415, 5, 22, 10, 2, 413, 415, 10, 32, 2, 2, 414, 412, 3, 2, 2, 2, 414, 413, 3, 2, 2, 2, 415, 416, 3, 2, 2, 2, 416, 414, 3, 2, 2, 2, 416, 417, 3, 2, 2, 2, 417, 419, 3, 2, 2, 2, 418, 420, 5, 8, 3, 2, 419, 418, 3, 2, 2, 2, 419, 420, 3, 2, 2, 2, 420, 422, 3, 2, 2, 2, 421, 411, 3, 2, 2, 2, 421, 414, 3, 2, 2, 2, 422, 127, 3, 2, 2, 2, 423, 424, 7, 41, 2, 2, 424, 425, 3, 2, 2, 2, 425, 426, 8, 63, 7, 2, 426, 129, 3, 2, 2, 2, 427, 438, 5, 8, 3, 2, 428, 431, 5, 22, 10, 2, 429, 431, 10, 33, 2, 2, 430, 428, 3, 2, 2, 2, 430, 429, 3, 2, 2, 2, 431, 432, 3, 2, 2, 2, 432, 430, 3, 2, 2, 2, 432, 433, 3, 2, 2, 2, 433, 435, 3, 2, 2, 2, 434, 436, 5, 8, 3, 2, 435, 434, 3, 2, 2, 2, 435, 436, 3, 2, 2, 2, 436, 438, 3, 2, 2, 2, 437, 427, 3, 2, 2, 2, 437, 430, 3, 2, 2, 2, 438, 131, 3, 2, 2, 2, 439, 440, 7, 36, 2, 2, 440, 441, 3, 2, 2, 2, 441, 442, 8, 65, 7, 2, 442, 133, 3, 2, 2, 2, 30, 2, 3, 4, 5, 136, 143, 150, 157, 159, 165, 174, 177, 202, 207, 344, 376, 382, 384, 405, 407, 414, 416, 419, 421, 430, 432, 435, 437, 9, 2, 3, 2, 7, 4, 2, 7, 5, 2, 3, 58, 2, 7, 3, 2, 6, 2, 2, 3, 61, 3] \ No newline at end of file diff --git a/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionLexer.tokens b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionLexer.tokens new file mode 100644 index 00000000..7d9b433f --- /dev/null +++ b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionLexer.tokens @@ -0,0 +1,74 @@ +WS=1 +START_QUOTE=2 +START_DOUBLE_QUOTE=3 +INTEGER_LITERAL=4 +NUMERIC_LITERAL=5 +LEADING_ZERO_INTEGER_LITERAL=6 +AND=7 +BETWEEN=8 +DATE=9 +DAYS=10 +EMPTY=11 +FALSE=12 +HOURS=13 +IN=14 +INTERVAL=15 +IS=16 +MINUTES=17 +MONTHS=18 +NOT=19 +NULL=20 +OR=21 +SECONDS=22 +TIME=23 +TIMESTAMP=24 +TRUE=25 +YEARS=26 +LESS=27 +LESS_EQUAL=28 +GREATER=29 +GREATER_EQUAL=30 +EQUAL=31 +NOT_EQUAL=32 +PLUS=33 +MINUS=34 +ASTERISK=35 +SLASH=36 +PERCENT=37 +LP=38 +RP=39 +LB=40 +RB=41 +COMMA=42 +DOT=43 +COLON=44 +EXCLAMATION_MARK=45 +IDENTIFIER=46 +QUOTED_IDENTIFIER=47 +EXPRESSION_END=48 +EXPRESSION_START=49 +TEXT=50 +TEXT_IN_QUOTE=51 +END_QUOTE=52 +TEXT_IN_DOUBLE_QUOTE=53 +END_DOUBLE_QUOTE=54 +'<'=27 +'<='=28 +'>'=29 +'>='=30 +'='=31 +'+'=33 +'-'=34 +'*'=35 +'/'=36 +'%'=37 +'('=38 +')'=39 +'['=40 +']'=41 +','=42 +'.'=43 +':'=44 +'!'=45 +'}'=48 +'#{'=49 diff --git a/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionLexer.ts b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionLexer.ts new file mode 100644 index 00000000..5dd9ea83 --- /dev/null +++ b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionLexer.ts @@ -0,0 +1,424 @@ +// Generated from target/antlr4/BlazeExpressionLexer.g4 by ANTLR 4.9.0-SNAPSHOT + + +import {LiteralFactory} from "./../LiteralFactory"; + + +import { ATN } from "antlr4ts/atn/ATN"; +import { ATNDeserializer } from "antlr4ts/atn/ATNDeserializer"; +import { CharStream } from "antlr4ts/CharStream"; +import { Lexer } from "antlr4ts/Lexer"; +import { LexerATNSimulator } from "antlr4ts/atn/LexerATNSimulator"; +import { NotNull } from "antlr4ts/Decorators"; +import { Override } from "antlr4ts/Decorators"; +import { RuleContext } from "antlr4ts/RuleContext"; +import { Vocabulary } from "antlr4ts/Vocabulary"; +import { VocabularyImpl } from "antlr4ts/VocabularyImpl"; + +import * as Utils from "antlr4ts/misc/Utils"; + + +export class BlazeExpressionLexer extends Lexer { + public static readonly WS = 1; + public static readonly START_QUOTE = 2; + public static readonly START_DOUBLE_QUOTE = 3; + public static readonly INTEGER_LITERAL = 4; + public static readonly NUMERIC_LITERAL = 5; + public static readonly LEADING_ZERO_INTEGER_LITERAL = 6; + public static readonly AND = 7; + public static readonly BETWEEN = 8; + public static readonly DATE = 9; + public static readonly DAYS = 10; + public static readonly EMPTY = 11; + public static readonly FALSE = 12; + public static readonly HOURS = 13; + public static readonly IN = 14; + public static readonly INTERVAL = 15; + public static readonly IS = 16; + public static readonly MINUTES = 17; + public static readonly MONTHS = 18; + public static readonly NOT = 19; + public static readonly NULL = 20; + public static readonly OR = 21; + public static readonly SECONDS = 22; + public static readonly TIME = 23; + public static readonly TIMESTAMP = 24; + public static readonly TRUE = 25; + public static readonly YEARS = 26; + public static readonly LESS = 27; + public static readonly LESS_EQUAL = 28; + public static readonly GREATER = 29; + public static readonly GREATER_EQUAL = 30; + public static readonly EQUAL = 31; + public static readonly NOT_EQUAL = 32; + public static readonly PLUS = 33; + public static readonly MINUS = 34; + public static readonly ASTERISK = 35; + public static readonly SLASH = 36; + public static readonly PERCENT = 37; + public static readonly LP = 38; + public static readonly RP = 39; + public static readonly LB = 40; + public static readonly RB = 41; + public static readonly COMMA = 42; + public static readonly DOT = 43; + public static readonly COLON = 44; + public static readonly EXCLAMATION_MARK = 45; + public static readonly IDENTIFIER = 46; + public static readonly QUOTED_IDENTIFIER = 47; + public static readonly EXPRESSION_END = 48; + public static readonly EXPRESSION_START = 49; + public static readonly TEXT = 50; + public static readonly TEXT_IN_QUOTE = 51; + public static readonly END_QUOTE = 52; + public static readonly TEXT_IN_DOUBLE_QUOTE = 53; + public static readonly END_DOUBLE_QUOTE = 54; + public static readonly TEMPLATE = 1; + public static readonly QUOTE_STRING = 2; + public static readonly DOUBLE_QUOTE_STRING = 3; + + // tslint:disable:no-trailing-whitespace + public static readonly channelNames: string[] = [ + "DEFAULT_TOKEN_CHANNEL", "HIDDEN", + ]; + + // tslint:disable:no-trailing-whitespace + public static readonly modeNames: string[] = [ + "DEFAULT_MODE", "TEMPLATE", "QUOTE_STRING", "DOUBLE_QUOTE_STRING", + ]; + + public static readonly ruleNames: string[] = [ + "WS", "EOL", "DIGIT", "DIGITS", "DIGIT_NOT_ZERO", "INTEGER", "EXPONENT_PART", + "SIGNED_INTEGER", "ESCAPE_SEQUENCE", "HEX_DIGIT", "UNICODE_ESCAPE", "START_QUOTE", + "START_DOUBLE_QUOTE", "INTEGER_LITERAL", "NUMERIC_LITERAL", "LEADING_ZERO_INTEGER_LITERAL", + "AND", "BETWEEN", "DATE", "DAYS", "EMPTY", "FALSE", "HOURS", "IN", "INTERVAL", + "IS", "MINUTES", "MONTHS", "NOT", "NULL", "OR", "SECONDS", "TIME", "TIMESTAMP", + "TRUE", "YEARS", "LESS", "LESS_EQUAL", "GREATER", "GREATER_EQUAL", "EQUAL", + "NOT_EQUAL", "PLUS", "MINUS", "ASTERISK", "SLASH", "PERCENT", "LP", "RP", + "LB", "RB", "COMMA", "DOT", "COLON", "EXCLAMATION_MARK", "IDENTIFIER", + "QUOTED_IDENTIFIER", "EXPRESSION_END", "EXPRESSION_START", "TEXT", "TEXT_IN_QUOTE", + "END_QUOTE", "TEXT_IN_DOUBLE_QUOTE", "END_DOUBLE_QUOTE", + ]; + + private static readonly _LITERAL_NAMES: Array = [ + undefined, undefined, undefined, undefined, undefined, undefined, undefined, + undefined, undefined, undefined, undefined, undefined, undefined, undefined, + undefined, undefined, undefined, undefined, undefined, undefined, undefined, + undefined, undefined, undefined, undefined, undefined, undefined, "'<'", + "'<='", "'>'", "'>='", "'='", undefined, "'+'", "'-'", "'*'", "'/'", "'%'", + "'('", "')'", "'['", "']'", "','", "'.'", "':'", "'!'", undefined, undefined, + "'}'", "'#{'", + ]; + private static readonly _SYMBOLIC_NAMES: Array = [ + undefined, "WS", "START_QUOTE", "START_DOUBLE_QUOTE", "INTEGER_LITERAL", + "NUMERIC_LITERAL", "LEADING_ZERO_INTEGER_LITERAL", "AND", "BETWEEN", "DATE", + "DAYS", "EMPTY", "FALSE", "HOURS", "IN", "INTERVAL", "IS", "MINUTES", + "MONTHS", "NOT", "NULL", "OR", "SECONDS", "TIME", "TIMESTAMP", "TRUE", + "YEARS", "LESS", "LESS_EQUAL", "GREATER", "GREATER_EQUAL", "EQUAL", "NOT_EQUAL", + "PLUS", "MINUS", "ASTERISK", "SLASH", "PERCENT", "LP", "RP", "LB", "RB", + "COMMA", "DOT", "COLON", "EXCLAMATION_MARK", "IDENTIFIER", "QUOTED_IDENTIFIER", + "EXPRESSION_END", "EXPRESSION_START", "TEXT", "TEXT_IN_QUOTE", "END_QUOTE", + "TEXT_IN_DOUBLE_QUOTE", "END_DOUBLE_QUOTE", + ]; + public static readonly VOCABULARY: Vocabulary = new VocabularyImpl(BlazeExpressionLexer._LITERAL_NAMES, BlazeExpressionLexer._SYMBOLIC_NAMES, []); + + // @Override + // @NotNull + public get vocabulary(): Vocabulary { + return BlazeExpressionLexer.VOCABULARY; + } + // tslint:enable:no-trailing-whitespace + + + private getText(): string { + return this.text; + } + private setText(text: string) { + this.text = text; + } + + + constructor(input: CharStream) { + super(input); + this._interp = new LexerATNSimulator(BlazeExpressionLexer._ATN, this); + } + + // @Override + public get grammarFileName(): string { return "BlazeExpressionLexer.g4"; } + + // @Override + public get ruleNames(): string[] { return BlazeExpressionLexer.ruleNames; } + + // @Override + public get serializedATN(): string { return BlazeExpressionLexer._serializedATN; } + + // @Override + public get channelNames(): string[] { return BlazeExpressionLexer.channelNames; } + + // @Override + public get modeNames(): string[] { return BlazeExpressionLexer.modeNames; } + + // @Override + public action(_localctx: RuleContext, ruleIndex: number, actionIndex: number): void { + switch (ruleIndex) { + case 56: + this.QUOTED_IDENTIFIER_action(_localctx, actionIndex); + break; + + case 59: + this.TEXT_action(_localctx, actionIndex); + break; + } + } + private QUOTED_IDENTIFIER_action(_localctx: RuleContext, actionIndex: number): void { + switch (actionIndex) { + case 0: + this.setText(LiteralFactory.unescapeString(this.getText())); + break; + } + } + private TEXT_action(_localctx: RuleContext, actionIndex: number): void { + switch (actionIndex) { + case 1: + this.setText(LiteralFactory.unescapeTemplateText(this.getText())); + break; + } + } + // @Override + public sempred(_localctx: RuleContext, ruleIndex: number, predIndex: number): boolean { + switch (ruleIndex) { + case 59: + return this.TEXT_sempred(_localctx, predIndex); + } + return true; + } + private TEXT_sempred(_localctx: RuleContext, predIndex: number): boolean { + switch (predIndex) { + case 0: + return this._input.LA(1) != LiteralFactory.OPEN_BRACKET ; + } + return true; + } + + public static readonly _serializedATN: string = + "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x028\u01BB\b\x01" + + "\b\x01\b\x01\b\x01\x04\x02\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t" + + "\x05\x04\x06\t\x06\x04\x07\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t" + + "\v\x04\f\t\f\x04\r\t\r\x04\x0E\t\x0E\x04\x0F\t\x0F\x04\x10\t\x10\x04\x11" + + "\t\x11\x04\x12\t\x12\x04\x13\t\x13\x04\x14\t\x14\x04\x15\t\x15\x04\x16" + + "\t\x16\x04\x17\t\x17\x04\x18\t\x18\x04\x19\t\x19\x04\x1A\t\x1A\x04\x1B" + + "\t\x1B\x04\x1C\t\x1C\x04\x1D\t\x1D\x04\x1E\t\x1E\x04\x1F\t\x1F\x04 \t" + + " \x04!\t!\x04\"\t\"\x04#\t#\x04$\t$\x04%\t%\x04&\t&\x04\'\t\'\x04(\t(" + + "\x04)\t)\x04*\t*\x04+\t+\x04,\t,\x04-\t-\x04.\t.\x04/\t/\x040\t0\x041" + + "\t1\x042\t2\x043\t3\x044\t4\x045\t5\x046\t6\x047\t7\x048\t8\x049\t9\x04" + + ":\t:\x04;\t;\x04<\t<\x04=\t=\x04>\t>\x04?\t?\x04@\t@\x04A\tA\x03\x02\x03" + + "\x02\x05\x02\x89\n\x02\x03\x02\x03\x02\x03\x03\x03\x03\x03\x03\x05\x03" + + "\x90\n\x03\x03\x04\x03\x04\x03\x05\x06\x05\x95\n\x05\r\x05\x0E\x05\x96" + + "\x03\x06\x03\x06\x03\x07\x03\x07\x03\x07\x05\x07\x9E\n\x07\x05\x07\xA0" + + "\n\x07\x03\b\x03\b\x03\b\x03\t\x05\t\xA6\n\t\x03\t\x03\t\x03\n\x03\n\x03" + + "\n\x03\n\x03\n\x05\n\xAF\n\n\x03\n\x05\n\xB2\n\n\x03\v\x03\v\x03\f\x03" + + "\f\x03\f\x03\f\x03\f\x03\f\x03\f\x03\r\x03\r\x03\r\x03\r\x03\x0E\x03\x0E" + + "\x03\x0E\x03\x0E\x03\x0F\x03\x0F\x03\x10\x03\x10\x03\x10\x03\x10\x05\x10" + + "\xCB\n\x10\x03\x10\x03\x10\x03\x10\x05\x10\xD0\n\x10\x03\x11\x03\x11\x03" + + "\x11\x03\x12\x03\x12\x03\x12\x03\x12\x03\x13\x03\x13\x03\x13\x03\x13\x03" + + "\x13\x03\x13\x03\x13\x03\x13\x03\x14\x03\x14\x03\x14\x03\x14\x03\x14\x03" + + "\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x16\x03\x16\x03\x16\x03\x16\x03" + + "\x16\x03\x16\x03\x17\x03\x17\x03\x17\x03\x17\x03\x17\x03\x17\x03\x18\x03" + + "\x18\x03\x18\x03\x18\x03\x18\x03\x18\x03\x19\x03\x19\x03\x19\x03\x1A\x03" + + "\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1A\x03\x1B\x03" + + "\x1B\x03\x1B\x03\x1C\x03\x1C\x03\x1C\x03\x1C\x03\x1C\x03\x1C\x03\x1C\x03" + + "\x1C\x03\x1D\x03\x1D\x03\x1D\x03\x1D\x03\x1D\x03\x1D\x03\x1D\x03\x1E\x03" + + "\x1E\x03\x1E\x03\x1E\x03\x1F\x03\x1F\x03\x1F\x03\x1F\x03\x1F\x03 \x03" + + " \x03 \x03!\x03!\x03!\x03!\x03!\x03!\x03!\x03!\x03\"\x03\"\x03\"\x03\"" + + "\x03\"\x03#\x03#\x03#\x03#\x03#\x03#\x03#\x03#\x03#\x03#\x03$\x03$\x03" + + "$\x03$\x03$\x03%\x03%\x03%\x03%\x03%\x03%\x03&\x03&\x03\'\x03\'\x03\'" + + "\x03(\x03(\x03)\x03)\x03)\x03*\x03*\x03+\x03+\x03+\x03+\x05+\u0159\n+" + + "\x03,\x03,\x03-\x03-\x03.\x03.\x03/\x03/\x030\x030\x031\x031\x032\x03" + + "2\x033\x033\x034\x034\x035\x035\x036\x036\x037\x037\x038\x038\x039\x03" + + "9\x079\u0177\n9\f9\x0E9\u017A\v9\x03:\x03:\x03:\x07:\u017F\n:\f:\x0E:" + + "\u0182\v:\x03:\x03:\x03:\x03;\x03;\x03;\x03;\x03<\x03<\x03<\x03<\x03<" + + "\x03=\x03=\x03=\x03=\x03=\x03=\x06=\u0196\n=\r=\x0E=\u0197\x03=\x03=\x03" + + ">\x03>\x03>\x06>\u019F\n>\r>\x0E>\u01A0\x03>\x05>\u01A4\n>\x05>\u01A6" + + "\n>\x03?\x03?\x03?\x03?\x03@\x03@\x03@\x06@\u01AF\n@\r@\x0E@\u01B0\x03" + + "@\x05@\u01B4\n@\x05@\u01B6\n@\x03A\x03A\x03A\x03A\x02\x02\x02B\x06\x02" + + "\x03\b\x02\x02\n\x02\x02\f\x02\x02\x0E\x02\x02\x10\x02\x02\x12\x02\x02" + + "\x14\x02\x02\x16\x02\x02\x18\x02\x02\x1A\x02\x02\x1C\x02\x04\x1E\x02\x05" + + " \x02\x06\"\x02\x07$\x02\b&\x02\t(\x02\n*\x02\v,\x02\f.\x02\r0\x02\x0E" + + "2\x02\x0F4\x02\x106\x02\x118\x02\x12:\x02\x13<\x02\x14>\x02\x15@\x02\x16" + + "B\x02\x17D\x02\x18F\x02\x19H\x02\x1AJ\x02\x1BL\x02\x1CN\x02\x1DP\x02\x1E" + + "R\x02\x1FT\x02 V\x02!X\x02\"Z\x02#\\\x02$^\x02%`\x02&b\x02\'d\x02(f\x02" + + ")h\x02*j\x02+l\x02,n\x02-p\x02.r\x02/t\x020v\x021x\x022z\x023|\x024~\x02" + + "5\x80\x026\x82\x027\x84\x028\x06\x02\x03\x04\x05\"\x05\x02\v\v\x0E\x0E" + + "\"\"\x04\x02\f\f\x0F\x0F\x04\x02GGgg\x04\x02--//\x07\x02ddhhppttvv\x04" + + "\x02))^^\x05\x022;CHch\x04\x02CCcc\x04\x02PPpp\x04\x02FFff\x04\x02DDd" + + "d\x04\x02VVvv\x04\x02YYyy\x04\x02[[{{\x04\x02UUuu\x04\x02OOoo\x04\x02" + + "RRrr\x04\x02HHhh\x04\x02NNnn\x04\x02JJjj\x04\x02QQqq\x04\x02WWww\x04\x02" + + "TTtt\x04\x02KKkk\x04\x02XXxx\x04\x02EEee\x07\x02&&C\\aac|\x82\x00\b\x02" + + "&&2;C\\aac|\x82\x00\x06\x02\f\f\x0F\x0F^^bb\x03\x02%%\x06\x02\f\f\x0F" + + "\x0F))^^\x06\x02\f\f\x0F\x0F$$^^\x02\u01C7\x02\x06\x03\x02\x02\x02\x02" + + "\x1C\x03\x02\x02\x02\x02\x1E\x03\x02\x02\x02\x02 \x03\x02\x02\x02\x02" + + "\"\x03\x02\x02\x02\x02$\x03\x02\x02\x02\x02&\x03\x02\x02\x02\x02(\x03" + + "\x02\x02\x02\x02*\x03\x02\x02\x02\x02,\x03\x02\x02\x02\x02.\x03\x02\x02" + + "\x02\x020\x03\x02\x02\x02\x022\x03\x02\x02\x02\x024\x03\x02\x02\x02\x02" + + "6\x03\x02\x02\x02\x028\x03\x02\x02\x02\x02:\x03\x02\x02\x02\x02<\x03\x02" + + "\x02\x02\x02>\x03\x02\x02\x02\x02@\x03\x02\x02\x02\x02B\x03\x02\x02\x02" + + "\x02D\x03\x02\x02\x02\x02F\x03\x02\x02\x02\x02H\x03\x02\x02\x02\x02J\x03" + + "\x02\x02\x02\x02L\x03\x02\x02\x02\x02N\x03\x02\x02\x02\x02P\x03\x02\x02" + + "\x02\x02R\x03\x02\x02\x02\x02T\x03\x02\x02\x02\x02V\x03\x02\x02\x02\x02" + + "X\x03\x02\x02\x02\x02Z\x03\x02\x02\x02\x02\\\x03\x02\x02\x02\x02^\x03" + + "\x02\x02\x02\x02`\x03\x02\x02\x02\x02b\x03\x02\x02\x02\x02d\x03\x02\x02" + + "\x02\x02f\x03\x02\x02\x02\x02h\x03\x02\x02\x02\x02j\x03\x02\x02\x02\x02" + + "l\x03\x02\x02\x02\x02n\x03\x02\x02\x02\x02p\x03\x02\x02\x02\x02r\x03\x02" + + "\x02\x02\x02t\x03\x02\x02\x02\x02v\x03\x02\x02\x02\x02x\x03\x02\x02\x02" + + "\x03z\x03\x02\x02\x02\x03|\x03\x02\x02\x02\x04~\x03\x02\x02\x02\x04\x80" + + "\x03\x02\x02\x02\x05\x82\x03\x02\x02\x02\x05\x84\x03\x02\x02\x02\x06\x88" + + "\x03\x02\x02\x02\b\x8F\x03\x02\x02\x02\n\x91\x03\x02\x02\x02\f\x94\x03" + + "\x02\x02\x02\x0E\x98\x03\x02\x02\x02\x10\x9F\x03\x02\x02\x02\x12\xA1\x03" + + "\x02\x02\x02\x14\xA5\x03\x02\x02\x02\x16\xB1\x03\x02\x02\x02\x18\xB3\x03" + + "\x02\x02\x02\x1A\xB5\x03\x02\x02\x02\x1C\xBC\x03\x02\x02\x02\x1E\xC0\x03" + + "\x02\x02\x02 \xC4\x03\x02\x02\x02\"\xCF\x03\x02\x02\x02$\xD1\x03\x02\x02" + + "\x02&\xD4\x03\x02\x02\x02(\xD8\x03\x02\x02\x02*\xE0\x03\x02\x02\x02,\xE5" + + "\x03\x02\x02\x02.\xEA\x03\x02\x02\x020\xF0\x03\x02\x02\x022\xF6\x03\x02" + + "\x02\x024\xFC\x03\x02\x02\x026\xFF\x03\x02\x02\x028\u0108\x03\x02\x02" + + "\x02:\u010B\x03\x02\x02\x02<\u0113\x03\x02\x02\x02>\u011A\x03\x02\x02" + + "\x02@\u011E\x03\x02\x02\x02B\u0123\x03\x02\x02\x02D\u0126\x03\x02\x02" + + "\x02F\u012E\x03\x02\x02\x02H\u0133\x03\x02\x02\x02J\u013D\x03\x02\x02" + + "\x02L\u0142\x03\x02\x02\x02N\u0148\x03\x02\x02\x02P\u014A\x03\x02\x02" + + "\x02R\u014D\x03\x02\x02\x02T\u014F\x03\x02\x02\x02V\u0152\x03\x02\x02" + + "\x02X\u0158\x03\x02\x02\x02Z\u015A\x03\x02\x02\x02\\\u015C\x03\x02\x02" + + "\x02^\u015E\x03\x02\x02\x02`\u0160\x03\x02\x02\x02b\u0162\x03\x02\x02" + + "\x02d\u0164\x03\x02\x02\x02f\u0166\x03\x02\x02\x02h\u0168\x03\x02\x02" + + "\x02j\u016A\x03\x02\x02\x02l\u016C\x03\x02\x02\x02n\u016E\x03\x02\x02" + + "\x02p\u0170\x03\x02\x02\x02r\u0172\x03\x02\x02\x02t\u0174\x03\x02\x02" + + "\x02v\u017B\x03\x02\x02\x02x\u0186\x03\x02\x02\x02z\u018A\x03\x02\x02" + + "\x02|\u0195\x03\x02\x02\x02~\u01A5\x03\x02\x02\x02\x80\u01A7\x03\x02\x02" + + "\x02\x82\u01B5\x03\x02\x02\x02\x84\u01B7\x03\x02\x02\x02\x86\x89\t\x02" + + "\x02\x02\x87\x89\x05\b\x03\x02\x88\x86\x03\x02\x02\x02\x88\x87\x03\x02" + + "\x02\x02\x89\x8A\x03\x02\x02\x02\x8A\x8B\b\x02\x02\x02\x8B\x07\x03\x02" + + "\x02\x02\x8C\x8D\x07\x0F\x02\x02\x8D\x90\x07\f\x02\x02\x8E\x90\t\x03\x02" + + "\x02\x8F\x8C\x03\x02\x02\x02\x8F\x8E\x03\x02\x02\x02\x90\t\x03\x02\x02" + + "\x02\x91\x92\x042;\x02\x92\v\x03\x02\x02\x02\x93\x95\x05\n\x04\x02\x94" + + "\x93\x03\x02\x02\x02\x95\x96\x03\x02\x02\x02\x96\x94\x03\x02\x02\x02\x96" + + "\x97\x03\x02\x02\x02\x97\r\x03\x02\x02\x02\x98\x99\x043;\x02\x99\x0F\x03" + + "\x02\x02\x02\x9A\xA0\x072\x02\x02\x9B\x9D\x05\x0E\x06\x02\x9C\x9E\x05" + + "\f\x05\x02\x9D\x9C\x03\x02\x02\x02\x9D\x9E\x03\x02\x02\x02\x9E\xA0\x03" + + "\x02\x02\x02\x9F\x9A\x03\x02\x02\x02\x9F\x9B\x03\x02\x02\x02\xA0\x11\x03" + + "\x02\x02\x02\xA1\xA2\t\x04\x02\x02\xA2\xA3\x05\x14\t\x02\xA3\x13\x03\x02" + + "\x02\x02\xA4\xA6\t\x05\x02\x02\xA5\xA4\x03\x02\x02\x02\xA5\xA6\x03\x02" + + "\x02\x02\xA6\xA7\x03\x02\x02\x02\xA7\xA8\x05\f\x05\x02\xA8\x15\x03\x02" + + "\x02\x02\xA9\xAE\x07^\x02\x02\xAA\xAF\t\x06\x02\x02\xAB\xAC\x07^\x02\x02" + + "\xAC\xAF\x07$\x02\x02\xAD\xAF\t\x07\x02\x02\xAE\xAA\x03\x02\x02\x02\xAE" + + "\xAB\x03\x02\x02\x02\xAE\xAD\x03\x02\x02\x02\xAF\xB2\x03\x02\x02\x02\xB0" + + "\xB2\x05\x1A\f\x02\xB1\xA9\x03\x02\x02\x02\xB1\xB0\x03\x02\x02\x02\xB2" + + "\x17\x03\x02\x02\x02\xB3\xB4\t\b\x02\x02\xB4\x19\x03\x02\x02\x02\xB5\xB6" + + "\x07^\x02\x02\xB6\xB7\x07w\x02\x02\xB7\xB8\x05\x18\v\x02\xB8\xB9\x05\x18" + + "\v\x02\xB9\xBA\x05\x18\v\x02\xBA\xBB\x05\x18\v\x02\xBB\x1B\x03\x02\x02" + + "\x02\xBC\xBD\x07)\x02\x02\xBD\xBE\x03\x02\x02\x02\xBE\xBF\b\r\x03\x02" + + "\xBF\x1D\x03\x02\x02\x02\xC0\xC1\x07$\x02\x02\xC1\xC2\x03\x02\x02\x02" + + "\xC2\xC3\b\x0E\x04\x02\xC3\x1F\x03\x02\x02\x02\xC4\xC5\x05\x10\x07\x02" + + "\xC5!\x03\x02\x02\x02\xC6\xC7\x05\x10\x07\x02\xC7\xC8\x070\x02\x02\xC8" + + "\xCA\x05\f\x05\x02\xC9\xCB\x05\x12\b\x02\xCA\xC9\x03\x02\x02\x02\xCA\xCB" + + "\x03\x02\x02\x02\xCB\xD0\x03\x02\x02\x02\xCC\xCD\x05\x10\x07\x02\xCD\xCE" + + "\x05\x12\b\x02\xCE\xD0\x03\x02\x02\x02\xCF\xC6\x03\x02\x02\x02\xCF\xCC" + + "\x03\x02\x02\x02\xD0#\x03\x02\x02\x02\xD1\xD2\x072\x02\x02\xD2\xD3\x05" + + "\f\x05\x02\xD3%\x03\x02\x02\x02\xD4\xD5\t\t\x02\x02\xD5\xD6\t\n\x02\x02" + + "\xD6\xD7\t\v\x02\x02\xD7\'\x03\x02\x02\x02\xD8\xD9\t\f\x02\x02\xD9\xDA" + + "\t\x04\x02\x02\xDA\xDB\t\r\x02\x02\xDB\xDC\t\x0E\x02\x02\xDC\xDD\t\x04" + + "\x02\x02\xDD\xDE\t\x04\x02\x02\xDE\xDF\t\n\x02\x02\xDF)\x03\x02\x02\x02" + + "\xE0\xE1\t\v\x02\x02\xE1\xE2\t\t\x02\x02\xE2\xE3\t\r\x02\x02\xE3\xE4\t" + + "\x04\x02\x02\xE4+\x03\x02\x02\x02\xE5\xE6\t\v\x02\x02\xE6\xE7\t\t\x02" + + "\x02\xE7\xE8\t\x0F\x02\x02\xE8\xE9\t\x10\x02\x02\xE9-\x03\x02\x02\x02" + + "\xEA\xEB\t\x04\x02\x02\xEB\xEC\t\x11\x02\x02\xEC\xED\t\x12\x02\x02\xED" + + "\xEE\t\r\x02\x02\xEE\xEF\t\x0F\x02\x02\xEF/\x03\x02\x02\x02\xF0\xF1\t" + + "\x13\x02\x02\xF1\xF2\t\t\x02\x02\xF2\xF3\t\x14\x02\x02\xF3\xF4\t\x10\x02" + + "\x02\xF4\xF5\t\x04\x02\x02\xF51\x03\x02\x02\x02\xF6\xF7\t\x15\x02\x02" + + "\xF7\xF8\t\x16\x02\x02\xF8\xF9\t\x17\x02\x02\xF9\xFA\t\x18\x02\x02\xFA" + + "\xFB\t\x10\x02\x02\xFB3\x03\x02\x02\x02\xFC\xFD\t\x19\x02\x02\xFD\xFE" + + "\t\n\x02\x02\xFE5\x03\x02\x02\x02\xFF\u0100\t\x19\x02\x02\u0100\u0101" + + "\t\n\x02\x02\u0101\u0102\t\r\x02\x02\u0102\u0103\t\x04\x02\x02\u0103\u0104" + + "\t\x18\x02\x02\u0104\u0105\t\x1A\x02\x02\u0105\u0106\t\t\x02\x02\u0106" + + "\u0107\t\x14\x02\x02\u01077\x03\x02\x02\x02\u0108\u0109\t\x19\x02\x02" + + "\u0109\u010A\t\x10\x02\x02\u010A9\x03\x02\x02\x02\u010B\u010C\t\x11\x02" + + "\x02\u010C\u010D\t\x19\x02\x02\u010D\u010E\t\n\x02\x02\u010E\u010F\t\x17" + + "\x02\x02\u010F\u0110\t\r\x02\x02\u0110\u0111\t\x04\x02\x02\u0111\u0112" + + "\t\x10\x02\x02\u0112;\x03\x02\x02\x02\u0113\u0114\t\x11\x02\x02\u0114" + + "\u0115\t\x16\x02\x02\u0115\u0116\t\n\x02\x02\u0116\u0117\t\r\x02\x02\u0117" + + "\u0118\t\x15\x02\x02\u0118\u0119\t\x10\x02\x02\u0119=\x03\x02\x02\x02" + + "\u011A\u011B\t\n\x02\x02\u011B\u011C\t\x16\x02\x02\u011C\u011D\t\r\x02" + + "\x02\u011D?\x03\x02\x02\x02\u011E\u011F\t\n\x02\x02\u011F\u0120\t\x17" + + "\x02\x02\u0120\u0121\t\x14\x02\x02\u0121\u0122\t\x14\x02\x02\u0122A\x03" + + "\x02\x02\x02\u0123\u0124\t\x16\x02\x02\u0124\u0125\t\x18\x02\x02\u0125" + + "C\x03\x02\x02\x02\u0126\u0127\t\x10\x02\x02\u0127\u0128\t\x04\x02\x02" + + "\u0128\u0129\t\x1B\x02\x02\u0129\u012A\t\x16\x02\x02\u012A\u012B\t\n\x02" + + "\x02\u012B\u012C\t\v\x02\x02\u012C\u012D\t\x10\x02\x02\u012DE\x03\x02" + + "\x02\x02\u012E\u012F\t\r\x02\x02\u012F\u0130\t\x19\x02\x02\u0130\u0131" + + "\t\x11\x02\x02\u0131\u0132\t\x04\x02\x02\u0132G\x03\x02\x02\x02\u0133" + + "\u0134\t\r\x02\x02\u0134\u0135\t\x19\x02\x02\u0135\u0136\t\x11\x02\x02" + + "\u0136\u0137\t\x04\x02\x02\u0137\u0138\t\x10\x02\x02\u0138\u0139\t\r\x02" + + "\x02\u0139\u013A\t\t\x02\x02\u013A\u013B\t\x11\x02\x02\u013B\u013C\t\x12" + + "\x02\x02\u013CI\x03\x02\x02\x02\u013D\u013E\t\r\x02\x02\u013E\u013F\t" + + "\x18\x02\x02\u013F\u0140\t\x17\x02\x02\u0140\u0141\t\x04\x02\x02\u0141" + + "K\x03\x02\x02\x02\u0142\u0143\t\x0F\x02\x02\u0143\u0144\t\x04\x02\x02" + + "\u0144\u0145\t\t\x02\x02\u0145\u0146\t\x18\x02\x02\u0146\u0147\t\x10\x02" + + "\x02\u0147M\x03\x02\x02\x02\u0148\u0149\x07>\x02\x02\u0149O\x03\x02\x02" + + "\x02\u014A\u014B\x07>\x02\x02\u014B\u014C\x07?\x02\x02\u014CQ\x03\x02" + + "\x02\x02\u014D\u014E\x07@\x02\x02\u014ES\x03\x02\x02\x02\u014F\u0150\x07" + + "@\x02\x02\u0150\u0151\x07?\x02\x02\u0151U\x03\x02\x02\x02\u0152\u0153" + + "\x07?\x02\x02\u0153W\x03\x02\x02\x02\u0154\u0155\x07#\x02\x02\u0155\u0159" + + "\x07?\x02\x02\u0156\u0157\x07>\x02\x02\u0157\u0159\x07@\x02\x02\u0158" + + "\u0154\x03\x02\x02\x02\u0158\u0156\x03\x02\x02\x02\u0159Y\x03\x02\x02" + + "\x02\u015A\u015B\x07-\x02\x02\u015B[\x03\x02\x02\x02\u015C\u015D\x07/" + + "\x02\x02\u015D]\x03\x02\x02\x02\u015E\u015F\x07,\x02\x02\u015F_\x03\x02" + + "\x02\x02\u0160\u0161\x071\x02\x02\u0161a\x03\x02\x02\x02\u0162\u0163\x07" + + "\'\x02\x02\u0163c\x03\x02\x02\x02\u0164\u0165\x07*\x02\x02\u0165e\x03" + + "\x02\x02\x02\u0166\u0167\x07+\x02\x02\u0167g\x03\x02\x02\x02\u0168\u0169" + + "\x07]\x02\x02\u0169i\x03\x02\x02\x02\u016A\u016B\x07_\x02\x02\u016Bk\x03" + + "\x02\x02\x02\u016C\u016D\x07.\x02\x02\u016Dm\x03\x02\x02\x02\u016E\u016F" + + "\x070\x02\x02\u016Fo\x03\x02\x02\x02\u0170\u0171\x07<\x02\x02\u0171q\x03" + + "\x02\x02\x02\u0172\u0173\x07#\x02\x02\u0173s\x03\x02\x02\x02\u0174\u0178" + + "\t\x1C\x02\x02\u0175\u0177\t\x1D\x02\x02\u0176\u0175\x03\x02\x02\x02\u0177" + + "\u017A\x03\x02\x02\x02\u0178\u0176\x03\x02\x02\x02\u0178\u0179\x03\x02" + + "\x02\x02\u0179u\x03\x02\x02\x02\u017A\u0178\x03\x02\x02\x02\u017B\u0180" + + "\x07b\x02\x02\u017C\u017F\x05\x16\n\x02\u017D\u017F\n\x1E\x02\x02\u017E" + + "\u017C\x03\x02\x02\x02\u017E\u017D\x03\x02\x02\x02\u017F\u0182\x03\x02" + + "\x02\x02\u0180\u017E\x03\x02\x02\x02\u0180\u0181\x03\x02\x02\x02\u0181" + + "\u0183\x03\x02\x02\x02\u0182\u0180\x03\x02\x02\x02\u0183\u0184\x07b\x02" + + "\x02\u0184\u0185\b:\x05\x02\u0185w\x03\x02\x02\x02\u0186\u0187\x07\x7F" + + "\x02\x02\u0187\u0188\x03\x02\x02\x02\u0188\u0189\b;\x06\x02\u0189y\x03" + + "\x02\x02\x02\u018A\u018B\x07%\x02\x02\u018B\u018C\x07}\x02\x02\u018C\u018D" + + "\x03\x02\x02\x02\u018D\u018E\b<\x07\x02\u018E{\x03\x02\x02\x02\u018F\u0190" + + "\x07^\x02\x02\u0190\u0191\x07%\x02\x02\u0191\u0196\x07}\x02\x02\u0192" + + "\u0196\n\x1F\x02\x02\u0193\u0194\x07%\x02\x02\u0194\u0196\x06=\x02\x02" + + "\u0195\u018F\x03\x02\x02\x02\u0195\u0192\x03\x02\x02\x02\u0195\u0193\x03" + + "\x02\x02\x02\u0196\u0197\x03\x02\x02\x02\u0197\u0195\x03\x02\x02\x02\u0197" + + "\u0198\x03\x02\x02\x02\u0198\u0199\x03\x02\x02\x02\u0199\u019A\b=\b\x02" + + "\u019A}\x03\x02\x02\x02\u019B\u01A6\x05\b\x03\x02\u019C\u019F\x05\x16" + + "\n\x02\u019D\u019F\n \x02\x02\u019E\u019C\x03\x02\x02\x02\u019E\u019D" + + "\x03\x02\x02\x02\u019F\u01A0\x03\x02\x02\x02\u01A0\u019E\x03\x02\x02\x02" + + "\u01A0\u01A1\x03\x02\x02\x02\u01A1\u01A3\x03\x02\x02\x02\u01A2\u01A4\x05" + + "\b\x03\x02\u01A3\u01A2\x03\x02\x02\x02\u01A3\u01A4\x03\x02\x02\x02\u01A4" + + "\u01A6\x03\x02\x02\x02\u01A5\u019B\x03\x02\x02\x02\u01A5\u019E\x03\x02" + + "\x02\x02\u01A6\x7F\x03\x02\x02\x02\u01A7\u01A8\x07)\x02\x02\u01A8\u01A9" + + "\x03\x02\x02\x02\u01A9\u01AA\b?\x07\x02\u01AA\x81\x03\x02\x02\x02\u01AB" + + "\u01B6\x05\b\x03\x02\u01AC\u01AF\x05\x16\n\x02\u01AD\u01AF\n!\x02\x02" + + "\u01AE\u01AC\x03\x02\x02\x02\u01AE\u01AD\x03\x02\x02\x02\u01AF\u01B0\x03" + + "\x02\x02\x02\u01B0\u01AE\x03\x02\x02\x02\u01B0\u01B1\x03\x02\x02\x02\u01B1" + + "\u01B3\x03\x02\x02\x02\u01B2\u01B4\x05\b\x03\x02\u01B3\u01B2\x03\x02\x02" + + "\x02\u01B3\u01B4\x03\x02\x02\x02\u01B4\u01B6\x03\x02\x02\x02\u01B5\u01AB" + + "\x03\x02\x02\x02\u01B5\u01AE\x03\x02\x02\x02\u01B6\x83\x03\x02\x02\x02" + + "\u01B7\u01B8\x07$\x02\x02\u01B8\u01B9\x03\x02\x02\x02\u01B9\u01BA\bA\x07" + + "\x02\u01BA\x85\x03\x02\x02\x02\x1E\x02\x03\x04\x05\x88\x8F\x96\x9D\x9F" + + "\xA5\xAE\xB1\xCA\xCF\u0158\u0178\u017E\u0180\u0195\u0197\u019E\u01A0\u01A3" + + "\u01A5\u01AE\u01B0\u01B3\u01B5\t\x02\x03\x02\x07\x04\x02\x07\x05\x02\x03" + + ":\x02\x07\x03\x02\x06\x02\x02\x03=\x03"; + public static __ATN: ATN; + public static get _ATN(): ATN { + if (!BlazeExpressionLexer.__ATN) { + BlazeExpressionLexer.__ATN = new ATNDeserializer().deserialize(Utils.toCharArray(BlazeExpressionLexer._serializedATN)); + } + + return BlazeExpressionLexer.__ATN; + } + +} + diff --git a/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParser.interp b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParser.interp new file mode 100644 index 00000000..397e0d9c --- /dev/null +++ b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParser.interp @@ -0,0 +1,142 @@ +token literal names: +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +'<' +'<=' +'>' +'>=' +'=' +null +'+' +'-' +'*' +'/' +'%' +'(' +')' +'[' +']' +',' +'.' +':' +'!' +null +null +'}' +'#{' +null +null +null +null +null + +token symbolic names: +null +WS +START_QUOTE +START_DOUBLE_QUOTE +INTEGER_LITERAL +NUMERIC_LITERAL +LEADING_ZERO_INTEGER_LITERAL +AND +BETWEEN +DATE +DAYS +EMPTY +FALSE +HOURS +IN +INTERVAL +IS +MINUTES +MONTHS +NOT +NULL +OR +SECONDS +TIME +TIMESTAMP +TRUE +YEARS +LESS +LESS_EQUAL +GREATER +GREATER_EQUAL +EQUAL +NOT_EQUAL +PLUS +MINUS +ASTERISK +SLASH +PERCENT +LP +RP +LB +RB +COMMA +DOT +COLON +EXCLAMATION_MARK +IDENTIFIER +QUOTED_IDENTIFIER +EXPRESSION_END +EXPRESSION_START +TEXT +TEXT_IN_QUOTE +END_QUOTE +TEXT_IN_DOUBLE_QUOTE +END_DOUBLE_QUOTE + +rule names: +parsePredicate +parseExpression +parseExpressionOrPredicate +parseTemplate +template +expression +predicate +predicateOrExpression +inList +path +pathAttributes +literal +stringLiteral +collectionLiteral +entityLiteral +functionInvocation +dateLiteral +timeLiteral +timestampLiteral +datePart +timePart +temporalIntervalLiteral +identifier + + +atn: +[3, 51485, 51898, 1421, 44986, 20307, 1543, 60043, 49729, 3, 56, 419, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 5, 5, 5, 59, 10, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 6, 6, 68, 10, 6, 13, 6, 14, 6, 69, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 5, 7, 84, 10, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 7, 7, 92, 10, 7, 12, 7, 14, 7, 95, 11, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 107, 10, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 114, 10, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 144, 10, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 151, 10, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 160, 10, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 7, 8, 168, 10, 8, 12, 8, 14, 8, 171, 11, 8, 3, 9, 3, 9, 5, 9, 175, 10, 9, 3, 10, 3, 10, 3, 10, 3, 10, 7, 10, 181, 10, 10, 12, 10, 14, 10, 184, 11, 10, 3, 10, 3, 10, 3, 10, 5, 10, 189, 10, 10, 3, 11, 3, 11, 5, 11, 193, 10, 11, 3, 11, 3, 11, 3, 11, 5, 11, 198, 10, 11, 3, 12, 3, 12, 6, 12, 202, 10, 12, 13, 12, 14, 12, 203, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 217, 10, 13, 3, 14, 3, 14, 7, 14, 221, 10, 14, 12, 14, 14, 14, 224, 11, 14, 3, 14, 3, 14, 3, 14, 7, 14, 229, 10, 14, 12, 14, 14, 14, 232, 11, 14, 3, 14, 5, 14, 235, 10, 14, 3, 15, 3, 15, 3, 15, 3, 15, 7, 15, 241, 10, 15, 12, 15, 14, 15, 244, 11, 15, 5, 15, 246, 10, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 7, 16, 257, 10, 16, 12, 16, 14, 16, 260, 11, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 7, 17, 274, 10, 17, 12, 17, 14, 17, 277, 11, 17, 3, 17, 3, 17, 3, 17, 3, 17, 5, 17, 283, 10, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 7, 17, 292, 10, 17, 12, 17, 14, 17, 295, 11, 17, 3, 17, 5, 17, 298, 10, 17, 3, 17, 3, 17, 5, 17, 302, 10, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 5, 19, 314, 10, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 5, 20, 324, 10, 20, 5, 20, 326, 10, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 347, 10, 23, 3, 23, 3, 23, 5, 23, 351, 10, 23, 3, 23, 3, 23, 5, 23, 355, 10, 23, 3, 23, 3, 23, 5, 23, 359, 10, 23, 3, 23, 3, 23, 5, 23, 363, 10, 23, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 369, 10, 23, 3, 23, 3, 23, 5, 23, 373, 10, 23, 3, 23, 3, 23, 5, 23, 377, 10, 23, 3, 23, 3, 23, 5, 23, 381, 10, 23, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 387, 10, 23, 3, 23, 3, 23, 5, 23, 391, 10, 23, 3, 23, 3, 23, 5, 23, 395, 10, 23, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 401, 10, 23, 3, 23, 3, 23, 5, 23, 405, 10, 23, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 411, 10, 23, 3, 23, 3, 23, 5, 23, 415, 10, 23, 3, 24, 3, 24, 3, 24, 2, 2, 4, 12, 14, 25, 2, 2, 4, 2, 6, 2, 8, 2, 10, 2, 12, 2, 14, 2, 16, 2, 18, 2, 20, 2, 22, 2, 24, 2, 26, 2, 28, 2, 30, 2, 32, 2, 34, 2, 36, 2, 38, 2, 40, 2, 42, 2, 44, 2, 46, 2, 2, 7, 3, 2, 37, 39, 3, 2, 35, 36, 4, 2, 21, 21, 47, 47, 4, 2, 6, 6, 8, 8, 8, 2, 9, 12, 15, 16, 18, 21, 23, 26, 28, 28, 48, 49, 2, 474, 2, 48, 3, 2, 2, 2, 4, 51, 3, 2, 2, 2, 6, 54, 3, 2, 2, 2, 8, 58, 3, 2, 2, 2, 10, 67, 3, 2, 2, 2, 12, 83, 3, 2, 2, 2, 14, 159, 3, 2, 2, 2, 16, 174, 3, 2, 2, 2, 18, 188, 3, 2, 2, 2, 20, 197, 3, 2, 2, 2, 22, 201, 3, 2, 2, 2, 24, 216, 3, 2, 2, 2, 26, 234, 3, 2, 2, 2, 28, 236, 3, 2, 2, 2, 30, 249, 3, 2, 2, 2, 32, 301, 3, 2, 2, 2, 34, 303, 3, 2, 2, 2, 36, 308, 3, 2, 2, 2, 38, 317, 3, 2, 2, 2, 40, 329, 3, 2, 2, 2, 42, 335, 3, 2, 2, 2, 44, 341, 3, 2, 2, 2, 46, 416, 3, 2, 2, 2, 48, 49, 5, 14, 8, 2, 49, 50, 7, 2, 2, 3, 50, 3, 3, 2, 2, 2, 51, 52, 5, 12, 7, 2, 52, 53, 7, 2, 2, 3, 53, 5, 3, 2, 2, 2, 54, 55, 5, 16, 9, 2, 55, 56, 7, 2, 2, 3, 56, 7, 3, 2, 2, 2, 57, 59, 5, 10, 6, 2, 58, 57, 3, 2, 2, 2, 58, 59, 3, 2, 2, 2, 59, 60, 3, 2, 2, 2, 60, 61, 7, 2, 2, 3, 61, 9, 3, 2, 2, 2, 62, 68, 7, 52, 2, 2, 63, 64, 7, 51, 2, 2, 64, 65, 5, 12, 7, 2, 65, 66, 7, 50, 2, 2, 66, 68, 3, 2, 2, 2, 67, 62, 3, 2, 2, 2, 67, 63, 3, 2, 2, 2, 68, 69, 3, 2, 2, 2, 69, 67, 3, 2, 2, 2, 69, 70, 3, 2, 2, 2, 70, 11, 3, 2, 2, 2, 71, 72, 8, 7, 1, 2, 72, 73, 7, 40, 2, 2, 73, 74, 5, 12, 7, 2, 74, 75, 7, 41, 2, 2, 75, 84, 3, 2, 2, 2, 76, 84, 5, 24, 13, 2, 77, 84, 5, 20, 11, 2, 78, 84, 5, 32, 17, 2, 79, 80, 7, 36, 2, 2, 80, 84, 5, 12, 7, 6, 81, 82, 7, 35, 2, 2, 82, 84, 5, 12, 7, 5, 83, 71, 3, 2, 2, 2, 83, 76, 3, 2, 2, 2, 83, 77, 3, 2, 2, 2, 83, 78, 3, 2, 2, 2, 83, 79, 3, 2, 2, 2, 83, 81, 3, 2, 2, 2, 84, 93, 3, 2, 2, 2, 85, 86, 12, 4, 2, 2, 86, 87, 9, 2, 2, 2, 87, 92, 5, 12, 7, 5, 88, 89, 12, 3, 2, 2, 89, 90, 9, 3, 2, 2, 90, 92, 5, 12, 7, 4, 91, 85, 3, 2, 2, 2, 91, 88, 3, 2, 2, 2, 92, 95, 3, 2, 2, 2, 93, 91, 3, 2, 2, 2, 93, 94, 3, 2, 2, 2, 94, 13, 3, 2, 2, 2, 95, 93, 3, 2, 2, 2, 96, 97, 8, 8, 1, 2, 97, 98, 7, 40, 2, 2, 98, 99, 5, 14, 8, 2, 99, 100, 7, 41, 2, 2, 100, 160, 3, 2, 2, 2, 101, 102, 9, 4, 2, 2, 102, 160, 5, 14, 8, 17, 103, 104, 5, 12, 7, 2, 104, 106, 7, 18, 2, 2, 105, 107, 7, 21, 2, 2, 106, 105, 3, 2, 2, 2, 106, 107, 3, 2, 2, 2, 107, 108, 3, 2, 2, 2, 108, 109, 7, 22, 2, 2, 109, 160, 3, 2, 2, 2, 110, 111, 5, 12, 7, 2, 111, 113, 7, 18, 2, 2, 112, 114, 7, 21, 2, 2, 113, 112, 3, 2, 2, 2, 113, 114, 3, 2, 2, 2, 114, 115, 3, 2, 2, 2, 115, 116, 7, 13, 2, 2, 116, 160, 3, 2, 2, 2, 117, 118, 5, 12, 7, 2, 118, 119, 7, 33, 2, 2, 119, 120, 5, 12, 7, 2, 120, 160, 3, 2, 2, 2, 121, 122, 5, 12, 7, 2, 122, 123, 7, 34, 2, 2, 123, 124, 5, 12, 7, 2, 124, 160, 3, 2, 2, 2, 125, 126, 5, 12, 7, 2, 126, 127, 7, 31, 2, 2, 127, 128, 5, 12, 7, 2, 128, 160, 3, 2, 2, 2, 129, 130, 5, 12, 7, 2, 130, 131, 7, 32, 2, 2, 131, 132, 5, 12, 7, 2, 132, 160, 3, 2, 2, 2, 133, 134, 5, 12, 7, 2, 134, 135, 7, 29, 2, 2, 135, 136, 5, 12, 7, 2, 136, 160, 3, 2, 2, 2, 137, 138, 5, 12, 7, 2, 138, 139, 7, 30, 2, 2, 139, 140, 5, 12, 7, 2, 140, 160, 3, 2, 2, 2, 141, 143, 5, 12, 7, 2, 142, 144, 7, 21, 2, 2, 143, 142, 3, 2, 2, 2, 143, 144, 3, 2, 2, 2, 144, 145, 3, 2, 2, 2, 145, 146, 7, 16, 2, 2, 146, 147, 5, 18, 10, 2, 147, 160, 3, 2, 2, 2, 148, 150, 5, 12, 7, 2, 149, 151, 7, 21, 2, 2, 150, 149, 3, 2, 2, 2, 150, 151, 3, 2, 2, 2, 151, 152, 3, 2, 2, 2, 152, 153, 7, 10, 2, 2, 153, 154, 5, 12, 7, 2, 154, 155, 7, 9, 2, 2, 155, 156, 5, 12, 7, 2, 156, 160, 3, 2, 2, 2, 157, 160, 5, 32, 17, 2, 158, 160, 5, 20, 11, 2, 159, 96, 3, 2, 2, 2, 159, 101, 3, 2, 2, 2, 159, 103, 3, 2, 2, 2, 159, 110, 3, 2, 2, 2, 159, 117, 3, 2, 2, 2, 159, 121, 3, 2, 2, 2, 159, 125, 3, 2, 2, 2, 159, 129, 3, 2, 2, 2, 159, 133, 3, 2, 2, 2, 159, 137, 3, 2, 2, 2, 159, 141, 3, 2, 2, 2, 159, 148, 3, 2, 2, 2, 159, 157, 3, 2, 2, 2, 159, 158, 3, 2, 2, 2, 160, 169, 3, 2, 2, 2, 161, 162, 12, 16, 2, 2, 162, 163, 7, 9, 2, 2, 163, 168, 5, 14, 8, 17, 164, 165, 12, 15, 2, 2, 165, 166, 7, 23, 2, 2, 166, 168, 5, 14, 8, 16, 167, 161, 3, 2, 2, 2, 167, 164, 3, 2, 2, 2, 168, 171, 3, 2, 2, 2, 169, 167, 3, 2, 2, 2, 169, 170, 3, 2, 2, 2, 170, 15, 3, 2, 2, 2, 171, 169, 3, 2, 2, 2, 172, 175, 5, 12, 7, 2, 173, 175, 5, 14, 8, 2, 174, 172, 3, 2, 2, 2, 174, 173, 3, 2, 2, 2, 175, 17, 3, 2, 2, 2, 176, 177, 7, 40, 2, 2, 177, 182, 5, 12, 7, 2, 178, 179, 7, 44, 2, 2, 179, 181, 5, 12, 7, 2, 180, 178, 3, 2, 2, 2, 181, 184, 3, 2, 2, 2, 182, 180, 3, 2, 2, 2, 182, 183, 3, 2, 2, 2, 183, 185, 3, 2, 2, 2, 184, 182, 3, 2, 2, 2, 185, 186, 7, 41, 2, 2, 186, 189, 3, 2, 2, 2, 187, 189, 5, 12, 7, 2, 188, 176, 3, 2, 2, 2, 188, 187, 3, 2, 2, 2, 189, 19, 3, 2, 2, 2, 190, 192, 5, 46, 24, 2, 191, 193, 5, 22, 12, 2, 192, 191, 3, 2, 2, 2, 192, 193, 3, 2, 2, 2, 193, 198, 3, 2, 2, 2, 194, 195, 5, 32, 17, 2, 195, 196, 5, 22, 12, 2, 196, 198, 3, 2, 2, 2, 197, 190, 3, 2, 2, 2, 197, 194, 3, 2, 2, 2, 198, 21, 3, 2, 2, 2, 199, 200, 7, 45, 2, 2, 200, 202, 5, 46, 24, 2, 201, 199, 3, 2, 2, 2, 202, 203, 3, 2, 2, 2, 203, 201, 3, 2, 2, 2, 203, 204, 3, 2, 2, 2, 204, 23, 3, 2, 2, 2, 205, 217, 7, 7, 2, 2, 206, 217, 7, 6, 2, 2, 207, 217, 5, 26, 14, 2, 208, 217, 7, 27, 2, 2, 209, 217, 7, 14, 2, 2, 210, 217, 5, 34, 18, 2, 211, 217, 5, 36, 19, 2, 212, 217, 5, 38, 20, 2, 213, 217, 5, 44, 23, 2, 214, 217, 5, 28, 15, 2, 215, 217, 5, 30, 16, 2, 216, 205, 3, 2, 2, 2, 216, 206, 3, 2, 2, 2, 216, 207, 3, 2, 2, 2, 216, 208, 3, 2, 2, 2, 216, 209, 3, 2, 2, 2, 216, 210, 3, 2, 2, 2, 216, 211, 3, 2, 2, 2, 216, 212, 3, 2, 2, 2, 216, 213, 3, 2, 2, 2, 216, 214, 3, 2, 2, 2, 216, 215, 3, 2, 2, 2, 217, 25, 3, 2, 2, 2, 218, 222, 7, 4, 2, 2, 219, 221, 7, 53, 2, 2, 220, 219, 3, 2, 2, 2, 221, 224, 3, 2, 2, 2, 222, 220, 3, 2, 2, 2, 222, 223, 3, 2, 2, 2, 223, 225, 3, 2, 2, 2, 224, 222, 3, 2, 2, 2, 225, 235, 7, 54, 2, 2, 226, 230, 7, 5, 2, 2, 227, 229, 7, 55, 2, 2, 228, 227, 3, 2, 2, 2, 229, 232, 3, 2, 2, 2, 230, 228, 3, 2, 2, 2, 230, 231, 3, 2, 2, 2, 231, 233, 3, 2, 2, 2, 232, 230, 3, 2, 2, 2, 233, 235, 7, 56, 2, 2, 234, 218, 3, 2, 2, 2, 234, 226, 3, 2, 2, 2, 235, 27, 3, 2, 2, 2, 236, 245, 7, 42, 2, 2, 237, 242, 5, 24, 13, 2, 238, 239, 7, 44, 2, 2, 239, 241, 5, 24, 13, 2, 240, 238, 3, 2, 2, 2, 241, 244, 3, 2, 2, 2, 242, 240, 3, 2, 2, 2, 242, 243, 3, 2, 2, 2, 243, 246, 3, 2, 2, 2, 244, 242, 3, 2, 2, 2, 245, 237, 3, 2, 2, 2, 245, 246, 3, 2, 2, 2, 246, 247, 3, 2, 2, 2, 247, 248, 7, 43, 2, 2, 248, 29, 3, 2, 2, 2, 249, 250, 5, 46, 24, 2, 250, 258, 7, 40, 2, 2, 251, 252, 5, 46, 24, 2, 252, 253, 7, 33, 2, 2, 253, 254, 5, 16, 9, 2, 254, 255, 7, 44, 2, 2, 255, 257, 3, 2, 2, 2, 256, 251, 3, 2, 2, 2, 257, 260, 3, 2, 2, 2, 258, 256, 3, 2, 2, 2, 258, 259, 3, 2, 2, 2, 259, 261, 3, 2, 2, 2, 260, 258, 3, 2, 2, 2, 261, 262, 5, 46, 24, 2, 262, 263, 7, 33, 2, 2, 263, 264, 5, 16, 9, 2, 264, 265, 7, 41, 2, 2, 265, 31, 3, 2, 2, 2, 266, 267, 5, 46, 24, 2, 267, 282, 7, 40, 2, 2, 268, 269, 5, 46, 24, 2, 269, 270, 7, 33, 2, 2, 270, 271, 5, 16, 9, 2, 271, 272, 7, 44, 2, 2, 272, 274, 3, 2, 2, 2, 273, 268, 3, 2, 2, 2, 274, 277, 3, 2, 2, 2, 275, 273, 3, 2, 2, 2, 275, 276, 3, 2, 2, 2, 276, 278, 3, 2, 2, 2, 277, 275, 3, 2, 2, 2, 278, 279, 5, 46, 24, 2, 279, 280, 7, 33, 2, 2, 280, 281, 5, 16, 9, 2, 281, 283, 3, 2, 2, 2, 282, 275, 3, 2, 2, 2, 282, 283, 3, 2, 2, 2, 283, 284, 3, 2, 2, 2, 284, 285, 7, 41, 2, 2, 285, 302, 3, 2, 2, 2, 286, 287, 5, 46, 24, 2, 287, 297, 7, 40, 2, 2, 288, 289, 5, 16, 9, 2, 289, 290, 7, 44, 2, 2, 290, 292, 3, 2, 2, 2, 291, 288, 3, 2, 2, 2, 292, 295, 3, 2, 2, 2, 293, 291, 3, 2, 2, 2, 293, 294, 3, 2, 2, 2, 294, 296, 3, 2, 2, 2, 295, 293, 3, 2, 2, 2, 296, 298, 5, 16, 9, 2, 297, 293, 3, 2, 2, 2, 297, 298, 3, 2, 2, 2, 298, 299, 3, 2, 2, 2, 299, 300, 7, 41, 2, 2, 300, 302, 3, 2, 2, 2, 301, 266, 3, 2, 2, 2, 301, 286, 3, 2, 2, 2, 302, 33, 3, 2, 2, 2, 303, 304, 7, 11, 2, 2, 304, 305, 7, 40, 2, 2, 305, 306, 5, 40, 21, 2, 306, 307, 7, 41, 2, 2, 307, 35, 3, 2, 2, 2, 308, 309, 7, 25, 2, 2, 309, 310, 7, 40, 2, 2, 310, 313, 5, 42, 22, 2, 311, 312, 7, 45, 2, 2, 312, 314, 9, 5, 2, 2, 313, 311, 3, 2, 2, 2, 313, 314, 3, 2, 2, 2, 314, 315, 3, 2, 2, 2, 315, 316, 7, 41, 2, 2, 316, 37, 3, 2, 2, 2, 317, 318, 7, 26, 2, 2, 318, 319, 7, 40, 2, 2, 319, 325, 5, 40, 21, 2, 320, 323, 5, 42, 22, 2, 321, 322, 7, 45, 2, 2, 322, 324, 9, 5, 2, 2, 323, 321, 3, 2, 2, 2, 323, 324, 3, 2, 2, 2, 324, 326, 3, 2, 2, 2, 325, 320, 3, 2, 2, 2, 325, 326, 3, 2, 2, 2, 326, 327, 3, 2, 2, 2, 327, 328, 7, 41, 2, 2, 328, 39, 3, 2, 2, 2, 329, 330, 7, 6, 2, 2, 330, 331, 7, 36, 2, 2, 331, 332, 9, 5, 2, 2, 332, 333, 7, 36, 2, 2, 333, 334, 9, 5, 2, 2, 334, 41, 3, 2, 2, 2, 335, 336, 9, 5, 2, 2, 336, 337, 7, 46, 2, 2, 337, 338, 9, 5, 2, 2, 338, 339, 7, 46, 2, 2, 339, 340, 9, 5, 2, 2, 340, 43, 3, 2, 2, 2, 341, 414, 7, 17, 2, 2, 342, 343, 7, 6, 2, 2, 343, 346, 7, 28, 2, 2, 344, 345, 7, 6, 2, 2, 345, 347, 7, 20, 2, 2, 346, 344, 3, 2, 2, 2, 346, 347, 3, 2, 2, 2, 347, 350, 3, 2, 2, 2, 348, 349, 7, 6, 2, 2, 349, 351, 7, 12, 2, 2, 350, 348, 3, 2, 2, 2, 350, 351, 3, 2, 2, 2, 351, 354, 3, 2, 2, 2, 352, 353, 7, 6, 2, 2, 353, 355, 7, 15, 2, 2, 354, 352, 3, 2, 2, 2, 354, 355, 3, 2, 2, 2, 355, 358, 3, 2, 2, 2, 356, 357, 7, 6, 2, 2, 357, 359, 7, 19, 2, 2, 358, 356, 3, 2, 2, 2, 358, 359, 3, 2, 2, 2, 359, 362, 3, 2, 2, 2, 360, 361, 7, 6, 2, 2, 361, 363, 7, 24, 2, 2, 362, 360, 3, 2, 2, 2, 362, 363, 3, 2, 2, 2, 363, 415, 3, 2, 2, 2, 364, 365, 7, 6, 2, 2, 365, 368, 7, 20, 2, 2, 366, 367, 7, 6, 2, 2, 367, 369, 7, 12, 2, 2, 368, 366, 3, 2, 2, 2, 368, 369, 3, 2, 2, 2, 369, 372, 3, 2, 2, 2, 370, 371, 7, 6, 2, 2, 371, 373, 7, 15, 2, 2, 372, 370, 3, 2, 2, 2, 372, 373, 3, 2, 2, 2, 373, 376, 3, 2, 2, 2, 374, 375, 7, 6, 2, 2, 375, 377, 7, 19, 2, 2, 376, 374, 3, 2, 2, 2, 376, 377, 3, 2, 2, 2, 377, 380, 3, 2, 2, 2, 378, 379, 7, 6, 2, 2, 379, 381, 7, 24, 2, 2, 380, 378, 3, 2, 2, 2, 380, 381, 3, 2, 2, 2, 381, 415, 3, 2, 2, 2, 382, 383, 7, 6, 2, 2, 383, 386, 7, 12, 2, 2, 384, 385, 7, 6, 2, 2, 385, 387, 7, 15, 2, 2, 386, 384, 3, 2, 2, 2, 386, 387, 3, 2, 2, 2, 387, 390, 3, 2, 2, 2, 388, 389, 7, 6, 2, 2, 389, 391, 7, 19, 2, 2, 390, 388, 3, 2, 2, 2, 390, 391, 3, 2, 2, 2, 391, 394, 3, 2, 2, 2, 392, 393, 7, 6, 2, 2, 393, 395, 7, 24, 2, 2, 394, 392, 3, 2, 2, 2, 394, 395, 3, 2, 2, 2, 395, 415, 3, 2, 2, 2, 396, 397, 7, 6, 2, 2, 397, 400, 7, 15, 2, 2, 398, 399, 7, 6, 2, 2, 399, 401, 7, 19, 2, 2, 400, 398, 3, 2, 2, 2, 400, 401, 3, 2, 2, 2, 401, 404, 3, 2, 2, 2, 402, 403, 7, 6, 2, 2, 403, 405, 7, 24, 2, 2, 404, 402, 3, 2, 2, 2, 404, 405, 3, 2, 2, 2, 405, 415, 3, 2, 2, 2, 406, 407, 7, 6, 2, 2, 407, 410, 7, 19, 2, 2, 408, 409, 7, 6, 2, 2, 409, 411, 7, 24, 2, 2, 410, 408, 3, 2, 2, 2, 410, 411, 3, 2, 2, 2, 411, 415, 3, 2, 2, 2, 412, 413, 7, 6, 2, 2, 413, 415, 7, 24, 2, 2, 414, 342, 3, 2, 2, 2, 414, 364, 3, 2, 2, 2, 414, 382, 3, 2, 2, 2, 414, 396, 3, 2, 2, 2, 414, 406, 3, 2, 2, 2, 414, 412, 3, 2, 2, 2, 415, 45, 3, 2, 2, 2, 416, 417, 9, 6, 2, 2, 417, 47, 3, 2, 2, 2, 52, 58, 67, 69, 83, 91, 93, 106, 113, 143, 150, 159, 167, 169, 174, 182, 188, 192, 197, 203, 216, 222, 230, 234, 242, 245, 258, 275, 282, 293, 297, 301, 313, 323, 325, 346, 350, 354, 358, 362, 368, 372, 376, 380, 386, 390, 394, 400, 404, 410, 414] \ No newline at end of file diff --git a/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParser.tokens b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParser.tokens new file mode 100644 index 00000000..7d9b433f --- /dev/null +++ b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParser.tokens @@ -0,0 +1,74 @@ +WS=1 +START_QUOTE=2 +START_DOUBLE_QUOTE=3 +INTEGER_LITERAL=4 +NUMERIC_LITERAL=5 +LEADING_ZERO_INTEGER_LITERAL=6 +AND=7 +BETWEEN=8 +DATE=9 +DAYS=10 +EMPTY=11 +FALSE=12 +HOURS=13 +IN=14 +INTERVAL=15 +IS=16 +MINUTES=17 +MONTHS=18 +NOT=19 +NULL=20 +OR=21 +SECONDS=22 +TIME=23 +TIMESTAMP=24 +TRUE=25 +YEARS=26 +LESS=27 +LESS_EQUAL=28 +GREATER=29 +GREATER_EQUAL=30 +EQUAL=31 +NOT_EQUAL=32 +PLUS=33 +MINUS=34 +ASTERISK=35 +SLASH=36 +PERCENT=37 +LP=38 +RP=39 +LB=40 +RB=41 +COMMA=42 +DOT=43 +COLON=44 +EXCLAMATION_MARK=45 +IDENTIFIER=46 +QUOTED_IDENTIFIER=47 +EXPRESSION_END=48 +EXPRESSION_START=49 +TEXT=50 +TEXT_IN_QUOTE=51 +END_QUOTE=52 +TEXT_IN_DOUBLE_QUOTE=53 +END_DOUBLE_QUOTE=54 +'<'=27 +'<='=28 +'>'=29 +'>='=30 +'='=31 +'+'=33 +'-'=34 +'*'=35 +'/'=36 +'%'=37 +'('=38 +')'=39 +'['=40 +']'=41 +','=42 +'.'=43 +':'=44 +'!'=45 +'}'=48 +'#{'=49 diff --git a/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParser.ts b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParser.ts new file mode 100644 index 00000000..74e2aa67 --- /dev/null +++ b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParser.ts @@ -0,0 +1,4171 @@ +// Generated from target/antlr4/BlazeExpressionParser.g4 by ANTLR 4.9.0-SNAPSHOT + + +import { ATN } from "antlr4ts/atn/ATN"; +import { ATNDeserializer } from "antlr4ts/atn/ATNDeserializer"; +import { FailedPredicateException } from "antlr4ts/FailedPredicateException"; +import { NotNull } from "antlr4ts/Decorators"; +import { NoViableAltException } from "antlr4ts/NoViableAltException"; +import { Override } from "antlr4ts/Decorators"; +import { Parser } from "antlr4ts/Parser"; +import { ParserRuleContext } from "antlr4ts/ParserRuleContext"; +import { ParserATNSimulator } from "antlr4ts/atn/ParserATNSimulator"; +import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener"; +import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor"; +import { RecognitionException } from "antlr4ts/RecognitionException"; +import { RuleContext } from "antlr4ts/RuleContext"; +//import { RuleVersion } from "antlr4ts/RuleVersion"; +import { TerminalNode } from "antlr4ts/tree/TerminalNode"; +import { Token } from "antlr4ts/Token"; +import { TokenStream } from "antlr4ts/TokenStream"; +import { Vocabulary } from "antlr4ts/Vocabulary"; +import { VocabularyImpl } from "antlr4ts/VocabularyImpl"; + +import * as Utils from "antlr4ts/misc/Utils"; + +import { BlazeExpressionParserListener } from "./BlazeExpressionParserListener"; +import { BlazeExpressionParserVisitor } from "./BlazeExpressionParserVisitor"; + + +export class BlazeExpressionParser extends Parser { + public static readonly WS = 1; + public static readonly START_QUOTE = 2; + public static readonly START_DOUBLE_QUOTE = 3; + public static readonly INTEGER_LITERAL = 4; + public static readonly NUMERIC_LITERAL = 5; + public static readonly LEADING_ZERO_INTEGER_LITERAL = 6; + public static readonly AND = 7; + public static readonly BETWEEN = 8; + public static readonly DATE = 9; + public static readonly DAYS = 10; + public static readonly EMPTY = 11; + public static readonly FALSE = 12; + public static readonly HOURS = 13; + public static readonly IN = 14; + public static readonly INTERVAL = 15; + public static readonly IS = 16; + public static readonly MINUTES = 17; + public static readonly MONTHS = 18; + public static readonly NOT = 19; + public static readonly NULL = 20; + public static readonly OR = 21; + public static readonly SECONDS = 22; + public static readonly TIME = 23; + public static readonly TIMESTAMP = 24; + public static readonly TRUE = 25; + public static readonly YEARS = 26; + public static readonly LESS = 27; + public static readonly LESS_EQUAL = 28; + public static readonly GREATER = 29; + public static readonly GREATER_EQUAL = 30; + public static readonly EQUAL = 31; + public static readonly NOT_EQUAL = 32; + public static readonly PLUS = 33; + public static readonly MINUS = 34; + public static readonly ASTERISK = 35; + public static readonly SLASH = 36; + public static readonly PERCENT = 37; + public static readonly LP = 38; + public static readonly RP = 39; + public static readonly LB = 40; + public static readonly RB = 41; + public static readonly COMMA = 42; + public static readonly DOT = 43; + public static readonly COLON = 44; + public static readonly EXCLAMATION_MARK = 45; + public static readonly IDENTIFIER = 46; + public static readonly QUOTED_IDENTIFIER = 47; + public static readonly EXPRESSION_END = 48; + public static readonly EXPRESSION_START = 49; + public static readonly TEXT = 50; + public static readonly TEXT_IN_QUOTE = 51; + public static readonly END_QUOTE = 52; + public static readonly TEXT_IN_DOUBLE_QUOTE = 53; + public static readonly END_DOUBLE_QUOTE = 54; + public static readonly RULE_parsePredicate = 0; + public static readonly RULE_parseExpression = 1; + public static readonly RULE_parseExpressionOrPredicate = 2; + public static readonly RULE_parseTemplate = 3; + public static readonly RULE_template = 4; + public static readonly RULE_expression = 5; + public static readonly RULE_predicate = 6; + public static readonly RULE_predicateOrExpression = 7; + public static readonly RULE_inList = 8; + public static readonly RULE_path = 9; + public static readonly RULE_pathAttributes = 10; + public static readonly RULE_literal = 11; + public static readonly RULE_stringLiteral = 12; + public static readonly RULE_collectionLiteral = 13; + public static readonly RULE_entityLiteral = 14; + public static readonly RULE_functionInvocation = 15; + public static readonly RULE_dateLiteral = 16; + public static readonly RULE_timeLiteral = 17; + public static readonly RULE_timestampLiteral = 18; + public static readonly RULE_datePart = 19; + public static readonly RULE_timePart = 20; + public static readonly RULE_temporalIntervalLiteral = 21; + public static readonly RULE_identifier = 22; + // tslint:disable:no-trailing-whitespace + public static readonly ruleNames: string[] = [ + "parsePredicate", "parseExpression", "parseExpressionOrPredicate", "parseTemplate", + "template", "expression", "predicate", "predicateOrExpression", "inList", + "path", "pathAttributes", "literal", "stringLiteral", "collectionLiteral", + "entityLiteral", "functionInvocation", "dateLiteral", "timeLiteral", "timestampLiteral", + "datePart", "timePart", "temporalIntervalLiteral", "identifier", + ]; + + private static readonly _LITERAL_NAMES: Array = [ + undefined, undefined, undefined, undefined, undefined, undefined, undefined, + undefined, undefined, undefined, undefined, undefined, undefined, undefined, + undefined, undefined, undefined, undefined, undefined, undefined, undefined, + undefined, undefined, undefined, undefined, undefined, undefined, "'<'", + "'<='", "'>'", "'>='", "'='", undefined, "'+'", "'-'", "'*'", "'/'", "'%'", + "'('", "')'", "'['", "']'", "','", "'.'", "':'", "'!'", undefined, undefined, + "'}'", "'#{'", + ]; + private static readonly _SYMBOLIC_NAMES: Array = [ + undefined, "WS", "START_QUOTE", "START_DOUBLE_QUOTE", "INTEGER_LITERAL", + "NUMERIC_LITERAL", "LEADING_ZERO_INTEGER_LITERAL", "AND", "BETWEEN", "DATE", + "DAYS", "EMPTY", "FALSE", "HOURS", "IN", "INTERVAL", "IS", "MINUTES", + "MONTHS", "NOT", "NULL", "OR", "SECONDS", "TIME", "TIMESTAMP", "TRUE", + "YEARS", "LESS", "LESS_EQUAL", "GREATER", "GREATER_EQUAL", "EQUAL", "NOT_EQUAL", + "PLUS", "MINUS", "ASTERISK", "SLASH", "PERCENT", "LP", "RP", "LB", "RB", + "COMMA", "DOT", "COLON", "EXCLAMATION_MARK", "IDENTIFIER", "QUOTED_IDENTIFIER", + "EXPRESSION_END", "EXPRESSION_START", "TEXT", "TEXT_IN_QUOTE", "END_QUOTE", + "TEXT_IN_DOUBLE_QUOTE", "END_DOUBLE_QUOTE", + ]; + public static readonly VOCABULARY: Vocabulary = new VocabularyImpl(BlazeExpressionParser._LITERAL_NAMES, BlazeExpressionParser._SYMBOLIC_NAMES, []); + + // @Override + // @NotNull + public get vocabulary(): Vocabulary { + return BlazeExpressionParser.VOCABULARY; + } + // tslint:enable:no-trailing-whitespace + + // @Override + public get grammarFileName(): string { return "BlazeExpressionParser.g4"; } + + // @Override + public get ruleNames(): string[] { return BlazeExpressionParser.ruleNames; } + + // @Override + public get serializedATN(): string { return BlazeExpressionParser._serializedATN; } + + protected createFailedPredicateException(predicate?: string, message?: string): FailedPredicateException { + return new FailedPredicateException(this, predicate, message); + } + + constructor(input: TokenStream) { + super(input); + this._interp = new ParserATNSimulator(BlazeExpressionParser._ATN, this); + } + // @RuleVersion(0) + public parsePredicate(): ParsePredicateContext { + let _localctx: ParsePredicateContext = new ParsePredicateContext(this._ctx, this.state); + this.enterRule(_localctx, 0, BlazeExpressionParser.RULE_parsePredicate); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 46; + this.predicate(0); + this.state = 47; + this.match(BlazeExpressionParser.EOF); + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public parseExpression(): ParseExpressionContext { + let _localctx: ParseExpressionContext = new ParseExpressionContext(this._ctx, this.state); + this.enterRule(_localctx, 2, BlazeExpressionParser.RULE_parseExpression); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 49; + this.expression(0); + this.state = 50; + this.match(BlazeExpressionParser.EOF); + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public parseExpressionOrPredicate(): ParseExpressionOrPredicateContext { + let _localctx: ParseExpressionOrPredicateContext = new ParseExpressionOrPredicateContext(this._ctx, this.state); + this.enterRule(_localctx, 4, BlazeExpressionParser.RULE_parseExpressionOrPredicate); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 52; + this.predicateOrExpression(); + this.state = 53; + this.match(BlazeExpressionParser.EOF); + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public parseTemplate(): ParseTemplateContext { + let _localctx: ParseTemplateContext = new ParseTemplateContext(this._ctx, this.state); + this.enterRule(_localctx, 6, BlazeExpressionParser.RULE_parseTemplate); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 56; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (_la === BlazeExpressionParser.EXPRESSION_START || _la === BlazeExpressionParser.TEXT) { + { + this.state = 55; + this.template(); + } + } + + this.state = 58; + this.match(BlazeExpressionParser.EOF); + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public template(): TemplateContext { + let _localctx: TemplateContext = new TemplateContext(this._ctx, this.state); + this.enterRule(_localctx, 8, BlazeExpressionParser.RULE_template); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 65; + this._errHandler.sync(this); + _la = this._input.LA(1); + do { + { + this.state = 65; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case BlazeExpressionParser.TEXT: + { + this.state = 60; + this.match(BlazeExpressionParser.TEXT); + } + break; + case BlazeExpressionParser.EXPRESSION_START: + { + { + this.state = 61; + this.match(BlazeExpressionParser.EXPRESSION_START); + this.state = 62; + this.expression(0); + this.state = 63; + this.match(BlazeExpressionParser.EXPRESSION_END); + } + } + break; + default: + throw new NoViableAltException(this); + } + } + this.state = 67; + this._errHandler.sync(this); + _la = this._input.LA(1); + } while (_la === BlazeExpressionParser.EXPRESSION_START || _la === BlazeExpressionParser.TEXT); + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + + public expression(): ExpressionContext; + public expression(_p: number): ExpressionContext; + // @RuleVersion(0) + public expression(_p?: number): ExpressionContext { + if (_p === undefined) { + _p = 0; + } + + let _parentctx: ParserRuleContext = this._ctx; + let _parentState: number = this.state; + let _localctx: ExpressionContext = new ExpressionContext(this._ctx, _parentState); + let _prevctx: ExpressionContext = _localctx; + let _startState: number = 10; + this.enterRecursionRule(_localctx, 10, BlazeExpressionParser.RULE_expression, _p); + let _la: number; + try { + let _alt: number; + this.enterOuterAlt(_localctx, 1); + { + this.state = 81; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 3, this._ctx) ) { + case 1: + { + _localctx = new GroupedExpressionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + + this.state = 70; + this.match(BlazeExpressionParser.LP); + this.state = 71; + this.expression(0); + this.state = 72; + this.match(BlazeExpressionParser.RP); + } + break; + + case 2: + { + _localctx = new LiteralExpressionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 74; + this.literal(); + } + break; + + case 3: + { + _localctx = new PathExpressionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 75; + this.path(); + } + break; + + case 4: + { + _localctx = new FunctionExpressionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 76; + this.functionInvocation(); + } + break; + + case 5: + { + _localctx = new UnaryMinusExpressionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 77; + this.match(BlazeExpressionParser.MINUS); + this.state = 78; + this.expression(4); + } + break; + + case 6: + { + _localctx = new UnaryPlusExpressionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 79; + this.match(BlazeExpressionParser.PLUS); + this.state = 80; + this.expression(3); + } + break; + } + this._ctx._stop = this._input.tryLT(-1); + this.state = 91; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 5, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + _prevctx = _localctx; + { + this.state = 89; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 4, this._ctx) ) { + case 1: + { + _localctx = new MultiplicativeExpressionContext(new ExpressionContext(_parentctx, _parentState)); + (_localctx as MultiplicativeExpressionContext)._lhs = _prevctx; + this.pushNewRecursionContext(_localctx, _startState, BlazeExpressionParser.RULE_expression); + this.state = 83; + if (!(this.precpred(this._ctx, 2))) { + throw this.createFailedPredicateException("this.precpred(this._ctx, 2)"); + } + this.state = 84; + (_localctx as MultiplicativeExpressionContext)._op = this._input.LT(1); + _la = this._input.LA(1); + if (!(((((_la - 35)) & ~0x1F) === 0 && ((1 << (_la - 35)) & ((1 << (BlazeExpressionParser.ASTERISK - 35)) | (1 << (BlazeExpressionParser.SLASH - 35)) | (1 << (BlazeExpressionParser.PERCENT - 35)))) !== 0))) { + (_localctx as MultiplicativeExpressionContext)._op = this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 85; + (_localctx as MultiplicativeExpressionContext)._rhs = this.expression(3); + } + break; + + case 2: + { + _localctx = new AdditiveExpressionContext(new ExpressionContext(_parentctx, _parentState)); + (_localctx as AdditiveExpressionContext)._lhs = _prevctx; + this.pushNewRecursionContext(_localctx, _startState, BlazeExpressionParser.RULE_expression); + this.state = 86; + if (!(this.precpred(this._ctx, 1))) { + throw this.createFailedPredicateException("this.precpred(this._ctx, 1)"); + } + this.state = 87; + (_localctx as AdditiveExpressionContext)._op = this._input.LT(1); + _la = this._input.LA(1); + if (!(_la === BlazeExpressionParser.PLUS || _la === BlazeExpressionParser.MINUS)) { + (_localctx as AdditiveExpressionContext)._op = this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 88; + (_localctx as AdditiveExpressionContext)._rhs = this.expression(2); + } + break; + } + } + } + this.state = 93; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 5, this._ctx); + } + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.unrollRecursionContexts(_parentctx); + } + return _localctx; + } + + public predicate(): PredicateContext; + public predicate(_p: number): PredicateContext; + // @RuleVersion(0) + public predicate(_p?: number): PredicateContext { + if (_p === undefined) { + _p = 0; + } + + let _parentctx: ParserRuleContext = this._ctx; + let _parentState: number = this.state; + let _localctx: PredicateContext = new PredicateContext(this._ctx, _parentState); + let _prevctx: PredicateContext = _localctx; + let _startState: number = 12; + this.enterRecursionRule(_localctx, 12, BlazeExpressionParser.RULE_predicate, _p); + let _la: number; + try { + let _alt: number; + this.enterOuterAlt(_localctx, 1); + { + this.state = 157; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 10, this._ctx) ) { + case 1: + { + _localctx = new GroupedPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + + this.state = 95; + this.match(BlazeExpressionParser.LP); + this.state = 96; + this.predicate(0); + this.state = 97; + this.match(BlazeExpressionParser.RP); + } + break; + + case 2: + { + _localctx = new NegatedPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 99; + _la = this._input.LA(1); + if (!(_la === BlazeExpressionParser.NOT || _la === BlazeExpressionParser.EXCLAMATION_MARK)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 100; + this.predicate(15); + } + break; + + case 3: + { + _localctx = new IsNullPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 101; + this.expression(0); + this.state = 102; + this.match(BlazeExpressionParser.IS); + this.state = 104; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (_la === BlazeExpressionParser.NOT) { + { + this.state = 103; + this.match(BlazeExpressionParser.NOT); + } + } + + this.state = 106; + this.match(BlazeExpressionParser.NULL); + } + break; + + case 4: + { + _localctx = new IsEmptyPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 108; + this.expression(0); + this.state = 109; + this.match(BlazeExpressionParser.IS); + this.state = 111; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (_la === BlazeExpressionParser.NOT) { + { + this.state = 110; + this.match(BlazeExpressionParser.NOT); + } + } + + this.state = 113; + this.match(BlazeExpressionParser.EMPTY); + } + break; + + case 5: + { + _localctx = new EqualityPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 115; + (_localctx as EqualityPredicateContext)._lhs = this.expression(0); + this.state = 116; + this.match(BlazeExpressionParser.EQUAL); + this.state = 117; + (_localctx as EqualityPredicateContext)._rhs = this.expression(0); + } + break; + + case 6: + { + _localctx = new InequalityPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 119; + (_localctx as InequalityPredicateContext)._lhs = this.expression(0); + this.state = 120; + this.match(BlazeExpressionParser.NOT_EQUAL); + this.state = 121; + (_localctx as InequalityPredicateContext)._rhs = this.expression(0); + } + break; + + case 7: + { + _localctx = new GreaterThanPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 123; + (_localctx as GreaterThanPredicateContext)._lhs = this.expression(0); + this.state = 124; + this.match(BlazeExpressionParser.GREATER); + this.state = 125; + (_localctx as GreaterThanPredicateContext)._rhs = this.expression(0); + } + break; + + case 8: + { + _localctx = new GreaterThanOrEqualPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 127; + (_localctx as GreaterThanOrEqualPredicateContext)._lhs = this.expression(0); + this.state = 128; + this.match(BlazeExpressionParser.GREATER_EQUAL); + this.state = 129; + (_localctx as GreaterThanOrEqualPredicateContext)._rhs = this.expression(0); + } + break; + + case 9: + { + _localctx = new LessThanPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 131; + (_localctx as LessThanPredicateContext)._lhs = this.expression(0); + this.state = 132; + this.match(BlazeExpressionParser.LESS); + this.state = 133; + (_localctx as LessThanPredicateContext)._rhs = this.expression(0); + } + break; + + case 10: + { + _localctx = new LessThanOrEqualPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 135; + (_localctx as LessThanOrEqualPredicateContext)._lhs = this.expression(0); + this.state = 136; + this.match(BlazeExpressionParser.LESS_EQUAL); + this.state = 137; + (_localctx as LessThanOrEqualPredicateContext)._rhs = this.expression(0); + } + break; + + case 11: + { + _localctx = new InPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 139; + this.expression(0); + this.state = 141; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (_la === BlazeExpressionParser.NOT) { + { + this.state = 140; + this.match(BlazeExpressionParser.NOT); + } + } + + this.state = 143; + this.match(BlazeExpressionParser.IN); + this.state = 144; + this.inList(); + } + break; + + case 12: + { + _localctx = new BetweenPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 146; + (_localctx as BetweenPredicateContext)._lhs = this.expression(0); + this.state = 148; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (_la === BlazeExpressionParser.NOT) { + { + this.state = 147; + this.match(BlazeExpressionParser.NOT); + } + } + + this.state = 150; + this.match(BlazeExpressionParser.BETWEEN); + this.state = 151; + (_localctx as BetweenPredicateContext)._begin = this.expression(0); + this.state = 152; + this.match(BlazeExpressionParser.AND); + this.state = 153; + (_localctx as BetweenPredicateContext)._end = this.expression(0); + } + break; + + case 13: + { + _localctx = new BooleanFunctionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 155; + this.functionInvocation(); + } + break; + + case 14: + { + _localctx = new PathPredicateContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 156; + this.path(); + } + break; + } + this._ctx._stop = this._input.tryLT(-1); + this.state = 167; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 12, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + _prevctx = _localctx; + { + this.state = 165; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 11, this._ctx) ) { + case 1: + { + _localctx = new AndPredicateContext(new PredicateContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, BlazeExpressionParser.RULE_predicate); + this.state = 159; + if (!(this.precpred(this._ctx, 14))) { + throw this.createFailedPredicateException("this.precpred(this._ctx, 14)"); + } + this.state = 160; + this.match(BlazeExpressionParser.AND); + this.state = 161; + this.predicate(15); + } + break; + + case 2: + { + _localctx = new OrPredicateContext(new PredicateContext(_parentctx, _parentState)); + this.pushNewRecursionContext(_localctx, _startState, BlazeExpressionParser.RULE_predicate); + this.state = 162; + if (!(this.precpred(this._ctx, 13))) { + throw this.createFailedPredicateException("this.precpred(this._ctx, 13)"); + } + this.state = 163; + this.match(BlazeExpressionParser.OR); + this.state = 164; + this.predicate(14); + } + break; + } + } + } + this.state = 169; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 12, this._ctx); + } + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.unrollRecursionContexts(_parentctx); + } + return _localctx; + } + // @RuleVersion(0) + public predicateOrExpression(): PredicateOrExpressionContext { + let _localctx: PredicateOrExpressionContext = new PredicateOrExpressionContext(this._ctx, this.state); + this.enterRule(_localctx, 14, BlazeExpressionParser.RULE_predicateOrExpression); + try { + this.state = 172; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 13, this._ctx) ) { + case 1: + this.enterOuterAlt(_localctx, 1); + { + this.state = 170; + this.expression(0); + } + break; + + case 2: + this.enterOuterAlt(_localctx, 2); + { + this.state = 171; + this.predicate(0); + } + break; + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public inList(): InListContext { + let _localctx: InListContext = new InListContext(this._ctx, this.state); + this.enterRule(_localctx, 16, BlazeExpressionParser.RULE_inList); + let _la: number; + try { + this.state = 186; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 15, this._ctx) ) { + case 1: + this.enterOuterAlt(_localctx, 1); + { + this.state = 174; + this.match(BlazeExpressionParser.LP); + this.state = 175; + this.expression(0); + this.state = 180; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === BlazeExpressionParser.COMMA) { + { + { + this.state = 176; + this.match(BlazeExpressionParser.COMMA); + this.state = 177; + this.expression(0); + } + } + this.state = 182; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + this.state = 183; + this.match(BlazeExpressionParser.RP); + } + break; + + case 2: + this.enterOuterAlt(_localctx, 2); + { + this.state = 185; + this.expression(0); + } + break; + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public path(): PathContext { + let _localctx: PathContext = new PathContext(this._ctx, this.state); + this.enterRule(_localctx, 18, BlazeExpressionParser.RULE_path); + try { + this.state = 195; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 17, this._ctx) ) { + case 1: + this.enterOuterAlt(_localctx, 1); + { + this.state = 188; + this.identifier(); + this.state = 190; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 16, this._ctx) ) { + case 1: + { + this.state = 189; + this.pathAttributes(); + } + break; + } + } + break; + + case 2: + this.enterOuterAlt(_localctx, 2); + { + this.state = 192; + this.functionInvocation(); + this.state = 193; + this.pathAttributes(); + } + break; + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public pathAttributes(): PathAttributesContext { + let _localctx: PathAttributesContext = new PathAttributesContext(this._ctx, this.state); + this.enterRule(_localctx, 20, BlazeExpressionParser.RULE_pathAttributes); + try { + let _alt: number; + this.enterOuterAlt(_localctx, 1); + { + this.state = 199; + this._errHandler.sync(this); + _alt = 1; + do { + switch (_alt) { + case 1: + { + { + this.state = 197; + this.match(BlazeExpressionParser.DOT); + this.state = 198; + this.identifier(); + } + } + break; + default: + throw new NoViableAltException(this); + } + this.state = 201; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 18, this._ctx); + } while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER); + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public literal(): LiteralContext { + let _localctx: LiteralContext = new LiteralContext(this._ctx, this.state); + this.enterRule(_localctx, 22, BlazeExpressionParser.RULE_literal); + try { + this.state = 214; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 19, this._ctx) ) { + case 1: + this.enterOuterAlt(_localctx, 1); + { + this.state = 203; + this.match(BlazeExpressionParser.NUMERIC_LITERAL); + } + break; + + case 2: + this.enterOuterAlt(_localctx, 2); + { + this.state = 204; + this.match(BlazeExpressionParser.INTEGER_LITERAL); + } + break; + + case 3: + this.enterOuterAlt(_localctx, 3); + { + this.state = 205; + this.stringLiteral(); + } + break; + + case 4: + this.enterOuterAlt(_localctx, 4); + { + this.state = 206; + this.match(BlazeExpressionParser.TRUE); + } + break; + + case 5: + this.enterOuterAlt(_localctx, 5); + { + this.state = 207; + this.match(BlazeExpressionParser.FALSE); + } + break; + + case 6: + this.enterOuterAlt(_localctx, 6); + { + this.state = 208; + this.dateLiteral(); + } + break; + + case 7: + this.enterOuterAlt(_localctx, 7); + { + this.state = 209; + this.timeLiteral(); + } + break; + + case 8: + this.enterOuterAlt(_localctx, 8); + { + this.state = 210; + this.timestampLiteral(); + } + break; + + case 9: + this.enterOuterAlt(_localctx, 9); + { + this.state = 211; + this.temporalIntervalLiteral(); + } + break; + + case 10: + this.enterOuterAlt(_localctx, 10); + { + this.state = 212; + this.collectionLiteral(); + } + break; + + case 11: + this.enterOuterAlt(_localctx, 11); + { + this.state = 213; + this.entityLiteral(); + } + break; + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public stringLiteral(): StringLiteralContext { + let _localctx: StringLiteralContext = new StringLiteralContext(this._ctx, this.state); + this.enterRule(_localctx, 24, BlazeExpressionParser.RULE_stringLiteral); + let _la: number; + try { + this.state = 232; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case BlazeExpressionParser.START_QUOTE: + this.enterOuterAlt(_localctx, 1); + { + this.state = 216; + this.match(BlazeExpressionParser.START_QUOTE); + this.state = 220; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === BlazeExpressionParser.TEXT_IN_QUOTE) { + { + { + this.state = 217; + this.match(BlazeExpressionParser.TEXT_IN_QUOTE); + } + } + this.state = 222; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + this.state = 223; + this.match(BlazeExpressionParser.END_QUOTE); + } + break; + case BlazeExpressionParser.START_DOUBLE_QUOTE: + this.enterOuterAlt(_localctx, 2); + { + this.state = 224; + this.match(BlazeExpressionParser.START_DOUBLE_QUOTE); + this.state = 228; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === BlazeExpressionParser.TEXT_IN_DOUBLE_QUOTE) { + { + { + this.state = 225; + this.match(BlazeExpressionParser.TEXT_IN_DOUBLE_QUOTE); + } + } + this.state = 230; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + this.state = 231; + this.match(BlazeExpressionParser.END_DOUBLE_QUOTE); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public collectionLiteral(): CollectionLiteralContext { + let _localctx: CollectionLiteralContext = new CollectionLiteralContext(this._ctx, this.state); + this.enterRule(_localctx, 26, BlazeExpressionParser.RULE_collectionLiteral); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 234; + this.match(BlazeExpressionParser.LB); + this.state = 243; + this._errHandler.sync(this); + _la = this._input.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << BlazeExpressionParser.START_QUOTE) | (1 << BlazeExpressionParser.START_DOUBLE_QUOTE) | (1 << BlazeExpressionParser.INTEGER_LITERAL) | (1 << BlazeExpressionParser.NUMERIC_LITERAL) | (1 << BlazeExpressionParser.AND) | (1 << BlazeExpressionParser.BETWEEN) | (1 << BlazeExpressionParser.DATE) | (1 << BlazeExpressionParser.DAYS) | (1 << BlazeExpressionParser.FALSE) | (1 << BlazeExpressionParser.HOURS) | (1 << BlazeExpressionParser.IN) | (1 << BlazeExpressionParser.INTERVAL) | (1 << BlazeExpressionParser.IS) | (1 << BlazeExpressionParser.MINUTES) | (1 << BlazeExpressionParser.MONTHS) | (1 << BlazeExpressionParser.NOT) | (1 << BlazeExpressionParser.OR) | (1 << BlazeExpressionParser.SECONDS) | (1 << BlazeExpressionParser.TIME) | (1 << BlazeExpressionParser.TIMESTAMP) | (1 << BlazeExpressionParser.TRUE) | (1 << BlazeExpressionParser.YEARS))) !== 0) || ((((_la - 40)) & ~0x1F) === 0 && ((1 << (_la - 40)) & ((1 << (BlazeExpressionParser.LB - 40)) | (1 << (BlazeExpressionParser.IDENTIFIER - 40)) | (1 << (BlazeExpressionParser.QUOTED_IDENTIFIER - 40)))) !== 0)) { + { + this.state = 235; + this.literal(); + this.state = 240; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la === BlazeExpressionParser.COMMA) { + { + { + this.state = 236; + this.match(BlazeExpressionParser.COMMA); + this.state = 237; + this.literal(); + } + } + this.state = 242; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + } + } + + this.state = 245; + this.match(BlazeExpressionParser.RB); + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public entityLiteral(): EntityLiteralContext { + let _localctx: EntityLiteralContext = new EntityLiteralContext(this._ctx, this.state); + this.enterRule(_localctx, 28, BlazeExpressionParser.RULE_entityLiteral); + try { + let _alt: number; + this.enterOuterAlt(_localctx, 1); + { + this.state = 247; + _localctx._name = this.identifier(); + this.state = 248; + this.match(BlazeExpressionParser.LP); + this.state = 256; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 25, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + { + { + this.state = 249; + this.identifier(); + this.state = 250; + this.match(BlazeExpressionParser.EQUAL); + this.state = 251; + this.predicateOrExpression(); + this.state = 252; + this.match(BlazeExpressionParser.COMMA); + } + } + } + this.state = 258; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 25, this._ctx); + } + this.state = 259; + this.identifier(); + this.state = 260; + this.match(BlazeExpressionParser.EQUAL); + this.state = 261; + this.predicateOrExpression(); + this.state = 262; + this.match(BlazeExpressionParser.RP); + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public functionInvocation(): FunctionInvocationContext { + let _localctx: FunctionInvocationContext = new FunctionInvocationContext(this._ctx, this.state); + this.enterRule(_localctx, 30, BlazeExpressionParser.RULE_functionInvocation); + let _la: number; + try { + let _alt: number; + this.state = 299; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 30, this._ctx) ) { + case 1: + _localctx = new NamedInvocationContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 264; + (_localctx as NamedInvocationContext)._name = this.identifier(); + this.state = 265; + this.match(BlazeExpressionParser.LP); + this.state = 280; + this._errHandler.sync(this); + _la = this._input.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << BlazeExpressionParser.AND) | (1 << BlazeExpressionParser.BETWEEN) | (1 << BlazeExpressionParser.DATE) | (1 << BlazeExpressionParser.DAYS) | (1 << BlazeExpressionParser.HOURS) | (1 << BlazeExpressionParser.IN) | (1 << BlazeExpressionParser.IS) | (1 << BlazeExpressionParser.MINUTES) | (1 << BlazeExpressionParser.MONTHS) | (1 << BlazeExpressionParser.NOT) | (1 << BlazeExpressionParser.OR) | (1 << BlazeExpressionParser.SECONDS) | (1 << BlazeExpressionParser.TIME) | (1 << BlazeExpressionParser.TIMESTAMP) | (1 << BlazeExpressionParser.YEARS))) !== 0) || _la === BlazeExpressionParser.IDENTIFIER || _la === BlazeExpressionParser.QUOTED_IDENTIFIER) { + { + this.state = 273; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 26, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + { + { + this.state = 266; + this.identifier(); + this.state = 267; + this.match(BlazeExpressionParser.EQUAL); + this.state = 268; + this.predicateOrExpression(); + this.state = 269; + this.match(BlazeExpressionParser.COMMA); + } + } + } + this.state = 275; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 26, this._ctx); + } + this.state = 276; + this.identifier(); + this.state = 277; + this.match(BlazeExpressionParser.EQUAL); + this.state = 278; + this.predicateOrExpression(); + } + } + + this.state = 282; + this.match(BlazeExpressionParser.RP); + } + break; + + case 2: + _localctx = new IndexedFunctionInvocationContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 284; + (_localctx as IndexedFunctionInvocationContext)._name = this.identifier(); + this.state = 285; + this.match(BlazeExpressionParser.LP); + this.state = 295; + this._errHandler.sync(this); + _la = this._input.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << BlazeExpressionParser.START_QUOTE) | (1 << BlazeExpressionParser.START_DOUBLE_QUOTE) | (1 << BlazeExpressionParser.INTEGER_LITERAL) | (1 << BlazeExpressionParser.NUMERIC_LITERAL) | (1 << BlazeExpressionParser.AND) | (1 << BlazeExpressionParser.BETWEEN) | (1 << BlazeExpressionParser.DATE) | (1 << BlazeExpressionParser.DAYS) | (1 << BlazeExpressionParser.FALSE) | (1 << BlazeExpressionParser.HOURS) | (1 << BlazeExpressionParser.IN) | (1 << BlazeExpressionParser.INTERVAL) | (1 << BlazeExpressionParser.IS) | (1 << BlazeExpressionParser.MINUTES) | (1 << BlazeExpressionParser.MONTHS) | (1 << BlazeExpressionParser.NOT) | (1 << BlazeExpressionParser.OR) | (1 << BlazeExpressionParser.SECONDS) | (1 << BlazeExpressionParser.TIME) | (1 << BlazeExpressionParser.TIMESTAMP) | (1 << BlazeExpressionParser.TRUE) | (1 << BlazeExpressionParser.YEARS))) !== 0) || ((((_la - 33)) & ~0x1F) === 0 && ((1 << (_la - 33)) & ((1 << (BlazeExpressionParser.PLUS - 33)) | (1 << (BlazeExpressionParser.MINUS - 33)) | (1 << (BlazeExpressionParser.LP - 33)) | (1 << (BlazeExpressionParser.LB - 33)) | (1 << (BlazeExpressionParser.EXCLAMATION_MARK - 33)) | (1 << (BlazeExpressionParser.IDENTIFIER - 33)) | (1 << (BlazeExpressionParser.QUOTED_IDENTIFIER - 33)))) !== 0)) { + { + this.state = 291; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 28, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + { + { + this.state = 286; + this.predicateOrExpression(); + this.state = 287; + this.match(BlazeExpressionParser.COMMA); + } + } + } + this.state = 293; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 28, this._ctx); + } + this.state = 294; + this.predicateOrExpression(); + } + } + + this.state = 297; + this.match(BlazeExpressionParser.RP); + } + break; + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public dateLiteral(): DateLiteralContext { + let _localctx: DateLiteralContext = new DateLiteralContext(this._ctx, this.state); + this.enterRule(_localctx, 32, BlazeExpressionParser.RULE_dateLiteral); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 301; + this.match(BlazeExpressionParser.DATE); + this.state = 302; + this.match(BlazeExpressionParser.LP); + this.state = 303; + this.datePart(); + this.state = 304; + this.match(BlazeExpressionParser.RP); + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public timeLiteral(): TimeLiteralContext { + let _localctx: TimeLiteralContext = new TimeLiteralContext(this._ctx, this.state); + this.enterRule(_localctx, 34, BlazeExpressionParser.RULE_timeLiteral); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 306; + this.match(BlazeExpressionParser.TIME); + this.state = 307; + this.match(BlazeExpressionParser.LP); + this.state = 308; + this.timePart(); + this.state = 311; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (_la === BlazeExpressionParser.DOT) { + { + this.state = 309; + this.match(BlazeExpressionParser.DOT); + this.state = 310; + _localctx._fraction = this._input.LT(1); + _la = this._input.LA(1); + if (!(_la === BlazeExpressionParser.INTEGER_LITERAL || _la === BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL)) { + _localctx._fraction = this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + } + } + + this.state = 313; + this.match(BlazeExpressionParser.RP); + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public timestampLiteral(): TimestampLiteralContext { + let _localctx: TimestampLiteralContext = new TimestampLiteralContext(this._ctx, this.state); + this.enterRule(_localctx, 36, BlazeExpressionParser.RULE_timestampLiteral); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 315; + this.match(BlazeExpressionParser.TIMESTAMP); + this.state = 316; + this.match(BlazeExpressionParser.LP); + this.state = 317; + this.datePart(); + this.state = 323; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (_la === BlazeExpressionParser.INTEGER_LITERAL || _la === BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL) { + { + this.state = 318; + this.timePart(); + this.state = 321; + this._errHandler.sync(this); + _la = this._input.LA(1); + if (_la === BlazeExpressionParser.DOT) { + { + this.state = 319; + this.match(BlazeExpressionParser.DOT); + this.state = 320; + _localctx._fraction = this._input.LT(1); + _la = this._input.LA(1); + if (!(_la === BlazeExpressionParser.INTEGER_LITERAL || _la === BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL)) { + _localctx._fraction = this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + } + } + + } + } + + this.state = 325; + this.match(BlazeExpressionParser.RP); + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public datePart(): DatePartContext { + let _localctx: DatePartContext = new DatePartContext(this._ctx, this.state); + this.enterRule(_localctx, 38, BlazeExpressionParser.RULE_datePart); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 327; + this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 328; + this.match(BlazeExpressionParser.MINUS); + this.state = 329; + _la = this._input.LA(1); + if (!(_la === BlazeExpressionParser.INTEGER_LITERAL || _la === BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 330; + this.match(BlazeExpressionParser.MINUS); + this.state = 331; + _la = this._input.LA(1); + if (!(_la === BlazeExpressionParser.INTEGER_LITERAL || _la === BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public timePart(): TimePartContext { + let _localctx: TimePartContext = new TimePartContext(this._ctx, this.state); + this.enterRule(_localctx, 40, BlazeExpressionParser.RULE_timePart); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 333; + _la = this._input.LA(1); + if (!(_la === BlazeExpressionParser.INTEGER_LITERAL || _la === BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 334; + this.match(BlazeExpressionParser.COLON); + this.state = 335; + _la = this._input.LA(1); + if (!(_la === BlazeExpressionParser.INTEGER_LITERAL || _la === BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + this.state = 336; + this.match(BlazeExpressionParser.COLON); + this.state = 337; + _la = this._input.LA(1); + if (!(_la === BlazeExpressionParser.INTEGER_LITERAL || _la === BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public temporalIntervalLiteral(): TemporalIntervalLiteralContext { + let _localctx: TemporalIntervalLiteralContext = new TemporalIntervalLiteralContext(this._ctx, this.state); + this.enterRule(_localctx, 42, BlazeExpressionParser.RULE_temporalIntervalLiteral); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 339; + this.match(BlazeExpressionParser.INTERVAL); + this.state = 412; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 49, this._ctx) ) { + case 1: + { + { + this.state = 340; + _localctx._years = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 341; + this.match(BlazeExpressionParser.YEARS); + this.state = 344; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 34, this._ctx) ) { + case 1: + { + this.state = 342; + _localctx._months = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 343; + this.match(BlazeExpressionParser.MONTHS); + } + break; + } + this.state = 348; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 35, this._ctx) ) { + case 1: + { + this.state = 346; + _localctx._days = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 347; + this.match(BlazeExpressionParser.DAYS); + } + break; + } + this.state = 352; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 36, this._ctx) ) { + case 1: + { + this.state = 350; + _localctx._hours = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 351; + this.match(BlazeExpressionParser.HOURS); + } + break; + } + this.state = 356; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 37, this._ctx) ) { + case 1: + { + this.state = 354; + _localctx._minutes = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 355; + this.match(BlazeExpressionParser.MINUTES); + } + break; + } + this.state = 360; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 38, this._ctx) ) { + case 1: + { + this.state = 358; + _localctx._seconds = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 359; + this.match(BlazeExpressionParser.SECONDS); + } + break; + } + } + } + break; + + case 2: + { + { + this.state = 362; + _localctx._months = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 363; + this.match(BlazeExpressionParser.MONTHS); + this.state = 366; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 39, this._ctx) ) { + case 1: + { + this.state = 364; + _localctx._days = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 365; + this.match(BlazeExpressionParser.DAYS); + } + break; + } + this.state = 370; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 40, this._ctx) ) { + case 1: + { + this.state = 368; + _localctx._hours = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 369; + this.match(BlazeExpressionParser.HOURS); + } + break; + } + this.state = 374; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 41, this._ctx) ) { + case 1: + { + this.state = 372; + _localctx._minutes = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 373; + this.match(BlazeExpressionParser.MINUTES); + } + break; + } + this.state = 378; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 42, this._ctx) ) { + case 1: + { + this.state = 376; + _localctx._seconds = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 377; + this.match(BlazeExpressionParser.SECONDS); + } + break; + } + } + } + break; + + case 3: + { + { + this.state = 380; + _localctx._days = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 381; + this.match(BlazeExpressionParser.DAYS); + this.state = 384; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 43, this._ctx) ) { + case 1: + { + this.state = 382; + _localctx._hours = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 383; + this.match(BlazeExpressionParser.HOURS); + } + break; + } + this.state = 388; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 44, this._ctx) ) { + case 1: + { + this.state = 386; + _localctx._minutes = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 387; + this.match(BlazeExpressionParser.MINUTES); + } + break; + } + this.state = 392; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 45, this._ctx) ) { + case 1: + { + this.state = 390; + _localctx._seconds = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 391; + this.match(BlazeExpressionParser.SECONDS); + } + break; + } + } + } + break; + + case 4: + { + { + this.state = 394; + _localctx._hours = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 395; + this.match(BlazeExpressionParser.HOURS); + this.state = 398; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 46, this._ctx) ) { + case 1: + { + this.state = 396; + _localctx._minutes = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 397; + this.match(BlazeExpressionParser.MINUTES); + } + break; + } + this.state = 402; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 47, this._ctx) ) { + case 1: + { + this.state = 400; + _localctx._seconds = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 401; + this.match(BlazeExpressionParser.SECONDS); + } + break; + } + } + } + break; + + case 5: + { + { + this.state = 404; + _localctx._minutes = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 405; + this.match(BlazeExpressionParser.MINUTES); + this.state = 408; + this._errHandler.sync(this); + switch ( this.interpreter.adaptivePredict(this._input, 48, this._ctx) ) { + case 1: + { + this.state = 406; + _localctx._seconds = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 407; + this.match(BlazeExpressionParser.SECONDS); + } + break; + } + } + } + break; + + case 6: + { + { + this.state = 410; + _localctx._seconds = this.match(BlazeExpressionParser.INTEGER_LITERAL); + this.state = 411; + this.match(BlazeExpressionParser.SECONDS); + } + } + break; + } + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public identifier(): IdentifierContext { + let _localctx: IdentifierContext = new IdentifierContext(this._ctx, this.state); + this.enterRule(_localctx, 44, BlazeExpressionParser.RULE_identifier); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 414; + _la = this._input.LA(1); + if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << BlazeExpressionParser.AND) | (1 << BlazeExpressionParser.BETWEEN) | (1 << BlazeExpressionParser.DATE) | (1 << BlazeExpressionParser.DAYS) | (1 << BlazeExpressionParser.HOURS) | (1 << BlazeExpressionParser.IN) | (1 << BlazeExpressionParser.IS) | (1 << BlazeExpressionParser.MINUTES) | (1 << BlazeExpressionParser.MONTHS) | (1 << BlazeExpressionParser.NOT) | (1 << BlazeExpressionParser.OR) | (1 << BlazeExpressionParser.SECONDS) | (1 << BlazeExpressionParser.TIME) | (1 << BlazeExpressionParser.TIMESTAMP) | (1 << BlazeExpressionParser.YEARS))) !== 0) || _la === BlazeExpressionParser.IDENTIFIER || _la === BlazeExpressionParser.QUOTED_IDENTIFIER)) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return _localctx; + } + + public sempred(_localctx: RuleContext, ruleIndex: number, predIndex: number): boolean { + switch (ruleIndex) { + case 5: + return this.expression_sempred(_localctx as ExpressionContext, predIndex); + + case 6: + return this.predicate_sempred(_localctx as PredicateContext, predIndex); + } + return true; + } + private expression_sempred(_localctx: ExpressionContext, predIndex: number): boolean { + switch (predIndex) { + case 0: + return this.precpred(this._ctx, 2); + + case 1: + return this.precpred(this._ctx, 1); + } + return true; + } + private predicate_sempred(_localctx: PredicateContext, predIndex: number): boolean { + switch (predIndex) { + case 2: + return this.precpred(this._ctx, 14); + + case 3: + return this.precpred(this._ctx, 13); + } + return true; + } + + public static readonly _serializedATN: string = + "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x038\u01A3\x04\x02" + + "\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04\x07" + + "\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f\x04\r\t\r\x04" + + "\x0E\t\x0E\x04\x0F\t\x0F\x04\x10\t\x10\x04\x11\t\x11\x04\x12\t\x12\x04" + + "\x13\t\x13\x04\x14\t\x14\x04\x15\t\x15\x04\x16\t\x16\x04\x17\t\x17\x04" + + "\x18\t\x18\x03\x02\x03\x02\x03\x02\x03\x03\x03\x03\x03\x03\x03\x04\x03" + + "\x04\x03\x04\x03\x05\x05\x05;\n\x05\x03\x05\x03\x05\x03\x06\x03\x06\x03" + + "\x06\x03\x06\x03\x06\x06\x06D\n\x06\r\x06\x0E\x06E\x03\x07\x03\x07\x03" + + "\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03" + + "\x07\x05\x07T\n\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x07" + + "\x07\\\n\x07\f\x07\x0E\x07_\v\x07\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b" + + "\x03\b\x03\b\x03\b\x03\b\x05\bk\n\b\x03\b\x03\b\x03\b\x03\b\x03\b\x05" + + "\br\n\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03" + + "\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03" + + "\b\x03\b\x03\b\x03\b\x03\b\x03\b\x05\b\x90\n\b\x03\b\x03\b\x03\b\x03\b" + + "\x03\b\x05\b\x97\n\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x05\b\xA0" + + "\n\b\x03\b\x03\b\x03\b\x03\b\x03\b\x03\b\x07\b\xA8\n\b\f\b\x0E\b\xAB\v" + + "\b\x03\t\x03\t\x05\t\xAF\n\t\x03\n\x03\n\x03\n\x03\n\x07\n\xB5\n\n\f\n" + + "\x0E\n\xB8\v\n\x03\n\x03\n\x03\n\x05\n\xBD\n\n\x03\v\x03\v\x05\v\xC1\n" + + "\v\x03\v\x03\v\x03\v\x05\v\xC6\n\v\x03\f\x03\f\x06\f\xCA\n\f\r\f\x0E\f" + + "\xCB\x03\r\x03\r\x03\r\x03\r\x03\r\x03\r\x03\r\x03\r\x03\r\x03\r\x03\r" + + "\x05\r\xD9\n\r\x03\x0E\x03\x0E\x07\x0E\xDD\n\x0E\f\x0E\x0E\x0E\xE0\v\x0E" + + "\x03\x0E\x03\x0E\x03\x0E\x07\x0E\xE5\n\x0E\f\x0E\x0E\x0E\xE8\v\x0E\x03" + + "\x0E\x05\x0E\xEB\n\x0E\x03\x0F\x03\x0F\x03\x0F\x03\x0F\x07\x0F\xF1\n\x0F" + + "\f\x0F\x0E\x0F\xF4\v\x0F\x05\x0F\xF6\n\x0F\x03\x0F\x03\x0F\x03\x10\x03" + + "\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x07\x10\u0101\n\x10\f\x10" + + "\x0E\x10\u0104\v\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x11\x03" + + "\x11\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x07\x11\u0112\n\x11\f\x11" + + "\x0E\x11\u0115\v\x11\x03\x11\x03\x11\x03\x11\x03\x11\x05\x11\u011B\n\x11" + + "\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x07\x11\u0124" + + "\n\x11\f\x11\x0E\x11\u0127\v\x11\x03\x11\x05\x11\u012A\n\x11\x03\x11\x03" + + "\x11\x05\x11\u012E\n\x11\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x13" + + "\x03\x13\x03\x13\x03\x13\x03\x13\x05\x13\u013A\n\x13\x03\x13\x03\x13\x03" + + "\x14\x03\x14\x03\x14\x03\x14\x03\x14\x03\x14\x05\x14\u0144\n\x14\x05\x14" + + "\u0146\n\x14\x03\x14\x03\x14\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03" + + "\x15\x03\x16\x03\x16\x03\x16\x03\x16\x03\x16\x03\x16\x03\x17\x03\x17\x03" + + "\x17\x03\x17\x03\x17\x05\x17\u015B\n\x17\x03\x17\x03\x17\x05\x17\u015F" + + "\n\x17\x03\x17\x03\x17\x05\x17\u0163\n\x17\x03\x17\x03\x17\x05\x17\u0167" + + "\n\x17\x03\x17\x03\x17\x05\x17\u016B\n\x17\x03\x17\x03\x17\x03\x17\x03" + + "\x17\x05\x17\u0171\n\x17\x03\x17\x03\x17\x05\x17\u0175\n\x17\x03\x17\x03" + + "\x17\x05\x17\u0179\n\x17\x03\x17\x03\x17\x05\x17\u017D\n\x17\x03\x17\x03" + + "\x17\x03\x17\x03\x17\x05\x17\u0183\n\x17\x03\x17\x03\x17\x05\x17\u0187" + + "\n\x17\x03\x17\x03\x17\x05\x17\u018B\n\x17\x03\x17\x03\x17\x03\x17\x03" + + "\x17\x05\x17\u0191\n\x17\x03\x17\x03\x17\x05\x17\u0195\n\x17\x03\x17\x03" + + "\x17\x03\x17\x03\x17\x05\x17\u019B\n\x17\x03\x17\x03\x17\x05\x17\u019F" + + "\n\x17\x03\x18\x03\x18\x03\x18\x02\x02\x04\f\x0E\x19\x02\x02\x04\x02\x06" + + "\x02\b\x02\n\x02\f\x02\x0E\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02" + + "\x1A\x02\x1C\x02\x1E\x02 \x02\"\x02$\x02&\x02(\x02*\x02,\x02.\x02\x02" + + "\x07\x03\x02%\'\x03\x02#$\x04\x02\x15\x15//\x04\x02\x06\x06\b\b\b\x02" + + "\t\f\x0F\x10\x12\x15\x17\x1A\x1C\x1C01\x02\u01DA\x020\x03\x02\x02\x02" + + "\x043\x03\x02\x02\x02\x066\x03\x02\x02\x02\b:\x03\x02\x02\x02\nC\x03\x02" + + "\x02\x02\fS\x03\x02\x02\x02\x0E\x9F\x03\x02\x02\x02\x10\xAE\x03\x02\x02" + + "\x02\x12\xBC\x03\x02\x02\x02\x14\xC5\x03\x02\x02\x02\x16\xC9\x03\x02\x02" + + "\x02\x18\xD8\x03\x02\x02\x02\x1A\xEA\x03\x02\x02\x02\x1C\xEC\x03\x02\x02" + + "\x02\x1E\xF9\x03\x02\x02\x02 \u012D\x03\x02\x02\x02\"\u012F\x03\x02\x02" + + "\x02$\u0134\x03\x02\x02\x02&\u013D\x03\x02\x02\x02(\u0149\x03\x02\x02" + + "\x02*\u014F\x03\x02\x02\x02,\u0155\x03\x02\x02\x02.\u01A0\x03\x02\x02" + + "\x0201\x05\x0E\b\x0212\x07\x02\x02\x032\x03\x03\x02\x02\x0234\x05\f\x07" + + "\x0245\x07\x02\x02\x035\x05\x03\x02\x02\x0267\x05\x10\t\x0278\x07\x02" + + "\x02\x038\x07\x03\x02\x02\x029;\x05\n\x06\x02:9\x03\x02\x02\x02:;\x03" + + "\x02\x02\x02;<\x03\x02\x02\x02<=\x07\x02\x02\x03=\t\x03\x02\x02\x02>D" + + "\x074\x02\x02?@\x073\x02\x02@A\x05\f\x07\x02AB\x072\x02\x02BD\x03\x02" + + "\x02\x02C>\x03\x02\x02\x02C?\x03\x02\x02\x02DE\x03\x02\x02\x02EC\x03\x02" + + "\x02\x02EF\x03\x02\x02\x02F\v\x03\x02\x02\x02GH\b\x07\x01\x02HI\x07(\x02" + + "\x02IJ\x05\f\x07\x02JK\x07)\x02\x02KT\x03\x02\x02\x02LT\x05\x18\r\x02" + + "MT\x05\x14\v\x02NT\x05 \x11\x02OP\x07$\x02\x02PT\x05\f\x07\x06QR\x07#" + + "\x02\x02RT\x05\f\x07\x05SG\x03\x02\x02\x02SL\x03\x02\x02\x02SM\x03\x02" + + "\x02\x02SN\x03\x02\x02\x02SO\x03\x02\x02\x02SQ\x03\x02\x02\x02T]\x03\x02" + + "\x02\x02UV\f\x04\x02\x02VW\t\x02\x02\x02W\\\x05\f\x07\x05XY\f\x03\x02" + + "\x02YZ\t\x03\x02\x02Z\\\x05\f\x07\x04[U\x03\x02\x02\x02[X\x03\x02\x02" + + "\x02\\_\x03\x02\x02\x02][\x03\x02\x02\x02]^\x03\x02\x02\x02^\r\x03\x02" + + "\x02\x02_]\x03\x02\x02\x02`a\b\b\x01\x02ab\x07(\x02\x02bc\x05\x0E\b\x02" + + "cd\x07)\x02\x02d\xA0\x03\x02\x02\x02ef\t\x04\x02\x02f\xA0\x05\x0E\b\x11" + + "gh\x05\f\x07\x02hj\x07\x12\x02\x02ik\x07\x15\x02\x02ji\x03\x02\x02\x02" + + "jk\x03\x02\x02\x02kl\x03\x02\x02\x02lm\x07\x16\x02\x02m\xA0\x03\x02\x02" + + "\x02no\x05\f\x07\x02oq\x07\x12\x02\x02pr\x07\x15\x02\x02qp\x03\x02\x02" + + "\x02qr\x03\x02\x02\x02rs\x03\x02\x02\x02st\x07\r\x02\x02t\xA0\x03\x02" + + "\x02\x02uv\x05\f\x07\x02vw\x07!\x02\x02wx\x05\f\x07\x02x\xA0\x03\x02\x02" + + "\x02yz\x05\f\x07\x02z{\x07\"\x02\x02{|\x05\f\x07\x02|\xA0\x03\x02\x02" + + "\x02}~\x05\f\x07\x02~\x7F\x07\x1F\x02\x02\x7F\x80\x05\f\x07\x02\x80\xA0" + + "\x03\x02\x02\x02\x81\x82\x05\f\x07\x02\x82\x83\x07 \x02\x02\x83\x84\x05" + + "\f\x07\x02\x84\xA0\x03\x02\x02\x02\x85\x86\x05\f\x07\x02\x86\x87\x07\x1D" + + "\x02\x02\x87\x88\x05\f\x07\x02\x88\xA0\x03\x02\x02\x02\x89\x8A\x05\f\x07" + + "\x02\x8A\x8B\x07\x1E\x02\x02\x8B\x8C\x05\f\x07\x02\x8C\xA0\x03\x02\x02" + + "\x02\x8D\x8F\x05\f\x07\x02\x8E\x90\x07\x15\x02\x02\x8F\x8E\x03\x02\x02" + + "\x02\x8F\x90\x03\x02\x02\x02\x90\x91\x03\x02\x02\x02\x91\x92\x07\x10\x02" + + "\x02\x92\x93\x05\x12\n\x02\x93\xA0\x03\x02\x02\x02\x94\x96\x05\f\x07\x02" + + "\x95\x97\x07\x15\x02\x02\x96\x95\x03\x02\x02\x02\x96\x97\x03\x02\x02\x02" + + "\x97\x98\x03\x02\x02\x02\x98\x99\x07\n\x02\x02\x99\x9A\x05\f\x07\x02\x9A" + + "\x9B\x07\t\x02\x02\x9B\x9C\x05\f\x07\x02\x9C\xA0\x03\x02\x02\x02\x9D\xA0" + + "\x05 \x11\x02\x9E\xA0\x05\x14\v\x02\x9F`\x03\x02\x02\x02\x9Fe\x03\x02" + + "\x02\x02\x9Fg\x03\x02\x02\x02\x9Fn\x03\x02\x02\x02\x9Fu\x03\x02\x02\x02" + + "\x9Fy\x03\x02\x02\x02\x9F}\x03\x02\x02\x02\x9F\x81\x03\x02\x02\x02\x9F" + + "\x85\x03\x02\x02\x02\x9F\x89\x03\x02\x02\x02\x9F\x8D\x03\x02\x02\x02\x9F" + + "\x94\x03\x02\x02\x02\x9F\x9D\x03\x02\x02\x02\x9F\x9E\x03\x02\x02\x02\xA0" + + "\xA9\x03\x02\x02\x02\xA1\xA2\f\x10\x02\x02\xA2\xA3\x07\t\x02\x02\xA3\xA8" + + "\x05\x0E\b\x11\xA4\xA5\f\x0F\x02\x02\xA5\xA6\x07\x17\x02\x02\xA6\xA8\x05" + + "\x0E\b\x10\xA7\xA1\x03\x02\x02\x02\xA7\xA4\x03\x02\x02\x02\xA8\xAB\x03" + + "\x02\x02\x02\xA9\xA7\x03\x02\x02\x02\xA9\xAA\x03\x02\x02\x02\xAA\x0F\x03" + + "\x02\x02\x02\xAB\xA9\x03\x02\x02\x02\xAC\xAF\x05\f\x07\x02\xAD\xAF\x05" + + "\x0E\b\x02\xAE\xAC\x03\x02\x02\x02\xAE\xAD\x03\x02\x02\x02\xAF\x11\x03" + + "\x02\x02\x02\xB0\xB1\x07(\x02\x02\xB1\xB6\x05\f\x07\x02\xB2\xB3\x07,\x02" + + "\x02\xB3\xB5\x05\f\x07\x02\xB4\xB2\x03\x02\x02\x02\xB5\xB8\x03\x02\x02" + + "\x02\xB6\xB4\x03\x02\x02\x02\xB6\xB7\x03\x02\x02\x02\xB7\xB9\x03\x02\x02" + + "\x02\xB8\xB6\x03\x02\x02\x02\xB9\xBA\x07)\x02\x02\xBA\xBD\x03\x02\x02" + + "\x02\xBB\xBD\x05\f\x07\x02\xBC\xB0\x03\x02\x02\x02\xBC\xBB\x03\x02\x02" + + "\x02\xBD\x13\x03\x02\x02\x02\xBE\xC0\x05.\x18\x02\xBF\xC1\x05\x16\f\x02" + + "\xC0\xBF\x03\x02\x02\x02\xC0\xC1\x03\x02\x02\x02\xC1\xC6\x03\x02\x02\x02" + + "\xC2\xC3\x05 \x11\x02\xC3\xC4\x05\x16\f\x02\xC4\xC6\x03\x02\x02\x02\xC5" + + "\xBE\x03\x02\x02\x02\xC5\xC2\x03\x02\x02\x02\xC6\x15\x03\x02\x02\x02\xC7" + + "\xC8\x07-\x02\x02\xC8\xCA\x05.\x18\x02\xC9\xC7\x03\x02\x02\x02\xCA\xCB" + + "\x03\x02\x02\x02\xCB\xC9\x03\x02\x02\x02\xCB\xCC\x03\x02\x02\x02\xCC\x17" + + "\x03\x02\x02\x02\xCD\xD9\x07\x07\x02\x02\xCE\xD9\x07\x06\x02\x02\xCF\xD9" + + "\x05\x1A\x0E\x02\xD0\xD9\x07\x1B\x02\x02\xD1\xD9\x07\x0E\x02\x02\xD2\xD9" + + "\x05\"\x12\x02\xD3\xD9\x05$\x13\x02\xD4\xD9\x05&\x14\x02\xD5\xD9\x05," + + "\x17\x02\xD6\xD9\x05\x1C\x0F\x02\xD7\xD9\x05\x1E\x10\x02\xD8\xCD\x03\x02" + + "\x02\x02\xD8\xCE\x03\x02\x02\x02\xD8\xCF\x03\x02\x02\x02\xD8\xD0\x03\x02" + + "\x02\x02\xD8\xD1\x03\x02\x02\x02\xD8\xD2\x03\x02\x02\x02\xD8\xD3\x03\x02" + + "\x02\x02\xD8\xD4\x03\x02\x02\x02\xD8\xD5\x03\x02\x02\x02\xD8\xD6\x03\x02" + + "\x02\x02\xD8\xD7\x03\x02\x02\x02\xD9\x19\x03\x02\x02\x02\xDA\xDE\x07\x04" + + "\x02\x02\xDB\xDD\x075\x02\x02\xDC\xDB\x03\x02\x02\x02\xDD\xE0\x03\x02" + + "\x02\x02\xDE\xDC\x03\x02\x02\x02\xDE\xDF\x03\x02\x02\x02\xDF\xE1\x03\x02" + + "\x02\x02\xE0\xDE\x03\x02\x02\x02\xE1\xEB\x076\x02\x02\xE2\xE6\x07\x05" + + "\x02\x02\xE3\xE5\x077\x02\x02\xE4\xE3\x03\x02\x02\x02\xE5\xE8\x03\x02" + + "\x02\x02\xE6\xE4\x03\x02\x02\x02\xE6\xE7\x03\x02\x02\x02\xE7\xE9\x03\x02" + + "\x02\x02\xE8\xE6\x03\x02\x02\x02\xE9\xEB\x078\x02\x02\xEA\xDA\x03\x02" + + "\x02\x02\xEA\xE2\x03\x02\x02\x02\xEB\x1B\x03\x02\x02\x02\xEC\xF5\x07*" + + "\x02\x02\xED\xF2\x05\x18\r\x02\xEE\xEF\x07,\x02\x02\xEF\xF1\x05\x18\r" + + "\x02\xF0\xEE\x03\x02\x02\x02\xF1\xF4\x03\x02\x02\x02\xF2\xF0\x03\x02\x02" + + "\x02\xF2\xF3\x03\x02\x02\x02\xF3\xF6\x03\x02\x02\x02\xF4\xF2\x03\x02\x02" + + "\x02\xF5\xED\x03\x02\x02\x02\xF5\xF6\x03\x02\x02\x02\xF6\xF7\x03\x02\x02" + + "\x02\xF7\xF8\x07+\x02\x02\xF8\x1D\x03\x02\x02\x02\xF9\xFA\x05.\x18\x02" + + "\xFA\u0102\x07(\x02\x02\xFB\xFC\x05.\x18\x02\xFC\xFD\x07!\x02\x02\xFD" + + "\xFE\x05\x10\t\x02\xFE\xFF\x07,\x02\x02\xFF\u0101\x03\x02\x02\x02\u0100" + + "\xFB\x03\x02\x02\x02\u0101\u0104\x03\x02\x02\x02\u0102\u0100\x03\x02\x02" + + "\x02\u0102\u0103\x03\x02\x02\x02\u0103\u0105\x03\x02\x02\x02\u0104\u0102" + + "\x03\x02\x02\x02\u0105\u0106\x05.\x18\x02\u0106\u0107\x07!\x02\x02\u0107" + + "\u0108\x05\x10\t\x02\u0108\u0109\x07)\x02\x02\u0109\x1F\x03\x02\x02\x02" + + "\u010A\u010B\x05.\x18\x02\u010B\u011A\x07(\x02\x02\u010C\u010D\x05.\x18" + + "\x02\u010D\u010E\x07!\x02\x02\u010E\u010F\x05\x10\t\x02\u010F\u0110\x07" + + ",\x02\x02\u0110\u0112\x03\x02\x02\x02\u0111\u010C\x03\x02\x02\x02\u0112" + + "\u0115\x03\x02\x02\x02\u0113\u0111\x03\x02\x02\x02\u0113\u0114\x03\x02" + + "\x02\x02\u0114\u0116\x03\x02\x02\x02\u0115\u0113\x03\x02\x02\x02\u0116" + + "\u0117\x05.\x18\x02\u0117\u0118\x07!\x02\x02\u0118\u0119\x05\x10\t\x02" + + "\u0119\u011B\x03\x02\x02\x02\u011A\u0113\x03\x02\x02\x02\u011A\u011B\x03" + + "\x02\x02\x02\u011B\u011C\x03\x02\x02\x02\u011C\u011D\x07)\x02\x02\u011D" + + "\u012E\x03\x02\x02\x02\u011E\u011F\x05.\x18\x02\u011F\u0129\x07(\x02\x02" + + "\u0120\u0121\x05\x10\t\x02\u0121\u0122\x07,\x02\x02\u0122\u0124\x03\x02" + + "\x02\x02\u0123\u0120\x03\x02\x02\x02\u0124\u0127\x03\x02\x02\x02\u0125" + + "\u0123\x03\x02\x02\x02\u0125\u0126\x03\x02\x02\x02\u0126\u0128\x03\x02" + + "\x02\x02\u0127\u0125\x03\x02\x02\x02\u0128\u012A\x05\x10\t\x02\u0129\u0125" + + "\x03\x02\x02\x02\u0129\u012A\x03\x02\x02\x02\u012A\u012B\x03\x02\x02\x02" + + "\u012B\u012C\x07)\x02\x02\u012C\u012E\x03\x02\x02\x02\u012D\u010A\x03" + + "\x02\x02\x02\u012D\u011E\x03\x02\x02\x02\u012E!\x03\x02\x02\x02\u012F" + + "\u0130\x07\v\x02\x02\u0130\u0131\x07(\x02\x02\u0131\u0132\x05(\x15\x02" + + "\u0132\u0133\x07)\x02\x02\u0133#\x03\x02\x02\x02\u0134\u0135\x07\x19\x02" + + "\x02\u0135\u0136\x07(\x02\x02\u0136\u0139\x05*\x16\x02\u0137\u0138\x07" + + "-\x02\x02\u0138\u013A\t\x05\x02\x02\u0139\u0137\x03\x02\x02\x02\u0139" + + "\u013A\x03\x02\x02\x02\u013A\u013B\x03\x02\x02\x02\u013B\u013C\x07)\x02" + + "\x02\u013C%\x03\x02\x02\x02\u013D\u013E\x07\x1A\x02\x02\u013E\u013F\x07" + + "(\x02\x02\u013F\u0145\x05(\x15\x02\u0140\u0143\x05*\x16\x02\u0141\u0142" + + "\x07-\x02\x02\u0142\u0144\t\x05\x02\x02\u0143\u0141\x03\x02\x02\x02\u0143" + + "\u0144\x03\x02\x02\x02\u0144\u0146\x03\x02\x02\x02\u0145\u0140\x03\x02" + + "\x02\x02\u0145\u0146\x03\x02\x02\x02\u0146\u0147\x03\x02\x02\x02\u0147" + + "\u0148\x07)\x02\x02\u0148\'\x03\x02\x02\x02\u0149\u014A\x07\x06\x02\x02" + + "\u014A\u014B\x07$\x02\x02\u014B\u014C\t\x05\x02\x02\u014C\u014D\x07$\x02" + + "\x02\u014D\u014E\t\x05\x02\x02\u014E)\x03\x02\x02\x02\u014F\u0150\t\x05" + + "\x02\x02\u0150\u0151\x07.\x02\x02\u0151\u0152\t\x05\x02\x02\u0152\u0153" + + "\x07.\x02\x02\u0153\u0154\t\x05\x02\x02\u0154+\x03\x02\x02\x02\u0155\u019E" + + "\x07\x11\x02\x02\u0156\u0157\x07\x06\x02\x02\u0157\u015A\x07\x1C\x02\x02" + + "\u0158\u0159\x07\x06\x02\x02\u0159\u015B\x07\x14\x02\x02\u015A\u0158\x03" + + "\x02\x02\x02\u015A\u015B\x03\x02\x02\x02\u015B\u015E\x03\x02\x02\x02\u015C" + + "\u015D\x07\x06\x02\x02\u015D\u015F\x07\f\x02\x02\u015E\u015C\x03\x02\x02" + + "\x02\u015E\u015F\x03\x02\x02\x02\u015F\u0162\x03\x02\x02\x02\u0160\u0161" + + "\x07\x06\x02\x02\u0161\u0163\x07\x0F\x02\x02\u0162\u0160\x03\x02\x02\x02" + + "\u0162\u0163\x03\x02\x02\x02\u0163\u0166\x03\x02\x02\x02\u0164\u0165\x07" + + "\x06\x02\x02\u0165\u0167\x07\x13\x02\x02\u0166\u0164\x03\x02\x02\x02\u0166" + + "\u0167\x03\x02\x02\x02\u0167\u016A\x03\x02\x02\x02\u0168\u0169\x07\x06" + + "\x02\x02\u0169\u016B\x07\x18\x02\x02\u016A\u0168\x03\x02\x02\x02\u016A" + + "\u016B\x03\x02\x02\x02\u016B\u019F\x03\x02\x02\x02\u016C\u016D\x07\x06" + + "\x02\x02\u016D\u0170\x07\x14\x02\x02\u016E\u016F\x07\x06\x02\x02\u016F" + + "\u0171\x07\f\x02\x02\u0170\u016E\x03\x02\x02\x02\u0170\u0171\x03\x02\x02" + + "\x02\u0171\u0174\x03\x02\x02\x02\u0172\u0173\x07\x06\x02\x02\u0173\u0175" + + "\x07\x0F\x02\x02\u0174\u0172\x03\x02\x02\x02\u0174\u0175\x03\x02\x02\x02" + + "\u0175\u0178\x03\x02\x02\x02\u0176\u0177\x07\x06\x02\x02\u0177\u0179\x07" + + "\x13\x02\x02\u0178\u0176\x03\x02\x02\x02\u0178\u0179\x03\x02\x02\x02\u0179" + + "\u017C\x03\x02\x02\x02\u017A\u017B\x07\x06\x02\x02\u017B\u017D\x07\x18" + + "\x02\x02\u017C\u017A\x03\x02\x02\x02\u017C\u017D\x03\x02\x02\x02\u017D" + + "\u019F\x03\x02\x02\x02\u017E\u017F\x07\x06\x02\x02\u017F\u0182\x07\f\x02" + + "\x02\u0180\u0181\x07\x06\x02\x02\u0181\u0183\x07\x0F\x02\x02\u0182\u0180" + + "\x03\x02\x02\x02\u0182\u0183\x03\x02\x02\x02\u0183\u0186\x03\x02\x02\x02" + + "\u0184\u0185\x07\x06\x02\x02\u0185\u0187\x07\x13\x02\x02\u0186\u0184\x03" + + "\x02\x02\x02\u0186\u0187\x03\x02\x02\x02\u0187\u018A\x03\x02\x02\x02\u0188" + + "\u0189\x07\x06\x02\x02\u0189\u018B\x07\x18\x02\x02\u018A\u0188\x03\x02" + + "\x02\x02\u018A\u018B\x03\x02\x02\x02\u018B\u019F\x03\x02\x02\x02\u018C" + + "\u018D\x07\x06\x02\x02\u018D\u0190\x07\x0F\x02\x02\u018E\u018F\x07\x06" + + "\x02\x02\u018F\u0191\x07\x13\x02\x02\u0190\u018E\x03\x02\x02\x02\u0190" + + "\u0191\x03\x02\x02\x02\u0191\u0194\x03\x02\x02\x02\u0192\u0193\x07\x06" + + "\x02\x02\u0193\u0195\x07\x18\x02\x02\u0194\u0192\x03\x02\x02\x02\u0194" + + "\u0195\x03\x02\x02\x02\u0195\u019F\x03\x02\x02\x02\u0196\u0197\x07\x06" + + "\x02\x02\u0197\u019A\x07\x13\x02\x02\u0198\u0199\x07\x06\x02\x02\u0199" + + "\u019B\x07\x18\x02\x02\u019A\u0198\x03\x02\x02\x02\u019A\u019B\x03\x02" + + "\x02\x02\u019B\u019F\x03\x02\x02\x02\u019C\u019D\x07\x06\x02\x02\u019D" + + "\u019F\x07\x18\x02\x02\u019E\u0156\x03\x02\x02\x02\u019E\u016C\x03\x02" + + "\x02\x02\u019E\u017E\x03\x02\x02\x02\u019E\u018C\x03\x02\x02\x02\u019E" + + "\u0196\x03\x02\x02\x02\u019E\u019C\x03\x02\x02\x02\u019F-\x03\x02\x02" + + "\x02\u01A0\u01A1\t\x06\x02\x02\u01A1/\x03\x02\x02\x024:CES[]jq\x8F\x96" + + "\x9F\xA7\xA9\xAE\xB6\xBC\xC0\xC5\xCB\xD8\xDE\xE6\xEA\xF2\xF5\u0102\u0113" + + "\u011A\u0125\u0129\u012D\u0139\u0143\u0145\u015A\u015E\u0162\u0166\u016A" + + "\u0170\u0174\u0178\u017C\u0182\u0186\u018A\u0190\u0194\u019A\u019E"; + public static __ATN: ATN; + public static get _ATN(): ATN { + if (!BlazeExpressionParser.__ATN) { + BlazeExpressionParser.__ATN = new ATNDeserializer().deserialize(Utils.toCharArray(BlazeExpressionParser._serializedATN)); + } + + return BlazeExpressionParser.__ATN; + } + +} + +export class ParsePredicateContext extends ParserRuleContext { + public predicate(): PredicateContext { + return this.getRuleContext(0, PredicateContext); + } + public EOF(): TerminalNode { return this.getToken(BlazeExpressionParser.EOF, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_parsePredicate; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterParsePredicate) { + listener.enterParsePredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitParsePredicate) { + listener.exitParsePredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitParsePredicate) { + return visitor.visitParsePredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class ParseExpressionContext extends ParserRuleContext { + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public EOF(): TerminalNode { return this.getToken(BlazeExpressionParser.EOF, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_parseExpression; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterParseExpression) { + listener.enterParseExpression(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitParseExpression) { + listener.exitParseExpression(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitParseExpression) { + return visitor.visitParseExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class ParseExpressionOrPredicateContext extends ParserRuleContext { + public predicateOrExpression(): PredicateOrExpressionContext { + return this.getRuleContext(0, PredicateOrExpressionContext); + } + public EOF(): TerminalNode { return this.getToken(BlazeExpressionParser.EOF, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_parseExpressionOrPredicate; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterParseExpressionOrPredicate) { + listener.enterParseExpressionOrPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitParseExpressionOrPredicate) { + listener.exitParseExpressionOrPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitParseExpressionOrPredicate) { + return visitor.visitParseExpressionOrPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class ParseTemplateContext extends ParserRuleContext { + public EOF(): TerminalNode { return this.getToken(BlazeExpressionParser.EOF, 0); } + public template(): TemplateContext | undefined { + return this.tryGetRuleContext(0, TemplateContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_parseTemplate; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterParseTemplate) { + listener.enterParseTemplate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitParseTemplate) { + listener.exitParseTemplate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitParseTemplate) { + return visitor.visitParseTemplate(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class TemplateContext extends ParserRuleContext { + public TEXT(): TerminalNode[]; + public TEXT(i: number): TerminalNode; + public TEXT(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.TEXT); + } else { + return this.getToken(BlazeExpressionParser.TEXT, i); + } + } + public EXPRESSION_START(): TerminalNode[]; + public EXPRESSION_START(i: number): TerminalNode; + public EXPRESSION_START(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.EXPRESSION_START); + } else { + return this.getToken(BlazeExpressionParser.EXPRESSION_START, i); + } + } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + public EXPRESSION_END(): TerminalNode[]; + public EXPRESSION_END(i: number): TerminalNode; + public EXPRESSION_END(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.EXPRESSION_END); + } else { + return this.getToken(BlazeExpressionParser.EXPRESSION_END, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_template; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterTemplate) { + listener.enterTemplate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitTemplate) { + listener.exitTemplate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitTemplate) { + return visitor.visitTemplate(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class ExpressionContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_expression; } + public copyFrom(ctx: ExpressionContext): void { + super.copyFrom(ctx); + } +} +export class GroupedExpressionContext extends ExpressionContext { + public LP(): TerminalNode { return this.getToken(BlazeExpressionParser.LP, 0); } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public RP(): TerminalNode { return this.getToken(BlazeExpressionParser.RP, 0); } + constructor(ctx: ExpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterGroupedExpression) { + listener.enterGroupedExpression(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitGroupedExpression) { + listener.exitGroupedExpression(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitGroupedExpression) { + return visitor.visitGroupedExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class LiteralExpressionContext extends ExpressionContext { + public literal(): LiteralContext { + return this.getRuleContext(0, LiteralContext); + } + constructor(ctx: ExpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterLiteralExpression) { + listener.enterLiteralExpression(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitLiteralExpression) { + listener.exitLiteralExpression(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitLiteralExpression) { + return visitor.visitLiteralExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class PathExpressionContext extends ExpressionContext { + public path(): PathContext { + return this.getRuleContext(0, PathContext); + } + constructor(ctx: ExpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterPathExpression) { + listener.enterPathExpression(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitPathExpression) { + listener.exitPathExpression(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitPathExpression) { + return visitor.visitPathExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class FunctionExpressionContext extends ExpressionContext { + public functionInvocation(): FunctionInvocationContext { + return this.getRuleContext(0, FunctionInvocationContext); + } + constructor(ctx: ExpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterFunctionExpression) { + listener.enterFunctionExpression(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitFunctionExpression) { + listener.exitFunctionExpression(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitFunctionExpression) { + return visitor.visitFunctionExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class UnaryMinusExpressionContext extends ExpressionContext { + public MINUS(): TerminalNode { return this.getToken(BlazeExpressionParser.MINUS, 0); } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + constructor(ctx: ExpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterUnaryMinusExpression) { + listener.enterUnaryMinusExpression(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitUnaryMinusExpression) { + listener.exitUnaryMinusExpression(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitUnaryMinusExpression) { + return visitor.visitUnaryMinusExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class UnaryPlusExpressionContext extends ExpressionContext { + public PLUS(): TerminalNode { return this.getToken(BlazeExpressionParser.PLUS, 0); } + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + constructor(ctx: ExpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterUnaryPlusExpression) { + listener.enterUnaryPlusExpression(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitUnaryPlusExpression) { + listener.exitUnaryPlusExpression(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitUnaryPlusExpression) { + return visitor.visitUnaryPlusExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class MultiplicativeExpressionContext extends ExpressionContext { + public _lhs!: ExpressionContext; + public _op!: Token; + public _rhs!: ExpressionContext; + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + public ASTERISK(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.ASTERISK, 0); } + public SLASH(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.SLASH, 0); } + public PERCENT(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.PERCENT, 0); } + constructor(ctx: ExpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterMultiplicativeExpression) { + listener.enterMultiplicativeExpression(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitMultiplicativeExpression) { + listener.exitMultiplicativeExpression(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitMultiplicativeExpression) { + return visitor.visitMultiplicativeExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class AdditiveExpressionContext extends ExpressionContext { + public _lhs!: ExpressionContext; + public _op!: Token; + public _rhs!: ExpressionContext; + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + public PLUS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.PLUS, 0); } + public MINUS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.MINUS, 0); } + constructor(ctx: ExpressionContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterAdditiveExpression) { + listener.enterAdditiveExpression(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitAdditiveExpression) { + listener.exitAdditiveExpression(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitAdditiveExpression) { + return visitor.visitAdditiveExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class PredicateContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_predicate; } + public copyFrom(ctx: PredicateContext): void { + super.copyFrom(ctx); + } +} +export class GroupedPredicateContext extends PredicateContext { + public LP(): TerminalNode { return this.getToken(BlazeExpressionParser.LP, 0); } + public predicate(): PredicateContext { + return this.getRuleContext(0, PredicateContext); + } + public RP(): TerminalNode { return this.getToken(BlazeExpressionParser.RP, 0); } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterGroupedPredicate) { + listener.enterGroupedPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitGroupedPredicate) { + listener.exitGroupedPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitGroupedPredicate) { + return visitor.visitGroupedPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class NegatedPredicateContext extends PredicateContext { + public predicate(): PredicateContext { + return this.getRuleContext(0, PredicateContext); + } + public NOT(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.NOT, 0); } + public EXCLAMATION_MARK(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.EXCLAMATION_MARK, 0); } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterNegatedPredicate) { + listener.enterNegatedPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitNegatedPredicate) { + listener.exitNegatedPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitNegatedPredicate) { + return visitor.visitNegatedPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class AndPredicateContext extends PredicateContext { + public predicate(): PredicateContext[]; + public predicate(i: number): PredicateContext; + public predicate(i?: number): PredicateContext | PredicateContext[] { + if (i === undefined) { + return this.getRuleContexts(PredicateContext); + } else { + return this.getRuleContext(i, PredicateContext); + } + } + public AND(): TerminalNode { return this.getToken(BlazeExpressionParser.AND, 0); } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterAndPredicate) { + listener.enterAndPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitAndPredicate) { + listener.exitAndPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitAndPredicate) { + return visitor.visitAndPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class OrPredicateContext extends PredicateContext { + public predicate(): PredicateContext[]; + public predicate(i: number): PredicateContext; + public predicate(i?: number): PredicateContext | PredicateContext[] { + if (i === undefined) { + return this.getRuleContexts(PredicateContext); + } else { + return this.getRuleContext(i, PredicateContext); + } + } + public OR(): TerminalNode { return this.getToken(BlazeExpressionParser.OR, 0); } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterOrPredicate) { + listener.enterOrPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitOrPredicate) { + listener.exitOrPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitOrPredicate) { + return visitor.visitOrPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class IsNullPredicateContext extends PredicateContext { + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public IS(): TerminalNode { return this.getToken(BlazeExpressionParser.IS, 0); } + public NULL(): TerminalNode { return this.getToken(BlazeExpressionParser.NULL, 0); } + public NOT(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.NOT, 0); } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterIsNullPredicate) { + listener.enterIsNullPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitIsNullPredicate) { + listener.exitIsNullPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitIsNullPredicate) { + return visitor.visitIsNullPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class IsEmptyPredicateContext extends PredicateContext { + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public IS(): TerminalNode { return this.getToken(BlazeExpressionParser.IS, 0); } + public EMPTY(): TerminalNode { return this.getToken(BlazeExpressionParser.EMPTY, 0); } + public NOT(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.NOT, 0); } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterIsEmptyPredicate) { + listener.enterIsEmptyPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitIsEmptyPredicate) { + listener.exitIsEmptyPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitIsEmptyPredicate) { + return visitor.visitIsEmptyPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class EqualityPredicateContext extends PredicateContext { + public _lhs!: ExpressionContext; + public _rhs!: ExpressionContext; + public EQUAL(): TerminalNode { return this.getToken(BlazeExpressionParser.EQUAL, 0); } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterEqualityPredicate) { + listener.enterEqualityPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitEqualityPredicate) { + listener.exitEqualityPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitEqualityPredicate) { + return visitor.visitEqualityPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class InequalityPredicateContext extends PredicateContext { + public _lhs!: ExpressionContext; + public _rhs!: ExpressionContext; + public NOT_EQUAL(): TerminalNode { return this.getToken(BlazeExpressionParser.NOT_EQUAL, 0); } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterInequalityPredicate) { + listener.enterInequalityPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitInequalityPredicate) { + listener.exitInequalityPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitInequalityPredicate) { + return visitor.visitInequalityPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class GreaterThanPredicateContext extends PredicateContext { + public _lhs!: ExpressionContext; + public _rhs!: ExpressionContext; + public GREATER(): TerminalNode { return this.getToken(BlazeExpressionParser.GREATER, 0); } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterGreaterThanPredicate) { + listener.enterGreaterThanPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitGreaterThanPredicate) { + listener.exitGreaterThanPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitGreaterThanPredicate) { + return visitor.visitGreaterThanPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class GreaterThanOrEqualPredicateContext extends PredicateContext { + public _lhs!: ExpressionContext; + public _rhs!: ExpressionContext; + public GREATER_EQUAL(): TerminalNode { return this.getToken(BlazeExpressionParser.GREATER_EQUAL, 0); } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterGreaterThanOrEqualPredicate) { + listener.enterGreaterThanOrEqualPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitGreaterThanOrEqualPredicate) { + listener.exitGreaterThanOrEqualPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitGreaterThanOrEqualPredicate) { + return visitor.visitGreaterThanOrEqualPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class LessThanPredicateContext extends PredicateContext { + public _lhs!: ExpressionContext; + public _rhs!: ExpressionContext; + public LESS(): TerminalNode { return this.getToken(BlazeExpressionParser.LESS, 0); } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterLessThanPredicate) { + listener.enterLessThanPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitLessThanPredicate) { + listener.exitLessThanPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitLessThanPredicate) { + return visitor.visitLessThanPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class LessThanOrEqualPredicateContext extends PredicateContext { + public _lhs!: ExpressionContext; + public _rhs!: ExpressionContext; + public LESS_EQUAL(): TerminalNode { return this.getToken(BlazeExpressionParser.LESS_EQUAL, 0); } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterLessThanOrEqualPredicate) { + listener.enterLessThanOrEqualPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitLessThanOrEqualPredicate) { + listener.exitLessThanOrEqualPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitLessThanOrEqualPredicate) { + return visitor.visitLessThanOrEqualPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class InPredicateContext extends PredicateContext { + public expression(): ExpressionContext { + return this.getRuleContext(0, ExpressionContext); + } + public IN(): TerminalNode { return this.getToken(BlazeExpressionParser.IN, 0); } + public inList(): InListContext { + return this.getRuleContext(0, InListContext); + } + public NOT(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.NOT, 0); } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterInPredicate) { + listener.enterInPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitInPredicate) { + listener.exitInPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitInPredicate) { + return visitor.visitInPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class BetweenPredicateContext extends PredicateContext { + public _lhs!: ExpressionContext; + public _begin!: ExpressionContext; + public _end!: ExpressionContext; + public BETWEEN(): TerminalNode { return this.getToken(BlazeExpressionParser.BETWEEN, 0); } + public AND(): TerminalNode { return this.getToken(BlazeExpressionParser.AND, 0); } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + public NOT(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.NOT, 0); } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterBetweenPredicate) { + listener.enterBetweenPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitBetweenPredicate) { + listener.exitBetweenPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitBetweenPredicate) { + return visitor.visitBetweenPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class BooleanFunctionContext extends PredicateContext { + public functionInvocation(): FunctionInvocationContext { + return this.getRuleContext(0, FunctionInvocationContext); + } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterBooleanFunction) { + listener.enterBooleanFunction(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitBooleanFunction) { + listener.exitBooleanFunction(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitBooleanFunction) { + return visitor.visitBooleanFunction(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class PathPredicateContext extends PredicateContext { + public path(): PathContext { + return this.getRuleContext(0, PathContext); + } + constructor(ctx: PredicateContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterPathPredicate) { + listener.enterPathPredicate(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitPathPredicate) { + listener.exitPathPredicate(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitPathPredicate) { + return visitor.visitPathPredicate(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class PredicateOrExpressionContext extends ParserRuleContext { + public expression(): ExpressionContext | undefined { + return this.tryGetRuleContext(0, ExpressionContext); + } + public predicate(): PredicateContext | undefined { + return this.tryGetRuleContext(0, PredicateContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_predicateOrExpression; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterPredicateOrExpression) { + listener.enterPredicateOrExpression(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitPredicateOrExpression) { + listener.exitPredicateOrExpression(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitPredicateOrExpression) { + return visitor.visitPredicateOrExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class InListContext extends ParserRuleContext { + public LP(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.LP, 0); } + public expression(): ExpressionContext[]; + public expression(i: number): ExpressionContext; + public expression(i?: number): ExpressionContext | ExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(ExpressionContext); + } else { + return this.getRuleContext(i, ExpressionContext); + } + } + public RP(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.RP, 0); } + public COMMA(): TerminalNode[]; + public COMMA(i: number): TerminalNode; + public COMMA(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.COMMA); + } else { + return this.getToken(BlazeExpressionParser.COMMA, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_inList; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterInList) { + listener.enterInList(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitInList) { + listener.exitInList(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitInList) { + return visitor.visitInList(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class PathContext extends ParserRuleContext { + public identifier(): IdentifierContext | undefined { + return this.tryGetRuleContext(0, IdentifierContext); + } + public pathAttributes(): PathAttributesContext | undefined { + return this.tryGetRuleContext(0, PathAttributesContext); + } + public functionInvocation(): FunctionInvocationContext | undefined { + return this.tryGetRuleContext(0, FunctionInvocationContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_path; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterPath) { + listener.enterPath(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitPath) { + listener.exitPath(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitPath) { + return visitor.visitPath(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class PathAttributesContext extends ParserRuleContext { + public DOT(): TerminalNode[]; + public DOT(i: number): TerminalNode; + public DOT(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.DOT); + } else { + return this.getToken(BlazeExpressionParser.DOT, i); + } + } + public identifier(): IdentifierContext[]; + public identifier(i: number): IdentifierContext; + public identifier(i?: number): IdentifierContext | IdentifierContext[] { + if (i === undefined) { + return this.getRuleContexts(IdentifierContext); + } else { + return this.getRuleContext(i, IdentifierContext); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_pathAttributes; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterPathAttributes) { + listener.enterPathAttributes(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitPathAttributes) { + listener.exitPathAttributes(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitPathAttributes) { + return visitor.visitPathAttributes(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class LiteralContext extends ParserRuleContext { + public NUMERIC_LITERAL(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.NUMERIC_LITERAL, 0); } + public INTEGER_LITERAL(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.INTEGER_LITERAL, 0); } + public stringLiteral(): StringLiteralContext | undefined { + return this.tryGetRuleContext(0, StringLiteralContext); + } + public TRUE(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.TRUE, 0); } + public FALSE(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.FALSE, 0); } + public dateLiteral(): DateLiteralContext | undefined { + return this.tryGetRuleContext(0, DateLiteralContext); + } + public timeLiteral(): TimeLiteralContext | undefined { + return this.tryGetRuleContext(0, TimeLiteralContext); + } + public timestampLiteral(): TimestampLiteralContext | undefined { + return this.tryGetRuleContext(0, TimestampLiteralContext); + } + public temporalIntervalLiteral(): TemporalIntervalLiteralContext | undefined { + return this.tryGetRuleContext(0, TemporalIntervalLiteralContext); + } + public collectionLiteral(): CollectionLiteralContext | undefined { + return this.tryGetRuleContext(0, CollectionLiteralContext); + } + public entityLiteral(): EntityLiteralContext | undefined { + return this.tryGetRuleContext(0, EntityLiteralContext); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_literal; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterLiteral) { + listener.enterLiteral(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitLiteral) { + listener.exitLiteral(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitLiteral) { + return visitor.visitLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class StringLiteralContext extends ParserRuleContext { + public START_QUOTE(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.START_QUOTE, 0); } + public END_QUOTE(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.END_QUOTE, 0); } + public TEXT_IN_QUOTE(): TerminalNode[]; + public TEXT_IN_QUOTE(i: number): TerminalNode; + public TEXT_IN_QUOTE(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.TEXT_IN_QUOTE); + } else { + return this.getToken(BlazeExpressionParser.TEXT_IN_QUOTE, i); + } + } + public START_DOUBLE_QUOTE(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.START_DOUBLE_QUOTE, 0); } + public END_DOUBLE_QUOTE(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.END_DOUBLE_QUOTE, 0); } + public TEXT_IN_DOUBLE_QUOTE(): TerminalNode[]; + public TEXT_IN_DOUBLE_QUOTE(i: number): TerminalNode; + public TEXT_IN_DOUBLE_QUOTE(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.TEXT_IN_DOUBLE_QUOTE); + } else { + return this.getToken(BlazeExpressionParser.TEXT_IN_DOUBLE_QUOTE, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_stringLiteral; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterStringLiteral) { + listener.enterStringLiteral(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitStringLiteral) { + listener.exitStringLiteral(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitStringLiteral) { + return visitor.visitStringLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class CollectionLiteralContext extends ParserRuleContext { + public LB(): TerminalNode { return this.getToken(BlazeExpressionParser.LB, 0); } + public RB(): TerminalNode { return this.getToken(BlazeExpressionParser.RB, 0); } + public literal(): LiteralContext[]; + public literal(i: number): LiteralContext; + public literal(i?: number): LiteralContext | LiteralContext[] { + if (i === undefined) { + return this.getRuleContexts(LiteralContext); + } else { + return this.getRuleContext(i, LiteralContext); + } + } + public COMMA(): TerminalNode[]; + public COMMA(i: number): TerminalNode; + public COMMA(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.COMMA); + } else { + return this.getToken(BlazeExpressionParser.COMMA, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_collectionLiteral; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterCollectionLiteral) { + listener.enterCollectionLiteral(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitCollectionLiteral) { + listener.exitCollectionLiteral(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitCollectionLiteral) { + return visitor.visitCollectionLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class EntityLiteralContext extends ParserRuleContext { + public _name!: IdentifierContext; + public LP(): TerminalNode { return this.getToken(BlazeExpressionParser.LP, 0); } + public identifier(): IdentifierContext[]; + public identifier(i: number): IdentifierContext; + public identifier(i?: number): IdentifierContext | IdentifierContext[] { + if (i === undefined) { + return this.getRuleContexts(IdentifierContext); + } else { + return this.getRuleContext(i, IdentifierContext); + } + } + public EQUAL(): TerminalNode[]; + public EQUAL(i: number): TerminalNode; + public EQUAL(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.EQUAL); + } else { + return this.getToken(BlazeExpressionParser.EQUAL, i); + } + } + public predicateOrExpression(): PredicateOrExpressionContext[]; + public predicateOrExpression(i: number): PredicateOrExpressionContext; + public predicateOrExpression(i?: number): PredicateOrExpressionContext | PredicateOrExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(PredicateOrExpressionContext); + } else { + return this.getRuleContext(i, PredicateOrExpressionContext); + } + } + public RP(): TerminalNode { return this.getToken(BlazeExpressionParser.RP, 0); } + public COMMA(): TerminalNode[]; + public COMMA(i: number): TerminalNode; + public COMMA(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.COMMA); + } else { + return this.getToken(BlazeExpressionParser.COMMA, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_entityLiteral; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterEntityLiteral) { + listener.enterEntityLiteral(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitEntityLiteral) { + listener.exitEntityLiteral(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitEntityLiteral) { + return visitor.visitEntityLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class FunctionInvocationContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_functionInvocation; } + public copyFrom(ctx: FunctionInvocationContext): void { + super.copyFrom(ctx); + } +} +export class NamedInvocationContext extends FunctionInvocationContext { + public _name!: IdentifierContext; + public LP(): TerminalNode { return this.getToken(BlazeExpressionParser.LP, 0); } + public RP(): TerminalNode { return this.getToken(BlazeExpressionParser.RP, 0); } + public identifier(): IdentifierContext[]; + public identifier(i: number): IdentifierContext; + public identifier(i?: number): IdentifierContext | IdentifierContext[] { + if (i === undefined) { + return this.getRuleContexts(IdentifierContext); + } else { + return this.getRuleContext(i, IdentifierContext); + } + } + public EQUAL(): TerminalNode[]; + public EQUAL(i: number): TerminalNode; + public EQUAL(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.EQUAL); + } else { + return this.getToken(BlazeExpressionParser.EQUAL, i); + } + } + public predicateOrExpression(): PredicateOrExpressionContext[]; + public predicateOrExpression(i: number): PredicateOrExpressionContext; + public predicateOrExpression(i?: number): PredicateOrExpressionContext | PredicateOrExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(PredicateOrExpressionContext); + } else { + return this.getRuleContext(i, PredicateOrExpressionContext); + } + } + public COMMA(): TerminalNode[]; + public COMMA(i: number): TerminalNode; + public COMMA(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.COMMA); + } else { + return this.getToken(BlazeExpressionParser.COMMA, i); + } + } + constructor(ctx: FunctionInvocationContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterNamedInvocation) { + listener.enterNamedInvocation(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitNamedInvocation) { + listener.exitNamedInvocation(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitNamedInvocation) { + return visitor.visitNamedInvocation(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class IndexedFunctionInvocationContext extends FunctionInvocationContext { + public _name!: IdentifierContext; + public LP(): TerminalNode { return this.getToken(BlazeExpressionParser.LP, 0); } + public RP(): TerminalNode { return this.getToken(BlazeExpressionParser.RP, 0); } + public identifier(): IdentifierContext { + return this.getRuleContext(0, IdentifierContext); + } + public predicateOrExpression(): PredicateOrExpressionContext[]; + public predicateOrExpression(i: number): PredicateOrExpressionContext; + public predicateOrExpression(i?: number): PredicateOrExpressionContext | PredicateOrExpressionContext[] { + if (i === undefined) { + return this.getRuleContexts(PredicateOrExpressionContext); + } else { + return this.getRuleContext(i, PredicateOrExpressionContext); + } + } + public COMMA(): TerminalNode[]; + public COMMA(i: number): TerminalNode; + public COMMA(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.COMMA); + } else { + return this.getToken(BlazeExpressionParser.COMMA, i); + } + } + constructor(ctx: FunctionInvocationContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterIndexedFunctionInvocation) { + listener.enterIndexedFunctionInvocation(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitIndexedFunctionInvocation) { + listener.exitIndexedFunctionInvocation(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitIndexedFunctionInvocation) { + return visitor.visitIndexedFunctionInvocation(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class DateLiteralContext extends ParserRuleContext { + public DATE(): TerminalNode { return this.getToken(BlazeExpressionParser.DATE, 0); } + public LP(): TerminalNode { return this.getToken(BlazeExpressionParser.LP, 0); } + public datePart(): DatePartContext { + return this.getRuleContext(0, DatePartContext); + } + public RP(): TerminalNode { return this.getToken(BlazeExpressionParser.RP, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_dateLiteral; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterDateLiteral) { + listener.enterDateLiteral(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitDateLiteral) { + listener.exitDateLiteral(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitDateLiteral) { + return visitor.visitDateLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class TimeLiteralContext extends ParserRuleContext { + public _fraction!: Token; + public TIME(): TerminalNode { return this.getToken(BlazeExpressionParser.TIME, 0); } + public LP(): TerminalNode { return this.getToken(BlazeExpressionParser.LP, 0); } + public timePart(): TimePartContext { + return this.getRuleContext(0, TimePartContext); + } + public RP(): TerminalNode { return this.getToken(BlazeExpressionParser.RP, 0); } + public DOT(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.DOT, 0); } + public INTEGER_LITERAL(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.INTEGER_LITERAL, 0); } + public LEADING_ZERO_INTEGER_LITERAL(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_timeLiteral; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterTimeLiteral) { + listener.enterTimeLiteral(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitTimeLiteral) { + listener.exitTimeLiteral(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitTimeLiteral) { + return visitor.visitTimeLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class TimestampLiteralContext extends ParserRuleContext { + public _fraction!: Token; + public TIMESTAMP(): TerminalNode { return this.getToken(BlazeExpressionParser.TIMESTAMP, 0); } + public LP(): TerminalNode { return this.getToken(BlazeExpressionParser.LP, 0); } + public datePart(): DatePartContext { + return this.getRuleContext(0, DatePartContext); + } + public RP(): TerminalNode { return this.getToken(BlazeExpressionParser.RP, 0); } + public timePart(): TimePartContext | undefined { + return this.tryGetRuleContext(0, TimePartContext); + } + public DOT(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.DOT, 0); } + public INTEGER_LITERAL(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.INTEGER_LITERAL, 0); } + public LEADING_ZERO_INTEGER_LITERAL(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_timestampLiteral; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterTimestampLiteral) { + listener.enterTimestampLiteral(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitTimestampLiteral) { + listener.exitTimestampLiteral(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitTimestampLiteral) { + return visitor.visitTimestampLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class DatePartContext extends ParserRuleContext { + public INTEGER_LITERAL(): TerminalNode[]; + public INTEGER_LITERAL(i: number): TerminalNode; + public INTEGER_LITERAL(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.INTEGER_LITERAL); + } else { + return this.getToken(BlazeExpressionParser.INTEGER_LITERAL, i); + } + } + public MINUS(): TerminalNode[]; + public MINUS(i: number): TerminalNode; + public MINUS(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.MINUS); + } else { + return this.getToken(BlazeExpressionParser.MINUS, i); + } + } + public LEADING_ZERO_INTEGER_LITERAL(): TerminalNode[]; + public LEADING_ZERO_INTEGER_LITERAL(i: number): TerminalNode; + public LEADING_ZERO_INTEGER_LITERAL(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL); + } else { + return this.getToken(BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_datePart; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterDatePart) { + listener.enterDatePart(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitDatePart) { + listener.exitDatePart(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitDatePart) { + return visitor.visitDatePart(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class TimePartContext extends ParserRuleContext { + public COLON(): TerminalNode[]; + public COLON(i: number): TerminalNode; + public COLON(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.COLON); + } else { + return this.getToken(BlazeExpressionParser.COLON, i); + } + } + public INTEGER_LITERAL(): TerminalNode[]; + public INTEGER_LITERAL(i: number): TerminalNode; + public INTEGER_LITERAL(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.INTEGER_LITERAL); + } else { + return this.getToken(BlazeExpressionParser.INTEGER_LITERAL, i); + } + } + public LEADING_ZERO_INTEGER_LITERAL(): TerminalNode[]; + public LEADING_ZERO_INTEGER_LITERAL(i: number): TerminalNode; + public LEADING_ZERO_INTEGER_LITERAL(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL); + } else { + return this.getToken(BlazeExpressionParser.LEADING_ZERO_INTEGER_LITERAL, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_timePart; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterTimePart) { + listener.enterTimePart(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitTimePart) { + listener.exitTimePart(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitTimePart) { + return visitor.visitTimePart(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class TemporalIntervalLiteralContext extends ParserRuleContext { + public _years!: Token; + public _months!: Token; + public _days!: Token; + public _hours!: Token; + public _minutes!: Token; + public _seconds!: Token; + public INTERVAL(): TerminalNode { return this.getToken(BlazeExpressionParser.INTERVAL, 0); } + public YEARS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.YEARS, 0); } + public MONTHS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.MONTHS, 0); } + public DAYS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.DAYS, 0); } + public HOURS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.HOURS, 0); } + public MINUTES(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.MINUTES, 0); } + public SECONDS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.SECONDS, 0); } + public INTEGER_LITERAL(): TerminalNode[]; + public INTEGER_LITERAL(i: number): TerminalNode; + public INTEGER_LITERAL(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(BlazeExpressionParser.INTEGER_LITERAL); + } else { + return this.getToken(BlazeExpressionParser.INTEGER_LITERAL, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_temporalIntervalLiteral; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterTemporalIntervalLiteral) { + listener.enterTemporalIntervalLiteral(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitTemporalIntervalLiteral) { + listener.exitTemporalIntervalLiteral(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitTemporalIntervalLiteral) { + return visitor.visitTemporalIntervalLiteral(this); + } else { + return visitor.visitChildren(this); + } + } +} + + +export class IdentifierContext extends ParserRuleContext { + public IDENTIFIER(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.IDENTIFIER, 0); } + public QUOTED_IDENTIFIER(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.QUOTED_IDENTIFIER, 0); } + public AND(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.AND, 0); } + public BETWEEN(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.BETWEEN, 0); } + public DATE(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.DATE, 0); } + public DAYS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.DAYS, 0); } + public HOURS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.HOURS, 0); } + public IN(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.IN, 0); } + public IS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.IS, 0); } + public MINUTES(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.MINUTES, 0); } + public MONTHS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.MONTHS, 0); } + public NOT(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.NOT, 0); } + public OR(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.OR, 0); } + public SECONDS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.SECONDS, 0); } + public TIME(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.TIME, 0); } + public TIMESTAMP(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.TIMESTAMP, 0); } + public YEARS(): TerminalNode | undefined { return this.tryGetToken(BlazeExpressionParser.YEARS, 0); } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { return BlazeExpressionParser.RULE_identifier; } + // @Override + public enterRule(listener: BlazeExpressionParserListener): void { + if (listener.enterIdentifier) { + listener.enterIdentifier(this); + } + } + // @Override + public exitRule(listener: BlazeExpressionParserListener): void { + if (listener.exitIdentifier) { + listener.exitIdentifier(this); + } + } + // @Override + public accept(visitor: BlazeExpressionParserVisitor): Result { + if (visitor.visitIdentifier) { + return visitor.visitIdentifier(this); + } else { + return visitor.visitChildren(this); + } + } +} + + diff --git a/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParserListener.ts b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParserListener.ts new file mode 100644 index 00000000..4ca45e48 --- /dev/null +++ b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParserListener.ts @@ -0,0 +1,653 @@ +// Generated from target/antlr4/BlazeExpressionParser.g4 by ANTLR 4.9.0-SNAPSHOT + + +import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener"; + +import { GroupedExpressionContext } from "./BlazeExpressionParser"; +import { LiteralExpressionContext } from "./BlazeExpressionParser"; +import { PathExpressionContext } from "./BlazeExpressionParser"; +import { FunctionExpressionContext } from "./BlazeExpressionParser"; +import { UnaryMinusExpressionContext } from "./BlazeExpressionParser"; +import { UnaryPlusExpressionContext } from "./BlazeExpressionParser"; +import { MultiplicativeExpressionContext } from "./BlazeExpressionParser"; +import { AdditiveExpressionContext } from "./BlazeExpressionParser"; +import { NamedInvocationContext } from "./BlazeExpressionParser"; +import { IndexedFunctionInvocationContext } from "./BlazeExpressionParser"; +import { GroupedPredicateContext } from "./BlazeExpressionParser"; +import { NegatedPredicateContext } from "./BlazeExpressionParser"; +import { AndPredicateContext } from "./BlazeExpressionParser"; +import { OrPredicateContext } from "./BlazeExpressionParser"; +import { IsNullPredicateContext } from "./BlazeExpressionParser"; +import { IsEmptyPredicateContext } from "./BlazeExpressionParser"; +import { EqualityPredicateContext } from "./BlazeExpressionParser"; +import { InequalityPredicateContext } from "./BlazeExpressionParser"; +import { GreaterThanPredicateContext } from "./BlazeExpressionParser"; +import { GreaterThanOrEqualPredicateContext } from "./BlazeExpressionParser"; +import { LessThanPredicateContext } from "./BlazeExpressionParser"; +import { LessThanOrEqualPredicateContext } from "./BlazeExpressionParser"; +import { InPredicateContext } from "./BlazeExpressionParser"; +import { BetweenPredicateContext } from "./BlazeExpressionParser"; +import { BooleanFunctionContext } from "./BlazeExpressionParser"; +import { PathPredicateContext } from "./BlazeExpressionParser"; +import { ParsePredicateContext } from "./BlazeExpressionParser"; +import { ParseExpressionContext } from "./BlazeExpressionParser"; +import { ParseExpressionOrPredicateContext } from "./BlazeExpressionParser"; +import { ParseTemplateContext } from "./BlazeExpressionParser"; +import { TemplateContext } from "./BlazeExpressionParser"; +import { ExpressionContext } from "./BlazeExpressionParser"; +import { PredicateContext } from "./BlazeExpressionParser"; +import { PredicateOrExpressionContext } from "./BlazeExpressionParser"; +import { InListContext } from "./BlazeExpressionParser"; +import { PathContext } from "./BlazeExpressionParser"; +import { PathAttributesContext } from "./BlazeExpressionParser"; +import { LiteralContext } from "./BlazeExpressionParser"; +import { StringLiteralContext } from "./BlazeExpressionParser"; +import { CollectionLiteralContext } from "./BlazeExpressionParser"; +import { EntityLiteralContext } from "./BlazeExpressionParser"; +import { FunctionInvocationContext } from "./BlazeExpressionParser"; +import { DateLiteralContext } from "./BlazeExpressionParser"; +import { TimeLiteralContext } from "./BlazeExpressionParser"; +import { TimestampLiteralContext } from "./BlazeExpressionParser"; +import { DatePartContext } from "./BlazeExpressionParser"; +import { TimePartContext } from "./BlazeExpressionParser"; +import { TemporalIntervalLiteralContext } from "./BlazeExpressionParser"; +import { IdentifierContext } from "./BlazeExpressionParser"; + + +/** + * This interface defines a complete listener for a parse tree produced by + * `BlazeExpressionParser`. + */ +export interface BlazeExpressionParserListener extends ParseTreeListener { + /** + * Enter a parse tree produced by the `GroupedExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + enterGroupedExpression?: (ctx: GroupedExpressionContext) => void; + /** + * Exit a parse tree produced by the `GroupedExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + exitGroupedExpression?: (ctx: GroupedExpressionContext) => void; + + /** + * Enter a parse tree produced by the `LiteralExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + enterLiteralExpression?: (ctx: LiteralExpressionContext) => void; + /** + * Exit a parse tree produced by the `LiteralExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + exitLiteralExpression?: (ctx: LiteralExpressionContext) => void; + + /** + * Enter a parse tree produced by the `PathExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + enterPathExpression?: (ctx: PathExpressionContext) => void; + /** + * Exit a parse tree produced by the `PathExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + exitPathExpression?: (ctx: PathExpressionContext) => void; + + /** + * Enter a parse tree produced by the `FunctionExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + enterFunctionExpression?: (ctx: FunctionExpressionContext) => void; + /** + * Exit a parse tree produced by the `FunctionExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + exitFunctionExpression?: (ctx: FunctionExpressionContext) => void; + + /** + * Enter a parse tree produced by the `UnaryMinusExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + enterUnaryMinusExpression?: (ctx: UnaryMinusExpressionContext) => void; + /** + * Exit a parse tree produced by the `UnaryMinusExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + exitUnaryMinusExpression?: (ctx: UnaryMinusExpressionContext) => void; + + /** + * Enter a parse tree produced by the `UnaryPlusExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + enterUnaryPlusExpression?: (ctx: UnaryPlusExpressionContext) => void; + /** + * Exit a parse tree produced by the `UnaryPlusExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + exitUnaryPlusExpression?: (ctx: UnaryPlusExpressionContext) => void; + + /** + * Enter a parse tree produced by the `MultiplicativeExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + enterMultiplicativeExpression?: (ctx: MultiplicativeExpressionContext) => void; + /** + * Exit a parse tree produced by the `MultiplicativeExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + exitMultiplicativeExpression?: (ctx: MultiplicativeExpressionContext) => void; + + /** + * Enter a parse tree produced by the `AdditiveExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + enterAdditiveExpression?: (ctx: AdditiveExpressionContext) => void; + /** + * Exit a parse tree produced by the `AdditiveExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + exitAdditiveExpression?: (ctx: AdditiveExpressionContext) => void; + + /** + * Enter a parse tree produced by the `NamedInvocation` + * labeled alternative in `BlazeExpressionParser.functionInvocation`. + * @param ctx the parse tree + */ + enterNamedInvocation?: (ctx: NamedInvocationContext) => void; + /** + * Exit a parse tree produced by the `NamedInvocation` + * labeled alternative in `BlazeExpressionParser.functionInvocation`. + * @param ctx the parse tree + */ + exitNamedInvocation?: (ctx: NamedInvocationContext) => void; + + /** + * Enter a parse tree produced by the `IndexedFunctionInvocation` + * labeled alternative in `BlazeExpressionParser.functionInvocation`. + * @param ctx the parse tree + */ + enterIndexedFunctionInvocation?: (ctx: IndexedFunctionInvocationContext) => void; + /** + * Exit a parse tree produced by the `IndexedFunctionInvocation` + * labeled alternative in `BlazeExpressionParser.functionInvocation`. + * @param ctx the parse tree + */ + exitIndexedFunctionInvocation?: (ctx: IndexedFunctionInvocationContext) => void; + + /** + * Enter a parse tree produced by the `GroupedPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterGroupedPredicate?: (ctx: GroupedPredicateContext) => void; + /** + * Exit a parse tree produced by the `GroupedPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitGroupedPredicate?: (ctx: GroupedPredicateContext) => void; + + /** + * Enter a parse tree produced by the `NegatedPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterNegatedPredicate?: (ctx: NegatedPredicateContext) => void; + /** + * Exit a parse tree produced by the `NegatedPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitNegatedPredicate?: (ctx: NegatedPredicateContext) => void; + + /** + * Enter a parse tree produced by the `AndPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterAndPredicate?: (ctx: AndPredicateContext) => void; + /** + * Exit a parse tree produced by the `AndPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitAndPredicate?: (ctx: AndPredicateContext) => void; + + /** + * Enter a parse tree produced by the `OrPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterOrPredicate?: (ctx: OrPredicateContext) => void; + /** + * Exit a parse tree produced by the `OrPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitOrPredicate?: (ctx: OrPredicateContext) => void; + + /** + * Enter a parse tree produced by the `IsNullPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterIsNullPredicate?: (ctx: IsNullPredicateContext) => void; + /** + * Exit a parse tree produced by the `IsNullPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitIsNullPredicate?: (ctx: IsNullPredicateContext) => void; + + /** + * Enter a parse tree produced by the `IsEmptyPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterIsEmptyPredicate?: (ctx: IsEmptyPredicateContext) => void; + /** + * Exit a parse tree produced by the `IsEmptyPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitIsEmptyPredicate?: (ctx: IsEmptyPredicateContext) => void; + + /** + * Enter a parse tree produced by the `EqualityPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterEqualityPredicate?: (ctx: EqualityPredicateContext) => void; + /** + * Exit a parse tree produced by the `EqualityPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitEqualityPredicate?: (ctx: EqualityPredicateContext) => void; + + /** + * Enter a parse tree produced by the `InequalityPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterInequalityPredicate?: (ctx: InequalityPredicateContext) => void; + /** + * Exit a parse tree produced by the `InequalityPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitInequalityPredicate?: (ctx: InequalityPredicateContext) => void; + + /** + * Enter a parse tree produced by the `GreaterThanPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterGreaterThanPredicate?: (ctx: GreaterThanPredicateContext) => void; + /** + * Exit a parse tree produced by the `GreaterThanPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitGreaterThanPredicate?: (ctx: GreaterThanPredicateContext) => void; + + /** + * Enter a parse tree produced by the `GreaterThanOrEqualPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterGreaterThanOrEqualPredicate?: (ctx: GreaterThanOrEqualPredicateContext) => void; + /** + * Exit a parse tree produced by the `GreaterThanOrEqualPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitGreaterThanOrEqualPredicate?: (ctx: GreaterThanOrEqualPredicateContext) => void; + + /** + * Enter a parse tree produced by the `LessThanPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterLessThanPredicate?: (ctx: LessThanPredicateContext) => void; + /** + * Exit a parse tree produced by the `LessThanPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitLessThanPredicate?: (ctx: LessThanPredicateContext) => void; + + /** + * Enter a parse tree produced by the `LessThanOrEqualPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterLessThanOrEqualPredicate?: (ctx: LessThanOrEqualPredicateContext) => void; + /** + * Exit a parse tree produced by the `LessThanOrEqualPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitLessThanOrEqualPredicate?: (ctx: LessThanOrEqualPredicateContext) => void; + + /** + * Enter a parse tree produced by the `InPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterInPredicate?: (ctx: InPredicateContext) => void; + /** + * Exit a parse tree produced by the `InPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitInPredicate?: (ctx: InPredicateContext) => void; + + /** + * Enter a parse tree produced by the `BetweenPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterBetweenPredicate?: (ctx: BetweenPredicateContext) => void; + /** + * Exit a parse tree produced by the `BetweenPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitBetweenPredicate?: (ctx: BetweenPredicateContext) => void; + + /** + * Enter a parse tree produced by the `BooleanFunction` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterBooleanFunction?: (ctx: BooleanFunctionContext) => void; + /** + * Exit a parse tree produced by the `BooleanFunction` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitBooleanFunction?: (ctx: BooleanFunctionContext) => void; + + /** + * Enter a parse tree produced by the `PathPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterPathPredicate?: (ctx: PathPredicateContext) => void; + /** + * Exit a parse tree produced by the `PathPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitPathPredicate?: (ctx: PathPredicateContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.parsePredicate`. + * @param ctx the parse tree + */ + enterParsePredicate?: (ctx: ParsePredicateContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.parsePredicate`. + * @param ctx the parse tree + */ + exitParsePredicate?: (ctx: ParsePredicateContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.parseExpression`. + * @param ctx the parse tree + */ + enterParseExpression?: (ctx: ParseExpressionContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.parseExpression`. + * @param ctx the parse tree + */ + exitParseExpression?: (ctx: ParseExpressionContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.parseExpressionOrPredicate`. + * @param ctx the parse tree + */ + enterParseExpressionOrPredicate?: (ctx: ParseExpressionOrPredicateContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.parseExpressionOrPredicate`. + * @param ctx the parse tree + */ + exitParseExpressionOrPredicate?: (ctx: ParseExpressionOrPredicateContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.parseTemplate`. + * @param ctx the parse tree + */ + enterParseTemplate?: (ctx: ParseTemplateContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.parseTemplate`. + * @param ctx the parse tree + */ + exitParseTemplate?: (ctx: ParseTemplateContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.template`. + * @param ctx the parse tree + */ + enterTemplate?: (ctx: TemplateContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.template`. + * @param ctx the parse tree + */ + exitTemplate?: (ctx: TemplateContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + enterExpression?: (ctx: ExpressionContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.expression`. + * @param ctx the parse tree + */ + exitExpression?: (ctx: ExpressionContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + enterPredicate?: (ctx: PredicateContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + */ + exitPredicate?: (ctx: PredicateContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.predicateOrExpression`. + * @param ctx the parse tree + */ + enterPredicateOrExpression?: (ctx: PredicateOrExpressionContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.predicateOrExpression`. + * @param ctx the parse tree + */ + exitPredicateOrExpression?: (ctx: PredicateOrExpressionContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.inList`. + * @param ctx the parse tree + */ + enterInList?: (ctx: InListContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.inList`. + * @param ctx the parse tree + */ + exitInList?: (ctx: InListContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.path`. + * @param ctx the parse tree + */ + enterPath?: (ctx: PathContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.path`. + * @param ctx the parse tree + */ + exitPath?: (ctx: PathContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.pathAttributes`. + * @param ctx the parse tree + */ + enterPathAttributes?: (ctx: PathAttributesContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.pathAttributes`. + * @param ctx the parse tree + */ + exitPathAttributes?: (ctx: PathAttributesContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.literal`. + * @param ctx the parse tree + */ + enterLiteral?: (ctx: LiteralContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.literal`. + * @param ctx the parse tree + */ + exitLiteral?: (ctx: LiteralContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.stringLiteral`. + * @param ctx the parse tree + */ + enterStringLiteral?: (ctx: StringLiteralContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.stringLiteral`. + * @param ctx the parse tree + */ + exitStringLiteral?: (ctx: StringLiteralContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.collectionLiteral`. + * @param ctx the parse tree + */ + enterCollectionLiteral?: (ctx: CollectionLiteralContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.collectionLiteral`. + * @param ctx the parse tree + */ + exitCollectionLiteral?: (ctx: CollectionLiteralContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.entityLiteral`. + * @param ctx the parse tree + */ + enterEntityLiteral?: (ctx: EntityLiteralContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.entityLiteral`. + * @param ctx the parse tree + */ + exitEntityLiteral?: (ctx: EntityLiteralContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.functionInvocation`. + * @param ctx the parse tree + */ + enterFunctionInvocation?: (ctx: FunctionInvocationContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.functionInvocation`. + * @param ctx the parse tree + */ + exitFunctionInvocation?: (ctx: FunctionInvocationContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.dateLiteral`. + * @param ctx the parse tree + */ + enterDateLiteral?: (ctx: DateLiteralContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.dateLiteral`. + * @param ctx the parse tree + */ + exitDateLiteral?: (ctx: DateLiteralContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.timeLiteral`. + * @param ctx the parse tree + */ + enterTimeLiteral?: (ctx: TimeLiteralContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.timeLiteral`. + * @param ctx the parse tree + */ + exitTimeLiteral?: (ctx: TimeLiteralContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.timestampLiteral`. + * @param ctx the parse tree + */ + enterTimestampLiteral?: (ctx: TimestampLiteralContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.timestampLiteral`. + * @param ctx the parse tree + */ + exitTimestampLiteral?: (ctx: TimestampLiteralContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.datePart`. + * @param ctx the parse tree + */ + enterDatePart?: (ctx: DatePartContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.datePart`. + * @param ctx the parse tree + */ + exitDatePart?: (ctx: DatePartContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.timePart`. + * @param ctx the parse tree + */ + enterTimePart?: (ctx: TimePartContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.timePart`. + * @param ctx the parse tree + */ + exitTimePart?: (ctx: TimePartContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.temporalIntervalLiteral`. + * @param ctx the parse tree + */ + enterTemporalIntervalLiteral?: (ctx: TemporalIntervalLiteralContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.temporalIntervalLiteral`. + * @param ctx the parse tree + */ + exitTemporalIntervalLiteral?: (ctx: TemporalIntervalLiteralContext) => void; + + /** + * Enter a parse tree produced by `BlazeExpressionParser.identifier`. + * @param ctx the parse tree + */ + enterIdentifier?: (ctx: IdentifierContext) => void; + /** + * Exit a parse tree produced by `BlazeExpressionParser.identifier`. + * @param ctx the parse tree + */ + exitIdentifier?: (ctx: IdentifierContext) => void; +} + diff --git a/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParserVisitor.ts b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParserVisitor.ts new file mode 100644 index 00000000..4718c125 --- /dev/null +++ b/editor/monaco/src/main/typescript/blaze-expression-predicate/BlazeExpressionParserVisitor.ts @@ -0,0 +1,434 @@ +// Generated from target/antlr4/BlazeExpressionParser.g4 by ANTLR 4.9.0-SNAPSHOT + + +import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor"; + +import { GroupedExpressionContext } from "./BlazeExpressionParser"; +import { LiteralExpressionContext } from "./BlazeExpressionParser"; +import { PathExpressionContext } from "./BlazeExpressionParser"; +import { FunctionExpressionContext } from "./BlazeExpressionParser"; +import { UnaryMinusExpressionContext } from "./BlazeExpressionParser"; +import { UnaryPlusExpressionContext } from "./BlazeExpressionParser"; +import { MultiplicativeExpressionContext } from "./BlazeExpressionParser"; +import { AdditiveExpressionContext } from "./BlazeExpressionParser"; +import { NamedInvocationContext } from "./BlazeExpressionParser"; +import { IndexedFunctionInvocationContext } from "./BlazeExpressionParser"; +import { GroupedPredicateContext } from "./BlazeExpressionParser"; +import { NegatedPredicateContext } from "./BlazeExpressionParser"; +import { AndPredicateContext } from "./BlazeExpressionParser"; +import { OrPredicateContext } from "./BlazeExpressionParser"; +import { IsNullPredicateContext } from "./BlazeExpressionParser"; +import { IsEmptyPredicateContext } from "./BlazeExpressionParser"; +import { EqualityPredicateContext } from "./BlazeExpressionParser"; +import { InequalityPredicateContext } from "./BlazeExpressionParser"; +import { GreaterThanPredicateContext } from "./BlazeExpressionParser"; +import { GreaterThanOrEqualPredicateContext } from "./BlazeExpressionParser"; +import { LessThanPredicateContext } from "./BlazeExpressionParser"; +import { LessThanOrEqualPredicateContext } from "./BlazeExpressionParser"; +import { InPredicateContext } from "./BlazeExpressionParser"; +import { BetweenPredicateContext } from "./BlazeExpressionParser"; +import { BooleanFunctionContext } from "./BlazeExpressionParser"; +import { PathPredicateContext } from "./BlazeExpressionParser"; +import { ParsePredicateContext } from "./BlazeExpressionParser"; +import { ParseExpressionContext } from "./BlazeExpressionParser"; +import { ParseExpressionOrPredicateContext } from "./BlazeExpressionParser"; +import { ParseTemplateContext } from "./BlazeExpressionParser"; +import { TemplateContext } from "./BlazeExpressionParser"; +import { ExpressionContext } from "./BlazeExpressionParser"; +import { PredicateContext } from "./BlazeExpressionParser"; +import { PredicateOrExpressionContext } from "./BlazeExpressionParser"; +import { InListContext } from "./BlazeExpressionParser"; +import { PathContext } from "./BlazeExpressionParser"; +import { PathAttributesContext } from "./BlazeExpressionParser"; +import { LiteralContext } from "./BlazeExpressionParser"; +import { StringLiteralContext } from "./BlazeExpressionParser"; +import { CollectionLiteralContext } from "./BlazeExpressionParser"; +import { EntityLiteralContext } from "./BlazeExpressionParser"; +import { FunctionInvocationContext } from "./BlazeExpressionParser"; +import { DateLiteralContext } from "./BlazeExpressionParser"; +import { TimeLiteralContext } from "./BlazeExpressionParser"; +import { TimestampLiteralContext } from "./BlazeExpressionParser"; +import { DatePartContext } from "./BlazeExpressionParser"; +import { TimePartContext } from "./BlazeExpressionParser"; +import { TemporalIntervalLiteralContext } from "./BlazeExpressionParser"; +import { IdentifierContext } from "./BlazeExpressionParser"; + + +/** + * This interface defines a complete generic visitor for a parse tree produced + * by `BlazeExpressionParser`. + * + * @param The return type of the visit operation. Use `void` for + * operations with no return type. + */ +export interface BlazeExpressionParserVisitor extends ParseTreeVisitor { + /** + * Visit a parse tree produced by the `GroupedExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitGroupedExpression?: (ctx: GroupedExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `LiteralExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitLiteralExpression?: (ctx: LiteralExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `PathExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitPathExpression?: (ctx: PathExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `FunctionExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitFunctionExpression?: (ctx: FunctionExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `UnaryMinusExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitUnaryMinusExpression?: (ctx: UnaryMinusExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `UnaryPlusExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitUnaryPlusExpression?: (ctx: UnaryPlusExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `MultiplicativeExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitMultiplicativeExpression?: (ctx: MultiplicativeExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `AdditiveExpression` + * labeled alternative in `BlazeExpressionParser.expression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitAdditiveExpression?: (ctx: AdditiveExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `NamedInvocation` + * labeled alternative in `BlazeExpressionParser.functionInvocation`. + * @param ctx the parse tree + * @return the visitor result + */ + visitNamedInvocation?: (ctx: NamedInvocationContext) => Result; + + /** + * Visit a parse tree produced by the `IndexedFunctionInvocation` + * labeled alternative in `BlazeExpressionParser.functionInvocation`. + * @param ctx the parse tree + * @return the visitor result + */ + visitIndexedFunctionInvocation?: (ctx: IndexedFunctionInvocationContext) => Result; + + /** + * Visit a parse tree produced by the `GroupedPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitGroupedPredicate?: (ctx: GroupedPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `NegatedPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitNegatedPredicate?: (ctx: NegatedPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `AndPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitAndPredicate?: (ctx: AndPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `OrPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitOrPredicate?: (ctx: OrPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `IsNullPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitIsNullPredicate?: (ctx: IsNullPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `IsEmptyPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitIsEmptyPredicate?: (ctx: IsEmptyPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `EqualityPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitEqualityPredicate?: (ctx: EqualityPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `InequalityPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitInequalityPredicate?: (ctx: InequalityPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `GreaterThanPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitGreaterThanPredicate?: (ctx: GreaterThanPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `GreaterThanOrEqualPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitGreaterThanOrEqualPredicate?: (ctx: GreaterThanOrEqualPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `LessThanPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitLessThanPredicate?: (ctx: LessThanPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `LessThanOrEqualPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitLessThanOrEqualPredicate?: (ctx: LessThanOrEqualPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `InPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitInPredicate?: (ctx: InPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `BetweenPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitBetweenPredicate?: (ctx: BetweenPredicateContext) => Result; + + /** + * Visit a parse tree produced by the `BooleanFunction` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitBooleanFunction?: (ctx: BooleanFunctionContext) => Result; + + /** + * Visit a parse tree produced by the `PathPredicate` + * labeled alternative in `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitPathPredicate?: (ctx: PathPredicateContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.parsePredicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitParsePredicate?: (ctx: ParsePredicateContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.parseExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitParseExpression?: (ctx: ParseExpressionContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.parseExpressionOrPredicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitParseExpressionOrPredicate?: (ctx: ParseExpressionOrPredicateContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.parseTemplate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitParseTemplate?: (ctx: ParseTemplateContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.template`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTemplate?: (ctx: TemplateContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.expression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitExpression?: (ctx: ExpressionContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.predicate`. + * @param ctx the parse tree + * @return the visitor result + */ + visitPredicate?: (ctx: PredicateContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.predicateOrExpression`. + * @param ctx the parse tree + * @return the visitor result + */ + visitPredicateOrExpression?: (ctx: PredicateOrExpressionContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.inList`. + * @param ctx the parse tree + * @return the visitor result + */ + visitInList?: (ctx: InListContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.path`. + * @param ctx the parse tree + * @return the visitor result + */ + visitPath?: (ctx: PathContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.pathAttributes`. + * @param ctx the parse tree + * @return the visitor result + */ + visitPathAttributes?: (ctx: PathAttributesContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.literal`. + * @param ctx the parse tree + * @return the visitor result + */ + visitLiteral?: (ctx: LiteralContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.stringLiteral`. + * @param ctx the parse tree + * @return the visitor result + */ + visitStringLiteral?: (ctx: StringLiteralContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.collectionLiteral`. + * @param ctx the parse tree + * @return the visitor result + */ + visitCollectionLiteral?: (ctx: CollectionLiteralContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.entityLiteral`. + * @param ctx the parse tree + * @return the visitor result + */ + visitEntityLiteral?: (ctx: EntityLiteralContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.functionInvocation`. + * @param ctx the parse tree + * @return the visitor result + */ + visitFunctionInvocation?: (ctx: FunctionInvocationContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.dateLiteral`. + * @param ctx the parse tree + * @return the visitor result + */ + visitDateLiteral?: (ctx: DateLiteralContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.timeLiteral`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTimeLiteral?: (ctx: TimeLiteralContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.timestampLiteral`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTimestampLiteral?: (ctx: TimestampLiteralContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.datePart`. + * @param ctx the parse tree + * @return the visitor result + */ + visitDatePart?: (ctx: DatePartContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.timePart`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTimePart?: (ctx: TimePartContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.temporalIntervalLiteral`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTemporalIntervalLiteral?: (ctx: TemporalIntervalLiteralContext) => Result; + + /** + * Visit a parse tree produced by `BlazeExpressionParser.identifier`. + * @param ctx the parse tree + * @return the visitor result + */ + visitIdentifier?: (ctx: IdentifierContext) => Result; +} + diff --git a/excel/src/main/java/com/blazebit/expression/excel/ExcelBooleanLiteralRenderer.java b/excel/src/main/java/com/blazebit/expression/excel/ExcelBooleanLiteralRenderer.java new file mode 100644 index 00000000..06f7cd38 --- /dev/null +++ b/excel/src/main/java/com/blazebit/expression/excel/ExcelBooleanLiteralRenderer.java @@ -0,0 +1,43 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.excel; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; + +/** + * @author Christian Beikov + * @since 1.0.0 + */ +public class ExcelBooleanLiteralRenderer implements ExcelLiteralRenderer, Serializable { + + public static final ExcelBooleanLiteralRenderer INSTANCE = new ExcelBooleanLiteralRenderer(); + + private ExcelBooleanLiteralRenderer() { + } + + @Override + public void render(Object value, DomainType domainType, ExcelExpressionSerializer serializer) { + StringBuilder sb = serializer.getStringBuilder(); + if ((boolean) value) { + sb.append("TRUE()"); + } else { + sb.append("FALSE()"); + } + } +} diff --git a/excel/src/main/java/com/blazebit/expression/excel/ExcelContributor.java b/excel/src/main/java/com/blazebit/expression/excel/ExcelContributor.java index 26d4712f..e6a754aa 100644 --- a/excel/src/main/java/com/blazebit/expression/excel/ExcelContributor.java +++ b/excel/src/main/java/com/blazebit/expression/excel/ExcelContributor.java @@ -64,13 +64,14 @@ public class ExcelContributor implements DomainContributor { @Override public void contribute(DomainBuilder domainBuilder) { - domainBuilder.extendBasicType(BaseContributor.INTEGER_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelNumericOperatorRenderer.INSTANCE)); - domainBuilder.extendBasicType(BaseContributor.NUMERIC_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelNumericOperatorRenderer.INSTANCE)); - domainBuilder.extendBasicType(BaseContributor.STRING_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelStringOperatorRenderer.INSTANCE)); - domainBuilder.extendBasicType(BaseContributor.TIMESTAMP_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelTimestampOperatorRenderer.INSTANCE)); - domainBuilder.extendBasicType(BaseContributor.TIME_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelTimeOperatorRenderer.INSTANCE)); - domainBuilder.extendBasicType(BaseContributor.INTERVAL_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelIntervalOperatorRenderer.INSTANCE)); - domainBuilder.extendBasicType(BaseContributor.BOOLEAN_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelDomainOperatorRenderer.SIMPLE)); + domainBuilder.extendBasicType(BaseContributor.INTEGER_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelNumericOperatorRenderer.INSTANCE), new ExcelLiteralRendererMetadataDefinition(ExcelLiteralRenderer.SIMPLE)); + domainBuilder.extendBasicType(BaseContributor.NUMERIC_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelNumericOperatorRenderer.INSTANCE), new ExcelLiteralRendererMetadataDefinition(ExcelLiteralRenderer.SIMPLE)); + domainBuilder.extendBasicType(BaseContributor.STRING_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelStringOperatorRenderer.INSTANCE), new ExcelLiteralRendererMetadataDefinition(ExcelStringLiteralRenderer.INSTANCE)); + domainBuilder.extendBasicType(BaseContributor.TIMESTAMP_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelTimestampOperatorRenderer.INSTANCE), new ExcelLiteralRendererMetadataDefinition(ExcelTimestampLiteralRenderer.INSTANCE)); + domainBuilder.extendBasicType(BaseContributor.TIME_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelTimeOperatorRenderer.INSTANCE), new ExcelLiteralRendererMetadataDefinition(ExcelTimeLiteralRenderer.INSTANCE)); + domainBuilder.extendBasicType(BaseContributor.DATE_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelDateOperatorRenderer.INSTANCE), new ExcelLiteralRendererMetadataDefinition(ExcelDateLiteralRenderer.INSTANCE)); + domainBuilder.extendBasicType(BaseContributor.INTERVAL_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelIntervalOperatorRenderer.INSTANCE), new ExcelLiteralRendererMetadataDefinition(ExcelIntervalLiteralRenderer.INSTANCE)); + domainBuilder.extendBasicType(BaseContributor.BOOLEAN_TYPE_NAME, new ExcelDomainOperatorRendererMetadataDefinition(ExcelDomainOperatorRenderer.SIMPLE), new ExcelLiteralRendererMetadataDefinition(ExcelBooleanLiteralRenderer.INSTANCE)); for (DomainFunctionDefinition functionDefinition : domainBuilder.getFunctions().values()) { Map, MetadataDefinition> metadataDefinitions = functionDefinition.getMetadataDefinitions(); @@ -152,4 +153,32 @@ public ExcelDomainOperatorRenderer build(MetadataDefinitionHolder definitionHold } } + /** + * @author Christian Beikov + * @since 1.0.0 + */ + static class ExcelLiteralRendererMetadataDefinition implements MetadataDefinition { + + private final ExcelLiteralRenderer excelLiteralRenderer; + + /** + * Creates a metadata definition for the given {@link ExcelLiteralRenderer}. + * + * @param excelLiteralRenderer The literal renderer + */ + public ExcelLiteralRendererMetadataDefinition(ExcelLiteralRenderer excelLiteralRenderer) { + this.excelLiteralRenderer = excelLiteralRenderer; + } + + @Override + public Class getJavaType() { + return ExcelLiteralRenderer.class; + } + + @Override + public ExcelLiteralRenderer build(MetadataDefinitionHolder definitionHolder) { + return excelLiteralRenderer; + } + } + } diff --git a/excel/src/main/java/com/blazebit/expression/excel/ExcelDateLiteralRenderer.java b/excel/src/main/java/com/blazebit/expression/excel/ExcelDateLiteralRenderer.java new file mode 100644 index 00000000..6a5566d0 --- /dev/null +++ b/excel/src/main/java/com/blazebit/expression/excel/ExcelDateLiteralRenderer.java @@ -0,0 +1,53 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.excel; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; +import java.time.LocalDate; + +/** + * @author Christian Beikov + * @since 1.0.0 + */ +public class ExcelDateLiteralRenderer implements ExcelLiteralRenderer, Serializable { + + public static final ExcelDateLiteralRenderer INSTANCE = new ExcelDateLiteralRenderer(); + + private ExcelDateLiteralRenderer() { + } + + @Override + public void render(Object value, DomainType domainType, ExcelExpressionSerializer serializer) { + LocalDate localDate = (LocalDate) value; + StringBuilder sb = serializer.getStringBuilder(); + sb.append("DATEVALUE(\""); + sb.append(localDate.getYear()); + sb.append('-'); + if (localDate.getMonthValue() < 10) { + sb.append('0'); + } + sb.append(localDate.getMonthValue()); + sb.append('-'); + if (localDate.getDayOfMonth() < 10) { + sb.append('0'); + } + sb.append(localDate.getDayOfMonth()); + sb.append("\")"); + } +} diff --git a/excel/src/main/java/com/blazebit/expression/excel/ExcelDateOperatorRenderer.java b/excel/src/main/java/com/blazebit/expression/excel/ExcelDateOperatorRenderer.java new file mode 100644 index 00000000..733c0579 --- /dev/null +++ b/excel/src/main/java/com/blazebit/expression/excel/ExcelDateOperatorRenderer.java @@ -0,0 +1,76 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.excel; + +import com.blazebit.domain.runtime.model.DomainOperator; +import com.blazebit.domain.runtime.model.TemporalInterval; +import com.blazebit.expression.ChainingArithmeticExpression; +import com.blazebit.expression.DomainModelException; +import com.blazebit.expression.Expression; +import com.blazebit.expression.Literal; + +import java.io.Serializable; + +/** + * @author Christian Beikov + * @since 1.0.0 + */ +public class ExcelDateOperatorRenderer implements ExcelDomainOperatorRenderer, Serializable { + + public static final ExcelDateOperatorRenderer INSTANCE = new ExcelDateOperatorRenderer(); + + private ExcelDateOperatorRenderer() { + } + + @Override + public boolean render(ChainingArithmeticExpression e, ExcelExpressionSerializer serializer) { + DomainOperator domainOperator = e.getOperator().getDomainOperator(); + if (domainOperator == DomainOperator.PLUS || domainOperator == DomainOperator.MINUS) { + Expression expression = null; + TemporalInterval interval = null; + StringBuilder sb = serializer.getStringBuilder(); + if (e.getLeft() instanceof Literal) { + if (domainOperator == DomainOperator.PLUS) { + expression = e.getRight(); + interval = (TemporalInterval) ((Literal) e.getLeft()).getValue(); + } + } else if (e.getRight() instanceof Literal) { + expression = e.getLeft(); + interval = (TemporalInterval) ((Literal) e.getRight()).getValue(); + } + + if (interval != null) { + boolean isConstant = expression.accept(serializer); + String argumentSeparator = serializer.getArgumentSeparator(); + if (domainOperator == DomainOperator.PLUS) { + sb.append(" + "); + } else { + sb.append(" - "); + } + sb.append("DATE("); + sb.append(interval.getYears()); + sb.append(argumentSeparator).append(' '); + sb.append(interval.getMonths()); + sb.append(argumentSeparator).append(' '); + sb.append(interval.getDays()); + sb.append(")"); + return isConstant; + } + } + throw new DomainModelException("Can't handle the operator " + domainOperator + " for the arguments [" + e.getLeft() + ", " + e.getRight() + "]!"); + } +} diff --git a/excel/src/main/java/com/blazebit/expression/excel/ExcelExpressionSerializer.java b/excel/src/main/java/com/blazebit/expression/excel/ExcelExpressionSerializer.java index 9ff959d9..64d514e0 100644 --- a/excel/src/main/java/com/blazebit/expression/excel/ExcelExpressionSerializer.java +++ b/excel/src/main/java/com/blazebit/expression/excel/ExcelExpressionSerializer.java @@ -215,7 +215,6 @@ public Boolean visit(Literal e) { } private Boolean visitLiteral(Object value, DomainType type) { - // TODO: implement some kind of SPI contract for literal rendering which can be replaced i.e. there should be a default impl that can be replaced if (type.getKind() == DomainType.DomainTypeKind.COLLECTION) { if (interpreterContextForInlining != null) { // This could be a problem if the literal was the root expression, but we assume this is not the case @@ -223,14 +222,9 @@ private Boolean visitLiteral(Object value, DomainType type) { } throw new UnsupportedOperationException("No support for collections in Excel"); } else { - if (value instanceof CharSequence) { - renderStringLiteral((CharSequence) value); - } else if (value instanceof Boolean) { - if ((boolean) value) { - sb.append("TRUE()"); - } else { - sb.append("FALSE()"); - } + ExcelLiteralRenderer literalRenderer = type.getMetadata(ExcelLiteralRenderer.class); + if (literalRenderer != null) { + literalRenderer.render(value, type, this); } else { sb.append(value); } diff --git a/excel/src/main/java/com/blazebit/expression/excel/ExcelIntervalLiteralRenderer.java b/excel/src/main/java/com/blazebit/expression/excel/ExcelIntervalLiteralRenderer.java new file mode 100644 index 00000000..f13c2a5a --- /dev/null +++ b/excel/src/main/java/com/blazebit/expression/excel/ExcelIntervalLiteralRenderer.java @@ -0,0 +1,38 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.excel; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; + +/** + * @author Christian Beikov + * @since 1.0.0 + */ +public class ExcelIntervalLiteralRenderer implements ExcelLiteralRenderer, Serializable { + + public static final ExcelIntervalLiteralRenderer INSTANCE = new ExcelIntervalLiteralRenderer(); + + private ExcelIntervalLiteralRenderer() { + } + + @Override + public void render(Object value, DomainType domainType, ExcelExpressionSerializer serializer) { + throw new UnsupportedOperationException("Not possible to render interval literals. Should be handled by operator renderers!"); + } +} diff --git a/excel/src/main/java/com/blazebit/expression/excel/ExcelLiteralRenderer.java b/excel/src/main/java/com/blazebit/expression/excel/ExcelLiteralRenderer.java new file mode 100644 index 00000000..bafcf10c --- /dev/null +++ b/excel/src/main/java/com/blazebit/expression/excel/ExcelLiteralRenderer.java @@ -0,0 +1,53 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.excel; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; + +/** + * Excel literal metadata. + * + * @author Christian Beikov + * @since 1.0.0 + */ +public interface ExcelLiteralRenderer { + + public static final ExcelLiteralRenderer SIMPLE = new ExcelLiteralRenderer.SimplePersistenceLiteralRenderer(); + + /** + * Renders the literal to the given string builder. + * + * @param value The literal value + * @param domainType The domain type of the literal + * @param serializer The serializer + */ + void render(Object value, DomainType domainType, ExcelExpressionSerializer serializer); + + /** + * + * @author Christian Beikov + * @since 1.0.0 + */ + class SimplePersistenceLiteralRenderer implements ExcelLiteralRenderer, Serializable { + @Override + public void render(Object value, DomainType domainType, ExcelExpressionSerializer serializer) { + serializer.getStringBuilder().append(value); + } + } +} diff --git a/excel/src/main/java/com/blazebit/expression/excel/ExcelStringLiteralRenderer.java b/excel/src/main/java/com/blazebit/expression/excel/ExcelStringLiteralRenderer.java new file mode 100644 index 00000000..a64ddc03 --- /dev/null +++ b/excel/src/main/java/com/blazebit/expression/excel/ExcelStringLiteralRenderer.java @@ -0,0 +1,48 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.excel; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; + +/** + * @author Christian Beikov + * @since 1.0.0 + */ +public class ExcelStringLiteralRenderer implements ExcelLiteralRenderer, Serializable { + + public static final ExcelStringLiteralRenderer INSTANCE = new ExcelStringLiteralRenderer(); + + private ExcelStringLiteralRenderer() { + } + + @Override + public void render(Object value, DomainType domainType, ExcelExpressionSerializer serializer) { + CharSequence charSequence = (CharSequence) value; + StringBuilder sb = serializer.getStringBuilder(); + sb.append('"'); + for (int i = 0; i < charSequence.length(); i++) { + final char c = charSequence.charAt(i); + if (c == '"') { + sb.append('"'); + } + sb.append(c); + } + sb.append('"'); + } +} diff --git a/excel/src/main/java/com/blazebit/expression/excel/ExcelTimeLiteralRenderer.java b/excel/src/main/java/com/blazebit/expression/excel/ExcelTimeLiteralRenderer.java new file mode 100644 index 00000000..f0b715cd --- /dev/null +++ b/excel/src/main/java/com/blazebit/expression/excel/ExcelTimeLiteralRenderer.java @@ -0,0 +1,85 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.excel; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; +import java.time.LocalTime; + +/** + * @author Christian Beikov + * @since 1.0.0 + */ +public class ExcelTimeLiteralRenderer implements ExcelLiteralRenderer, Serializable { + + public static final ExcelTimeLiteralRenderer INSTANCE = new ExcelTimeLiteralRenderer(); + + private ExcelTimeLiteralRenderer() { + } + + @Override + public void render(Object value, DomainType domainType, ExcelExpressionSerializer serializer) { + LocalTime localTime = (LocalTime) value; + StringBuilder sb = serializer.getStringBuilder(); + sb.append("TIMEVALUE(\""); + if (localTime.getHour() < 10) { + sb.append('0'); + } + sb.append(localTime.getHour()); + sb.append(':'); + if (localTime.getMinute() < 10) { + sb.append('0'); + } + sb.append(localTime.getMinute()); + sb.append(':'); + if (localTime.getSecond() < 10) { + sb.append('0'); + } + sb.append(localTime.getSecond()); + int nano = localTime.getNano(); + if (nano != 0L) { + sb.append('.'); + if (nano < 100_000_000) { + sb.append('0'); + if (nano < 10_000_000) { + sb.append('0'); + if (nano < 1_000_000) { + sb.append('0'); + if (nano < 100_000) { + sb.append('0'); + if (nano < 10_000) { + sb.append('0'); + if (nano < 1_000) { + sb.append('0'); + if (nano < 100) { + sb.append('0'); + if (nano < 10) { + sb.append('0'); + } + } + } + } + } + } + } + } + sb.append(nano); + } + sb.append("\")"); + } +} diff --git a/excel/src/main/java/com/blazebit/expression/excel/ExcelTimestampLiteralRenderer.java b/excel/src/main/java/com/blazebit/expression/excel/ExcelTimestampLiteralRenderer.java new file mode 100644 index 00000000..d339ac0b --- /dev/null +++ b/excel/src/main/java/com/blazebit/expression/excel/ExcelTimestampLiteralRenderer.java @@ -0,0 +1,100 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.excel; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * @author Christian Beikov + * @since 1.0.0 + */ +public class ExcelTimestampLiteralRenderer implements ExcelLiteralRenderer, Serializable { + + public static final ExcelTimestampLiteralRenderer INSTANCE = new ExcelTimestampLiteralRenderer(); + + private ExcelTimestampLiteralRenderer() { + } + + @Override + public void render(Object value, DomainType domainType, ExcelExpressionSerializer serializer) { + Instant instant = (Instant) value; + StringBuilder sb = serializer.getStringBuilder(); + OffsetDateTime offsetDateTime = instant.atOffset(ZoneOffset.UTC); + sb.append("VALUE(\""); + sb.append(offsetDateTime.getYear()); + sb.append('-'); + if (offsetDateTime.getMonthValue() < 10) { + sb.append('0'); + } + sb.append(offsetDateTime.getMonthValue()); + sb.append('-'); + if (offsetDateTime.getDayOfMonth() < 10) { + sb.append('0'); + } + sb.append(offsetDateTime.getDayOfMonth()); + sb.append(' '); + if (offsetDateTime.getHour() < 10) { + sb.append('0'); + } + sb.append(offsetDateTime.getHour()); + sb.append(':'); + if (offsetDateTime.getMinute() < 10) { + sb.append('0'); + } + sb.append(offsetDateTime.getMinute()); + sb.append(':'); + if (offsetDateTime.getSecond() < 10) { + sb.append('0'); + } + sb.append(offsetDateTime.getSecond()); + int nano = offsetDateTime.getNano(); + if (nano != 0L) { + sb.append('.'); + if (nano < 100_000_000) { + sb.append('0'); + if (nano < 10_000_000) { + sb.append('0'); + if (nano < 1_000_000) { + sb.append('0'); + if (nano < 100_000) { + sb.append('0'); + if (nano < 10_000) { + sb.append('0'); + if (nano < 1_000) { + sb.append('0'); + if (nano < 100) { + sb.append('0'); + if (nano < 10) { + sb.append('0'); + } + } + } + } + } + } + } + } + sb.append(nano); + } + sb.append("\")"); + } +} diff --git a/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceContributor.java b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceContributor.java index 630844f9..cada0051 100644 --- a/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceContributor.java +++ b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceContributor.java @@ -64,14 +64,14 @@ public class PersistenceContributor implements DomainContributor { @Override public void contribute(DomainBuilder domainBuilder) { - domainBuilder.extendBasicType(BaseContributor.INTEGER_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceDomainOperatorRenderer.SIMPLE)); - domainBuilder.extendBasicType(BaseContributor.NUMERIC_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceDomainOperatorRenderer.SIMPLE)); - domainBuilder.extendBasicType(BaseContributor.STRING_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceStringOperatorRenderer.INSTANCE)); - domainBuilder.extendBasicType(BaseContributor.TIMESTAMP_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceTimestampOperatorRenderer.INSTANCE)); - domainBuilder.extendBasicType(BaseContributor.TIME_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceTimeOperatorRenderer.INSTANCE)); - domainBuilder.extendBasicType(BaseContributor.DATE_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceLocalDateOperatorRenderer.INSTANCE)); - domainBuilder.extendBasicType(BaseContributor.INTERVAL_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceIntervalOperatorRenderer.INSTANCE)); - domainBuilder.extendBasicType(BaseContributor.BOOLEAN_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceDomainOperatorRenderer.SIMPLE)); + domainBuilder.extendBasicType(BaseContributor.INTEGER_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceDomainOperatorRenderer.SIMPLE), new PersistenceLiteralRendererMetadataDefinition(PersistenceLiteralRenderer.SIMPLE)); + domainBuilder.extendBasicType(BaseContributor.NUMERIC_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceDomainOperatorRenderer.SIMPLE), new PersistenceLiteralRendererMetadataDefinition(PersistenceLiteralRenderer.SIMPLE)); + domainBuilder.extendBasicType(BaseContributor.STRING_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceStringOperatorRenderer.INSTANCE), new PersistenceLiteralRendererMetadataDefinition(PersistenceStringLiteralRenderer.INSTANCE)); + domainBuilder.extendBasicType(BaseContributor.TIMESTAMP_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceTimestampOperatorRenderer.INSTANCE), new PersistenceLiteralRendererMetadataDefinition(PersistenceTimestampLiteralRenderer.INSTANCE)); + domainBuilder.extendBasicType(BaseContributor.TIME_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceTimeOperatorRenderer.INSTANCE), new PersistenceLiteralRendererMetadataDefinition(PersistenceTimeLiteralRenderer.INSTANCE)); + domainBuilder.extendBasicType(BaseContributor.DATE_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceDateOperatorRenderer.INSTANCE), new PersistenceLiteralRendererMetadataDefinition(PersistenceDateLiteralRenderer.INSTANCE)); + domainBuilder.extendBasicType(BaseContributor.INTERVAL_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceIntervalOperatorRenderer.INSTANCE), new PersistenceLiteralRendererMetadataDefinition(PersistenceIntervalLiteralRenderer.INSTANCE)); + domainBuilder.extendBasicType(BaseContributor.BOOLEAN_TYPE_NAME, new PersistenceDomainOperatorRendererMetadataDefinition(PersistenceDomainOperatorRenderer.SIMPLE), new PersistenceLiteralRendererMetadataDefinition(PersistenceLiteralRenderer.SIMPLE)); for (DomainFunctionDefinition functionDefinition : domainBuilder.getFunctions().values()) { Map, MetadataDefinition> metadataDefinitions = functionDefinition.getMetadataDefinitions(); @@ -153,4 +153,32 @@ public PersistenceDomainOperatorRenderer build(MetadataDefinitionHolder definiti } } + /** + * @author Christian Beikov + * @since 1.0.0 + */ + static class PersistenceLiteralRendererMetadataDefinition implements MetadataDefinition { + + private final PersistenceLiteralRenderer persistenceLiteralRenderer; + + /** + * Creates a metadata definition for the given {@link PersistenceLiteralRenderer}. + * + * @param persistenceLiteralRenderer The literal renderer + */ + public PersistenceLiteralRendererMetadataDefinition(PersistenceLiteralRenderer persistenceLiteralRenderer) { + this.persistenceLiteralRenderer = persistenceLiteralRenderer; + } + + @Override + public Class getJavaType() { + return PersistenceLiteralRenderer.class; + } + + @Override + public PersistenceLiteralRenderer build(MetadataDefinitionHolder definitionHolder) { + return persistenceLiteralRenderer; + } + } + } diff --git a/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceDateLiteralRenderer.java b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceDateLiteralRenderer.java new file mode 100644 index 00000000..2680d1b0 --- /dev/null +++ b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceDateLiteralRenderer.java @@ -0,0 +1,53 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.persistence; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; +import java.time.LocalDate; + +/** + * @author Christian Beikov + * @since 1.0.0 + */ +public class PersistenceDateLiteralRenderer implements PersistenceLiteralRenderer, Serializable { + + public static final PersistenceDateLiteralRenderer INSTANCE = new PersistenceDateLiteralRenderer(); + + private PersistenceDateLiteralRenderer() { + } + + @Override + public void render(Object value, DomainType domainType, PersistenceExpressionSerializer serializer) { + LocalDate localDate = (LocalDate) value; + StringBuilder sb = serializer.getStringBuilder(); + sb.append("{d '"); + sb.append(localDate.getYear()); + sb.append('-'); + if (localDate.getMonthValue() < 10) { + sb.append('0'); + } + sb.append(localDate.getMonthValue()); + sb.append('-'); + if (localDate.getDayOfMonth() < 10) { + sb.append('0'); + } + sb.append(localDate.getDayOfMonth()); + sb.append("'}"); + } +} diff --git a/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceLocalDateOperatorRenderer.java b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceDateOperatorRenderer.java similarity index 92% rename from persistence/src/main/java/com/blazebit/expression/persistence/PersistenceLocalDateOperatorRenderer.java rename to persistence/src/main/java/com/blazebit/expression/persistence/PersistenceDateOperatorRenderer.java index c0626297..7c2aae81 100644 --- a/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceLocalDateOperatorRenderer.java +++ b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceDateOperatorRenderer.java @@ -29,11 +29,11 @@ * @author Yevhen Tucha * @since 1.0.0 */ -public class PersistenceLocalDateOperatorRenderer implements PersistenceDomainOperatorRenderer, Serializable { +public class PersistenceDateOperatorRenderer implements PersistenceDomainOperatorRenderer, Serializable { - public static final PersistenceLocalDateOperatorRenderer INSTANCE = new PersistenceLocalDateOperatorRenderer(); + public static final PersistenceDateOperatorRenderer INSTANCE = new PersistenceDateOperatorRenderer(); - private PersistenceLocalDateOperatorRenderer() { + private PersistenceDateOperatorRenderer() { } @Override diff --git a/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceExpressionSerializer.java b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceExpressionSerializer.java index 291a8c55..ef6df310 100644 --- a/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceExpressionSerializer.java +++ b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceExpressionSerializer.java @@ -258,7 +258,6 @@ public Boolean visit(FunctionInvocation e) { @Override public Boolean visit(Literal e) { - // TODO: implement some kind of SPI contract for literal rendering which can be replaced i.e. there should be a default impl that can be replaced if (e.getType().getKind() == DomainType.DomainTypeKind.COLLECTION) { @SuppressWarnings("unchecked") Collection expressions = (Collection) e.getValue(); @@ -271,17 +270,9 @@ public Boolean visit(Literal e) { } } else { Object value = e.getValue(); - if (value instanceof CharSequence) { - sb.append('\''); - CharSequence charSequence = (CharSequence) value; - for (int i = 0; i < charSequence.length(); i++) { - final char c = charSequence.charAt(i); - if (c == '\'') { - sb.append('\''); - } - sb.append(c); - } - sb.append('\''); + PersistenceLiteralRenderer literalRenderer = e.getType().getMetadata(PersistenceLiteralRenderer.class); + if (literalRenderer != null) { + literalRenderer.render(value, e.getType(), this); } else { sb.append(value); } diff --git a/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceIntervalLiteralRenderer.java b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceIntervalLiteralRenderer.java new file mode 100644 index 00000000..db7da8c3 --- /dev/null +++ b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceIntervalLiteralRenderer.java @@ -0,0 +1,38 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.persistence; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; + +/** + * @author Christian Beikov + * @since 1.0.0 + */ +public class PersistenceIntervalLiteralRenderer implements PersistenceLiteralRenderer, Serializable { + + public static final PersistenceIntervalLiteralRenderer INSTANCE = new PersistenceIntervalLiteralRenderer(); + + private PersistenceIntervalLiteralRenderer() { + } + + @Override + public void render(Object value, DomainType domainType, PersistenceExpressionSerializer serializer) { + throw new UnsupportedOperationException("Not possible to render interval literals. Should be handled by operator renderers!"); + } +} diff --git a/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceLiteralRenderer.java b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceLiteralRenderer.java new file mode 100644 index 00000000..c1e400c9 --- /dev/null +++ b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceLiteralRenderer.java @@ -0,0 +1,52 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.persistence; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; + +/** + * JPQL.next literal metadata. + * + * @author Christian Beikov + * @since 1.0.0 + */ +public interface PersistenceLiteralRenderer { + + public static final PersistenceLiteralRenderer SIMPLE = new PersistenceLiteralRenderer.SimplePersistenceLiteralRenderer(); + + /** + * Renders the literal to the given string builder. + * @param value The literal value + * @param domainType The domain type of the literal + * @param serializer The serializer + */ + void render(Object value, DomainType domainType, PersistenceExpressionSerializer serializer); + + /** + * + * @author Christian Beikov + * @since 1.0.0 + */ + class SimplePersistenceLiteralRenderer implements PersistenceLiteralRenderer, Serializable { + @Override + public void render(Object value, DomainType domainType, PersistenceExpressionSerializer serializer) { + serializer.getStringBuilder().append(value); + } + } +} diff --git a/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceStringLiteralRenderer.java b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceStringLiteralRenderer.java new file mode 100644 index 00000000..0ba64072 --- /dev/null +++ b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceStringLiteralRenderer.java @@ -0,0 +1,48 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.persistence; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; + +/** + * @author Christian Beikov + * @since 1.0.0 + */ +public class PersistenceStringLiteralRenderer implements PersistenceLiteralRenderer, Serializable { + + public static final PersistenceStringLiteralRenderer INSTANCE = new PersistenceStringLiteralRenderer(); + + private PersistenceStringLiteralRenderer() { + } + + @Override + public void render(Object value, DomainType domainType, PersistenceExpressionSerializer serializer) { + CharSequence charSequence = (CharSequence) value; + StringBuilder sb = serializer.getStringBuilder(); + sb.append('\''); + for (int i = 0; i < charSequence.length(); i++) { + final char c = charSequence.charAt(i); + if (c == '\'') { + sb.append('\''); + } + sb.append(c); + } + sb.append('\''); + } +} diff --git a/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceTimeLiteralRenderer.java b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceTimeLiteralRenderer.java new file mode 100644 index 00000000..9b60fe90 --- /dev/null +++ b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceTimeLiteralRenderer.java @@ -0,0 +1,85 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.persistence; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; +import java.time.LocalTime; + +/** + * @author Christian Beikov + * @since 1.0.0 + */ +public class PersistenceTimeLiteralRenderer implements PersistenceLiteralRenderer, Serializable { + + public static final PersistenceTimeLiteralRenderer INSTANCE = new PersistenceTimeLiteralRenderer(); + + private PersistenceTimeLiteralRenderer() { + } + + @Override + public void render(Object value, DomainType domainType, PersistenceExpressionSerializer serializer) { + LocalTime localTime = (LocalTime) value; + StringBuilder sb = serializer.getStringBuilder(); + sb.append("{t '"); + if (localTime.getHour() < 10) { + sb.append('0'); + } + sb.append(localTime.getHour()); + sb.append(':'); + if (localTime.getMinute() < 10) { + sb.append('0'); + } + sb.append(localTime.getMinute()); + sb.append(':'); + if (localTime.getSecond() < 10) { + sb.append('0'); + } + sb.append(localTime.getSecond()); + int nano = localTime.getNano(); + if (nano != 0L) { + sb.append('.'); + if (nano < 100_000_000) { + sb.append('0'); + if (nano < 10_000_000) { + sb.append('0'); + if (nano < 1_000_000) { + sb.append('0'); + if (nano < 100_000) { + sb.append('0'); + if (nano < 10_000) { + sb.append('0'); + if (nano < 1_000) { + sb.append('0'); + if (nano < 100) { + sb.append('0'); + if (nano < 10) { + sb.append('0'); + } + } + } + } + } + } + } + } + sb.append(nano); + } + sb.append("'}"); + } +} diff --git a/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceTimestampLiteralRenderer.java b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceTimestampLiteralRenderer.java new file mode 100644 index 00000000..622b951f --- /dev/null +++ b/persistence/src/main/java/com/blazebit/expression/persistence/PersistenceTimestampLiteralRenderer.java @@ -0,0 +1,100 @@ +/* + * Copyright 2019 - 2022 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.expression.persistence; + +import com.blazebit.domain.runtime.model.DomainType; + +import java.io.Serializable; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * @author Christian Beikov + * @since 1.0.0 + */ +public class PersistenceTimestampLiteralRenderer implements PersistenceLiteralRenderer, Serializable { + + public static final PersistenceTimestampLiteralRenderer INSTANCE = new PersistenceTimestampLiteralRenderer(); + + private PersistenceTimestampLiteralRenderer() { + } + + @Override + public void render(Object value, DomainType domainType, PersistenceExpressionSerializer serializer) { + Instant instant = (Instant) value; + StringBuilder sb = serializer.getStringBuilder(); + OffsetDateTime offsetDateTime = instant.atOffset(ZoneOffset.UTC); + sb.append("{ts '"); + sb.append(offsetDateTime.getYear()); + sb.append('-'); + if (offsetDateTime.getMonthValue() < 10) { + sb.append('0'); + } + sb.append(offsetDateTime.getMonthValue()); + sb.append('-'); + if (offsetDateTime.getDayOfMonth() < 10) { + sb.append('0'); + } + sb.append(offsetDateTime.getDayOfMonth()); + sb.append(' '); + if (offsetDateTime.getHour() < 10) { + sb.append('0'); + } + sb.append(offsetDateTime.getHour()); + sb.append(':'); + if (offsetDateTime.getMinute() < 10) { + sb.append('0'); + } + sb.append(offsetDateTime.getMinute()); + sb.append(':'); + if (offsetDateTime.getSecond() < 10) { + sb.append('0'); + } + sb.append(offsetDateTime.getSecond()); + int nano = offsetDateTime.getNano(); + if (nano != 0L) { + sb.append('.'); + if (nano < 100_000_000) { + sb.append('0'); + if (nano < 10_000_000) { + sb.append('0'); + if (nano < 1_000_000) { + sb.append('0'); + if (nano < 100_000) { + sb.append('0'); + if (nano < 10_000) { + sb.append('0'); + if (nano < 1_000) { + sb.append('0'); + if (nano < 100) { + sb.append('0'); + if (nano < 10) { + sb.append('0'); + } + } + } + } + } + } + } + } + sb.append(nano); + } + sb.append("'}"); + } +}