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

commit 8bdde3ba45eb87acca859cf5f4717c4822d18fc2
Author: Aaron Radzinzski <[email protected]>
AuthorDate: Wed Feb 10 18:27:19 2021 -0800

    WIP.
---
 .../model/intent/impl/antlr4/NCIntentDsl.g4        |   2 +-
 .../model/intent/impl/antlr4/NCIntentDsl.interp    |   3 +-
 .../impl/antlr4/NCIntentDslBaseListener.java       |  14 +-
 .../model/intent/impl/antlr4/NCIntentDslLexer.java |   2 +-
 .../intent/impl/antlr4/NCIntentDslListener.java    |  12 +-
 .../intent/impl/antlr4/NCIntentDslParser.java      | 552 +++++++++++----------
 .../intent/impl/ver2/NCIntentDslCompiler.scala     | 105 +++-
 7 files changed, 420 insertions(+), 270 deletions(-)

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 a204ab2..57a595f 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
@@ -62,7 +62,7 @@ expr
     : val
     | expr COMMA val
     | LPAREN expr RPAREN
-    | expr (MINUS | PLUS | STAR | FSLASH) expr
+    | expr (MINUS | PLUS | STAR | FSLASH | PERCENT) expr
     | funCall
     ;
 funCall: ID LPAREN expr? RPAREN; // Buit-in function call.
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDsl.interp
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDsl.interp
index 5ac160a..2c559f9 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDsl.interp
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDsl.interp
@@ -111,6 +111,7 @@ termId
 termDef
 termPred
 expr
+funCall
 val
 qstring
 minMax
@@ -119,4 +120,4 @@ minMaxRange
 
 
 atn:
-[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 46, 256, 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, 3, 2, 3, 2, 
5, 2, 51, 10, 2, 3, 2, 5, 2, 54, 10, 2, 3, 2, 5, 2, 57, 10, 2, 3, 2, 3, 2, 3, 
2, 3, 3, 3, 3, 3, 3, 3,  [...]
\ No newline at end of file
+[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 46, 260, 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, 3, 2, 3, 2, 5, 2, 53, 10, 2, 3, 2, 5, 2, 56, 10, 2, 3, 2, 5, 2, 59, 10, 2, 
3, 2, 3, 2, 3, 2, 3, 3, 3 [...]
\ No newline at end of file
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslBaseListener.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslBaseListener.java
index 041b046..c083c73 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslBaseListener.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslBaseListener.java
@@ -1,4 +1,4 @@
-// Generated from C:/Users/Nikita 
Ivanov/Documents/GitHub/incubator-nlpcraft/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4\NCIntentDsl.g4
 by ANTLR 4.9.1
+// Generated from 
/Users/nivanov/incubator-nlpcraft/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDsl.g4
 by ANTLR 4.9.1
 package org.apache.nlpcraft.model.intent.impl.antlr4;
 
 import org.antlr.v4.runtime.ParserRuleContext;
@@ -232,6 +232,18 @@ public class NCIntentDslBaseListener implements 
NCIntentDslListener {
         *
         * <p>The default implementation does nothing.</p>
         */
+       @Override public void enterFunCall(NCIntentDslParser.FunCallContext 
ctx) { }
+       /**
+        * {@inheritDoc}
+        *
+        * <p>The default implementation does nothing.</p>
+        */
+       @Override public void exitFunCall(NCIntentDslParser.FunCallContext ctx) 
{ }
+       /**
+        * {@inheritDoc}
+        *
+        * <p>The default implementation does nothing.</p>
+        */
        @Override public void enterVal(NCIntentDslParser.ValContext ctx) { }
        /**
         * {@inheritDoc}
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 24d3f45..a42630c 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
@@ -1,4 +1,4 @@
-// Generated from C:/Users/Nikita 
Ivanov/Documents/GitHub/incubator-nlpcraft/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4\NCIntentDsl.g4
 by ANTLR 4.9.1
+// Generated from 
/Users/nivanov/incubator-nlpcraft/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDsl.g4
 by ANTLR 4.9.1
 package org.apache.nlpcraft.model.intent.impl.antlr4;
 import org.antlr.v4.runtime.Lexer;
 import org.antlr.v4.runtime.CharStream;
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslListener.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslListener.java
index b8bb1c1..6cce4e1 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslListener.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslListener.java
@@ -1,4 +1,4 @@
-// Generated from C:/Users/Nikita 
Ivanov/Documents/GitHub/incubator-nlpcraft/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4\NCIntentDsl.g4
 by ANTLR 4.9.1
+// Generated from 
/Users/nivanov/incubator-nlpcraft/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDsl.g4
 by ANTLR 4.9.1
 package org.apache.nlpcraft.model.intent.impl.antlr4;
 import org.antlr.v4.runtime.tree.ParseTreeListener;
 
@@ -188,6 +188,16 @@ public interface NCIntentDslListener extends 
ParseTreeListener {
         */
        void exitExpr(NCIntentDslParser.ExprContext ctx);
        /**
+        * Enter a parse tree produced by {@link NCIntentDslParser#funCall}.
+        * @param ctx the parse tree
+        */
+       void enterFunCall(NCIntentDslParser.FunCallContext ctx);
+       /**
+        * Exit a parse tree produced by {@link NCIntentDslParser#funCall}.
+        * @param ctx the parse tree
+        */
+       void exitFunCall(NCIntentDslParser.FunCallContext ctx);
+       /**
         * Enter a parse tree produced by {@link NCIntentDslParser#val}.
         * @param ctx the parse tree
         */
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslParser.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslParser.java
index 5bbffa3..355e75b 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslParser.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDslParser.java
@@ -1,4 +1,4 @@
-// Generated from C:/Users/Nikita 
Ivanov/Documents/GitHub/incubator-nlpcraft/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4\NCIntentDsl.g4
 by ANTLR 4.9.1
+// Generated from 
/Users/nivanov/incubator-nlpcraft/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/antlr4/NCIntentDsl.g4
 by ANTLR 4.9.1
 package org.apache.nlpcraft.model.intent.impl.antlr4;
 import org.antlr.v4.runtime.atn.*;
 import org.antlr.v4.runtime.dfa.DFA;
@@ -28,14 +28,14 @@ public class NCIntentDslParser extends Parser {
                RULE_metaDecl = 4, RULE_jsonObj = 5, RULE_jsonPair = 6, 
RULE_jsonVal = 7, 
                RULE_jsonArr = 8, RULE_terms = 9, RULE_termEq = 10, RULE_term = 
11, RULE_clsNer = 12, 
                RULE_javaFqn = 13, RULE_termId = 14, RULE_termDef = 15, 
RULE_termPred = 16, 
-               RULE_expr = 17, RULE_val = 18, RULE_qstring = 19, RULE_minMax = 
20, RULE_minMaxShortcut = 21, 
-               RULE_minMaxRange = 22;
+               RULE_expr = 17, RULE_funCall = 18, RULE_val = 19, RULE_qstring 
= 20, RULE_minMax = 21, 
+               RULE_minMaxShortcut = 22, RULE_minMaxRange = 23;
        private static String[] makeRuleNames() {
                return new String[] {
                        "intent", "intentId", "orderedDecl", "flowDecl", 
"metaDecl", "jsonObj", 
                        "jsonPair", "jsonVal", "jsonArr", "terms", "termEq", 
"term", "clsNer", 
-                       "javaFqn", "termId", "termDef", "termPred", "expr", 
"val", "qstring", 
-                       "minMax", "minMaxShortcut", "minMaxRange"
+                       "javaFqn", "termId", "termDef", "termPred", "expr", 
"funCall", "val", 
+                       "qstring", "minMax", "minMaxShortcut", "minMaxRange"
                };
        }
        public static final String[] ruleNames = makeRuleNames();
@@ -149,41 +149,41 @@ public class NCIntentDslParser extends Parser {
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(46);
-                       intentId();
                        setState(48);
+                       intentId();
+                       setState(50);
                        _errHandler.sync(this);
                        _la = _input.LA(1);
                        if (_la==T__1) {
                                {
-                               setState(47);
+                               setState(49);
                                orderedDecl();
                                }
                        }
 
-                       setState(51);
+                       setState(53);
                        _errHandler.sync(this);
                        _la = _input.LA(1);
                        if (_la==T__2) {
                                {
-                               setState(50);
+                               setState(52);
                                flowDecl();
                                }
                        }
 
-                       setState(54);
+                       setState(56);
                        _errHandler.sync(this);
                        _la = _input.LA(1);
                        if (_la==T__3) {
                                {
-                               setState(53);
+                               setState(55);
                                metaDecl();
                                }
                        }
 
-                       setState(56);
+                       setState(58);
                        terms(0);
-                       setState(57);
+                       setState(59);
                        match(EOF);
                        }
                }
@@ -221,11 +221,11 @@ public class NCIntentDslParser extends Parser {
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(59);
+                       setState(61);
                        match(T__0);
-                       setState(60);
+                       setState(62);
                        match(EQ);
-                       setState(61);
+                       setState(63);
                        match(ID);
                        }
                }
@@ -263,11 +263,11 @@ public class NCIntentDslParser extends Parser {
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(63);
+                       setState(65);
                        match(T__1);
-                       setState(64);
+                       setState(66);
                        match(EQ);
-                       setState(65);
+                       setState(67);
                        match(BOOL);
                        }
                }
@@ -307,11 +307,11 @@ public class NCIntentDslParser extends Parser {
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(67);
+                       setState(69);
                        match(T__2);
-                       setState(68);
+                       setState(70);
                        match(EQ);
-                       setState(69);
+                       setState(71);
                        qstring();
                        }
                }
@@ -351,11 +351,11 @@ public class NCIntentDslParser extends Parser {
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(71);
+                       setState(73);
                        match(T__3);
-                       setState(72);
+                       setState(74);
                        match(EQ);
-                       setState(73);
+                       setState(75);
                        jsonObj();
                        }
                }
@@ -402,42 +402,42 @@ public class NCIntentDslParser extends Parser {
                enterRule(_localctx, 10, RULE_jsonObj);
                int _la;
                try {
-                       setState(88);
+                       setState(90);
                        _errHandler.sync(this);
                        switch ( 
getInterpreter().adaptivePredict(_input,4,_ctx) ) {
                        case 1:
                                enterOuterAlt(_localctx, 1);
                                {
-                               setState(75);
+                               setState(77);
                                match(LCURLY);
-                               setState(76);
+                               setState(78);
                                jsonPair();
-                               setState(81);
+                               setState(83);
                                _errHandler.sync(this);
                                _la = _input.LA(1);
                                while (_la==COMMA) {
                                        {
                                        {
-                                       setState(77);
+                                       setState(79);
                                        match(COMMA);
-                                       setState(78);
+                                       setState(80);
                                        jsonPair();
                                        }
                                        }
-                                       setState(83);
+                                       setState(85);
                                        _errHandler.sync(this);
                                        _la = _input.LA(1);
                                }
-                               setState(84);
+                               setState(86);
                                match(RCURLY);
                                }
                                break;
                        case 2:
                                enterOuterAlt(_localctx, 2);
                                {
-                               setState(86);
+                               setState(88);
                                match(LCURLY);
-                               setState(87);
+                               setState(89);
                                match(RCURLY);
                                }
                                break;
@@ -482,11 +482,11 @@ public class NCIntentDslParser extends Parser {
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(90);
+                       setState(92);
                        qstring();
-                       setState(91);
+                       setState(93);
                        match(COLON);
-                       setState(92);
+                       setState(94);
                        jsonVal();
                        }
                }
@@ -536,14 +536,14 @@ public class NCIntentDslParser extends Parser {
                enterRule(_localctx, 14, RULE_jsonVal);
                int _la;
                try {
-                       setState(109);
+                       setState(111);
                        _errHandler.sync(this);
                        switch (_input.LA(1)) {
                        case SQSTRING:
                        case DQSTRING:
                                enterOuterAlt(_localctx, 1);
                                {
-                               setState(94);
+                               setState(96);
                                qstring();
                                }
                                break;
@@ -551,34 +551,34 @@ public class NCIntentDslParser extends Parser {
                        case INT:
                                enterOuterAlt(_localctx, 2);
                                {
-                               setState(96);
+                               setState(98);
                                _errHandler.sync(this);
                                _la = _input.LA(1);
                                if (_la==MINUS) {
                                        {
-                                       setState(95);
+                                       setState(97);
                                        match(MINUS);
                                        }
                                }
 
-                               setState(98);
-                               match(INT);
                                setState(100);
+                               match(INT);
+                               setState(102);
                                _errHandler.sync(this);
                                _la = _input.LA(1);
                                if (_la==REAL) {
                                        {
-                                       setState(99);
+                                       setState(101);
                                        match(REAL);
                                        }
                                }
 
-                               setState(103);
+                               setState(105);
                                _errHandler.sync(this);
                                _la = _input.LA(1);
                                if (_la==EXP) {
                                        {
-                                       setState(102);
+                                       setState(104);
                                        match(EXP);
                                        }
                                }
@@ -588,28 +588,28 @@ public class NCIntentDslParser extends Parser {
                        case LCURLY:
                                enterOuterAlt(_localctx, 3);
                                {
-                               setState(105);
+                               setState(107);
                                jsonObj();
                                }
                                break;
                        case LBR:
                                enterOuterAlt(_localctx, 4);
                                {
-                               setState(106);
+                               setState(108);
                                jsonArr();
                                }
                                break;
                        case BOOL:
                                enterOuterAlt(_localctx, 5);
                                {
-                               setState(107);
+                               setState(109);
                                match(BOOL);
                                }
                                break;
                        case NULL:
                                enterOuterAlt(_localctx, 6);
                                {
-                               setState(108);
+                               setState(110);
                                match(NULL);
                                }
                                break;
@@ -660,42 +660,42 @@ public class NCIntentDslParser extends Parser {
                enterRule(_localctx, 16, RULE_jsonArr);
                int _la;
                try {
-                       setState(124);
+                       setState(126);
                        _errHandler.sync(this);
                        switch ( 
getInterpreter().adaptivePredict(_input,10,_ctx) ) {
                        case 1:
                                enterOuterAlt(_localctx, 1);
                                {
-                               setState(111);
+                               setState(113);
                                match(LBR);
-                               setState(112);
+                               setState(114);
                                jsonVal();
-                               setState(117);
+                               setState(119);
                                _errHandler.sync(this);
                                _la = _input.LA(1);
                                while (_la==COMMA) {
                                        {
                                        {
-                                       setState(113);
+                                       setState(115);
                                        match(COMMA);
-                                       setState(114);
+                                       setState(116);
                                        jsonVal();
                                        }
                                        }
-                                       setState(119);
+                                       setState(121);
                                        _errHandler.sync(this);
                                        _la = _input.LA(1);
                                }
-                               setState(120);
+                               setState(122);
                                match(RBR);
                                }
                                break;
                        case 2:
                                enterOuterAlt(_localctx, 2);
                                {
-                               setState(122);
+                               setState(124);
                                match(LBR);
-                               setState(123);
+                               setState(125);
                                match(RBR);
                                }
                                break;
@@ -749,11 +749,11 @@ public class NCIntentDslParser extends Parser {
                        enterOuterAlt(_localctx, 1);
                        {
                        {
-                       setState(127);
+                       setState(129);
                        term();
                        }
                        _ctx.stop = _input.LT(-1);
-                       setState(133);
+                       setState(135);
                        _errHandler.sync(this);
                        _alt = getInterpreter().adaptivePredict(_input,11,_ctx);
                        while ( _alt!=2 && 
_alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
@@ -764,14 +764,14 @@ public class NCIntentDslParser extends Parser {
                                        {
                                        _localctx = new 
TermsContext(_parentctx, _parentState);
                                        pushNewRecursionContext(_localctx, 
_startState, RULE_terms);
-                                       setState(129);
+                                       setState(131);
                                        if (!(precpred(_ctx, 1))) throw new 
FailedPredicateException(this, "precpred(_ctx, 1)");
-                                       setState(130);
+                                       setState(132);
                                        term();
                                        }
                                        } 
                                }
-                               setState(135);
+                               setState(137);
                                _errHandler.sync(this);
                                _alt = 
getInterpreter().adaptivePredict(_input,11,_ctx);
                        }
@@ -812,7 +812,7 @@ public class NCIntentDslParser extends Parser {
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(136);
+                       setState(138);
                        _la = _input.LA(1);
                        if ( !(_la==TILDA || _la==EQ) ) {
                        _errHandler.recoverInline(this);
@@ -878,31 +878,31 @@ public class NCIntentDslParser extends Parser {
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(138);
-                       match(T__4);
                        setState(140);
+                       match(T__4);
+                       setState(142);
                        _errHandler.sync(this);
                        _la = _input.LA(1);
                        if (_la==LPAREN) {
                                {
-                               setState(139);
+                               setState(141);
                                termId();
                                }
                        }
 
-                       setState(142);
+                       setState(144);
                        termEq();
-                       setState(151);
+                       setState(153);
                        _errHandler.sync(this);
                        switch (_input.LA(1)) {
                        case LCURLY:
                                {
                                {
-                               setState(143);
+                               setState(145);
                                match(LCURLY);
-                               setState(144);
+                               setState(146);
                                termDef(0);
-                               setState(145);
+                               setState(147);
                                match(RCURLY);
                                }
                                }
@@ -910,11 +910,11 @@ public class NCIntentDslParser extends Parser {
                        case FSLASH:
                                {
                                {
-                               setState(147);
+                               setState(149);
                                match(FSLASH);
-                               setState(148);
+                               setState(150);
                                clsNer();
-                               setState(149);
+                               setState(151);
                                match(FSLASH);
                                }
                                }
@@ -922,12 +922,12 @@ public class NCIntentDslParser extends Parser {
                        default:
                                throw new NoViableAltException(this);
                        }
-                       setState(154);
+                       setState(156);
                        _errHandler.sync(this);
                        switch ( 
getInterpreter().adaptivePredict(_input,14,_ctx) ) {
                        case 1:
                                {
-                               setState(153);
+                               setState(155);
                                minMax();
                                }
                                break;
@@ -972,19 +972,19 @@ public class NCIntentDslParser extends Parser {
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(157);
+                       setState(159);
                        _errHandler.sync(this);
                        _la = _input.LA(1);
                        if (_la==ID) {
                                {
-                               setState(156);
+                               setState(158);
                                javaFqn(0);
                                }
                        }
 
-                       setState(159);
+                       setState(161);
                        match(POUND);
-                       setState(160);
+                       setState(162);
                        match(ID);
                        }
                }
@@ -1035,11 +1035,11 @@ public class NCIntentDslParser extends Parser {
                        enterOuterAlt(_localctx, 1);
                        {
                        {
-                       setState(163);
+                       setState(165);
                        match(ID);
                        }
                        _ctx.stop = _input.LT(-1);
-                       setState(170);
+                       setState(172);
                        _errHandler.sync(this);
                        _alt = getInterpreter().adaptivePredict(_input,16,_ctx);
                        while ( _alt!=2 && 
_alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
@@ -1050,16 +1050,16 @@ public class NCIntentDslParser extends Parser {
                                        {
                                        _localctx = new 
JavaFqnContext(_parentctx, _parentState);
                                        pushNewRecursionContext(_localctx, 
_startState, RULE_javaFqn);
-                                       setState(165);
+                                       setState(167);
                                        if (!(precpred(_ctx, 1))) throw new 
FailedPredicateException(this, "precpred(_ctx, 1)");
-                                       setState(166);
+                                       setState(168);
                                        match(DOT);
-                                       setState(167);
+                                       setState(169);
                                        match(ID);
                                        }
                                        } 
                                }
-                               setState(172);
+                               setState(174);
                                _errHandler.sync(this);
                                _alt = 
getInterpreter().adaptivePredict(_input,16,_ctx);
                        }
@@ -1100,11 +1100,11 @@ public class NCIntentDslParser extends Parser {
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(173);
+                       setState(175);
                        match(LPAREN);
-                       setState(174);
+                       setState(176);
                        match(ID);
-                       setState(175);
+                       setState(177);
                        match(RPAREN);
                        }
                }
@@ -1164,36 +1164,36 @@ public class NCIntentDslParser extends Parser {
                        int _alt;
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(185);
+                       setState(187);
                        _errHandler.sync(this);
                        switch ( 
getInterpreter().adaptivePredict(_input,17,_ctx) ) {
                        case 1:
                                {
-                               setState(178);
+                               setState(180);
                                termPred();
                                }
                                break;
                        case 2:
                                {
-                               setState(179);
+                               setState(181);
                                match(LPAREN);
-                               setState(180);
+                               setState(182);
                                termDef(0);
-                               setState(181);
+                               setState(183);
                                match(RPAREN);
                                }
                                break;
                        case 3:
                                {
-                               setState(183);
+                               setState(185);
                                match(EXCL);
-                               setState(184);
+                               setState(186);
                                termDef(1);
                                }
                                break;
                        }
                        _ctx.stop = _input.LT(-1);
-                       setState(192);
+                       setState(194);
                        _errHandler.sync(this);
                        _alt = getInterpreter().adaptivePredict(_input,18,_ctx);
                        while ( _alt!=2 && 
_alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
@@ -1204,9 +1204,9 @@ public class NCIntentDslParser extends Parser {
                                        {
                                        _localctx = new 
TermDefContext(_parentctx, _parentState);
                                        pushNewRecursionContext(_localctx, 
_startState, RULE_termDef);
-                                       setState(187);
+                                       setState(189);
                                        if (!(precpred(_ctx, 2))) throw new 
FailedPredicateException(this, "precpred(_ctx, 2)");
-                                       setState(188);
+                                       setState(190);
                                        _la = _input.LA(1);
                                        if ( !(_la==AND || _la==OR) ) {
                                        _errHandler.recoverInline(this);
@@ -1216,12 +1216,12 @@ public class NCIntentDslParser extends Parser {
                                                _errHandler.reportMatch(this);
                                                consume();
                                        }
-                                       setState(189);
+                                       setState(191);
                                        termDef(3);
                                        }
                                        } 
                                }
-                               setState(194);
+                               setState(196);
                                _errHandler.sync(this);
                                _alt = 
getInterpreter().adaptivePredict(_input,18,_ctx);
                        }
@@ -1266,11 +1266,11 @@ public class NCIntentDslParser extends Parser {
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(195);
+                       setState(197);
                        expr(0);
-                       setState(196);
+                       setState(198);
                        match(PRED_OP);
-                       setState(197);
+                       setState(199);
                        expr(0);
                        }
                }
@@ -1297,11 +1297,14 @@ public class NCIntentDslParser extends Parser {
                        return getRuleContext(ExprContext.class,i);
                }
                public TerminalNode RPAREN() { return 
getToken(NCIntentDslParser.RPAREN, 0); }
-               public TerminalNode ID() { return 
getToken(NCIntentDslParser.ID, 0); }
+               public FunCallContext funCall() {
+                       return getRuleContext(FunCallContext.class,0);
+               }
                public TerminalNode MINUS() { return 
getToken(NCIntentDslParser.MINUS, 0); }
                public TerminalNode PLUS() { return 
getToken(NCIntentDslParser.PLUS, 0); }
                public TerminalNode STAR() { return 
getToken(NCIntentDslParser.STAR, 0); }
                public TerminalNode FSLASH() { return 
getToken(NCIntentDslParser.FSLASH, 0); }
+               public TerminalNode PERCENT() { return 
getToken(NCIntentDslParser.PERCENT, 0); }
                public TerminalNode COMMA() { return 
getToken(NCIntentDslParser.COMMA, 0); }
                public ExprContext(ParserRuleContext parent, int invokingState) 
{
                        super(parent, invokingState);
@@ -1333,7 +1336,7 @@ public class NCIntentDslParser extends Parser {
                        int _alt;
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(211);
+                       setState(208);
                        _errHandler.sync(this);
                        switch (_input.LA(1)) {
                        case SQSTRING:
@@ -1343,64 +1346,50 @@ public class NCIntentDslParser extends Parser {
                        case NULL:
                        case INT:
                                {
-                               setState(200);
+                               setState(202);
                                val();
                                }
                                break;
                        case LPAREN:
                                {
-                               setState(201);
+                               setState(203);
                                match(LPAREN);
-                               setState(202);
+                               setState(204);
                                expr(0);
-                               setState(203);
+                               setState(205);
                                match(RPAREN);
                                }
                                break;
                        case ID:
                                {
-                               setState(205);
-                               match(ID);
-                               setState(206);
-                               match(LPAREN);
-                               setState(208);
-                               _errHandler.sync(this);
-                               _la = _input.LA(1);
-                               if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 
((1L << SQSTRING) | (1L << DQSTRING) | (1L << LPAREN) | (1L << MINUS) | (1L << 
BOOL) | (1L << NULL) | (1L << INT) | (1L << ID))) != 0)) {
-                                       {
-                                       setState(207);
-                                       expr(0);
-                                       }
-                               }
-
-                               setState(210);
-                               match(RPAREN);
+                               setState(207);
+                               funCall();
                                }
                                break;
                        default:
                                throw new NoViableAltException(this);
                        }
                        _ctx.stop = _input.LT(-1);
-                       setState(221);
+                       setState(218);
                        _errHandler.sync(this);
-                       _alt = getInterpreter().adaptivePredict(_input,22,_ctx);
+                       _alt = getInterpreter().adaptivePredict(_input,21,_ctx);
                        while ( _alt!=2 && 
_alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
                                if ( _alt==1 ) {
                                        if ( _parseListeners!=null ) 
triggerExitRuleEvent();
                                        _prevctx = _localctx;
                                        {
-                                       setState(219);
+                                       setState(216);
                                        _errHandler.sync(this);
-                                       switch ( 
getInterpreter().adaptivePredict(_input,21,_ctx) ) {
+                                       switch ( 
getInterpreter().adaptivePredict(_input,20,_ctx) ) {
                                        case 1:
                                                {
                                                _localctx = new 
ExprContext(_parentctx, _parentState);
                                                
pushNewRecursionContext(_localctx, _startState, RULE_expr);
-                                               setState(213);
+                                               setState(210);
                                                if (!(precpred(_ctx, 2))) throw 
new FailedPredicateException(this, "precpred(_ctx, 2)");
-                                               setState(214);
+                                               setState(211);
                                                _la = _input.LA(1);
-                                               if ( !((((_la) & ~0x3f) == 0 && 
((1L << _la) & ((1L << MINUS) | (1L << PLUS) | (1L << STAR) | (1L << FSLASH))) 
!= 0)) ) {
+                                               if ( !((((_la) & ~0x3f) == 0 && 
((1L << _la) & ((1L << MINUS) | (1L << PLUS) | (1L << STAR) | (1L << FSLASH) | 
(1L << PERCENT))) != 0)) ) {
                                                _errHandler.recoverInline(this);
                                                }
                                                else {
@@ -1408,7 +1397,7 @@ public class NCIntentDslParser extends Parser {
                                                        
_errHandler.reportMatch(this);
                                                        consume();
                                                }
-                                               setState(215);
+                                               setState(212);
                                                expr(3);
                                                }
                                                break;
@@ -1416,20 +1405,20 @@ public class NCIntentDslParser extends Parser {
                                                {
                                                _localctx = new 
ExprContext(_parentctx, _parentState);
                                                
pushNewRecursionContext(_localctx, _startState, RULE_expr);
-                                               setState(216);
+                                               setState(213);
                                                if (!(precpred(_ctx, 4))) throw 
new FailedPredicateException(this, "precpred(_ctx, 4)");
-                                               setState(217);
+                                               setState(214);
                                                match(COMMA);
-                                               setState(218);
+                                               setState(215);
                                                val();
                                                }
                                                break;
                                        }
                                        } 
                                }
-                               setState(223);
+                               setState(220);
                                _errHandler.sync(this);
-                               _alt = 
getInterpreter().adaptivePredict(_input,22,_ctx);
+                               _alt = 
getInterpreter().adaptivePredict(_input,21,_ctx);
                        }
                        }
                }
@@ -1444,6 +1433,63 @@ public class NCIntentDslParser extends Parser {
                return _localctx;
        }
 
+       public static class FunCallContext extends ParserRuleContext {
+               public TerminalNode ID() { return 
getToken(NCIntentDslParser.ID, 0); }
+               public TerminalNode LPAREN() { return 
getToken(NCIntentDslParser.LPAREN, 0); }
+               public TerminalNode RPAREN() { return 
getToken(NCIntentDslParser.RPAREN, 0); }
+               public ExprContext expr() {
+                       return getRuleContext(ExprContext.class,0);
+               }
+               public FunCallContext(ParserRuleContext parent, int 
invokingState) {
+                       super(parent, invokingState);
+               }
+               @Override public int getRuleIndex() { return RULE_funCall; }
+               @Override
+               public void enterRule(ParseTreeListener listener) {
+                       if ( listener instanceof NCIntentDslListener ) 
((NCIntentDslListener)listener).enterFunCall(this);
+               }
+               @Override
+               public void exitRule(ParseTreeListener listener) {
+                       if ( listener instanceof NCIntentDslListener ) 
((NCIntentDslListener)listener).exitFunCall(this);
+               }
+       }
+
+       public final FunCallContext funCall() throws RecognitionException {
+               FunCallContext _localctx = new FunCallContext(_ctx, getState());
+               enterRule(_localctx, 36, RULE_funCall);
+               int _la;
+               try {
+                       enterOuterAlt(_localctx, 1);
+                       {
+                       setState(221);
+                       match(ID);
+                       setState(222);
+                       match(LPAREN);
+                       setState(224);
+                       _errHandler.sync(this);
+                       _la = _input.LA(1);
+                       if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 
SQSTRING) | (1L << DQSTRING) | (1L << LPAREN) | (1L << MINUS) | (1L << BOOL) | 
(1L << NULL) | (1L << INT) | (1L << ID))) != 0)) {
+                               {
+                               setState(223);
+                               expr(0);
+                               }
+                       }
+
+                       setState(226);
+                       match(RPAREN);
+                       }
+               }
+               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 TerminalNode NULL() { return 
getToken(NCIntentDslParser.NULL, 0); }
                public TerminalNode INT() { return 
getToken(NCIntentDslParser.INT, 0); }
@@ -1470,16 +1516,16 @@ public class NCIntentDslParser extends Parser {
 
        public final ValContext val() throws RecognitionException {
                ValContext _localctx = new ValContext(_ctx, getState());
-               enterRule(_localctx, 36, RULE_val);
+               enterRule(_localctx, 38, RULE_val);
                int _la;
                try {
-                       setState(237);
+                       setState(241);
                        _errHandler.sync(this);
                        switch (_input.LA(1)) {
                        case NULL:
                                enterOuterAlt(_localctx, 1);
                                {
-                               setState(224);
+                               setState(228);
                                match(NULL);
                                }
                                break;
@@ -1487,34 +1533,34 @@ public class NCIntentDslParser extends Parser {
                        case INT:
                                enterOuterAlt(_localctx, 2);
                                {
-                               setState(226);
+                               setState(230);
                                _errHandler.sync(this);
                                _la = _input.LA(1);
                                if (_la==MINUS) {
                                        {
-                                       setState(225);
+                                       setState(229);
                                        match(MINUS);
                                        }
                                }
 
-                               setState(228);
+                               setState(232);
                                match(INT);
-                               setState(230);
+                               setState(234);
                                _errHandler.sync(this);
                                switch ( 
getInterpreter().adaptivePredict(_input,24,_ctx) ) {
                                case 1:
                                        {
-                                       setState(229);
+                                       setState(233);
                                        match(REAL);
                                        }
                                        break;
                                }
-                               setState(233);
+                               setState(237);
                                _errHandler.sync(this);
                                switch ( 
getInterpreter().adaptivePredict(_input,25,_ctx) ) {
                                case 1:
                                        {
-                                       setState(232);
+                                       setState(236);
                                        match(EXP);
                                        }
                                        break;
@@ -1524,7 +1570,7 @@ public class NCIntentDslParser extends Parser {
                        case BOOL:
                                enterOuterAlt(_localctx, 3);
                                {
-                               setState(235);
+                               setState(239);
                                match(BOOL);
                                }
                                break;
@@ -1532,7 +1578,7 @@ public class NCIntentDslParser extends Parser {
                        case DQSTRING:
                                enterOuterAlt(_localctx, 4);
                                {
-                               setState(236);
+                               setState(240);
                                qstring();
                                }
                                break;
@@ -1570,12 +1616,12 @@ public class NCIntentDslParser extends Parser {
 
        public final QstringContext qstring() throws RecognitionException {
                QstringContext _localctx = new QstringContext(_ctx, getState());
-               enterRule(_localctx, 38, RULE_qstring);
+               enterRule(_localctx, 40, RULE_qstring);
                int _la;
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(239);
+                       setState(243);
                        _la = _input.LA(1);
                        if ( !(_la==SQSTRING || _la==DQSTRING) ) {
                        _errHandler.recoverInline(this);
@@ -1621,9 +1667,9 @@ public class NCIntentDslParser extends Parser {
 
        public final MinMaxContext minMax() throws RecognitionException {
                MinMaxContext _localctx = new MinMaxContext(_ctx, getState());
-               enterRule(_localctx, 40, RULE_minMax);
+               enterRule(_localctx, 42, RULE_minMax);
                try {
-                       setState(243);
+                       setState(247);
                        _errHandler.sync(this);
                        switch (_input.LA(1)) {
                        case PLUS:
@@ -1631,14 +1677,14 @@ public class NCIntentDslParser extends Parser {
                        case STAR:
                                enterOuterAlt(_localctx, 1);
                                {
-                               setState(241);
+                               setState(245);
                                minMaxShortcut();
                                }
                                break;
                        case LBR:
                                enterOuterAlt(_localctx, 2);
                                {
-                               setState(242);
+                               setState(246);
                                minMaxRange();
                                }
                                break;
@@ -1677,12 +1723,12 @@ public class NCIntentDslParser extends Parser {
 
        public final MinMaxShortcutContext minMaxShortcut() throws 
RecognitionException {
                MinMaxShortcutContext _localctx = new 
MinMaxShortcutContext(_ctx, getState());
-               enterRule(_localctx, 42, RULE_minMaxShortcut);
+               enterRule(_localctx, 44, RULE_minMaxShortcut);
                int _la;
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(245);
+                       setState(249);
                        _la = _input.LA(1);
                        if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 
PLUS) | (1L << QUESTION) | (1L << STAR))) != 0)) ) {
                        _errHandler.recoverInline(this);
@@ -1729,19 +1775,19 @@ public class NCIntentDslParser extends Parser {
 
        public final MinMaxRangeContext minMaxRange() throws 
RecognitionException {
                MinMaxRangeContext _localctx = new MinMaxRangeContext(_ctx, 
getState());
-               enterRule(_localctx, 44, RULE_minMaxRange);
+               enterRule(_localctx, 46, RULE_minMaxRange);
                try {
                        enterOuterAlt(_localctx, 1);
                        {
-                       setState(247);
+                       setState(251);
                        match(LBR);
-                       setState(248);
+                       setState(252);
                        match(INT);
-                       setState(249);
+                       setState(253);
                        match(COMMA);
-                       setState(250);
+                       setState(254);
                        match(INT);
-                       setState(251);
+                       setState(255);
                        match(RBR);
                        }
                }
@@ -1801,90 +1847,92 @@ public class NCIntentDslParser extends Parser {
        }
 
        public static final String _serializedATN =
-               
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3.\u0100\4\2\t\2\4"+
+               
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3.\u0104\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\3\2\3\2\5"+
-               
"\2\63\n\2\3\2\5\2\66\n\2\3\2\5\29\n\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\4"+
-               
"\3\4\3\4\3\4\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\7\3\7\3\7\3\7\7\7R\n\7"+
-               
"\f\7\16\7U\13\7\3\7\3\7\3\7\3\7\5\7[\n\7\3\b\3\b\3\b\3\b\3\t\3\t\5\tc"+
-               
"\n\t\3\t\3\t\5\tg\n\t\3\t\5\tj\n\t\3\t\3\t\3\t\3\t\5\tp\n\t\3\n\3\n\3"+
-               
"\n\3\n\7\nv\n\n\f\n\16\ny\13\n\3\n\3\n\3\n\3\n\5\n\177\n\n\3\13\3\13\3"+
-               
"\13\3\13\3\13\7\13\u0086\n\13\f\13\16\13\u0089\13\13\3\f\3\f\3\r\3\r\5"+
-               
"\r\u008f\n\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\5\r\u009a\n\r\3\r\5\r"+
-               
"\u009d\n\r\3\16\5\16\u00a0\n\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\17"+
-               
"\3\17\7\17\u00ab\n\17\f\17\16\17\u00ae\13\17\3\20\3\20\3\20\3\20\3\21"+
-               
"\3\21\3\21\3\21\3\21\3\21\3\21\3\21\5\21\u00bc\n\21\3\21\3\21\3\21\7\21"+
-               
"\u00c1\n\21\f\21\16\21\u00c4\13\21\3\22\3\22\3\22\3\22\3\23\3\23\3\23"+
-               
"\3\23\3\23\3\23\3\23\3\23\3\23\5\23\u00d3\n\23\3\23\5\23\u00d6\n\23\3"+
-               
"\23\3\23\3\23\3\23\3\23\3\23\7\23\u00de\n\23\f\23\16\23\u00e1\13\23\3"+
-               
"\24\3\24\5\24\u00e5\n\24\3\24\3\24\5\24\u00e9\n\24\3\24\5\24\u00ec\n\24"+
-               
"\3\24\3\24\5\24\u00f0\n\24\3\25\3\25\3\26\3\26\5\26\u00f6\n\26\3\27\3"+
-               "\27\3\30\3\30\3\30\3\30\3\30\3\30\3\30\2\6\24\34 
$\31\2\4\6\b\n\f\16\20"+
-               "\22\24\26\30\32\34\36 
\"$&(*,.\2\7\4\2\25\25\37\37\3\2\13\f\5\2\34\34"+
-               "  \"#\3\2\b\t\3\2 
\"\2\u010c\2\60\3\2\2\2\4=\3\2\2\2\6A\3\2\2\2\bE\3\2"+
-               
"\2\2\nI\3\2\2\2\fZ\3\2\2\2\16\\\3\2\2\2\20o\3\2\2\2\22~\3\2\2\2\24\u0080"+
-               
"\3\2\2\2\26\u008a\3\2\2\2\30\u008c\3\2\2\2\32\u009f\3\2\2\2\34\u00a4\3"+
-               "\2\2\2\36\u00af\3\2\2\2 
\u00bb\3\2\2\2\"\u00c5\3\2\2\2$\u00d5\3\2\2\2"+
-               
"&\u00ef\3\2\2\2(\u00f1\3\2\2\2*\u00f5\3\2\2\2,\u00f7\3\2\2\2.\u00f9\3"+
-               
"\2\2\2\60\62\5\4\3\2\61\63\5\6\4\2\62\61\3\2\2\2\62\63\3\2\2\2\63\65\3"+
-               
"\2\2\2\64\66\5\b\5\2\65\64\3\2\2\2\65\66\3\2\2\2\668\3\2\2\2\679\5\n\6"+
-               
"\28\67\3\2\2\289\3\2\2\29:\3\2\2\2:;\5\24\13\2;<\7\2\2\3<\3\3\2\2\2=>"+
-               
"\7\3\2\2>?\7\37\2\2?@\7,\2\2@\5\3\2\2\2AB\7\4\2\2BC\7\37\2\2CD\7\'\2\2"+
-               
"D\7\3\2\2\2EF\7\5\2\2FG\7\37\2\2GH\5(\25\2H\t\3\2\2\2IJ\7\6\2\2JK\7\37"+
-               
"\2\2KL\5\f\7\2L\13\3\2\2\2MN\7\21\2\2NS\5\16\b\2OP\7\32\2\2PR\5\16\b\2"+
-               
"QO\3\2\2\2RU\3\2\2\2SQ\3\2\2\2ST\3\2\2\2TV\3\2\2\2US\3\2\2\2VW\7\22\2"+
-               
"\2W[\3\2\2\2XY\7\21\2\2Y[\7\22\2\2ZM\3\2\2\2ZX\3\2\2\2[\r\3\2\2\2\\]\5"+
-               
"(\25\2]^\7\33\2\2^_\5\20\t\2_\17\3\2\2\2`p\5(\25\2ac\7\34\2\2ba\3\2\2"+
-               
"\2bc\3\2\2\2cd\3\2\2\2df\7)\2\2eg\7*\2\2fe\3\2\2\2fg\3\2\2\2gi\3\2\2\2"+
-               
"hj\7+\2\2ih\3\2\2\2ij\3\2\2\2jp\3\2\2\2kp\5\f\7\2lp\5\22\n\2mp\7\'\2\2"+
-               
"np\7(\2\2o`\3\2\2\2ob\3\2\2\2ok\3\2\2\2ol\3\2\2\2om\3\2\2\2on\3\2\2\2"+
-               
"p\21\3\2\2\2qr\7\27\2\2rw\5\20\t\2st\7\32\2\2tv\5\20\t\2us\3\2\2\2vy\3"+
-               
"\2\2\2wu\3\2\2\2wx\3\2\2\2xz\3\2\2\2yw\3\2\2\2z{\7\30\2\2{\177\3\2\2\2"+
-               
"|}\7\27\2\2}\177\7\30\2\2~q\3\2\2\2~|\3\2\2\2\177\23\3\2\2\2\u0080\u0081"+
-               
"\b\13\1\2\u0081\u0082\5\30\r\2\u0082\u0087\3\2\2\2\u0083\u0084\f\3\2\2"+
-               
"\u0084\u0086\5\30\r\2\u0085\u0083\3\2\2\2\u0086\u0089\3\2\2\2\u0087\u0085"+
-               
"\3\2\2\2\u0087\u0088\3\2\2\2\u0088\25\3\2\2\2\u0089\u0087\3\2\2\2\u008a"+
-               
"\u008b\t\2\2\2\u008b\27\3\2\2\2\u008c\u008e\7\7\2\2\u008d\u008f\5\36\20"+
-               
"\2\u008e\u008d\3\2\2\2\u008e\u008f\3\2\2\2\u008f\u0090\3\2\2\2\u0090\u0099"+
-               "\5\26\f\2\u0091\u0092\7\21\2\2\u0092\u0093\5 
\21\2\u0093\u0094\7\22\2"+
-               
"\2\u0094\u009a\3\2\2\2\u0095\u0096\7#\2\2\u0096\u0097\5\32\16\2\u0097"+
-               
"\u0098\7#\2\2\u0098\u009a\3\2\2\2\u0099\u0091\3\2\2\2\u0099\u0095\3\2"+
-               
"\2\2\u009a\u009c\3\2\2\2\u009b\u009d\5*\26\2\u009c\u009b\3\2\2\2\u009c"+
-               
"\u009d\3\2\2\2\u009d\31\3\2\2\2\u009e\u00a0\5\34\17\2\u009f\u009e\3\2"+
-               
"\2\2\u009f\u00a0\3\2\2\2\u00a0\u00a1\3\2\2\2\u00a1\u00a2\7\31\2\2\u00a2"+
-               
"\u00a3\7,\2\2\u00a3\33\3\2\2\2\u00a4\u00a5\b\17\1\2\u00a5\u00a6\7,\2\2"+
-               
"\u00a6\u00ac\3\2\2\2\u00a7\u00a8\f\3\2\2\u00a8\u00a9\7\35\2\2\u00a9\u00ab"+
-               
"\7,\2\2\u00aa\u00a7\3\2\2\2\u00ab\u00ae\3\2\2\2\u00ac\u00aa\3\2\2\2\u00ac"+
-               
"\u00ad\3\2\2\2\u00ad\35\3\2\2\2\u00ae\u00ac\3\2\2\2\u00af\u00b0\7\17\2"+
-               
"\2\u00b0\u00b1\7,\2\2\u00b1\u00b2\7\20\2\2\u00b2\37\3\2\2\2\u00b3\u00b4"+
-               
"\b\21\1\2\u00b4\u00bc\5\"\22\2\u00b5\u00b6\7\17\2\2\u00b6\u00b7\5 \21"+
-               
"\2\u00b7\u00b8\7\20\2\2\u00b8\u00bc\3\2\2\2\u00b9\u00ba\7\16\2\2\u00ba"+
-               "\u00bc\5 
\21\3\u00bb\u00b3\3\2\2\2\u00bb\u00b5\3\2\2\2\u00bb\u00b9\3\2"+
-               
"\2\2\u00bc\u00c2\3\2\2\2\u00bd\u00be\f\4\2\2\u00be\u00bf\t\3\2\2\u00bf"+
-               "\u00c1\5 
\21\5\u00c0\u00bd\3\2\2\2\u00c1\u00c4\3\2\2\2\u00c2\u00c0\3\2"+
-               
"\2\2\u00c2\u00c3\3\2\2\2\u00c3!\3\2\2\2\u00c4\u00c2\3\2\2\2\u00c5\u00c6"+
-               
"\5$\23\2\u00c6\u00c7\7\n\2\2\u00c7\u00c8\5$\23\2\u00c8#\3\2\2\2\u00c9"+
-               
"\u00ca\b\23\1\2\u00ca\u00d6\5&\24\2\u00cb\u00cc\7\17\2\2\u00cc\u00cd\5"+
-               
"$\23\2\u00cd\u00ce\7\20\2\2\u00ce\u00d6\3\2\2\2\u00cf\u00d0\7,\2\2\u00d0"+
-               
"\u00d2\7\17\2\2\u00d1\u00d3\5$\23\2\u00d2\u00d1\3\2\2\2\u00d2\u00d3\3"+
-               
"\2\2\2\u00d3\u00d4\3\2\2\2\u00d4\u00d6\7\20\2\2\u00d5\u00c9\3\2\2\2\u00d5"+
-               
"\u00cb\3\2\2\2\u00d5\u00cf\3\2\2\2\u00d6\u00df\3\2\2\2\u00d7\u00d8\f\4"+
-               
"\2\2\u00d8\u00d9\t\4\2\2\u00d9\u00de\5$\23\5\u00da\u00db\f\6\2\2\u00db"+
-               
"\u00dc\7\32\2\2\u00dc\u00de\5&\24\2\u00dd\u00d7\3\2\2\2\u00dd\u00da\3"+
-               
"\2\2\2\u00de\u00e1\3\2\2\2\u00df\u00dd\3\2\2\2\u00df\u00e0\3\2\2\2\u00e0"+
-               
"%\3\2\2\2\u00e1\u00df\3\2\2\2\u00e2\u00f0\7(\2\2\u00e3\u00e5\7\34\2\2"+
-               
"\u00e4\u00e3\3\2\2\2\u00e4\u00e5\3\2\2\2\u00e5\u00e6\3\2\2\2\u00e6\u00e8"+
-               
"\7)\2\2\u00e7\u00e9\7*\2\2\u00e8\u00e7\3\2\2\2\u00e8\u00e9\3\2\2\2\u00e9"+
-               
"\u00eb\3\2\2\2\u00ea\u00ec\7+\2\2\u00eb\u00ea\3\2\2\2\u00eb\u00ec\3\2"+
-               
"\2\2\u00ec\u00f0\3\2\2\2\u00ed\u00f0\7\'\2\2\u00ee\u00f0\5(\25\2\u00ef"+
-               
"\u00e2\3\2\2\2\u00ef\u00e4\3\2\2\2\u00ef\u00ed\3\2\2\2\u00ef\u00ee\3\2"+
-               
"\2\2\u00f0\'\3\2\2\2\u00f1\u00f2\t\5\2\2\u00f2)\3\2\2\2\u00f3\u00f6\5"+
-               
",\27\2\u00f4\u00f6\5.\30\2\u00f5\u00f3\3\2\2\2\u00f5\u00f4\3\2\2\2\u00f6"+
-               
"+\3\2\2\2\u00f7\u00f8\t\6\2\2\u00f8-\3\2\2\2\u00f9\u00fa\7\27\2\2\u00fa"+
-               
"\u00fb\7)\2\2\u00fb\u00fc\7\32\2\2\u00fc\u00fd\7)\2\2\u00fd\u00fe\7\30"+
-               
"\2\2\u00fe/\3\2\2\2\36\62\658SZbfiow~\u0087\u008e\u0099\u009c\u009f\u00ac"+
-               
"\u00bb\u00c2\u00d2\u00d5\u00dd\u00df\u00e4\u00e8\u00eb\u00ef\u00f5";
+               
"\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"+
+               
"\3\2\3\2\5\2\65\n\2\3\2\5\28\n\2\3\2\5\2;\n\2\3\2\3\2\3\2\3\3\3\3\3\3"+
+               
"\3\3\3\4\3\4\3\4\3\4\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\7\3\7\3\7\3\7\7"+
+               
"\7T\n\7\f\7\16\7W\13\7\3\7\3\7\3\7\3\7\5\7]\n\7\3\b\3\b\3\b\3\b\3\t\3"+
+               
"\t\5\te\n\t\3\t\3\t\5\ti\n\t\3\t\5\tl\n\t\3\t\3\t\3\t\3\t\5\tr\n\t\3\n"+
+               
"\3\n\3\n\3\n\7\nx\n\n\f\n\16\n{\13\n\3\n\3\n\3\n\3\n\5\n\u0081\n\n\3\13"+
+               
"\3\13\3\13\3\13\3\13\7\13\u0088\n\13\f\13\16\13\u008b\13\13\3\f\3\f\3"+
+               
"\r\3\r\5\r\u0091\n\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\5\r\u009c\n\r"+
+               
"\3\r\5\r\u009f\n\r\3\16\5\16\u00a2\n\16\3\16\3\16\3\16\3\17\3\17\3\17"+
+               
"\3\17\3\17\3\17\7\17\u00ad\n\17\f\17\16\17\u00b0\13\17\3\20\3\20\3\20"+
+               
"\3\20\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\5\21\u00be\n\21\3\21\3\21"+
+               
"\3\21\7\21\u00c3\n\21\f\21\16\21\u00c6\13\21\3\22\3\22\3\22\3\22\3\23"+
+               
"\3\23\3\23\3\23\3\23\3\23\3\23\5\23\u00d3\n\23\3\23\3\23\3\23\3\23\3\23"+
+               
"\3\23\7\23\u00db\n\23\f\23\16\23\u00de\13\23\3\24\3\24\3\24\5\24\u00e3"+
+               
"\n\24\3\24\3\24\3\25\3\25\5\25\u00e9\n\25\3\25\3\25\5\25\u00ed\n\25\3"+
+               
"\25\5\25\u00f0\n\25\3\25\3\25\5\25\u00f4\n\25\3\26\3\26\3\27\3\27\5\27"+
+               
"\u00fa\n\27\3\30\3\30\3\31\3\31\3\31\3\31\3\31\3\31\3\31\2\6\24\34 $\32"+
+               "\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 
\"$&(*,.\60\2\7\4\2\25\25\37\37"+
+               "\3\2\13\f\5\2\34\34  \"$\3\2\b\t\3\2 
\"\2\u010f\2\62\3\2\2\2\4?\3\2\2"+
+               
"\2\6C\3\2\2\2\bG\3\2\2\2\nK\3\2\2\2\f\\\3\2\2\2\16^\3\2\2\2\20q\3\2\2"+
+               
"\2\22\u0080\3\2\2\2\24\u0082\3\2\2\2\26\u008c\3\2\2\2\30\u008e\3\2\2\2"+
+               "\32\u00a1\3\2\2\2\34\u00a6\3\2\2\2\36\u00b1\3\2\2\2 
\u00bd\3\2\2\2\"\u00c7"+
+               
"\3\2\2\2$\u00d2\3\2\2\2&\u00df\3\2\2\2(\u00f3\3\2\2\2*\u00f5\3\2\2\2,"+
+               
"\u00f9\3\2\2\2.\u00fb\3\2\2\2\60\u00fd\3\2\2\2\62\64\5\4\3\2\63\65\5\6"+
+               
"\4\2\64\63\3\2\2\2\64\65\3\2\2\2\65\67\3\2\2\2\668\5\b\5\2\67\66\3\2\2"+
+               
"\2\678\3\2\2\28:\3\2\2\29;\5\n\6\2:9\3\2\2\2:;\3\2\2\2;<\3\2\2\2<=\5\24"+
+               
"\13\2=>\7\2\2\3>\3\3\2\2\2?@\7\3\2\2@A\7\37\2\2AB\7,\2\2B\5\3\2\2\2CD"+
+               
"\7\4\2\2DE\7\37\2\2EF\7\'\2\2F\7\3\2\2\2GH\7\5\2\2HI\7\37\2\2IJ\5*\26"+
+               
"\2J\t\3\2\2\2KL\7\6\2\2LM\7\37\2\2MN\5\f\7\2N\13\3\2\2\2OP\7\21\2\2PU"+
+               
"\5\16\b\2QR\7\32\2\2RT\5\16\b\2SQ\3\2\2\2TW\3\2\2\2US\3\2\2\2UV\3\2\2"+
+               
"\2VX\3\2\2\2WU\3\2\2\2XY\7\22\2\2Y]\3\2\2\2Z[\7\21\2\2[]\7\22\2\2\\O\3"+
+               
"\2\2\2\\Z\3\2\2\2]\r\3\2\2\2^_\5*\26\2_`\7\33\2\2`a\5\20\t\2a\17\3\2\2"+
+               
"\2br\5*\26\2ce\7\34\2\2dc\3\2\2\2de\3\2\2\2ef\3\2\2\2fh\7)\2\2gi\7*\2"+
+               
"\2hg\3\2\2\2hi\3\2\2\2ik\3\2\2\2jl\7+\2\2kj\3\2\2\2kl\3\2\2\2lr\3\2\2"+
+               
"\2mr\5\f\7\2nr\5\22\n\2or\7\'\2\2pr\7(\2\2qb\3\2\2\2qd\3\2\2\2qm\3\2\2"+
+               
"\2qn\3\2\2\2qo\3\2\2\2qp\3\2\2\2r\21\3\2\2\2st\7\27\2\2ty\5\20\t\2uv\7"+
+               
"\32\2\2vx\5\20\t\2wu\3\2\2\2x{\3\2\2\2yw\3\2\2\2yz\3\2\2\2z|\3\2\2\2{"+
+               
"y\3\2\2\2|}\7\30\2\2}\u0081\3\2\2\2~\177\7\27\2\2\177\u0081\7\30\2\2\u0080"+
+               
"s\3\2\2\2\u0080~\3\2\2\2\u0081\23\3\2\2\2\u0082\u0083\b\13\1\2\u0083\u0084"+
+               
"\5\30\r\2\u0084\u0089\3\2\2\2\u0085\u0086\f\3\2\2\u0086\u0088\5\30\r\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\25\3\2\2\2\u008b\u0089\3\2\2\2\u008c\u008d\t\2\2\2\u008d"+
+               
"\27\3\2\2\2\u008e\u0090\7\7\2\2\u008f\u0091\5\36\20\2\u0090\u008f\3\2"+
+               
"\2\2\u0090\u0091\3\2\2\2\u0091\u0092\3\2\2\2\u0092\u009b\5\26\f\2\u0093"+
+               "\u0094\7\21\2\2\u0094\u0095\5 
\21\2\u0095\u0096\7\22\2\2\u0096\u009c\3"+
+               
"\2\2\2\u0097\u0098\7#\2\2\u0098\u0099\5\32\16\2\u0099\u009a\7#\2\2\u009a"+
+               
"\u009c\3\2\2\2\u009b\u0093\3\2\2\2\u009b\u0097\3\2\2\2\u009c\u009e\3\2"+
+               
"\2\2\u009d\u009f\5,\27\2\u009e\u009d\3\2\2\2\u009e\u009f\3\2\2\2\u009f"+
+               
"\31\3\2\2\2\u00a0\u00a2\5\34\17\2\u00a1\u00a0\3\2\2\2\u00a1\u00a2\3\2"+
+               
"\2\2\u00a2\u00a3\3\2\2\2\u00a3\u00a4\7\31\2\2\u00a4\u00a5\7,\2\2\u00a5"+
+               
"\33\3\2\2\2\u00a6\u00a7\b\17\1\2\u00a7\u00a8\7,\2\2\u00a8\u00ae\3\2\2"+
+               
"\2\u00a9\u00aa\f\3\2\2\u00aa\u00ab\7\35\2\2\u00ab\u00ad\7,\2\2\u00ac\u00a9"+
+               
"\3\2\2\2\u00ad\u00b0\3\2\2\2\u00ae\u00ac\3\2\2\2\u00ae\u00af\3\2\2\2\u00af"+
+               
"\35\3\2\2\2\u00b0\u00ae\3\2\2\2\u00b1\u00b2\7\17\2\2\u00b2\u00b3\7,\2"+
+               
"\2\u00b3\u00b4\7\20\2\2\u00b4\37\3\2\2\2\u00b5\u00b6\b\21\1\2\u00b6\u00be"+
+               "\5\"\22\2\u00b7\u00b8\7\17\2\2\u00b8\u00b9\5 
\21\2\u00b9\u00ba\7\20\2"+
+               "\2\u00ba\u00be\3\2\2\2\u00bb\u00bc\7\16\2\2\u00bc\u00be\5 
\21\3\u00bd"+
+               
"\u00b5\3\2\2\2\u00bd\u00b7\3\2\2\2\u00bd\u00bb\3\2\2\2\u00be\u00c4\3\2"+
+               "\2\2\u00bf\u00c0\f\4\2\2\u00c0\u00c1\t\3\2\2\u00c1\u00c3\5 
\21\5\u00c2"+
+               
"\u00bf\3\2\2\2\u00c3\u00c6\3\2\2\2\u00c4\u00c2\3\2\2\2\u00c4\u00c5\3\2"+
+               
"\2\2\u00c5!\3\2\2\2\u00c6\u00c4\3\2\2\2\u00c7\u00c8\5$\23\2\u00c8\u00c9"+
+               
"\7\n\2\2\u00c9\u00ca\5$\23\2\u00ca#\3\2\2\2\u00cb\u00cc\b\23\1\2\u00cc"+
+               
"\u00d3\5(\25\2\u00cd\u00ce\7\17\2\2\u00ce\u00cf\5$\23\2\u00cf\u00d0\7"+
+               
"\20\2\2\u00d0\u00d3\3\2\2\2\u00d1\u00d3\5&\24\2\u00d2\u00cb\3\2\2\2\u00d2"+
+               
"\u00cd\3\2\2\2\u00d2\u00d1\3\2\2\2\u00d3\u00dc\3\2\2\2\u00d4\u00d5\f\4"+
+               
"\2\2\u00d5\u00d6\t\4\2\2\u00d6\u00db\5$\23\5\u00d7\u00d8\f\6\2\2\u00d8"+
+               
"\u00d9\7\32\2\2\u00d9\u00db\5(\25\2\u00da\u00d4\3\2\2\2\u00da\u00d7\3"+
+               
"\2\2\2\u00db\u00de\3\2\2\2\u00dc\u00da\3\2\2\2\u00dc\u00dd\3\2\2\2\u00dd"+
+               
"%\3\2\2\2\u00de\u00dc\3\2\2\2\u00df\u00e0\7,\2\2\u00e0\u00e2\7\17\2\2"+
+               
"\u00e1\u00e3\5$\23\2\u00e2\u00e1\3\2\2\2\u00e2\u00e3\3\2\2\2\u00e3\u00e4"+
+               
"\3\2\2\2\u00e4\u00e5\7\20\2\2\u00e5\'\3\2\2\2\u00e6\u00f4\7(\2\2\u00e7"+
+               
"\u00e9\7\34\2\2\u00e8\u00e7\3\2\2\2\u00e8\u00e9\3\2\2\2\u00e9\u00ea\3"+
+               
"\2\2\2\u00ea\u00ec\7)\2\2\u00eb\u00ed\7*\2\2\u00ec\u00eb\3\2\2\2\u00ec"+
+               
"\u00ed\3\2\2\2\u00ed\u00ef\3\2\2\2\u00ee\u00f0\7+\2\2\u00ef\u00ee\3\2"+
+               
"\2\2\u00ef\u00f0\3\2\2\2\u00f0\u00f4\3\2\2\2\u00f1\u00f4\7\'\2\2\u00f2"+
+               
"\u00f4\5*\26\2\u00f3\u00e6\3\2\2\2\u00f3\u00e8\3\2\2\2\u00f3\u00f1\3\2"+
+               
"\2\2\u00f3\u00f2\3\2\2\2\u00f4)\3\2\2\2\u00f5\u00f6\t\5\2\2\u00f6+\3\2"+
+               
"\2\2\u00f7\u00fa\5.\30\2\u00f8\u00fa\5\60\31\2\u00f9\u00f7\3\2\2\2\u00f9"+
+               
"\u00f8\3\2\2\2\u00fa-\3\2\2\2\u00fb\u00fc\t\6\2\2\u00fc/\3\2\2\2\u00fd"+
+               
"\u00fe\7\27\2\2\u00fe\u00ff\7)\2\2\u00ff\u0100\7\32\2\2\u0100\u0101\7"+
+               
")\2\2\u0101\u0102\7\30\2\2\u0102\61\3\2\2\2\36\64\67:U\\dhkqy\u0080\u0089"+
+               
"\u0090\u009b\u009e\u00a1\u00ae\u00bd\u00c4\u00d2\u00da\u00dc\u00e2\u00e8"+
+               "\u00ec\u00ef\u00f3\u00f9";
        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/NCIntentDslCompiler.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/ver2/NCIntentDslCompiler.scala
index d965800..4edae92 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
@@ -80,6 +80,7 @@ object NCIntentDslCompiler extends LazyLogging {
                 assert(false)
         }
 
+        //noinspection TypeCheckCanBeMatch
         override def exitExpr(ctx: NCIntentDslParser.ExprContext): Unit = {
             if (ctx.`val`() != null) {} // Just a val - no-op.
             else if (ctx.LPAREN() != null && ctx.RPAREN() != null) {} // Just 
a val in brackets - no-op.
@@ -90,19 +91,102 @@ object NCIntentDslCompiler extends LazyLogging {
                     val NCDslTermRetVal(lastVal, usedTok) = stack.pop()
 
                     val newVal = lastVal match {
-                        case list: List[Any] ⇒ mkVal(ctx.`val`().getText) :: 
list
+                        case list: List[_] ⇒ mkVal(ctx.`val`().getText) :: list
                         case _ ⇒ List(lastVal)
                     }
 
                     stack.push(NCDslTermRetVal(newVal, usedTok))
                 })
             }
-            else if (ctx.MINUS() != null || ctx.PLUS() != null || ctx.STAR() 
!= null || ctx.FSLASH() != null) {
+            else if (ctx.MINUS() != null || ctx.PLUS() != null || ctx.STAR() 
!= null || ctx.FSLASH() != null || ctx.PERCENT() != null) {
                 termCode += ((_, stack: StackType, _) ⇒ {
                     require(stack.size >= 2)
 
-                    val NCDslTermRetVal(lastVal1, usedTok1) = stack.pop()
-                    val NCDslTermRetVal(lastVal2, usedTok2) = stack.pop()
+                    // Stack pop in reverse order of push...
+                    val NCDslTermRetVal(val2, usedTok2) = stack.pop()
+                    val NCDslTermRetVal(val1, usedTok1) = stack.pop()
+                    
+                    def push(any: Any): Unit = stack.push(NCDslTermRetVal(any, 
usedTok1 || usedTok2))
+                    def isLong(v: Any): Boolean = 
v.isInstanceOf[java.lang.Long]
+                    def isDouble(v: Any): Boolean = 
v.isInstanceOf[java.lang.Double]
+                    def isString(v: Any): Boolean = v.isInstanceOf[String]
+                    def asLong(v: Any): java.lang.Long = 
v.asInstanceOf[java.lang.Long]
+                    def asDouble(v: Any): java.lang.Double = 
v.asInstanceOf[java.lang.Double]
+                    def asString(v: Any): String = v.asInstanceOf[String]
+                    def asList(v: Any): List[_] = v.asInstanceOf[List[_]]
+                    def isList(v: Any): Boolean = v.isInstanceOf[List[_]]
+                    
+                    def error(op: String): Unit =
+                        throw new IllegalArgumentException(s"Unexpected '$op' 
operation for values: $val1, $val2")
+                    
+                    if (ctx.PLUS() != null) { // '+'.
+                        if (isList(val1) && isList(val2))
+                            push(asList(val1) ::: asList(val2))
+                        else if (isList(val1))
+                            push(val2 :: asList(val1))
+                        else if (isList(val2)) 
+                            push(val1 :: asList(val2))
+                        else if (isString(val1) && isString(val2))
+                            push(asString(val1) + asString(val2))
+                        else if (isLong(val1) && isLong(val2))
+                            push(asLong(val1).longValue() + 
asLong(val2).longValue())
+                        else if (isLong(val1) && isDouble(val2))
+                            push(asLong(val1).longValue() + 
asDouble(val2).doubleValue())
+                        else if (isDouble(val1) && isLong(val2))
+                            push(asDouble(val1).doubleValue() + 
asLong(val2).longValue())
+                        else if (isDouble(val1) && isDouble(val2))
+                            push(asDouble(val1).doubleValue() + 
asDouble(val2).doubleValue())
+                        else
+                            error("+")
+                    }
+                    else if (ctx.MINUS() != null) { // '-'.
+                        if (isList(val1) && isList(val2))
+                            
push(asList(val1).filterNot(asInstanceOf[List[_]].toSet))
+                        else if (isList(val1))
+                            push(asList(val1).filter(_ != val1))
+                        else if (isLong(val1) && isLong(val2))
+                            push(asLong(val1).longValue() - 
asLong(val2).longValue())
+                        else if (isLong(val1) && isDouble(val2))
+                            push(asLong(val1).longValue() - 
asDouble(val2).doubleValue())
+                        else if (isDouble(val1) && isLong(val2))
+                            push(asDouble(val1).doubleValue() - 
asLong(val2).longValue())
+                        else if (isDouble(val1) && isDouble(val2))
+                            push(asDouble(val1).doubleValue() - 
asDouble(val2).doubleValue())
+                        else
+                            error("-")
+                    }
+                    else if (ctx.STAR() != null) { // '*'.
+                        if (isLong(val1) && isLong(val2))
+                            push(asLong(val1).longValue() * 
asLong(val2).longValue())
+                        else if (isLong(val1) && isDouble(val2))
+                            push(asLong(val1).longValue() * 
asDouble(val2).doubleValue())
+                        else if (isDouble(val1) && isLong(val2))
+                            push(asDouble(val1).doubleValue() * 
asLong(val2).longValue())
+                        else if (isDouble(val1) && isDouble(val2))
+                            push(asDouble(val1).doubleValue() * 
asDouble(val2).doubleValue())
+                        else
+                            error("*")
+                    }
+                    else if (ctx.FSLASH() != null) { // '/'.
+                        if (isLong(val1) && isLong(val2))
+                            push(asLong(val1).longValue() / 
asLong(val2).longValue())
+                        else if (isLong(val1) && isDouble(val2))
+                            push(asLong(val1).longValue() / 
asDouble(val2).doubleValue())
+                        else if (isDouble(val1) && isLong(val2))
+                            push(asDouble(val1).doubleValue() / 
asLong(val2).longValue())
+                        else if (isDouble(val1) && isDouble(val2))
+                            push(asDouble(val1).doubleValue() / 
asDouble(val2).doubleValue())
+                        else
+                            error("/")
+                    }
+                    else if (ctx.PERCENT() != null) { // '%'.
+                        if (isLong(val1) && isLong(val2))
+                            push(asLong(val1).longValue() % 
asLong(val2).longValue())
+                        else
+                            error("%")
+                    }
+                    else
+                        assert(false)
                 })
             }
         }
@@ -157,24 +241,19 @@ object NCIntentDslCompiler extends LazyLogging {
             if (s == "null") null // Try 'null'.
             else if (s == "true") true // Try 'boolean'.
             else if (s == "false") false // Try 'boolean'.
-            // Only numeric values below...
+            // Only numeric or string values below...
             else {
                 // Strip '_' from numeric values.
                 val num = s.replaceAll("_", "")
 
                 try
-                    java.lang.Integer.parseInt(num) // Try 'int'.
+                    java.lang.Long.parseLong(num) // Try 'long'.
                 catch {
                     case _: NumberFormatException ⇒
                         try
-                            java.lang.Long.parseLong(num) // Try 'long'.
+                            java.lang.Double.parseDouble(num) // Try 'double'.
                         catch {
-                            case _: NumberFormatException ⇒
-                                try
-                                    java.lang.Double.parseDouble(num) // Try 
'double'.
-                                catch {
-                                    case _: NumberFormatException ⇒ s // 
String by default (incl. quotes).
-                                }
+                            case _: NumberFormatException ⇒ s // String by 
default (incl. quotes).
                         }
                 }
             }

Reply via email to