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

commit 11704704acc2856c0e009dde9bc87462500c3b09
Author: Aaron Radzinski <[email protected]>
AuthorDate: Sat Feb 20 21:57:32 2021 -0800

    WIP.
---
 .../org/apache/nlpcraft/common/util/NCUtils.scala  |  20 ++-
 .../model/intent/impl/antlr4/NCIntentDsl.g4        |  28 +++-
 .../intent/impl/antlr4/NCIntentDslLexer.interp     |   4 +-
 .../model/intent/impl/antlr4/NCIntentDslLexer.java | 182 +++++++++++----------
 .../model/intent/impl/ver2/NCBaseDslCompiler.scala |   2 +-
 .../model/intent/dsl/NCDslCompilerSpec.scala       |   6 +-
 6 files changed, 143 insertions(+), 99 deletions(-)

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 fba34ef..5927455 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
@@ -176,7 +176,7 @@ object NCUtils extends LazyLogging {
         trimFilter(s.split(sep))
 
     /**
-     * Recursively removed quotes from given string.
+     * Recursively removes quotes from given string.
      *
      * @param s
      * @return
@@ -192,6 +192,24 @@ object NCUtils extends LazyLogging {
     }
 
     /**
+     * Recursively removes quotes and replaces escaped quotes from given 
string.
+     *
+     * @param s
+     * @return
+     */
+    @tailrec
+    def trimEscapesQuotes(s: String): String = {
+        val z = s.strip
+
+        if (z.head == '\'' && z.last == '\'')
+            trimEscapesQuotes(z.substring(1, z.length - 1).replace("\'", "'"))
+        else if (z.head == '"' && z.last == '"')
+            trimEscapesQuotes(z.substring(1, z.length - 1).replace("\\\"", 
"\""))
+        else
+            z
+    }
+
+    /**
      *
      * @param s
      * @param sep
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDsl.g4
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDsl.g4
index cba5303..278746f 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDsl.g4
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDsl.g4
@@ -87,8 +87,8 @@ minMaxShortcut
     | MULT
     ;
 minMaxRange: LBR INT COMMA INT RBR;
-SQSTRING: SQUOTE (~'\'')* SQUOTE;
-DQSTRING: DQUOTE (~'"')* DQUOTE;
+SQSTRING: SQUOTE ((~'\'') | ('\\''\''))* SQUOTE; // Allow for \' (escaped 
single quote) in the string.
+DQSTRING: DQUOTE ((~'"') | ('\\''"'))* DQUOTE; // Allow for \" (escape double 
quote) in the string.
 BOOL: 'true' | 'false';
 NULL: 'null';
 EQ: '==';
@@ -126,9 +126,23 @@ DOLLAR: '$';
 INT: '0' | [1-9] [_0-9]*;
 REAL: DOT [0-9]+;
 EXP: [Ee] [+\-]? INT;
-ID: 
(UNDERSCORE|[a-z]|[A-Z]|DOLLAR)+(DOLLAR|[a-z]|[A-Z]|[0-9]|COLON|MINUS|UNDERSCORE)*;
+fragment UNI_CHAR // International chars.
+    : '\u00B7'
+    | '\u0300'..'\u036F'
+    | '\u203F'..'\u2040'
+    | '\u00C0'..'\u00D6'
+    | '\u00D8'..'\u00F6'
+    | '\u00F8'..'\u02FF'
+    | '\u0370'..'\u037D'
+    | '\u037F'..'\u1FFF'
+    | '\u200C'..'\u200D'
+    | '\u2070'..'\u218F'
+    | '\u2C00'..'\u2FEF'
+    | '\u3001'..'\uD7FF'
+    | '\uF900'..'\uFDCF'
+    | '\uFDF0'..'\uFFFD'
+    ; // Ignoring ['\u10000-'\uEFFFF].
+fragment LETTER: [a-zA-Z];
+ID: 
(UNI_CHAR|UNDERSCORE|LETTER|DOLLAR)+(UNI_CHAR|DOLLAR|LETTER|[0-9]|COLON|MINUS|UNDERSCORE)*;
 WS: [ \r\t\u000C\n]+ -> skip;
-
-ErrorCharacter
-  : .
-  ;
+ErrorCharacter: .;
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslLexer.interp
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslLexer.interp
index 9b1be1d..b8b7fae 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslLexer.interp
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslLexer.interp
@@ -143,6 +143,8 @@ DOLLAR
 INT
 REAL
 EXP
+UNI_CHAR
+LETTER
 ID
 WS
 ErrorCharacter
@@ -155,4 +157,4 @@ mode names:
 DEFAULT_MODE
 
 atn:
-[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 49, 279, 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
+[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 49, 294, 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/model/intent/impl/antlr4/NCIntentDslLexer.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslLexer.java
index 3704fa8..a752afa 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslLexer.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslLexer.java
@@ -38,7 +38,7 @@ public class NCIntentDslLexer extends Lexer {
                        "NOT", "LPAR", "RPAR", "LBRACE", "RBRACE", "SQUOTE", 
"DQUOTE", "TILDA", 
                        "LBR", "RBR", "POUND", "COMMA", "COLON", "MINUS", 
"DOT", "UNDERSCORE", 
                        "ASSIGN", "PLUS", "QUESTION", "MULT", "DIV", "MOD", 
"DOLLAR", "INT", 
-                       "REAL", "EXP", "ID", "WS", "ErrorCharacter"
+                       "REAL", "EXP", "UNI_CHAR", "LETTER", "ID", "WS", 
"ErrorCharacter"
                };
        }
        public static final String[] ruleNames = makeRuleNames();
@@ -122,96 +122,106 @@ public class NCIntentDslLexer extends Lexer {
        public ATN getATN() { return _ATN; }
 
        public static final String _serializedATN =
-               
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\61\u0117\b\1\4\2"+
+               
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\61\u0126\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\'\4(\t(\4)\t)\4*\t*\4+\t"+
-               
"+\4,\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\3\3"+
-               
"\3\3\3\3\3\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\6"+
-               
"\3\6\3\6\3\6\3\6\3\7\3\7\7\7\u0082\n\7\f\7\16\7\u0085\13\7\3\7\3\7\3\b"+
-               
"\3\b\7\b\u008b\n\b\f\b\16\b\u008e\13\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\t"+
-               
"\3\t\3\t\3\t\5\t\u009b\n\t\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\f\3\f"+
-               
"\3\f\3\r\3\r\3\r\3\16\3\16\3\16\3\17\3\17\3\20\3\20\3\21\3\21\3\21\3\22"+
-               
"\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&\3&\3\'\3\'\3(\3(\3)\3)\3*\3"+
-               
"*\3+\3+\3+\7+\u00eb\n+\f+\16+\u00ee\13+\5+\u00f0\n+\3,\3,\6,\u00f4\n,"+
-               
"\r,\16,\u00f5\3-\3-\5-\u00fa\n-\3-\3-\3.\3.\3.\6.\u0101\n.\r.\16.\u0102"+
-               
"\3.\3.\3.\3.\3.\7.\u010a\n.\f.\16.\u010d\13.\3/\6/\u0110\n/\r/\16/\u0111"+
-               
"\3/\3/\3\60\3\60\2\2\61\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(O)Q*S+U,W-Y.[/]\60_\61\3\2"+
-               
"\f\3\2))\3\2$$\3\2\63;\4\2\62;aa\3\2\62;\4\2GGgg\4\2--//\4\2C\\c|\5\2"+
-               
"\62;C\\c|\5\2\13\f\16\17\"\"\2\u0126\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"+
-               
"\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2["+
-               
"\3\2\2\2\2]\3\2\2\2\2_\3\2\2\2\3a\3\2\2\2\5h\3\2\2\2\7p\3\2\2\2\tu\3\2"+
-               
"\2\2\13z\3\2\2\2\r\177\3\2\2\2\17\u0088\3\2\2\2\21\u009a\3\2\2\2\23\u009c"+
-               
"\3\2\2\2\25\u00a1\3\2\2\2\27\u00a4\3\2\2\2\31\u00a7\3\2\2\2\33\u00aa\3"+
-               
"\2\2\2\35\u00ad\3\2\2\2\37\u00af\3\2\2\2!\u00b1\3\2\2\2#\u00b4\3\2\2\2"+
-               
"%\u00b7\3\2\2\2\'\u00b9\3\2\2\2)\u00bb\3\2\2\2+\u00bd\3\2\2\2-\u00bf\3"+
-               
"\2\2\2/\u00c1\3\2\2\2\61\u00c3\3\2\2\2\63\u00c5\3\2\2\2\65\u00c7\3\2\2"+
-               
"\2\67\u00c9\3\2\2\29\u00cb\3\2\2\2;\u00cd\3\2\2\2=\u00cf\3\2\2\2?\u00d1"+
-               
"\3\2\2\2A\u00d3\3\2\2\2C\u00d5\3\2\2\2E\u00d7\3\2\2\2G\u00d9\3\2\2\2I"+
-               
"\u00db\3\2\2\2K\u00dd\3\2\2\2M\u00df\3\2\2\2O\u00e1\3\2\2\2Q\u00e3\3\2"+
-               
"\2\2S\u00e5\3\2\2\2U\u00ef\3\2\2\2W\u00f1\3\2\2\2Y\u00f7\3\2\2\2[\u0100"+
-               
"\3\2\2\2]\u010f\3\2\2\2_\u0115\3\2\2\2ab\7k\2\2bc\7p\2\2cd\7v\2\2de\7"+
-               
"g\2\2ef\7p\2\2fg\7v\2\2g\4\3\2\2\2hi\7q\2\2ij\7t\2\2jk\7f\2\2kl\7g\2\2"+
-               
"lm\7t\2\2mn\7g\2\2no\7f\2\2o\6\3\2\2\2pq\7h\2\2qr\7n\2\2rs\7q\2\2st\7"+
-               
"y\2\2t\b\3\2\2\2uv\7o\2\2vw\7g\2\2wx\7v\2\2xy\7c\2\2y\n\3\2\2\2z{\7v\2"+
-               
"\2{|\7g\2\2|}\7t\2\2}~\7o\2\2~\f\3\2\2\2\177\u0083\5\61\31\2\u0080\u0082"+
-               
"\n\2\2\2\u0081\u0080\3\2\2\2\u0082\u0085\3\2\2\2\u0083\u0081\3\2\2\2\u0083"+
-               
"\u0084\3\2\2\2\u0084\u0086\3\2\2\2\u0085\u0083\3\2\2\2\u0086\u0087\5\61"+
-               
"\31\2\u0087\16\3\2\2\2\u0088\u008c\5\63\32\2\u0089\u008b\n\3\2\2\u008a"+
-               
"\u0089\3\2\2\2\u008b\u008e\3\2\2\2\u008c\u008a\3\2\2\2\u008c\u008d\3\2"+
-               
"\2\2\u008d\u008f\3\2\2\2\u008e\u008c\3\2\2\2\u008f\u0090\5\63\32\2\u0090"+
-               
"\20\3\2\2\2\u0091\u0092\7v\2\2\u0092\u0093\7t\2\2\u0093\u0094\7w\2\2\u0094"+
-               
"\u009b\7g\2\2\u0095\u0096\7h\2\2\u0096\u0097\7c\2\2\u0097\u0098\7n\2\2"+
-               
"\u0098\u0099\7u\2\2\u0099\u009b\7g\2\2\u009a\u0091\3\2\2\2\u009a\u0095"+
-               
"\3\2\2\2\u009b\22\3\2\2\2\u009c\u009d\7p\2\2\u009d\u009e\7w\2\2\u009e"+
-               
"\u009f\7n\2\2\u009f\u00a0\7n\2\2\u00a0\24\3\2\2\2\u00a1\u00a2\7?\2\2\u00a2"+
-               
"\u00a3\7?\2\2\u00a3\26\3\2\2\2\u00a4\u00a5\7#\2\2\u00a5\u00a6\7?\2\2\u00a6"+
-               
"\30\3\2\2\2\u00a7\u00a8\7@\2\2\u00a8\u00a9\7?\2\2\u00a9\32\3\2\2\2\u00aa"+
-               
"\u00ab\7>\2\2\u00ab\u00ac\7?\2\2\u00ac\34\3\2\2\2\u00ad\u00ae\7@\2\2\u00ae"+
-               "\36\3\2\2\2\u00af\u00b0\7>\2\2\u00b0 
\3\2\2\2\u00b1\u00b2\7(\2\2\u00b2"+
-               
"\u00b3\7(\2\2\u00b3\"\3\2\2\2\u00b4\u00b5\7~\2\2\u00b5\u00b6\7~\2\2\u00b6"+
-               
"$\3\2\2\2\u00b7\u00b8\7~\2\2\u00b8&\3\2\2\2\u00b9\u00ba\7#\2\2\u00ba("+
-               
"\3\2\2\2\u00bb\u00bc\7*\2\2\u00bc*\3\2\2\2\u00bd\u00be\7+\2\2\u00be,\3"+
-               
"\2\2\2\u00bf\u00c0\7}\2\2\u00c0.\3\2\2\2\u00c1\u00c2\7\177\2\2\u00c2\60"+
-               
"\3\2\2\2\u00c3\u00c4\7)\2\2\u00c4\62\3\2\2\2\u00c5\u00c6\7$\2\2\u00c6"+
-               
"\64\3\2\2\2\u00c7\u00c8\7\u0080\2\2\u00c8\66\3\2\2\2\u00c9\u00ca\7]\2"+
-               
"\2\u00ca8\3\2\2\2\u00cb\u00cc\7_\2\2\u00cc:\3\2\2\2\u00cd\u00ce\7%\2\2"+
-               
"\u00ce<\3\2\2\2\u00cf\u00d0\7.\2\2\u00d0>\3\2\2\2\u00d1\u00d2\7<\2\2\u00d2"+
-               
"@\3\2\2\2\u00d3\u00d4\7/\2\2\u00d4B\3\2\2\2\u00d5\u00d6\7\60\2\2\u00d6"+
-               
"D\3\2\2\2\u00d7\u00d8\7a\2\2\u00d8F\3\2\2\2\u00d9\u00da\7?\2\2\u00daH"+
-               
"\3\2\2\2\u00db\u00dc\7-\2\2\u00dcJ\3\2\2\2\u00dd\u00de\7A\2\2\u00deL\3"+
-               
"\2\2\2\u00df\u00e0\7,\2\2\u00e0N\3\2\2\2\u00e1\u00e2\7\61\2\2\u00e2P\3"+
-               
"\2\2\2\u00e3\u00e4\7\'\2\2\u00e4R\3\2\2\2\u00e5\u00e6\7&\2\2\u00e6T\3"+
-               
"\2\2\2\u00e7\u00f0\7\62\2\2\u00e8\u00ec\t\4\2\2\u00e9\u00eb\t\5\2\2\u00ea"+
-               
"\u00e9\3\2\2\2\u00eb\u00ee\3\2\2\2\u00ec\u00ea\3\2\2\2\u00ec\u00ed\3\2"+
-               
"\2\2\u00ed\u00f0\3\2\2\2\u00ee\u00ec\3\2\2\2\u00ef\u00e7\3\2\2\2\u00ef"+
-               
"\u00e8\3\2\2\2\u00f0V\3\2\2\2\u00f1\u00f3\5C\"\2\u00f2\u00f4\t\6\2\2\u00f3"+
-               
"\u00f2\3\2\2\2\u00f4\u00f5\3\2\2\2\u00f5\u00f3\3\2\2\2\u00f5\u00f6\3\2"+
-               
"\2\2\u00f6X\3\2\2\2\u00f7\u00f9\t\7\2\2\u00f8\u00fa\t\b\2\2\u00f9\u00f8"+
-               
"\3\2\2\2\u00f9\u00fa\3\2\2\2\u00fa\u00fb\3\2\2\2\u00fb\u00fc\5U+\2\u00fc"+
-               
"Z\3\2\2\2\u00fd\u0101\5E#\2\u00fe\u0101\t\t\2\2\u00ff\u0101\5S*\2\u0100"+
-               
"\u00fd\3\2\2\2\u0100\u00fe\3\2\2\2\u0100\u00ff\3\2\2\2\u0101\u0102\3\2"+
-               
"\2\2\u0102\u0100\3\2\2\2\u0102\u0103\3\2\2\2\u0103\u010b\3\2\2\2\u0104"+
-               "\u010a\5S*\2\u0105\u010a\t\n\2\2\u0106\u010a\5? 
\2\u0107\u010a\5A!\2\u0108"+
-               
"\u010a\5E#\2\u0109\u0104\3\2\2\2\u0109\u0105\3\2\2\2\u0109\u0106\3\2\2"+
-               
"\2\u0109\u0107\3\2\2\2\u0109\u0108\3\2\2\2\u010a\u010d\3\2\2\2\u010b\u0109"+
-               
"\3\2\2\2\u010b\u010c\3\2\2\2\u010c\\\3\2\2\2\u010d\u010b\3\2\2\2\u010e"+
-               
"\u0110\t\13\2\2\u010f\u010e\3\2\2\2\u0110\u0111\3\2\2\2\u0111\u010f\3"+
-               
"\2\2\2\u0111\u0112\3\2\2\2\u0112\u0113\3\2\2\2\u0113\u0114\b/\2\2\u0114"+
-               
"^\3\2\2\2\u0115\u0116\13\2\2\2\u0116`\3\2\2\2\17\2\u0083\u008c\u009a\u00ec"+
-               "\u00ef\u00f5\u00f9\u0100\u0102\u0109\u010b\u0111\3\b\2\2";
+               
"+\4,\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\3\2\3\2\3\2\3"+
+               
"\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\5"+
+               
"\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\7\3\7\3\7\3\7\7\7\u0088\n\7\f\7"+
+               
"\16\7\u008b\13\7\3\7\3\7\3\b\3\b\3\b\3\b\7\b\u0093\n\b\f\b\16\b\u0096"+
+               
"\13\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\5\t\u00a3\n\t\3\n\3"+
+               
"\n\3\n\3\n\3\n\3\13\3\13\3\13\3\f\3\f\3\f\3\r\3\r\3\r\3\16\3\16\3\16\3"+
+               
"\17\3\17\3\20\3\20\3\21\3\21\3\21\3\22\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&\3&\3\'\3\'\3(\3(\3)\3)\3*\3*\3+\3+\3+\7+\u00f3\n+\f+\16+\u00f6"+
+               
"\13+\5+\u00f8\n+\3,\3,\6,\u00fc\n,\r,\16,\u00fd\3-\3-\5-\u0102\n-\3-\3"+
+               
"-\3.\3.\3/\3/\3\60\3\60\3\60\3\60\6\60\u010e\n\60\r\60\16\60\u010f\3\60"+
+               
"\3\60\3\60\3\60\3\60\3\60\3\60\7\60\u0119\n\60\f\60\16\60\u011c\13\60"+
+               
"\3\61\6\61\u011f\n\61\r\61\16\61\u0120\3\61\3\61\3\62\3\62\2\2\63\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(O)Q*S+U,W-Y.[\2]\2_/a\60c\61\3\2\f\3\2))\3\2$$\3\2\63"+
+               
";\4\2\62;aa\3\2\62;\4\2GGgg\4\2--//\16\2\u00b9\u00b9\u00c2\u00d8\u00da"+
+               
"\u00f8\u00fa\u037f\u0381\u2001\u200e\u200f\u2041\u2042\u2072\u2191\u2c02"+
+               
"\u2ff1\u3003\ud801\uf902\ufdd1\ufdf2\uffff\4\2C\\c|\5\2\13\f\16\17\"\""+
+               
"\2\u0138\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\2O\3\2\2\2\2Q\3\2\2\2\2S"+
+               
"\3\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2"+
+               
"\2\2\3e\3\2\2\2\5l\3\2\2\2\7t\3\2\2\2\ty\3\2\2\2\13~\3\2\2\2\r\u0083\3"+
+               
"\2\2\2\17\u008e\3\2\2\2\21\u00a2\3\2\2\2\23\u00a4\3\2\2\2\25\u00a9\3\2"+
+               
"\2\2\27\u00ac\3\2\2\2\31\u00af\3\2\2\2\33\u00b2\3\2\2\2\35\u00b5\3\2\2"+
+               
"\2\37\u00b7\3\2\2\2!\u00b9\3\2\2\2#\u00bc\3\2\2\2%\u00bf\3\2\2\2\'\u00c1"+
+               
"\3\2\2\2)\u00c3\3\2\2\2+\u00c5\3\2\2\2-\u00c7\3\2\2\2/\u00c9\3\2\2\2\61"+
+               
"\u00cb\3\2\2\2\63\u00cd\3\2\2\2\65\u00cf\3\2\2\2\67\u00d1\3\2\2\29\u00d3"+
+               
"\3\2\2\2;\u00d5\3\2\2\2=\u00d7\3\2\2\2?\u00d9\3\2\2\2A\u00db\3\2\2\2C"+
+               
"\u00dd\3\2\2\2E\u00df\3\2\2\2G\u00e1\3\2\2\2I\u00e3\3\2\2\2K\u00e5\3\2"+
+               
"\2\2M\u00e7\3\2\2\2O\u00e9\3\2\2\2Q\u00eb\3\2\2\2S\u00ed\3\2\2\2U\u00f7"+
+               
"\3\2\2\2W\u00f9\3\2\2\2Y\u00ff\3\2\2\2[\u0105\3\2\2\2]\u0107\3\2\2\2_"+
+               
"\u010d\3\2\2\2a\u011e\3\2\2\2c\u0124\3\2\2\2ef\7k\2\2fg\7p\2\2gh\7v\2"+
+               
"\2hi\7g\2\2ij\7p\2\2jk\7v\2\2k\4\3\2\2\2lm\7q\2\2mn\7t\2\2no\7f\2\2op"+
+               
"\7g\2\2pq\7t\2\2qr\7g\2\2rs\7f\2\2s\6\3\2\2\2tu\7h\2\2uv\7n\2\2vw\7q\2"+
+               
"\2wx\7y\2\2x\b\3\2\2\2yz\7o\2\2z{\7g\2\2{|\7v\2\2|}\7c\2\2}\n\3\2\2\2"+
+               
"~\177\7v\2\2\177\u0080\7g\2\2\u0080\u0081\7t\2\2\u0081\u0082\7o\2\2\u0082"+
+               
"\f\3\2\2\2\u0083\u0089\5\61\31\2\u0084\u0088\n\2\2\2\u0085\u0086\7^\2"+
+               
"\2\u0086\u0088\7)\2\2\u0087\u0084\3\2\2\2\u0087\u0085\3\2\2\2\u0088\u008b"+
+               
"\3\2\2\2\u0089\u0087\3\2\2\2\u0089\u008a\3\2\2\2\u008a\u008c\3\2\2\2\u008b"+
+               
"\u0089\3\2\2\2\u008c\u008d\5\61\31\2\u008d\16\3\2\2\2\u008e\u0094\5\63"+
+               
"\32\2\u008f\u0093\n\3\2\2\u0090\u0091\7^\2\2\u0091\u0093\7$\2\2\u0092"+
+               
"\u008f\3\2\2\2\u0092\u0090\3\2\2\2\u0093\u0096\3\2\2\2\u0094\u0092\3\2"+
+               
"\2\2\u0094\u0095\3\2\2\2\u0095\u0097\3\2\2\2\u0096\u0094\3\2\2\2\u0097"+
+               
"\u0098\5\63\32\2\u0098\20\3\2\2\2\u0099\u009a\7v\2\2\u009a\u009b\7t\2"+
+               
"\2\u009b\u009c\7w\2\2\u009c\u00a3\7g\2\2\u009d\u009e\7h\2\2\u009e\u009f"+
+               
"\7c\2\2\u009f\u00a0\7n\2\2\u00a0\u00a1\7u\2\2\u00a1\u00a3\7g\2\2\u00a2"+
+               
"\u0099\3\2\2\2\u00a2\u009d\3\2\2\2\u00a3\22\3\2\2\2\u00a4\u00a5\7p\2\2"+
+               
"\u00a5\u00a6\7w\2\2\u00a6\u00a7\7n\2\2\u00a7\u00a8\7n\2\2\u00a8\24\3\2"+
+               
"\2\2\u00a9\u00aa\7?\2\2\u00aa\u00ab\7?\2\2\u00ab\26\3\2\2\2\u00ac\u00ad"+
+               
"\7#\2\2\u00ad\u00ae\7?\2\2\u00ae\30\3\2\2\2\u00af\u00b0\7@\2\2\u00b0\u00b1"+
+               
"\7?\2\2\u00b1\32\3\2\2\2\u00b2\u00b3\7>\2\2\u00b3\u00b4\7?\2\2\u00b4\34"+
+               
"\3\2\2\2\u00b5\u00b6\7@\2\2\u00b6\36\3\2\2\2\u00b7\u00b8\7>\2\2\u00b8"+
+               " 
\3\2\2\2\u00b9\u00ba\7(\2\2\u00ba\u00bb\7(\2\2\u00bb\"\3\2\2\2\u00bc"+
+               
"\u00bd\7~\2\2\u00bd\u00be\7~\2\2\u00be$\3\2\2\2\u00bf\u00c0\7~\2\2\u00c0"+
+               
"&\3\2\2\2\u00c1\u00c2\7#\2\2\u00c2(\3\2\2\2\u00c3\u00c4\7*\2\2\u00c4*"+
+               
"\3\2\2\2\u00c5\u00c6\7+\2\2\u00c6,\3\2\2\2\u00c7\u00c8\7}\2\2\u00c8.\3"+
+               
"\2\2\2\u00c9\u00ca\7\177\2\2\u00ca\60\3\2\2\2\u00cb\u00cc\7)\2\2\u00cc"+
+               
"\62\3\2\2\2\u00cd\u00ce\7$\2\2\u00ce\64\3\2\2\2\u00cf\u00d0\7\u0080\2"+
+               
"\2\u00d0\66\3\2\2\2\u00d1\u00d2\7]\2\2\u00d28\3\2\2\2\u00d3\u00d4\7_\2"+
+               
"\2\u00d4:\3\2\2\2\u00d5\u00d6\7%\2\2\u00d6<\3\2\2\2\u00d7\u00d8\7.\2\2"+
+               
"\u00d8>\3\2\2\2\u00d9\u00da\7<\2\2\u00da@\3\2\2\2\u00db\u00dc\7/\2\2\u00dc"+
+               
"B\3\2\2\2\u00dd\u00de\7\60\2\2\u00deD\3\2\2\2\u00df\u00e0\7a\2\2\u00e0"+
+               
"F\3\2\2\2\u00e1\u00e2\7?\2\2\u00e2H\3\2\2\2\u00e3\u00e4\7-\2\2\u00e4J"+
+               
"\3\2\2\2\u00e5\u00e6\7A\2\2\u00e6L\3\2\2\2\u00e7\u00e8\7,\2\2\u00e8N\3"+
+               
"\2\2\2\u00e9\u00ea\7\61\2\2\u00eaP\3\2\2\2\u00eb\u00ec\7\'\2\2\u00ecR"+
+               
"\3\2\2\2\u00ed\u00ee\7&\2\2\u00eeT\3\2\2\2\u00ef\u00f8\7\62\2\2\u00f0"+
+               
"\u00f4\t\4\2\2\u00f1\u00f3\t\5\2\2\u00f2\u00f1\3\2\2\2\u00f3\u00f6\3\2"+
+               
"\2\2\u00f4\u00f2\3\2\2\2\u00f4\u00f5\3\2\2\2\u00f5\u00f8\3\2\2\2\u00f6"+
+               
"\u00f4\3\2\2\2\u00f7\u00ef\3\2\2\2\u00f7\u00f0\3\2\2\2\u00f8V\3\2\2\2"+
+               
"\u00f9\u00fb\5C\"\2\u00fa\u00fc\t\6\2\2\u00fb\u00fa\3\2\2\2\u00fc\u00fd"+
+               
"\3\2\2\2\u00fd\u00fb\3\2\2\2\u00fd\u00fe\3\2\2\2\u00feX\3\2\2\2\u00ff"+
+               
"\u0101\t\7\2\2\u0100\u0102\t\b\2\2\u0101\u0100\3\2\2\2\u0101\u0102\3\2"+
+               
"\2\2\u0102\u0103\3\2\2\2\u0103\u0104\5U+\2\u0104Z\3\2\2\2\u0105\u0106"+
+               
"\t\t\2\2\u0106\\\3\2\2\2\u0107\u0108\t\n\2\2\u0108^\3\2\2\2\u0109\u010e"+
+               
"\5[.\2\u010a\u010e\5E#\2\u010b\u010e\5]/\2\u010c\u010e\5S*\2\u010d\u0109"+
+               
"\3\2\2\2\u010d\u010a\3\2\2\2\u010d\u010b\3\2\2\2\u010d\u010c\3\2\2\2\u010e"+
+               
"\u010f\3\2\2\2\u010f\u010d\3\2\2\2\u010f\u0110\3\2\2\2\u0110\u011a\3\2"+
+               
"\2\2\u0111\u0119\5[.\2\u0112\u0119\5S*\2\u0113\u0119\5]/\2\u0114\u0119"+
+               "\t\6\2\2\u0115\u0119\5? 
\2\u0116\u0119\5A!\2\u0117\u0119\5E#\2\u0118\u0111"+
+               
"\3\2\2\2\u0118\u0112\3\2\2\2\u0118\u0113\3\2\2\2\u0118\u0114\3\2\2\2\u0118"+
+               
"\u0115\3\2\2\2\u0118\u0116\3\2\2\2\u0118\u0117\3\2\2\2\u0119\u011c\3\2"+
+               
"\2\2\u011a\u0118\3\2\2\2\u011a\u011b\3\2\2\2\u011b`\3\2\2\2\u011c\u011a"+
+               
"\3\2\2\2\u011d\u011f\t\13\2\2\u011e\u011d\3\2\2\2\u011f\u0120\3\2\2\2"+
+               
"\u0120\u011e\3\2\2\2\u0120\u0121\3\2\2\2\u0121\u0122\3\2\2\2\u0122\u0123"+
+               
"\b\61\2\2\u0123b\3\2\2\2\u0124\u0125\13\2\2\2\u0125d\3\2\2\2\21\2\u0087"+
+               
"\u0089\u0092\u0094\u00a2\u00f4\u00f7\u00fd\u0101\u010d\u010f\u0118\u011a"+
+               "\u0120\3\b\2\2";
        public static final ATN _ATN =
                new ATNDeserializer().deserialize(_serializedATN.toCharArray());
        static {
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCBaseDslCompiler.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCBaseDslCompiler.scala
index 2b67f46..fa25550 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCBaseDslCompiler.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCBaseDslCompiler.scala
@@ -327,7 +327,7 @@ trait NCBaseDslCompiler {
                         try
                             Double.box(JDouble.parseDouble(num)) // Try 
'double'.
                         catch {
-                            case _: NumberFormatException ⇒ txt // String by 
default (incl. quotes).
+                            case _: NumberFormatException ⇒ 
U.trimEscapesQuotes(txt)
                         }
                 }
             }
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCDslCompilerSpec.scala
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCDslCompilerSpec.scala
index ce0b8f8..f2b0f23 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCDslCompilerSpec.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCDslCompilerSpec.scala
@@ -35,12 +35,12 @@ class NCDslCompilerSpec {
         )
         val intent2 = NCIntentDslCompiler.compile(
             """
-              |intent=i1 flow="a[^0-9]b" term(t1)={has(json("{'a': true, 'b': 
{'arr': [1, 2, 3]}}"), map("k1", "v1", "k2", "v2"))}
+              |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"))}
               |""".stripMargin, "mdl.id"
         )
 
-        // val ret = intent2.terms.head.pred(_, _, _)
+        () // Breakpoint.
 
-        println(intent)
+        // val ret = intent2.terms.head.pred(_, _, _)
     }
 }

Reply via email to