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 5ac370a  WIP.
5ac370a is described below

commit 5ac370af34257c5b8e5265896dc3ff0628996d95
Author: Aaron Radzinzski <[email protected]>
AuthorDate: Tue Mar 2 00:12:02 2021 -0800

    WIP.
---
 .../apache/nlpcraft/common/socket/NCSocket.scala   |   4 +-
 .../org/apache/nlpcraft/common/util/NCUtils.scala  |  18 ++--
 .../impl/ver2/NCIntentDslBaselCompiler.scala       |   2 +-
 .../intent/impl/ver2/NCIntentDslCompiler.scala     | 117 +++++++++++++--------
 .../model/intent/utils/ver2/NCDslTermContext.scala |  11 +-
 .../server/geo/tools/NCGeoNamesGenerator.scala     |   2 +-
 .../geo/tools/NCGeoStateNamesGenerator.scala       |   2 +-
 .../org/apache/nlpcraft/server/json/NCJson.scala   |   4 +-
 .../model/intent/dsl/NCIntentDslCompilerSpec.scala |  47 ++++++---
 9 files changed, 135 insertions(+), 72 deletions(-)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/socket/NCSocket.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/socket/NCSocket.scala
index 0d0c16f..22c643b 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/socket/NCSocket.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/socket/NCSocket.scala
@@ -36,8 +36,8 @@ case class NCSocket(socket: Socket, soTimeout: Int = 20000) 
extends LazyLogging
     socket.setSoTimeout(soTimeout)
 
     private final val rwLock = new Object()
-    private lazy val writer = new BufferedWriter(new 
OutputStreamWriter(socket.getOutputStream, "UTF8"))
-    private lazy val reader = new BufferedReader(new 
InputStreamReader(socket.getInputStream, "UTF8"))
+    private lazy val writer = new BufferedWriter(new 
OutputStreamWriter(socket.getOutputStream, "UTF-8"))
+    private lazy val reader = new BufferedReader(new 
InputStreamReader(socket.getInputStream, "UTF-8"))
 
     override def toString: String = socket.toString
     override def hashCode(): Int = socket.hashCode()
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
index 1d16e4c..8a3aa5d 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
@@ -323,7 +323,7 @@ object NCUtils extends LazyLogging {
       * @param log Logger to use.
       */
     @throws[NCE]
-    def readPath(path: String, enc: String, log: Logger = logger): 
List[String] =
+    def readPath(path: String, enc: String = "UTF-8", log: Logger = logger): 
List[String] =
         readFile(new File(path), enc, log)
 
     /**
@@ -334,7 +334,7 @@ object NCUtils extends LazyLogging {
       * @param log Logger to use.
       */
     @throws[NCE]
-    def readResource(res: String, enc: String, log: Logger = logger): 
List[String] = readStream(getStream(res), enc, log)
+    def readResource(res: String, enc: String = "UTF-8", log: Logger = 
logger): List[String] = readStream(getStream(res), enc, log)
 
     /**
       * Maps lines from the given resource to an object.
@@ -345,7 +345,7 @@ object NCUtils extends LazyLogging {
       * @param mapper Function to map lines.
       */
     @throws[NCE]
-    def mapResource[T](res: String, enc: String, log: Logger = logger, mapper: 
Iterator[String] ⇒ T): T =
+    def mapResource[T](res: String, enc: String = "UTF-8", log: Logger = 
logger, mapper: Iterator[String] ⇒ T): T =
         mapStream(getStream(res), enc, log, mapper)
 
     /**
@@ -356,7 +356,7 @@ object NCUtils extends LazyLogging {
       * @param log Logger to use.
       */
     @throws[NCE]
-    def readGzipPath(path: String, enc: String, log: Logger = logger): 
List[String] =
+    def readGzipPath(path: String, enc: String = "UTF-8", log: Logger = 
logger): List[String] =
         readGzipFile(new File(path), enc, log)
 
     /**
@@ -367,7 +367,7 @@ object NCUtils extends LazyLogging {
       * @param log Logger to use.
       */
     @throws[NCE]
-    def readFile(f: File, enc: String, log: Logger = logger): List[String] =
+    def readFile(f: File, enc: String = "UTF-8", log: Logger = logger): 
List[String] =
         try
             managed(Source.fromFile(f, enc)) acquireAndGet { src ⇒
                 getAndLog(src.getLines().map(p ⇒ p).toList, f, log)
@@ -1420,7 +1420,7 @@ object NCUtils extends LazyLogging {
         prettyErrorImpl(new PrettyErrorLogger(), title, e)
 
     sealed class PrettyErrorLogger {
-        def log(s: String) = System.err.println(s)
+        def log(s: String): Unit = System.err.println(s)
     }
 
     /**
@@ -1784,7 +1784,7 @@ object NCUtils extends LazyLogging {
             managed(new PrintStream(out)) acquireAndGet { ps ⇒
                 t.printStackTrace(ps)
 
-                new String(out.toByteArray, "UTF8")
+                new String(out.toByteArray, "UTF-8")
             }
         }
 
@@ -1983,7 +1983,7 @@ object NCUtils extends LazyLogging {
       */
     @throws[NCE]
     def extractYamlFile[T](f: File, ignoreCase: Boolean, tr: 
TypeReference[T]): T =
-        extractYamlString(readFile(f, "UTF8").mkString("\n"), 
f.getAbsolutePath, ignoreCase, tr)
+        extractYamlString(readFile(f, "UTF-8").mkString("\n"), 
f.getAbsolutePath, ignoreCase, tr)
 
     /**
       * Extracts type `T` from given YAML `resource`.
@@ -1994,7 +1994,7 @@ object NCUtils extends LazyLogging {
       */
     @throws[NCE]
     def extractYamlResource[T](res: String, ignoreCase: Boolean, tr: 
TypeReference[T]): T =
-        extractYamlString(readStream(getStream(res), "UTF8").mkString("\n"), 
res, ignoreCase, tr)
+        extractYamlString(readStream(getStream(res), "UTF-8").mkString("\n"), 
res, ignoreCase, tr)
 
     /**
       * Extracts type `T` from given YAML `data`.
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCIntentDslBaselCompiler.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCIntentDslBaselCompiler.scala
index e0da8ac..794ad1e 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCIntentDslBaselCompiler.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCIntentDslBaselCompiler.scala
@@ -355,7 +355,7 @@ trait NCIntentDslBaselCompiler {
                         try
                             Double.box(JDouble.parseDouble(num)) // Try 
'double'.
                         catch {
-                            case _: NumberFormatException ⇒ 
U.trimEscapesQuotes(txt)
+                            case _: NumberFormatException ⇒ 
U.trimEscapesQuotes(txt) // String in the end.
                         }
                 }
             }
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCIntentDslCompiler.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCIntentDslCompiler.scala
index 3351d07..37f0a3d 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCIntentDslCompiler.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCIntentDslCompiler.scala
@@ -26,6 +26,7 @@ import org.apache.nlpcraft.model.intent.utils.ver2._
 import org.apache.nlpcraft.model._
 import org.apache.nlpcraft.model.intent.impl.ver2.{NCIntentDslFragmentCache ⇒ 
FragCache}
 
+import java.nio.file.Path
 import java.util.Optional
 import java.util.regex.{Pattern, PatternSyntaxException}
 import scala.collection.mutable
@@ -103,6 +104,18 @@ object NCIntentDslCompiler extends LazyLogging {
             else
                 assert(false)
         }
+    
+        override def exitMinMaxRange(ctx: IDP.MinMaxRangeContext): Unit = {
+            val minStr = ctx.getChild(1).getText.trim
+            val maxStr = ctx.getChild(3).getText.trim
+        
+            try
+                setMinMax(java.lang.Integer.parseInt(minStr), 
java.lang.Integer.parseInt(maxStr))
+            catch {
+                // Errors should be caught during compilation phase.
+                case _: NumberFormatException ⇒ assert(false)
+            }
+        }
 
         override def exitMtdRef(ctx: IDP.MtdRefContext): Unit = {
             if (ctx.javaFqn() != null)
@@ -114,14 +127,25 @@ object NCIntentDslCompiler extends LazyLogging {
         override def exitTermId(ctx: IDP.TermIdContext): Unit = {
             termId = ctx.id().getText
     
-            // Check term ID uniqueness here for better error location.
             if (terms.exists(t ⇒ t.id != null && t.id == termId))
                 throw newSyntaxError(s"Duplicate term ID: $termId")(ctx.id())
         }
-        
+    
+        override def exitIntentId(ctx: IDP.IntentIdContext): Unit = {
+            intentId = ctx.id().getText
+    
+            if (intents.exists(i ⇒ i.id != null && i.id == intentId))
+                throw newSyntaxError(s"Duplicate intent ID: 
$intentId")(ctx.id())
+        }
+    
+        override def exitFragId(ctx: IDP.FragIdContext): Unit = {
+            fragId = ctx.id().getText
+    
+            if (FragCache.get(mdlId, fragId).isDefined)
+                throw newSyntaxError(s"Duplicate fragment ID: 
$fragId")(ctx.id())
+        }
+
         override def exitTermEq(ctx: IDP.TermEqContext): Unit =  termConv = 
ctx.TILDA() != null
-        override def exitIntentId(ctx: IDP.IntentIdContext): Unit = intentId = 
ctx.id().getText
-        override def exitFragId(ctx: IDP.FragIdContext): Unit = fragId = 
ctx.id().getText
         override def exitFragMeta(ctx: IDP.FragMetaContext): Unit = fragMeta = 
U.jsonToScalaMap(ctx.jsonObj().getText)
         override def exitMetaDecl(ctx: IDP.MetaDeclContext): Unit = intentMeta 
= U.jsonToScalaMap(ctx.jsonObj().getText)
         override def exitOrderedDecl(ctx: IDP.OrderedDeclContext): Unit = 
ordered = ctx.BOOL().getText == "true"
@@ -168,9 +192,9 @@ object NCIntentDslCompiler extends LazyLogging {
             implicit val c: ParserRuleContext = ctx
 
             if (min < 0 || min > max)
-                throw newSyntaxError(s"Invalid intent term min quantifiers: 
$min (must be 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).")
+                throw newSyntaxError(s"Invalid intent term max quantifiers: 
$max (must be max >= 1).")(ctx.minMax())
 
             val pred =
                 if (refMtdName != null) { // User-code defined term.
@@ -244,19 +268,12 @@ object NCIntentDslCompiler extends LazyLogging {
         }
 
         override def exitFrag(ctx: IDP.FragContext): Unit = {
-            if (FragCache.get(mdlId, fragId).isDefined)
-                throw newSyntaxError(s"Duplicate fragment ID: $fragId")(ctx)
-
             FragCache.add(mdlId, NCDslFragment(fragId, terms.toList))
 
             terms.clear()
         }
         
         override def exitIntent(ctx: IDP.IntentContext): Unit = {
-            // Check intent ID uniqueness (only for the current source).
-            if (intents.exists(i ⇒ i.id != null && i.id == intentId))
-                throw newSyntaxError(s"Duplicate intent ID: $termId")(ctx)
-
             intents += NCDslIntent(
                 dsl,
                 intentId,
@@ -334,13 +351,12 @@ object NCIntentDslCompiler extends LazyLogging {
         val pos = Math.max(0, charPos)
         val posPtr = dash.substring(0, pos) + r("^") + y(dash.substring(pos + 
1))
         val dslPtr = dslLine.substring(0, pos) + r(dslLine.charAt(pos)) + 
y(dslLine.substring(pos + 1))
-        val src = if (srcName == "<unknown>") "<inline>"else srcName
         val aMsg = U.decapitalize(msg) match {
             case s: String if s.last == '.' ⇒ s
             case s: String ⇒ s + '.'
         }
         
-        s"Intent DSL $kind error in '$src' at line $line:${charPos + 1} - 
$aMsg\n" +
+        s"Intent DSL $kind error in '$srcName' at line $line:${charPos + 1} - 
$aMsg\n" +
         s"  |-- ${c("Model:")}    $mdlId\n" +
         s"  |-- ${c("Line:")}     $dslPtr\n" +
         s"  +-- ${c("Position:")} $posPtr"
@@ -373,56 +389,73 @@ object NCIntentDslCompiler extends LazyLogging {
     }
     
     /**
-      * Compile individual fragment or intent. Note that fragments are 
accumulated in a static
-      * map keyed by model ID. Only intents are returned, if any.
       *
-      * @param filePath *.nc DSL file to compile.
-      * @param mdlId ID of the model *.nc file belongs to.
-      * @return
-      */
-    def compileFile(
-        filePath: String,
-        mdlId: String
-    ): Set[NCDslIntent] = ???
-    
-    /**
-      * Compile individual fragment or intent. Note that fragments are 
accumulated in a static
-      * map keyed by model ID. Only intents are returned, if any.
-      *
-      * @param dsl DSL to compile.
-      * @param mdlId ID of the model DSL belongs to.
+      * @param dsl
+      * @param mdlId
+      * @param srcName
       * @return
       */
-    def compile(
+    private def antlr4(
         dsl: String,
-        mdlId: String
+        mdlId: String,
+        srcName: String
     ): Set[NCDslIntent] = {
         require(dsl != null)
-
+        require(mdlId != null)
+        require(srcName != null)
+    
         val aDsl = dsl.strip()
-
+    
         val intents: Set[NCDslIntent] = cache.getOrElseUpdate(aDsl, {
             // ANTLR4 armature.
-            val lexer = new NCIntentDslLexer(CharStreams.fromString(aDsl))
+            val lexer = new NCIntentDslLexer(CharStreams.fromString(aDsl, 
srcName))
             val tokens = new CommonTokenStream(lexer)
             val parser = new IDP(tokens)
-
+        
             // Set custom error handlers.
             lexer.removeErrorListeners()
             parser.removeErrorListeners()
             lexer.addErrorListener(new CompilerErrorListener(aDsl, mdlId))
             parser.addErrorListener(new CompilerErrorListener(aDsl, mdlId))
-
+        
             // State automata.
             val fsm = new FiniteStateMachine(aDsl, mdlId)
-
+        
             // Parse the input DSL and walk built AST.
             (new ParseTreeWalker).walk(fsm, parser.dsl())
-
+        
             // Return the built intent.
             fsm.getBuiltIntents
         })
-
+    
         intents
     }
+    
+    /**
+      * Compiles inline (supplied) fragments and/or intents from given file. 
Note that fragments are
+      * accumulated in a static map keyed by model ID. Only intents are 
returned, if any.
+      *
+      * @param filePath *.nc DSL file to compile.
+      * @param mdlId ID of the model *.nc file belongs to.
+      * @return
+      */
+    @throws[NCE]
+    def compileFile(
+        filePath: Path,
+        mdlId: String
+    ): Set[NCDslIntent] = antlr4(U.readFile(filePath.toFile).mkString("\n"), 
mdlId, filePath.getFileName.toString)
+    
+    /**
+      * 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 DSL to compile.
+      * @param mdlId ID of the model DSL belongs to.
+      * @return
+      */
+    @throws[NCE]
+    def compile(
+        dsl: String,
+        mdlId: String
+    ): Set[NCDslIntent] = antlr4(dsl, mdlId, "<inline>")
 }
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/utils/ver2/NCDslTermContext.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/utils/ver2/NCDslTermContext.scala
index 9e8aa5e..291ae9a 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/utils/ver2/NCDslTermContext.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/utils/ver2/NCDslTermContext.scala
@@ -21,8 +21,15 @@ import org.apache.nlpcraft.common.ScalaMeta
 import org.apache.nlpcraft.model.NCRequest
 
 /**
- *
- */
+  *
+  * @param intentMeta Intent metadata.
+  * @param reqMeta User request ('data' parameter) metadata.
+  * @param usrMeta User object metadata.
+  * @param compMeta Company metadata.
+  * @param convMeta Conversation metadata.
+  * @param fragMeta Optional fragment (argument) metadata passed during intent 
fragment reference.
+  * @param req Server request holder.
+  */
 case class NCDslTermContext(
     intentMeta: ScalaMeta,
     reqMeta: ScalaMeta,
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoNamesGenerator.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoNamesGenerator.scala
index 5f254c5..2b64a16 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoNamesGenerator.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoNamesGenerator.scala
@@ -74,7 +74,7 @@ object NCGeoNamesGenerator extends App {
     // GEO name ID → internal representation mapping.
     private val ids = mutable.Map.empty[String, Location]
 
-    private def read(path: String): Seq[String] = U.readPath(path, 
"UTF8").filter(!_.startsWith("#"))
+    private def read(path: String): Seq[String] = U.readPath(path, 
"UTF-8").filter(!_.startsWith("#"))
 
     // Process country and continent information.
     private def processCountries(unsdContinents: Seq[NCUnsdStatsContinent]): 
Set[Country] = {
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoStateNamesGenerator.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoStateNamesGenerator.scala
index af13ef2..8c570dc 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoStateNamesGenerator.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoStateNamesGenerator.scala
@@ -31,7 +31,7 @@ import org.apache.nlpcraft.common.U
 object NCGeoStateNamesGenerator extends App {
     // Produce a map of regions (countryCode + regCode → region name)).
     private def getStates(txtFile: String): Map[String, String] =
-        U.readPath(txtFile, "UTF8").filter(!_.startsWith("#")).flatMap(line ⇒ {
+        U.readPath(txtFile, "UTF-8").filter(!_.startsWith("#")).flatMap(line ⇒ 
{
             val seq = line.split("\t").toSeq
 
             if (seq(7) == "ADM1" && seq(8) == "US") {
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/json/NCJson.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/json/NCJson.scala
index a213564..9d1f452 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/json/NCJson.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/json/NCJson.scala
@@ -239,14 +239,14 @@ object NCJson {
      *
      * @param f File to extract from.
      */
-    private def readFile(f: File): String = removeComments(U.readFile(f, 
"UTF8").mkString)
+    private def readFile(f: File): String = removeComments(U.readFile(f, 
"UTF-8").mkString)
 
     /**
       * Reads stream.
       *
       * @param in Stream to extract from.
       */
-    private def readStream(in: InputStream): String = 
removeComments(U.readStream(in, "UTF8").mkString)
+    private def readStream(in: InputStream): String = 
removeComments(U.readStream(in, "UTF-8").mkString)
 
     /**
      * Extracts type `T` from given JSON `file`.
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslCompilerSpec.scala
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslCompilerSpec.scala
index 41316b0..1f13305 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslCompilerSpec.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslCompilerSpec.scala
@@ -31,7 +31,7 @@ class NCIntentDslCompilerSpec {
      *
      * @param dsl
      */
-    private def checkOk(dsl: String): Unit =
+    private def checkCompileOk(dsl: String): Unit =
         try {
             NCIntentDslCompiler.compile(dsl, MODEL_ID)
 
@@ -45,7 +45,7 @@ class NCIntentDslCompilerSpec {
      *
      * @param txt
      */
-    private def checkError(txt: String): Unit =
+    private def checkCompileError(txt: String): Unit =
         try {
             NCIntentDslCompiler.compile(txt, MODEL_ID)
 
@@ -61,7 +61,7 @@ class NCIntentDslCompilerSpec {
     def testOk(): Unit = {
         NCIntentDslFragmentCache.clear(MODEL_ID)
         
-        checkOk(
+        checkCompileOk(
             """
               |intent=i1
               |     flow="a[^0-9]b"
@@ -69,14 +69,14 @@ class NCIntentDslCompilerSpec {
               |     term(t1)={2 == 2 && size(id()) != -25}
               |""".stripMargin
         )
-        checkOk(
+        checkCompileOk(
             """
               |intent=i1
               |     flow="a[^0-9]b"
               |     term(t1)={has(json("{'a': true, 'b\'2': {'arr': [1, 2, 
3]}}"), map("موسكو\"", 'v1\'v1', "k2", "v2"))}
               |""".stripMargin
         )
-        checkOk(
+        checkCompileOk(
             """
               |fragment=f1
               |     term(ft1)={2==2}
@@ -88,7 +88,7 @@ class NCIntentDslCompilerSpec {
               |     fragment(f1, {'a': true, 'b': ["s1", "s2"]})
               |""".stripMargin
         )
-        checkOk(
+        checkCompileOk(
             """
               |fragment=f21
               |     term(f21_t1)={2==2}
@@ -112,7 +112,7 @@ class NCIntentDslCompilerSpec {
     def testFail(): Unit = {
         NCIntentDslFragmentCache.clear(MODEL_ID)
         
-        checkError(
+        checkCompileError(
             """
               |intent=i1
               |     flow="a[^0-9]b"
@@ -120,29 +120,52 @@ class NCIntentDslCompilerSpec {
               |     term(t1)={2 == 2 && size(id()) != -25}
               |""".stripMargin
         )
-        checkError(
+        checkCompileError(
+            """
+              |intent=i1
+              |     meta={'a': true1, 'b': {'arr': [1, 2, 3]}}
+              |     term(t1)={2 == 2 && size(id()) != -25}
+              |""".stripMargin
+        )
+        checkCompileError(
             """
               |intent=i1
               |     flow="a[^0-9b"
               |     term(t1)={true}
               |""".stripMargin
         )
-        checkError(
+        checkCompileError(
+            """
+              |intent=i1
+              |     term(t1)={true}[2,1]
+              |""".stripMargin
+        )
+        checkCompileError(
+            """
+              |intent=i1
+              |     flow="a[^0-9b]"
+              |     term(t1)={true}
+              |     term(t1)={true}
+              |""".stripMargin
+        )
+        checkCompileError(
             """
               |intent=i1
               |     flow="a[^0-9b]"
               |     term(t1)={true}
+              |intent=i1
+              |     flow="a[^0-9b]"
               |     term(t1)={true}
               |""".stripMargin
         )
-        checkError(
+        checkCompileError(
             """
               |intent=i1
               |     flow="a[^0-9]b"
               |     term(t1)={has(json("{'a': true, 'b\'2': {'arr': [1, 2, 
3]}}"), map("k1\"", 'v1\'v1', "k2", "v2"))}[1:2]
               |""".stripMargin
         )
-        checkError(
+        checkCompileError(
             """
               |fragment=f1
               |     term(t1)={2==2}
@@ -154,7 +177,7 @@ class NCIntentDslCompilerSpec {
               |     fragment(f1, {'a': true, 'b': ["s1", "s2"]})
               |""".stripMargin
         )
-        checkError(
+        checkCompileError(
             """
               |fragment=f111
               |     term(t1)={2==2}

Reply via email to