def parseAtom()

in nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/compiler/NCIDLCodeGenerator.scala [448:465]


    def parseAtom(txt: String)(implicit ctx: PRC): SI = {
        val atom =
            if txt == "null" then null // Try 'null'.
            else if txt == "true" then Boolean.box(true) // Try 'boolean'.
            else if txt == "false" then Boolean.box(false) // Try 'boolean'.
            // Only numeric or string values below...
            else
                // Strip '_' from numeric values.
                val num = txt.replaceAll("_", "")

                try Long.box(JLong.parseLong(num)) // Try 'long'.
                catch case _: NumberFormatException =>
                    try Double.box(JDouble.parseDouble(num)) // Try 'double'.
                    catch case _: NumberFormatException => NCUtils.escapesQuotes(txt) // String in the end.


        (_, stack, _) => stack.push(() => Z(atom, 0))
    }