This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-206
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-206 by this push:
new 230ff50 WIP.
230ff50 is described below
commit 230ff50d5844ee6ced9136afb1018ba34be98e0c
Author: Aaron Radzinski <[email protected]>
AuthorDate: Tue Mar 9 17:25:29 2021 -0800
WIP.
---
.../nlpcraft/model/intent/NCDslSynonym.scala | 2 +-
.../apache/nlpcraft/model/intent/NCDslTerm.scala | 2 +-
...slPredicate.scala => NCDslTokenPredicate.scala} | 2 +-
.../model/intent/compiler/NCDslBaselCompiler.scala | 4 +-
.../model/intent/compiler/NCDslCompiler.scala | 176 ++-
.../model/intent/solver/NCIntentSolverEngine.scala | 21 +-
.../intent/solver/NCIntentSolverVariant.scala | 19 +
.../nlpcraft/probe/mgrs/NCProbeSynonymChunk.scala | 7 +-
.../probe/mgrs/deploy/NCDeployManager.scala | 39 +-
.../mgrs/model/NCModelSynonymDslCompiler.scala | 290 ----
.../probe/mgrs/model/antlr4/NCSynonymDsl.g4 | 123 --
.../probe/mgrs/model/antlr4/NCSynonymDsl.interp | 101 --
.../probe/mgrs/model/antlr4/NCSynonymDsl.tokens | 67 -
.../model/antlr4/NCSynonymDslBaseListener.java | 207 ---
.../mgrs/model/antlr4/NCSynonymDslLexer.interp | 131 --
.../probe/mgrs/model/antlr4/NCSynonymDslLexer.java | 216 ---
.../mgrs/model/antlr4/NCSynonymDslLexer.tokens | 67 -
.../mgrs/model/antlr4/NCSynonymDslListener.java | 150 ---
.../mgrs/model/antlr4/NCSynonymDslParser.java | 1379 --------------------
19 files changed, 147 insertions(+), 2856 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslSynonym.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslSynonym.scala
index ef6ca09..1f2ba65 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslSynonym.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslSynonym.scala
@@ -27,7 +27,7 @@ import org.apache.nlpcraft.model.NCToken
*/
case class NCDslSynonym(
alias: Option[String],
- pred: NCDslPredicate,
+ pred: NCDslTokenPredicate,
) {
require(pred != null)
}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslTerm.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslTerm.scala
index 3b4ebe3..6002359 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslTerm.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslTerm.scala
@@ -30,7 +30,7 @@ import org.apache.nlpcraft.model.NCToken
*/
case class NCDslTerm(
id: Option[String],
- pred: NCDslPredicate,
+ pred: NCDslTokenPredicate,
min: Int,
max: Int,
conv: Boolean,
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslPredicate.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslTokenPredicate.scala
similarity index 86%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslPredicate.scala
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslTokenPredicate.scala
index 39b6844..a9191de 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslPredicate.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/NCDslTokenPredicate.scala
@@ -22,4 +22,4 @@ import org.apache.nlpcraft.model.NCToken
/**
*
*/
-trait NCDslPredicate extends ((NCToken, NCDslContext) ⇒ (Boolean
/*Predicate.*/ , Boolean /*Whether or not token was used.*/ ))
+trait NCDslTokenPredicate extends ((NCToken, NCDslContext) ⇒ (Boolean /*
Predicate. */ , Boolean /* Whether or not token was used. */ ))
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCDslBaselCompiler.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCDslBaselCompiler.scala
index 6983876..4ed3c81 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCDslBaselCompiler.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCDslBaselCompiler.scala
@@ -446,8 +446,8 @@ trait NCDslBaselCompiler {
pop1()
}
- def doSplit(): Unit = get2Str() match { case (s1, s2, f) ⇒
s1.split(asStr(s2)).foreach { pushAny(_, f) }}
- def doSplitTrim(): Unit = get2Str() match { case (s1, s2, f) ⇒
s1.split(asStr(s2)).foreach { s ⇒ pushAny(s.strip, f) }}
+ def doSplit(): Unit = get2Str() match { case (s1, s2, f) ⇒
s1.split(asStr(s2)).foreach { s ⇒ pushAny(s, f)(stack) }}
+ def doSplitTrim(): Unit = get2Str() match { case (s1, s2, f) ⇒
s1.split(asStr(s2)).foreach { s ⇒ pushAny(s.strip, f)(stack) }}
/*
* Collection, statistical operations.
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCDslCompiler.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCDslCompiler.scala
index 682e054..76df6fe 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCDslCompiler.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCDslCompiler.scala
@@ -20,11 +20,12 @@ package org.apache.nlpcraft.model.intent.compiler
import com.typesafe.scalalogging.LazyLogging
import org.antlr.v4.runtime.tree.ParseTreeWalker
import org.antlr.v4.runtime._
+import org.antlr.v4.runtime.{ParserRuleContext ⇒ PRC}
import org.apache.nlpcraft.common._
import
org.apache.nlpcraft.model.intent.compiler.antlr4.{NCIntentDslBaseListener,
NCIntentDslLexer, NCIntentDslParser ⇒ IDP}
import org.apache.nlpcraft.model.intent.compiler.{NCDslFragmentCache ⇒
FragCache}
import org.apache.nlpcraft.model._
-import org.apache.nlpcraft.model.intent.{NCDslContext, NCDslIntent,
NCDslSynonym, NCDslTerm}
+import org.apache.nlpcraft.model.intent.{NCDslContext, NCDslIntent,
NCDslTokenPredicate, NCDslSynonym, NCDslTerm}
import scala.collection.JavaConverters._
import java.nio.file.Path
@@ -149,27 +150,9 @@ object NCDslCompiler extends LazyLogging {
}
override def exitSynonym(ctx: IDP.SynonymContext): Unit = {
- implicit val evidence: ParserRuleContext = ctx
+ implicit val evidence: PRC = ctx
- val code = mutable.Buffer.empty[Instr] ++ instrs // Local copy.
-
- synonym = intent.NCDslSynonym(
- Option(alias),
- (tok: NCToken, termCtx: NCDslContext) ⇒ {
- val stack = new mutable.ArrayStack[NCDslExprRetVal]()
-
- // Execute all instructions.
- code.foreach(_ (tok, stack, termCtx))
-
- // Pop final result from stack.
- val x = stack.pop()
-
- if (!isBool(x.retVal))
- throw newRuntimeError(s"Synonym does not return
boolean value: ${ctx.getText}")
-
- asBool(x.retVal)
- }
- )
+ synonym = NCDslSynonym(Option(alias), instrToPredicate("Synonym"))
}
override def exitFragId(ctx: IDP.FragIdContext): Unit = {
@@ -204,7 +187,7 @@ object NCDslCompiler extends LazyLogging {
}
override def exitFlowDecl(ctx: IDP.FlowDeclContext): Unit = {
- implicit val evidence: ParserRuleContext = ctx
+ implicit val evidence: PRC = ctx
if (ctx.qstring() != null) {
val regex = ctx.qstring().getText
@@ -223,92 +206,73 @@ object NCDslCompiler extends LazyLogging {
}
override def exitTerm(ctx: IDP.TermContext): Unit = {
- implicit val c: ParserRuleContext = ctx
+ implicit val c: PRC = ctx
if (min < 0 || min > max)
throw newSyntaxError(s"Invalid intent term min quantifiers:
$min (must be min >= 0 && min <= max).")(ctx.minMax())
if (max < 1)
throw newSyntaxError(s"Invalid intent term max quantifiers:
$max (must be max >= 1).")(ctx.minMax())
- val pred =
- if (refMtdName != null) { // User-code defined term.
- // Closure copies.
- val clsName = refClsName.orNull
- val mtdName = refMtdName.orNull
-
- (tok: NCToken, termCtx: NCDslContext) ⇒ {
- val javaCtx: NCTokenPredicateContext = new
NCTokenPredicateContext {
- override lazy val getRequest: NCRequest =
termCtx.req
- override lazy val getToken: NCToken = tok
- override lazy val getIntentMeta:
Optional[NCMetadata] =
- if (termCtx.intentMeta != null)
-
Optional.of(NCMetadata.apply(termCtx.intentMeta.asJava))
- else
- Optional.empty()
- }
+ val pred: NCDslTokenPredicate = if (refMtdName != null) { //
User-code defined term.
+ // Closure copies.
+ val clsName = refClsName.orNull
+ val mtdName = refMtdName.orNull
- val mdl = tok.getModel
- val mdlCls = if (clsName == null)
mdl.meta[String](MDL_META_MODEL_CLASS_KEY) else clsName
+ (tok: NCToken, termCtx: NCDslContext) ⇒ {
+ val javaCtx: NCTokenPredicateContext = new
NCTokenPredicateContext {
+ override lazy val getRequest: NCRequest = termCtx.req
+ override lazy val getToken: NCToken = tok
+ override lazy val getIntentMeta: Optional[NCMetadata] =
+ if (termCtx.intentMeta != null)
+
Optional.of(NCMetadata.apply(termCtx.intentMeta.asJava))
+ else
+ Optional.empty()
+ }
- try {
- val obj = if (clsName == null) mdl else
U.mkObject(clsName)
- val mtd =
Thread.currentThread().getContextClassLoader.loadClass(mdlCls)
- .getMethod(mtdName,
classOf[NCTokenPredicateContext])
+ val mdl = tok.getModel
+ val mdlCls = if (clsName == null)
mdl.meta[String](MDL_META_MODEL_CLASS_KEY) else clsName
- var flag = mtd.canAccess(mdl)
+ try {
+ val obj = if (clsName == null) mdl else
U.mkObject(clsName)
+ val mtd =
Thread.currentThread().getContextClassLoader.loadClass(mdlCls)
+ .getMethod(mtdName,
classOf[NCTokenPredicateContext])
- val res = try {
- if (!flag) {
- mtd.setAccessible(true)
+ var flag = mtd.canAccess(mdl)
- flag = true
- }
- else
- flag = false
+ val res = try {
+ if (!flag) {
+ mtd.setAccessible(true)
- mtd.invoke(obj,
javaCtx).asInstanceOf[NCTokenPredicateResult]
- }
- finally {
- if (flag)
- try
- mtd.setAccessible(false)
- catch {
- case e: SecurityException ⇒
- throw new NCE(s"Access or security
error in custom intent term: $mdlCls.$mtdName", e)
- }
+ flag = true
}
+ else
+ flag = false
- (res.getResult, res.wasTokenUsed())
+ mtd.invoke(obj,
javaCtx).asInstanceOf[NCTokenPredicateResult]
}
- catch {
- case e: Exception ⇒
- throw newRuntimeError(s"Failed to invoke
custom intent term: $mdlCls.$mtdName", e)
+ finally {
+ if (flag)
+ try
+ mtd.setAccessible(false)
+ catch {
+ case e: SecurityException ⇒
+ throw new NCE(s"Access or security
error in custom intent term: $mdlCls.$mtdName", e)
+ }
}
- }
- }
- else { // DSL-defined term.
- val code = mutable.Buffer.empty[Instr]
-
- code ++= instrs
-
- (tok: NCToken, termCtx: NCDslContext) ⇒ {
- val stack = new mutable.ArrayStack[NCDslExprRetVal]()
-
- // Execute all instructions.
- code.foreach(_ (tok, stack, termCtx))
-
- // Pop final result from stack.
- val x = stack.pop()
- if (!isBool(x.retVal))
- throw newRuntimeError(s"Intent term does not
return boolean value: ${ctx.getText}")
-
- (asBool(x.retVal), x.usedTok)
+ (res.getResult, res.wasTokenUsed())
+ }
+ catch {
+ case e: Exception ⇒
+ throw newRuntimeError(s"Failed to invoke custom
intent term: $mdlCls.$mtdName", e)
}
}
+ }
+ else // DSL-defined term.
+ instrToPredicate("Intent term")
// Add term.
- terms += intent.NCDslTerm(
+ terms += NCDslTerm(
Option(termId),
pred,
min,
@@ -324,6 +288,32 @@ object NCDslCompiler extends LazyLogging {
refMtdName = None
}
+ /**
+ *
+ * @param subj
+ * @return
+ */
+ private def instrToPredicate(subj: String)(implicit ctx: PRC):
NCDslTokenPredicate = {
+ val code = mutable.Buffer.empty[Instr]
+
+ code ++= instrs
+
+ (tok: NCToken, termCtx: NCDslContext) ⇒ {
+ val stack = new mutable.ArrayStack[NCDslExprRetVal]()
+
+ // Execute all instructions.
+ code.foreach(_ (tok, stack, termCtx))
+
+ // Pop final result from stack.
+ val x = stack.pop()
+
+ if (!isBool(x.retVal))
+ throw newRuntimeError(s"$subj does not return boolean
value: ${ctx.getText}")
+
+ (asBool(x.retVal), x.usedTok)
+ }
+ }
+
override def exitFrag(ctx: IDP.FragContext): Unit = {
FragCache.add(mdlId, NCDslFragment(fragId, terms.toList))
@@ -331,7 +321,7 @@ object NCDslCompiler extends LazyLogging {
}
override def exitIntent(ctx: IDP.IntentContext): Unit = {
- intents += intent.NCDslIntent(
+ intents += NCDslIntent(
dsl,
intentId,
ordered,
@@ -471,7 +461,7 @@ object NCDslCompiler extends LazyLogging {
val x = dsl.strip()
val intents: Set[NCDslIntent] = intentCache.getOrElseUpdate(x, {
- val (fsm, parser) = antlr4Armature(x, mdlId)
+ val (fsm, parser) = antlr4Armature(x, mdlId, srcName)
// Parse the input DSL and walk built AST.
(new ParseTreeWalker).walk(fsm, parser.dsl())
@@ -542,7 +532,7 @@ object NCDslCompiler extends LazyLogging {
* accumulated in a static map keyed by model ID. Only intents are
returned, if any.
*
* @param filePath *.nc intent DSL file to compile.
- * @param mdlId ID of the model *.nc file belongs to.
+ * @param mdlId ID of the model *.nc file belongs to.
* @return
*/
@throws[NCE]
@@ -555,8 +545,8 @@ object NCDslCompiler extends LazyLogging {
* Compiles inline (supplied) fragments and/or intents. Note that
fragments are accumulated in a static
* map keyed by model ID. Only intents are returned, if any.
*
- * @param dsl Intent DSL to compile.
- * @param mdlId ID of the model DSL belongs to.
+ * @param dsl Intent DSL to compile.
+ * @param mdlId ID of the model DSL belongs to.
* @param srcName Optional source name.
* @return
*/
@@ -569,7 +559,7 @@ object NCDslCompiler extends LazyLogging {
/**
*
- * @param dsl Synonym DSL to compile.
+ * @param dsl Synonym DSL to compile.
* @param mdlId ID of the model DSL belongs to.
* @return
*/
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverEngine.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverEngine.scala
index f15bd07..5279f4b 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverEngine.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverEngine.scala
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.nlpcraft.model.intent.solver
import com.typesafe.scalalogging.LazyLogging
@@ -6,13 +23,13 @@ import org.apache.nlpcraft.common.debug.{NCLogGroupToken,
NCLogHolder}
import org.apache.nlpcraft.common.opencensus.NCOpenCensusTrace
import org.apache.nlpcraft.common._
import org.apache.nlpcraft.model.impl.NCTokenLogger
-import org.apache.nlpcraft.model.intent.utils.NCDslTerm
import org.apache.nlpcraft.model.{NCContext, NCIntentMatch, NCResult, NCToken}
import org.apache.nlpcraft.probe.mgrs.dialogflow.NCDialogFlowManager
import org.apache.nlpcraft.model.impl.NCTokenPimp._
import org.apache.nlpcraft.model.intent.{NCDslContext, NCDslIntent, NCDslTerm}
import java.util.function.Function
+import scala.collection.convert.ImplicitConversions._
import scala.collection.mutable
/**
@@ -23,7 +40,7 @@ object NCIntentSolverEngine extends LazyLogging with
NCOpenCensusTrace {
/**
* NOTE: not thread-safe.
*/
- private[impl] class Weight(ws: Int*) extends Ordered[Weight] {
+ private[solver] class Weight(ws: Int*) extends Ordered[Weight] {
private var buf = mutable.ArrayBuffer[Int]()
buf.appendAll(ws)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverVariant.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverVariant.scala
index e6b7da4..56e2d22 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverVariant.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverVariant.scala
@@ -1,7 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.nlpcraft.model.intent.solver
import org.apache.nlpcraft.model.NCToken
+import org.apache.nlpcraft.model.impl.NCTokenPimp._
+import scala.collection.JavaConverters._
import java.util
/**
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/NCProbeSynonymChunk.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/NCProbeSynonymChunk.scala
index 32aadca..252b33e 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/NCProbeSynonymChunk.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/NCProbeSynonymChunk.scala
@@ -18,8 +18,8 @@
package org.apache.nlpcraft.probe.mgrs
import java.util.regex.Pattern
-
import org.apache.nlpcraft.model.NCToken
+import org.apache.nlpcraft.model.intent.NCDslTokenPredicate
import org.apache.nlpcraft.probe.mgrs.NCProbeSynonymChunkKind._
/**
@@ -39,7 +39,10 @@ case class NCProbeSynonymChunk(
wordStem: String = null, // Only for kind == TEXT.
posTag: String = null,
regex: Pattern = null,
- dslPred: java.util.function.Function[NCToken, java.lang.Boolean] = null
+ dslPred: NCDslTokenPredicate = null
) {
+ require(origText != null)
+ require(kind != null)
+
override def toString = s"($origText|$kind)"
}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
index 6e3ddb4..28d3db6 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
@@ -33,12 +33,11 @@ import
org.apache.nlpcraft.common.nlp.core.{NCNlpCoreManager, NCNlpPorterStemmer
import org.apache.nlpcraft.common.util.NCUtils.{DSL_FIX, REGEX_FIX}
import org.apache.nlpcraft.model._
import org.apache.nlpcraft.model.factories.basic.NCBasicModelFactory
-import org.apache.nlpcraft.model.intent.compiler.NCIntentDslCompiler
+import org.apache.nlpcraft.model.intent.compiler.NCDslCompiler
import org.apache.nlpcraft.model.intent.solver.NCIntentSolver
-import org.apache.nlpcraft.model.intent.utils.NCDslIntent
+import org.apache.nlpcraft.model.intent._
import org.apache.nlpcraft.probe.mgrs.NCProbeSynonymChunkKind.{DSL, REGEX,
TEXT}
import org.apache.nlpcraft.probe.mgrs.{NCProbeModel, NCProbeSynonym,
NCProbeSynonymChunk, NCProbeSynonymsWrapper}
-import org.apache.nlpcraft.probe.mgrs.model.NCModelSynonymDslCompiler
import resource.managed
import scala.collection.JavaConverters._
@@ -467,17 +466,6 @@ object NCDeployManager extends NCService with
DecorateAsScala {
throw new NCE(s"Duplicated synonyms found and not allowed
[mdlId=$mdlId]")
}
- mdl.getMetadata.put(MDL_META_ALL_ELM_IDS_KEY,
- mdl.getElements.asScala.map(_.getId).toSet ++
- Set("nlpcraft:nlp") ++
- mdl.getEnabledBuiltInTokens.asScala
- )
- mdl.getMetadata.put(MDL_META_ALL_GRP_IDS_KEY,
- mdl.getElements.asScala.flatMap(_.getGroups.asScala).toSet ++
- Set("nlpcraft:nlp") ++
- mdl.getEnabledBuiltInTokens.asScala
- )
-
// Scan for intent annotations in the model class.
val intents = scanIntents(mdl)
var solver: NCIntentSolver = null
@@ -1006,9 +994,9 @@ object NCDeployManager extends NCService with
DecorateAsScala {
// DSL-based synonym.
else if (startsAndEnds(DSL_FIX, chunk)) {
val dsl = stripSuffix(DSL_FIX, chunk)
- val compUnit = NCModelSynonymDslCompiler.parse(dsl)
+ val compUnit = NCDslCompiler.compileSynonym(dsl, mdlId)
- val x = NCProbeSynonymChunk(alias = compUnit.alias, kind = DSL,
origText = chunk, dslPred = compUnit.predicate)
+ val x = NCProbeSynonymChunk(alias = compUnit.alias.orNull, kind =
DSL, origText = chunk, dslPred = compUnit.pred)
x
}
@@ -1121,7 +1109,7 @@ object NCDeployManager extends NCService with
DecorateAsScala {
s"callback=${method2Str(mtd)}" +
s"]")
- // Gets terms identifiers.
+ // Gets terms IDs.
val termIds = tokParamAnns.toList.zipWithIndex.map {
case (anns, idx) ⇒
def mkArg(): String = arg2Str(mtd, idx, ctxFirstParam)
@@ -1157,7 +1145,7 @@ object NCDeployManager extends NCService with
DecorateAsScala {
// Checks correctness of term IDs.
// Note we don't restrict them to be duplicated.
- val intentTermIds = terms.filter(_.id != null).map(_.id)
+ val intentTermIds = terms.flatMap(_.id)
val invalidIds = termIds.filter(id ⇒ !intentTermIds.contains(id))
if (invalidIds.nonEmpty) {
@@ -1179,7 +1167,7 @@ object NCDeployManager extends NCService with
DecorateAsScala {
// Checks limits.
val allLimits = terms.map(t ⇒ t.id → (t.min, t.max)).toMap
- checkMinMax(mdlId, mtd, tokParamTypes, termIds.map(allLimits),
ctxFirstParam)
+ checkMinMax(mdlId, mtd, tokParamTypes, termIds.map (allLimits),
ctxFirstParam)
// Prepares invocation method.
(ctx: NCIntentMatch) ⇒ {
@@ -1424,7 +1412,12 @@ object NCDeployManager extends NCService with
DecorateAsScala {
* @param ctxFirstParam
*/
@throws[NCE]
- private def checkMinMax(mdlId: String, mtd: Method, paramCls:
Seq[Class[_]], limits: Seq[(Int, Int)], ctxFirstParam: Boolean): Unit = {
+ private def checkMinMax(
+ mdlId: String,
+ mtd: Method,
+ paramCls: Seq[Class[_]],
+ limits: Seq[(Int, Int)],
+ ctxFirstParam: Boolean): Unit = {
require(paramCls.length == limits.length)
paramCls.zip(limits).zipWithIndex.foreach { case ((cls, (min, max)),
i) ⇒
@@ -1473,7 +1466,7 @@ object NCDeployManager extends NCService with
DecorateAsScala {
val mStr = method2Str(m)
// Process inline intent declarations by @NCIntent annotation.
- for (ann ← m.getAnnotationsByType(CLS_INTENT); intent ←
NCIntentDslCompiler.compileIntents(ann.value(), mdl.getId, mStr))
+ for (ann ← m.getAnnotationsByType(CLS_INTENT); intent ←
NCDslCompiler.compileIntents(ann.value(), mdl.getId, mStr))
intents += (intent → prepareCallback(m, mdl, intent))
// Process intent references from @NCIntentRef annotation.
@@ -1485,7 +1478,7 @@ object NCDeployManager extends NCService with
DecorateAsScala {
val compiledIntents = adapter
.getIntents
.asScala
- .flatMap(NCIntentDslCompiler.compileIntents(_,
mdl.getId, mStr))
+ .flatMap(NCDslCompiler.compileIntents(_,
mdl.getId, mStr))
U.getDups(compiledIntents.toSeq.map(_.id)) match {
case ids if ids.nonEmpty ⇒
@@ -1554,7 +1547,7 @@ object NCDeployManager extends NCService with
DecorateAsScala {
val distinct = seqSeq.map(_.distinct).distinct
for (ann ← intAnns) {
- for (intent ←
NCIntentDslCompiler.compileIntents(ann.value(), mdlId, mStr))
+ for (intent ←
NCDslCompiler.compileIntents(ann.value(), mdlId, mStr))
samples += (intent.id → distinct)
}
for (ann ← refAnns)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/NCModelSynonymDslCompiler.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/NCModelSynonymDslCompiler.scala
deleted file mode 100644
index 81b7175..0000000
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/NCModelSynonymDslCompiler.scala
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.nlpcraft.probe.mgrs.model
-
-import com.typesafe.scalalogging.LazyLogging
-import org.antlr.v4.runtime._
-import org.antlr.v4.runtime.tree._
-import org.apache.nlpcraft.common._
-import org.apache.nlpcraft.model.NCToken
-import org.apache.nlpcraft.model.intent.{NCDslSynonym, utils}
-import org.apache.nlpcraft.model.intent.utils._
-import org.apache.nlpcraft.probe.mgrs.model.antlr4.{NCSynonymDslBaseListener,
NCSynonymDslLexer, NCSynonymDslParser}
-
-import scala.collection.JavaConverters._
-import scala.collection.mutable
-import scala.collection.mutable.ArrayBuffer
-
-/**
- * Compiler for model synonym DSL.
- */
-object NCModelSynonymDslCompiler extends LazyLogging {
- private type Predicate = java.util.function.Function[NCToken,
java.lang.Boolean]
-
- def toJavaFunc(alias: String, func: NCToken ⇒ Boolean): Predicate = (tok:
NCToken) ⇒ {
- val res = func(tok)
-
- // Store predicate's alias, if any, in token metadata if this token
satisfies this predicate.
- // NOTE: token can have multiple aliases associated with it.
- if (res && alias != null) {
- val meta = tok.getMetadata
-
- if (!meta.containsKey(TOK_META_ALIASES_KEY))
- meta.put(TOK_META_ALIASES_KEY, new java.util.HashSet[String]())
-
- val aliases =
meta.get(TOK_META_ALIASES_KEY).asInstanceOf[java.util.Set[String]]
-
- aliases.add(alias)
- }
-
- res
- }
-
- /**
- *
- */
- class FiniteStateMachine extends NCSynonymDslBaseListener {
- private val predStack = new mutable.ArrayStack[NCToken ⇒ Boolean] //
Stack of predicates.
- private val tokQualParts = ArrayBuffer.empty[String] // lval parts
collector.
- private val rvalList = ArrayBuffer.empty[String] // rval list
collector.
- private var alias: String = _
- private var rval: String = _
-
- /**
- * Gets compiled synonym DSL.
- *
- * @return
- */
- def getCompiledSynonymDsl: NCDslSynonym = {
- utils.NCDslSynonym(alias, toJavaFunc(alias, predStack.pop()))
- }
-
-// override def exitRvalSingle(ctx:
NCSynonymDslParser.RvalSingleContext): Unit = {
-// rval = ctx.getText.trim()
-// }
-//
-// override def exitRvalList(ctx: NCSynonymDslParser.RvalListContext):
Unit = {
-// rvalList += rval
-// }
-
- override def exitTokQualPart(ctx:
NCSynonymDslParser.TokQualPartContext): Unit = {
- tokQualParts += ctx.ID().getText.trim()
- }
-
- override def exitAlias(ctx: NCSynonymDslParser.AliasContext): Unit = {
- alias = ctx.ID().getText.trim()
- }
-
- override def exitItem(ctx: NCSynonymDslParser.ItemContext): Unit = {
- if (ctx.EXCL() != null) {
- val p = predStack.pop
-
- predStack.push(new Function[NCToken, Boolean] {
- override def apply(tok: NCToken): Boolean = !p.apply(tok)
- override def toString: String = s"!$p"
- })
- }
- else if (ctx.AND() != null) {
- // Note that stack is LIFO so order is flipped.
- val p2 = predStack.pop
- val p1 = predStack.pop
-
- predStack.push(new Function[NCToken, Boolean] {
- override def apply(tok: NCToken): Boolean = {
- // To bypass any possible compiler optimizations.
- if (!p1.apply(tok))
- false
- else if (!p2.apply(tok))
- false
- else
- true
- }
- override def toString: String = s"$p1 && $p2"
- })
- }
- else if (ctx.OR() != null) {
- // Note that stack is LIFO so order is flipped.
- val p2 = predStack.pop
- val p1 = predStack.pop
-
- predStack.push(new Function[NCToken, Boolean] {
- override def apply(tok: NCToken): Boolean = {
- // To bypass any possible compiler optimizations.
- if (p1.apply(tok))
- true
- else if (p2.apply(tok))
- true
- else
- false
- }
- override def toString: String = s"$p1 || $p2"
- })
- }
- else if (ctx.RPAREN() != null && ctx.LPAREN() != null) {
- val p = predStack.pop
-
- predStack.push(new Function[NCToken, Boolean] {
- override def apply(tok: NCToken): Boolean = p.apply(tok)
- override def toString: String = s"($p)"
- })
- }
-
- // In all other cases the current predicate is already on the top
of the stack.
- }
-
- /**
- *
- * @param rv
- * @return
- */
- private def mkRvalObject(rv: String): Any = {
- if (rv == "null") null // Try 'null'.
- else if (rv == "true") true // Try 'boolean'.
- else if (rv == "false") false // Try 'boolean'.
- // Only numeric values below...
- else {
- // Strip '_' from numeric values.
- val rvalNum = rv.replaceAll("_", "")
-
- try
- java.lang.Integer.parseInt(rvalNum) // Try 'int'.
- catch {
- case _: NumberFormatException ⇒
- try
- java.lang.Long.parseLong(rvalNum) // Try 'long'.
- catch {
- case _: NumberFormatException ⇒
- try
- java.lang.Double.parseDouble(rvalNum) //
Try 'double'.
- catch {
- case _: NumberFormatException ⇒ rv //
String by default.
- }
- }
- }
- }
- }
-
-// override def exitPredicate(ctx:
NCSynonymDslParser.PredicateContext): Unit = {
-// var lval: String = null
-// var lvalFunc: String = null
-// var op: String = null
-//
-// def getLvalNode(tree: ParseTree): String =
-// tree.getChild(if (tree.getChildCount == 1) 0 else
1).getText.trim
-//
-// if (ctx.children.size() == 3) {
-// lval = getLvalNode(ctx.getChild(0))
-// op = ctx.getChild(1).getText.trim
-// }
-// else {
-// lvalFunc = ctx.getChild(0).getText.trim
-// lval = getLvalNode(ctx.getChild(2))
-// op = ctx.getChild(4).getText.trim
-// }
-//
-// val pred = new NCDslTokenPredicate(
-// tokQualParts.asJava,
-// lvalFunc,
-// lval,
-// op,
-// if (rvalList.isEmpty) mkRvalObject(rval) else
rvalList.map(mkRvalObject).asJava
-// )
-//
-// predStack.push(new Function[NCToken, Boolean] {
-// override def apply(tok: NCToken): Boolean = pred.apply(tok)
-// override def toString: String = pred.toString
-// })
-//
-// // Reset.
-// tokQualParts.clear()
-// rvalList.clear()
-// rval = null
-// }
- }
-
- /**
- * Custom error handler.
- */
- class CompilerErrorListener(dsl: String) extends BaseErrorListener {
- /**
- *
- * @param len
- * @param pos
- * @return
- */
- private def makeCharPosPointer(len: Int, pos: Int): String = {
- val s = (for (_ ← 1 to len) yield '-').mkString("")
-
- s.substring(0, pos - 1) + '^' + s.substring(pos)
- }
-
- /**
- *
- * @param recognizer
- * @param offendingSymbol
- * @param line
- * @param charPos
- * @param msg
- * @param e
- */
- override def syntaxError(
- recognizer: Recognizer[_, _],
- offendingSymbol: scala.Any,
- line: Int,
- charPos: Int,
- msg: String,
- e: RecognitionException): Unit = {
-
- val errMsg = s"Synonym DSL syntax error at line $line:$charPos -
$msg"
-
- logger.error(errMsg)
- logger.error(s" |-- ${c("Expression:")} $dsl")
- logger.error(s" +-- ${c("Error:")}
${makeCharPosPointer(dsl.length, charPos)}")
-
- throw new NCE(errMsg)
- }
- }
-
- /**
- *
- * @param dsl Synonym DSL to parse.
- * @return
- */
- def parse(dsl: String): NCDslSynonym = {
- require(dsl != null)
-
- // ANTLR4 armature.
- val lexer = new NCSynonymDslLexer(CharStreams.fromString(dsl))
- val tokens = new CommonTokenStream(lexer)
- val parser = new NCSynonymDslParser(tokens)
-
- // Set custom error handlers.
- lexer.removeErrorListeners()
- parser.removeErrorListeners()
- lexer.addErrorListener(new CompilerErrorListener(dsl))
- parser.addErrorListener(new CompilerErrorListener(dsl))
-
- // State automata.
- val fsm = new FiniteStateMachine
-
- // Parse the input DSL and walk built AST.
- (new ParseTreeWalker).walk(fsm, parser.synonym())
-
- fsm.getCompiledSynonymDsl
- }
-}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDsl.g4
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDsl.g4
deleted file mode 100644
index a889df1..0000000
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDsl.g4
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-grammar NCSynonymDsl;
-
-synonym
- : alias LPAREN item RPAREN EOF
- | item EOF
- ;
-alias: LBR ID RBR;
-item
- : pred
- | LPAREN item RPAREN
- | item (AND | OR) item
- | EXCL item
- ;
-pred: expr PRED_OP expr;
-expr
- : val
- | LPAREN expr RPAREN
- | expr mathOp expr
- | ID LPAREN expr? RPAREN // Buit-in function call.
- ;
-mathOp
- : MINUS
- | PLUS
- | STAR
- | DEVIDE
- ;
-val
- : singleVal
- | LPAREN val RPAREN
- | val COMMA singleVal
- ;
-singleVal
- : 'null'
- | MINUS? (INT | INT EXP)
- | BOOL
- | qstring
- | tokQual? ('id' | 'aliases' | 'startidx' | 'endidx' | 'parent' | 'groups'
| 'ancestors' | 'value')
- | tokQual? tokMeta
- | modelMeta
- | intentMeta
- ;
-tokQual
- : tokQualPart
- | tokQual tokQualPart
- ;
-tokQualPart: ID DOT;
-tokMeta // Token metadata: ~prop
- : TILDA ID
- | TILDA ID LBR INT RBR
- | TILDA ID LBR qstring RBR
- ;
-modelMeta // Model metadata: #prop
- : POUND ID
- | POUND ID LBR INT RBR
- | POUND ID LBR qstring RBR
- ;
-intentMeta // Intent metadata: $prop
- : DOLLAR ID
- | DOLLAR ID LBR INT RBR
- | DOLLAR ID LBR qstring RBR
- ;
-qstring
- : SQSTRING
- | DQSTRING
- ;
-SQSTRING: SQUOTE (~'\'')* SQUOTE;
-DQSTRING: DQUOTE (~'"')* DQUOTE;
-PRED_OP
- : '==' // Includes regex for strings.
- | '!=' // Includes regex for strings.
- | '>='
- | '<='
- | '>'
- | '<'
- | '@@' // Set or string containment.
- | '!@' // Set or string not containment.
- ;
-AND: '&&';
-OR: '||';
-EXCL: '!';
-LPAREN: '(';
-RPAREN: ')';
-SQUOTE: '\'';
-DQUOTE: '"';
-DOLLAR: '$';
-TILDA: '~';
-LBR: '[';
-RBR: ']';
-PLUS: '+';
-STAR: '*';
-DEVIDE: '/';
-COMMA: ',';
-COLON: ':';
-POUND: '#';
-MINUS: '-';
-DOT: '.';
-UNDERSCORE: '_';
-BOOL: 'true' | 'false';
-INT: '0' | [1-9][_0-9]*;
-EXP: DOT [0-9]+;
-ID: (UNDERSCORE|[a-z]|[A-Z])+([a-z]|[A-Z]|[0-9]|COLON|MINUS|UNDERSCORE)*;
-WS : [ \r\t\u000C\n]+ -> skip ;
-
-ErrorCharacter
- : .
- ;
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDsl.interp
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDsl.interp
deleted file mode 100644
index 0dca965..0000000
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDsl.interp
+++ /dev/null
@@ -1,101 +0,0 @@
-token literal names:
-null
-'null'
-'id'
-'aliases'
-'startidx'
-'endidx'
-'parent'
-'groups'
-'ancestors'
-'value'
-null
-null
-null
-'&&'
-'||'
-'!'
-'('
-')'
-'\''
-'"'
-'$'
-'~'
-'['
-']'
-'+'
-'*'
-'/'
-','
-':'
-'#'
-'-'
-'.'
-'_'
-null
-null
-null
-null
-null
-null
-
-token symbolic names:
-null
-null
-null
-null
-null
-null
-null
-null
-null
-null
-SQSTRING
-DQSTRING
-PRED_OP
-AND
-OR
-EXCL
-LPAREN
-RPAREN
-SQUOTE
-DQUOTE
-DOLLAR
-TILDA
-LBR
-RBR
-PLUS
-STAR
-DEVIDE
-COMMA
-COLON
-POUND
-MINUS
-DOT
-UNDERSCORE
-BOOL
-INT
-EXP
-ID
-WS
-ErrorCharacter
-
-rule names:
-synonym
-alias
-item
-pred
-expr
-mathOp
-val
-singleVal
-tokQual
-tokQualPart
-tokMeta
-modelMeta
-intentMeta
-qstring
-
-
-atn:
-[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 40, 192, 4, 2,
9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8,
4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9,
14, 4, 15, 9, 15, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2,
40, 10, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3,
4, 5, 4, 54, 10, 4, 3, 4, 3, 4, 3, 4, 7, 4, 59, 10, 4, 12, 4, 14, 4, 62, 11, 4,
3, 5, 3, 5, 3, 5, 3, [...]
\ No newline at end of file
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDsl.tokens
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDsl.tokens
deleted file mode 100644
index 041c397..0000000
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDsl.tokens
+++ /dev/null
@@ -1,67 +0,0 @@
-T__0=1
-T__1=2
-T__2=3
-T__3=4
-T__4=5
-T__5=6
-T__6=7
-T__7=8
-T__8=9
-SQSTRING=10
-DQSTRING=11
-PRED_OP=12
-AND=13
-OR=14
-EXCL=15
-LPAREN=16
-RPAREN=17
-SQUOTE=18
-DQUOTE=19
-DOLLAR=20
-TILDA=21
-LBR=22
-RBR=23
-PLUS=24
-STAR=25
-DEVIDE=26
-COMMA=27
-COLON=28
-POUND=29
-MINUS=30
-DOT=31
-UNDERSCORE=32
-BOOL=33
-INT=34
-EXP=35
-ID=36
-WS=37
-ErrorCharacter=38
-'null'=1
-'id'=2
-'aliases'=3
-'startidx'=4
-'endidx'=5
-'parent'=6
-'groups'=7
-'ancestors'=8
-'value'=9
-'&&'=13
-'||'=14
-'!'=15
-'('=16
-')'=17
-'\''=18
-'"'=19
-'$'=20
-'~'=21
-'['=22
-']'=23
-'+'=24
-'*'=25
-'/'=26
-','=27
-':'=28
-'#'=29
-'-'=30
-'.'=31
-'_'=32
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslBaseListener.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslBaseListener.java
deleted file mode 100644
index 26791e8..0000000
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslBaseListener.java
+++ /dev/null
@@ -1,207 +0,0 @@
-// Generated from C:/Users/Nikita
Ivanov/Documents/GitHub/incubator-nlpcraft/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4\NCSynonymDsl.g4
by ANTLR 4.9.1
-package org.apache.nlpcraft.probe.mgrs.model.antlr4;
-
-import org.antlr.v4.runtime.ParserRuleContext;
-import org.antlr.v4.runtime.tree.ErrorNode;
-import org.antlr.v4.runtime.tree.TerminalNode;
-
-/**
- * This class provides an empty implementation of {@link NCSynonymDslListener},
- * which can be extended to create a listener which only needs to handle a
subset
- * of the available methods.
- */
-public class NCSynonymDslBaseListener implements NCSynonymDslListener {
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void enterSynonym(NCSynonymDslParser.SynonymContext
ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitSynonym(NCSynonymDslParser.SynonymContext
ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void enterAlias(NCSynonymDslParser.AliasContext ctx) {
}
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitAlias(NCSynonymDslParser.AliasContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void enterItem(NCSynonymDslParser.ItemContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitItem(NCSynonymDslParser.ItemContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void enterPred(NCSynonymDslParser.PredContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitPred(NCSynonymDslParser.PredContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void enterExpr(NCSynonymDslParser.ExprContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitExpr(NCSynonymDslParser.ExprContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void enterMathOp(NCSynonymDslParser.MathOpContext ctx)
{ }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitMathOp(NCSynonymDslParser.MathOpContext ctx)
{ }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void enterVal(NCSynonymDslParser.ValContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitVal(NCSynonymDslParser.ValContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void
enterSingleVal(NCSynonymDslParser.SingleValContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitSingleVal(NCSynonymDslParser.SingleValContext
ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void enterTokQual(NCSynonymDslParser.TokQualContext
ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitTokQual(NCSynonymDslParser.TokQualContext
ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void
enterTokQualPart(NCSynonymDslParser.TokQualPartContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void
exitTokQualPart(NCSynonymDslParser.TokQualPartContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void enterTokMeta(NCSynonymDslParser.TokMetaContext
ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitTokMeta(NCSynonymDslParser.TokMetaContext
ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void
enterModelMeta(NCSynonymDslParser.ModelMetaContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitModelMeta(NCSynonymDslParser.ModelMetaContext
ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void
enterIntentMeta(NCSynonymDslParser.IntentMetaContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void
exitIntentMeta(NCSynonymDslParser.IntentMetaContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void enterQstring(NCSynonymDslParser.QstringContext
ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitQstring(NCSynonymDslParser.QstringContext
ctx) { }
-
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void enterEveryRule(ParserRuleContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void exitEveryRule(ParserRuleContext ctx) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void visitTerminal(TerminalNode node) { }
- /**
- * {@inheritDoc}
- *
- * <p>The default implementation does nothing.</p>
- */
- @Override public void visitErrorNode(ErrorNode node) { }
-}
\ No newline at end of file
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslLexer.interp
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslLexer.interp
deleted file mode 100644
index d3cec1e..0000000
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslLexer.interp
+++ /dev/null
@@ -1,131 +0,0 @@
-token literal names:
-null
-'null'
-'id'
-'aliases'
-'startidx'
-'endidx'
-'parent'
-'groups'
-'ancestors'
-'value'
-null
-null
-null
-'&&'
-'||'
-'!'
-'('
-')'
-'\''
-'"'
-'$'
-'~'
-'['
-']'
-'+'
-'*'
-'/'
-','
-':'
-'#'
-'-'
-'.'
-'_'
-null
-null
-null
-null
-null
-null
-
-token symbolic names:
-null
-null
-null
-null
-null
-null
-null
-null
-null
-null
-SQSTRING
-DQSTRING
-PRED_OP
-AND
-OR
-EXCL
-LPAREN
-RPAREN
-SQUOTE
-DQUOTE
-DOLLAR
-TILDA
-LBR
-RBR
-PLUS
-STAR
-DEVIDE
-COMMA
-COLON
-POUND
-MINUS
-DOT
-UNDERSCORE
-BOOL
-INT
-EXP
-ID
-WS
-ErrorCharacter
-
-rule names:
-T__0
-T__1
-T__2
-T__3
-T__4
-T__5
-T__6
-T__7
-T__8
-SQSTRING
-DQSTRING
-PRED_OP
-AND
-OR
-EXCL
-LPAREN
-RPAREN
-SQUOTE
-DQUOTE
-DOLLAR
-TILDA
-LBR
-RBR
-PLUS
-STAR
-DEVIDE
-COMMA
-COLON
-POUND
-MINUS
-DOT
-UNDERSCORE
-BOOL
-INT
-EXP
-ID
-WS
-ErrorCharacter
-
-channel names:
-DEFAULT_TOKEN_CHANNEL
-HIDDEN
-
-mode names:
-DEFAULT_MODE
-
-atn:
-[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 40, 267, 8, 1,
4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8,
9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4,
14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9,
19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4,
25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9,
30, 4, 31, 9, 31, 4, 32, 9, [...]
\ No newline at end of file
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslLexer.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslLexer.java
deleted file mode 100644
index 3c4fbb0..0000000
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslLexer.java
+++ /dev/null
@@ -1,216 +0,0 @@
-// Generated from C:/Users/Nikita
Ivanov/Documents/GitHub/incubator-nlpcraft/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4\NCSynonymDsl.g4
by ANTLR 4.9.1
-package org.apache.nlpcraft.probe.mgrs.model.antlr4;
-import org.antlr.v4.runtime.Lexer;
-import org.antlr.v4.runtime.CharStream;
-import org.antlr.v4.runtime.Token;
-import org.antlr.v4.runtime.TokenStream;
-import org.antlr.v4.runtime.*;
-import org.antlr.v4.runtime.atn.*;
-import org.antlr.v4.runtime.dfa.DFA;
-import org.antlr.v4.runtime.misc.*;
-
-@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
-public class NCSynonymDslLexer extends Lexer {
- static { RuntimeMetaData.checkVersion("4.9.1",
RuntimeMetaData.VERSION); }
-
- protected static final DFA[] _decisionToDFA;
- protected static final PredictionContextCache _sharedContextCache =
- new PredictionContextCache();
- public static final int
- T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8,
T__8=9,
- SQSTRING=10, DQSTRING=11, PRED_OP=12, AND=13, OR=14, EXCL=15,
LPAREN=16,
- RPAREN=17, SQUOTE=18, DQUOTE=19, DOLLAR=20, TILDA=21, LBR=22,
RBR=23,
- PLUS=24, STAR=25, DEVIDE=26, COMMA=27, COLON=28, POUND=29,
MINUS=30, DOT=31,
- UNDERSCORE=32, BOOL=33, INT=34, EXP=35, ID=36, WS=37,
ErrorCharacter=38;
- public static String[] channelNames = {
- "DEFAULT_TOKEN_CHANNEL", "HIDDEN"
- };
-
- public static String[] modeNames = {
- "DEFAULT_MODE"
- };
-
- private static String[] makeRuleNames() {
- return new String[] {
- "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
"T__7", "T__8",
- "SQSTRING", "DQSTRING", "PRED_OP", "AND", "OR", "EXCL",
"LPAREN", "RPAREN",
- "SQUOTE", "DQUOTE", "DOLLAR", "TILDA", "LBR", "RBR",
"PLUS", "STAR",
- "DEVIDE", "COMMA", "COLON", "POUND", "MINUS", "DOT",
"UNDERSCORE", "BOOL",
- "INT", "EXP", "ID", "WS", "ErrorCharacter"
- };
- }
- public static final String[] ruleNames = makeRuleNames();
-
- private static String[] makeLiteralNames() {
- return new String[] {
- null, "'null'", "'id'", "'aliases'", "'startidx'",
"'endidx'", "'parent'",
- "'groups'", "'ancestors'", "'value'", null, null, null,
"'&&'", "'||'",
- "'!'", "'('", "')'", "'''", "'\"'", "'$'", "'~'",
"'['", "']'", "'+'",
- "'*'", "'/'", "','", "':'", "'#'", "'-'", "'.'", "'_'"
- };
- }
- private static final String[] _LITERAL_NAMES = makeLiteralNames();
- private static String[] makeSymbolicNames() {
- return new String[] {
- null, null, null, null, null, null, null, null, null,
null, "SQSTRING",
- "DQSTRING", "PRED_OP", "AND", "OR", "EXCL", "LPAREN",
"RPAREN", "SQUOTE",
- "DQUOTE", "DOLLAR", "TILDA", "LBR", "RBR", "PLUS",
"STAR", "DEVIDE",
- "COMMA", "COLON", "POUND", "MINUS", "DOT",
"UNDERSCORE", "BOOL", "INT",
- "EXP", "ID", "WS", "ErrorCharacter"
- };
- }
- private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
- public static final Vocabulary VOCABULARY = new
VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
-
- /**
- * @deprecated Use {@link #VOCABULARY} instead.
- */
- @Deprecated
- public static final String[] tokenNames;
- static {
- tokenNames = new String[_SYMBOLIC_NAMES.length];
- for (int i = 0; i < tokenNames.length; i++) {
- tokenNames[i] = VOCABULARY.getLiteralName(i);
- if (tokenNames[i] == null) {
- tokenNames[i] = VOCABULARY.getSymbolicName(i);
- }
-
- if (tokenNames[i] == null) {
- tokenNames[i] = "<INVALID>";
- }
- }
- }
-
- @Override
- @Deprecated
- public String[] getTokenNames() {
- return tokenNames;
- }
-
- @Override
-
- public Vocabulary getVocabulary() {
- return VOCABULARY;
- }
-
-
- public NCSynonymDslLexer(CharStream input) {
- super(input);
- _interp = new
LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
- }
-
- @Override
- public String getGrammarFileName() { return "NCSynonymDsl.g4"; }
-
- @Override
- public String[] getRuleNames() { return ruleNames; }
-
- @Override
- public String getSerializedATN() { return _serializedATN; }
-
- @Override
- public String[] getChannelNames() { return channelNames; }
-
- @Override
- public String[] getModeNames() { return modeNames; }
-
- @Override
- public ATN getATN() { return _ATN; }
-
- public static final String _serializedATN =
-
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2(\u010b\b\1\4\2\t"+
-
"\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
-
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
-
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
- "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4
\t \4!"+
-
"\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\3\2\3\2\3\2\3\2\3\2\3\3\3"+
-
"\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5"+
-
"\3\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\b\3\b\3"+
-
"\b\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n"+
-
"\3\n\3\n\3\n\3\13\3\13\7\13\u0090\n\13\f\13\16\13\u0093\13\13\3\13\3\13"+
-
"\3\f\3\f\7\f\u0099\n\f\f\f\16\f\u009c\13\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r"+
-
"\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\5\r\u00ad\n\r\3\16\3\16\3\16\3\17\3\17"+
-
"\3\17\3\20\3\20\3\21\3\21\3\22\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\26"+
-
"\3\26\3\27\3\27\3\30\3\30\3\31\3\31\3\32\3\32\3\33\3\33\3\34\3\34\3\35"+
- "\3\35\3\36\3\36\3\37\3\37\3 \3
\3!\3!\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\""+
-
"\3\"\5\"\u00e2\n\"\3#\3#\3#\7#\u00e7\n#\f#\16#\u00ea\13#\5#\u00ec\n#\3"+
-
"$\3$\6$\u00f0\n$\r$\16$\u00f1\3%\3%\6%\u00f6\n%\r%\16%\u00f7\3%\3%\3%"+
-
"\3%\7%\u00fe\n%\f%\16%\u0101\13%\3&\6&\u0104\n&\r&\16&\u0105\3&\3&\3\'"+
-
"\3\'\2\2(\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33"+
-
"\17\35\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67"+
- "\359\36;\37=
?!A\"C#E$G%I&K\'M(\3\2\13\3\2))\3\2$$\4\2>>@@\3\2\63;\4\2"+
-
"\62;aa\3\2\62;\4\2C\\c|\5\2\62;C\\c|\5\2\13\f\16\17\"\"\2\u011d\2\3\3"+
-
"\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2"+
-
"\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3"+
-
"\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2"+
-
"%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61"+
-
"\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2"+
-
"\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I"+
-
"\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\3O\3\2\2\2\5T\3\2\2\2\7W\3\2\2\2\t_\3\2"+
-
"\2\2\13h\3\2\2\2\ro\3\2\2\2\17v\3\2\2\2\21}\3\2\2\2\23\u0087\3\2\2\2\25"+
-
"\u008d\3\2\2\2\27\u0096\3\2\2\2\31\u00ac\3\2\2\2\33\u00ae\3\2\2\2\35\u00b1"+
-
"\3\2\2\2\37\u00b4\3\2\2\2!\u00b6\3\2\2\2#\u00b8\3\2\2\2%\u00ba\3\2\2\2"+
-
"\'\u00bc\3\2\2\2)\u00be\3\2\2\2+\u00c0\3\2\2\2-\u00c2\3\2\2\2/\u00c4\3"+
-
"\2\2\2\61\u00c6\3\2\2\2\63\u00c8\3\2\2\2\65\u00ca\3\2\2\2\67\u00cc\3\2"+
-
"\2\29\u00ce\3\2\2\2;\u00d0\3\2\2\2=\u00d2\3\2\2\2?\u00d4\3\2\2\2A\u00d6"+
-
"\3\2\2\2C\u00e1\3\2\2\2E\u00eb\3\2\2\2G\u00ed\3\2\2\2I\u00f5\3\2\2\2K"+
-
"\u0103\3\2\2\2M\u0109\3\2\2\2OP\7p\2\2PQ\7w\2\2QR\7n\2\2RS\7n\2\2S\4\3"+
-
"\2\2\2TU\7k\2\2UV\7f\2\2V\6\3\2\2\2WX\7c\2\2XY\7n\2\2YZ\7k\2\2Z[\7c\2"+
-
"\2[\\\7u\2\2\\]\7g\2\2]^\7u\2\2^\b\3\2\2\2_`\7u\2\2`a\7v\2\2ab\7c\2\2"+
-
"bc\7t\2\2cd\7v\2\2de\7k\2\2ef\7f\2\2fg\7z\2\2g\n\3\2\2\2hi\7g\2\2ij\7"+
-
"p\2\2jk\7f\2\2kl\7k\2\2lm\7f\2\2mn\7z\2\2n\f\3\2\2\2op\7r\2\2pq\7c\2\2"+
-
"qr\7t\2\2rs\7g\2\2st\7p\2\2tu\7v\2\2u\16\3\2\2\2vw\7i\2\2wx\7t\2\2xy\7"+
-
"q\2\2yz\7w\2\2z{\7r\2\2{|\7u\2\2|\20\3\2\2\2}~\7c\2\2~\177\7p\2\2\177"+
-
"\u0080\7e\2\2\u0080\u0081\7g\2\2\u0081\u0082\7u\2\2\u0082\u0083\7v\2\2"+
-
"\u0083\u0084\7q\2\2\u0084\u0085\7t\2\2\u0085\u0086\7u\2\2\u0086\22\3\2"+
-
"\2\2\u0087\u0088\7x\2\2\u0088\u0089\7c\2\2\u0089\u008a\7n\2\2\u008a\u008b"+
-
"\7w\2\2\u008b\u008c\7g\2\2\u008c\24\3\2\2\2\u008d\u0091\5%\23\2\u008e"+
-
"\u0090\n\2\2\2\u008f\u008e\3\2\2\2\u0090\u0093\3\2\2\2\u0091\u008f\3\2"+
-
"\2\2\u0091\u0092\3\2\2\2\u0092\u0094\3\2\2\2\u0093\u0091\3\2\2\2\u0094"+
-
"\u0095\5%\23\2\u0095\26\3\2\2\2\u0096\u009a\5\'\24\2\u0097\u0099\n\3\2"+
-
"\2\u0098\u0097\3\2\2\2\u0099\u009c\3\2\2\2\u009a\u0098\3\2\2\2\u009a\u009b"+
-
"\3\2\2\2\u009b\u009d\3\2\2\2\u009c\u009a\3\2\2\2\u009d\u009e\5\'\24\2"+
-
"\u009e\30\3\2\2\2\u009f\u00a0\7?\2\2\u00a0\u00ad\7?\2\2\u00a1\u00a2\7"+
-
"#\2\2\u00a2\u00ad\7?\2\2\u00a3\u00a4\7@\2\2\u00a4\u00ad\7?\2\2\u00a5\u00a6"+
-
"\7>\2\2\u00a6\u00ad\7?\2\2\u00a7\u00ad\t\4\2\2\u00a8\u00a9\7B\2\2\u00a9"+
-
"\u00ad\7B\2\2\u00aa\u00ab\7#\2\2\u00ab\u00ad\7B\2\2\u00ac\u009f\3\2\2"+
-
"\2\u00ac\u00a1\3\2\2\2\u00ac\u00a3\3\2\2\2\u00ac\u00a5\3\2\2\2\u00ac\u00a7"+
-
"\3\2\2\2\u00ac\u00a8\3\2\2\2\u00ac\u00aa\3\2\2\2\u00ad\32\3\2\2\2\u00ae"+
-
"\u00af\7(\2\2\u00af\u00b0\7(\2\2\u00b0\34\3\2\2\2\u00b1\u00b2\7~\2\2\u00b2"+
- "\u00b3\7~\2\2\u00b3\36\3\2\2\2\u00b4\u00b5\7#\2\2\u00b5
\3\2\2\2\u00b6"+
-
"\u00b7\7*\2\2\u00b7\"\3\2\2\2\u00b8\u00b9\7+\2\2\u00b9$\3\2\2\2\u00ba"+
-
"\u00bb\7)\2\2\u00bb&\3\2\2\2\u00bc\u00bd\7$\2\2\u00bd(\3\2\2\2\u00be\u00bf"+
-
"\7&\2\2\u00bf*\3\2\2\2\u00c0\u00c1\7\u0080\2\2\u00c1,\3\2\2\2\u00c2\u00c3"+
-
"\7]\2\2\u00c3.\3\2\2\2\u00c4\u00c5\7_\2\2\u00c5\60\3\2\2\2\u00c6\u00c7"+
-
"\7-\2\2\u00c7\62\3\2\2\2\u00c8\u00c9\7,\2\2\u00c9\64\3\2\2\2\u00ca\u00cb"+
-
"\7\61\2\2\u00cb\66\3\2\2\2\u00cc\u00cd\7.\2\2\u00cd8\3\2\2\2\u00ce\u00cf"+
-
"\7<\2\2\u00cf:\3\2\2\2\u00d0\u00d1\7%\2\2\u00d1<\3\2\2\2\u00d2\u00d3\7"+
-
"/\2\2\u00d3>\3\2\2\2\u00d4\u00d5\7\60\2\2\u00d5@\3\2\2\2\u00d6\u00d7\7"+
-
"a\2\2\u00d7B\3\2\2\2\u00d8\u00d9\7v\2\2\u00d9\u00da\7t\2\2\u00da\u00db"+
-
"\7w\2\2\u00db\u00e2\7g\2\2\u00dc\u00dd\7h\2\2\u00dd\u00de\7c\2\2\u00de"+
-
"\u00df\7n\2\2\u00df\u00e0\7u\2\2\u00e0\u00e2\7g\2\2\u00e1\u00d8\3\2\2"+
-
"\2\u00e1\u00dc\3\2\2\2\u00e2D\3\2\2\2\u00e3\u00ec\7\62\2\2\u00e4\u00e8"+
-
"\t\5\2\2\u00e5\u00e7\t\6\2\2\u00e6\u00e5\3\2\2\2\u00e7\u00ea\3\2\2\2\u00e8"+
-
"\u00e6\3\2\2\2\u00e8\u00e9\3\2\2\2\u00e9\u00ec\3\2\2\2\u00ea\u00e8\3\2"+
-
"\2\2\u00eb\u00e3\3\2\2\2\u00eb\u00e4\3\2\2\2\u00ecF\3\2\2\2\u00ed\u00ef"+
- "\5?
\2\u00ee\u00f0\t\7\2\2\u00ef\u00ee\3\2\2\2\u00f0\u00f1\3\2\2\2\u00f1"+
-
"\u00ef\3\2\2\2\u00f1\u00f2\3\2\2\2\u00f2H\3\2\2\2\u00f3\u00f6\5A!\2\u00f4"+
-
"\u00f6\t\b\2\2\u00f5\u00f3\3\2\2\2\u00f5\u00f4\3\2\2\2\u00f6\u00f7\3\2"+
-
"\2\2\u00f7\u00f5\3\2\2\2\u00f7\u00f8\3\2\2\2\u00f8\u00ff\3\2\2\2\u00f9"+
-
"\u00fe\t\t\2\2\u00fa\u00fe\59\35\2\u00fb\u00fe\5=\37\2\u00fc\u00fe\5A"+
-
"!\2\u00fd\u00f9\3\2\2\2\u00fd\u00fa\3\2\2\2\u00fd\u00fb\3\2\2\2\u00fd"+
-
"\u00fc\3\2\2\2\u00fe\u0101\3\2\2\2\u00ff\u00fd\3\2\2\2\u00ff\u0100\3\2"+
-
"\2\2\u0100J\3\2\2\2\u0101\u00ff\3\2\2\2\u0102\u0104\t\n\2\2\u0103\u0102"+
-
"\3\2\2\2\u0104\u0105\3\2\2\2\u0105\u0103\3\2\2\2\u0105\u0106\3\2\2\2\u0106"+
-
"\u0107\3\2\2\2\u0107\u0108\b&\2\2\u0108L\3\2\2\2\u0109\u010a\13\2\2\2"+
-
"\u010aN\3\2\2\2\17\2\u0091\u009a\u00ac\u00e1\u00e8\u00eb\u00f1\u00f5\u00f7"+
- "\u00fd\u00ff\u0105\3\b\2\2";
- public static final ATN _ATN =
- new ATNDeserializer().deserialize(_serializedATN.toCharArray());
- static {
- _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
- for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
- _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i),
i);
- }
- }
-}
\ No newline at end of file
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslLexer.tokens
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslLexer.tokens
deleted file mode 100644
index 041c397..0000000
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslLexer.tokens
+++ /dev/null
@@ -1,67 +0,0 @@
-T__0=1
-T__1=2
-T__2=3
-T__3=4
-T__4=5
-T__5=6
-T__6=7
-T__7=8
-T__8=9
-SQSTRING=10
-DQSTRING=11
-PRED_OP=12
-AND=13
-OR=14
-EXCL=15
-LPAREN=16
-RPAREN=17
-SQUOTE=18
-DQUOTE=19
-DOLLAR=20
-TILDA=21
-LBR=22
-RBR=23
-PLUS=24
-STAR=25
-DEVIDE=26
-COMMA=27
-COLON=28
-POUND=29
-MINUS=30
-DOT=31
-UNDERSCORE=32
-BOOL=33
-INT=34
-EXP=35
-ID=36
-WS=37
-ErrorCharacter=38
-'null'=1
-'id'=2
-'aliases'=3
-'startidx'=4
-'endidx'=5
-'parent'=6
-'groups'=7
-'ancestors'=8
-'value'=9
-'&&'=13
-'||'=14
-'!'=15
-'('=16
-')'=17
-'\''=18
-'"'=19
-'$'=20
-'~'=21
-'['=22
-']'=23
-'+'=24
-'*'=25
-'/'=26
-','=27
-':'=28
-'#'=29
-'-'=30
-'.'=31
-'_'=32
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslListener.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslListener.java
deleted file mode 100644
index 146ef51..0000000
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslListener.java
+++ /dev/null
@@ -1,150 +0,0 @@
-// Generated from C:/Users/Nikita
Ivanov/Documents/GitHub/incubator-nlpcraft/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4\NCSynonymDsl.g4
by ANTLR 4.9.1
-package org.apache.nlpcraft.probe.mgrs.model.antlr4;
-import org.antlr.v4.runtime.tree.ParseTreeListener;
-
-/**
- * This interface defines a complete listener for a parse tree produced by
- * {@link NCSynonymDslParser}.
- */
-public interface NCSynonymDslListener extends ParseTreeListener {
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#synonym}.
- * @param ctx the parse tree
- */
- void enterSynonym(NCSynonymDslParser.SynonymContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#synonym}.
- * @param ctx the parse tree
- */
- void exitSynonym(NCSynonymDslParser.SynonymContext ctx);
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#alias}.
- * @param ctx the parse tree
- */
- void enterAlias(NCSynonymDslParser.AliasContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#alias}.
- * @param ctx the parse tree
- */
- void exitAlias(NCSynonymDslParser.AliasContext ctx);
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#item}.
- * @param ctx the parse tree
- */
- void enterItem(NCSynonymDslParser.ItemContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#item}.
- * @param ctx the parse tree
- */
- void exitItem(NCSynonymDslParser.ItemContext ctx);
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#pred}.
- * @param ctx the parse tree
- */
- void enterPred(NCSynonymDslParser.PredContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#pred}.
- * @param ctx the parse tree
- */
- void exitPred(NCSynonymDslParser.PredContext ctx);
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#expr}.
- * @param ctx the parse tree
- */
- void enterExpr(NCSynonymDslParser.ExprContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#expr}.
- * @param ctx the parse tree
- */
- void exitExpr(NCSynonymDslParser.ExprContext ctx);
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#mathOp}.
- * @param ctx the parse tree
- */
- void enterMathOp(NCSynonymDslParser.MathOpContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#mathOp}.
- * @param ctx the parse tree
- */
- void exitMathOp(NCSynonymDslParser.MathOpContext ctx);
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#val}.
- * @param ctx the parse tree
- */
- void enterVal(NCSynonymDslParser.ValContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#val}.
- * @param ctx the parse tree
- */
- void exitVal(NCSynonymDslParser.ValContext ctx);
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#singleVal}.
- * @param ctx the parse tree
- */
- void enterSingleVal(NCSynonymDslParser.SingleValContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#singleVal}.
- * @param ctx the parse tree
- */
- void exitSingleVal(NCSynonymDslParser.SingleValContext ctx);
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#tokQual}.
- * @param ctx the parse tree
- */
- void enterTokQual(NCSynonymDslParser.TokQualContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#tokQual}.
- * @param ctx the parse tree
- */
- void exitTokQual(NCSynonymDslParser.TokQualContext ctx);
- /**
- * Enter a parse tree produced by {@link
NCSynonymDslParser#tokQualPart}.
- * @param ctx the parse tree
- */
- void enterTokQualPart(NCSynonymDslParser.TokQualPartContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#tokQualPart}.
- * @param ctx the parse tree
- */
- void exitTokQualPart(NCSynonymDslParser.TokQualPartContext ctx);
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#tokMeta}.
- * @param ctx the parse tree
- */
- void enterTokMeta(NCSynonymDslParser.TokMetaContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#tokMeta}.
- * @param ctx the parse tree
- */
- void exitTokMeta(NCSynonymDslParser.TokMetaContext ctx);
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#modelMeta}.
- * @param ctx the parse tree
- */
- void enterModelMeta(NCSynonymDslParser.ModelMetaContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#modelMeta}.
- * @param ctx the parse tree
- */
- void exitModelMeta(NCSynonymDslParser.ModelMetaContext ctx);
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#intentMeta}.
- * @param ctx the parse tree
- */
- void enterIntentMeta(NCSynonymDslParser.IntentMetaContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#intentMeta}.
- * @param ctx the parse tree
- */
- void exitIntentMeta(NCSynonymDslParser.IntentMetaContext ctx);
- /**
- * Enter a parse tree produced by {@link NCSynonymDslParser#qstring}.
- * @param ctx the parse tree
- */
- void enterQstring(NCSynonymDslParser.QstringContext ctx);
- /**
- * Exit a parse tree produced by {@link NCSynonymDslParser#qstring}.
- * @param ctx the parse tree
- */
- void exitQstring(NCSynonymDslParser.QstringContext ctx);
-}
\ No newline at end of file
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslParser.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslParser.java
deleted file mode 100644
index 33047ef..0000000
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4/NCSynonymDslParser.java
+++ /dev/null
@@ -1,1379 +0,0 @@
-// Generated from C:/Users/Nikita
Ivanov/Documents/GitHub/incubator-nlpcraft/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/antlr4\NCSynonymDsl.g4
by ANTLR 4.9.1
-package org.apache.nlpcraft.probe.mgrs.model.antlr4;
-import org.antlr.v4.runtime.atn.*;
-import org.antlr.v4.runtime.dfa.DFA;
-import org.antlr.v4.runtime.*;
-import org.antlr.v4.runtime.misc.*;
-import org.antlr.v4.runtime.tree.*;
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
-public class NCSynonymDslParser extends Parser {
- static { RuntimeMetaData.checkVersion("4.9.1",
RuntimeMetaData.VERSION); }
-
- protected static final DFA[] _decisionToDFA;
- protected static final PredictionContextCache _sharedContextCache =
- new PredictionContextCache();
- public static final int
- T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8,
T__8=9,
- SQSTRING=10, DQSTRING=11, PRED_OP=12, AND=13, OR=14, EXCL=15,
LPAREN=16,
- RPAREN=17, SQUOTE=18, DQUOTE=19, DOLLAR=20, TILDA=21, LBR=22,
RBR=23,
- PLUS=24, STAR=25, DEVIDE=26, COMMA=27, COLON=28, POUND=29,
MINUS=30, DOT=31,
- UNDERSCORE=32, BOOL=33, INT=34, EXP=35, ID=36, WS=37,
ErrorCharacter=38;
- public static final int
- RULE_synonym = 0, RULE_alias = 1, RULE_item = 2, RULE_pred = 3,
RULE_expr = 4,
- RULE_mathOp = 5, RULE_val = 6, RULE_singleVal = 7, RULE_tokQual
= 8, RULE_tokQualPart = 9,
- RULE_tokMeta = 10, RULE_modelMeta = 11, RULE_intentMeta = 12,
RULE_qstring = 13;
- private static String[] makeRuleNames() {
- return new String[] {
- "synonym", "alias", "item", "pred", "expr", "mathOp",
"val", "singleVal",
- "tokQual", "tokQualPart", "tokMeta", "modelMeta",
"intentMeta", "qstring"
- };
- }
- public static final String[] ruleNames = makeRuleNames();
-
- private static String[] makeLiteralNames() {
- return new String[] {
- null, "'null'", "'id'", "'aliases'", "'startidx'",
"'endidx'", "'parent'",
- "'groups'", "'ancestors'", "'value'", null, null, null,
"'&&'", "'||'",
- "'!'", "'('", "')'", "'''", "'\"'", "'$'", "'~'",
"'['", "']'", "'+'",
- "'*'", "'/'", "','", "':'", "'#'", "'-'", "'.'", "'_'"
- };
- }
- private static final String[] _LITERAL_NAMES = makeLiteralNames();
- private static String[] makeSymbolicNames() {
- return new String[] {
- null, null, null, null, null, null, null, null, null,
null, "SQSTRING",
- "DQSTRING", "PRED_OP", "AND", "OR", "EXCL", "LPAREN",
"RPAREN", "SQUOTE",
- "DQUOTE", "DOLLAR", "TILDA", "LBR", "RBR", "PLUS",
"STAR", "DEVIDE",
- "COMMA", "COLON", "POUND", "MINUS", "DOT",
"UNDERSCORE", "BOOL", "INT",
- "EXP", "ID", "WS", "ErrorCharacter"
- };
- }
- private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
- public static final Vocabulary VOCABULARY = new
VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
-
- /**
- * @deprecated Use {@link #VOCABULARY} instead.
- */
- @Deprecated
- public static final String[] tokenNames;
- static {
- tokenNames = new String[_SYMBOLIC_NAMES.length];
- for (int i = 0; i < tokenNames.length; i++) {
- tokenNames[i] = VOCABULARY.getLiteralName(i);
- if (tokenNames[i] == null) {
- tokenNames[i] = VOCABULARY.getSymbolicName(i);
- }
-
- if (tokenNames[i] == null) {
- tokenNames[i] = "<INVALID>";
- }
- }
- }
-
- @Override
- @Deprecated
- public String[] getTokenNames() {
- return tokenNames;
- }
-
- @Override
-
- public Vocabulary getVocabulary() {
- return VOCABULARY;
- }
-
- @Override
- public String getGrammarFileName() { return "NCSynonymDsl.g4"; }
-
- @Override
- public String[] getRuleNames() { return ruleNames; }
-
- @Override
- public String getSerializedATN() { return _serializedATN; }
-
- @Override
- public ATN getATN() { return _ATN; }
-
- public NCSynonymDslParser(TokenStream input) {
- super(input);
- _interp = new
ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
- }
-
- public static class SynonymContext extends ParserRuleContext {
- public AliasContext alias() {
- return getRuleContext(AliasContext.class,0);
- }
- public TerminalNode LPAREN() { return
getToken(NCSynonymDslParser.LPAREN, 0); }
- public ItemContext item() {
- return getRuleContext(ItemContext.class,0);
- }
- public TerminalNode RPAREN() { return
getToken(NCSynonymDslParser.RPAREN, 0); }
- public TerminalNode EOF() { return
getToken(NCSynonymDslParser.EOF, 0); }
- public SynonymContext(ParserRuleContext parent, int
invokingState) {
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_synonym; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterSynonym(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitSynonym(this);
- }
- }
-
- public final SynonymContext synonym() throws RecognitionException {
- SynonymContext _localctx = new SynonymContext(_ctx, getState());
- enterRule(_localctx, 0, RULE_synonym);
- try {
- setState(37);
- _errHandler.sync(this);
- switch (_input.LA(1)) {
- case LBR:
- enterOuterAlt(_localctx, 1);
- {
- setState(28);
- alias();
- setState(29);
- match(LPAREN);
- setState(30);
- item(0);
- setState(31);
- match(RPAREN);
- setState(32);
- match(EOF);
- }
- break;
- case T__0:
- case T__1:
- case T__2:
- case T__3:
- case T__4:
- case T__5:
- case T__6:
- case T__7:
- case T__8:
- case SQSTRING:
- case DQSTRING:
- case EXCL:
- case LPAREN:
- case DOLLAR:
- case TILDA:
- case POUND:
- case MINUS:
- case BOOL:
- case INT:
- case ID:
- enterOuterAlt(_localctx, 2);
- {
- setState(34);
- item(0);
- setState(35);
- match(EOF);
- }
- break;
- default:
- throw new NoViableAltException(this);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- exitRule();
- }
- return _localctx;
- }
-
- public static class AliasContext extends ParserRuleContext {
- public TerminalNode LBR() { return
getToken(NCSynonymDslParser.LBR, 0); }
- public TerminalNode ID() { return
getToken(NCSynonymDslParser.ID, 0); }
- public TerminalNode RBR() { return
getToken(NCSynonymDslParser.RBR, 0); }
- public AliasContext(ParserRuleContext parent, int
invokingState) {
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_alias; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterAlias(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitAlias(this);
- }
- }
-
- public final AliasContext alias() throws RecognitionException {
- AliasContext _localctx = new AliasContext(_ctx, getState());
- enterRule(_localctx, 2, RULE_alias);
- try {
- enterOuterAlt(_localctx, 1);
- {
- setState(39);
- match(LBR);
- setState(40);
- match(ID);
- setState(41);
- match(RBR);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- exitRule();
- }
- return _localctx;
- }
-
- public static class ItemContext extends ParserRuleContext {
- public PredContext pred() {
- return getRuleContext(PredContext.class,0);
- }
- public TerminalNode LPAREN() { return
getToken(NCSynonymDslParser.LPAREN, 0); }
- public List<ItemContext> item() {
- return getRuleContexts(ItemContext.class);
- }
- public ItemContext item(int i) {
- return getRuleContext(ItemContext.class,i);
- }
- public TerminalNode RPAREN() { return
getToken(NCSynonymDslParser.RPAREN, 0); }
- public TerminalNode EXCL() { return
getToken(NCSynonymDslParser.EXCL, 0); }
- public TerminalNode AND() { return
getToken(NCSynonymDslParser.AND, 0); }
- public TerminalNode OR() { return
getToken(NCSynonymDslParser.OR, 0); }
- public ItemContext(ParserRuleContext parent, int invokingState)
{
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_item; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterItem(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitItem(this);
- }
- }
-
- public final ItemContext item() throws RecognitionException {
- return item(0);
- }
-
- private ItemContext item(int _p) throws RecognitionException {
- ParserRuleContext _parentctx = _ctx;
- int _parentState = getState();
- ItemContext _localctx = new ItemContext(_ctx, _parentState);
- ItemContext _prevctx = _localctx;
- int _startState = 4;
- enterRecursionRule(_localctx, 4, RULE_item, _p);
- int _la;
- try {
- int _alt;
- enterOuterAlt(_localctx, 1);
- {
- setState(51);
- _errHandler.sync(this);
- switch (
getInterpreter().adaptivePredict(_input,1,_ctx) ) {
- case 1:
- {
- setState(44);
- pred();
- }
- break;
- case 2:
- {
- setState(45);
- match(LPAREN);
- setState(46);
- item(0);
- setState(47);
- match(RPAREN);
- }
- break;
- case 3:
- {
- setState(49);
- match(EXCL);
- setState(50);
- item(1);
- }
- break;
- }
- _ctx.stop = _input.LT(-1);
- setState(58);
- _errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,2,_ctx);
- while ( _alt!=2 &&
_alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
- if ( _alt==1 ) {
- if ( _parseListeners!=null )
triggerExitRuleEvent();
- _prevctx = _localctx;
- {
- {
- _localctx = new ItemContext(_parentctx,
_parentState);
- pushNewRecursionContext(_localctx,
_startState, RULE_item);
- setState(53);
- if (!(precpred(_ctx, 2))) throw new
FailedPredicateException(this, "precpred(_ctx, 2)");
- setState(54);
- _la = _input.LA(1);
- if ( !(_la==AND || _la==OR) ) {
- _errHandler.recoverInline(this);
- }
- else {
- if ( _input.LA(1)==Token.EOF )
matchedEOF = true;
- _errHandler.reportMatch(this);
- consume();
- }
- setState(55);
- item(3);
- }
- }
- }
- setState(60);
- _errHandler.sync(this);
- _alt =
getInterpreter().adaptivePredict(_input,2,_ctx);
- }
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- unrollRecursionContexts(_parentctx);
- }
- return _localctx;
- }
-
- public static class PredContext extends ParserRuleContext {
- public List<ExprContext> expr() {
- return getRuleContexts(ExprContext.class);
- }
- public ExprContext expr(int i) {
- return getRuleContext(ExprContext.class,i);
- }
- public TerminalNode PRED_OP() { return
getToken(NCSynonymDslParser.PRED_OP, 0); }
- public PredContext(ParserRuleContext parent, int invokingState)
{
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_pred; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterPred(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitPred(this);
- }
- }
-
- public final PredContext pred() throws RecognitionException {
- PredContext _localctx = new PredContext(_ctx, getState());
- enterRule(_localctx, 6, RULE_pred);
- try {
- enterOuterAlt(_localctx, 1);
- {
- setState(61);
- expr(0);
- setState(62);
- match(PRED_OP);
- setState(63);
- expr(0);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- exitRule();
- }
- return _localctx;
- }
-
- public static class ExprContext extends ParserRuleContext {
- public ValContext val() {
- return getRuleContext(ValContext.class,0);
- }
- public TerminalNode LPAREN() { return
getToken(NCSynonymDslParser.LPAREN, 0); }
- public List<ExprContext> expr() {
- return getRuleContexts(ExprContext.class);
- }
- public ExprContext expr(int i) {
- return getRuleContext(ExprContext.class,i);
- }
- public TerminalNode RPAREN() { return
getToken(NCSynonymDslParser.RPAREN, 0); }
- public TerminalNode ID() { return
getToken(NCSynonymDslParser.ID, 0); }
- public MathOpContext mathOp() {
- return getRuleContext(MathOpContext.class,0);
- }
- public ExprContext(ParserRuleContext parent, int invokingState)
{
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_expr; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterExpr(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitExpr(this);
- }
- }
-
- public final ExprContext expr() throws RecognitionException {
- return expr(0);
- }
-
- private ExprContext expr(int _p) throws RecognitionException {
- ParserRuleContext _parentctx = _ctx;
- int _parentState = getState();
- ExprContext _localctx = new ExprContext(_ctx, _parentState);
- ExprContext _prevctx = _localctx;
- int _startState = 8;
- enterRecursionRule(_localctx, 8, RULE_expr, _p);
- int _la;
- try {
- int _alt;
- enterOuterAlt(_localctx, 1);
- {
- setState(77);
- _errHandler.sync(this);
- switch (
getInterpreter().adaptivePredict(_input,4,_ctx) ) {
- case 1:
- {
- setState(66);
- val(0);
- }
- break;
- case 2:
- {
- setState(67);
- match(LPAREN);
- setState(68);
- expr(0);
- setState(69);
- match(RPAREN);
- }
- break;
- case 3:
- {
- setState(71);
- match(ID);
- setState(72);
- match(LPAREN);
- setState(74);
- _errHandler.sync(this);
- _la = _input.LA(1);
- if ((((_la) & ~0x3f) == 0 && ((1L << _la) &
((1L << T__0) | (1L << T__1) | (1L << T__2) | (1L << T__3) | (1L << T__4) | (1L
<< T__5) | (1L << T__6) | (1L << T__7) | (1L << T__8) | (1L << SQSTRING) | (1L
<< DQSTRING) | (1L << LPAREN) | (1L << DOLLAR) | (1L << TILDA) | (1L << POUND)
| (1L << MINUS) | (1L << BOOL) | (1L << INT) | (1L << ID))) != 0)) {
- {
- setState(73);
- expr(0);
- }
- }
-
- setState(76);
- match(RPAREN);
- }
- break;
- }
- _ctx.stop = _input.LT(-1);
- setState(85);
- _errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,5,_ctx);
- while ( _alt!=2 &&
_alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
- if ( _alt==1 ) {
- if ( _parseListeners!=null )
triggerExitRuleEvent();
- _prevctx = _localctx;
- {
- {
- _localctx = new ExprContext(_parentctx,
_parentState);
- pushNewRecursionContext(_localctx,
_startState, RULE_expr);
- setState(79);
- if (!(precpred(_ctx, 2))) throw new
FailedPredicateException(this, "precpred(_ctx, 2)");
- setState(80);
- mathOp();
- setState(81);
- expr(3);
- }
- }
- }
- setState(87);
- _errHandler.sync(this);
- _alt =
getInterpreter().adaptivePredict(_input,5,_ctx);
- }
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- unrollRecursionContexts(_parentctx);
- }
- return _localctx;
- }
-
- public static class MathOpContext extends ParserRuleContext {
- public TerminalNode MINUS() { return
getToken(NCSynonymDslParser.MINUS, 0); }
- public TerminalNode PLUS() { return
getToken(NCSynonymDslParser.PLUS, 0); }
- public TerminalNode STAR() { return
getToken(NCSynonymDslParser.STAR, 0); }
- public TerminalNode DEVIDE() { return
getToken(NCSynonymDslParser.DEVIDE, 0); }
- public MathOpContext(ParserRuleContext parent, int
invokingState) {
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_mathOp; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterMathOp(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitMathOp(this);
- }
- }
-
- public final MathOpContext mathOp() throws RecognitionException {
- MathOpContext _localctx = new MathOpContext(_ctx, getState());
- enterRule(_localctx, 10, RULE_mathOp);
- int _la;
- try {
- enterOuterAlt(_localctx, 1);
- {
- setState(88);
- _la = _input.LA(1);
- if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L <<
PLUS) | (1L << STAR) | (1L << DEVIDE) | (1L << MINUS))) != 0)) ) {
- _errHandler.recoverInline(this);
- }
- else {
- if ( _input.LA(1)==Token.EOF ) matchedEOF =
true;
- _errHandler.reportMatch(this);
- consume();
- }
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- exitRule();
- }
- return _localctx;
- }
-
- public static class ValContext extends ParserRuleContext {
- public SingleValContext singleVal() {
- return getRuleContext(SingleValContext.class,0);
- }
- public TerminalNode LPAREN() { return
getToken(NCSynonymDslParser.LPAREN, 0); }
- public List<ValContext> val() {
- return getRuleContexts(ValContext.class);
- }
- public ValContext val(int i) {
- return getRuleContext(ValContext.class,i);
- }
- public TerminalNode RPAREN() { return
getToken(NCSynonymDslParser.RPAREN, 0); }
- public TerminalNode COMMA() { return
getToken(NCSynonymDslParser.COMMA, 0); }
- public ValContext(ParserRuleContext parent, int invokingState) {
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_val; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterVal(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitVal(this);
- }
- }
-
- public final ValContext val() throws RecognitionException {
- return val(0);
- }
-
- private ValContext val(int _p) throws RecognitionException {
- ParserRuleContext _parentctx = _ctx;
- int _parentState = getState();
- ValContext _localctx = new ValContext(_ctx, _parentState);
- ValContext _prevctx = _localctx;
- int _startState = 12;
- enterRecursionRule(_localctx, 12, RULE_val, _p);
- try {
- int _alt;
- enterOuterAlt(_localctx, 1);
- {
- setState(96);
- _errHandler.sync(this);
- switch (_input.LA(1)) {
- case T__0:
- case T__1:
- case T__2:
- case T__3:
- case T__4:
- case T__5:
- case T__6:
- case T__7:
- case T__8:
- case SQSTRING:
- case DQSTRING:
- case DOLLAR:
- case TILDA:
- case POUND:
- case MINUS:
- case BOOL:
- case INT:
- case ID:
- {
- setState(91);
- singleVal();
- }
- break;
- case LPAREN:
- {
- setState(92);
- match(LPAREN);
- setState(93);
- val(0);
- setState(94);
- match(RPAREN);
- }
- break;
- default:
- throw new NoViableAltException(this);
- }
- _ctx.stop = _input.LT(-1);
- setState(103);
- _errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,7,_ctx);
- while ( _alt!=2 &&
_alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
- if ( _alt==1 ) {
- if ( _parseListeners!=null )
triggerExitRuleEvent();
- _prevctx = _localctx;
- {
- {
- _localctx = new ValContext(_parentctx,
_parentState);
- pushNewRecursionContext(_localctx,
_startState, RULE_val);
- setState(98);
- if (!(precpred(_ctx, 1))) throw new
FailedPredicateException(this, "precpred(_ctx, 1)");
- setState(99);
- match(COMMA);
- setState(100);
- val(2);
- }
- }
- }
- setState(105);
- _errHandler.sync(this);
- _alt =
getInterpreter().adaptivePredict(_input,7,_ctx);
- }
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- unrollRecursionContexts(_parentctx);
- }
- return _localctx;
- }
-
- public static class SingleValContext extends ParserRuleContext {
- public TerminalNode INT() { return
getToken(NCSynonymDslParser.INT, 0); }
- public TerminalNode EXP() { return
getToken(NCSynonymDslParser.EXP, 0); }
- public TerminalNode MINUS() { return
getToken(NCSynonymDslParser.MINUS, 0); }
- public TerminalNode BOOL() { return
getToken(NCSynonymDslParser.BOOL, 0); }
- public QstringContext qstring() {
- return getRuleContext(QstringContext.class,0);
- }
- public TokQualContext tokQual() {
- return getRuleContext(TokQualContext.class,0);
- }
- public TokMetaContext tokMeta() {
- return getRuleContext(TokMetaContext.class,0);
- }
- public ModelMetaContext modelMeta() {
- return getRuleContext(ModelMetaContext.class,0);
- }
- public IntentMetaContext intentMeta() {
- return getRuleContext(IntentMetaContext.class,0);
- }
- public SingleValContext(ParserRuleContext parent, int
invokingState) {
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_singleVal; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterSingleVal(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitSingleVal(this);
- }
- }
-
- public final SingleValContext singleVal() throws RecognitionException {
- SingleValContext _localctx = new SingleValContext(_ctx,
getState());
- enterRule(_localctx, 14, RULE_singleVal);
- int _la;
- try {
- setState(127);
- _errHandler.sync(this);
- switch (
getInterpreter().adaptivePredict(_input,12,_ctx) ) {
- case 1:
- enterOuterAlt(_localctx, 1);
- {
- setState(106);
- match(T__0);
- }
- break;
- case 2:
- enterOuterAlt(_localctx, 2);
- {
- setState(108);
- _errHandler.sync(this);
- _la = _input.LA(1);
- if (_la==MINUS) {
- {
- setState(107);
- match(MINUS);
- }
- }
-
- setState(113);
- _errHandler.sync(this);
- switch (
getInterpreter().adaptivePredict(_input,9,_ctx) ) {
- case 1:
- {
- setState(110);
- match(INT);
- }
- break;
- case 2:
- {
- setState(111);
- match(INT);
- setState(112);
- match(EXP);
- }
- break;
- }
- }
- break;
- case 3:
- enterOuterAlt(_localctx, 3);
- {
- setState(115);
- match(BOOL);
- }
- break;
- case 4:
- enterOuterAlt(_localctx, 4);
- {
- setState(116);
- qstring();
- }
- break;
- case 5:
- enterOuterAlt(_localctx, 5);
- {
- setState(118);
- _errHandler.sync(this);
- _la = _input.LA(1);
- if (_la==ID) {
- {
- setState(117);
- tokQual(0);
- }
- }
-
- setState(120);
- _la = _input.LA(1);
- if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) &
((1L << T__1) | (1L << T__2) | (1L << T__3) | (1L << T__4) | (1L << T__5) | (1L
<< T__6) | (1L << T__7) | (1L << T__8))) != 0)) ) {
- _errHandler.recoverInline(this);
- }
- else {
- if ( _input.LA(1)==Token.EOF )
matchedEOF = true;
- _errHandler.reportMatch(this);
- consume();
- }
- }
- break;
- case 6:
- enterOuterAlt(_localctx, 6);
- {
- setState(122);
- _errHandler.sync(this);
- _la = _input.LA(1);
- if (_la==ID) {
- {
- setState(121);
- tokQual(0);
- }
- }
-
- setState(124);
- tokMeta();
- }
- break;
- case 7:
- enterOuterAlt(_localctx, 7);
- {
- setState(125);
- modelMeta();
- }
- break;
- case 8:
- enterOuterAlt(_localctx, 8);
- {
- setState(126);
- intentMeta();
- }
- break;
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- exitRule();
- }
- return _localctx;
- }
-
- public static class TokQualContext extends ParserRuleContext {
- public TokQualPartContext tokQualPart() {
- return getRuleContext(TokQualPartContext.class,0);
- }
- public TokQualContext tokQual() {
- return getRuleContext(TokQualContext.class,0);
- }
- public TokQualContext(ParserRuleContext parent, int
invokingState) {
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_tokQual; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterTokQual(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitTokQual(this);
- }
- }
-
- public final TokQualContext tokQual() throws RecognitionException {
- return tokQual(0);
- }
-
- private TokQualContext tokQual(int _p) throws RecognitionException {
- ParserRuleContext _parentctx = _ctx;
- int _parentState = getState();
- TokQualContext _localctx = new TokQualContext(_ctx,
_parentState);
- TokQualContext _prevctx = _localctx;
- int _startState = 16;
- enterRecursionRule(_localctx, 16, RULE_tokQual, _p);
- try {
- int _alt;
- enterOuterAlt(_localctx, 1);
- {
- {
- setState(130);
- tokQualPart();
- }
- _ctx.stop = _input.LT(-1);
- setState(136);
- _errHandler.sync(this);
- _alt = getInterpreter().adaptivePredict(_input,13,_ctx);
- while ( _alt!=2 &&
_alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
- if ( _alt==1 ) {
- if ( _parseListeners!=null )
triggerExitRuleEvent();
- _prevctx = _localctx;
- {
- {
- _localctx = new
TokQualContext(_parentctx, _parentState);
- pushNewRecursionContext(_localctx,
_startState, RULE_tokQual);
- setState(132);
- if (!(precpred(_ctx, 1))) throw new
FailedPredicateException(this, "precpred(_ctx, 1)");
- setState(133);
- tokQualPart();
- }
- }
- }
- setState(138);
- _errHandler.sync(this);
- _alt =
getInterpreter().adaptivePredict(_input,13,_ctx);
- }
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- unrollRecursionContexts(_parentctx);
- }
- return _localctx;
- }
-
- public static class TokQualPartContext extends ParserRuleContext {
- public TerminalNode ID() { return
getToken(NCSynonymDslParser.ID, 0); }
- public TerminalNode DOT() { return
getToken(NCSynonymDslParser.DOT, 0); }
- public TokQualPartContext(ParserRuleContext parent, int
invokingState) {
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_tokQualPart; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterTokQualPart(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitTokQualPart(this);
- }
- }
-
- public final TokQualPartContext tokQualPart() throws
RecognitionException {
- TokQualPartContext _localctx = new TokQualPartContext(_ctx,
getState());
- enterRule(_localctx, 18, RULE_tokQualPart);
- try {
- enterOuterAlt(_localctx, 1);
- {
- setState(139);
- match(ID);
- setState(140);
- match(DOT);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- exitRule();
- }
- return _localctx;
- }
-
- public static class TokMetaContext extends ParserRuleContext {
- public TerminalNode TILDA() { return
getToken(NCSynonymDslParser.TILDA, 0); }
- public TerminalNode ID() { return
getToken(NCSynonymDslParser.ID, 0); }
- public TerminalNode LBR() { return
getToken(NCSynonymDslParser.LBR, 0); }
- public TerminalNode INT() { return
getToken(NCSynonymDslParser.INT, 0); }
- public TerminalNode RBR() { return
getToken(NCSynonymDslParser.RBR, 0); }
- public QstringContext qstring() {
- return getRuleContext(QstringContext.class,0);
- }
- public TokMetaContext(ParserRuleContext parent, int
invokingState) {
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_tokMeta; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterTokMeta(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitTokMeta(this);
- }
- }
-
- public final TokMetaContext tokMeta() throws RecognitionException {
- TokMetaContext _localctx = new TokMetaContext(_ctx, getState());
- enterRule(_localctx, 20, RULE_tokMeta);
- try {
- setState(155);
- _errHandler.sync(this);
- switch (
getInterpreter().adaptivePredict(_input,14,_ctx) ) {
- case 1:
- enterOuterAlt(_localctx, 1);
- {
- setState(142);
- match(TILDA);
- setState(143);
- match(ID);
- }
- break;
- case 2:
- enterOuterAlt(_localctx, 2);
- {
- setState(144);
- match(TILDA);
- setState(145);
- match(ID);
- setState(146);
- match(LBR);
- setState(147);
- match(INT);
- setState(148);
- match(RBR);
- }
- break;
- case 3:
- enterOuterAlt(_localctx, 3);
- {
- setState(149);
- match(TILDA);
- setState(150);
- match(ID);
- setState(151);
- match(LBR);
- setState(152);
- qstring();
- setState(153);
- match(RBR);
- }
- break;
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- exitRule();
- }
- return _localctx;
- }
-
- public static class ModelMetaContext extends ParserRuleContext {
- public TerminalNode POUND() { return
getToken(NCSynonymDslParser.POUND, 0); }
- public TerminalNode ID() { return
getToken(NCSynonymDslParser.ID, 0); }
- public TerminalNode LBR() { return
getToken(NCSynonymDslParser.LBR, 0); }
- public TerminalNode INT() { return
getToken(NCSynonymDslParser.INT, 0); }
- public TerminalNode RBR() { return
getToken(NCSynonymDslParser.RBR, 0); }
- public QstringContext qstring() {
- return getRuleContext(QstringContext.class,0);
- }
- public ModelMetaContext(ParserRuleContext parent, int
invokingState) {
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_modelMeta; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterModelMeta(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitModelMeta(this);
- }
- }
-
- public final ModelMetaContext modelMeta() throws RecognitionException {
- ModelMetaContext _localctx = new ModelMetaContext(_ctx,
getState());
- enterRule(_localctx, 22, RULE_modelMeta);
- try {
- setState(170);
- _errHandler.sync(this);
- switch (
getInterpreter().adaptivePredict(_input,15,_ctx) ) {
- case 1:
- enterOuterAlt(_localctx, 1);
- {
- setState(157);
- match(POUND);
- setState(158);
- match(ID);
- }
- break;
- case 2:
- enterOuterAlt(_localctx, 2);
- {
- setState(159);
- match(POUND);
- setState(160);
- match(ID);
- setState(161);
- match(LBR);
- setState(162);
- match(INT);
- setState(163);
- match(RBR);
- }
- break;
- case 3:
- enterOuterAlt(_localctx, 3);
- {
- setState(164);
- match(POUND);
- setState(165);
- match(ID);
- setState(166);
- match(LBR);
- setState(167);
- qstring();
- setState(168);
- match(RBR);
- }
- break;
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- exitRule();
- }
- return _localctx;
- }
-
- public static class IntentMetaContext extends ParserRuleContext {
- public TerminalNode DOLLAR() { return
getToken(NCSynonymDslParser.DOLLAR, 0); }
- public TerminalNode ID() { return
getToken(NCSynonymDslParser.ID, 0); }
- public TerminalNode LBR() { return
getToken(NCSynonymDslParser.LBR, 0); }
- public TerminalNode INT() { return
getToken(NCSynonymDslParser.INT, 0); }
- public TerminalNode RBR() { return
getToken(NCSynonymDslParser.RBR, 0); }
- public QstringContext qstring() {
- return getRuleContext(QstringContext.class,0);
- }
- public IntentMetaContext(ParserRuleContext parent, int
invokingState) {
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_intentMeta; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterIntentMeta(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitIntentMeta(this);
- }
- }
-
- public final IntentMetaContext intentMeta() throws RecognitionException
{
- IntentMetaContext _localctx = new IntentMetaContext(_ctx,
getState());
- enterRule(_localctx, 24, RULE_intentMeta);
- try {
- setState(185);
- _errHandler.sync(this);
- switch (
getInterpreter().adaptivePredict(_input,16,_ctx) ) {
- case 1:
- enterOuterAlt(_localctx, 1);
- {
- setState(172);
- match(DOLLAR);
- setState(173);
- match(ID);
- }
- break;
- case 2:
- enterOuterAlt(_localctx, 2);
- {
- setState(174);
- match(DOLLAR);
- setState(175);
- match(ID);
- setState(176);
- match(LBR);
- setState(177);
- match(INT);
- setState(178);
- match(RBR);
- }
- break;
- case 3:
- enterOuterAlt(_localctx, 3);
- {
- setState(179);
- match(DOLLAR);
- setState(180);
- match(ID);
- setState(181);
- match(LBR);
- setState(182);
- qstring();
- setState(183);
- match(RBR);
- }
- break;
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- exitRule();
- }
- return _localctx;
- }
-
- public static class QstringContext extends ParserRuleContext {
- public TerminalNode SQSTRING() { return
getToken(NCSynonymDslParser.SQSTRING, 0); }
- public TerminalNode DQSTRING() { return
getToken(NCSynonymDslParser.DQSTRING, 0); }
- public QstringContext(ParserRuleContext parent, int
invokingState) {
- super(parent, invokingState);
- }
- @Override public int getRuleIndex() { return RULE_qstring; }
- @Override
- public void enterRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).enterQstring(this);
- }
- @Override
- public void exitRule(ParseTreeListener listener) {
- if ( listener instanceof NCSynonymDslListener )
((NCSynonymDslListener)listener).exitQstring(this);
- }
- }
-
- public final QstringContext qstring() throws RecognitionException {
- QstringContext _localctx = new QstringContext(_ctx, getState());
- enterRule(_localctx, 26, RULE_qstring);
- int _la;
- try {
- enterOuterAlt(_localctx, 1);
- {
- setState(187);
- _la = _input.LA(1);
- if ( !(_la==SQSTRING || _la==DQSTRING) ) {
- _errHandler.recoverInline(this);
- }
- else {
- if ( _input.LA(1)==Token.EOF ) matchedEOF =
true;
- _errHandler.reportMatch(this);
- consume();
- }
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- _errHandler.reportError(this, re);
- _errHandler.recover(this, re);
- }
- finally {
- exitRule();
- }
- return _localctx;
- }
-
- public boolean sempred(RuleContext _localctx, int ruleIndex, int
predIndex) {
- switch (ruleIndex) {
- case 2:
- return item_sempred((ItemContext)_localctx, predIndex);
- case 4:
- return expr_sempred((ExprContext)_localctx, predIndex);
- case 6:
- return val_sempred((ValContext)_localctx, predIndex);
- case 8:
- return tokQual_sempred((TokQualContext)_localctx,
predIndex);
- }
- return true;
- }
- private boolean item_sempred(ItemContext _localctx, int predIndex) {
- switch (predIndex) {
- case 0:
- return precpred(_ctx, 2);
- }
- return true;
- }
- private boolean expr_sempred(ExprContext _localctx, int predIndex) {
- switch (predIndex) {
- case 1:
- return precpred(_ctx, 2);
- }
- return true;
- }
- private boolean val_sempred(ValContext _localctx, int predIndex) {
- switch (predIndex) {
- case 2:
- return precpred(_ctx, 1);
- }
- return true;
- }
- private boolean tokQual_sempred(TokQualContext _localctx, int
predIndex) {
- switch (predIndex) {
- case 3:
- return precpred(_ctx, 1);
- }
- return true;
- }
-
- public static final String _serializedATN =
-
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3(\u00c0\4\2\t\2\4"+
-
"\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+
-
"\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3"+
-
"\2\3\2\5\2(\n\2\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\5\4\66"+
-
"\n\4\3\4\3\4\3\4\7\4;\n\4\f\4\16\4>\13\4\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3"+
-
"\6\3\6\3\6\3\6\3\6\3\6\5\6M\n\6\3\6\5\6P\n\6\3\6\3\6\3\6\3\6\7\6V\n\6"+
-
"\f\6\16\6Y\13\6\3\7\3\7\3\b\3\b\3\b\3\b\3\b\3\b\5\bc\n\b\3\b\3\b\3\b\7"+
-
"\bh\n\b\f\b\16\bk\13\b\3\t\3\t\5\to\n\t\3\t\3\t\3\t\5\tt\n\t\3\t\3\t\3"+
-
"\t\5\ty\n\t\3\t\3\t\5\t}\n\t\3\t\3\t\3\t\5\t\u0082\n\t\3\n\3\n\3\n\3\n"+
-
"\3\n\7\n\u0089\n\n\f\n\16\n\u008c\13\n\3\13\3\13\3\13\3\f\3\f\3\f\3\f"+
-
"\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\5\f\u009e\n\f\3\r\3\r\3\r\3\r\3\r"+
-
"\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\5\r\u00ad\n\r\3\16\3\16\3\16\3\16\3\16"+
-
"\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\5\16\u00bc\n\16\3\17\3\17\3\17"+
-
"\2\6\6\n\16\22\20\2\4\6\b\n\f\16\20\22\24\26\30\32\34\2\6\3\2\17\20\4"+
- "\2\32\34
\3\2\4\13\3\2\f\r\2\u00cd\2\'\3\2\2\2\4)\3\2\2\2\6\65\3\2\2"+
-
"\2\b?\3\2\2\2\nO\3\2\2\2\fZ\3\2\2\2\16b\3\2\2\2\20\u0081\3\2\2\2\22\u0083"+
-
"\3\2\2\2\24\u008d\3\2\2\2\26\u009d\3\2\2\2\30\u00ac\3\2\2\2\32\u00bb\3"+
- "\2\2\2\34\u00bd\3\2\2\2\36\37\5\4\3\2\37 \7\22\2\2
!\5\6\4\2!\"\7\23\2"+
-
"\2\"#\7\2\2\3#(\3\2\2\2$%\5\6\4\2%&\7\2\2\3&(\3\2\2\2\'\36\3\2\2\2\'$"+
-
"\3\2\2\2(\3\3\2\2\2)*\7\30\2\2*+\7&\2\2+,\7\31\2\2,\5\3\2\2\2-.\b\4\1"+
-
"\2.\66\5\b\5\2/\60\7\22\2\2\60\61\5\6\4\2\61\62\7\23\2\2\62\66\3\2\2\2"+
-
"\63\64\7\21\2\2\64\66\5\6\4\3\65-\3\2\2\2\65/\3\2\2\2\65\63\3\2\2\2\66"+
-
"<\3\2\2\2\678\f\4\2\289\t\2\2\29;\5\6\4\5:\67\3\2\2\2;>\3\2\2\2<:\3\2"+
-
"\2\2<=\3\2\2\2=\7\3\2\2\2><\3\2\2\2?@\5\n\6\2@A\7\16\2\2AB\5\n\6\2B\t"+
-
"\3\2\2\2CD\b\6\1\2DP\5\16\b\2EF\7\22\2\2FG\5\n\6\2GH\7\23\2\2HP\3\2\2"+
-
"\2IJ\7&\2\2JL\7\22\2\2KM\5\n\6\2LK\3\2\2\2LM\3\2\2\2MN\3\2\2\2NP\7\23"+
-
"\2\2OC\3\2\2\2OE\3\2\2\2OI\3\2\2\2PW\3\2\2\2QR\f\4\2\2RS\5\f\7\2ST\5\n"+
-
"\6\5TV\3\2\2\2UQ\3\2\2\2VY\3\2\2\2WU\3\2\2\2WX\3\2\2\2X\13\3\2\2\2YW\3"+
-
"\2\2\2Z[\t\3\2\2[\r\3\2\2\2\\]\b\b\1\2]c\5\20\t\2^_\7\22\2\2_`\5\16\b"+
-
"\2`a\7\23\2\2ac\3\2\2\2b\\\3\2\2\2b^\3\2\2\2ci\3\2\2\2de\f\3\2\2ef\7\35"+
-
"\2\2fh\5\16\b\4gd\3\2\2\2hk\3\2\2\2ig\3\2\2\2ij\3\2\2\2j\17\3\2\2\2ki"+
- "\3\2\2\2l\u0082\7\3\2\2mo\7
\2\2nm\3\2\2\2no\3\2\2\2os\3\2\2\2pt\7$\2"+
-
"\2qr\7$\2\2rt\7%\2\2sp\3\2\2\2sq\3\2\2\2t\u0082\3\2\2\2u\u0082\7#\2\2"+
-
"v\u0082\5\34\17\2wy\5\22\n\2xw\3\2\2\2xy\3\2\2\2yz\3\2\2\2z\u0082\t\4"+
-
"\2\2{}\5\22\n\2|{\3\2\2\2|}\3\2\2\2}~\3\2\2\2~\u0082\5\26\f\2\177\u0082"+
-
"\5\30\r\2\u0080\u0082\5\32\16\2\u0081l\3\2\2\2\u0081n\3\2\2\2\u0081u\3"+
-
"\2\2\2\u0081v\3\2\2\2\u0081x\3\2\2\2\u0081|\3\2\2\2\u0081\177\3\2\2\2"+
-
"\u0081\u0080\3\2\2\2\u0082\21\3\2\2\2\u0083\u0084\b\n\1\2\u0084\u0085"+
-
"\5\24\13\2\u0085\u008a\3\2\2\2\u0086\u0087\f\3\2\2\u0087\u0089\5\24\13"+
-
"\2\u0088\u0086\3\2\2\2\u0089\u008c\3\2\2\2\u008a\u0088\3\2\2\2\u008a\u008b"+
-
"\3\2\2\2\u008b\23\3\2\2\2\u008c\u008a\3\2\2\2\u008d\u008e\7&\2\2\u008e"+
-
"\u008f\7!\2\2\u008f\25\3\2\2\2\u0090\u0091\7\27\2\2\u0091\u009e\7&\2\2"+
-
"\u0092\u0093\7\27\2\2\u0093\u0094\7&\2\2\u0094\u0095\7\30\2\2\u0095\u0096"+
-
"\7$\2\2\u0096\u009e\7\31\2\2\u0097\u0098\7\27\2\2\u0098\u0099\7&\2\2\u0099"+
-
"\u009a\7\30\2\2\u009a\u009b\5\34\17\2\u009b\u009c\7\31\2\2\u009c\u009e"+
-
"\3\2\2\2\u009d\u0090\3\2\2\2\u009d\u0092\3\2\2\2\u009d\u0097\3\2\2\2\u009e"+
-
"\27\3\2\2\2\u009f\u00a0\7\37\2\2\u00a0\u00ad\7&\2\2\u00a1\u00a2\7\37\2"+
-
"\2\u00a2\u00a3\7&\2\2\u00a3\u00a4\7\30\2\2\u00a4\u00a5\7$\2\2\u00a5\u00ad"+
-
"\7\31\2\2\u00a6\u00a7\7\37\2\2\u00a7\u00a8\7&\2\2\u00a8\u00a9\7\30\2\2"+
-
"\u00a9\u00aa\5\34\17\2\u00aa\u00ab\7\31\2\2\u00ab\u00ad\3\2\2\2\u00ac"+
-
"\u009f\3\2\2\2\u00ac\u00a1\3\2\2\2\u00ac\u00a6\3\2\2\2\u00ad\31\3\2\2"+
-
"\2\u00ae\u00af\7\26\2\2\u00af\u00bc\7&\2\2\u00b0\u00b1\7\26\2\2\u00b1"+
-
"\u00b2\7&\2\2\u00b2\u00b3\7\30\2\2\u00b3\u00b4\7$\2\2\u00b4\u00bc\7\31"+
-
"\2\2\u00b5\u00b6\7\26\2\2\u00b6\u00b7\7&\2\2\u00b7\u00b8\7\30\2\2\u00b8"+
-
"\u00b9\5\34\17\2\u00b9\u00ba\7\31\2\2\u00ba\u00bc\3\2\2\2\u00bb\u00ae"+
-
"\3\2\2\2\u00bb\u00b0\3\2\2\2\u00bb\u00b5\3\2\2\2\u00bc\33\3\2\2\2\u00bd"+
-
"\u00be\t\5\2\2\u00be\35\3\2\2\2\23\'\65<LOWbinsx|\u0081\u008a\u009d\u00ac"+
- "\u00bb";
- public static final ATN _ATN =
- new ATNDeserializer().deserialize(_serializedATN.toCharArray());
- static {
- _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
- for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
- _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i),
i);
- }
- }
-}
\ No newline at end of file