26 #ifndef NVNEURAL_SCRIPTENGINELEXYN_H
27 #define NVNEURAL_SCRIPTENGINELEXYN_H
53 TypeCode type = FATAL_ERROR;
57 std::vector<Lexem> lexParser(
const std::string& text,
bool debugScript =
false);
69 SynParser& addLiteral(
const std::string& name,
const std::string& value,
bool skip =
false);
70 SynParser& addTypedLiteral(
const std::string& name, Lexem::TypeCode type,
bool skip =
false);
71 SynParser& addGrammar(
const std::string& name,
const std::string& value,
bool root =
false,
bool unskippable =
false);
76 std::vector<Node> child;
77 std::string print(
const std::string& tab =
"");
80 Node parse(std::vector<Lexem>& lexems, std::string root =
"");
84 std::string m_rootName;
85 std::set<std::string> m_skippableLiterals;
86 std::set<std::string> m_unskippableGrammars;
87 std::map<std::string, std::string> m_literals;
88 std::map<std::string, Lexem::TypeCode> m_literalsTyped;
89 std::map<std::string, std::string> m_grammars;
90 std::map<std::string, std::vector<Lexem>> m_grammarsParsed;
92 Node parseRecursive(
const std::string& g, std::vector<Lexem>& lexems,
size_t& off);
110 TypeCode type = FATAL_ERROR;
113 std::vector<SyntaxTreeNode> params;
116 SyntaxTreeNode syntaxParserPower(std::vector<Lexem>& lexems,
size_t& off);
117 SyntaxTreeNode syntaxParserMulDiv(std::vector<Lexem>& lexems,
size_t& off);
118 SyntaxTreeNode syntaxParserAddSub(std::vector<Lexem>& lexems,
size_t& off);
119 SyntaxTreeNode syntaxParserOperand(std::vector<Lexem>& lexems,
size_t& off);
120 SyntaxTreeNode syntaxParserBlock(std::vector<Lexem>& lexems,
size_t& off);
121 SyntaxTreeNode syntaxParser(std::vector<Lexem>& lexems,
bool call, SyntaxTreeNode* pBlockParams =
nullptr,
size_t* pCallOffset =
nullptr);
123 SyntaxTreeNode syntaxMixFormula(std::vector<Lexem>& lexems);