diff --git a/oap-formats/oap-logstream/oap-logstream-test/pom.xml b/oap-formats/oap-logstream/oap-logstream-test/pom.xml
index fb8cbef5a..171a90764 100644
--- a/oap-formats/oap-logstream/oap-logstream-test/pom.xml
+++ b/oap-formats/oap-logstream/oap-logstream-test/pom.xml
@@ -39,6 +39,11 @@
oap-stdlib-test
${project.version}
+
+ oap
+ oap-template-test
+ ${project.version}
+
org.apache.commons
commons-csv
diff --git a/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/LoggerJsonTest.java b/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/LoggerJsonTest.java
index c26a943c8..b0950c895 100644
--- a/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/LoggerJsonTest.java
+++ b/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/LoggerJsonTest.java
@@ -29,6 +29,7 @@
import oap.json.Binder;
import oap.logstream.disk.DiskLoggerBackend;
import oap.logstream.formats.rowbinary.RowBinaryUtils;
+import oap.template.TemplateEngineFixture;
import oap.template.Types;
import oap.testng.Fixtures;
import oap.testng.TestDirectoryFixture;
@@ -49,9 +50,11 @@
public class LoggerJsonTest extends Fixtures {
private final TestDirectoryFixture testDirectoryFixture;
+ private final TemplateEngineFixture templateEngineFixture;
public LoggerJsonTest() {
testDirectoryFixture = fixture( new TestDirectoryFixture() );
+ templateEngineFixture = fixture( new TemplateEngineFixture() );
}
@Test
@@ -61,7 +64,7 @@ public void diskJSON() throws IOException {
String content = "{\"title\":\"response\",\"status\":false,\"values\":[1,2,3]}";
String[] headers = new String[] { "test" };
byte[][] types = new byte[][] { new byte[] { Types.STRING.id } };
- try( DiskLoggerBackend backend = new DiskLoggerBackend( testDirectoryFixture.testPath( "logs" ), BPH_12, DEFAULT_BUFFER, "localhost" ) ) {
+ try( DiskLoggerBackend backend = new DiskLoggerBackend( templateEngineFixture.templateEngine, testDirectoryFixture.testPath( "logs" ), BPH_12, DEFAULT_BUFFER, "localhost" ) ) {
Logger logger = new Logger( backend );
SimpleJson o = contentOfTestResource( getClass(), "simple_json.json", ofJson( SimpleJson.class ) );
diff --git a/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/LoggerTest.java b/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/LoggerTest.java
index f384866c2..0f220d099 100644
--- a/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/LoggerTest.java
+++ b/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/LoggerTest.java
@@ -33,6 +33,7 @@
import oap.logstream.net.server.SocketLoggerServer;
import oap.message.client.MessageSender;
import oap.message.server.MessageHttpHandler;
+import oap.template.TemplateEngineFixture;
import oap.template.Types;
import oap.testng.Fixtures;
import oap.testng.Ports;
@@ -61,9 +62,11 @@
@Slf4j
public class LoggerTest extends Fixtures {
private final TestDirectoryFixture testDirectoryFixture;
+ private final TemplateEngineFixture templateEngineFixture;
public LoggerTest() {
testDirectoryFixture = fixture( new TestDirectoryFixture() );
+ templateEngineFixture = fixture( new TemplateEngineFixture() );
}
@Test
@@ -78,7 +81,7 @@ public void disk() throws IOException {
byte[] line2 = Compression.gzip( RowBinaryUtils.line( lineData2 ) );
String[] headers2 = new String[] { "TIMESTAMP", "REQUEST_ID2" };
byte[][] types2 = new byte[][] { new byte[] { Types.DATETIME.id }, new byte[] { Types.STRING.id } };
- try( DiskLoggerBackend backend = new DiskLoggerBackend( testDirectoryFixture.testPath( "logs" ), BPH_12, DEFAULT_BUFFER, "localhost" ) ) {
+ try( DiskLoggerBackend backend = new DiskLoggerBackend( templateEngineFixture.templateEngine, testDirectoryFixture.testPath( "logs" ), BPH_12, DEFAULT_BUFFER, "localhost" ) ) {
Logger logger = new Logger( backend );
logger.log( "lfn1", Map.of(), "log", headers1, types1, line1 );
logger.log( "lfn2", Map.of(), "log", headers1, types1, line1 );
@@ -114,7 +117,7 @@ public void net() throws IOException {
String[] headers2 = new String[] { "TIMESTAMP", "REQUEST_ID2" };
byte[][] types2 = new byte[][] { new byte[] { Types.DATETIME.id }, new byte[] { Types.STRING.id } };
- try( DiskLoggerBackend serverBackend = new DiskLoggerBackend( testDirectoryFixture.testPath( "logs" ), BPH_12, DEFAULT_BUFFER, "localhost" );
+ try( DiskLoggerBackend serverBackend = new DiskLoggerBackend( templateEngineFixture.templateEngine, testDirectoryFixture.testPath( "logs" ), BPH_12, DEFAULT_BUFFER, "localhost" );
SocketLoggerServer server = new SocketLoggerServer( serverBackend );
NioHttpServer mServer = new NioHttpServer( new NioHttpServer.DefaultPort( port ) );
MessageHttpHandler messageHttpHandler = new MessageHttpHandler( mServer, "/messages", controlStatePath, List.of( server ), -1 );
diff --git a/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/disk/AbstractWriterTest.java b/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/disk/AbstractWriterTest.java
index f5479a381..aa2980531 100644
--- a/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/disk/AbstractWriterTest.java
+++ b/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/disk/AbstractWriterTest.java
@@ -26,7 +26,9 @@
import oap.logstream.LogId;
import oap.logstream.Timestamp;
+import oap.template.TemplateEngineFixture;
import oap.template.Types;
+import oap.testng.Fixtures;
import oap.util.Dates;
import org.testng.annotations.Test;
@@ -34,7 +36,13 @@
import static org.assertj.core.api.Assertions.assertThat;
-public class AbstractWriterTest {
+public class AbstractWriterTest extends Fixtures {
+ private final TemplateEngineFixture templateEngineFixture;
+
+ public AbstractWriterTest() {
+ templateEngineFixture = fixture( new TemplateEngineFixture() );
+ }
+
@Test
public void testFileName() {
String[] h1Headers = new String[] { "h1" };
@@ -44,15 +52,15 @@ public void testFileName() {
Dates.setTimeFixed( 2023, 1, 23, 21, 6, 0 );
- assertThat( AbstractWriter.currentPattern( LogFormat.TSV_GZ, "${LOG_FORMAT_TSV_GZ}-${INTERVAL} -${LOG_VERSION}-#{if}(${ORGANIZATION})${ORGANIZATION}#{else}UNKNOWN#{end}.${LOG_FORMAT}", lid1, Timestamp.BPH_12, 1, Dates.nowUtc(), "localhost" ) )
+ assertThat( AbstractWriter.currentPattern( templateEngineFixture.templateEngine, LogFormat.TSV_GZ, "{{ LOG_FORMAT_TSV_GZ }}-{{ INTERVAL }}-{{ LOG_VERSION }}-{{% if ORGANIZATION }}{{ ORGANIZATION }}{{% else }}UNKNOWN{{% end }}.{{ LOG_FORMAT }}", lid1, Timestamp.BPH_12, 1, Dates.nowUtc(), "localhost" ) )
.isEqualTo( "ln/tsv.gz-01-855943970-1-UNKNOWN.tsv.gz.rb.gz" );
- assertThat( AbstractWriter.currentPattern( LogFormat.TSV_GZ, "${INTERVAL}-${LOG_VERSION}-${ORGANIZATION}.${LOG_FORMAT}", lid1, Timestamp.BPH_12, 1, Dates.nowUtc(), "localhost" ) )
+ assertThat( AbstractWriter.currentPattern( templateEngineFixture.templateEngine, LogFormat.TSV_GZ, "{{ INTERVAL }}-{{ LOG_VERSION }}-{{ ORGANIZATION }}.{{ LOG_FORMAT }}", lid1, Timestamp.BPH_12, 1, Dates.nowUtc(), "localhost" ) )
.isEqualTo( "ln/01-855943970-1-.tsv.gz.rb.gz" );
- assertThat( AbstractWriter.currentPattern( LogFormat.TSV_GZ, "${INTERVAL}-${LOG_VERSION}-${ORGANIZATION}.${LOG_FORMAT}", lid1, Timestamp.BPH_12, 1, Dates.nowUtc(), "localhost" ) )
+ assertThat( AbstractWriter.currentPattern( templateEngineFixture.templateEngine, LogFormat.TSV_GZ, "{{ INTERVAL }}-{{ LOG_VERSION}}-{{ ORGANIZATION }}.{{ LOG_FORMAT }}", lid1, Timestamp.BPH_12, 1, Dates.nowUtc(), "localhost" ) )
.isEqualTo( "ln/01-855943970-1-.tsv.gz.rb.gz" );
- assertThat( AbstractWriter.currentPattern( LogFormat.TSV_GZ, "${LOG_TIME_INTERVAL}.log.gz", lid1, Timestamp.BPH_6, 1, Dates.nowUtc(), "localhost" ) )
+ assertThat( AbstractWriter.currentPattern( templateEngineFixture.templateEngine, LogFormat.TSV_GZ, "{{ LOG_TIME_INTERVAL }}.log.gz", lid1, Timestamp.BPH_6, 1, Dates.nowUtc(), "localhost" ) )
.isEqualTo( "ln/10.log.gz.rb.gz" );
}
@@ -64,11 +72,11 @@ public void testFileNameConditional() {
Dates.setTimeFixed( 2023, 1, 23, 21, 6, 0 );
LogId lid1 = new LogId( "ln", "lt", "chn", Map.of(), h1Headers, strTypes );
- assertThat( AbstractWriter.currentPattern( LogFormat.TSV_GZ, "#{if}(${ORGANIZATION}&&${ACCOUNT})${ORGANIZATION}/${ACCOUNT}/#{end}${INTERVAL}-${LOG_VERSION}.${LOG_FORMAT}", lid1, Timestamp.BPH_12, 1, Dates.nowUtc(), "localhost" ) )
+ assertThat( AbstractWriter.currentPattern( templateEngineFixture.templateEngine, LogFormat.TSV_GZ, "{{% if ORGANIZATION and ACCOUNT }}{{ ORGANIZATION }}/{{ ACCOUNT }}/{{% end }}{{ INTERVAL }}-{{ LOG_VERSION }}.{{ LOG_FORMAT }}", lid1, Timestamp.BPH_12, 1, Dates.nowUtc(), "localhost" ) )
.isEqualTo( "ln/01-855943970-1.tsv.gz.rb.gz" );
lid1 = new LogId( "ln", "lt", "chn", Map.of( "ORGANIZATION", "org1", "ACCOUNT", "acc1" ), h1Headers, strTypes );
- assertThat( AbstractWriter.currentPattern( LogFormat.PARQUET, "#{if}(${ORGANIZATION}&&${ACCOUNT})${ORGANIZATION}/${ACCOUNT}/#{end}${INTERVAL}-${LOG_VERSION}.${LOG_FORMAT}", lid1, Timestamp.BPH_12, 1, Dates.nowUtc(), "localhost" ) )
+ assertThat( AbstractWriter.currentPattern( templateEngineFixture.templateEngine, LogFormat.PARQUET, "{{% if ORGANIZATION and ACCOUNT }}{{ ORGANIZATION }}/{{ ACCOUNT }}/{{% end }}{{ INTERVAL }}-{{ LOG_VERSION }}.{{ LOG_FORMAT }}", lid1, Timestamp.BPH_12, 1, Dates.nowUtc(), "localhost" ) )
.isEqualTo( "ln/org1/acc1/01-855943970-1.parquet.rb.gz" );
}
}
diff --git a/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/disk/DiskLoggerBackendTest.java b/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/disk/DiskLoggerBackendTest.java
index f64557bcc..aca4bb8f3 100644
--- a/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/disk/DiskLoggerBackendTest.java
+++ b/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/disk/DiskLoggerBackendTest.java
@@ -28,6 +28,7 @@
import oap.logstream.Logger;
import oap.logstream.Timestamp;
import oap.logstream.formats.rowbinary.RowBinaryUtils;
+import oap.template.TemplateEngineFixture;
import oap.template.Types;
import oap.testng.Fixtures;
import oap.testng.TestDirectoryFixture;
@@ -48,14 +49,16 @@
public class DiskLoggerBackendTest extends Fixtures {
private final TestDirectoryFixture testDirectoryFixture;
+ private final TemplateEngineFixture templateEngineFixture;
public DiskLoggerBackendTest() {
testDirectoryFixture = fixture( new TestDirectoryFixture() );
+ templateEngineFixture = fixture( new TemplateEngineFixture() );
}
@Test
public void spaceAvailable() {
- try( DiskLoggerBackend backend = new DiskLoggerBackend( testDirectoryFixture.testPath( "logs" ), Timestamp.BPH_12, 4000, "localhost" ) ) {
+ try( DiskLoggerBackend backend = new DiskLoggerBackend( templateEngineFixture.templateEngine, testDirectoryFixture.testPath( "logs" ), Timestamp.BPH_12, 4000, "localhost" ) ) {
backend.start();
assertTrue( backend.isLoggingAvailable() );
@@ -73,7 +76,7 @@ public void testPatternByType() throws IOException {
byte[][] types = new byte[][] { new byte[] { Types.STRING.id }, new byte[] { Types.STRING.id } };
byte[] lines = Compression.gzip( RowBinaryUtils.lines( List.of( List.of( "12345678", "rrrr5678" ), List.of( "1", "2" ) ) ) );
- try( DiskLoggerBackend backend = new DiskLoggerBackend( testDirectoryFixture.testPath( "logs" ), Timestamp.BPH_12, 4000, "localhost" ) ) {
+ try( DiskLoggerBackend backend = new DiskLoggerBackend( templateEngineFixture.templateEngine, testDirectoryFixture.testPath( "logs" ), Timestamp.BPH_12, 4000, "localhost" ) ) {
backend.filePattern = "${LOG_TYPE}_${LOG_VERSION}_${INTERVAL}.tsv.gz";
backend.filePatternByType.put( "LOG_TYPE_WITH_DIFFERENT_FILE_PATTERN",
new DiskLoggerBackend.FilePatternConfiguration( "${LOG_TYPE}_${LOG_VERSION}_${MINUTE}.parquet" ) );
@@ -106,7 +109,7 @@ public void testWriteSync() throws IOException {
byte[][] types = new byte[][] { new byte[] { Types.STRING.id }, new byte[] { Types.STRING.id } };
byte[] lines = Compression.gzip( RowBinaryUtils.lines( List.of( List.of( "12345678", "rrrr5678" ), List.of( "1", "2" ) ) ) );
//init new logger
- try( DiskLoggerBackend backend = new DiskLoggerBackend( testDirectoryFixture.testPath( "logs" ), BPH_12, DEFAULT_BUFFER, "localhost" ) ) {
+ try( DiskLoggerBackend backend = new DiskLoggerBackend( templateEngineFixture.templateEngine, testDirectoryFixture.testPath( "logs" ), BPH_12, DEFAULT_BUFFER, "localhost" ) ) {
backend.start();
Logger logger = new Logger( backend );
diff --git a/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/disk/RowBinaryWriterTest.java b/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/disk/RowBinaryWriterTest.java
index a2c89452c..5081b760e 100644
--- a/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/disk/RowBinaryWriterTest.java
+++ b/oap-formats/oap-logstream/oap-logstream-test/src/test/java/oap/logstream/disk/RowBinaryWriterTest.java
@@ -27,6 +27,7 @@
import oap.compression.Compression;
import oap.logstream.LogId;
import oap.logstream.formats.rowbinary.RowBinaryUtils;
+import oap.template.TemplateEngineFixture;
import oap.template.Types;
import oap.testng.Fixtures;
import oap.testng.TestDirectoryFixture;
@@ -49,9 +50,11 @@
public class RowBinaryWriterTest extends Fixtures {
private static final String FILE_PATTERN = "${p}-file-${INTERVAL}-${LOG_VERSION}.rb.gz";
private final TestDirectoryFixture testDirectoryFixture;
+ private final TemplateEngineFixture templateEngineFixture;
public RowBinaryWriterTest() {
testDirectoryFixture = fixture( new TestDirectoryFixture() );
+ templateEngineFixture = fixture( new TemplateEngineFixture() );
}
@Test
@@ -78,7 +81,7 @@ public void testWrite() throws IOException {
LogId logId = new LogId( "", "log", "log",
Map.of( "p", "1" ), headers, types );
Path logs = testDirectoryFixture.testPath( "logs" );
- try( RowBinaryWriter writer = new RowBinaryWriter( logs, FILE_PATTERN, logId, 1024, BPH_12, 20, "localhost" ) ) {
+ try( RowBinaryWriter writer = new RowBinaryWriter( templateEngineFixture.templateEngine, logs, FILE_PATTERN, logId, 1024, BPH_12, 20, "localhost" ) ) {
writer.write( CURRENT_PROTOCOL_VERSION, content1 );
writer.write( CURRENT_PROTOCOL_VERSION, content2 );
}
diff --git a/oap-formats/oap-logstream/oap-logstream/src/main/java/oap/logstream/LogIdTemplate.java b/oap-formats/oap-logstream/oap-logstream/src/main/java/oap/logstream/LogIdTemplate.java
index 0eeb0e683..ce4cf3991 100644
--- a/oap-formats/oap-logstream/oap-logstream/src/main/java/oap/logstream/LogIdTemplate.java
+++ b/oap-formats/oap-logstream/oap-logstream/src/main/java/oap/logstream/LogIdTemplate.java
@@ -24,17 +24,13 @@
package oap.logstream;
-import oap.io.Closeables;
import oap.kubernetes.ReplicaUtils;
import oap.net.Inet;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.app.event.EventCartridge;
-import org.apache.velocity.app.event.ReferenceInsertionEventHandler;
-import org.apache.velocity.context.Context;
+import oap.reflect.TypeRef;
+import oap.template.TemplateAccumulators;
+import oap.template.TemplateEngine;
import org.joda.time.DateTime;
-import java.io.StringWriter;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -45,8 +41,6 @@
* @see oap.logstream.disk.AbstractWriter
*/
public class LogIdTemplate {
- private final VelocityEngine engine = new VelocityEngine();
-
private final LogId logId;
private final LinkedHashMap variables = new LinkedHashMap<>();
@@ -66,29 +60,16 @@ public LogIdTemplate addVariables( Map variables ) {
return this;
}
- public String render( String template, DateTime time, Timestamp timestamp, int version, String hostname ) {
- VelocityContext context = new VelocityContext();
- EventCartridge eventCartridge = new EventCartridge();
- context.attachEventCartridge( eventCartridge );
- eventCartridge.addReferenceInsertionEventHandler( new ReferenceInsertionEventHandler() {
- @Override
- public Object referenceInsert( Context context, String s, Object o ) {
- return o == null ? "" : o;
- }
- } );
-
+ public String render( TemplateEngine templateEngine, String template, DateTime time, Timestamp timestamp, int version, String hostname ) {
+ LinkedHashMap context = new LinkedHashMap<>();
init( context, time, timestamp, version, hostname );
- variables.forEach( context::put );
-
- StringWriter writer = new StringWriter();
- engine.evaluate( context, writer, "log-id-template", template );
- Closeables.close( writer );
+ context.putAll( variables );
- return writer.toString();
+ return templateEngine.getRuntimeTemplate( "LogIdTemplate", new TypeRef
*/
@Override public void exitIfCondition(TemplateGrammarExpression.IfConditionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterConditionOr(TemplateGrammarExpression.ConditionOrContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitConditionOr(TemplateGrammarExpression.ConditionOrContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterConditionAnd(TemplateGrammarExpression.ConditionAndContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitConditionAnd(TemplateGrammarExpression.ConditionAndContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterConditionNot(TemplateGrammarExpression.ConditionNotContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitConditionNot(TemplateGrammarExpression.ConditionNotContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterConditionAtom(TemplateGrammarExpression.ConditionAtomContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitConditionAtom(TemplateGrammarExpression.ConditionAtomContext ctx) { }
/**
* {@inheritDoc}
*
diff --git a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammarExpressionListener.java b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammarExpressionListener.java
index 0b477ccbb..5025a8dd4 100644
--- a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammarExpressionListener.java
+++ b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammarExpressionListener.java
@@ -5,6 +5,11 @@
import oap.template.tree.*;
import oap.template.tree.Math;
import oap.template.tree.WithCondition;
+import oap.template.tree.ConditionExpr;
+import oap.template.tree.FieldConditionExpr;
+import oap.template.tree.AndConditionExpr;
+import oap.template.tree.OrConditionExpr;
+import oap.template.tree.NotConditionExpr;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -71,6 +76,46 @@ public interface TemplateGrammarExpressionListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitIfCondition(TemplateGrammarExpression.IfConditionContext ctx);
+ /**
+ * Enter a parse tree produced by {@link TemplateGrammarExpression#conditionOr}.
+ * @param ctx the parse tree
+ */
+ void enterConditionOr(TemplateGrammarExpression.ConditionOrContext ctx);
+ /**
+ * Exit a parse tree produced by {@link TemplateGrammarExpression#conditionOr}.
+ * @param ctx the parse tree
+ */
+ void exitConditionOr(TemplateGrammarExpression.ConditionOrContext ctx);
+ /**
+ * Enter a parse tree produced by {@link TemplateGrammarExpression#conditionAnd}.
+ * @param ctx the parse tree
+ */
+ void enterConditionAnd(TemplateGrammarExpression.ConditionAndContext ctx);
+ /**
+ * Exit a parse tree produced by {@link TemplateGrammarExpression#conditionAnd}.
+ * @param ctx the parse tree
+ */
+ void exitConditionAnd(TemplateGrammarExpression.ConditionAndContext ctx);
+ /**
+ * Enter a parse tree produced by {@link TemplateGrammarExpression#conditionNot}.
+ * @param ctx the parse tree
+ */
+ void enterConditionNot(TemplateGrammarExpression.ConditionNotContext ctx);
+ /**
+ * Exit a parse tree produced by {@link TemplateGrammarExpression#conditionNot}.
+ * @param ctx the parse tree
+ */
+ void exitConditionNot(TemplateGrammarExpression.ConditionNotContext ctx);
+ /**
+ * Enter a parse tree produced by {@link TemplateGrammarExpression#conditionAtom}.
+ * @param ctx the parse tree
+ */
+ void enterConditionAtom(TemplateGrammarExpression.ConditionAtomContext ctx);
+ /**
+ * Exit a parse tree produced by {@link TemplateGrammarExpression#conditionAtom}.
+ * @param ctx the parse tree
+ */
+ void exitConditionAtom(TemplateGrammarExpression.ConditionAtomContext ctx);
/**
* Enter a parse tree produced by {@link TemplateGrammarExpression#defaultValue}.
* @param ctx the parse tree
diff --git a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexerExpression.interp b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexerExpression.interp
index 17ea4c3aa..65c51daa6 100644
--- a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexerExpression.interp
+++ b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexerExpression.interp
@@ -6,6 +6,10 @@ null
'else'
'end'
'with'
+'and'
+'or'
+'not'
+'!'
null
'$'
null
@@ -46,6 +50,10 @@ THEN
ELSE
END
WITH
+AND
+OR
+NOT
+BANG
VAR_ID
ROOT
BLOCK_COMMENT
@@ -122,6 +130,10 @@ THEN
ELSE
END
WITH
+AND
+OR
+NOT
+BANG
VAR_ID
ROOT
BLOCK_COMMENT
@@ -172,4 +184,4 @@ DEFAULT_MODE
Concatenation
atn:
-[4, 0, 37, 496, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 1, 0, 1, 0, 3, 0, 171, 8, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 181, 8, 3, 10, 3, 12, 3, 184, 9, 3, 1, 3, 1, 3, 1, 3, 3, 3, 189, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 3, 25, 243, 8, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 3, 26, 250, 8, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 3, 27, 257, 8, 27, 3, 27, 259, 8, 27, 3, 27, 261, 8, 27, 3, 27, 263, 8, 27, 1, 28, 1, 28, 1, 28, 5, 28, 268, 8, 28, 10, 28, 12, 28, 271, 9, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 5, 29, 278, 8, 29, 10, 29, 12, 29, 281, 9, 29, 1, 29, 1, 29, 1, 30, 1, 30, 3, 30, 287, 8, 30, 1, 31, 1, 31, 1, 32, 1, 32, 1, 33, 4, 33, 294, 8, 33, 11, 33, 12, 33, 295, 1, 34, 1, 34, 1, 34, 3, 34, 301, 8, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 5, 37, 316, 8, 37, 10, 37, 12, 37, 319, 9, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 5, 43, 349, 8, 43, 10, 43, 12, 43, 352, 9, 43, 1, 44, 1, 44, 1, 45, 1, 45, 1, 46, 4, 46, 359, 8, 46, 11, 46, 12, 46, 360, 1, 46, 1, 46, 1, 47, 4, 47, 366, 8, 47, 11, 47, 12, 47, 367, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 51, 1, 51, 1, 52, 1, 52, 1, 53, 1, 53, 1, 54, 1, 54, 1, 55, 1, 55, 1, 56, 1, 56, 1, 57, 1, 57, 1, 58, 1, 58, 1, 59, 1, 59, 1, 60, 1, 60, 1, 61, 1, 61, 1, 62, 1, 62, 1, 63, 1, 63, 1, 64, 1, 64, 1, 65, 1, 65, 1, 66, 1, 66, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 5, 68, 419, 8, 68, 10, 68, 12, 68, 422, 9, 68, 1, 69, 1, 69, 1, 69, 4, 69, 427, 8, 69, 11, 69, 12, 69, 428, 1, 69, 3, 69, 432, 8, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 72, 1, 72, 1, 73, 4, 73, 445, 8, 73, 11, 73, 12, 73, 446, 1, 73, 1, 73, 1, 74, 4, 74, 452, 8, 74, 11, 74, 12, 74, 453, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 5, 77, 470, 8, 77, 10, 77, 12, 77, 473, 9, 77, 1, 77, 1, 77, 1, 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 182, 0, 83, 2, 0, 4, 0, 6, 0, 8, 0, 10, 0, 12, 0, 14, 0, 16, 0, 18, 0, 20, 0, 22, 0, 24, 0, 26, 0, 28, 0, 30, 0, 32, 0, 34, 0, 36, 0, 38, 0, 40, 0, 42, 0, 44, 0, 46, 0, 48, 0, 50, 0, 52, 0, 54, 0, 56, 0, 58, 0, 60, 0, 62, 0, 64, 0, 66, 0, 68, 0, 70, 0, 72, 0, 74, 0, 76, 1, 78, 2, 80, 3, 82, 4, 84, 5, 86, 6, 88, 7, 90, 8, 92, 9, 94, 10, 96, 11, 98, 12, 100, 13, 102, 14, 104, 15, 106, 16, 108, 17, 110, 18, 112, 19, 114, 20, 116, 21, 118, 22, 120, 23, 122, 24, 124, 25, 126, 26, 128, 27, 130, 28, 132, 29, 134, 30, 136, 31, 138, 32, 140, 33, 142, 34, 144, 0, 146, 0, 148, 35, 150, 36, 152, 0, 154, 0, 156, 0, 158, 0, 160, 0, 162, 0, 164, 0, 166, 37, 2, 0, 1, 9, 2, 0, 9, 9, 32, 32, 2, 0, 10, 10, 12, 13, 13, 0, 65, 90, 97, 122, 192, 214, 216, 246, 248, 767, 880, 893, 895, 8191, 8204, 8205, 8304, 8591, 11264, 12271, 12289, 55295, 63744, 64975, 65008, 65533, 3, 0, 183, 183, 768, 879, 8255, 8256, 8, 0, 34, 34, 39, 39, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 4, 0, 10, 10, 13, 13, 39, 39, 92, 92, 4, 0, 10, 10, 13, 13, 34, 34, 92, 92, 3, 0, 48, 57, 65, 70, 97, 102, 1, 0, 48, 57, 488, 0, 76, 1, 0, 0, 0, 0, 78, 1, 0, 0, 0, 0, 80, 1, 0, 0, 0, 0, 82, 1, 0, 0, 0, 0, 84, 1, 0, 0, 0, 0, 86, 1, 0, 0, 0, 0, 88, 1, 0, 0, 0, 0, 90, 1, 0, 0, 0, 0, 92, 1, 0, 0, 0, 0, 94, 1, 0, 0, 0, 0, 96, 1, 0, 0, 0, 0, 98, 1, 0, 0, 0, 0, 100, 1, 0, 0, 0, 0, 102, 1, 0, 0, 0, 0, 104, 1, 0, 0, 0, 0, 106, 1, 0, 0, 0, 0, 108, 1, 0, 0, 0, 0, 110, 1, 0, 0, 0, 0, 112, 1, 0, 0, 0, 0, 114, 1, 0, 0, 0, 0, 116, 1, 0, 0, 0, 0, 118, 1, 0, 0, 0, 0, 120, 1, 0, 0, 0, 0, 122, 1, 0, 0, 0, 0, 124, 1, 0, 0, 0, 0, 126, 1, 0, 0, 0, 0, 128, 1, 0, 0, 0, 0, 130, 1, 0, 0, 0, 0, 132, 1, 0, 0, 0, 0, 134, 1, 0, 0, 0, 0, 136, 1, 0, 0, 0, 0, 138, 1, 0, 0, 0, 0, 140, 1, 0, 0, 0, 0, 142, 1, 0, 0, 0, 1, 148, 1, 0, 0, 0, 1, 150, 1, 0, 0, 0, 1, 152, 1, 0, 0, 0, 1, 154, 1, 0, 0, 0, 1, 156, 1, 0, 0, 0, 1, 158, 1, 0, 0, 0, 1, 160, 1, 0, 0, 0, 1, 162, 1, 0, 0, 0, 1, 164, 1, 0, 0, 0, 1, 166, 1, 0, 0, 0, 2, 170, 1, 0, 0, 0, 4, 172, 1, 0, 0, 0, 6, 174, 1, 0, 0, 0, 8, 176, 1, 0, 0, 0, 10, 190, 1, 0, 0, 0, 12, 192, 1, 0, 0, 0, 14, 194, 1, 0, 0, 0, 16, 196, 1, 0, 0, 0, 18, 198, 1, 0, 0, 0, 20, 200, 1, 0, 0, 0, 22, 202, 1, 0, 0, 0, 24, 204, 1, 0, 0, 0, 26, 206, 1, 0, 0, 0, 28, 208, 1, 0, 0, 0, 30, 210, 1, 0, 0, 0, 32, 212, 1, 0, 0, 0, 34, 214, 1, 0, 0, 0, 36, 216, 1, 0, 0, 0, 38, 218, 1, 0, 0, 0, 40, 220, 1, 0, 0, 0, 42, 222, 1, 0, 0, 0, 44, 224, 1, 0, 0, 0, 46, 227, 1, 0, 0, 0, 48, 229, 1, 0, 0, 0, 50, 231, 1, 0, 0, 0, 52, 242, 1, 0, 0, 0, 54, 244, 1, 0, 0, 0, 56, 251, 1, 0, 0, 0, 58, 264, 1, 0, 0, 0, 60, 274, 1, 0, 0, 0, 62, 286, 1, 0, 0, 0, 64, 288, 1, 0, 0, 0, 66, 290, 1, 0, 0, 0, 68, 293, 1, 0, 0, 0, 70, 297, 1, 0, 0, 0, 72, 302, 1, 0, 0, 0, 74, 307, 1, 0, 0, 0, 76, 313, 1, 0, 0, 0, 78, 322, 1, 0, 0, 0, 80, 325, 1, 0, 0, 0, 82, 330, 1, 0, 0, 0, 84, 335, 1, 0, 0, 0, 86, 339, 1, 0, 0, 0, 88, 344, 1, 0, 0, 0, 90, 353, 1, 0, 0, 0, 92, 355, 1, 0, 0, 0, 94, 358, 1, 0, 0, 0, 96, 365, 1, 0, 0, 0, 98, 371, 1, 0, 0, 0, 100, 375, 1, 0, 0, 0, 102, 379, 1, 0, 0, 0, 104, 381, 1, 0, 0, 0, 106, 383, 1, 0, 0, 0, 108, 385, 1, 0, 0, 0, 110, 387, 1, 0, 0, 0, 112, 389, 1, 0, 0, 0, 114, 391, 1, 0, 0, 0, 116, 393, 1, 0, 0, 0, 118, 395, 1, 0, 0, 0, 120, 397, 1, 0, 0, 0, 122, 399, 1, 0, 0, 0, 124, 401, 1, 0, 0, 0, 126, 403, 1, 0, 0, 0, 128, 405, 1, 0, 0, 0, 130, 407, 1, 0, 0, 0, 132, 409, 1, 0, 0, 0, 134, 411, 1, 0, 0, 0, 136, 413, 1, 0, 0, 0, 138, 415, 1, 0, 0, 0, 140, 423, 1, 0, 0, 0, 142, 435, 1, 0, 0, 0, 144, 439, 1, 0, 0, 0, 146, 441, 1, 0, 0, 0, 148, 444, 1, 0, 0, 0, 150, 451, 1, 0, 0, 0, 152, 457, 1, 0, 0, 0, 154, 462, 1, 0, 0, 0, 156, 466, 1, 0, 0, 0, 158, 476, 1, 0, 0, 0, 160, 480, 1, 0, 0, 0, 162, 484, 1, 0, 0, 0, 164, 488, 1, 0, 0, 0, 166, 492, 1, 0, 0, 0, 168, 171, 3, 4, 1, 0, 169, 171, 3, 6, 2, 0, 170, 168, 1, 0, 0, 0, 170, 169, 1, 0, 0, 0, 171, 3, 1, 0, 0, 0, 172, 173, 7, 0, 0, 0, 173, 5, 1, 0, 0, 0, 174, 175, 7, 1, 0, 0, 175, 7, 1, 0, 0, 0, 176, 177, 5, 47, 0, 0, 177, 178, 5, 42, 0, 0, 178, 182, 1, 0, 0, 0, 179, 181, 9, 0, 0, 0, 180, 179, 1, 0, 0, 0, 181, 184, 1, 0, 0, 0, 182, 183, 1, 0, 0, 0, 182, 180, 1, 0, 0, 0, 183, 188, 1, 0, 0, 0, 184, 182, 1, 0, 0, 0, 185, 186, 5, 42, 0, 0, 186, 189, 5, 47, 0, 0, 187, 189, 5, 0, 0, 1, 188, 185, 1, 0, 0, 0, 188, 187, 1, 0, 0, 0, 189, 9, 1, 0, 0, 0, 190, 191, 5, 92, 0, 0, 191, 11, 1, 0, 0, 0, 192, 193, 5, 39, 0, 0, 193, 13, 1, 0, 0, 0, 194, 195, 5, 34, 0, 0, 195, 15, 1, 0, 0, 0, 196, 197, 5, 95, 0, 0, 197, 17, 1, 0, 0, 0, 198, 199, 5, 44, 0, 0, 199, 19, 1, 0, 0, 0, 200, 201, 5, 59, 0, 0, 201, 21, 1, 0, 0, 0, 202, 203, 5, 124, 0, 0, 203, 23, 1, 0, 0, 0, 204, 205, 5, 46, 0, 0, 205, 25, 1, 0, 0, 0, 206, 207, 5, 40, 0, 0, 207, 27, 1, 0, 0, 0, 208, 209, 5, 41, 0, 0, 209, 29, 1, 0, 0, 0, 210, 211, 5, 91, 0, 0, 211, 31, 1, 0, 0, 0, 212, 213, 5, 93, 0, 0, 213, 33, 1, 0, 0, 0, 214, 215, 5, 42, 0, 0, 215, 35, 1, 0, 0, 0, 216, 217, 5, 47, 0, 0, 217, 37, 1, 0, 0, 0, 218, 219, 5, 37, 0, 0, 219, 39, 1, 0, 0, 0, 220, 221, 5, 43, 0, 0, 221, 41, 1, 0, 0, 0, 222, 223, 5, 45, 0, 0, 223, 43, 1, 0, 0, 0, 224, 225, 5, 63, 0, 0, 225, 226, 5, 63, 0, 0, 226, 45, 1, 0, 0, 0, 227, 228, 5, 60, 0, 0, 228, 47, 1, 0, 0, 0, 229, 230, 5, 62, 0, 0, 230, 49, 1, 0, 0, 0, 231, 232, 5, 100, 0, 0, 232, 233, 5, 101, 0, 0, 233, 234, 5, 102, 0, 0, 234, 235, 5, 97, 0, 0, 235, 236, 5, 117, 0, 0, 236, 237, 5, 108, 0, 0, 237, 238, 5, 116, 0, 0, 238, 51, 1, 0, 0, 0, 239, 243, 7, 2, 0, 0, 240, 243, 3, 16, 7, 0, 241, 243, 7, 3, 0, 0, 242, 239, 1, 0, 0, 0, 242, 240, 1, 0, 0, 0, 242, 241, 1, 0, 0, 0, 243, 53, 1, 0, 0, 0, 244, 249, 3, 10, 4, 0, 245, 250, 7, 4, 0, 0, 246, 250, 3, 56, 27, 0, 247, 250, 9, 0, 0, 0, 248, 250, 5, 0, 0, 1, 249, 245, 1, 0, 0, 0, 249, 246, 1, 0, 0, 0, 249, 247, 1, 0, 0, 0, 249, 248, 1, 0, 0, 0, 250, 55, 1, 0, 0, 0, 251, 262, 5, 117, 0, 0, 252, 260, 3, 64, 31, 0, 253, 258, 3, 64, 31, 0, 254, 256, 3, 64, 31, 0, 255, 257, 3, 64, 31, 0, 256, 255, 1, 0, 0, 0, 256, 257, 1, 0, 0, 0, 257, 259, 1, 0, 0, 0, 258, 254, 1, 0, 0, 0, 258, 259, 1, 0, 0, 0, 259, 261, 1, 0, 0, 0, 260, 253, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261, 263, 1, 0, 0, 0, 262, 252, 1, 0, 0, 0, 262, 263, 1, 0, 0, 0, 263, 57, 1, 0, 0, 0, 264, 269, 3, 12, 5, 0, 265, 268, 3, 54, 26, 0, 266, 268, 8, 5, 0, 0, 267, 265, 1, 0, 0, 0, 267, 266, 1, 0, 0, 0, 268, 271, 1, 0, 0, 0, 269, 267, 1, 0, 0, 0, 269, 270, 1, 0, 0, 0, 270, 272, 1, 0, 0, 0, 271, 269, 1, 0, 0, 0, 272, 273, 3, 12, 5, 0, 273, 59, 1, 0, 0, 0, 274, 279, 3, 14, 6, 0, 275, 278, 3, 54, 26, 0, 276, 278, 8, 6, 0, 0, 277, 275, 1, 0, 0, 0, 277, 276, 1, 0, 0, 0, 278, 281, 1, 0, 0, 0, 279, 277, 1, 0, 0, 0, 279, 280, 1, 0, 0, 0, 280, 282, 1, 0, 0, 0, 281, 279, 1, 0, 0, 0, 282, 283, 3, 14, 6, 0, 283, 61, 1, 0, 0, 0, 284, 287, 3, 72, 35, 0, 285, 287, 3, 74, 36, 0, 286, 284, 1, 0, 0, 0, 286, 285, 1, 0, 0, 0, 287, 63, 1, 0, 0, 0, 288, 289, 7, 7, 0, 0, 289, 65, 1, 0, 0, 0, 290, 291, 7, 8, 0, 0, 291, 67, 1, 0, 0, 0, 292, 294, 3, 66, 32, 0, 293, 292, 1, 0, 0, 0, 294, 295, 1, 0, 0, 0, 295, 293, 1, 0, 0, 0, 295, 296, 1, 0, 0, 0, 296, 69, 1, 0, 0, 0, 297, 298, 3, 68, 33, 0, 298, 300, 3, 24, 11, 0, 299, 301, 3, 68, 33, 0, 300, 299, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 71, 1, 0, 0, 0, 302, 303, 5, 116, 0, 0, 303, 304, 5, 114, 0, 0, 304, 305, 5, 117, 0, 0, 305, 306, 5, 101, 0, 0, 306, 73, 1, 0, 0, 0, 307, 308, 5, 102, 0, 0, 308, 309, 5, 97, 0, 0, 309, 310, 5, 108, 0, 0, 310, 311, 5, 115, 0, 0, 311, 312, 5, 101, 0, 0, 312, 75, 1, 0, 0, 0, 313, 317, 3, 22, 10, 0, 314, 316, 3, 4, 1, 0, 315, 314, 1, 0, 0, 0, 316, 319, 1, 0, 0, 0, 317, 315, 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 320, 1, 0, 0, 0, 319, 317, 1, 0, 0, 0, 320, 321, 3, 50, 24, 0, 321, 77, 1, 0, 0, 0, 322, 323, 5, 105, 0, 0, 323, 324, 5, 102, 0, 0, 324, 79, 1, 0, 0, 0, 325, 326, 5, 116, 0, 0, 326, 327, 5, 104, 0, 0, 327, 328, 5, 101, 0, 0, 328, 329, 5, 110, 0, 0, 329, 81, 1, 0, 0, 0, 330, 331, 5, 101, 0, 0, 331, 332, 5, 108, 0, 0, 332, 333, 5, 115, 0, 0, 333, 334, 5, 101, 0, 0, 334, 83, 1, 0, 0, 0, 335, 336, 5, 101, 0, 0, 336, 337, 5, 110, 0, 0, 337, 338, 5, 100, 0, 0, 338, 85, 1, 0, 0, 0, 339, 340, 5, 119, 0, 0, 340, 341, 5, 105, 0, 0, 341, 342, 5, 116, 0, 0, 342, 343, 5, 104, 0, 0, 343, 87, 1, 0, 0, 0, 344, 345, 5, 36, 0, 0, 345, 350, 3, 52, 25, 0, 346, 349, 3, 52, 25, 0, 347, 349, 3, 66, 32, 0, 348, 346, 1, 0, 0, 0, 348, 347, 1, 0, 0, 0, 349, 352, 1, 0, 0, 0, 350, 348, 1, 0, 0, 0, 350, 351, 1, 0, 0, 0, 351, 89, 1, 0, 0, 0, 352, 350, 1, 0, 0, 0, 353, 354, 5, 36, 0, 0, 354, 91, 1, 0, 0, 0, 355, 356, 3, 8, 3, 0, 356, 93, 1, 0, 0, 0, 357, 359, 3, 4, 1, 0, 358, 357, 1, 0, 0, 0, 359, 360, 1, 0, 0, 0, 360, 358, 1, 0, 0, 0, 360, 361, 1, 0, 0, 0, 361, 362, 1, 0, 0, 0, 362, 363, 6, 46, 0, 0, 363, 95, 1, 0, 0, 0, 364, 366, 3, 6, 2, 0, 365, 364, 1, 0, 0, 0, 366, 367, 1, 0, 0, 0, 367, 365, 1, 0, 0, 0, 367, 368, 1, 0, 0, 0, 368, 369, 1, 0, 0, 0, 369, 370, 6, 47, 0, 0, 370, 97, 1, 0, 0, 0, 371, 372, 3, 144, 71, 0, 372, 373, 1, 0, 0, 0, 373, 374, 6, 48, 1, 0, 374, 99, 1, 0, 0, 0, 375, 376, 3, 146, 72, 0, 376, 377, 1, 0, 0, 0, 377, 378, 6, 49, 2, 0, 378, 101, 1, 0, 0, 0, 379, 380, 3, 24, 11, 0, 380, 103, 1, 0, 0, 0, 381, 382, 3, 26, 12, 0, 382, 105, 1, 0, 0, 0, 383, 384, 3, 28, 13, 0, 384, 107, 1, 0, 0, 0, 385, 386, 3, 30, 14, 0, 386, 109, 1, 0, 0, 0, 387, 388, 3, 32, 15, 0, 388, 111, 1, 0, 0, 0, 389, 390, 3, 44, 21, 0, 390, 113, 1, 0, 0, 0, 391, 392, 3, 20, 9, 0, 392, 115, 1, 0, 0, 0, 393, 394, 3, 18, 8, 0, 394, 117, 1, 0, 0, 0, 395, 396, 3, 34, 16, 0, 396, 119, 1, 0, 0, 0, 397, 398, 3, 36, 17, 0, 398, 121, 1, 0, 0, 0, 399, 400, 3, 38, 18, 0, 400, 123, 1, 0, 0, 0, 401, 402, 3, 40, 19, 0, 402, 125, 1, 0, 0, 0, 403, 404, 3, 42, 20, 0, 404, 127, 1, 0, 0, 0, 405, 406, 3, 60, 29, 0, 406, 129, 1, 0, 0, 0, 407, 408, 3, 58, 28, 0, 408, 131, 1, 0, 0, 0, 409, 410, 3, 68, 33, 0, 410, 133, 1, 0, 0, 0, 411, 412, 3, 70, 34, 0, 412, 135, 1, 0, 0, 0, 413, 414, 3, 62, 30, 0, 414, 137, 1, 0, 0, 0, 415, 420, 3, 52, 25, 0, 416, 419, 3, 52, 25, 0, 417, 419, 3, 66, 32, 0, 418, 416, 1, 0, 0, 0, 418, 417, 1, 0, 0, 0, 419, 422, 1, 0, 0, 0, 420, 418, 1, 0, 0, 0, 420, 421, 1, 0, 0, 0, 421, 139, 1, 0, 0, 0, 422, 420, 1, 0, 0, 0, 423, 426, 3, 46, 22, 0, 424, 427, 3, 52, 25, 0, 425, 427, 3, 102, 50, 0, 426, 424, 1, 0, 0, 0, 426, 425, 1, 0, 0, 0, 427, 428, 1, 0, 0, 0, 428, 426, 1, 0, 0, 0, 428, 429, 1, 0, 0, 0, 429, 431, 1, 0, 0, 0, 430, 432, 3, 140, 69, 0, 431, 430, 1, 0, 0, 0, 431, 432, 1, 0, 0, 0, 432, 433, 1, 0, 0, 0, 433, 434, 3, 48, 23, 0, 434, 141, 1, 0, 0, 0, 435, 436, 3, 4, 1, 0, 436, 437, 1, 0, 0, 0, 437, 438, 6, 70, 0, 0, 438, 143, 1, 0, 0, 0, 439, 440, 5, 123, 0, 0, 440, 145, 1, 0, 0, 0, 441, 442, 5, 125, 0, 0, 442, 147, 1, 0, 0, 0, 443, 445, 3, 4, 1, 0, 444, 443, 1, 0, 0, 0, 445, 446, 1, 0, 0, 0, 446, 444, 1, 0, 0, 0, 446, 447, 1, 0, 0, 0, 447, 448, 1, 0, 0, 0, 448, 449, 6, 73, 0, 0, 449, 149, 1, 0, 0, 0, 450, 452, 3, 6, 2, 0, 451, 450, 1, 0, 0, 0, 452, 453, 1, 0, 0, 0, 453, 451, 1, 0, 0, 0, 453, 454, 1, 0, 0, 0, 454, 455, 1, 0, 0, 0, 455, 456, 6, 74, 0, 0, 456, 151, 1, 0, 0, 0, 457, 458, 3, 146, 72, 0, 458, 459, 1, 0, 0, 0, 459, 460, 6, 75, 2, 0, 460, 461, 6, 75, 3, 0, 461, 153, 1, 0, 0, 0, 462, 463, 3, 18, 8, 0, 463, 464, 1, 0, 0, 0, 464, 465, 6, 76, 4, 0, 465, 155, 1, 0, 0, 0, 466, 471, 3, 52, 25, 0, 467, 470, 3, 52, 25, 0, 468, 470, 3, 66, 32, 0, 469, 467, 1, 0, 0, 0, 469, 468, 1, 0, 0, 0, 470, 473, 1, 0, 0, 0, 471, 469, 1, 0, 0, 0, 471, 472, 1, 0, 0, 0, 472, 474, 1, 0, 0, 0, 473, 471, 1, 0, 0, 0, 474, 475, 6, 77, 5, 0, 475, 157, 1, 0, 0, 0, 476, 477, 3, 60, 29, 0, 477, 478, 1, 0, 0, 0, 478, 479, 6, 78, 6, 0, 479, 159, 1, 0, 0, 0, 480, 481, 3, 58, 28, 0, 481, 482, 1, 0, 0, 0, 482, 483, 6, 79, 7, 0, 483, 161, 1, 0, 0, 0, 484, 485, 3, 68, 33, 0, 485, 486, 1, 0, 0, 0, 486, 487, 6, 80, 8, 0, 487, 163, 1, 0, 0, 0, 488, 489, 3, 70, 34, 0, 489, 490, 1, 0, 0, 0, 490, 491, 6, 81, 9, 0, 491, 165, 1, 0, 0, 0, 492, 493, 7, 0, 0, 0, 493, 494, 1, 0, 0, 0, 494, 495, 6, 82, 0, 0, 495, 167, 1, 0, 0, 0, 32, 0, 1, 170, 182, 188, 242, 249, 256, 258, 260, 262, 267, 269, 277, 279, 286, 295, 300, 317, 348, 350, 360, 367, 418, 420, 426, 428, 431, 446, 453, 469, 471, 10, 6, 0, 0, 5, 1, 0, 4, 0, 0, 7, 13, 0, 7, 21, 0, 7, 32, 0, 7, 27, 0, 7, 28, 0, 7, 29, 0, 7, 30, 0]
\ No newline at end of file
+[4, 0, 41, 517, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 1, 0, 1, 0, 3, 0, 179, 8, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 189, 8, 3, 10, 3, 12, 3, 192, 9, 3, 1, 3, 1, 3, 1, 3, 3, 3, 197, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 3, 25, 251, 8, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 3, 26, 258, 8, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 3, 27, 265, 8, 27, 3, 27, 267, 8, 27, 3, 27, 269, 8, 27, 3, 27, 271, 8, 27, 1, 28, 1, 28, 1, 28, 5, 28, 276, 8, 28, 10, 28, 12, 28, 279, 9, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 5, 29, 286, 8, 29, 10, 29, 12, 29, 289, 9, 29, 1, 29, 1, 29, 1, 30, 1, 30, 3, 30, 295, 8, 30, 1, 31, 1, 31, 1, 32, 1, 32, 1, 33, 4, 33, 302, 8, 33, 11, 33, 12, 33, 303, 1, 34, 1, 34, 1, 34, 3, 34, 309, 8, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 5, 37, 324, 8, 37, 10, 37, 12, 37, 327, 9, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 5, 47, 370, 8, 47, 10, 47, 12, 47, 373, 9, 47, 1, 48, 1, 48, 1, 49, 1, 49, 1, 50, 4, 50, 380, 8, 50, 11, 50, 12, 50, 381, 1, 50, 1, 50, 1, 51, 4, 51, 387, 8, 51, 11, 51, 12, 51, 388, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 55, 1, 55, 1, 56, 1, 56, 1, 57, 1, 57, 1, 58, 1, 58, 1, 59, 1, 59, 1, 60, 1, 60, 1, 61, 1, 61, 1, 62, 1, 62, 1, 63, 1, 63, 1, 64, 1, 64, 1, 65, 1, 65, 1, 66, 1, 66, 1, 67, 1, 67, 1, 68, 1, 68, 1, 69, 1, 69, 1, 70, 1, 70, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 5, 72, 440, 8, 72, 10, 72, 12, 72, 443, 9, 72, 1, 73, 1, 73, 1, 73, 4, 73, 448, 8, 73, 11, 73, 12, 73, 449, 1, 73, 3, 73, 453, 8, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 76, 1, 76, 1, 77, 4, 77, 466, 8, 77, 11, 77, 12, 77, 467, 1, 77, 1, 77, 1, 78, 4, 78, 473, 8, 78, 11, 78, 12, 78, 474, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 5, 81, 491, 8, 81, 10, 81, 12, 81, 494, 9, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 190, 0, 87, 2, 0, 4, 0, 6, 0, 8, 0, 10, 0, 12, 0, 14, 0, 16, 0, 18, 0, 20, 0, 22, 0, 24, 0, 26, 0, 28, 0, 30, 0, 32, 0, 34, 0, 36, 0, 38, 0, 40, 0, 42, 0, 44, 0, 46, 0, 48, 0, 50, 0, 52, 0, 54, 0, 56, 0, 58, 0, 60, 0, 62, 0, 64, 0, 66, 0, 68, 0, 70, 0, 72, 0, 74, 0, 76, 1, 78, 2, 80, 3, 82, 4, 84, 5, 86, 6, 88, 7, 90, 8, 92, 9, 94, 10, 96, 11, 98, 12, 100, 13, 102, 14, 104, 15, 106, 16, 108, 17, 110, 18, 112, 19, 114, 20, 116, 21, 118, 22, 120, 23, 122, 24, 124, 25, 126, 26, 128, 27, 130, 28, 132, 29, 134, 30, 136, 31, 138, 32, 140, 33, 142, 34, 144, 35, 146, 36, 148, 37, 150, 38, 152, 0, 154, 0, 156, 39, 158, 40, 160, 0, 162, 0, 164, 0, 166, 0, 168, 0, 170, 0, 172, 0, 174, 41, 2, 0, 1, 9, 2, 0, 9, 9, 32, 32, 2, 0, 10, 10, 12, 13, 13, 0, 65, 90, 97, 122, 192, 214, 216, 246, 248, 767, 880, 893, 895, 8191, 8204, 8205, 8304, 8591, 11264, 12271, 12289, 55295, 63744, 64975, 65008, 65533, 3, 0, 183, 183, 768, 879, 8255, 8256, 8, 0, 34, 34, 39, 39, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 4, 0, 10, 10, 13, 13, 39, 39, 92, 92, 4, 0, 10, 10, 13, 13, 34, 34, 92, 92, 3, 0, 48, 57, 65, 70, 97, 102, 1, 0, 48, 57, 509, 0, 76, 1, 0, 0, 0, 0, 78, 1, 0, 0, 0, 0, 80, 1, 0, 0, 0, 0, 82, 1, 0, 0, 0, 0, 84, 1, 0, 0, 0, 0, 86, 1, 0, 0, 0, 0, 88, 1, 0, 0, 0, 0, 90, 1, 0, 0, 0, 0, 92, 1, 0, 0, 0, 0, 94, 1, 0, 0, 0, 0, 96, 1, 0, 0, 0, 0, 98, 1, 0, 0, 0, 0, 100, 1, 0, 0, 0, 0, 102, 1, 0, 0, 0, 0, 104, 1, 0, 0, 0, 0, 106, 1, 0, 0, 0, 0, 108, 1, 0, 0, 0, 0, 110, 1, 0, 0, 0, 0, 112, 1, 0, 0, 0, 0, 114, 1, 0, 0, 0, 0, 116, 1, 0, 0, 0, 0, 118, 1, 0, 0, 0, 0, 120, 1, 0, 0, 0, 0, 122, 1, 0, 0, 0, 0, 124, 1, 0, 0, 0, 0, 126, 1, 0, 0, 0, 0, 128, 1, 0, 0, 0, 0, 130, 1, 0, 0, 0, 0, 132, 1, 0, 0, 0, 0, 134, 1, 0, 0, 0, 0, 136, 1, 0, 0, 0, 0, 138, 1, 0, 0, 0, 0, 140, 1, 0, 0, 0, 0, 142, 1, 0, 0, 0, 0, 144, 1, 0, 0, 0, 0, 146, 1, 0, 0, 0, 0, 148, 1, 0, 0, 0, 0, 150, 1, 0, 0, 0, 1, 156, 1, 0, 0, 0, 1, 158, 1, 0, 0, 0, 1, 160, 1, 0, 0, 0, 1, 162, 1, 0, 0, 0, 1, 164, 1, 0, 0, 0, 1, 166, 1, 0, 0, 0, 1, 168, 1, 0, 0, 0, 1, 170, 1, 0, 0, 0, 1, 172, 1, 0, 0, 0, 1, 174, 1, 0, 0, 0, 2, 178, 1, 0, 0, 0, 4, 180, 1, 0, 0, 0, 6, 182, 1, 0, 0, 0, 8, 184, 1, 0, 0, 0, 10, 198, 1, 0, 0, 0, 12, 200, 1, 0, 0, 0, 14, 202, 1, 0, 0, 0, 16, 204, 1, 0, 0, 0, 18, 206, 1, 0, 0, 0, 20, 208, 1, 0, 0, 0, 22, 210, 1, 0, 0, 0, 24, 212, 1, 0, 0, 0, 26, 214, 1, 0, 0, 0, 28, 216, 1, 0, 0, 0, 30, 218, 1, 0, 0, 0, 32, 220, 1, 0, 0, 0, 34, 222, 1, 0, 0, 0, 36, 224, 1, 0, 0, 0, 38, 226, 1, 0, 0, 0, 40, 228, 1, 0, 0, 0, 42, 230, 1, 0, 0, 0, 44, 232, 1, 0, 0, 0, 46, 235, 1, 0, 0, 0, 48, 237, 1, 0, 0, 0, 50, 239, 1, 0, 0, 0, 52, 250, 1, 0, 0, 0, 54, 252, 1, 0, 0, 0, 56, 259, 1, 0, 0, 0, 58, 272, 1, 0, 0, 0, 60, 282, 1, 0, 0, 0, 62, 294, 1, 0, 0, 0, 64, 296, 1, 0, 0, 0, 66, 298, 1, 0, 0, 0, 68, 301, 1, 0, 0, 0, 70, 305, 1, 0, 0, 0, 72, 310, 1, 0, 0, 0, 74, 315, 1, 0, 0, 0, 76, 321, 1, 0, 0, 0, 78, 330, 1, 0, 0, 0, 80, 333, 1, 0, 0, 0, 82, 338, 1, 0, 0, 0, 84, 343, 1, 0, 0, 0, 86, 347, 1, 0, 0, 0, 88, 352, 1, 0, 0, 0, 90, 356, 1, 0, 0, 0, 92, 359, 1, 0, 0, 0, 94, 363, 1, 0, 0, 0, 96, 365, 1, 0, 0, 0, 98, 374, 1, 0, 0, 0, 100, 376, 1, 0, 0, 0, 102, 379, 1, 0, 0, 0, 104, 386, 1, 0, 0, 0, 106, 392, 1, 0, 0, 0, 108, 396, 1, 0, 0, 0, 110, 400, 1, 0, 0, 0, 112, 402, 1, 0, 0, 0, 114, 404, 1, 0, 0, 0, 116, 406, 1, 0, 0, 0, 118, 408, 1, 0, 0, 0, 120, 410, 1, 0, 0, 0, 122, 412, 1, 0, 0, 0, 124, 414, 1, 0, 0, 0, 126, 416, 1, 0, 0, 0, 128, 418, 1, 0, 0, 0, 130, 420, 1, 0, 0, 0, 132, 422, 1, 0, 0, 0, 134, 424, 1, 0, 0, 0, 136, 426, 1, 0, 0, 0, 138, 428, 1, 0, 0, 0, 140, 430, 1, 0, 0, 0, 142, 432, 1, 0, 0, 0, 144, 434, 1, 0, 0, 0, 146, 436, 1, 0, 0, 0, 148, 444, 1, 0, 0, 0, 150, 456, 1, 0, 0, 0, 152, 460, 1, 0, 0, 0, 154, 462, 1, 0, 0, 0, 156, 465, 1, 0, 0, 0, 158, 472, 1, 0, 0, 0, 160, 478, 1, 0, 0, 0, 162, 483, 1, 0, 0, 0, 164, 487, 1, 0, 0, 0, 166, 497, 1, 0, 0, 0, 168, 501, 1, 0, 0, 0, 170, 505, 1, 0, 0, 0, 172, 509, 1, 0, 0, 0, 174, 513, 1, 0, 0, 0, 176, 179, 3, 4, 1, 0, 177, 179, 3, 6, 2, 0, 178, 176, 1, 0, 0, 0, 178, 177, 1, 0, 0, 0, 179, 3, 1, 0, 0, 0, 180, 181, 7, 0, 0, 0, 181, 5, 1, 0, 0, 0, 182, 183, 7, 1, 0, 0, 183, 7, 1, 0, 0, 0, 184, 185, 5, 47, 0, 0, 185, 186, 5, 42, 0, 0, 186, 190, 1, 0, 0, 0, 187, 189, 9, 0, 0, 0, 188, 187, 1, 0, 0, 0, 189, 192, 1, 0, 0, 0, 190, 191, 1, 0, 0, 0, 190, 188, 1, 0, 0, 0, 191, 196, 1, 0, 0, 0, 192, 190, 1, 0, 0, 0, 193, 194, 5, 42, 0, 0, 194, 197, 5, 47, 0, 0, 195, 197, 5, 0, 0, 1, 196, 193, 1, 0, 0, 0, 196, 195, 1, 0, 0, 0, 197, 9, 1, 0, 0, 0, 198, 199, 5, 92, 0, 0, 199, 11, 1, 0, 0, 0, 200, 201, 5, 39, 0, 0, 201, 13, 1, 0, 0, 0, 202, 203, 5, 34, 0, 0, 203, 15, 1, 0, 0, 0, 204, 205, 5, 95, 0, 0, 205, 17, 1, 0, 0, 0, 206, 207, 5, 44, 0, 0, 207, 19, 1, 0, 0, 0, 208, 209, 5, 59, 0, 0, 209, 21, 1, 0, 0, 0, 210, 211, 5, 124, 0, 0, 211, 23, 1, 0, 0, 0, 212, 213, 5, 46, 0, 0, 213, 25, 1, 0, 0, 0, 214, 215, 5, 40, 0, 0, 215, 27, 1, 0, 0, 0, 216, 217, 5, 41, 0, 0, 217, 29, 1, 0, 0, 0, 218, 219, 5, 91, 0, 0, 219, 31, 1, 0, 0, 0, 220, 221, 5, 93, 0, 0, 221, 33, 1, 0, 0, 0, 222, 223, 5, 42, 0, 0, 223, 35, 1, 0, 0, 0, 224, 225, 5, 47, 0, 0, 225, 37, 1, 0, 0, 0, 226, 227, 5, 37, 0, 0, 227, 39, 1, 0, 0, 0, 228, 229, 5, 43, 0, 0, 229, 41, 1, 0, 0, 0, 230, 231, 5, 45, 0, 0, 231, 43, 1, 0, 0, 0, 232, 233, 5, 63, 0, 0, 233, 234, 5, 63, 0, 0, 234, 45, 1, 0, 0, 0, 235, 236, 5, 60, 0, 0, 236, 47, 1, 0, 0, 0, 237, 238, 5, 62, 0, 0, 238, 49, 1, 0, 0, 0, 239, 240, 5, 100, 0, 0, 240, 241, 5, 101, 0, 0, 241, 242, 5, 102, 0, 0, 242, 243, 5, 97, 0, 0, 243, 244, 5, 117, 0, 0, 244, 245, 5, 108, 0, 0, 245, 246, 5, 116, 0, 0, 246, 51, 1, 0, 0, 0, 247, 251, 7, 2, 0, 0, 248, 251, 3, 16, 7, 0, 249, 251, 7, 3, 0, 0, 250, 247, 1, 0, 0, 0, 250, 248, 1, 0, 0, 0, 250, 249, 1, 0, 0, 0, 251, 53, 1, 0, 0, 0, 252, 257, 3, 10, 4, 0, 253, 258, 7, 4, 0, 0, 254, 258, 3, 56, 27, 0, 255, 258, 9, 0, 0, 0, 256, 258, 5, 0, 0, 1, 257, 253, 1, 0, 0, 0, 257, 254, 1, 0, 0, 0, 257, 255, 1, 0, 0, 0, 257, 256, 1, 0, 0, 0, 258, 55, 1, 0, 0, 0, 259, 270, 5, 117, 0, 0, 260, 268, 3, 64, 31, 0, 261, 266, 3, 64, 31, 0, 262, 264, 3, 64, 31, 0, 263, 265, 3, 64, 31, 0, 264, 263, 1, 0, 0, 0, 264, 265, 1, 0, 0, 0, 265, 267, 1, 0, 0, 0, 266, 262, 1, 0, 0, 0, 266, 267, 1, 0, 0, 0, 267, 269, 1, 0, 0, 0, 268, 261, 1, 0, 0, 0, 268, 269, 1, 0, 0, 0, 269, 271, 1, 0, 0, 0, 270, 260, 1, 0, 0, 0, 270, 271, 1, 0, 0, 0, 271, 57, 1, 0, 0, 0, 272, 277, 3, 12, 5, 0, 273, 276, 3, 54, 26, 0, 274, 276, 8, 5, 0, 0, 275, 273, 1, 0, 0, 0, 275, 274, 1, 0, 0, 0, 276, 279, 1, 0, 0, 0, 277, 275, 1, 0, 0, 0, 277, 278, 1, 0, 0, 0, 278, 280, 1, 0, 0, 0, 279, 277, 1, 0, 0, 0, 280, 281, 3, 12, 5, 0, 281, 59, 1, 0, 0, 0, 282, 287, 3, 14, 6, 0, 283, 286, 3, 54, 26, 0, 284, 286, 8, 6, 0, 0, 285, 283, 1, 0, 0, 0, 285, 284, 1, 0, 0, 0, 286, 289, 1, 0, 0, 0, 287, 285, 1, 0, 0, 0, 287, 288, 1, 0, 0, 0, 288, 290, 1, 0, 0, 0, 289, 287, 1, 0, 0, 0, 290, 291, 3, 14, 6, 0, 291, 61, 1, 0, 0, 0, 292, 295, 3, 72, 35, 0, 293, 295, 3, 74, 36, 0, 294, 292, 1, 0, 0, 0, 294, 293, 1, 0, 0, 0, 295, 63, 1, 0, 0, 0, 296, 297, 7, 7, 0, 0, 297, 65, 1, 0, 0, 0, 298, 299, 7, 8, 0, 0, 299, 67, 1, 0, 0, 0, 300, 302, 3, 66, 32, 0, 301, 300, 1, 0, 0, 0, 302, 303, 1, 0, 0, 0, 303, 301, 1, 0, 0, 0, 303, 304, 1, 0, 0, 0, 304, 69, 1, 0, 0, 0, 305, 306, 3, 68, 33, 0, 306, 308, 3, 24, 11, 0, 307, 309, 3, 68, 33, 0, 308, 307, 1, 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 71, 1, 0, 0, 0, 310, 311, 5, 116, 0, 0, 311, 312, 5, 114, 0, 0, 312, 313, 5, 117, 0, 0, 313, 314, 5, 101, 0, 0, 314, 73, 1, 0, 0, 0, 315, 316, 5, 102, 0, 0, 316, 317, 5, 97, 0, 0, 317, 318, 5, 108, 0, 0, 318, 319, 5, 115, 0, 0, 319, 320, 5, 101, 0, 0, 320, 75, 1, 0, 0, 0, 321, 325, 3, 22, 10, 0, 322, 324, 3, 4, 1, 0, 323, 322, 1, 0, 0, 0, 324, 327, 1, 0, 0, 0, 325, 323, 1, 0, 0, 0, 325, 326, 1, 0, 0, 0, 326, 328, 1, 0, 0, 0, 327, 325, 1, 0, 0, 0, 328, 329, 3, 50, 24, 0, 329, 77, 1, 0, 0, 0, 330, 331, 5, 105, 0, 0, 331, 332, 5, 102, 0, 0, 332, 79, 1, 0, 0, 0, 333, 334, 5, 116, 0, 0, 334, 335, 5, 104, 0, 0, 335, 336, 5, 101, 0, 0, 336, 337, 5, 110, 0, 0, 337, 81, 1, 0, 0, 0, 338, 339, 5, 101, 0, 0, 339, 340, 5, 108, 0, 0, 340, 341, 5, 115, 0, 0, 341, 342, 5, 101, 0, 0, 342, 83, 1, 0, 0, 0, 343, 344, 5, 101, 0, 0, 344, 345, 5, 110, 0, 0, 345, 346, 5, 100, 0, 0, 346, 85, 1, 0, 0, 0, 347, 348, 5, 119, 0, 0, 348, 349, 5, 105, 0, 0, 349, 350, 5, 116, 0, 0, 350, 351, 5, 104, 0, 0, 351, 87, 1, 0, 0, 0, 352, 353, 5, 97, 0, 0, 353, 354, 5, 110, 0, 0, 354, 355, 5, 100, 0, 0, 355, 89, 1, 0, 0, 0, 356, 357, 5, 111, 0, 0, 357, 358, 5, 114, 0, 0, 358, 91, 1, 0, 0, 0, 359, 360, 5, 110, 0, 0, 360, 361, 5, 111, 0, 0, 361, 362, 5, 116, 0, 0, 362, 93, 1, 0, 0, 0, 363, 364, 5, 33, 0, 0, 364, 95, 1, 0, 0, 0, 365, 366, 5, 36, 0, 0, 366, 371, 3, 52, 25, 0, 367, 370, 3, 52, 25, 0, 368, 370, 3, 66, 32, 0, 369, 367, 1, 0, 0, 0, 369, 368, 1, 0, 0, 0, 370, 373, 1, 0, 0, 0, 371, 369, 1, 0, 0, 0, 371, 372, 1, 0, 0, 0, 372, 97, 1, 0, 0, 0, 373, 371, 1, 0, 0, 0, 374, 375, 5, 36, 0, 0, 375, 99, 1, 0, 0, 0, 376, 377, 3, 8, 3, 0, 377, 101, 1, 0, 0, 0, 378, 380, 3, 4, 1, 0, 379, 378, 1, 0, 0, 0, 380, 381, 1, 0, 0, 0, 381, 379, 1, 0, 0, 0, 381, 382, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, 384, 6, 50, 0, 0, 384, 103, 1, 0, 0, 0, 385, 387, 3, 6, 2, 0, 386, 385, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, 386, 1, 0, 0, 0, 388, 389, 1, 0, 0, 0, 389, 390, 1, 0, 0, 0, 390, 391, 6, 51, 0, 0, 391, 105, 1, 0, 0, 0, 392, 393, 3, 152, 75, 0, 393, 394, 1, 0, 0, 0, 394, 395, 6, 52, 1, 0, 395, 107, 1, 0, 0, 0, 396, 397, 3, 154, 76, 0, 397, 398, 1, 0, 0, 0, 398, 399, 6, 53, 2, 0, 399, 109, 1, 0, 0, 0, 400, 401, 3, 24, 11, 0, 401, 111, 1, 0, 0, 0, 402, 403, 3, 26, 12, 0, 403, 113, 1, 0, 0, 0, 404, 405, 3, 28, 13, 0, 405, 115, 1, 0, 0, 0, 406, 407, 3, 30, 14, 0, 407, 117, 1, 0, 0, 0, 408, 409, 3, 32, 15, 0, 409, 119, 1, 0, 0, 0, 410, 411, 3, 44, 21, 0, 411, 121, 1, 0, 0, 0, 412, 413, 3, 20, 9, 0, 413, 123, 1, 0, 0, 0, 414, 415, 3, 18, 8, 0, 415, 125, 1, 0, 0, 0, 416, 417, 3, 34, 16, 0, 417, 127, 1, 0, 0, 0, 418, 419, 3, 36, 17, 0, 419, 129, 1, 0, 0, 0, 420, 421, 3, 38, 18, 0, 421, 131, 1, 0, 0, 0, 422, 423, 3, 40, 19, 0, 423, 133, 1, 0, 0, 0, 424, 425, 3, 42, 20, 0, 425, 135, 1, 0, 0, 0, 426, 427, 3, 60, 29, 0, 427, 137, 1, 0, 0, 0, 428, 429, 3, 58, 28, 0, 429, 139, 1, 0, 0, 0, 430, 431, 3, 68, 33, 0, 431, 141, 1, 0, 0, 0, 432, 433, 3, 70, 34, 0, 433, 143, 1, 0, 0, 0, 434, 435, 3, 62, 30, 0, 435, 145, 1, 0, 0, 0, 436, 441, 3, 52, 25, 0, 437, 440, 3, 52, 25, 0, 438, 440, 3, 66, 32, 0, 439, 437, 1, 0, 0, 0, 439, 438, 1, 0, 0, 0, 440, 443, 1, 0, 0, 0, 441, 439, 1, 0, 0, 0, 441, 442, 1, 0, 0, 0, 442, 147, 1, 0, 0, 0, 443, 441, 1, 0, 0, 0, 444, 447, 3, 46, 22, 0, 445, 448, 3, 52, 25, 0, 446, 448, 3, 110, 54, 0, 447, 445, 1, 0, 0, 0, 447, 446, 1, 0, 0, 0, 448, 449, 1, 0, 0, 0, 449, 447, 1, 0, 0, 0, 449, 450, 1, 0, 0, 0, 450, 452, 1, 0, 0, 0, 451, 453, 3, 148, 73, 0, 452, 451, 1, 0, 0, 0, 452, 453, 1, 0, 0, 0, 453, 454, 1, 0, 0, 0, 454, 455, 3, 48, 23, 0, 455, 149, 1, 0, 0, 0, 456, 457, 3, 4, 1, 0, 457, 458, 1, 0, 0, 0, 458, 459, 6, 74, 0, 0, 459, 151, 1, 0, 0, 0, 460, 461, 5, 123, 0, 0, 461, 153, 1, 0, 0, 0, 462, 463, 5, 125, 0, 0, 463, 155, 1, 0, 0, 0, 464, 466, 3, 4, 1, 0, 465, 464, 1, 0, 0, 0, 466, 467, 1, 0, 0, 0, 467, 465, 1, 0, 0, 0, 467, 468, 1, 0, 0, 0, 468, 469, 1, 0, 0, 0, 469, 470, 6, 77, 0, 0, 470, 157, 1, 0, 0, 0, 471, 473, 3, 6, 2, 0, 472, 471, 1, 0, 0, 0, 473, 474, 1, 0, 0, 0, 474, 472, 1, 0, 0, 0, 474, 475, 1, 0, 0, 0, 475, 476, 1, 0, 0, 0, 476, 477, 6, 78, 0, 0, 477, 159, 1, 0, 0, 0, 478, 479, 3, 154, 76, 0, 479, 480, 1, 0, 0, 0, 480, 481, 6, 79, 2, 0, 481, 482, 6, 79, 3, 0, 482, 161, 1, 0, 0, 0, 483, 484, 3, 18, 8, 0, 484, 485, 1, 0, 0, 0, 485, 486, 6, 80, 4, 0, 486, 163, 1, 0, 0, 0, 487, 492, 3, 52, 25, 0, 488, 491, 3, 52, 25, 0, 489, 491, 3, 66, 32, 0, 490, 488, 1, 0, 0, 0, 490, 489, 1, 0, 0, 0, 491, 494, 1, 0, 0, 0, 492, 490, 1, 0, 0, 0, 492, 493, 1, 0, 0, 0, 493, 495, 1, 0, 0, 0, 494, 492, 1, 0, 0, 0, 495, 496, 6, 81, 5, 0, 496, 165, 1, 0, 0, 0, 497, 498, 3, 60, 29, 0, 498, 499, 1, 0, 0, 0, 499, 500, 6, 82, 6, 0, 500, 167, 1, 0, 0, 0, 501, 502, 3, 58, 28, 0, 502, 503, 1, 0, 0, 0, 503, 504, 6, 83, 7, 0, 504, 169, 1, 0, 0, 0, 505, 506, 3, 68, 33, 0, 506, 507, 1, 0, 0, 0, 507, 508, 6, 84, 8, 0, 508, 171, 1, 0, 0, 0, 509, 510, 3, 70, 34, 0, 510, 511, 1, 0, 0, 0, 511, 512, 6, 85, 9, 0, 512, 173, 1, 0, 0, 0, 513, 514, 7, 0, 0, 0, 514, 515, 1, 0, 0, 0, 515, 516, 6, 86, 0, 0, 516, 175, 1, 0, 0, 0, 32, 0, 1, 178, 190, 196, 250, 257, 264, 266, 268, 270, 275, 277, 285, 287, 294, 303, 308, 325, 369, 371, 381, 388, 439, 441, 447, 449, 452, 467, 474, 490, 492, 10, 6, 0, 0, 5, 1, 0, 4, 0, 0, 7, 17, 0, 7, 25, 0, 7, 36, 0, 7, 31, 0, 7, 32, 0, 7, 33, 0, 7, 34, 0]
\ No newline at end of file
diff --git a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexerExpression.java b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexerExpression.java
index dcd9335a7..b25cedb29 100644
--- a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexerExpression.java
+++ b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexerExpression.java
@@ -19,12 +19,12 @@ public class TemplateLexerExpression extends Lexer {
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
- DEFAULT=1, IF=2, THEN=3, ELSE=4, END=5, WITH=6, VAR_ID=7, ROOT=8, BLOCK_COMMENT=9,
- HORZ_WS=10, VERT_WS=11, LBRACE=12, RBRACE=13, DOT=14, LPAREN=15, RPAREN=16,
- LBRACK=17, RBRACK=18, DQUESTION=19, SEMI=20, COMMA=21, STAR=22, SLASH=23,
- PERCENT=24, PLUS=25, MINUS=26, DSTRING=27, SSTRING=28, DECDIGITS=29, FLOAT=30,
- BOOLEAN=31, ID=32, CAST_TYPE=33, ERR_CHAR=34, C_HORZ_WS=35, C_VERT_WS=36,
- CERR_CHAR=37;
+ DEFAULT=1, IF=2, THEN=3, ELSE=4, END=5, WITH=6, AND=7, OR=8, NOT=9, BANG=10,
+ VAR_ID=11, ROOT=12, BLOCK_COMMENT=13, HORZ_WS=14, VERT_WS=15, LBRACE=16,
+ RBRACE=17, DOT=18, LPAREN=19, RPAREN=20, LBRACK=21, RBRACK=22, DQUESTION=23,
+ SEMI=24, COMMA=25, STAR=26, SLASH=27, PERCENT=28, PLUS=29, MINUS=30, DSTRING=31,
+ SSTRING=32, DECDIGITS=33, FLOAT=34, BOOLEAN=35, ID=36, CAST_TYPE=37, ERR_CHAR=38,
+ C_HORZ_WS=39, C_VERT_WS=40, CERR_CHAR=41;
public static final int
Concatenation=1;
public static String[] channelNames = {
@@ -42,30 +42,32 @@ private static String[] makeRuleNames() {
"Star", "Slash", "Percent", "Plus", "Minus", "DQuestion", "LT", "GT",
"Default", "NameChar", "EscSeq", "UnicodeEsc", "SQuoteLiteral", "DQuoteLiteral",
"BoolLiteral", "HexDigit", "DecDigit", "DecDigits", "Float", "True",
- "False", "DEFAULT", "IF", "THEN", "ELSE", "END", "WITH", "VAR_ID", "ROOT",
- "BLOCK_COMMENT", "HORZ_WS", "VERT_WS", "LBRACE", "RBRACE", "DOT", "LPAREN",
- "RPAREN", "LBRACK", "RBRACK", "DQUESTION", "SEMI", "COMMA", "STAR", "SLASH",
- "PERCENT", "PLUS", "MINUS", "DSTRING", "SSTRING", "DECDIGITS", "FLOAT",
- "BOOLEAN", "ID", "CAST_TYPE", "ERR_CHAR", "LBrace", "RBrace", "C_HORZ_WS",
- "C_VERT_WS", "CRBRACE", "CCOMMA", "CID", "CDSTRING", "CSSTRING", "CDECDIGITS",
- "CFLOAT", "CERR_CHAR"
+ "False", "DEFAULT", "IF", "THEN", "ELSE", "END", "WITH", "AND", "OR",
+ "NOT", "BANG", "VAR_ID", "ROOT", "BLOCK_COMMENT", "HORZ_WS", "VERT_WS",
+ "LBRACE", "RBRACE", "DOT", "LPAREN", "RPAREN", "LBRACK", "RBRACK", "DQUESTION",
+ "SEMI", "COMMA", "STAR", "SLASH", "PERCENT", "PLUS", "MINUS", "DSTRING",
+ "SSTRING", "DECDIGITS", "FLOAT", "BOOLEAN", "ID", "CAST_TYPE", "ERR_CHAR",
+ "LBrace", "RBrace", "C_HORZ_WS", "C_VERT_WS", "CRBRACE", "CCOMMA", "CID",
+ "CDSTRING", "CSSTRING", "CDECDIGITS", "CFLOAT", "CERR_CHAR"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
- null, null, "'if'", "'then'", "'else'", "'end'", "'with'", null, "'$'"
+ null, null, "'if'", "'then'", "'else'", "'end'", "'with'", "'and'", "'or'",
+ "'not'", "'!'", null, "'$'"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
- null, "DEFAULT", "IF", "THEN", "ELSE", "END", "WITH", "VAR_ID", "ROOT",
- "BLOCK_COMMENT", "HORZ_WS", "VERT_WS", "LBRACE", "RBRACE", "DOT", "LPAREN",
- "RPAREN", "LBRACK", "RBRACK", "DQUESTION", "SEMI", "COMMA", "STAR", "SLASH",
- "PERCENT", "PLUS", "MINUS", "DSTRING", "SSTRING", "DECDIGITS", "FLOAT",
- "BOOLEAN", "ID", "CAST_TYPE", "ERR_CHAR", "C_HORZ_WS", "C_VERT_WS", "CERR_CHAR"
+ null, "DEFAULT", "IF", "THEN", "ELSE", "END", "WITH", "AND", "OR", "NOT",
+ "BANG", "VAR_ID", "ROOT", "BLOCK_COMMENT", "HORZ_WS", "VERT_WS", "LBRACE",
+ "RBRACE", "DOT", "LPAREN", "RPAREN", "LBRACK", "RBRACK", "DQUESTION",
+ "SEMI", "COMMA", "STAR", "SLASH", "PERCENT", "PLUS", "MINUS", "DSTRING",
+ "SSTRING", "DECDIGITS", "FLOAT", "BOOLEAN", "ID", "CAST_TYPE", "ERR_CHAR",
+ "C_HORZ_WS", "C_VERT_WS", "CERR_CHAR"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
@@ -127,7 +129,7 @@ public TemplateLexerExpression(CharStream input) {
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
- "\u0004\u0000%\u01f0\u0006\uffff\uffff\u0006\uffff\uffff\u0002\u0000\u0007"+
+ "\u0004\u0000)\u0205\u0006\uffff\uffff\u0006\uffff\uffff\u0002\u0000\u0007"+
"\u0000\u0002\u0001\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007"+
"\u0003\u0002\u0004\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007"+
"\u0006\u0002\u0007\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n"+
@@ -148,292 +150,304 @@ public TemplateLexerExpression(CharStream input) {
"C\u0007C\u0002D\u0007D\u0002E\u0007E\u0002F\u0007F\u0002G\u0007G\u0002"+
"H\u0007H\u0002I\u0007I\u0002J\u0007J\u0002K\u0007K\u0002L\u0007L\u0002"+
"M\u0007M\u0002N\u0007N\u0002O\u0007O\u0002P\u0007P\u0002Q\u0007Q\u0002"+
- "R\u0007R\u0001\u0000\u0001\u0000\u0003\u0000\u00ab\b\u0000\u0001\u0001"+
- "\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0003"+
- "\u0001\u0003\u0005\u0003\u00b5\b\u0003\n\u0003\f\u0003\u00b8\t\u0003\u0001"+
- "\u0003\u0001\u0003\u0001\u0003\u0003\u0003\u00bd\b\u0003\u0001\u0004\u0001"+
- "\u0004\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0007\u0001"+
- "\u0007\u0001\b\u0001\b\u0001\t\u0001\t\u0001\n\u0001\n\u0001\u000b\u0001"+
- "\u000b\u0001\f\u0001\f\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000f"+
- "\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0012"+
- "\u0001\u0012\u0001\u0013\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0015"+
- "\u0001\u0015\u0001\u0015\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017"+
- "\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0018"+
- "\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u0019\u0003\u0019"+
- "\u00f3\b\u0019\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a"+
- "\u0003\u001a\u00fa\b\u001a\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b"+
- "\u0001\u001b\u0003\u001b\u0101\b\u001b\u0003\u001b\u0103\b\u001b\u0003"+
- "\u001b\u0105\b\u001b\u0003\u001b\u0107\b\u001b\u0001\u001c\u0001\u001c"+
- "\u0001\u001c\u0005\u001c\u010c\b\u001c\n\u001c\f\u001c\u010f\t\u001c\u0001"+
- "\u001c\u0001\u001c\u0001\u001d\u0001\u001d\u0001\u001d\u0005\u001d\u0116"+
- "\b\u001d\n\u001d\f\u001d\u0119\t\u001d\u0001\u001d\u0001\u001d\u0001\u001e"+
- "\u0001\u001e\u0003\u001e\u011f\b\u001e\u0001\u001f\u0001\u001f\u0001 "+
- "\u0001 \u0001!\u0004!\u0126\b!\u000b!\f!\u0127\u0001\"\u0001\"\u0001\""+
- "\u0003\"\u012d\b\"\u0001#\u0001#\u0001#\u0001#\u0001#\u0001$\u0001$\u0001"+
- "$\u0001$\u0001$\u0001$\u0001%\u0001%\u0005%\u013c\b%\n%\f%\u013f\t%\u0001"+
- "%\u0001%\u0001&\u0001&\u0001&\u0001\'\u0001\'\u0001\'\u0001\'\u0001\'"+
- "\u0001(\u0001(\u0001(\u0001(\u0001(\u0001)\u0001)\u0001)\u0001)\u0001"+
- "*\u0001*\u0001*\u0001*\u0001*\u0001+\u0001+\u0001+\u0001+\u0005+\u015d"+
- "\b+\n+\f+\u0160\t+\u0001,\u0001,\u0001-\u0001-\u0001.\u0004.\u0167\b."+
- "\u000b.\f.\u0168\u0001.\u0001.\u0001/\u0004/\u016e\b/\u000b/\f/\u016f"+
- "\u0001/\u0001/\u00010\u00010\u00010\u00010\u00011\u00011\u00011\u0001"+
- "1\u00012\u00012\u00013\u00013\u00014\u00014\u00015\u00015\u00016\u0001"+
- "6\u00017\u00017\u00018\u00018\u00019\u00019\u0001:\u0001:\u0001;\u0001"+
- ";\u0001<\u0001<\u0001=\u0001=\u0001>\u0001>\u0001?\u0001?\u0001@\u0001"+
- "@\u0001A\u0001A\u0001B\u0001B\u0001C\u0001C\u0001D\u0001D\u0001D\u0005"+
- "D\u01a3\bD\nD\fD\u01a6\tD\u0001E\u0001E\u0001E\u0004E\u01ab\bE\u000bE"+
- "\fE\u01ac\u0001E\u0003E\u01b0\bE\u0001E\u0001E\u0001F\u0001F\u0001F\u0001"+
- "F\u0001G\u0001G\u0001H\u0001H\u0001I\u0004I\u01bd\bI\u000bI\fI\u01be\u0001"+
- "I\u0001I\u0001J\u0004J\u01c4\bJ\u000bJ\fJ\u01c5\u0001J\u0001J\u0001K\u0001"+
- "K\u0001K\u0001K\u0001K\u0001L\u0001L\u0001L\u0001L\u0001M\u0001M\u0001"+
- "M\u0005M\u01d6\bM\nM\fM\u01d9\tM\u0001M\u0001M\u0001N\u0001N\u0001N\u0001"+
- "N\u0001O\u0001O\u0001O\u0001O\u0001P\u0001P\u0001P\u0001P\u0001Q\u0001"+
- "Q\u0001Q\u0001Q\u0001R\u0001R\u0001R\u0001R\u0001\u00b6\u0000S\u0002\u0000"+
- "\u0004\u0000\u0006\u0000\b\u0000\n\u0000\f\u0000\u000e\u0000\u0010\u0000"+
- "\u0012\u0000\u0014\u0000\u0016\u0000\u0018\u0000\u001a\u0000\u001c\u0000"+
- "\u001e\u0000 \u0000\"\u0000$\u0000&\u0000(\u0000*\u0000,\u0000.\u0000"+
- "0\u00002\u00004\u00006\u00008\u0000:\u0000<\u0000>\u0000@\u0000B\u0000"+
- "D\u0000F\u0000H\u0000J\u0000L\u0001N\u0002P\u0003R\u0004T\u0005V\u0006"+
- "X\u0007Z\b\\\t^\n`\u000bb\fd\rf\u000eh\u000fj\u0010l\u0011n\u0012p\u0013"+
- "r\u0014t\u0015v\u0016x\u0017z\u0018|\u0019~\u001a\u0080\u001b\u0082\u001c"+
- "\u0084\u001d\u0086\u001e\u0088\u001f\u008a \u008c!\u008e\"\u0090\u0000"+
- "\u0092\u0000\u0094#\u0096$\u0098\u0000\u009a\u0000\u009c\u0000\u009e\u0000"+
- "\u00a0\u0000\u00a2\u0000\u00a4\u0000\u00a6%\u0002\u0000\u0001\t\u0002"+
- "\u0000\t\t \u0002\u0000\n\n\f\r\r\u0000AZaz\u00c0\u00d6\u00d8\u00f6\u00f8"+
- "\u02ff\u0370\u037d\u037f\u1fff\u200c\u200d\u2070\u218f\u2c00\u2fef\u3001"+
- "\u8000\ud7ff\u8000\uf900\u8000\ufdcf\u8000\ufdf0\u8000\ufffd\u0003\u0000"+
- "\u00b7\u00b7\u0300\u036f\u203f\u2040\b\u0000\"\"\'\'\\\\bbffnnrrtt\u0004"+
- "\u0000\n\n\r\r\'\'\\\\\u0004\u0000\n\n\r\r\"\"\\\\\u0003\u000009AFaf\u0001"+
- "\u000009\u01e8\u0000L\u0001\u0000\u0000\u0000\u0000N\u0001\u0000\u0000"+
- "\u0000\u0000P\u0001\u0000\u0000\u0000\u0000R\u0001\u0000\u0000\u0000\u0000"+
- "T\u0001\u0000\u0000\u0000\u0000V\u0001\u0000\u0000\u0000\u0000X\u0001"+
- "\u0000\u0000\u0000\u0000Z\u0001\u0000\u0000\u0000\u0000\\\u0001\u0000"+
- "\u0000\u0000\u0000^\u0001\u0000\u0000\u0000\u0000`\u0001\u0000\u0000\u0000"+
- "\u0000b\u0001\u0000\u0000\u0000\u0000d\u0001\u0000\u0000\u0000\u0000f"+
- "\u0001\u0000\u0000\u0000\u0000h\u0001\u0000\u0000\u0000\u0000j\u0001\u0000"+
- "\u0000\u0000\u0000l\u0001\u0000\u0000\u0000\u0000n\u0001\u0000\u0000\u0000"+
- "\u0000p\u0001\u0000\u0000\u0000\u0000r\u0001\u0000\u0000\u0000\u0000t"+
- "\u0001\u0000\u0000\u0000\u0000v\u0001\u0000\u0000\u0000\u0000x\u0001\u0000"+
- "\u0000\u0000\u0000z\u0001\u0000\u0000\u0000\u0000|\u0001\u0000\u0000\u0000"+
- "\u0000~\u0001\u0000\u0000\u0000\u0000\u0080\u0001\u0000\u0000\u0000\u0000"+
- "\u0082\u0001\u0000\u0000\u0000\u0000\u0084\u0001\u0000\u0000\u0000\u0000"+
- "\u0086\u0001\u0000\u0000\u0000\u0000\u0088\u0001\u0000\u0000\u0000\u0000"+
- "\u008a\u0001\u0000\u0000\u0000\u0000\u008c\u0001\u0000\u0000\u0000\u0000"+
- "\u008e\u0001\u0000\u0000\u0000\u0001\u0094\u0001\u0000\u0000\u0000\u0001"+
- "\u0096\u0001\u0000\u0000\u0000\u0001\u0098\u0001\u0000\u0000\u0000\u0001"+
- "\u009a\u0001\u0000\u0000\u0000\u0001\u009c\u0001\u0000\u0000\u0000\u0001"+
- "\u009e\u0001\u0000\u0000\u0000\u0001\u00a0\u0001\u0000\u0000\u0000\u0001"+
- "\u00a2\u0001\u0000\u0000\u0000\u0001\u00a4\u0001\u0000\u0000\u0000\u0001"+
- "\u00a6\u0001\u0000\u0000\u0000\u0002\u00aa\u0001\u0000\u0000\u0000\u0004"+
- "\u00ac\u0001\u0000\u0000\u0000\u0006\u00ae\u0001\u0000\u0000\u0000\b\u00b0"+
- "\u0001\u0000\u0000\u0000\n\u00be\u0001\u0000\u0000\u0000\f\u00c0\u0001"+
- "\u0000\u0000\u0000\u000e\u00c2\u0001\u0000\u0000\u0000\u0010\u00c4\u0001"+
- "\u0000\u0000\u0000\u0012\u00c6\u0001\u0000\u0000\u0000\u0014\u00c8\u0001"+
- "\u0000\u0000\u0000\u0016\u00ca\u0001\u0000\u0000\u0000\u0018\u00cc\u0001"+
- "\u0000\u0000\u0000\u001a\u00ce\u0001\u0000\u0000\u0000\u001c\u00d0\u0001"+
- "\u0000\u0000\u0000\u001e\u00d2\u0001\u0000\u0000\u0000 \u00d4\u0001\u0000"+
- "\u0000\u0000\"\u00d6\u0001\u0000\u0000\u0000$\u00d8\u0001\u0000\u0000"+
- "\u0000&\u00da\u0001\u0000\u0000\u0000(\u00dc\u0001\u0000\u0000\u0000*"+
- "\u00de\u0001\u0000\u0000\u0000,\u00e0\u0001\u0000\u0000\u0000.\u00e3\u0001"+
- "\u0000\u0000\u00000\u00e5\u0001\u0000\u0000\u00002\u00e7\u0001\u0000\u0000"+
- "\u00004\u00f2\u0001\u0000\u0000\u00006\u00f4\u0001\u0000\u0000\u00008"+
- "\u00fb\u0001\u0000\u0000\u0000:\u0108\u0001\u0000\u0000\u0000<\u0112\u0001"+
- "\u0000\u0000\u0000>\u011e\u0001\u0000\u0000\u0000@\u0120\u0001\u0000\u0000"+
- "\u0000B\u0122\u0001\u0000\u0000\u0000D\u0125\u0001\u0000\u0000\u0000F"+
- "\u0129\u0001\u0000\u0000\u0000H\u012e\u0001\u0000\u0000\u0000J\u0133\u0001"+
- "\u0000\u0000\u0000L\u0139\u0001\u0000\u0000\u0000N\u0142\u0001\u0000\u0000"+
- "\u0000P\u0145\u0001\u0000\u0000\u0000R\u014a\u0001\u0000\u0000\u0000T"+
- "\u014f\u0001\u0000\u0000\u0000V\u0153\u0001\u0000\u0000\u0000X\u0158\u0001"+
- "\u0000\u0000\u0000Z\u0161\u0001\u0000\u0000\u0000\\\u0163\u0001\u0000"+
- "\u0000\u0000^\u0166\u0001\u0000\u0000\u0000`\u016d\u0001\u0000\u0000\u0000"+
- "b\u0173\u0001\u0000\u0000\u0000d\u0177\u0001\u0000\u0000\u0000f\u017b"+
- "\u0001\u0000\u0000\u0000h\u017d\u0001\u0000\u0000\u0000j\u017f\u0001\u0000"+
- "\u0000\u0000l\u0181\u0001\u0000\u0000\u0000n\u0183\u0001\u0000\u0000\u0000"+
- "p\u0185\u0001\u0000\u0000\u0000r\u0187\u0001\u0000\u0000\u0000t\u0189"+
- "\u0001\u0000\u0000\u0000v\u018b\u0001\u0000\u0000\u0000x\u018d\u0001\u0000"+
- "\u0000\u0000z\u018f\u0001\u0000\u0000\u0000|\u0191\u0001\u0000\u0000\u0000"+
- "~\u0193\u0001\u0000\u0000\u0000\u0080\u0195\u0001\u0000\u0000\u0000\u0082"+
- "\u0197\u0001\u0000\u0000\u0000\u0084\u0199\u0001\u0000\u0000\u0000\u0086"+
- "\u019b\u0001\u0000\u0000\u0000\u0088\u019d\u0001\u0000\u0000\u0000\u008a"+
- "\u019f\u0001\u0000\u0000\u0000\u008c\u01a7\u0001\u0000\u0000\u0000\u008e"+
- "\u01b3\u0001\u0000\u0000\u0000\u0090\u01b7\u0001\u0000\u0000\u0000\u0092"+
- "\u01b9\u0001\u0000\u0000\u0000\u0094\u01bc\u0001\u0000\u0000\u0000\u0096"+
- "\u01c3\u0001\u0000\u0000\u0000\u0098\u01c9\u0001\u0000\u0000\u0000\u009a"+
- "\u01ce\u0001\u0000\u0000\u0000\u009c\u01d2\u0001\u0000\u0000\u0000\u009e"+
- "\u01dc\u0001\u0000\u0000\u0000\u00a0\u01e0\u0001\u0000\u0000\u0000\u00a2"+
- "\u01e4\u0001\u0000\u0000\u0000\u00a4\u01e8\u0001\u0000\u0000\u0000\u00a6"+
- "\u01ec\u0001\u0000\u0000\u0000\u00a8\u00ab\u0003\u0004\u0001\u0000\u00a9"+
- "\u00ab\u0003\u0006\u0002\u0000\u00aa\u00a8\u0001\u0000\u0000\u0000\u00aa"+
- "\u00a9\u0001\u0000\u0000\u0000\u00ab\u0003\u0001\u0000\u0000\u0000\u00ac"+
- "\u00ad\u0007\u0000\u0000\u0000\u00ad\u0005\u0001\u0000\u0000\u0000\u00ae"+
- "\u00af\u0007\u0001\u0000\u0000\u00af\u0007\u0001\u0000\u0000\u0000\u00b0"+
- "\u00b1\u0005/\u0000\u0000\u00b1\u00b2\u0005*\u0000\u0000\u00b2\u00b6\u0001"+
- "\u0000\u0000\u0000\u00b3\u00b5\t\u0000\u0000\u0000\u00b4\u00b3\u0001\u0000"+
- "\u0000\u0000\u00b5\u00b8\u0001\u0000\u0000\u0000\u00b6\u00b7\u0001\u0000"+
- "\u0000\u0000\u00b6\u00b4\u0001\u0000\u0000\u0000\u00b7\u00bc\u0001\u0000"+
- "\u0000\u0000\u00b8\u00b6\u0001\u0000\u0000\u0000\u00b9\u00ba\u0005*\u0000"+
- "\u0000\u00ba\u00bd\u0005/\u0000\u0000\u00bb\u00bd\u0005\u0000\u0000\u0001"+
- "\u00bc\u00b9\u0001\u0000\u0000\u0000\u00bc\u00bb\u0001\u0000\u0000\u0000"+
- "\u00bd\t\u0001\u0000\u0000\u0000\u00be\u00bf\u0005\\\u0000\u0000\u00bf"+
- "\u000b\u0001\u0000\u0000\u0000\u00c0\u00c1\u0005\'\u0000\u0000\u00c1\r"+
- "\u0001\u0000\u0000\u0000\u00c2\u00c3\u0005\"\u0000\u0000\u00c3\u000f\u0001"+
- "\u0000\u0000\u0000\u00c4\u00c5\u0005_\u0000\u0000\u00c5\u0011\u0001\u0000"+
- "\u0000\u0000\u00c6\u00c7\u0005,\u0000\u0000\u00c7\u0013\u0001\u0000\u0000"+
- "\u0000\u00c8\u00c9\u0005;\u0000\u0000\u00c9\u0015\u0001\u0000\u0000\u0000"+
- "\u00ca\u00cb\u0005|\u0000\u0000\u00cb\u0017\u0001\u0000\u0000\u0000\u00cc"+
- "\u00cd\u0005.\u0000\u0000\u00cd\u0019\u0001\u0000\u0000\u0000\u00ce\u00cf"+
- "\u0005(\u0000\u0000\u00cf\u001b\u0001\u0000\u0000\u0000\u00d0\u00d1\u0005"+
- ")\u0000\u0000\u00d1\u001d\u0001\u0000\u0000\u0000\u00d2\u00d3\u0005[\u0000"+
- "\u0000\u00d3\u001f\u0001\u0000\u0000\u0000\u00d4\u00d5\u0005]\u0000\u0000"+
- "\u00d5!\u0001\u0000\u0000\u0000\u00d6\u00d7\u0005*\u0000\u0000\u00d7#"+
- "\u0001\u0000\u0000\u0000\u00d8\u00d9\u0005/\u0000\u0000\u00d9%\u0001\u0000"+
- "\u0000\u0000\u00da\u00db\u0005%\u0000\u0000\u00db\'\u0001\u0000\u0000"+
- "\u0000\u00dc\u00dd\u0005+\u0000\u0000\u00dd)\u0001\u0000\u0000\u0000\u00de"+
- "\u00df\u0005-\u0000\u0000\u00df+\u0001\u0000\u0000\u0000\u00e0\u00e1\u0005"+
- "?\u0000\u0000\u00e1\u00e2\u0005?\u0000\u0000\u00e2-\u0001\u0000\u0000"+
- "\u0000\u00e3\u00e4\u0005<\u0000\u0000\u00e4/\u0001\u0000\u0000\u0000\u00e5"+
- "\u00e6\u0005>\u0000\u0000\u00e61\u0001\u0000\u0000\u0000\u00e7\u00e8\u0005"+
- "d\u0000\u0000\u00e8\u00e9\u0005e\u0000\u0000\u00e9\u00ea\u0005f\u0000"+
- "\u0000\u00ea\u00eb\u0005a\u0000\u0000\u00eb\u00ec\u0005u\u0000\u0000\u00ec"+
- "\u00ed\u0005l\u0000\u0000\u00ed\u00ee\u0005t\u0000\u0000\u00ee3\u0001"+
- "\u0000\u0000\u0000\u00ef\u00f3\u0007\u0002\u0000\u0000\u00f0\u00f3\u0003"+
- "\u0010\u0007\u0000\u00f1\u00f3\u0007\u0003\u0000\u0000\u00f2\u00ef\u0001"+
- "\u0000\u0000\u0000\u00f2\u00f0\u0001\u0000\u0000\u0000\u00f2\u00f1\u0001"+
- "\u0000\u0000\u0000\u00f35\u0001\u0000\u0000\u0000\u00f4\u00f9\u0003\n"+
- "\u0004\u0000\u00f5\u00fa\u0007\u0004\u0000\u0000\u00f6\u00fa\u00038\u001b"+
- "\u0000\u00f7\u00fa\t\u0000\u0000\u0000\u00f8\u00fa\u0005\u0000\u0000\u0001"+
- "\u00f9\u00f5\u0001\u0000\u0000\u0000\u00f9\u00f6\u0001\u0000\u0000\u0000"+
- "\u00f9\u00f7\u0001\u0000\u0000\u0000\u00f9\u00f8\u0001\u0000\u0000\u0000"+
- "\u00fa7\u0001\u0000\u0000\u0000\u00fb\u0106\u0005u\u0000\u0000\u00fc\u0104"+
- "\u0003@\u001f\u0000\u00fd\u0102\u0003@\u001f\u0000\u00fe\u0100\u0003@"+
- "\u001f\u0000\u00ff\u0101\u0003@\u001f\u0000\u0100\u00ff\u0001\u0000\u0000"+
- "\u0000\u0100\u0101\u0001\u0000\u0000\u0000\u0101\u0103\u0001\u0000\u0000"+
- "\u0000\u0102\u00fe\u0001\u0000\u0000\u0000\u0102\u0103\u0001\u0000\u0000"+
- "\u0000\u0103\u0105\u0001\u0000\u0000\u0000\u0104\u00fd\u0001\u0000\u0000"+
- "\u0000\u0104\u0105\u0001\u0000\u0000\u0000\u0105\u0107\u0001\u0000\u0000"+
- "\u0000\u0106\u00fc\u0001\u0000\u0000\u0000\u0106\u0107\u0001\u0000\u0000"+
- "\u0000\u01079\u0001\u0000\u0000\u0000\u0108\u010d\u0003\f\u0005\u0000"+
- "\u0109\u010c\u00036\u001a\u0000\u010a\u010c\b\u0005\u0000\u0000\u010b"+
- "\u0109\u0001\u0000\u0000\u0000\u010b\u010a\u0001\u0000\u0000\u0000\u010c"+
- "\u010f\u0001\u0000\u0000\u0000\u010d\u010b\u0001\u0000\u0000\u0000\u010d"+
- "\u010e\u0001\u0000\u0000\u0000\u010e\u0110\u0001\u0000\u0000\u0000\u010f"+
- "\u010d\u0001\u0000\u0000\u0000\u0110\u0111\u0003\f\u0005\u0000\u0111;"+
- "\u0001\u0000\u0000\u0000\u0112\u0117\u0003\u000e\u0006\u0000\u0113\u0116"+
- "\u00036\u001a\u0000\u0114\u0116\b\u0006\u0000\u0000\u0115\u0113\u0001"+
- "\u0000\u0000\u0000\u0115\u0114\u0001\u0000\u0000\u0000\u0116\u0119\u0001"+
- "\u0000\u0000\u0000\u0117\u0115\u0001\u0000\u0000\u0000\u0117\u0118\u0001"+
- "\u0000\u0000\u0000\u0118\u011a\u0001\u0000\u0000\u0000\u0119\u0117\u0001"+
- "\u0000\u0000\u0000\u011a\u011b\u0003\u000e\u0006\u0000\u011b=\u0001\u0000"+
- "\u0000\u0000\u011c\u011f\u0003H#\u0000\u011d\u011f\u0003J$\u0000\u011e"+
- "\u011c\u0001\u0000\u0000\u0000\u011e\u011d\u0001\u0000\u0000\u0000\u011f"+
- "?\u0001\u0000\u0000\u0000\u0120\u0121\u0007\u0007\u0000\u0000\u0121A\u0001"+
- "\u0000\u0000\u0000\u0122\u0123\u0007\b\u0000\u0000\u0123C\u0001\u0000"+
- "\u0000\u0000\u0124\u0126\u0003B \u0000\u0125\u0124\u0001\u0000\u0000\u0000"+
- "\u0126\u0127\u0001\u0000\u0000\u0000\u0127\u0125\u0001\u0000\u0000\u0000"+
- "\u0127\u0128\u0001\u0000\u0000\u0000\u0128E\u0001\u0000\u0000\u0000\u0129"+
- "\u012a\u0003D!\u0000\u012a\u012c\u0003\u0018\u000b\u0000\u012b\u012d\u0003"+
- "D!\u0000\u012c\u012b\u0001\u0000\u0000\u0000\u012c\u012d\u0001\u0000\u0000"+
- "\u0000\u012dG\u0001\u0000\u0000\u0000\u012e\u012f\u0005t\u0000\u0000\u012f"+
- "\u0130\u0005r\u0000\u0000\u0130\u0131\u0005u\u0000\u0000\u0131\u0132\u0005"+
- "e\u0000\u0000\u0132I\u0001\u0000\u0000\u0000\u0133\u0134\u0005f\u0000"+
- "\u0000\u0134\u0135\u0005a\u0000\u0000\u0135\u0136\u0005l\u0000\u0000\u0136"+
- "\u0137\u0005s\u0000\u0000\u0137\u0138\u0005e\u0000\u0000\u0138K\u0001"+
- "\u0000\u0000\u0000\u0139\u013d\u0003\u0016\n\u0000\u013a\u013c\u0003\u0004"+
- "\u0001\u0000\u013b\u013a\u0001\u0000\u0000\u0000\u013c\u013f\u0001\u0000"+
- "\u0000\u0000\u013d\u013b\u0001\u0000\u0000\u0000\u013d\u013e\u0001\u0000"+
- "\u0000\u0000\u013e\u0140\u0001\u0000\u0000\u0000\u013f\u013d\u0001\u0000"+
- "\u0000\u0000\u0140\u0141\u00032\u0018\u0000\u0141M\u0001\u0000\u0000\u0000"+
- "\u0142\u0143\u0005i\u0000\u0000\u0143\u0144\u0005f\u0000\u0000\u0144O"+
- "\u0001\u0000\u0000\u0000\u0145\u0146\u0005t\u0000\u0000\u0146\u0147\u0005"+
- "h\u0000\u0000\u0147\u0148\u0005e\u0000\u0000\u0148\u0149\u0005n\u0000"+
- "\u0000\u0149Q\u0001\u0000\u0000\u0000\u014a\u014b\u0005e\u0000\u0000\u014b"+
- "\u014c\u0005l\u0000\u0000\u014c\u014d\u0005s\u0000\u0000\u014d\u014e\u0005"+
- "e\u0000\u0000\u014eS\u0001\u0000\u0000\u0000\u014f\u0150\u0005e\u0000"+
- "\u0000\u0150\u0151\u0005n\u0000\u0000\u0151\u0152\u0005d\u0000\u0000\u0152"+
- "U\u0001\u0000\u0000\u0000\u0153\u0154\u0005w\u0000\u0000\u0154\u0155\u0005"+
- "i\u0000\u0000\u0155\u0156\u0005t\u0000\u0000\u0156\u0157\u0005h\u0000"+
- "\u0000\u0157W\u0001\u0000\u0000\u0000\u0158\u0159\u0005$\u0000\u0000\u0159"+
- "\u015e\u00034\u0019\u0000\u015a\u015d\u00034\u0019\u0000\u015b\u015d\u0003"+
- "B \u0000\u015c\u015a\u0001\u0000\u0000\u0000\u015c\u015b\u0001\u0000\u0000"+
- "\u0000\u015d\u0160\u0001\u0000\u0000\u0000\u015e\u015c\u0001\u0000\u0000"+
- "\u0000\u015e\u015f\u0001\u0000\u0000\u0000\u015fY\u0001\u0000\u0000\u0000"+
- "\u0160\u015e\u0001\u0000\u0000\u0000\u0161\u0162\u0005$\u0000\u0000\u0162"+
- "[\u0001\u0000\u0000\u0000\u0163\u0164\u0003\b\u0003\u0000\u0164]\u0001"+
- "\u0000\u0000\u0000\u0165\u0167\u0003\u0004\u0001\u0000\u0166\u0165\u0001"+
- "\u0000\u0000\u0000\u0167\u0168\u0001\u0000\u0000\u0000\u0168\u0166\u0001"+
- "\u0000\u0000\u0000\u0168\u0169\u0001\u0000\u0000\u0000\u0169\u016a\u0001"+
- "\u0000\u0000\u0000\u016a\u016b\u0006.\u0000\u0000\u016b_\u0001\u0000\u0000"+
- "\u0000\u016c\u016e\u0003\u0006\u0002\u0000\u016d\u016c\u0001\u0000\u0000"+
- "\u0000\u016e\u016f\u0001\u0000\u0000\u0000\u016f\u016d\u0001\u0000\u0000"+
- "\u0000\u016f\u0170\u0001\u0000\u0000\u0000\u0170\u0171\u0001\u0000\u0000"+
- "\u0000\u0171\u0172\u0006/\u0000\u0000\u0172a\u0001\u0000\u0000\u0000\u0173"+
- "\u0174\u0003\u0090G\u0000\u0174\u0175\u0001\u0000\u0000\u0000\u0175\u0176"+
- "\u00060\u0001\u0000\u0176c\u0001\u0000\u0000\u0000\u0177\u0178\u0003\u0092"+
- "H\u0000\u0178\u0179\u0001\u0000\u0000\u0000\u0179\u017a\u00061\u0002\u0000"+
- "\u017ae\u0001\u0000\u0000\u0000\u017b\u017c\u0003\u0018\u000b\u0000\u017c"+
- "g\u0001\u0000\u0000\u0000\u017d\u017e\u0003\u001a\f\u0000\u017ei\u0001"+
- "\u0000\u0000\u0000\u017f\u0180\u0003\u001c\r\u0000\u0180k\u0001\u0000"+
- "\u0000\u0000\u0181\u0182\u0003\u001e\u000e\u0000\u0182m\u0001\u0000\u0000"+
- "\u0000\u0183\u0184\u0003 \u000f\u0000\u0184o\u0001\u0000\u0000\u0000\u0185"+
- "\u0186\u0003,\u0015\u0000\u0186q\u0001\u0000\u0000\u0000\u0187\u0188\u0003"+
- "\u0014\t\u0000\u0188s\u0001\u0000\u0000\u0000\u0189\u018a\u0003\u0012"+
- "\b\u0000\u018au\u0001\u0000\u0000\u0000\u018b\u018c\u0003\"\u0010\u0000"+
- "\u018cw\u0001\u0000\u0000\u0000\u018d\u018e\u0003$\u0011\u0000\u018ey"+
- "\u0001\u0000\u0000\u0000\u018f\u0190\u0003&\u0012\u0000\u0190{\u0001\u0000"+
- "\u0000\u0000\u0191\u0192\u0003(\u0013\u0000\u0192}\u0001\u0000\u0000\u0000"+
- "\u0193\u0194\u0003*\u0014\u0000\u0194\u007f\u0001\u0000\u0000\u0000\u0195"+
- "\u0196\u0003<\u001d\u0000\u0196\u0081\u0001\u0000\u0000\u0000\u0197\u0198"+
- "\u0003:\u001c\u0000\u0198\u0083\u0001\u0000\u0000\u0000\u0199\u019a\u0003"+
- "D!\u0000\u019a\u0085\u0001\u0000\u0000\u0000\u019b\u019c\u0003F\"\u0000"+
- "\u019c\u0087\u0001\u0000\u0000\u0000\u019d\u019e\u0003>\u001e\u0000\u019e"+
- "\u0089\u0001\u0000\u0000\u0000\u019f\u01a4\u00034\u0019\u0000\u01a0\u01a3"+
- "\u00034\u0019\u0000\u01a1\u01a3\u0003B \u0000\u01a2\u01a0\u0001\u0000"+
- "\u0000\u0000\u01a2\u01a1\u0001\u0000\u0000\u0000\u01a3\u01a6\u0001\u0000"+
- "\u0000\u0000\u01a4\u01a2\u0001\u0000\u0000\u0000\u01a4\u01a5\u0001\u0000"+
- "\u0000\u0000\u01a5\u008b\u0001\u0000\u0000\u0000\u01a6\u01a4\u0001\u0000"+
- "\u0000\u0000\u01a7\u01aa\u0003.\u0016\u0000\u01a8\u01ab\u00034\u0019\u0000"+
- "\u01a9\u01ab\u0003f2\u0000\u01aa\u01a8\u0001\u0000\u0000\u0000\u01aa\u01a9"+
- "\u0001\u0000\u0000\u0000\u01ab\u01ac\u0001\u0000\u0000\u0000\u01ac\u01aa"+
- "\u0001\u0000\u0000\u0000\u01ac\u01ad\u0001\u0000\u0000\u0000\u01ad\u01af"+
- "\u0001\u0000\u0000\u0000\u01ae\u01b0\u0003\u008cE\u0000\u01af\u01ae\u0001"+
- "\u0000\u0000\u0000\u01af\u01b0\u0001\u0000\u0000\u0000\u01b0\u01b1\u0001"+
- "\u0000\u0000\u0000\u01b1\u01b2\u00030\u0017\u0000\u01b2\u008d\u0001\u0000"+
- "\u0000\u0000\u01b3\u01b4\u0003\u0004\u0001\u0000\u01b4\u01b5\u0001\u0000"+
- "\u0000\u0000\u01b5\u01b6\u0006F\u0000\u0000\u01b6\u008f\u0001\u0000\u0000"+
- "\u0000\u01b7\u01b8\u0005{\u0000\u0000\u01b8\u0091\u0001\u0000\u0000\u0000"+
- "\u01b9\u01ba\u0005}\u0000\u0000\u01ba\u0093\u0001\u0000\u0000\u0000\u01bb"+
- "\u01bd\u0003\u0004\u0001\u0000\u01bc\u01bb\u0001\u0000\u0000\u0000\u01bd"+
- "\u01be\u0001\u0000\u0000\u0000\u01be\u01bc\u0001\u0000\u0000\u0000\u01be"+
- "\u01bf\u0001\u0000\u0000\u0000\u01bf\u01c0\u0001\u0000\u0000\u0000\u01c0"+
- "\u01c1\u0006I\u0000\u0000\u01c1\u0095\u0001\u0000\u0000\u0000\u01c2\u01c4"+
- "\u0003\u0006\u0002\u0000\u01c3\u01c2\u0001\u0000\u0000\u0000\u01c4\u01c5"+
- "\u0001\u0000\u0000\u0000\u01c5\u01c3\u0001\u0000\u0000\u0000\u01c5\u01c6"+
- "\u0001\u0000\u0000\u0000\u01c6\u01c7\u0001\u0000\u0000\u0000\u01c7\u01c8"+
- "\u0006J\u0000\u0000\u01c8\u0097\u0001\u0000\u0000\u0000\u01c9\u01ca\u0003"+
- "\u0092H\u0000\u01ca\u01cb\u0001\u0000\u0000\u0000\u01cb\u01cc\u0006K\u0002"+
- "\u0000\u01cc\u01cd\u0006K\u0003\u0000\u01cd\u0099\u0001\u0000\u0000\u0000"+
- "\u01ce\u01cf\u0003\u0012\b\u0000\u01cf\u01d0\u0001\u0000\u0000\u0000\u01d0"+
- "\u01d1\u0006L\u0004\u0000\u01d1\u009b\u0001\u0000\u0000\u0000\u01d2\u01d7"+
- "\u00034\u0019\u0000\u01d3\u01d6\u00034\u0019\u0000\u01d4\u01d6\u0003B"+
- " \u0000\u01d5\u01d3\u0001\u0000\u0000\u0000\u01d5\u01d4\u0001\u0000\u0000"+
- "\u0000\u01d6\u01d9\u0001\u0000\u0000\u0000\u01d7\u01d5\u0001\u0000\u0000"+
- "\u0000\u01d7\u01d8\u0001\u0000\u0000\u0000\u01d8\u01da\u0001\u0000\u0000"+
- "\u0000\u01d9\u01d7\u0001\u0000\u0000\u0000\u01da\u01db\u0006M\u0005\u0000"+
- "\u01db\u009d\u0001\u0000\u0000\u0000\u01dc\u01dd\u0003<\u001d\u0000\u01dd"+
- "\u01de\u0001\u0000\u0000\u0000\u01de\u01df\u0006N\u0006\u0000\u01df\u009f"+
- "\u0001\u0000\u0000\u0000\u01e0\u01e1\u0003:\u001c\u0000\u01e1\u01e2\u0001"+
- "\u0000\u0000\u0000\u01e2\u01e3\u0006O\u0007\u0000\u01e3\u00a1\u0001\u0000"+
- "\u0000\u0000\u01e4\u01e5\u0003D!\u0000\u01e5\u01e6\u0001\u0000\u0000\u0000"+
- "\u01e6\u01e7\u0006P\b\u0000\u01e7\u00a3\u0001\u0000\u0000\u0000\u01e8"+
- "\u01e9\u0003F\"\u0000\u01e9\u01ea\u0001\u0000\u0000\u0000\u01ea\u01eb"+
- "\u0006Q\t\u0000\u01eb\u00a5\u0001\u0000\u0000\u0000\u01ec\u01ed\u0007"+
- "\u0000\u0000\u0000\u01ed\u01ee\u0001\u0000\u0000\u0000\u01ee\u01ef\u0006"+
- "R\u0000\u0000\u01ef\u00a7\u0001\u0000\u0000\u0000 \u0000\u0001\u00aa\u00b6"+
- "\u00bc\u00f2\u00f9\u0100\u0102\u0104\u0106\u010b\u010d\u0115\u0117\u011e"+
- "\u0127\u012c\u013d\u015c\u015e\u0168\u016f\u01a2\u01a4\u01aa\u01ac\u01af"+
- "\u01be\u01c5\u01d5\u01d7\n\u0006\u0000\u0000\u0005\u0001\u0000\u0004\u0000"+
- "\u0000\u0007\r\u0000\u0007\u0015\u0000\u0007 \u0000\u0007\u001b\u0000"+
- "\u0007\u001c\u0000\u0007\u001d\u0000\u0007\u001e\u0000";
+ "R\u0007R\u0002S\u0007S\u0002T\u0007T\u0002U\u0007U\u0002V\u0007V\u0001"+
+ "\u0000\u0001\u0000\u0003\u0000\u00b3\b\u0000\u0001\u0001\u0001\u0001\u0001"+
+ "\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0005"+
+ "\u0003\u00bd\b\u0003\n\u0003\f\u0003\u00c0\t\u0003\u0001\u0003\u0001\u0003"+
+ "\u0001\u0003\u0003\u0003\u00c5\b\u0003\u0001\u0004\u0001\u0004\u0001\u0005"+
+ "\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001\b\u0001"+
+ "\b\u0001\t\u0001\t\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001\f\u0001"+
+ "\f\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f\u0001"+
+ "\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001"+
+ "\u0013\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015\u0001"+
+ "\u0015\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017\u0001\u0018\u0001"+
+ "\u0018\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0018\u0001"+
+ "\u0018\u0001\u0019\u0001\u0019\u0001\u0019\u0003\u0019\u00fb\b\u0019\u0001"+
+ "\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0003\u001a\u0102"+
+ "\b\u001a\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0003"+
+ "\u001b\u0109\b\u001b\u0003\u001b\u010b\b\u001b\u0003\u001b\u010d\b\u001b"+
+ "\u0003\u001b\u010f\b\u001b\u0001\u001c\u0001\u001c\u0001\u001c\u0005\u001c"+
+ "\u0114\b\u001c\n\u001c\f\u001c\u0117\t\u001c\u0001\u001c\u0001\u001c\u0001"+
+ "\u001d\u0001\u001d\u0001\u001d\u0005\u001d\u011e\b\u001d\n\u001d\f\u001d"+
+ "\u0121\t\u001d\u0001\u001d\u0001\u001d\u0001\u001e\u0001\u001e\u0003\u001e"+
+ "\u0127\b\u001e\u0001\u001f\u0001\u001f\u0001 \u0001 \u0001!\u0004!\u012e"+
+ "\b!\u000b!\f!\u012f\u0001\"\u0001\"\u0001\"\u0003\"\u0135\b\"\u0001#\u0001"+
+ "#\u0001#\u0001#\u0001#\u0001$\u0001$\u0001$\u0001$\u0001$\u0001$\u0001"+
+ "%\u0001%\u0005%\u0144\b%\n%\f%\u0147\t%\u0001%\u0001%\u0001&\u0001&\u0001"+
+ "&\u0001\'\u0001\'\u0001\'\u0001\'\u0001\'\u0001(\u0001(\u0001(\u0001("+
+ "\u0001(\u0001)\u0001)\u0001)\u0001)\u0001*\u0001*\u0001*\u0001*\u0001"+
+ "*\u0001+\u0001+\u0001+\u0001+\u0001,\u0001,\u0001,\u0001-\u0001-\u0001"+
+ "-\u0001-\u0001.\u0001.\u0001/\u0001/\u0001/\u0001/\u0005/\u0172\b/\n/"+
+ "\f/\u0175\t/\u00010\u00010\u00011\u00011\u00012\u00042\u017c\b2\u000b"+
+ "2\f2\u017d\u00012\u00012\u00013\u00043\u0183\b3\u000b3\f3\u0184\u0001"+
+ "3\u00013\u00014\u00014\u00014\u00014\u00015\u00015\u00015\u00015\u0001"+
+ "6\u00016\u00017\u00017\u00018\u00018\u00019\u00019\u0001:\u0001:\u0001"+
+ ";\u0001;\u0001<\u0001<\u0001=\u0001=\u0001>\u0001>\u0001?\u0001?\u0001"+
+ "@\u0001@\u0001A\u0001A\u0001B\u0001B\u0001C\u0001C\u0001D\u0001D\u0001"+
+ "E\u0001E\u0001F\u0001F\u0001G\u0001G\u0001H\u0001H\u0001H\u0005H\u01b8"+
+ "\bH\nH\fH\u01bb\tH\u0001I\u0001I\u0001I\u0004I\u01c0\bI\u000bI\fI\u01c1"+
+ "\u0001I\u0003I\u01c5\bI\u0001I\u0001I\u0001J\u0001J\u0001J\u0001J\u0001"+
+ "K\u0001K\u0001L\u0001L\u0001M\u0004M\u01d2\bM\u000bM\fM\u01d3\u0001M\u0001"+
+ "M\u0001N\u0004N\u01d9\bN\u000bN\fN\u01da\u0001N\u0001N\u0001O\u0001O\u0001"+
+ "O\u0001O\u0001O\u0001P\u0001P\u0001P\u0001P\u0001Q\u0001Q\u0001Q\u0005"+
+ "Q\u01eb\bQ\nQ\fQ\u01ee\tQ\u0001Q\u0001Q\u0001R\u0001R\u0001R\u0001R\u0001"+
+ "S\u0001S\u0001S\u0001S\u0001T\u0001T\u0001T\u0001T\u0001U\u0001U\u0001"+
+ "U\u0001U\u0001V\u0001V\u0001V\u0001V\u0001\u00be\u0000W\u0002\u0000\u0004"+
+ "\u0000\u0006\u0000\b\u0000\n\u0000\f\u0000\u000e\u0000\u0010\u0000\u0012"+
+ "\u0000\u0014\u0000\u0016\u0000\u0018\u0000\u001a\u0000\u001c\u0000\u001e"+
+ "\u0000 \u0000\"\u0000$\u0000&\u0000(\u0000*\u0000,\u0000.\u00000\u0000"+
+ "2\u00004\u00006\u00008\u0000:\u0000<\u0000>\u0000@\u0000B\u0000D\u0000"+
+ "F\u0000H\u0000J\u0000L\u0001N\u0002P\u0003R\u0004T\u0005V\u0006X\u0007"+
+ "Z\b\\\t^\n`\u000bb\fd\rf\u000eh\u000fj\u0010l\u0011n\u0012p\u0013r\u0014"+
+ "t\u0015v\u0016x\u0017z\u0018|\u0019~\u001a\u0080\u001b\u0082\u001c\u0084"+
+ "\u001d\u0086\u001e\u0088\u001f\u008a \u008c!\u008e\"\u0090#\u0092$\u0094"+
+ "%\u0096&\u0098\u0000\u009a\u0000\u009c\'\u009e(\u00a0\u0000\u00a2\u0000"+
+ "\u00a4\u0000\u00a6\u0000\u00a8\u0000\u00aa\u0000\u00ac\u0000\u00ae)\u0002"+
+ "\u0000\u0001\t\u0002\u0000\t\t \u0002\u0000\n\n\f\r\r\u0000AZaz\u00c0"+
+ "\u00d6\u00d8\u00f6\u00f8\u02ff\u0370\u037d\u037f\u1fff\u200c\u200d\u2070"+
+ "\u218f\u2c00\u2fef\u3001\u8000\ud7ff\u8000\uf900\u8000\ufdcf\u8000\ufdf0"+
+ "\u8000\ufffd\u0003\u0000\u00b7\u00b7\u0300\u036f\u203f\u2040\b\u0000\""+
+ "\"\'\'\\\\bbffnnrrtt\u0004\u0000\n\n\r\r\'\'\\\\\u0004\u0000\n\n\r\r\""+
+ "\"\\\\\u0003\u000009AFaf\u0001\u000009\u01fd\u0000L\u0001\u0000\u0000"+
+ "\u0000\u0000N\u0001\u0000\u0000\u0000\u0000P\u0001\u0000\u0000\u0000\u0000"+
+ "R\u0001\u0000\u0000\u0000\u0000T\u0001\u0000\u0000\u0000\u0000V\u0001"+
+ "\u0000\u0000\u0000\u0000X\u0001\u0000\u0000\u0000\u0000Z\u0001\u0000\u0000"+
+ "\u0000\u0000\\\u0001\u0000\u0000\u0000\u0000^\u0001\u0000\u0000\u0000"+
+ "\u0000`\u0001\u0000\u0000\u0000\u0000b\u0001\u0000\u0000\u0000\u0000d"+
+ "\u0001\u0000\u0000\u0000\u0000f\u0001\u0000\u0000\u0000\u0000h\u0001\u0000"+
+ "\u0000\u0000\u0000j\u0001\u0000\u0000\u0000\u0000l\u0001\u0000\u0000\u0000"+
+ "\u0000n\u0001\u0000\u0000\u0000\u0000p\u0001\u0000\u0000\u0000\u0000r"+
+ "\u0001\u0000\u0000\u0000\u0000t\u0001\u0000\u0000\u0000\u0000v\u0001\u0000"+
+ "\u0000\u0000\u0000x\u0001\u0000\u0000\u0000\u0000z\u0001\u0000\u0000\u0000"+
+ "\u0000|\u0001\u0000\u0000\u0000\u0000~\u0001\u0000\u0000\u0000\u0000\u0080"+
+ "\u0001\u0000\u0000\u0000\u0000\u0082\u0001\u0000\u0000\u0000\u0000\u0084"+
+ "\u0001\u0000\u0000\u0000\u0000\u0086\u0001\u0000\u0000\u0000\u0000\u0088"+
+ "\u0001\u0000\u0000\u0000\u0000\u008a\u0001\u0000\u0000\u0000\u0000\u008c"+
+ "\u0001\u0000\u0000\u0000\u0000\u008e\u0001\u0000\u0000\u0000\u0000\u0090"+
+ "\u0001\u0000\u0000\u0000\u0000\u0092\u0001\u0000\u0000\u0000\u0000\u0094"+
+ "\u0001\u0000\u0000\u0000\u0000\u0096\u0001\u0000\u0000\u0000\u0001\u009c"+
+ "\u0001\u0000\u0000\u0000\u0001\u009e\u0001\u0000\u0000\u0000\u0001\u00a0"+
+ "\u0001\u0000\u0000\u0000\u0001\u00a2\u0001\u0000\u0000\u0000\u0001\u00a4"+
+ "\u0001\u0000\u0000\u0000\u0001\u00a6\u0001\u0000\u0000\u0000\u0001\u00a8"+
+ "\u0001\u0000\u0000\u0000\u0001\u00aa\u0001\u0000\u0000\u0000\u0001\u00ac"+
+ "\u0001\u0000\u0000\u0000\u0001\u00ae\u0001\u0000\u0000\u0000\u0002\u00b2"+
+ "\u0001\u0000\u0000\u0000\u0004\u00b4\u0001\u0000\u0000\u0000\u0006\u00b6"+
+ "\u0001\u0000\u0000\u0000\b\u00b8\u0001\u0000\u0000\u0000\n\u00c6\u0001"+
+ "\u0000\u0000\u0000\f\u00c8\u0001\u0000\u0000\u0000\u000e\u00ca\u0001\u0000"+
+ "\u0000\u0000\u0010\u00cc\u0001\u0000\u0000\u0000\u0012\u00ce\u0001\u0000"+
+ "\u0000\u0000\u0014\u00d0\u0001\u0000\u0000\u0000\u0016\u00d2\u0001\u0000"+
+ "\u0000\u0000\u0018\u00d4\u0001\u0000\u0000\u0000\u001a\u00d6\u0001\u0000"+
+ "\u0000\u0000\u001c\u00d8\u0001\u0000\u0000\u0000\u001e\u00da\u0001\u0000"+
+ "\u0000\u0000 \u00dc\u0001\u0000\u0000\u0000\"\u00de\u0001\u0000\u0000"+
+ "\u0000$\u00e0\u0001\u0000\u0000\u0000&\u00e2\u0001\u0000\u0000\u0000("+
+ "\u00e4\u0001\u0000\u0000\u0000*\u00e6\u0001\u0000\u0000\u0000,\u00e8\u0001"+
+ "\u0000\u0000\u0000.\u00eb\u0001\u0000\u0000\u00000\u00ed\u0001\u0000\u0000"+
+ "\u00002\u00ef\u0001\u0000\u0000\u00004\u00fa\u0001\u0000\u0000\u00006"+
+ "\u00fc\u0001\u0000\u0000\u00008\u0103\u0001\u0000\u0000\u0000:\u0110\u0001"+
+ "\u0000\u0000\u0000<\u011a\u0001\u0000\u0000\u0000>\u0126\u0001\u0000\u0000"+
+ "\u0000@\u0128\u0001\u0000\u0000\u0000B\u012a\u0001\u0000\u0000\u0000D"+
+ "\u012d\u0001\u0000\u0000\u0000F\u0131\u0001\u0000\u0000\u0000H\u0136\u0001"+
+ "\u0000\u0000\u0000J\u013b\u0001\u0000\u0000\u0000L\u0141\u0001\u0000\u0000"+
+ "\u0000N\u014a\u0001\u0000\u0000\u0000P\u014d\u0001\u0000\u0000\u0000R"+
+ "\u0152\u0001\u0000\u0000\u0000T\u0157\u0001\u0000\u0000\u0000V\u015b\u0001"+
+ "\u0000\u0000\u0000X\u0160\u0001\u0000\u0000\u0000Z\u0164\u0001\u0000\u0000"+
+ "\u0000\\\u0167\u0001\u0000\u0000\u0000^\u016b\u0001\u0000\u0000\u0000"+
+ "`\u016d\u0001\u0000\u0000\u0000b\u0176\u0001\u0000\u0000\u0000d\u0178"+
+ "\u0001\u0000\u0000\u0000f\u017b\u0001\u0000\u0000\u0000h\u0182\u0001\u0000"+
+ "\u0000\u0000j\u0188\u0001\u0000\u0000\u0000l\u018c\u0001\u0000\u0000\u0000"+
+ "n\u0190\u0001\u0000\u0000\u0000p\u0192\u0001\u0000\u0000\u0000r\u0194"+
+ "\u0001\u0000\u0000\u0000t\u0196\u0001\u0000\u0000\u0000v\u0198\u0001\u0000"+
+ "\u0000\u0000x\u019a\u0001\u0000\u0000\u0000z\u019c\u0001\u0000\u0000\u0000"+
+ "|\u019e\u0001\u0000\u0000\u0000~\u01a0\u0001\u0000\u0000\u0000\u0080\u01a2"+
+ "\u0001\u0000\u0000\u0000\u0082\u01a4\u0001\u0000\u0000\u0000\u0084\u01a6"+
+ "\u0001\u0000\u0000\u0000\u0086\u01a8\u0001\u0000\u0000\u0000\u0088\u01aa"+
+ "\u0001\u0000\u0000\u0000\u008a\u01ac\u0001\u0000\u0000\u0000\u008c\u01ae"+
+ "\u0001\u0000\u0000\u0000\u008e\u01b0\u0001\u0000\u0000\u0000\u0090\u01b2"+
+ "\u0001\u0000\u0000\u0000\u0092\u01b4\u0001\u0000\u0000\u0000\u0094\u01bc"+
+ "\u0001\u0000\u0000\u0000\u0096\u01c8\u0001\u0000\u0000\u0000\u0098\u01cc"+
+ "\u0001\u0000\u0000\u0000\u009a\u01ce\u0001\u0000\u0000\u0000\u009c\u01d1"+
+ "\u0001\u0000\u0000\u0000\u009e\u01d8\u0001\u0000\u0000\u0000\u00a0\u01de"+
+ "\u0001\u0000\u0000\u0000\u00a2\u01e3\u0001\u0000\u0000\u0000\u00a4\u01e7"+
+ "\u0001\u0000\u0000\u0000\u00a6\u01f1\u0001\u0000\u0000\u0000\u00a8\u01f5"+
+ "\u0001\u0000\u0000\u0000\u00aa\u01f9\u0001\u0000\u0000\u0000\u00ac\u01fd"+
+ "\u0001\u0000\u0000\u0000\u00ae\u0201\u0001\u0000\u0000\u0000\u00b0\u00b3"+
+ "\u0003\u0004\u0001\u0000\u00b1\u00b3\u0003\u0006\u0002\u0000\u00b2\u00b0"+
+ "\u0001\u0000\u0000\u0000\u00b2\u00b1\u0001\u0000\u0000\u0000\u00b3\u0003"+
+ "\u0001\u0000\u0000\u0000\u00b4\u00b5\u0007\u0000\u0000\u0000\u00b5\u0005"+
+ "\u0001\u0000\u0000\u0000\u00b6\u00b7\u0007\u0001\u0000\u0000\u00b7\u0007"+
+ "\u0001\u0000\u0000\u0000\u00b8\u00b9\u0005/\u0000\u0000\u00b9\u00ba\u0005"+
+ "*\u0000\u0000\u00ba\u00be\u0001\u0000\u0000\u0000\u00bb\u00bd\t\u0000"+
+ "\u0000\u0000\u00bc\u00bb\u0001\u0000\u0000\u0000\u00bd\u00c0\u0001\u0000"+
+ "\u0000\u0000\u00be\u00bf\u0001\u0000\u0000\u0000\u00be\u00bc\u0001\u0000"+
+ "\u0000\u0000\u00bf\u00c4\u0001\u0000\u0000\u0000\u00c0\u00be\u0001\u0000"+
+ "\u0000\u0000\u00c1\u00c2\u0005*\u0000\u0000\u00c2\u00c5\u0005/\u0000\u0000"+
+ "\u00c3\u00c5\u0005\u0000\u0000\u0001\u00c4\u00c1\u0001\u0000\u0000\u0000"+
+ "\u00c4\u00c3\u0001\u0000\u0000\u0000\u00c5\t\u0001\u0000\u0000\u0000\u00c6"+
+ "\u00c7\u0005\\\u0000\u0000\u00c7\u000b\u0001\u0000\u0000\u0000\u00c8\u00c9"+
+ "\u0005\'\u0000\u0000\u00c9\r\u0001\u0000\u0000\u0000\u00ca\u00cb\u0005"+
+ "\"\u0000\u0000\u00cb\u000f\u0001\u0000\u0000\u0000\u00cc\u00cd\u0005_"+
+ "\u0000\u0000\u00cd\u0011\u0001\u0000\u0000\u0000\u00ce\u00cf\u0005,\u0000"+
+ "\u0000\u00cf\u0013\u0001\u0000\u0000\u0000\u00d0\u00d1\u0005;\u0000\u0000"+
+ "\u00d1\u0015\u0001\u0000\u0000\u0000\u00d2\u00d3\u0005|\u0000\u0000\u00d3"+
+ "\u0017\u0001\u0000\u0000\u0000\u00d4\u00d5\u0005.\u0000\u0000\u00d5\u0019"+
+ "\u0001\u0000\u0000\u0000\u00d6\u00d7\u0005(\u0000\u0000\u00d7\u001b\u0001"+
+ "\u0000\u0000\u0000\u00d8\u00d9\u0005)\u0000\u0000\u00d9\u001d\u0001\u0000"+
+ "\u0000\u0000\u00da\u00db\u0005[\u0000\u0000\u00db\u001f\u0001\u0000\u0000"+
+ "\u0000\u00dc\u00dd\u0005]\u0000\u0000\u00dd!\u0001\u0000\u0000\u0000\u00de"+
+ "\u00df\u0005*\u0000\u0000\u00df#\u0001\u0000\u0000\u0000\u00e0\u00e1\u0005"+
+ "/\u0000\u0000\u00e1%\u0001\u0000\u0000\u0000\u00e2\u00e3\u0005%\u0000"+
+ "\u0000\u00e3\'\u0001\u0000\u0000\u0000\u00e4\u00e5\u0005+\u0000\u0000"+
+ "\u00e5)\u0001\u0000\u0000\u0000\u00e6\u00e7\u0005-\u0000\u0000\u00e7+"+
+ "\u0001\u0000\u0000\u0000\u00e8\u00e9\u0005?\u0000\u0000\u00e9\u00ea\u0005"+
+ "?\u0000\u0000\u00ea-\u0001\u0000\u0000\u0000\u00eb\u00ec\u0005<\u0000"+
+ "\u0000\u00ec/\u0001\u0000\u0000\u0000\u00ed\u00ee\u0005>\u0000\u0000\u00ee"+
+ "1\u0001\u0000\u0000\u0000\u00ef\u00f0\u0005d\u0000\u0000\u00f0\u00f1\u0005"+
+ "e\u0000\u0000\u00f1\u00f2\u0005f\u0000\u0000\u00f2\u00f3\u0005a\u0000"+
+ "\u0000\u00f3\u00f4\u0005u\u0000\u0000\u00f4\u00f5\u0005l\u0000\u0000\u00f5"+
+ "\u00f6\u0005t\u0000\u0000\u00f63\u0001\u0000\u0000\u0000\u00f7\u00fb\u0007"+
+ "\u0002\u0000\u0000\u00f8\u00fb\u0003\u0010\u0007\u0000\u00f9\u00fb\u0007"+
+ "\u0003\u0000\u0000\u00fa\u00f7\u0001\u0000\u0000\u0000\u00fa\u00f8\u0001"+
+ "\u0000\u0000\u0000\u00fa\u00f9\u0001\u0000\u0000\u0000\u00fb5\u0001\u0000"+
+ "\u0000\u0000\u00fc\u0101\u0003\n\u0004\u0000\u00fd\u0102\u0007\u0004\u0000"+
+ "\u0000\u00fe\u0102\u00038\u001b\u0000\u00ff\u0102\t\u0000\u0000\u0000"+
+ "\u0100\u0102\u0005\u0000\u0000\u0001\u0101\u00fd\u0001\u0000\u0000\u0000"+
+ "\u0101\u00fe\u0001\u0000\u0000\u0000\u0101\u00ff\u0001\u0000\u0000\u0000"+
+ "\u0101\u0100\u0001\u0000\u0000\u0000\u01027\u0001\u0000\u0000\u0000\u0103"+
+ "\u010e\u0005u\u0000\u0000\u0104\u010c\u0003@\u001f\u0000\u0105\u010a\u0003"+
+ "@\u001f\u0000\u0106\u0108\u0003@\u001f\u0000\u0107\u0109\u0003@\u001f"+
+ "\u0000\u0108\u0107\u0001\u0000\u0000\u0000\u0108\u0109\u0001\u0000\u0000"+
+ "\u0000\u0109\u010b\u0001\u0000\u0000\u0000\u010a\u0106\u0001\u0000\u0000"+
+ "\u0000\u010a\u010b\u0001\u0000\u0000\u0000\u010b\u010d\u0001\u0000\u0000"+
+ "\u0000\u010c\u0105\u0001\u0000\u0000\u0000\u010c\u010d\u0001\u0000\u0000"+
+ "\u0000\u010d\u010f\u0001\u0000\u0000\u0000\u010e\u0104\u0001\u0000\u0000"+
+ "\u0000\u010e\u010f\u0001\u0000\u0000\u0000\u010f9\u0001\u0000\u0000\u0000"+
+ "\u0110\u0115\u0003\f\u0005\u0000\u0111\u0114\u00036\u001a\u0000\u0112"+
+ "\u0114\b\u0005\u0000\u0000\u0113\u0111\u0001\u0000\u0000\u0000\u0113\u0112"+
+ "\u0001\u0000\u0000\u0000\u0114\u0117\u0001\u0000\u0000\u0000\u0115\u0113"+
+ "\u0001\u0000\u0000\u0000\u0115\u0116\u0001\u0000\u0000\u0000\u0116\u0118"+
+ "\u0001\u0000\u0000\u0000\u0117\u0115\u0001\u0000\u0000\u0000\u0118\u0119"+
+ "\u0003\f\u0005\u0000\u0119;\u0001\u0000\u0000\u0000\u011a\u011f\u0003"+
+ "\u000e\u0006\u0000\u011b\u011e\u00036\u001a\u0000\u011c\u011e\b\u0006"+
+ "\u0000\u0000\u011d\u011b\u0001\u0000\u0000\u0000\u011d\u011c\u0001\u0000"+
+ "\u0000\u0000\u011e\u0121\u0001\u0000\u0000\u0000\u011f\u011d\u0001\u0000"+
+ "\u0000\u0000\u011f\u0120\u0001\u0000\u0000\u0000\u0120\u0122\u0001\u0000"+
+ "\u0000\u0000\u0121\u011f\u0001\u0000\u0000\u0000\u0122\u0123\u0003\u000e"+
+ "\u0006\u0000\u0123=\u0001\u0000\u0000\u0000\u0124\u0127\u0003H#\u0000"+
+ "\u0125\u0127\u0003J$\u0000\u0126\u0124\u0001\u0000\u0000\u0000\u0126\u0125"+
+ "\u0001\u0000\u0000\u0000\u0127?\u0001\u0000\u0000\u0000\u0128\u0129\u0007"+
+ "\u0007\u0000\u0000\u0129A\u0001\u0000\u0000\u0000\u012a\u012b\u0007\b"+
+ "\u0000\u0000\u012bC\u0001\u0000\u0000\u0000\u012c\u012e\u0003B \u0000"+
+ "\u012d\u012c\u0001\u0000\u0000\u0000\u012e\u012f\u0001\u0000\u0000\u0000"+
+ "\u012f\u012d\u0001\u0000\u0000\u0000\u012f\u0130\u0001\u0000\u0000\u0000"+
+ "\u0130E\u0001\u0000\u0000\u0000\u0131\u0132\u0003D!\u0000\u0132\u0134"+
+ "\u0003\u0018\u000b\u0000\u0133\u0135\u0003D!\u0000\u0134\u0133\u0001\u0000"+
+ "\u0000\u0000\u0134\u0135\u0001\u0000\u0000\u0000\u0135G\u0001\u0000\u0000"+
+ "\u0000\u0136\u0137\u0005t\u0000\u0000\u0137\u0138\u0005r\u0000\u0000\u0138"+
+ "\u0139\u0005u\u0000\u0000\u0139\u013a\u0005e\u0000\u0000\u013aI\u0001"+
+ "\u0000\u0000\u0000\u013b\u013c\u0005f\u0000\u0000\u013c\u013d\u0005a\u0000"+
+ "\u0000\u013d\u013e\u0005l\u0000\u0000\u013e\u013f\u0005s\u0000\u0000\u013f"+
+ "\u0140\u0005e\u0000\u0000\u0140K\u0001\u0000\u0000\u0000\u0141\u0145\u0003"+
+ "\u0016\n\u0000\u0142\u0144\u0003\u0004\u0001\u0000\u0143\u0142\u0001\u0000"+
+ "\u0000\u0000\u0144\u0147\u0001\u0000\u0000\u0000\u0145\u0143\u0001\u0000"+
+ "\u0000\u0000\u0145\u0146\u0001\u0000\u0000\u0000\u0146\u0148\u0001\u0000"+
+ "\u0000\u0000\u0147\u0145\u0001\u0000\u0000\u0000\u0148\u0149\u00032\u0018"+
+ "\u0000\u0149M\u0001\u0000\u0000\u0000\u014a\u014b\u0005i\u0000\u0000\u014b"+
+ "\u014c\u0005f\u0000\u0000\u014cO\u0001\u0000\u0000\u0000\u014d\u014e\u0005"+
+ "t\u0000\u0000\u014e\u014f\u0005h\u0000\u0000\u014f\u0150\u0005e\u0000"+
+ "\u0000\u0150\u0151\u0005n\u0000\u0000\u0151Q\u0001\u0000\u0000\u0000\u0152"+
+ "\u0153\u0005e\u0000\u0000\u0153\u0154\u0005l\u0000\u0000\u0154\u0155\u0005"+
+ "s\u0000\u0000\u0155\u0156\u0005e\u0000\u0000\u0156S\u0001\u0000\u0000"+
+ "\u0000\u0157\u0158\u0005e\u0000\u0000\u0158\u0159\u0005n\u0000\u0000\u0159"+
+ "\u015a\u0005d\u0000\u0000\u015aU\u0001\u0000\u0000\u0000\u015b\u015c\u0005"+
+ "w\u0000\u0000\u015c\u015d\u0005i\u0000\u0000\u015d\u015e\u0005t\u0000"+
+ "\u0000\u015e\u015f\u0005h\u0000\u0000\u015fW\u0001\u0000\u0000\u0000\u0160"+
+ "\u0161\u0005a\u0000\u0000\u0161\u0162\u0005n\u0000\u0000\u0162\u0163\u0005"+
+ "d\u0000\u0000\u0163Y\u0001\u0000\u0000\u0000\u0164\u0165\u0005o\u0000"+
+ "\u0000\u0165\u0166\u0005r\u0000\u0000\u0166[\u0001\u0000\u0000\u0000\u0167"+
+ "\u0168\u0005n\u0000\u0000\u0168\u0169\u0005o\u0000\u0000\u0169\u016a\u0005"+
+ "t\u0000\u0000\u016a]\u0001\u0000\u0000\u0000\u016b\u016c\u0005!\u0000"+
+ "\u0000\u016c_\u0001\u0000\u0000\u0000\u016d\u016e\u0005$\u0000\u0000\u016e"+
+ "\u0173\u00034\u0019\u0000\u016f\u0172\u00034\u0019\u0000\u0170\u0172\u0003"+
+ "B \u0000\u0171\u016f\u0001\u0000\u0000\u0000\u0171\u0170\u0001\u0000\u0000"+
+ "\u0000\u0172\u0175\u0001\u0000\u0000\u0000\u0173\u0171\u0001\u0000\u0000"+
+ "\u0000\u0173\u0174\u0001\u0000\u0000\u0000\u0174a\u0001\u0000\u0000\u0000"+
+ "\u0175\u0173\u0001\u0000\u0000\u0000\u0176\u0177\u0005$\u0000\u0000\u0177"+
+ "c\u0001\u0000\u0000\u0000\u0178\u0179\u0003\b\u0003\u0000\u0179e\u0001"+
+ "\u0000\u0000\u0000\u017a\u017c\u0003\u0004\u0001\u0000\u017b\u017a\u0001"+
+ "\u0000\u0000\u0000\u017c\u017d\u0001\u0000\u0000\u0000\u017d\u017b\u0001"+
+ "\u0000\u0000\u0000\u017d\u017e\u0001\u0000\u0000\u0000\u017e\u017f\u0001"+
+ "\u0000\u0000\u0000\u017f\u0180\u00062\u0000\u0000\u0180g\u0001\u0000\u0000"+
+ "\u0000\u0181\u0183\u0003\u0006\u0002\u0000\u0182\u0181\u0001\u0000\u0000"+
+ "\u0000\u0183\u0184\u0001\u0000\u0000\u0000\u0184\u0182\u0001\u0000\u0000"+
+ "\u0000\u0184\u0185\u0001\u0000\u0000\u0000\u0185\u0186\u0001\u0000\u0000"+
+ "\u0000\u0186\u0187\u00063\u0000\u0000\u0187i\u0001\u0000\u0000\u0000\u0188"+
+ "\u0189\u0003\u0098K\u0000\u0189\u018a\u0001\u0000\u0000\u0000\u018a\u018b"+
+ "\u00064\u0001\u0000\u018bk\u0001\u0000\u0000\u0000\u018c\u018d\u0003\u009a"+
+ "L\u0000\u018d\u018e\u0001\u0000\u0000\u0000\u018e\u018f\u00065\u0002\u0000"+
+ "\u018fm\u0001\u0000\u0000\u0000\u0190\u0191\u0003\u0018\u000b\u0000\u0191"+
+ "o\u0001\u0000\u0000\u0000\u0192\u0193\u0003\u001a\f\u0000\u0193q\u0001"+
+ "\u0000\u0000\u0000\u0194\u0195\u0003\u001c\r\u0000\u0195s\u0001\u0000"+
+ "\u0000\u0000\u0196\u0197\u0003\u001e\u000e\u0000\u0197u\u0001\u0000\u0000"+
+ "\u0000\u0198\u0199\u0003 \u000f\u0000\u0199w\u0001\u0000\u0000\u0000\u019a"+
+ "\u019b\u0003,\u0015\u0000\u019by\u0001\u0000\u0000\u0000\u019c\u019d\u0003"+
+ "\u0014\t\u0000\u019d{\u0001\u0000\u0000\u0000\u019e\u019f\u0003\u0012"+
+ "\b\u0000\u019f}\u0001\u0000\u0000\u0000\u01a0\u01a1\u0003\"\u0010\u0000"+
+ "\u01a1\u007f\u0001\u0000\u0000\u0000\u01a2\u01a3\u0003$\u0011\u0000\u01a3"+
+ "\u0081\u0001\u0000\u0000\u0000\u01a4\u01a5\u0003&\u0012\u0000\u01a5\u0083"+
+ "\u0001\u0000\u0000\u0000\u01a6\u01a7\u0003(\u0013\u0000\u01a7\u0085\u0001"+
+ "\u0000\u0000\u0000\u01a8\u01a9\u0003*\u0014\u0000\u01a9\u0087\u0001\u0000"+
+ "\u0000\u0000\u01aa\u01ab\u0003<\u001d\u0000\u01ab\u0089\u0001\u0000\u0000"+
+ "\u0000\u01ac\u01ad\u0003:\u001c\u0000\u01ad\u008b\u0001\u0000\u0000\u0000"+
+ "\u01ae\u01af\u0003D!\u0000\u01af\u008d\u0001\u0000\u0000\u0000\u01b0\u01b1"+
+ "\u0003F\"\u0000\u01b1\u008f\u0001\u0000\u0000\u0000\u01b2\u01b3\u0003"+
+ ">\u001e\u0000\u01b3\u0091\u0001\u0000\u0000\u0000\u01b4\u01b9\u00034\u0019"+
+ "\u0000\u01b5\u01b8\u00034\u0019\u0000\u01b6\u01b8\u0003B \u0000\u01b7"+
+ "\u01b5\u0001\u0000\u0000\u0000\u01b7\u01b6\u0001\u0000\u0000\u0000\u01b8"+
+ "\u01bb\u0001\u0000\u0000\u0000\u01b9\u01b7\u0001\u0000\u0000\u0000\u01b9"+
+ "\u01ba\u0001\u0000\u0000\u0000\u01ba\u0093\u0001\u0000\u0000\u0000\u01bb"+
+ "\u01b9\u0001\u0000\u0000\u0000\u01bc\u01bf\u0003.\u0016\u0000\u01bd\u01c0"+
+ "\u00034\u0019\u0000\u01be\u01c0\u0003n6\u0000\u01bf\u01bd\u0001\u0000"+
+ "\u0000\u0000\u01bf\u01be\u0001\u0000\u0000\u0000\u01c0\u01c1\u0001\u0000"+
+ "\u0000\u0000\u01c1\u01bf\u0001\u0000\u0000\u0000\u01c1\u01c2\u0001\u0000"+
+ "\u0000\u0000\u01c2\u01c4\u0001\u0000\u0000\u0000\u01c3\u01c5\u0003\u0094"+
+ "I\u0000\u01c4\u01c3\u0001\u0000\u0000\u0000\u01c4\u01c5\u0001\u0000\u0000"+
+ "\u0000\u01c5\u01c6\u0001\u0000\u0000\u0000\u01c6\u01c7\u00030\u0017\u0000"+
+ "\u01c7\u0095\u0001\u0000\u0000\u0000\u01c8\u01c9\u0003\u0004\u0001\u0000"+
+ "\u01c9\u01ca\u0001\u0000\u0000\u0000\u01ca\u01cb\u0006J\u0000\u0000\u01cb"+
+ "\u0097\u0001\u0000\u0000\u0000\u01cc\u01cd\u0005{\u0000\u0000\u01cd\u0099"+
+ "\u0001\u0000\u0000\u0000\u01ce\u01cf\u0005}\u0000\u0000\u01cf\u009b\u0001"+
+ "\u0000\u0000\u0000\u01d0\u01d2\u0003\u0004\u0001\u0000\u01d1\u01d0\u0001"+
+ "\u0000\u0000\u0000\u01d2\u01d3\u0001\u0000\u0000\u0000\u01d3\u01d1\u0001"+
+ "\u0000\u0000\u0000\u01d3\u01d4\u0001\u0000\u0000\u0000\u01d4\u01d5\u0001"+
+ "\u0000\u0000\u0000\u01d5\u01d6\u0006M\u0000\u0000\u01d6\u009d\u0001\u0000"+
+ "\u0000\u0000\u01d7\u01d9\u0003\u0006\u0002\u0000\u01d8\u01d7\u0001\u0000"+
+ "\u0000\u0000\u01d9\u01da\u0001\u0000\u0000\u0000\u01da\u01d8\u0001\u0000"+
+ "\u0000\u0000\u01da\u01db\u0001\u0000\u0000\u0000\u01db\u01dc\u0001\u0000"+
+ "\u0000\u0000\u01dc\u01dd\u0006N\u0000\u0000\u01dd\u009f\u0001\u0000\u0000"+
+ "\u0000\u01de\u01df\u0003\u009aL\u0000\u01df\u01e0\u0001\u0000\u0000\u0000"+
+ "\u01e0\u01e1\u0006O\u0002\u0000\u01e1\u01e2\u0006O\u0003\u0000\u01e2\u00a1"+
+ "\u0001\u0000\u0000\u0000\u01e3\u01e4\u0003\u0012\b\u0000\u01e4\u01e5\u0001"+
+ "\u0000\u0000\u0000\u01e5\u01e6\u0006P\u0004\u0000\u01e6\u00a3\u0001\u0000"+
+ "\u0000\u0000\u01e7\u01ec\u00034\u0019\u0000\u01e8\u01eb\u00034\u0019\u0000"+
+ "\u01e9\u01eb\u0003B \u0000\u01ea\u01e8\u0001\u0000\u0000\u0000\u01ea\u01e9"+
+ "\u0001\u0000\u0000\u0000\u01eb\u01ee\u0001\u0000\u0000\u0000\u01ec\u01ea"+
+ "\u0001\u0000\u0000\u0000\u01ec\u01ed\u0001\u0000\u0000\u0000\u01ed\u01ef"+
+ "\u0001\u0000\u0000\u0000\u01ee\u01ec\u0001\u0000\u0000\u0000\u01ef\u01f0"+
+ "\u0006Q\u0005\u0000\u01f0\u00a5\u0001\u0000\u0000\u0000\u01f1\u01f2\u0003"+
+ "<\u001d\u0000\u01f2\u01f3\u0001\u0000\u0000\u0000\u01f3\u01f4\u0006R\u0006"+
+ "\u0000\u01f4\u00a7\u0001\u0000\u0000\u0000\u01f5\u01f6\u0003:\u001c\u0000"+
+ "\u01f6\u01f7\u0001\u0000\u0000\u0000\u01f7\u01f8\u0006S\u0007\u0000\u01f8"+
+ "\u00a9\u0001\u0000\u0000\u0000\u01f9\u01fa\u0003D!\u0000\u01fa\u01fb\u0001"+
+ "\u0000\u0000\u0000\u01fb\u01fc\u0006T\b\u0000\u01fc\u00ab\u0001\u0000"+
+ "\u0000\u0000\u01fd\u01fe\u0003F\"\u0000\u01fe\u01ff\u0001\u0000\u0000"+
+ "\u0000\u01ff\u0200\u0006U\t\u0000\u0200\u00ad\u0001\u0000\u0000\u0000"+
+ "\u0201\u0202\u0007\u0000\u0000\u0000\u0202\u0203\u0001\u0000\u0000\u0000"+
+ "\u0203\u0204\u0006V\u0000\u0000\u0204\u00af\u0001\u0000\u0000\u0000 \u0000"+
+ "\u0001\u00b2\u00be\u00c4\u00fa\u0101\u0108\u010a\u010c\u010e\u0113\u0115"+
+ "\u011d\u011f\u0126\u012f\u0134\u0145\u0171\u0173\u017d\u0184\u01b7\u01b9"+
+ "\u01bf\u01c1\u01c4\u01d3\u01da\u01ea\u01ec\n\u0006\u0000\u0000\u0005\u0001"+
+ "\u0000\u0004\u0000\u0000\u0007\u0011\u0000\u0007\u0019\u0000\u0007$\u0000"+
+ "\u0007\u001f\u0000\u0007 \u0000\u0007!\u0000\u0007\"\u0000";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
diff --git a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexerExpression.tokens b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexerExpression.tokens
index d384822c9..c45df57c8 100644
--- a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexerExpression.tokens
+++ b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexerExpression.tokens
@@ -4,40 +4,48 @@ THEN=3
ELSE=4
END=5
WITH=6
-VAR_ID=7
-ROOT=8
-BLOCK_COMMENT=9
-HORZ_WS=10
-VERT_WS=11
-LBRACE=12
-RBRACE=13
-DOT=14
-LPAREN=15
-RPAREN=16
-LBRACK=17
-RBRACK=18
-DQUESTION=19
-SEMI=20
-COMMA=21
-STAR=22
-SLASH=23
-PERCENT=24
-PLUS=25
-MINUS=26
-DSTRING=27
-SSTRING=28
-DECDIGITS=29
-FLOAT=30
-BOOLEAN=31
-ID=32
-CAST_TYPE=33
-ERR_CHAR=34
-C_HORZ_WS=35
-C_VERT_WS=36
-CERR_CHAR=37
+AND=7
+OR=8
+NOT=9
+BANG=10
+VAR_ID=11
+ROOT=12
+BLOCK_COMMENT=13
+HORZ_WS=14
+VERT_WS=15
+LBRACE=16
+RBRACE=17
+DOT=18
+LPAREN=19
+RPAREN=20
+LBRACK=21
+RBRACK=22
+DQUESTION=23
+SEMI=24
+COMMA=25
+STAR=26
+SLASH=27
+PERCENT=28
+PLUS=29
+MINUS=30
+DSTRING=31
+SSTRING=32
+DECDIGITS=33
+FLOAT=34
+BOOLEAN=35
+ID=36
+CAST_TYPE=37
+ERR_CHAR=38
+C_HORZ_WS=39
+C_VERT_WS=40
+CERR_CHAR=41
'if'=2
'then'=3
'else'=4
'end'=5
'with'=6
-'$'=8
+'and'=7
+'or'=8
+'not'=9
+'!'=10
+'$'=12
diff --git a/oap-formats/oap-template/src/main/java/oap/template/RuntimeTemplate.java b/oap-formats/oap-template/src/main/java/oap/template/RuntimeTemplate.java
new file mode 100644
index 000000000..69f4fcdea
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/RuntimeTemplate.java
@@ -0,0 +1,72 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template;
+
+import oap.template.render.AstRenderRoot;
+import oap.template.runtime.RuntimeContext;
+
+/**
+ * A {@link Template} implementation that interprets the AST directly at runtime
+ * using Java reflection — no code generation or compilation required.
+ *
+ * Use {@link TemplateEngine#getRuntimeTemplate} to obtain an instance.
+ */
+public class RuntimeTemplate>
+ implements Template {
+
+ private final TA acc;
+ private final AstRenderRoot ast;
+
+ public RuntimeTemplate( TA acc, AstRenderRoot ast ) {
+ this.acc = acc;
+ this.ast = ast;
+ }
+
+ @Override
+ public TA render( TIn obj, boolean eol ) {
+ TA newAcc = acc.newInstance();
+ try {
+ ast.interpret( RuntimeContext.root( obj, newAcc ) );
+ } catch( TemplateException e ) {
+ throw e;
+ } catch( Exception e ) {
+ throw new TemplateException( e );
+ }
+ return newAcc.addEol( eol );
+ }
+
+ @Override
+ public TA render( TIn obj, boolean eol, TOutMutable tOut ) {
+ TA newAcc = acc.newInstance( tOut );
+ try {
+ ast.interpret( RuntimeContext.root( obj, newAcc ) );
+ } catch( TemplateException e ) {
+ throw e;
+ } catch( Exception e ) {
+ throw new TemplateException( e );
+ }
+ return newAcc.addEol( eol );
+ }
+}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/TemplateConditionHelper.java b/oap-formats/oap-template/src/main/java/oap/template/TemplateConditionHelper.java
new file mode 100644
index 000000000..0ed3ff089
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/TemplateConditionHelper.java
@@ -0,0 +1,44 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template;
+
+import javax.annotation.Nullable;
+import java.lang.reflect.Array;
+import java.util.Collection;
+import java.util.Map;
+
+public final class TemplateConditionHelper {
+ private TemplateConditionHelper() {}
+
+ public static boolean isTruthy( @Nullable Object value ) {
+ if( value == null ) return false;
+ if( value instanceof Boolean b ) return b;
+ if( value instanceof String s ) return !s.isEmpty();
+ if( value instanceof Collection> c ) return !c.isEmpty();
+ if( value instanceof Map, ?> m ) return !m.isEmpty();
+ if( value.getClass().isArray() ) return Array.getLength( value ) > 0;
+ return true;
+ }
+}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/TemplateEngine.java b/oap-formats/oap-template/src/main/java/oap/template/TemplateEngine.java
index 46eda98d7..bbc8312b8 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/TemplateEngine.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/TemplateEngine.java
@@ -216,6 +216,59 @@ private void loadFunctions() {
}
}
+ public > Template
+ getRuntimeTemplate( String name, TypeRef type, String template, TA acc ) {
+ return getRuntimeTemplate( name, type, template, acc, Map.of(), ErrorStrategy.ERROR, null );
+ }
+
+ public > Template
+ getRuntimeTemplate( String name, TypeRef type, String template, TA acc, Consumer postProcess ) {
+ return getRuntimeTemplate( name, type, template, acc, Map.of(), ErrorStrategy.ERROR, postProcess );
+ }
+
+ public > Template
+ getRuntimeTemplate( String name, TypeRef type, String template, TA acc, Map aliases, Consumer postProcess ) {
+ return getRuntimeTemplate( name, type, template, acc, aliases, ErrorStrategy.ERROR, postProcess );
+ }
+
+ public > Template
+ getRuntimeTemplate( String name, TypeRef type, String template, TA acc, ErrorStrategy errorStrategy, Consumer postProcess ) {
+ return getRuntimeTemplate( name, type, template, acc, Map.of(), errorStrategy, postProcess );
+ }
+
+ public > Template
+ getRuntimeTemplate( String name, TypeRef type, String template, TA acc, Map aliases, ErrorStrategy errorStrategy ) {
+ return getRuntimeTemplate( name, type, template, acc, aliases, errorStrategy, null );
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public > Template
+ getRuntimeTemplate( String name, TypeRef type, String template, TA acc,
+ Map aliases, ErrorStrategy errorStrategy, Consumer postProcess ) {
+ Objects.requireNonNull( template );
+ Objects.requireNonNull( acc );
+
+ try {
+ TemplateLexer lexer = new TemplateLexer( CharStreams.fromString( template ) );
+ TemplateGrammar grammar = new TemplateGrammar( new BufferedTokenStream( lexer ), builtInFunction, errorStrategy );
+ if( errorStrategy == ErrorStrategy.ERROR ) {
+ lexer.addErrorListener( ThrowingErrorListener.INSTANCE );
+ grammar.addErrorListener( ThrowingErrorListener.INSTANCE );
+ }
+ Elements elements = grammar.elements( aliases ).ret;
+
+ AstRenderRoot ast = TemplateAstUtils.toAst( elements, new TemplateType( type.type() ), builtInFunction, errorStrategy );
+
+ if( postProcess != null ) postProcess.accept( ast );
+
+ return new RuntimeTemplate<>( acc, ast );
+ } catch( TemplateException e ) {
+ throw e;
+ } catch( Exception e ) {
+ throw new TemplateException( e );
+ }
+ }
+
public long getCacheSize() {
return templates.size();
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRender.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRender.java
index 27a6ce296..24c6678a8 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRender.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRender.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
import java.util.ArrayList;
import java.util.List;
@@ -41,6 +42,9 @@ public AstRender( TemplateType type ) {
public abstract void render( Render render );
+ /** Interpret this node against the live context, writing output to {@code ctx.acc}. */
+ public abstract void interpret( RuntimeContext ctx );
+
public void addChild( AstRender astRender ) {
children.add( astRender );
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockIf.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockIf.java
index f82ef81a2..7db7a1099 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockIf.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockIf.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
import javax.annotation.Nullable;
import java.util.List;
@@ -71,4 +72,15 @@ public void render( Render render ) {
render.ntab().append( "}" );
}
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ boolean[] capture = { false };
+ conditionAst.interpret( ctx.withBooleanCapture( capture ) );
+ if( capture[0] ) {
+ thenChildren.forEach( c -> c.interpret( ctx ) );
+ } else if( elseChildren != null ) {
+ elseChildren.forEach( c -> c.interpret( ctx ) );
+ }
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockRange.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockRange.java
index e0f8d0d20..45b3053f8 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockRange.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockRange.java
@@ -25,9 +25,12 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
import javax.annotation.Nullable;
+import java.util.Collection;
import java.util.List;
+import java.util.Map;
/**
* Block range over a collection or map.
@@ -148,4 +151,62 @@ private void renderMap( Render render, Render outerRender, String collVar ) {
for( AstRender child : bodyChildren ) child.render( bodyRender );
outerRender.ntab().append( "}" );
}
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public void interpret( RuntimeContext ctx ) {
+ Object[] capture = { null };
+ collectionAst.interpret( ctx.withScopeCapture( capture ) );
+ Object coll = capture[0];
+
+ boolean nonEmpty = mode == Mode.MAP_KEY_VALUE
+ ? ( coll instanceof Map, ?> m && !m.isEmpty() )
+ : ( coll instanceof Collection> c && !c.isEmpty() );
+
+ if( nonEmpty ) {
+ if( mode == Mode.MAP_KEY_VALUE ) {
+ interpretMap( ctx, ( Map, ?> ) coll );
+ } else if( mode == Mode.IMPLICIT_SCOPE ) {
+ interpretImplicit( ctx, ( Collection> ) coll );
+ } else if( mode == Mode.NAMED_INDEX_ITEM ) {
+ interpretIndexItem( ctx, ( Collection> ) coll );
+ } else {
+ interpretNamedItem( ctx, ( Collection> ) coll );
+ }
+ } else if( elseChildren != null ) {
+ elseChildren.forEach( c -> c.interpret( ctx ) );
+ }
+ }
+
+ private void interpretImplicit( RuntimeContext ctx, Collection> coll ) {
+ for( Object item : coll ) {
+ RuntimeContext inner = ctx.withCurrentObject( item );
+ bodyChildren.forEach( c -> c.interpret( inner ) );
+ }
+ }
+
+ private void interpretNamedItem( RuntimeContext ctx, Collection> coll ) {
+ for( Object item : coll ) {
+ RuntimeContext inner = ctx.withRangeVar( itemVarName, item );
+ bodyChildren.forEach( c -> c.interpret( inner ) );
+ }
+ }
+
+ private void interpretIndexItem( RuntimeContext ctx, Collection> coll ) {
+ int idx = 0;
+ for( Object item : coll ) {
+ RuntimeContext inner = ctx.withRangeVar( indexOrKeyVarName, idx ).withRangeVar( itemVarName, item );
+ bodyChildren.forEach( c -> c.interpret( inner ) );
+ idx++;
+ }
+ }
+
+ private void interpretMap( RuntimeContext ctx, Map, ?> map ) {
+ for( Map.Entry, ?> entry : map.entrySet() ) {
+ RuntimeContext inner = ctx
+ .withRangeVar( indexOrKeyVarName, entry.getKey() )
+ .withRangeVar( itemVarName, entry.getValue() );
+ bodyChildren.forEach( c -> c.interpret( inner ) );
+ }
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockRangeInterval.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockRangeInterval.java
index 9901f83de..39b0979a9 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockRangeInterval.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockRangeInterval.java
@@ -25,6 +25,8 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.ReflectionCache;
+import oap.template.runtime.RuntimeContext;
import javax.annotation.Nullable;
import java.util.List;
@@ -88,4 +90,22 @@ public void render( Render render ) {
render.ntab().append( "}" );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ int fromVal = resolveInt( from, ctx );
+ int toVal = resolveInt( to, ctx );
+ int stepVal = resolveInt( step, ctx );
+ for( int k = fromVal; k <= toVal; k += stepVal ) {
+ RuntimeContext inner = ctx.withRangeVar( varName, k );
+ bodyChildren.forEach( c -> c.interpret( inner ) );
+ }
+ }
+
+ private static int resolveInt( IntRangeValue v, RuntimeContext ctx ) {
+ if( v instanceof IntRangeValue.Literal lit ) return lit.value();
+ IntRangeValue.Field fv = ( IntRangeValue.Field ) v;
+ Object val = ReflectionCache.getFieldValue( ctx.currentObject, fv.fieldName() );
+ return val instanceof Number n ? n.intValue() : Integer.parseInt( String.valueOf( val ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockWith.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockWith.java
index f36f7a6c3..e33b15fda 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockWith.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBlockWith.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
import java.util.List;
@@ -55,4 +56,12 @@ public void render( Render render ) {
child.render( bodyRender );
}
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ Object[] capture = { null };
+ scopeAst.interpret( ctx.withScopeCapture( capture ) );
+ RuntimeContext bodyCtx = ctx.withCurrentObject( capture[0] );
+ bodyChildren.forEach( c -> c.interpret( bodyCtx ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBooleanIf.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBooleanIf.java
index 4c8eb8ef0..7b2ec14a0 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBooleanIf.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderBooleanIf.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
import javax.annotation.Nullable;
@@ -65,4 +66,15 @@ public void render( Render render ) {
render.ntab().append( "}" );
}
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ boolean[] capture = { false };
+ conditionAst.interpret( ctx.withBooleanCapture( capture ) );
+ if( capture[0] ) {
+ thenCode.interpret( ctx );
+ } else if( elseCode != null ) {
+ elseCode.interpret( ctx );
+ }
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderCaptureBoolean.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderCaptureBoolean.java
index 9c6f1848d..246c8b1c3 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderCaptureBoolean.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderCaptureBoolean.java
@@ -25,11 +25,25 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.TemplateConditionHelper;
+import oap.template.runtime.RuntimeContext;
+
+import java.util.Collection;
+import java.util.Map;
/**
- * Leaf node for the condition path in AstRenderBooleanIf.
- * Assigns render.field (the resolved boolean variable) into render.booleanIfVar
- * (the hoisted variable declared by AstRenderBooleanIf).
+ * Leaf node for the condition path in AstRenderBooleanIf / AstRenderBlockIf.
+ * Evaluates the current field value as a boolean condition and writes the result
+ * into render.booleanIfVar (codegen) or ctx.booleanCapture (interpreter).
+ *
+ * Truthiness rules:
+ *
+ * - {@code boolean} / {@code Boolean} — the value itself
+ * - {@code String} — not empty
+ * - {@code Collection} / {@code Map} — not empty
+ * - array — length > 0
+ * - any other non-null object — true
+ *
*/
@ToString( callSuper = true )
class AstRenderCaptureBoolean extends AstRender {
@@ -39,6 +53,27 @@ class AstRenderCaptureBoolean extends AstRender {
@Override
public void render( Render render ) {
- render.ntab().append( "%s = %s;", render.booleanIfVar, render.field );
+ Class> tc = type.getTypeClass();
+ if( boolean.class.equals( tc ) ) {
+ render.ntab().append( "%s = %s;", render.booleanIfVar, render.field );
+ } else if( Boolean.class.equals( tc ) ) {
+ render.ntab().append( "%s = Boolean.TRUE.equals( %s );", render.booleanIfVar, render.field );
+ } else if( String.class.equals( tc ) ) {
+ render.ntab().append( "%s = !%s.isEmpty();", render.booleanIfVar, render.field );
+ } else if( Collection.class.isAssignableFrom( tc ) || Map.class.isAssignableFrom( tc ) ) {
+ render.ntab().append( "%s = !%s.isEmpty();", render.booleanIfVar, render.field );
+ } else if( tc.isArray() ) {
+ render.ntab().append( "%s = %s.length > 0;", render.booleanIfVar, render.field );
+ } else {
+ render.ntab().append( "%s = oap.template.TemplateConditionHelper.isTruthy( %s );",
+ render.booleanIfVar, render.field );
+ }
+ }
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ if( ctx.booleanCapture != null ) {
+ ctx.booleanCapture[0] = TemplateConditionHelper.isTruthy( ctx.currentObject );
+ }
}
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderCaptureScope.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderCaptureScope.java
index 9317c6838..e4b9aac1d 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderCaptureScope.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderCaptureScope.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
/**
* Leaf node for the scope path in AstRenderWith / AstRenderBlockWith.
@@ -40,4 +41,9 @@ class AstRenderCaptureScope extends AstRender {
public void render( Render render ) {
render.ntab().append( "%s = %s;", render.scopeVar, render.field );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ if( ctx.scopeCapture != null ) ctx.scopeCapture[0] = ctx.currentObject;
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderComment.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderComment.java
index 7e86653a1..307328077 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderComment.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderComment.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
@ToString( callSuper = true )
class AstRenderComment extends AstRender {
@@ -42,4 +43,9 @@ public void render( Render render ) {
children.forEach( a -> a.render( render ) );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ children.forEach( c -> c.interpret( ctx ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConcatenation.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConcatenation.java
index 3f1d1a2cb..45e71ff2a 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConcatenation.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConcatenation.java
@@ -26,6 +26,8 @@
import lombok.ToString;
import oap.template.TemplateAccumulator;
+import oap.template.TemplateAccumulatorString;
+import oap.template.runtime.RuntimeContext;
import java.util.ArrayList;
import java.util.List;
@@ -54,6 +56,17 @@ public void render( Render render ) {
children.forEach( a -> a.render( newRender ) );
}
+ @Override
+ @SuppressWarnings( { "unchecked", "rawtypes" } )
+ public void interpret( RuntimeContext ctx ) {
+ TemplateAccumulatorString subAcc = new TemplateAccumulatorString();
+ RuntimeContext subCtx = ctx.withAcc( subAcc );
+ for( AstRender item : items ) item.interpret( subCtx );
+ RuntimeContext nextCtx = ctx.withCurrentObject( subAcc )
+ .withAcc( ctx.acc );
+ children.forEach( c -> c.interpret( nextCtx ) );
+ }
+
@Override
public void print( StringBuilder buffer, String prefix, String childrenPrefix ) {
printTop( buffer, prefix );
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConditionAnd.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConditionAnd.java
new file mode 100644
index 000000000..6922e2ab4
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConditionAnd.java
@@ -0,0 +1,60 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template.render;
+
+import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
+
+@ToString( callSuper = true )
+public class AstRenderConditionAnd extends AstRender {
+ private final AstRender left;
+ private final AstRender right;
+
+ public AstRenderConditionAnd( TemplateType type, AstRender left, AstRender right ) {
+ super( type );
+ this.left = left;
+ this.right = right;
+ }
+
+ @Override
+ public void render( Render render ) {
+ String leftVar = render.newVariable();
+ String rightVar = render.newVariable();
+ render.ntab().append( "boolean %s = false;", leftVar );
+ left.render( render.withBooleanIfVar( leftVar ) );
+ render.ntab().append( "boolean %s = false;", rightVar );
+ right.render( render.withBooleanIfVar( rightVar ) );
+ render.ntab().append( "%s = %s && %s;", render.booleanIfVar, leftVar, rightVar );
+ }
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ boolean[] leftCapture = { false };
+ boolean[] rightCapture = { false };
+ left.interpret( ctx.withBooleanCapture( leftCapture ) );
+ right.interpret( ctx.withBooleanCapture( rightCapture ) );
+ if( ctx.booleanCapture != null ) ctx.booleanCapture[0] = leftCapture[0] && rightCapture[0];
+ }
+}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConditionNot.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConditionNot.java
new file mode 100644
index 000000000..b655de99b
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConditionNot.java
@@ -0,0 +1,53 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template.render;
+
+import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
+
+@ToString( callSuper = true )
+public class AstRenderConditionNot extends AstRender {
+ private final AstRender inner;
+
+ public AstRenderConditionNot( TemplateType type, AstRender inner ) {
+ super( type );
+ this.inner = inner;
+ }
+
+ @Override
+ public void render( Render render ) {
+ String innerVar = render.newVariable();
+ render.ntab().append( "boolean %s = false;", innerVar );
+ inner.render( render.withBooleanIfVar( innerVar ) );
+ render.ntab().append( "%s = !%s;", render.booleanIfVar, innerVar );
+ }
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ boolean[] innerCapture = { false };
+ inner.interpret( ctx.withBooleanCapture( innerCapture ) );
+ if( ctx.booleanCapture != null ) ctx.booleanCapture[0] = !innerCapture[0];
+ }
+}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConditionOr.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConditionOr.java
new file mode 100644
index 000000000..ded03d4cf
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderConditionOr.java
@@ -0,0 +1,60 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template.render;
+
+import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
+
+@ToString( callSuper = true )
+public class AstRenderConditionOr extends AstRender {
+ private final AstRender left;
+ private final AstRender right;
+
+ public AstRenderConditionOr( TemplateType type, AstRender left, AstRender right ) {
+ super( type );
+ this.left = left;
+ this.right = right;
+ }
+
+ @Override
+ public void render( Render render ) {
+ String leftVar = render.newVariable();
+ String rightVar = render.newVariable();
+ render.ntab().append( "boolean %s = false;", leftVar );
+ left.render( render.withBooleanIfVar( leftVar ) );
+ render.ntab().append( "boolean %s = false;", rightVar );
+ right.render( render.withBooleanIfVar( rightVar ) );
+ render.ntab().append( "%s = %s || %s;", render.booleanIfVar, leftVar, rightVar );
+ }
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ boolean[] leftCapture = { false };
+ boolean[] rightCapture = { false };
+ left.interpret( ctx.withBooleanCapture( leftCapture ) );
+ right.interpret( ctx.withBooleanCapture( rightCapture ) );
+ if( ctx.booleanCapture != null ) ctx.booleanCapture[0] = leftCapture[0] || rightCapture[0];
+ }
+}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderExpression.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderExpression.java
index 10bef386e..1f6583fa1 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderExpression.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderExpression.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
import org.apache.commons.text.StringEscapeUtils;
import java.util.ArrayList;
@@ -46,4 +47,9 @@ public void render( Render render ) {
}
children.forEach( a -> a.render( render.withContent( String.join( " | ", content ) ) ) );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ children.forEach( c -> c.interpret( ctx ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderField.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderField.java
index c43c25d48..639f5b0a2 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderField.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderField.java
@@ -25,6 +25,8 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.ReflectionCache;
+import oap.template.runtime.RuntimeContext;
@ToString( callSuper = true )
public class AstRenderField extends AstRender {
@@ -66,4 +68,18 @@ public void render( Render render ) {
var newRender = render.withField( variableName.name ).withParentType( type );
children.forEach( a -> a.render( newRender ) );
}
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public void interpret( RuntimeContext ctx ) {
+ Object parent = ctx.currentObject;
+ Object value;
+ if( parent instanceof java.util.Map, ?> m ) {
+ value = m.get( fieldName );
+ } else {
+ value = ReflectionCache.getFieldValue( parent, fieldName );
+ }
+ RuntimeContext next = ctx.withCurrentObject( value );
+ children.forEach( c -> c.interpret( next ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderFunction.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderFunction.java
index 1506fe693..0bd77f903 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderFunction.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderFunction.java
@@ -25,6 +25,9 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.AcceptDispatch;
+import oap.template.runtime.ReflectionCache;
+import oap.template.runtime.RuntimeContext;
import java.lang.reflect.Method;
import java.util.List;
@@ -68,4 +71,31 @@ public void render( Render render ) {
Render newRender = render.withField( funcVariable ).withParentType( type );
children.forEach( a -> a.render( newRender ) );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ Class>[] paramTypes = method.getParameterTypes();
+ Object firstArg = ctx.currentObject;
+ if( paramTypes.length > 0 && paramTypes[0].equals( String.class ) && !( firstArg instanceof String ) ) {
+ firstArg = firstArg != null
+ ? AcceptDispatch.toStringViaAcc( firstArg, new TemplateType( firstArg.getClass() ), ctx.acc )
+ : null;
+ }
+
+ Object[] args = new Object[1 + parameters.size()];
+ args[0] = firstArg;
+ for( int i = 0; i < parameters.size(); i++ ) {
+ args[i + 1] = ReflectionCache.parseArg( paramTypes[i + 1], parameters.get( i ) );
+ }
+
+ Object result;
+ try {
+ result = method.invoke( null, args );
+ } catch( Exception e ) {
+ throw new RuntimeException( e );
+ }
+
+ RuntimeContext nextCtx = ctx.withCurrentObject( result ).withAcc( ctx.acc );
+ children.forEach( c -> c.interpret( nextCtx ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderIfElse.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderIfElse.java
index afa92bf48..012746182 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderIfElse.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderIfElse.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
import java.util.function.Supplier;
@@ -81,6 +82,11 @@ public void print( StringBuilder buffer, String prefix, String childrenPrefix )
}
}
+ /** Render the else branch when present, during runtime interpretation. */
+ protected void interpretElse( RuntimeContext ctx ) {
+ if( elseAstRender != null ) elseAstRender.interpret( ctx );
+ }
+
protected abstract String getTrue();
protected abstract String getFalseToString();
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderMap.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderMap.java
index 05feaeca7..cecac1062 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderMap.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderMap.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
@ToString( callSuper = true )
public class AstRenderMap extends AstRender {
@@ -38,13 +39,23 @@ public AstRenderMap( String key, TemplateType valueType ) {
@Override
public void render( Render render ) {
- String mapVariable = render.newVariable();
+ Render.NewVariable mapVariable = render.newVariable( key );
- render.ntab().append( "%s %s = %s.get( \"%s\" );",
- type.getTypeName(), mapVariable,
- render.field, render.escapeJava( key ) );
+ if( mapVariable.isNew ) {
+ render.ntab().append( "%s %s = %s.get( \"%s\" );",
+ type.getTypeName(), mapVariable.name,
+ render.field, render.escapeJava( key ) );
+ }
- Render newRender = render.withField( mapVariable ).withParentType( type );
+ Render newRender = render.withField( mapVariable.name ).withParentType( type );
children.forEach( a -> a.render( newRender ) );
}
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public void interpret( RuntimeContext ctx ) {
+ Object value = ctx.currentObject instanceof java.util.Map, ?> m ? m.get( key ) : null;
+ RuntimeContext next = ctx.withCurrentObject( value );
+ children.forEach( c -> c.interpret( next ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderMath.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderMath.java
index b370674f0..a371a79cc 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderMath.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderMath.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
@ToString( callSuper = true )
public class AstRenderMath extends AstRender {
@@ -46,4 +47,37 @@ public void render( Render render ) {
var newRender = render.withField( mathVariable ).withParentType( type );
children.forEach( a -> a.render( newRender ) );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ Object result = applyMath( operation, ( Number ) ctx.currentObject, number );
+ RuntimeContext next = ctx.withCurrentObject( result );
+ children.forEach( c -> c.interpret( next ) );
+ }
+
+ private static Object applyMath( String op, Number val, String numStr ) {
+ if( ( val instanceof Integer || val instanceof Long ) && !numStr.contains( "." ) ) {
+ long lv = val.longValue();
+ long n = Long.parseLong( numStr );
+ long r = switch( op ) {
+ case "+" -> lv + n;
+ case "-" -> lv - n;
+ case "*" -> lv * n;
+ case "/" -> lv / n;
+ case "%" -> lv % n;
+ default -> throw new IllegalArgumentException( op );
+ };
+ return val instanceof Integer ? ( int ) r : r;
+ }
+ double dv = val.doubleValue();
+ double n = Double.parseDouble( numStr );
+ return switch( op ) {
+ case "+" -> dv + n;
+ case "-" -> dv - n;
+ case "*" -> dv * n;
+ case "/" -> dv / n;
+ case "%" -> dv % n;
+ default -> throw new IllegalArgumentException( op );
+ };
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderMethod.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderMethod.java
index d3517b657..58fb9d493 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderMethod.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderMethod.java
@@ -25,6 +25,8 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.ReflectionCache;
+import oap.template.runtime.RuntimeContext;
import java.util.List;
@@ -53,4 +55,11 @@ public void render( Render render ) {
var newRender = render.withField( variableName.name ).withParentType( type );
children.forEach( a -> a.render( newRender ) );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ Object result = ReflectionCache.invokeMethod( ctx.currentObject, methodName, arguments );
+ RuntimeContext next = ctx.withCurrentObject( result );
+ children.forEach( c -> c.interpret( next ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderNullable.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderNullable.java
index ad2190a4f..f8773b2d8 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderNullable.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderNullable.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
import java.util.function.Supplier;
@@ -53,4 +54,14 @@ protected String getInnerVariable( Supplier newVariable ) {
protected String getInnerVariableSetter( String variableName, Render render ) {
return null;
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ if( ctx.currentObject != null ) {
+ children.forEach( c -> c.interpret( ctx ) );
+ } else {
+ if( ctx.tryEmpty != null ) ctx.tryEmpty[0] = true;
+ interpretElse( ctx );
+ }
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderOptional.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderOptional.java
index f83d5cc7f..bada36e5b 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderOptional.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderOptional.java
@@ -25,7 +25,9 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
+import java.util.Optional;
import java.util.function.Supplier;
@ToString( callSuper = true )
@@ -53,4 +55,16 @@ protected String getInnerVariable( Supplier newVariable ) {
protected String getInnerVariableSetter( String variableName, Render render ) {
return "%s %s = %s.get();".formatted( type.getTypeName(), variableName, render.field );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ Optional> opt = ( Optional> ) ctx.currentObject;
+ if( opt != null && opt.isPresent() ) {
+ RuntimeContext inner = ctx.withCurrentObject( opt.get() );
+ children.forEach( c -> c.interpret( inner ) );
+ } else {
+ if( ctx.tryEmpty != null ) ctx.tryEmpty[0] = true;
+ interpretElse( ctx );
+ }
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderOr.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderOr.java
index 41daf371a..e36cbda7b 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderOr.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderOr.java
@@ -25,6 +25,8 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.TemplateAccumulator;
+import oap.template.runtime.RuntimeContext;
import java.util.ArrayList;
import java.util.List;
@@ -112,4 +114,28 @@ public void render( Render render ) {
Render newRender = r.withField( orVariable );
super.render( newRender );
}
+
+ @Override
+ @SuppressWarnings( { "unchecked", "rawtypes" } )
+ public void interpret( RuntimeContext ctx ) {
+ TemplateAccumulator orAcc = ctx.acc.newInstance();
+ boolean found = false;
+ for( AstRender orItem : or ) {
+ TemplateAccumulator tryAcc = ctx.acc.newInstance();
+ boolean[] tryEmpty = { false };
+ RuntimeContext tryCtx = ctx.withAcc( tryAcc ).withTryEmpty( tryEmpty );
+ orItem.interpret( tryCtx );
+ if( !tryEmpty[0] ) {
+ orAcc = tryAcc;
+ found = true;
+ break;
+ }
+ }
+ TemplateAccumulator winner = orAcc;
+ if( found && winner.isNotEmpty() ) {
+ children.forEach( c -> c.interpret( ctx.withCurrentObject( winner ) ) );
+ } else {
+ interpretElse( ctx );
+ }
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderPathNotFound.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderPathNotFound.java
index 76ac78100..70254a1bb 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderPathNotFound.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderPathNotFound.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
@ToString( callSuper = true )
public class AstRenderPathNotFound extends AstRender {
@@ -46,4 +47,10 @@ public void render( Render render ) {
var newRender = render.withField( newVariable ).withParentType( type );
children.forEach( a -> a.render( newRender ) );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ RuntimeContext empty = ctx.withCurrentObject( "" );
+ children.forEach( c -> c.interpret( empty ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderPrintField.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderPrintField.java
index db1543d0c..ea2fc84ac 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderPrintField.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderPrintField.java
@@ -26,6 +26,8 @@
import com.google.common.base.Preconditions;
import lombok.ToString;
+import oap.template.runtime.AcceptDispatch;
+import oap.template.runtime.RuntimeContext;
import javax.annotation.Nullable;
@@ -45,6 +47,12 @@ public void render( Render render ) {
r.append( "%s.accept( %s );", r.templateAccumulatorName, format( castType != null ? new TemplateType( castType.type ) : type, r.field ) );
}
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public void interpret( RuntimeContext ctx ) {
+ AcceptDispatch.accept( ctx.acc, ctx.currentObject, type, castType );
+ }
+
@SuppressWarnings( { "checkstyle:ParameterAssignment" } )
private String format( TemplateType castType, String value ) {
Preconditions.checkNotNull( value );
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderPrintValue.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderPrintValue.java
index 2af15e044..9d262dda9 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderPrintValue.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderPrintValue.java
@@ -26,6 +26,8 @@
import com.google.common.base.Preconditions;
import lombok.ToString;
+import oap.template.runtime.AcceptDispatch;
+import oap.template.runtime.RuntimeContext;
import oap.util.Dates;
import oap.util.Strings;
import org.apache.commons.lang3.StringUtils;
@@ -63,6 +65,18 @@ public void render( Render render ) {
}
}
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public void interpret( RuntimeContext ctx ) {
+ String defaultValue = value;
+ if( defaultValue == null ) defaultValue = ctx.acc.getDefault( type.getTypeClass() );
+ if( defaultValue == null ) {
+ ctx.acc.acceptNull( type.getTypeClass() );
+ } else {
+ AcceptDispatch.acceptDefaultValue( ctx.acc, type, castType, defaultValue );
+ }
+ }
+
@SuppressWarnings( { "checkstyle:ParameterAssignment" } )
private String format( TemplateType castType, String defaultValue ) {
Preconditions.checkNotNull( defaultValue );
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderRoot.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderRoot.java
index 32ced9699..f127762a0 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderRoot.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderRoot.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
@ToString( callSuper = true )
public class AstRenderRoot extends AstRender {
@@ -64,4 +65,9 @@ public void render( Render render ) {
}
}""".stripIndent() );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ children.forEach( c -> c.interpret( ctx ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderSwitchToRoot.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderSwitchToRoot.java
index 530dbf8d2..b55acfb79 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderSwitchToRoot.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderSwitchToRoot.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
/**
* Redirects render.field to render.rootField so that child nodes resolve
@@ -42,4 +43,10 @@ public void render( Render render ) {
Render rootRender = render.withField( render.rootField ).withParentType( type );
children.forEach( c -> c.render( rootRender ) );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ RuntimeContext rootCtx = ctx.withCurrentObject( ctx.rootObject );
+ children.forEach( c -> c.interpret( rootCtx ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderText.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderText.java
index 72a5af281..43bf7d5b5 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderText.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderText.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
@ToString( callSuper = true )
public class AstRenderText extends AstRender {
@@ -41,4 +42,9 @@ public void render( Render render ) {
.append( "%s.acceptText( \"%s\" );", render.templateAccumulatorName, render.escapeJava( text != null ? text : "" ) );
}
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ ctx.acc.acceptText( text != null ? text : "" );
+ }
+
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderTryBlock.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderTryBlock.java
index ad9e79d05..c57ad8dc5 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderTryBlock.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderTryBlock.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
@ToString( callSuper = true )
public class AstRenderTryBlock extends AstRender {
@@ -61,4 +62,9 @@ public void render( String newFunctionId, String templateAccumulatorName, Render
.tabDec()
.ntab().append( "};" );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ children.forEach( c -> c.interpret( ctx ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderVarRef.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderVarRef.java
index ff70281c9..210e1d38a 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderVarRef.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderVarRef.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
/**
* Redirects render.field to the Java variable bound to a named range variable ($varName).
@@ -45,4 +46,11 @@ public void render( Render render ) {
Render varRender = render.withField( javaVar ).withParentType( type );
children.forEach( c -> c.render( varRender ) );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ Object value = ctx.rangeVars.get( varName );
+ RuntimeContext next = ctx.withCurrentObject( value );
+ children.forEach( c -> c.interpret( next ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderWith.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderWith.java
index 9fd53adf7..57a8f353d 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderWith.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRenderWith.java
@@ -25,6 +25,7 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
/**
* Inline with: {{ with (field1) field2 | default field3 end }}
@@ -50,4 +51,11 @@ public void render( Render render ) {
scopeAst.render( render.withScopeVar( sv ) );
bodyAst.render( render.withField( sv ).withParentType( scopeType ) );
}
+
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ Object[] capture = { null };
+ scopeAst.interpret( ctx.withScopeCapture( capture ) );
+ bodyAst.interpret( ctx.withCurrentObject( capture[0] ) );
+ }
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/AstRendererDynamicMap.java b/oap-formats/oap-template/src/main/java/oap/template/render/AstRendererDynamicMap.java
index 78eb0ef7c..11efde690 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/AstRendererDynamicMap.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/AstRendererDynamicMap.java
@@ -1,8 +1,10 @@
package oap.template.render;
import lombok.ToString;
+import oap.template.runtime.RuntimeContext;
import java.util.ArrayList;
+import java.util.Map;
@ToString
public class AstRendererDynamicMap extends AstRender {
@@ -36,6 +38,21 @@ public void render( Render render ) {
}
}
+ @Override
+ public void interpret( RuntimeContext ctx ) {
+ Object obj = ctx.currentObject;
+ for( String key : path ) {
+ if( obj instanceof Map, ?> m ) {
+ obj = m.get( key );
+ } else {
+ obj = null;
+ break;
+ }
+ }
+ RuntimeContext nextCtx = ctx.withCurrentObject( obj );
+ for( AstRender child : children ) child.interpret( nextCtx );
+ }
+
public void addPath( String key ) {
this.path.add( key );
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/Render.java b/oap-formats/oap-template/src/main/java/oap/template/render/Render.java
index 942a4c9e3..2e0d30262 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/Render.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/Render.java
@@ -31,6 +31,7 @@
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@@ -171,12 +172,15 @@ public String newVariable() {
return "v" + id;
}
+ @SuppressWarnings( "checkstyle:ParameterAssignment" )
public NewVariable newVariable( String name ) {
- var fullName = variableNameWithPrefix( name );
- var it = variables.descendingIterator();
+ name = name.replaceAll( "[\\s,-?]", "_" );
+
+ String fullName = variableNameWithPrefix( name );
+ Iterator> it = variables.descendingIterator();
while( it.hasNext() ) {
- var map = it.next();
+ HashSet map = it.next();
if( map.contains( fullName ) ) return new NewVariable( fullName, false );
}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/TemplateAstUtils.java b/oap-formats/oap-template/src/main/java/oap/template/render/TemplateAstUtils.java
index b99c07320..b0498248b 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/render/TemplateAstUtils.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/render/TemplateAstUtils.java
@@ -34,17 +34,22 @@
import oap.template.TemplateGrammarExpression;
import oap.template.TemplateLexerExpression;
import oap.template.ThrowingErrorListener;
+import oap.template.tree.AndConditionExpr;
import oap.template.tree.BlockIfElement;
import oap.template.tree.BlockRangeElement;
import oap.template.tree.BlockWithElement;
+import oap.template.tree.ConditionExpr;
import oap.template.tree.Element;
import oap.template.tree.Elements;
import oap.template.tree.Expr;
import oap.template.tree.Expression;
import oap.template.tree.ExpressionElement;
import oap.template.tree.Exprs;
+import oap.template.tree.FieldConditionExpr;
import oap.template.tree.Func;
import oap.template.tree.IfCondition;
+import oap.template.tree.NotConditionExpr;
+import oap.template.tree.OrConditionExpr;
import oap.template.tree.TextElement;
import oap.template.tree.WithCondition;
import oap.util.Arrays;
@@ -235,7 +240,9 @@ private static AstRender toAst( Expression expression, TemplateType templateType
AstRender conditionAst = toConditionAst( ifCondition.condition, templateType, errorStrategy );
AstRender thenCode = toAst( ifCondition.thenCode, null, templateType, rootTemplateType, expressionResultType, castType, defaultValue, builtInFunction, errorStrategy );
- AstRender elseCode = ifCondition.elseCode != null ? toAst( ifCondition.elseCode, null, templateType, rootTemplateType, expressionResultType, castType, defaultValue, builtInFunction, errorStrategy ) : null;
+ AstRender elseCode = ifCondition.elseCode != null
+ ? toAst( ifCondition.elseCode, null, templateType, rootTemplateType, expressionResultType, castType, defaultValue, builtInFunction, errorStrategy )
+ : null;
return new AstRenderBooleanIf( templateType, conditionAst, thenCode, elseCode );
}
@@ -264,6 +271,23 @@ private static AstRender toAst( Expression expression, TemplateType templateType
}
+ private static AstRender toConditionAst( ConditionExpr cond, TemplateType templateType, ErrorStrategy errorStrategy ) {
+ if( cond instanceof FieldConditionExpr f ) {
+ return toConditionAst( f.fieldPath(), templateType, errorStrategy );
+ } else if( cond instanceof AndConditionExpr a ) {
+ return new AstRenderConditionAnd( templateType,
+ toConditionAst( a.left(), templateType, errorStrategy ),
+ toConditionAst( a.right(), templateType, errorStrategy ) );
+ } else if( cond instanceof OrConditionExpr o ) {
+ return new AstRenderConditionOr( templateType,
+ toConditionAst( o.left(), templateType, errorStrategy ),
+ toConditionAst( o.right(), templateType, errorStrategy ) );
+ } else if( cond instanceof NotConditionExpr n ) {
+ return new AstRenderConditionNot( templateType, toConditionAst( n.inner(), templateType, errorStrategy ) );
+ }
+ throw new IllegalStateException( "Unknown ConditionExpr: " + cond );
+ }
+
@SuppressWarnings( { "checkstyle:ModifiedControlVariable", "checkstyle:ParameterAssignment" } )
private static AstRender toConditionAst( Exprs conditionExprs, TemplateType templateType, ErrorStrategy errorStrategy ) {
try {
@@ -285,6 +309,11 @@ private static AstRender toConditionAst( Exprs conditionExprs, TemplateType temp
i--;
result.add( ast );
currentTemplateType = newType;
+ } else if( currentTemplateType.isInstanceOf( Map.class ) ) {
+ TemplateType valueType = currentTemplateType.getActualTypeArguments1( true );
+ AstRenderMap ast = new AstRenderMap( expr.name, valueType );
+ result.add( ast );
+ currentTemplateType = valueType;
} else if( !expr.method ) {
Class> parentClass = currentTemplateType.getTypeClass();
java.lang.reflect.Field field = findField( parentClass, expr.name );
@@ -651,8 +680,8 @@ private static AstRenderRoot toAst( Elements elements, TemplateType templateType
lexer.addErrorListener( ThrowingErrorListener.INSTANCE );
grammar.addErrorListener( ThrowingErrorListener.INSTANCE );
}
- Exprs conditionExprs = grammar.exprs().ret;
- AstRender conditionAst = toConditionAst( conditionExprs, templateType, errorStrategy );
+ ConditionExpr conditionExpr = grammar.ifCondition().ret;
+ AstRender conditionAst = toConditionAst( conditionExpr, templateType, errorStrategy );
AstRenderRoot thenRoot = toAst( b.thenElements, templateType, rootTemplateType, builtInFunction, errorStrategy, rangeVarTypes );
AstRenderRoot elseRoot = b.elseElements != null
? toAst( b.elseElements, templateType, rootTemplateType, builtInFunction, errorStrategy, rangeVarTypes )
diff --git a/oap-formats/oap-template/src/main/java/oap/template/runtime/AcceptDispatch.java b/oap-formats/oap-template/src/main/java/oap/template/runtime/AcceptDispatch.java
new file mode 100644
index 000000000..5152fb2b2
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/runtime/AcceptDispatch.java
@@ -0,0 +1,181 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template.runtime;
+
+import oap.template.TemplateAccumulator;
+import oap.template.TemplateAccumulatorString;
+import oap.template.render.FieldType;
+import oap.template.render.TemplateType;
+import oap.util.Dates;
+import oap.util.Strings;
+import org.joda.time.DateTime;
+
+import javax.annotation.Nullable;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Routes a runtime {@code value} + {@link TemplateType} to the correct typed
+ * {@link TemplateAccumulator#accept} overload — doing at runtime what the code-generator
+ * resolves statically.
+ */
+@SuppressWarnings( { "rawtypes", "unchecked" } )
+public final class AcceptDispatch {
+
+ private AcceptDispatch() {}
+
+ /**
+ * Accept a live field value into the accumulator, applying numeric coercion
+ * when {@code castType} is set (mirrors {@code AstRenderPrintField.format()}).
+ */
+ public static void accept( TemplateAccumulator acc, @Nullable Object value,
+ TemplateType type, @Nullable FieldType castType ) {
+ if( value == null ) {
+ acc.acceptNull( type.getTypeClass() );
+ return;
+ }
+ if( value instanceof TemplateAccumulator subAcc ) {
+ acc.accept( subAcc );
+ return;
+ }
+ if( castType != null ) {
+ TemplateType effective = new TemplateType( castType.type );
+ Class> tc = effective.isOptional() ? effective.getActualTypeArguments0().getTypeClass() : effective.getTypeClass();
+ dispatchValue( acc, coerce( value, tc ), tc );
+ } else {
+ dispatchValue( acc, value, value.getClass() );
+ }
+ }
+
+ /**
+ * Accept a literal default value into the accumulator
+ * (mirrors {@code AstRenderPrintValue.format()}).
+ */
+ public static void acceptDefaultValue( TemplateAccumulator acc,
+ TemplateType type, @Nullable FieldType castType,
+ String defaultValue ) {
+ TemplateType effective = castType != null ? new TemplateType( castType.type ) : type;
+ Class> tc = effective.isOptional() ? effective.getActualTypeArguments0().getTypeClass() : effective.getTypeClass();
+ Object parsed = parseDefault( tc, type, defaultValue );
+ if( castType != null && parsed instanceof Number n ) parsed = coerce( n, castType.type );
+ if( castType != null ) {
+ acc.accept( parsed );
+ } else {
+ dispatchValue( acc, parsed, parsed != null ? parsed.getClass() : tc );
+ }
+ }
+
+ private static Object coerce( Object value, Class> target ) {
+ if( value instanceof Number n ) {
+ if( byte.class.equals( target ) || Byte.class.isAssignableFrom( target ) ) return n.byteValue();
+ if( short.class.equals( target ) || Short.class.isAssignableFrom( target ) ) return n.shortValue();
+ if( int.class.equals( target ) || Integer.class.isAssignableFrom( target ) ) return n.intValue();
+ if( long.class.equals( target ) || Long.class.isAssignableFrom( target ) ) return n.longValue();
+ if( float.class.equals( target ) || Float.class.isAssignableFrom( target ) ) return n.floatValue();
+ if( double.class.equals( target ) || Double.class.isAssignableFrom( target ) ) return n.doubleValue();
+ }
+ return value;
+ }
+
+ private static void dispatchValue( TemplateAccumulator acc, Object value, Class> tc ) {
+ if( value instanceof TemplateAccumulator subAcc ) {
+ acc.accept( subAcc );
+ return;
+ }
+ if( boolean.class.equals( tc ) || Boolean.class.isAssignableFrom( tc ) ) {
+ acc.accept( ( Boolean ) value );
+ } else if( byte.class.equals( tc ) || Byte.class.isAssignableFrom( tc ) ) {
+ acc.accept( ( ( Number ) value ).byteValue() );
+ } else if( short.class.equals( tc ) || Short.class.isAssignableFrom( tc ) ) {
+ acc.accept( ( ( Number ) value ).shortValue() );
+ } else if( int.class.equals( tc ) || Integer.class.isAssignableFrom( tc ) ) {
+ acc.accept( ( ( Number ) value ).intValue() );
+ } else if( long.class.equals( tc ) || Long.class.isAssignableFrom( tc ) ) {
+ acc.accept( ( ( Number ) value ).longValue() );
+ } else if( float.class.equals( tc ) || Float.class.isAssignableFrom( tc ) ) {
+ acc.accept( ( ( Number ) value ).floatValue() );
+ } else if( double.class.equals( tc ) || Double.class.isAssignableFrom( tc ) ) {
+ acc.accept( ( ( Number ) value ).doubleValue() );
+ } else if( Enum.class.isAssignableFrom( tc ) ) {
+ acc.accept( ( Enum> ) value );
+ } else if( Collection.class.isAssignableFrom( tc ) ) {
+ acc.accept( ( Collection> ) value );
+ } else if( value instanceof DateTime dt ) {
+ acc.accept( dt );
+ } else if( value instanceof String s ) {
+ acc.accept( s );
+ } else {
+ acc.accept( value );
+ }
+ }
+
+ private static Object parseDefault( Class> tc, TemplateType type, String defaultValue ) {
+ if( String.class.equals( tc ) ) return defaultValue;
+ if( byte.class.equals( tc ) || Byte.class.isAssignableFrom( tc ) )
+ return Byte.parseByte( defaultValue );
+ if( short.class.equals( tc ) || Short.class.isAssignableFrom( tc ) )
+ return Short.parseShort( defaultValue );
+ if( int.class.equals( tc ) || Integer.class.isAssignableFrom( tc ) )
+ return Integer.parseInt( defaultValue );
+ if( long.class.equals( tc ) || Long.class.isAssignableFrom( tc ) )
+ return Long.parseLong( defaultValue );
+ if( float.class.equals( tc ) || Float.class.isAssignableFrom( tc ) )
+ return Float.parseFloat( defaultValue );
+ if( double.class.equals( tc ) || Double.class.isAssignableFrom( tc ) )
+ return Double.parseDouble( defaultValue );
+ if( boolean.class.equals( tc ) || Boolean.class.isAssignableFrom( tc ) )
+ return Boolean.parseBoolean( defaultValue );
+ if( Collection.class.isAssignableFrom( tc ) ) return List.of();
+ if( Enum.class.isAssignableFrom( tc ) ) {
+ Class> enumClass = ( tc == Enum.class ) ? type.getTypeClass() : tc;
+ String name = defaultValue.isEmpty() ? Strings.UNKNOWN : defaultValue;
+ return Enum.valueOf( ( Class ) enumClass, name );
+ }
+ if( Object.class.equals( tc ) ) {
+ if( "true".equals( defaultValue ) || "false".equals( defaultValue ) ) return Boolean.parseBoolean( defaultValue );
+ try {
+ return Long.parseLong( defaultValue );
+ } catch( NumberFormatException ignored ) { }
+ try {
+ return Double.parseDouble( defaultValue );
+ } catch( NumberFormatException ignored ) { }
+ return defaultValue;
+ }
+ if( DateTime.class.equals( tc ) )
+ return Dates.PARSER_MULTIPLE_DATETIME.parseDateTime( defaultValue );
+ return defaultValue;
+ }
+
+ /**
+ * Convert a live value to its String representation using a temporary
+ * {@link TemplateAccumulatorString}. Used by function nodes when the first
+ * parameter expects {@code String} but the current value is not a String.
+ */
+ public static String toStringViaAcc( Object value, TemplateType type, TemplateAccumulator parentAcc ) {
+ TemplateAccumulatorString tmp = new TemplateAccumulatorString();
+ accept( tmp, value, type, null );
+ return tmp.get();
+ }
+}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/runtime/ReflectionCache.java b/oap-formats/oap-template/src/main/java/oap/template/runtime/ReflectionCache.java
new file mode 100644
index 000000000..939f1281a
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/runtime/ReflectionCache.java
@@ -0,0 +1,129 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template.runtime;
+
+import javax.annotation.Nullable;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * JVM-wide cache of {@link Field} and {@link Method} references, pre-made accessible,
+ * to minimise reflection overhead in the runtime interpreter.
+ */
+public final class ReflectionCache {
+ private static final ConcurrentHashMap FIELD_CACHE = new ConcurrentHashMap<>();
+ private static final ConcurrentHashMap METHOD_CACHE = new ConcurrentHashMap<>();
+
+ private ReflectionCache() {}
+
+ /**
+ * Read the value of {@code fieldName} on {@code obj}, traversing the class hierarchy.
+ * Returns {@code null} when {@code obj} is {@code null} or the field cannot be found.
+ */
+ @Nullable
+ public static Object getFieldValue( @Nullable Object obj, String fieldName ) {
+ if( obj == null ) return null;
+ String key = obj.getClass().getName() + '#' + fieldName;
+ Field f = FIELD_CACHE.computeIfAbsent( key, k -> findField( obj.getClass(), fieldName ) );
+ if( f == null ) return null;
+ try {
+ return f.get( obj );
+ } catch( IllegalAccessException e ) {
+ throw new RuntimeException( e );
+ }
+ }
+
+ /**
+ * Invoke a zero-or-more-argument instance method by name, with pre-parsed arguments.
+ */
+ public static Object invokeMethod( Object obj, String methodName, List rawArgs ) {
+ if( obj == null ) return null;
+ String key = obj.getClass().getName() + '#' + methodName + '/' + rawArgs.size();
+ Method m = METHOD_CACHE.computeIfAbsent( key, k -> findMethod( obj.getClass(), methodName, rawArgs.size() ) );
+ if( m == null ) return null;
+ try {
+ Object[] args = parseArgs( m.getParameterTypes(), rawArgs );
+ return m.invoke( obj, args );
+ } catch( Exception e ) {
+ throw new RuntimeException( e );
+ }
+ }
+
+ /** Parse raw string args to the concrete types expected by the method. */
+ public static Object[] parseArgs( Class>[] paramTypes, List rawArgs ) {
+ Object[] args = new Object[rawArgs.size()];
+ for( int i = 0; i < rawArgs.size(); i++ ) {
+ args[i] = parseArg( paramTypes[i], rawArgs.get( i ) );
+ }
+ return args;
+ }
+
+ /** Parse a single raw argument string to the target Java type. */
+ public static Object parseArg( Class> targetType, String raw ) {
+ String s = raw;
+ if( s.startsWith( "\"" ) && s.endsWith( "\"" ) ) {
+ s = s.substring( 1, s.length() - 1 );
+ if( String.class.equals( targetType ) ) return s;
+ }
+ if( int.class.equals( targetType ) || Integer.class.equals( targetType ) ) return Integer.parseInt( s );
+ if( long.class.equals( targetType ) || Long.class.equals( targetType ) ) return Long.parseLong( s );
+ if( double.class.equals( targetType ) || Double.class.equals( targetType ) ) return Double.parseDouble( s );
+ if( float.class.equals( targetType ) || Float.class.equals( targetType ) ) return Float.parseFloat( s );
+ if( short.class.equals( targetType ) || Short.class.equals( targetType ) ) return Short.parseShort( s );
+ if( byte.class.equals( targetType ) || Byte.class.equals( targetType ) ) return Byte.parseByte( s );
+ if( boolean.class.equals( targetType ) || Boolean.class.equals( targetType ) ) return Boolean.parseBoolean( s );
+ return s;
+ }
+
+ @Nullable
+ private static Field findField( Class> clazz, String name ) {
+ Class> c = clazz;
+ while( c != null ) {
+ try {
+ Field f = c.getDeclaredField( name );
+ f.setAccessible( true );
+ return f;
+ } catch( NoSuchFieldException e ) {
+ c = c.getSuperclass();
+ }
+ }
+ return null;
+ }
+
+ @Nullable
+ private static Method findMethod( Class> clazz, String name, int argCount ) {
+ return Arrays.stream( clazz.getMethods() )
+ .filter( m -> m.getName().equals( name ) && m.getParameterCount() == argCount )
+ .findFirst()
+ .map( m -> {
+ m.setAccessible( true );
+ return m;
+ } )
+ .orElse( null );
+ }
+}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/runtime/RuntimeContext.java b/oap-formats/oap-template/src/main/java/oap/template/runtime/RuntimeContext.java
new file mode 100644
index 000000000..9a150c56d
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/runtime/RuntimeContext.java
@@ -0,0 +1,114 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template.runtime;
+
+import oap.template.TemplateAccumulator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Runtime interpretation context — analogous to {@code Render} for code-generation,
+ * but carries live Java objects instead of code fragments.
+ *
+ * All with-methods produce a new immutable copy; the accumulator and captures
+ * are shared mutable references intentionally (they are coordination points).
+ */
+@SuppressWarnings( "rawtypes" )
+public final class RuntimeContext {
+ /** The object currently being inspected (analogous to {@code Render.field}). */
+ public final Object currentObject;
+ /** The root input object (analogous to {@code Render.rootField}). */
+ public final Object rootObject;
+ /** The accumulator that receives rendered output. */
+ public final TemplateAccumulator acc;
+ /** Named range-loop variables (e.g. {@code $item}, {@code $k}). */
+ public final Map rangeVars;
+ /**
+ * One-element array shared with the caller of {@code withBooleanCapture()}.
+ * {@code AstRenderCaptureBoolean} writes into {@code [0]} when reached.
+ * {@code null} when not inside a condition-path evaluation.
+ */
+ public final boolean[] booleanCapture;
+ /**
+ * One-element array shared with the caller of {@code withScopeCapture()}.
+ * {@code AstRenderCaptureScope} writes into {@code [0]} when reached.
+ * {@code null} when not resolving a scope/collection path.
+ */
+ public final Object[] scopeCapture;
+ /**
+ * One-element array shared with the caller of {@code withTryEmpty()}.
+ * Set to {@code true} by {@code AstRenderNullable/Optional} when the null branch is taken.
+ * {@code null} when not inside an Or-candidate evaluation.
+ */
+ public final boolean[] tryEmpty;
+
+ public RuntimeContext( Object currentObject, Object rootObject,
+ TemplateAccumulator acc,
+ Map rangeVars,
+ boolean[] booleanCapture,
+ Object[] scopeCapture,
+ boolean[] tryEmpty ) {
+ this.currentObject = currentObject;
+ this.rootObject = rootObject;
+ this.acc = acc;
+ this.rangeVars = rangeVars;
+ this.booleanCapture = booleanCapture;
+ this.scopeCapture = scopeCapture;
+ this.tryEmpty = tryEmpty;
+ }
+
+ /** Create the initial context for interpreting a template against {@code obj}. */
+ public static RuntimeContext root( Object obj, TemplateAccumulator acc ) {
+ return new RuntimeContext( obj, obj, acc, Map.of(), null, null, null );
+ }
+
+ public RuntimeContext withCurrentObject( Object obj ) {
+ return new RuntimeContext( obj, rootObject, acc, rangeVars, booleanCapture, scopeCapture, tryEmpty );
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public RuntimeContext withAcc( TemplateAccumulator newAcc ) {
+ return new RuntimeContext( currentObject, rootObject, newAcc, rangeVars, booleanCapture, scopeCapture, tryEmpty );
+ }
+
+ public RuntimeContext withRangeVar( String name, Object value ) {
+ var newVars = new HashMap<>( rangeVars );
+ newVars.put( name, value );
+ return new RuntimeContext( currentObject, rootObject, acc, newVars, booleanCapture, scopeCapture, tryEmpty );
+ }
+
+ public RuntimeContext withBooleanCapture( boolean[] capture ) {
+ return new RuntimeContext( currentObject, rootObject, acc, rangeVars, capture, scopeCapture, tryEmpty );
+ }
+
+ public RuntimeContext withScopeCapture( Object[] capture ) {
+ return new RuntimeContext( currentObject, rootObject, acc, rangeVars, booleanCapture, capture, tryEmpty );
+ }
+
+ public RuntimeContext withTryEmpty( boolean[] tryEmptyFlag ) {
+ return new RuntimeContext( currentObject, rootObject, acc, rangeVars, booleanCapture, scopeCapture, tryEmptyFlag );
+ }
+}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/tree/AndConditionExpr.java b/oap-formats/oap-template/src/main/java/oap/template/tree/AndConditionExpr.java
new file mode 100644
index 000000000..2ea4aa77a
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/tree/AndConditionExpr.java
@@ -0,0 +1,27 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template.tree;
+
+public record AndConditionExpr( ConditionExpr left, ConditionExpr right ) implements ConditionExpr {}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/tree/ConditionExpr.java b/oap-formats/oap-template/src/main/java/oap/template/tree/ConditionExpr.java
new file mode 100644
index 000000000..a94d826e1
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/tree/ConditionExpr.java
@@ -0,0 +1,27 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template.tree;
+
+public sealed interface ConditionExpr permits FieldConditionExpr, AndConditionExpr, OrConditionExpr, NotConditionExpr {}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/tree/Expression.java b/oap-formats/oap-template/src/main/java/oap/template/tree/Expression.java
index 87ccc16df..0ae50d04d 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/tree/Expression.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/tree/Expression.java
@@ -66,7 +66,7 @@ public String print() {
if( castType != null ) sb.append( "CAST " ).append( castType ).append( '\n' );
if( defaultValue != null ) sb.append( "DEFAULT '" ).append( defaultValue ).append( "'\n" );
if( ifCondition != null ) {
- sb.append( "IF\n" ).append( "└── " ).append( ifCondition.condition.print() ).append( '\n' );
+ sb.append( "IF\n" ).append( "└── " ).append( ifCondition.condition ).append( '\n' );
sb.append( "THEN\n" ).append( "└── " ).append( ifCondition.thenCode.print() ).append( '\n' );
if( ifCondition.elseCode != null ) {
sb.append( "ELSE\n" ).append( "└── " ).append( ifCondition.elseCode.print() ).append( '\n' );
diff --git a/oap-formats/oap-template/src/main/java/oap/template/tree/FieldConditionExpr.java b/oap-formats/oap-template/src/main/java/oap/template/tree/FieldConditionExpr.java
new file mode 100644
index 000000000..14c7a537e
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/tree/FieldConditionExpr.java
@@ -0,0 +1,27 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template.tree;
+
+public record FieldConditionExpr( Exprs fieldPath ) implements ConditionExpr {}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/tree/IfCondition.java b/oap-formats/oap-template/src/main/java/oap/template/tree/IfCondition.java
index c5f6f391f..ad1211edf 100644
--- a/oap-formats/oap-template/src/main/java/oap/template/tree/IfCondition.java
+++ b/oap-formats/oap-template/src/main/java/oap/template/tree/IfCondition.java
@@ -3,11 +3,11 @@
import javax.annotation.Nullable;
public class IfCondition {
- public final Exprs condition;
+ public final ConditionExpr condition;
public final Exprs thenCode;
public final Exprs elseCode;
- public IfCondition( Exprs condition, Exprs thenCode, @Nullable Exprs elseCode ) {
+ public IfCondition( ConditionExpr condition, Exprs thenCode, @Nullable Exprs elseCode ) {
this.condition = condition;
this.thenCode = thenCode;
this.elseCode = elseCode;
diff --git a/oap-formats/oap-template/src/main/java/oap/template/tree/NotConditionExpr.java b/oap-formats/oap-template/src/main/java/oap/template/tree/NotConditionExpr.java
new file mode 100644
index 000000000..5b688d8b7
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/tree/NotConditionExpr.java
@@ -0,0 +1,27 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template.tree;
+
+public record NotConditionExpr( ConditionExpr inner ) implements ConditionExpr {}
diff --git a/oap-formats/oap-template/src/main/java/oap/template/tree/OrConditionExpr.java b/oap-formats/oap-template/src/main/java/oap/template/tree/OrConditionExpr.java
new file mode 100644
index 000000000..b341b9739
--- /dev/null
+++ b/oap-formats/oap-template/src/main/java/oap/template/tree/OrConditionExpr.java
@@ -0,0 +1,27 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Open Application Platform Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package oap.template.tree;
+
+public record OrConditionExpr( ConditionExpr left, ConditionExpr right ) implements ConditionExpr {}
diff --git a/oap-formats/oap-template/src/test/java/oap/template/AbstractTemplateEngineTest.java b/oap-formats/oap-template/src/test/java/oap/template/AbstractTemplateEngineTest.java
index d7f780ac3..5a8f00d29 100644
--- a/oap-formats/oap-template/src/test/java/oap/template/AbstractTemplateEngineTest.java
+++ b/oap-formats/oap-template/src/test/java/oap/template/AbstractTemplateEngineTest.java
@@ -1,11 +1,16 @@
package oap.template;
+import oap.reflect.TypeRef;
import oap.testng.Fixtures;
import oap.testng.TestDirectoryFixture;
import oap.util.Dates;
import org.testng.annotations.BeforeMethod;
import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.function.Consumer;
+
+import oap.template.render.AstRender;
public abstract class AbstractTemplateEngineTest extends Fixtures {
protected final TestDirectoryFixture testDirectoryFixture;
@@ -25,4 +30,50 @@ public void beforeCMethod() {
public void nameBefore( Method method ) {
testMethodName = method.getName();
}
+
+ /** Override to {@code true} in subclasses that run against the runtime interpreter. */
+ protected boolean useRuntime() {
+ return false;
+ }
+
+ protected >
+ Template getTemplate( String name, TypeRef type, String template, TA acc,
+ Consumer postProcess ) {
+ return useRuntime()
+ ? engine.getRuntimeTemplate( name, type, template, acc, postProcess )
+ : engine.getTemplate( name, type, template, acc, postProcess );
+ }
+
+ protected >
+ Template getTemplate( String name, TypeRef type, String template, TA acc,
+ Map aliases, Consumer postProcess ) {
+ return useRuntime()
+ ? engine.getRuntimeTemplate( name, type, template, acc, aliases, postProcess )
+ : engine.getTemplate( name, type, template, acc, aliases, postProcess );
+ }
+
+ protected >
+ Template getTemplate( String name, TypeRef type, String template, TA acc,
+ ErrorStrategy errorStrategy, Consumer postProcess ) {
+ return useRuntime()
+ ? engine.getRuntimeTemplate( name, type, template, acc, errorStrategy, postProcess )
+ : engine.getTemplate( name, type, template, acc, errorStrategy, postProcess );
+ }
+
+ protected >
+ Template getTemplate( String name, TypeRef type, String template, TA acc,
+ Map aliases, ErrorStrategy errorStrategy ) {
+ return useRuntime()
+ ? engine.getRuntimeTemplate( name, type, template, acc, aliases, errorStrategy )
+ : engine.getTemplate( name, type, template, acc, aliases, errorStrategy );
+ }
+
+ protected >
+ Template getTemplate( String name, TypeRef type, String template, TA acc,
+ Map aliases, ErrorStrategy errorStrategy,
+ Consumer postProcess ) {
+ return useRuntime()
+ ? engine.getRuntimeTemplate( name, type, template, acc, aliases, errorStrategy, postProcess )
+ : engine.getTemplate( name, type, template, acc, aliases, errorStrategy, postProcess );
+ }
}
diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConcatenationRuntimeTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConcatenationRuntimeTest.java
new file mode 100644
index 000000000..0523f1c21
--- /dev/null
+++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConcatenationRuntimeTest.java
@@ -0,0 +1,8 @@
+package oap.template;
+
+public class TemplateEngineConcatenationRuntimeTest extends TemplateEngineConcatenationTest {
+ @Override
+ protected boolean useRuntime() {
+ return true;
+ }
+}
diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConcatenationTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConcatenationTest.java
index bed54cce3..2bbbb97ff 100644
--- a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConcatenationTest.java
+++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConcatenationTest.java
@@ -39,7 +39,7 @@ public void testConcatenation() {
c.field = "f1";
c.field2 = "f2";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${{field,\"x\",field2}}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${{field,\"x\",field2}}", STRING, null ).render( c ).get() )
.isEqualTo( "f1xf2" );
}
@@ -49,7 +49,7 @@ public void testConcatenationWithNumber() {
c.intField = 3;
c.field2 = "f2";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${{intField,\"x\",field2}}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${{intField,\"x\",field2}}", STRING, null ).render( c ).get() )
.isEqualTo( "3xf2" );
}
@@ -61,7 +61,7 @@ public void testNestedConcatenation() {
c1.field = "f1";
c1.field2 = "f2";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${child{field,\"x\",field2}}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${child{field,\"x\",field2}}", STRING, null ).render( c ).get() )
.isEqualTo( "f1xf2" );
}
@@ -73,7 +73,7 @@ public void testNestedConcatenationWithDot() {
c1.field2 = "f1";
c1.field22 = "f2";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${child2.{field2,\"x\",field22}}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${child2.{field2,\"x\",field22}}", STRING, null ).render( c ).get() )
.isEqualTo( "f1xf2" );
}
@@ -89,7 +89,7 @@ public void testNestedNullableConcatenationWithDot() {
c11.field2 = "f1";
c11.intField = 5;
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${childNullable.childNullable.{field2,\"x\",intField}??''}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${childNullable.childNullable.{field2,\"x\",intField}??''}", STRING, null ).render( c ).get() )
.isEqualTo( "f1x5" );
}
@@ -105,7 +105,7 @@ public void testNestedOptConcatenationWithDot() {
c11.field2 = "f1";
c11.intField = 5;
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${childOpt.childOpt.{field2,\"x\",intField}??''}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${childOpt.childOpt.{field2,\"x\",intField}??''}", STRING, null ).render( c ).get() )
.isEqualTo( "f1x5" );
}
}
diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConditionRuntimeTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConditionRuntimeTest.java
new file mode 100644
index 000000000..6c2adb3d9
--- /dev/null
+++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConditionRuntimeTest.java
@@ -0,0 +1,8 @@
+package oap.template;
+
+public class TemplateEngineConditionRuntimeTest extends TemplateEngineConditionTest {
+ @Override
+ protected boolean useRuntime() {
+ return true;
+ }
+}
diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConditionTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConditionTest.java
index e21326fac..db994e997 100644
--- a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConditionTest.java
+++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConditionTest.java
@@ -27,6 +27,8 @@
import oap.reflect.TypeRef;
import org.testng.annotations.Test;
+import java.util.HashMap;
+
import static oap.template.ErrorStrategy.ERROR;
import static oap.template.TemplateAccumulators.STRING;
import static org.assertj.core.api.Assertions.assertThat;
@@ -38,7 +40,7 @@ public void testIfConditionTrue() {
TestTemplateClass c = new TestTemplateClass();
c.field = "val";
c.booleanField = true;
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "{{ if booleanField then field end }}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "{{ if booleanField then field end }}", STRING, null ).render( c ).get() )
.isEqualTo( "val" );
}
@@ -47,7 +49,7 @@ public void testIfConditionFalse() {
TestTemplateClass c = new TestTemplateClass();
c.field = "val";
c.booleanField = false;
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "{{ if booleanField then field end }}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "{{ if booleanField then field end }}", STRING, null ).render( c ).get() )
.isEqualTo( "" );
}
@@ -57,7 +59,7 @@ public void testIfElseConditionFalse() {
c.field = "val";
c.field2 = "val2";
c.booleanField = false;
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "{{ if booleanField then field else field2 end }}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "{{ if booleanField then field else field2 end }}", STRING, null ).render( c ).get() )
.isEqualTo( "val2" );
}
@@ -67,11 +69,11 @@ public void testIfConditionNullableObject() {
c.field = "val";
c.booleanObjectField = true;
- assertThat( engine.getTemplate( testMethodName + "True", new TypeRef() {}, "{{ if booleanObjectField then field end }}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName + "True", new TypeRef() {}, "{{ if booleanObjectField then field end }}", STRING, null ).render( c ).get() )
.isEqualTo( "val" );
c.booleanObjectField = null;
- assertThat( engine.getTemplate( testMethodName + "Null", new TypeRef() {}, "{{ if booleanObjectField then field end }}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName + "Null", new TypeRef() {}, "{{ if booleanObjectField then field end }}", STRING, null ).render( c ).get() )
.isEqualTo( "" );
}
@@ -80,7 +82,7 @@ public void testIfConditionWithText() {
TestTemplateClass c = new TestTemplateClass();
c.field = "val";
c.booleanField = true;
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "prefix-{{ if booleanField then field end }}-suffix", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "prefix-{{ if booleanField then field end }}-suffix", STRING, null ).render( c ).get() )
.isEqualTo( "prefix-val-suffix" );
}
@@ -88,16 +90,91 @@ public void testIfConditionWithText() {
public void testIfConditionWithDefaultValue() {
TestTemplateClass c = new TestTemplateClass();
c.booleanField = true;
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "{{ if booleanField then field end ?? 'default' }}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "{{ if booleanField then field end ?? 'default' }}", STRING, null ).render( c ).get() )
.isEqualTo( "default" );
}
+ @Test
+ public void testIfConditionAnd() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.field = "val";
+ c.booleanField = true;
+ c.booleanObjectField = true;
+ assertThat( getTemplate( testMethodName + "BothTrue", new TypeRef() {}, "{{ if booleanField and booleanObjectField then field end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "val" );
+
+ c.booleanObjectField = false;
+ assertThat( getTemplate( testMethodName + "SecondFalse", new TypeRef() {}, "{{ if booleanField and booleanObjectField then field end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "" );
+ }
+
+ @Test
+ public void testIfConditionOr() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.field = "val";
+ c.booleanField = false;
+ c.booleanObjectField = true;
+ assertThat( getTemplate( testMethodName + "SecondTrue", new TypeRef() {}, "{{ if booleanField or booleanObjectField then field end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "val" );
+
+ c.booleanObjectField = false;
+ assertThat( getTemplate( testMethodName + "BothFalse", new TypeRef() {}, "{{ if booleanField or booleanObjectField then field end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "" );
+ }
+
+ @Test
+ public void testIfConditionNot() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.field = "val";
+ c.booleanField = false;
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "{{ if not booleanField then field end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "val" );
+ }
+
+ @Test
+ public void testIfConditionBangNot() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.field = "val";
+ c.booleanField = true;
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "{{ if !booleanField then field end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "" );
+ }
+
+ @Test
+ public void testIfConditionAndString() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.field = "hello";
+ c.field2 = "world";
+ assertThat( getTemplate( testMethodName + "BothNonEmpty", new TypeRef() {}, "{{ if field and field2 then field end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "hello" );
+
+ c.field2 = "";
+ assertThat( getTemplate( testMethodName + "SecondEmpty", new TypeRef() {}, "{{ if field and field2 then field end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "" );
+
+ c.field = null;
+ c.field2 = "world";
+ assertThat( getTemplate( testMethodName + "FirstNullOrSecond", new TypeRef() {}, "{{ if field or field2 then field2 end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "world" );
+ }
+
+ @Test
+ public void testIfConditionComplex() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.field = "val";
+ c.booleanField = true;
+ c.booleanObjectField = true;
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
+ "{{ if (booleanField and booleanObjectField) and not booleanField then field end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "" );
+ }
+
@Test
public void testBlockIfTrue() {
TestTemplateClass c = new TestTemplateClass();
c.booleanField = true;
c.field = "hello";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {},
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
"{{% if booleanField }}{{ field }}{{% end }}", STRING, null ).render( c ).get() )
.isEqualTo( "hello" );
}
@@ -107,7 +184,7 @@ public void testBlockIfFalse() {
TestTemplateClass c = new TestTemplateClass();
c.booleanField = false;
c.field = "hello";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {},
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
"{{% if booleanField }}{{ field }}{{% end }}", STRING, null ).render( c ).get() )
.isEqualTo( "" );
}
@@ -118,7 +195,7 @@ public void testBlockIfElseTrue() {
c.booleanField = true;
c.field = "then-val";
c.field2 = "else-val";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {},
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
"{{% if booleanField }}{{ field }}{{% else }}{{ field2 }}{{% end }}", STRING, null ).render( c ).get() )
.isEqualTo( "then-val" );
}
@@ -129,7 +206,17 @@ public void testBlockIfElseFalse() {
c.booleanField = false;
c.field = "then-val";
c.field2 = "else-val";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {},
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
+ "{{% if booleanField }}{{ field }}{{% else }}{{ field2 }}{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "else-val" );
+ }
+
+ @Test
+ public void testBlockIfElseFalseMap() {
+ HashMap c = new HashMap<>();
+ c.put( "field", "then-val" );
+ c.put( "field2", "else-val" );
+ assertThat( getTemplate( testMethodName, new TypeRef>() {},
"{{% if booleanField }}{{ field }}{{% else }}{{ field2 }}{{% end }}", STRING, null ).render( c ).get() )
.isEqualTo( "else-val" );
}
@@ -139,7 +226,7 @@ public void testBlockIfNullableBoolTrue() {
TestTemplateClass c = new TestTemplateClass();
c.booleanObjectField = true;
c.field = "yes";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {},
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
"{{% if booleanObjectField }}{{ field }}{{% end }}", STRING, null ).render( c ).get() )
.isEqualTo( "yes" );
}
@@ -149,7 +236,7 @@ public void testBlockIfNullableBoolNull() {
TestTemplateClass c = new TestTemplateClass();
c.booleanObjectField = null;
c.field = "yes";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {},
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
"{{% if booleanObjectField }}{{ field }}{{% end }}", STRING, null ).render( c ).get() )
.isEqualTo( "" );
}
@@ -159,7 +246,7 @@ public void testBlockIfWithSurroundingText() {
TestTemplateClass c = new TestTemplateClass();
c.booleanField = true;
c.field = "world";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {},
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
"Hello {{% if booleanField }}{{ field }}{{% end }} done", STRING, null ).render( c ).get() )
.isEqualTo( "Hello world done" );
}
@@ -170,7 +257,7 @@ public void testBlockIfNestedPath() {
c.child = new TestTemplateClass();
c.child.booleanField = true;
c.child.field = "nested";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {},
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
"{{% if child.booleanField }}{{ child.field }}{{% end }}", STRING, null ).render( c ).get() )
.isEqualTo( "nested" );
}
@@ -180,7 +267,7 @@ public void testBlockIfMultiLineBody() {
TestTemplateClass c = new TestTemplateClass();
c.booleanField = true;
c.field = "myval";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {},
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
"{{% if booleanField }}\n value={{ field }}\n{{% end }}", STRING, null ).render( c ).get() )
.isEqualTo( "\n value=myval\n" );
}
@@ -192,7 +279,7 @@ public void testBlockIfNested() {
c.child = new TestTemplateClass();
c.child.booleanField = true;
c.child.field = "deep";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {},
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
"{{% if booleanField %}}{{% if child.booleanField }}{{ child.field }}{{% end }}{{% end }}", STRING, null ).render( c ).get() )
.isEqualTo( "deep" );
}
@@ -200,9 +287,114 @@ public void testBlockIfNested() {
@Test
public void testBlockIfUnknownFieldThrows() {
assertThatThrownBy( () ->
- engine.getTemplate( testMethodName, new TypeRef() {},
+ getTemplate( testMethodName, new TypeRef() {},
"{{% if unknownField }}x{{% end }}", STRING, ERROR, null ) )
.isInstanceOf( TemplateException.class );
}
+ @Test
+ public void testBlockIfAnd() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.booleanField = true;
+ c.booleanObjectField = true;
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
+ "{{% if booleanField and booleanObjectField }}yes{{% else }}no{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "yes" );
+ }
+
+ @Test
+ public void testBlockIfAndString() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.field = "1";
+ c.field2 = "2";
+ assertThat( getTemplate( testMethodName + "Both", new TypeRef() {},
+ "{{% if field and field2 }}yes{{% else }}no{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "yes" );
+
+ c.field2 = "";
+ assertThat( getTemplate( testMethodName + "SecondEmpty", new TypeRef() {},
+ "{{% if field and field2 }}yes{{% else }}no{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "no" );
+
+ c.field = null;
+ c.field2 = "2";
+ assertThat( getTemplate( testMethodName + "FirstNull", new TypeRef() {},
+ "{{% if field or field2 }}yes{{% else }}no{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "yes" );
+
+ c.field = "1";
+ assertThat( getTemplate( testMethodName + "Single", new TypeRef() {},
+ "{{% if field }}yes{{% else }}no{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "yes" );
+ }
+
+ @Test
+ public void testBlockIfAndFalse() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.booleanField = true;
+ c.booleanObjectField = false;
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
+ "{{% if booleanField and booleanObjectField }}yes{{% else }}no{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "no" );
+ }
+
+ @Test
+ public void testBlockIfOr() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.booleanField = false;
+ c.booleanObjectField = true;
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
+ "{{% if booleanField or booleanObjectField }}yes{{% else }}no{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "yes" );
+ }
+
+ @Test
+ public void testBlockIfOrFalse() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.booleanField = false;
+ c.booleanObjectField = false;
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
+ "{{% if booleanField or booleanObjectField }}yes{{% else }}no{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "no" );
+ }
+
+ @Test
+ public void testBlockIfNot() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.booleanField = false;
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
+ "{{% if not booleanField }}yes{{% else }}no{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "yes" );
+ }
+
+ @Test
+ public void testBlockIfBangNot() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.booleanField = true;
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
+ "{{% if !booleanField }}yes{{% else }}no{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "no" );
+ }
+
+ @Test
+ public void testBlockIfComplex() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.booleanField = true;
+ c.booleanObjectField = true;
+ c.field = "check";
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
+ "{{% if (booleanField and booleanObjectField) and not booleanField }}yes{{% else }}no{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "no" );
+ }
+
+ @Test
+ public void testBlockIfComplexTrue() {
+ TestTemplateClass c = new TestTemplateClass();
+ c.booleanField = true;
+ c.booleanObjectField = true;
+ assertThat( getTemplate( testMethodName, new TypeRef() {},
+ "{{% if (booleanField and booleanObjectField) and not booleanObjectField }}yes{{% else }}no{{% end }}", STRING, null ).render( c ).get() )
+ .isEqualTo( "no" );
+ }
+
}
diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineEnumRuntimeTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineEnumRuntimeTest.java
new file mode 100644
index 000000000..cd276ab7d
--- /dev/null
+++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineEnumRuntimeTest.java
@@ -0,0 +1,8 @@
+package oap.template;
+
+public class TemplateEngineEnumRuntimeTest extends TemplateEngineEnumTest {
+ @Override
+ protected boolean useRuntime() {
+ return true;
+ }
+}
diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineEnumTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineEnumTest.java
index 2bf652d98..a5b4fdcda 100644
--- a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineEnumTest.java
+++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineEnumTest.java
@@ -37,7 +37,7 @@ public class TemplateEngineEnumTest extends AbstractTemplateEngineTest {
public void testEnumField() {
var c = new TestTemplateClass();
c.enumFieldWithoutDefaultValue = TestTemplateEnumWithoutDefaultValue.VAL1;
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${enumFieldWithoutDefaultValue}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${enumFieldWithoutDefaultValue}", STRING, null ).render( c ).get() )
.isEqualTo( "VAL1" );
}
@@ -45,7 +45,7 @@ public void testEnumField() {
public void testEnumFieldDefault() {
var c = new TestTemplateClass();
c.enumField = null;
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${enumField??'VAL2'}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${enumField??'VAL2'}", STRING, null ).render( c ).get() )
.isEqualTo( "VAL2" );
}
@@ -53,7 +53,7 @@ public void testEnumFieldDefault() {
public void testEnumFieldWithoutDefault() {
var c = new TestTemplateClass();
c.enumField = null;
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${enumField}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${enumField}", STRING, null ).render( c ).get() )
.isEqualTo( "" );
}
@@ -61,7 +61,7 @@ public void testEnumFieldWithoutDefault() {
public void testEnumFieldDefaultEmptyAsUNKNOWN() {
var c = new TestTemplateClass();
c.enumField = null;
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${enumField??''}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${enumField??''}", STRING, null ).render( c ).get() )
.isEqualTo( "UNKNOWN" );
}
@@ -69,7 +69,7 @@ public void testEnumFieldDefaultEmptyAsUNKNOWN() {
public void testEnumFieldNonNull() {
var c = new TestTemplateClass();
c.nonNullEnumField = TestTemplateEnum.VAL2;
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${nonNullEnumField}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${nonNullEnumField}", STRING, null ).render( c ).get() )
.isEqualTo( "VAL2" );
}
@@ -77,7 +77,7 @@ public void testEnumFieldNonNull() {
public void testListEnum() {
var c = new TestTemplateClass();
c.listEnum = List.of( TestTemplateEnum.VAL2, TestTemplateEnum.VAL1 );
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${listEnum}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${listEnum}", STRING, null ).render( c ).get() )
.isEqualTo( "['VAL2','VAL1']" );
}
}
diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineFunctionsRuntimeTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineFunctionsRuntimeTest.java
new file mode 100644
index 000000000..3c9e6c1ea
--- /dev/null
+++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineFunctionsRuntimeTest.java
@@ -0,0 +1,8 @@
+package oap.template;
+
+public class TemplateEngineFunctionsRuntimeTest extends TemplateEngineFunctionsTest {
+ @Override
+ protected boolean useRuntime() {
+ return true;
+ }
+}
diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineFunctionsTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineFunctionsTest.java
index 8a5dcb46b..403556db6 100644
--- a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineFunctionsTest.java
+++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineFunctionsTest.java
@@ -39,16 +39,16 @@ public class TemplateEngineFunctionsTest extends AbstractTemplateEngineTest {
public void testMethod() {
TestTemplateClass c = new TestTemplateClass();
c.field = "val2";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${fieldM()}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${fieldM()}", STRING, null ).render( c ).get() )
.isEqualTo( "val2" );
}
@Test
public void testMethodDefault() {
TestTemplateClass c = new TestTemplateClass();
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${fieldM()??'d'}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${fieldM()??'d'}", STRING, null ).render( c ).get() )
.isEqualTo( "d" );
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${childM().field??'d'}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${childM().field??'d'}", STRING, null ).render( c ).get() )
.isEqualTo( "d" );
}
@@ -56,7 +56,7 @@ public void testMethodDefault() {
public void testMethodWithIntParameter() {
TestTemplateClass c = new TestTemplateClass();
c.field = "val2";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${fieldMInt(1 )}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${fieldMInt(1 )}", STRING, null ).render( c ).get() )
.isEqualTo( "val2-1" );
}
@@ -64,7 +64,7 @@ public void testMethodWithIntParameter() {
public void testMethodWithNegativeIntParameter() {
TestTemplateClass c = new TestTemplateClass();
c.field = "val2";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${fieldMInt( -1)}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${fieldMInt( -1)}", STRING, null ).render( c ).get() )
.isEqualTo( "val2--1" );
}
@@ -72,7 +72,7 @@ public void testMethodWithNegativeIntParameter() {
public void testMethodWithFloatParameter() {
TestTemplateClass c = new TestTemplateClass();
c.field = "val2";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${fieldMDouble(1.2 )}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${fieldMDouble(1.2 )}", STRING, null ).render( c ).get() )
.isEqualTo( "val2-1.2" );
}
@@ -80,33 +80,33 @@ public void testMethodWithFloatParameter() {
public void testMethodWithStringParameter() {
TestTemplateClass c = new TestTemplateClass();
c.field = "val2";
- assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, "${fieldMString( 'str')}", STRING, null ).render( c ).get() )
+ assertThat( getTemplate( testMethodName, new TypeRef() {}, "${fieldMString( 'str')}", STRING, null ).render( c ).get() )
.isEqualTo( "val2-str" );
}
@Test
public void testFunctionUrlencode() {
- assertThat( engine.getTemplate( "testFunctionUrlencode0", new TypeRef