You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2022/02/01 01:04:37 UTC
[incubator-nlpcraft] 01/02: Update NCCompilerUtils.scala
This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
commit 61e6d16bf0f66559f76677bf3d6a5eda624e3c84
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Mon Jan 31 16:17:02 2022 -0800
Update NCCompilerUtils.scala
---
.../scala/org/apache/nlpcraft/internal/antlr4/NCCompilerUtils.scala | 2 ++
1 file changed, 2 insertions(+)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/antlr4/NCCompilerUtils.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/antlr4/NCCompilerUtils.scala
index 540bd0f..f4963be 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/antlr4/NCCompilerUtils.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/antlr4/NCCompilerUtils.scala
@@ -32,6 +32,8 @@ object NCCompilerUtils:
* @return
*/
def mkErrorHolder(in: String, charPos: Int): CompilerErrorHolder =
+ require(charPos >= 0)
+
val charPos0 = charPos - (in.length - in.stripLeading().length)
val in0 = in.strip()
val pos = Math.max(0, charPos0)