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

commit 7d489a82948a24702307c44c9da4484c623d0001
Author: Aaron Radzinski <[email protected]>
AuthorDate: Thu Mar 11 21:59:47 2021 -0800

    WIP.
---
 nlpcraft/pom.xml                                               |  1 +
 .../apache/nlpcraft/model/intent/compiler/NCDslCompiler.scala  | 10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/nlpcraft/pom.xml b/nlpcraft/pom.xml
index 67c88a1..a9ee222 100644
--- a/nlpcraft/pom.xml
+++ b/nlpcraft/pom.xml
@@ -263,6 +263,7 @@
                 <includes>
                     <include>**/*.txt</include>
                     <include>**/*.json</include>
+                    <include>**/*.nc</include>
                     <include>**/*.yaml</include>
                     <include>**/*.sql</include>
                     <include>**/*.properties</include>
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 466f0a1..e668bd0 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
@@ -186,7 +186,7 @@ object NCDslCompiler extends LazyLogging {
 
         override def exitFlowDecl(ctx: IDP.FlowDeclContext): Unit = {
             if (ctx.qstring() != null) {
-                val regex = ctx.qstring().getText
+                val regex = U.trimQuotes(ctx.qstring().getText)
 
                 if (regex != null && regex.length > 2)
                     flowRegex = if (regex.nonEmpty) Some(regex) else None
@@ -329,7 +329,7 @@ object NCDslCompiler extends LazyLogging {
         }
     
         override def exitImp(ctx: IDP.ImpContext): Unit = {
-            val x = ctx.qstring().getText
+            val x = U.trimQuotes(ctx.qstring().getText)
             var imports: Set[NCDslIntent] = null
 
             val file = new File(x)
@@ -360,9 +360,13 @@ object NCDslCompiler extends LazyLogging {
                         x
                     )
                 catch {
-                    case _: Exception ⇒ newSyntaxError(s"Invalid or unknown 
import location: $x")(ctx.qstring())
+                    case _: Exception ⇒ throw newSyntaxError(s"Invalid or 
unknown import location: $x")(ctx.qstring())
                 }
             }
+
+            require(imports != null)
+
+            imports.foreach(addIntent(_)(ctx.qstring()))
         }
         
         override def exitIntent(ctx: IDP.IntentContext): Unit = {

Reply via email to