From 5c1b392a7074d64f94e7e9af6187e9a2faf1c34d Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Sun, 7 May 2023 00:16:45 +0300 Subject: [PATCH 01/12] [memory][scs] Implement AST Json parser listener --- sc-memory/sc-memory/CMakeLists.txt | 2 + sc-memory/sc-memory/scs/ASTJsonListener.cpp | 158 ++++++++++++++++++++ sc-memory/sc-memory/scs/ASTJsonListener.hpp | 96 ++++++++++++ sc-memory/sc-memory/scs/scs_parser.cpp | 40 +++++ sc-memory/sc-memory/scs/scs_parser.hpp | 1 + 5 files changed, 297 insertions(+) create mode 100644 sc-memory/sc-memory/scs/ASTJsonListener.cpp create mode 100644 sc-memory/sc-memory/scs/ASTJsonListener.hpp diff --git a/sc-memory/sc-memory/CMakeLists.txt b/sc-memory/sc-memory/CMakeLists.txt index 1096face96..f576ca5f18 100644 --- a/sc-memory/sc-memory/CMakeLists.txt +++ b/sc-memory/sc-memory/CMakeLists.txt @@ -19,6 +19,8 @@ set(SOURCES_PARSER "${CMAKE_CURRENT_LIST_DIR}/scs/scsLexer.h" "${CMAKE_CURRENT_LIST_DIR}/scs/scsParser.cpp" "${CMAKE_CURRENT_LIST_DIR}/scs/scsParser.h" + "${CMAKE_CURRENT_LIST_DIR}/scs/ASTJsonListener.cpp" + "${CMAKE_CURRENT_LIST_DIR}/scs/ASTJsonListener.hpp" ) file(GLOB_RECURSE SOURCES "*.cpp" "*.hpp") diff --git a/sc-memory/sc-memory/scs/ASTJsonListener.cpp b/sc-memory/sc-memory/scs/ASTJsonListener.cpp new file mode 100644 index 0000000000..753484172d --- /dev/null +++ b/sc-memory/sc-memory/scs/ASTJsonListener.cpp @@ -0,0 +1,158 @@ +#include "ASTJsonListener.hpp" + +using namespace scs; + +void ASTErrorListener::syntaxError( + antlr4::Recognizer *, + antlr4::Token * token, + size_t line, + size_t charPositionInLine, + std::string const & msg, + std::exception_ptr) +{ + ScJson errorInfoJson; + errorInfoJson["token"] = token ? token->getText() : "Invalid token"; + errorInfoJson["line"] = line; + errorInfoJson["charPositionInLine"] = charPositionInLine; + errorInfoJson["msg"] = msg; + + m_errors.push_back(errorInfoJson); +} + +void ASTErrorListener::reportAmbiguity( + antlr4::Parser *, + antlr4::dfa::DFA const & dfa, + size_t startIndex, + size_t stopIndex, + bool, + antlrcpp::BitSet const &, + antlr4::atn::ATNConfigSet *) +{ + ScJson errorInfoJson; + errorInfoJson["msg"] = "reportAmbiguity"; + + m_errors.push_back(errorInfoJson); +} + +void ASTErrorListener::reportAttemptingFullContext( + antlr4::Parser *, + antlr4::dfa::DFA const &, + size_t, + size_t, + antlrcpp::BitSet const &, + antlr4::atn::ATNConfigSet *) +{ + ScJson errorInfoJson; + errorInfoJson["msg"] = "reportAttemptingFullContext"; + + m_errors.push_back(errorInfoJson); +} + +void ASTErrorListener::reportContextSensitivity( + antlr4::Parser *, + antlr4::dfa::DFA const &, + size_t, + size_t, + size_t, + antlr4::atn::ATNConfigSet *) +{ + ScJson errorInfoJson; + errorInfoJson["msg"] = "reportContextSensitivity"; + + m_errors.push_back(errorInfoJson); +} + +void ASTJsonListener::buildTokenStartInfo(antlr4::ParserRuleContext * ctx, ScJson & nodeInfo) +{ + ScJson positionJson; + positionJson["beginLine"] = ctx->getStart()->getLine(); + positionJson["beginIndex"] = ctx->getStart()->getTokenIndex(); + + nodeInfo["ruleType"] = m_ruleNames[ctx->getRuleIndex()]; + nodeInfo["position"] = positionJson; + nodeInfo["children"] = ScJson::array(); +} + +void ASTJsonListener::buildTokenStopInfo(antlr4::ParserRuleContext * ctx, ScJson & nodeInfo) +{ + if (ctx->getStop() == nullptr) + return; + + nodeInfo["position"]["endLine"] = ctx->getStop()->getLine(); + nodeInfo["position"]["endIndex"] = ctx->getStop()->getTokenIndex(); +} + +void ASTJsonListener::enterEveryRule(antlr4::ParserRuleContext * ctx) +{ + auto * node = new ASTNode(); + + if (m_ast == nullptr) + { + m_currentNode = node; + m_ast = node; + m_currentNode->parentNode = nullptr; + } + else + { + m_currentNode->children.insert(node); + m_parentNode = m_currentNode; + m_currentNode = node; + m_currentNode->parentNode = m_parentNode; + } + + buildTokenStartInfo(ctx, m_currentNode->info); +} + +void ASTJsonListener::exitEveryRule(antlr4::ParserRuleContext * ctx) +{ + buildTokenStopInfo(ctx, m_currentNode->info); + + m_currentNode = m_parentNode; + if (m_parentNode != nullptr) + m_parentNode = m_currentNode->parentNode; +} + +void ASTJsonListener::visitTerminal(antlr4::tree::TerminalNode * node) +{ + m_currentNode->info["token"] = node->getText(); +} + +void ASTJsonListener::visitErrorNode(antlr4::tree::ErrorNode * node) +{ +} + +void visitAllASTNodes(ASTNode * node, ScJson & json) +{ + for (ASTNode * child : node->children) + { + json.push_back(child->info); + + visitAllASTNodes(child, json[json.size() - 1]["children"]); + } +} + +void ASTJsonListener::buildAST(ScJson & astJson) +{ + astJson = ScJson(); + astJson["ruleType"] = "syntax"; + + visitAllASTNodes(m_ast, astJson["children"]); +} + +void removeAllASTNodes(ASTNode * node) +{ + for (ASTNode * child : node->children) + { + removeAllASTNodes(child); + delete child; + } +} + +ASTJsonListener::~ASTJsonListener() +{ + removeAllASTNodes(m_ast); + delete m_ast; + m_ast = nullptr; + m_currentNode = nullptr; + m_parentNode = nullptr; +} diff --git a/sc-memory/sc-memory/scs/ASTJsonListener.hpp b/sc-memory/sc-memory/scs/ASTJsonListener.hpp new file mode 100644 index 0000000000..f96e477293 --- /dev/null +++ b/sc-memory/sc-memory/scs/ASTJsonListener.hpp @@ -0,0 +1,96 @@ +#pragma once + +#include "antlr4-runtime.h" + +#include "nlohmann/json.hpp" +using ScJson = nlohmann::json; + +namespace scs +{ + +class ASTErrorListener : public antlr4::ANTLRErrorListener +{ +public: + ScJson getErrors() + { + return m_errors; + } + +protected: + ScJson m_errors; + + void syntaxError( + antlr4::Recognizer *, + antlr4::Token * token, + size_t line, + size_t charPositionInLine, + std::string const & msg, + std::exception_ptr) override; + + void reportAmbiguity( + antlr4::Parser *, + antlr4::dfa::DFA const & dfa, + size_t startIndex, + size_t stopIndex, + bool, + antlrcpp::BitSet const &, + antlr4::atn::ATNConfigSet *) override; + + void reportAttemptingFullContext( + antlr4::Parser *, + antlr4::dfa::DFA const &, + size_t, + size_t, + antlrcpp::BitSet const &, + antlr4::atn::ATNConfigSet *) override; + + void reportContextSensitivity( + antlr4::Parser *, + antlr4::dfa::DFA const &, + size_t, + size_t, + size_t, + antlr4::atn::ATNConfigSet *) override; +}; + +struct ASTNode +{ + ScJson info; + std::set children; + ASTNode * parentNode; +}; + +/** + * This class provides an empty implementation of ASTJsonListener, + * which can be extended to create a listener which only needs to handle a subset + * of the available methods. + */ +class ASTJsonListener : public antlr4::tree::ParseTreeListener { +public: + explicit ASTJsonListener(antlr4::Parser & parser) + : m_parser(parser), m_ruleNames(m_parser.getRuleNames()) + {} + + void enterEveryRule(antlr4::ParserRuleContext * /*ctx*/) override; + void exitEveryRule(antlr4::ParserRuleContext * /*ctx*/) override; + void visitTerminal(antlr4::tree::TerminalNode * /*node*/) override; + void visitErrorNode(antlr4::tree::ErrorNode * /*node*/) override; + + void buildAST(ScJson & astJson); + + ~ASTJsonListener() override; + +protected: + antlr4::Parser & m_parser; + std::vector const & m_ruleNames; + + ASTNode * m_ast = nullptr; + ASTNode * m_currentNode = nullptr; + ASTNode * m_parentNode = nullptr; + + void buildTokenStartInfo(antlr4::ParserRuleContext * ctx, ScJson & nodeInfo); + + void buildTokenStopInfo(antlr4::ParserRuleContext * ctx, ScJson & nodeInfo); +}; + +} // namespace scs diff --git a/sc-memory/sc-memory/scs/scs_parser.cpp b/sc-memory/sc-memory/scs/scs_parser.cpp index f02f76a4a4..267f4550f6 100644 --- a/sc-memory/sc-memory/scs/scs_parser.cpp +++ b/sc-memory/sc-memory/scs/scs_parser.cpp @@ -30,6 +30,7 @@ #include "scsLexer.h" #include "scsParser.h" +#include "ASTJsonListener.hpp" #include @@ -303,6 +304,45 @@ bool Parser::Parse(std::string const & str) return result; } +std::string Parser::BuildAST(std::string const & str) +{ + std::string fName; + + antlr4::ANTLRInputStream input(str); + scsLexer lexer(&input); + antlr4::CommonTokenStream tokens(&lexer); + scsParser parser(&tokens); + + ASTJsonListener astListener(parser); + parser.addParseListener(&astListener); + + ASTErrorListener astErrorListener; + lexer.addErrorListener(&astErrorListener); + parser.addErrorListener(&astErrorListener); + + parser.setParser(this); + + try + { + parser.syntax(); + } + catch (utils::ExceptionParseError const & e) + { + m_lastError = e.Message(); + } + + ScJson astJson; + astListener.buildAST(astJson); + + astJson["errors"] = astErrorListener.getErrors(); + + parser.removeParseListener(&astListener); + lexer.removeErrorListener(&astErrorListener); + parser.removeErrorListener(&astErrorListener); + + return astJson.dump(); +} + ParsedElement & Parser::GetParsedElementRef(ElementHandle const & elID) { auto & container = (elID.IsLocal() ? m_parsedElementsLocal : m_parsedElements); diff --git a/sc-memory/sc-memory/scs/scs_parser.hpp b/sc-memory/sc-memory/scs/scs_parser.hpp index 14c3dd5fe2..10e4595120 100644 --- a/sc-memory/sc-memory/scs/scs_parser.hpp +++ b/sc-memory/sc-memory/scs/scs_parser.hpp @@ -112,6 +112,7 @@ class Parser _SC_EXTERN Parser(); _SC_EXTERN bool Parse(std::string const & str); + _SC_EXTERN std::string BuildAST(std::string const & str); _SC_EXTERN ParsedElement const & GetParsedElement(ElementHandle const & elID) const; _SC_EXTERN TripleVector const & GetParsedTriples() const; _SC_EXTERN std::string const & GetParseError() const; From ab205e5b4963aae33f6fdd8df968b0b1d4885c4e Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Sun, 7 May 2023 01:13:31 +0300 Subject: [PATCH 02/12] [tests][memory][scs] Cover AST listener with tests --- sc-memory/sc-memory/scs/ASTJsonListener.hpp | 2 +- sc-memory/tests/scs/units/test_ast.cpp | 544 ++++++++++++++++++++ 2 files changed, 545 insertions(+), 1 deletion(-) create mode 100644 sc-memory/tests/scs/units/test_ast.cpp diff --git a/sc-memory/sc-memory/scs/ASTJsonListener.hpp b/sc-memory/sc-memory/scs/ASTJsonListener.hpp index f96e477293..c45c5d8ad5 100644 --- a/sc-memory/sc-memory/scs/ASTJsonListener.hpp +++ b/sc-memory/sc-memory/scs/ASTJsonListener.hpp @@ -17,7 +17,7 @@ class ASTErrorListener : public antlr4::ANTLRErrorListener } protected: - ScJson m_errors; + ScJson m_errors = ScJson::array(); void syntaxError( antlr4::Recognizer *, diff --git a/sc-memory/tests/scs/units/test_ast.cpp b/sc-memory/tests/scs/units/test_ast.cpp new file mode 100644 index 0000000000..8bfe4a3670 --- /dev/null +++ b/sc-memory/tests/scs/units/test_ast.cpp @@ -0,0 +1,544 @@ +/* +* This source file is part of an OSTIS project. For the latest info, see http://ostis.net +* Distributed under the MIT License +* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT) + */ + +#include + +#include + +#include "test_scs_utils.hpp" + +TEST(scs_ast, CorrectAST1) +{ + sc_char const * data = "x -> y;;"; + + scs::Parser parser; + std::string const & ast = parser.BuildAST(data); + + EXPECT_EQ(R"({ + "children": [{ + "children": [{ + "children": [{ + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 2, + "beginLine": 1, + "endIndex": 2, + "endLine": 1 + }, + "ruleType": "connector", + "token": "->" + }, { + "children": [{ + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 4, + "beginLine": 1, + "endIndex": 4, + "endLine": 1 + }, + "ruleType": "idtf_system", + "token": "y" + }], + "position": { + "beginIndex": 4, + "beginLine": 1, + "endIndex": 4, + "endLine": 1 + }, + "ruleType": "idtf_atomic" + }], + "position": { + "beginIndex": 4, + "beginLine": 1, + "endIndex": 4, + "endLine": 1 + }, + "ruleType": "idtf_common" + }], + "position": { + "beginIndex": 4, + "beginLine": 1, + "endIndex": 4, + "endLine": 1 + }, + "ruleType": "idtf_list" + }], + "position": { + "beginIndex": 2, + "beginLine": 1, + "endIndex": 4, + "endLine": 1 + }, + "ruleType": "sentence_lvl_4_list_item" + }, { + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 0, + "endLine": 1 + }, + "ruleType": "idtf_system", + "token": "x" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 0, + "endLine": 1 + }, + "ruleType": "idtf_atomic" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 0, + "endLine": 1 + }, + "ruleType": "idtf_common" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 4, + "endLine": 1 + }, + "ruleType": "sentence_lvl_common" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 4, + "endLine": 1 + }, + "ruleType": "sentence" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 5, + "endLine": 1 + }, + "ruleType": "sentence_wrap", + "token": ";;" + }], + "errors": [], + "ruleType": "syntax" + })"_json.dump(), ast); +} + +TEST(scs_ast, CorrectAST2) +{ + sc_char const * data = "x -> [* y _=> [test*];; *];;"; + + scs::Parser parser; + std::string const & ast = parser.BuildAST(data); + + EXPECT_EQ(R"({ + "children": [{ + "children": [{ + "children": [{ + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 2, + "beginLine": 1, + "endIndex": 2, + "endLine": 1 + }, + "ruleType": "connector", + "token": "->" + }, { + "children": [{ + "children": [{ + "children": [{ + "children": [{ + "children": [{ + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 8, + "beginLine": 1, + "endIndex": 8, + "endLine": 1 + }, + "ruleType": "connector", + "token": "_=>" + }, { + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 10, + "beginLine": 1, + "endIndex": 10, + "endLine": 1 + }, + "ruleType": "content", + "token": "[test*]" + }], + "position": { + "beginIndex": 10, + "beginLine": 1, + "endIndex": 10, + "endLine": 1 + }, + "ruleType": "idtf_common" + }], + "position": { + "beginIndex": 10, + "beginLine": 1, + "endIndex": 10, + "endLine": 1 + }, + "ruleType": "idtf_list" + }], + "position": { + "beginIndex": 8, + "beginLine": 1, + "endIndex": 10, + "endLine": 1 + }, + "ruleType": "sentence_lvl_4_list_item" + }, { + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 6, + "beginLine": 1, + "endIndex": 6, + "endLine": 1 + }, + "ruleType": "idtf_system", + "token": "y" + }], + "position": { + "beginIndex": 6, + "beginLine": 1, + "endIndex": 6, + "endLine": 1 + }, + "ruleType": "idtf_atomic" + }], + "position": { + "beginIndex": 6, + "beginLine": 1, + "endIndex": 6, + "endLine": 1 + }, + "ruleType": "idtf_common" + }], + "position": { + "beginIndex": 6, + "beginLine": 1, + "endIndex": 10, + "endLine": 1 + }, + "ruleType": "sentence_lvl_common" + }], + "position": { + "beginIndex": 6, + "beginLine": 1, + "endIndex": 10, + "endLine": 1 + }, + "ruleType": "sentence" + }], + "position": { + "beginIndex": 6, + "beginLine": 1, + "endIndex": 11, + "endLine": 1 + }, + "ruleType": "sentence_wrap", + "token": ";;" + }], + "position": { + "beginIndex": 4, + "beginLine": 1, + "endIndex": 13, + "endLine": 1 + }, + "ruleType": "contour", + "token": "*]" + }], + "position": { + "beginIndex": 4, + "beginLine": 1, + "endIndex": 13, + "endLine": 1 + }, + "ruleType": "idtf_common" + }], + "position": { + "beginIndex": 4, + "beginLine": 1, + "endIndex": 13, + "endLine": 1 + }, + "ruleType": "idtf_list" + }], + "position": { + "beginIndex": 2, + "beginLine": 1, + "endIndex": 13, + "endLine": 1 + }, + "ruleType": "sentence_lvl_4_list_item" + }, { + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 0, + "endLine": 1 + }, + "ruleType": "idtf_system", + "token": "x" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 0, + "endLine": 1 + }, + "ruleType": "idtf_atomic" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 0, + "endLine": 1 + }, + "ruleType": "idtf_common" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 13, + "endLine": 1 + }, + "ruleType": "sentence_lvl_common" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 13, + "endLine": 1 + }, + "ruleType": "sentence" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 14, + "endLine": 1 + }, + "ruleType": "sentence_wrap", + "token": ";;" + }], + "errors": [], + "ruleType": "syntax" + })"_json.dump(), ast); +} + +TEST(scs_ast, IncorrectAST1) +{ + sc_char const * data = "x"; + + scs::Parser parser; + std::string const & ast = parser.BuildAST(data); + + EXPECT_EQ(R"({ + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 0, + "beginLine": 1 + }, + "ruleType": "sentence" + }], + "position": { + "beginIndex": 0, + "beginLine": 1 + }, + "ruleType": "sentence_wrap" + }, { + "children": [{ + "children": [], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 0, + "endLine": 1 + }, + "ruleType": "sentence" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 0, + "endLine": 1 + }, + "ruleType": "sentence_wrap" + }], + "errors": [{ + "charPositionInLine": 1, + "line": 1, + "msg": "no viable alternative at input 'x'", + "token": "" + }], + "ruleType": "syntax" + })"_json.dump(), ast); +} + +TEST(scs_ast, IncorrectAST2) +{ + sc_char const * data = "x => nrel_idtf: [text]]"; + + scs::Parser parser; + std::string const & ast = parser.BuildAST(data); + + EXPECT_EQ(R"({ + "children": [{ + "children": [{ + "children": [{ + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 2, + "beginLine": 1, + "endIndex": 2, + "endLine": 1 + }, + "ruleType": "connector", + "token": "=>" + }, { + "children": [], + "position": { + "beginIndex": 4, + "beginLine": 1, + "endIndex": 5, + "endLine": 1 + }, + "ruleType": "attr_list", + "token": ":" + }, { + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 7, + "beginLine": 1, + "endIndex": 7, + "endLine": 1 + }, + "ruleType": "content", + "token": "[text]" + }], + "position": { + "beginIndex": 7, + "beginLine": 1, + "endIndex": 7, + "endLine": 1 + }, + "ruleType": "idtf_common" + }], + "position": { + "beginIndex": 7, + "beginLine": 1, + "endIndex": 7, + "endLine": 1 + }, + "ruleType": "idtf_list" + }], + "position": { + "beginIndex": 2, + "beginLine": 1, + "endIndex": 7, + "endLine": 1 + }, + "ruleType": "sentence_lvl_4_list_item" + }, { + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 0, + "endLine": 1 + }, + "ruleType": "idtf_system", + "token": "x" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 0, + "endLine": 1 + }, + "ruleType": "idtf_atomic" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 0, + "endLine": 1 + }, + "ruleType": "idtf_common" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 7, + "endLine": 1 + }, + "ruleType": "sentence_lvl_common" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 7, + "endLine": 1 + }, + "ruleType": "sentence" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 7, + "endLine": 1 + }, + "ruleType": "sentence_wrap" + }], + "errors": [{ + "charPositionInLine": 22, + "line": 1, + "msg": "token recognition error at: ']'", + "token": "Invalid token" + }, { + "charPositionInLine": 23, + "line": 1, + "msg": "missing ';;' at ''", + "token": "" + }], + "ruleType": "syntax" + })"_json.dump(), ast); +} From d8f860426224545f8c43ff8958b90ed03506004e Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Sun, 7 May 2023 11:25:59 +0300 Subject: [PATCH 03/12] [tools][server] Add endpoint to parse scs AST --- .../sc_memory_json_action_defines.hpp | 1 + .../sc_memory_json_actions_handler.hpp | 1 + .../sc_memory_parse_scs_json_action.hpp | 46 +++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 sc-tools/sc-server/src/sc-server-impl/sc-memory-json/sc-memory-json-action/sc_memory_parse_scs_json_action.hpp diff --git a/sc-tools/sc-server/src/sc-server-impl/sc-memory-json/sc-memory-json-action/sc_memory_json_action_defines.hpp b/sc-tools/sc-server/src/sc-server-impl/sc-memory-json/sc-memory-json-action/sc_memory_json_action_defines.hpp index cfd36bb20c..dbe5c12315 100644 --- a/sc-tools/sc-server/src/sc-server-impl/sc-memory-json/sc-memory-json-action/sc_memory_json_action_defines.hpp +++ b/sc-tools/sc-server/src/sc-server-impl/sc-memory-json/sc-memory-json-action/sc_memory_json_action_defines.hpp @@ -10,6 +10,7 @@ #include "sc_memory_check_elements_json_action.hpp" #include "sc_memory_create_elements_json_action.hpp" #include "sc_memory_create_elements_by_scs_json_action.hpp" +#include "sc_memory_parse_scs_json_action.hpp" #include "sc_memory_delete_elements_json_action.hpp" #include "sc_memory_handle_link_content_json_action.hpp" #include "sc_memory_handle_keynodes_json_action.hpp" diff --git a/sc-tools/sc-server/src/sc-server-impl/sc-memory-json/sc-memory-json-action/sc_memory_json_actions_handler.hpp b/sc-tools/sc-server/src/sc-server-impl/sc-memory-json/sc-memory-json-action/sc_memory_json_actions_handler.hpp index acbd0bddf2..07702c060a 100644 --- a/sc-tools/sc-server/src/sc-server-impl/sc-memory-json/sc-memory-json-action/sc_memory_json_actions_handler.hpp +++ b/sc-tools/sc-server/src/sc-server-impl/sc-memory-json/sc-memory-json-action/sc_memory_json_actions_handler.hpp @@ -33,6 +33,7 @@ class ScMemoryJsonActionsHandler : public ScMemoryJsonHandler {"keynodes", new ScMemoryHandleKeynodesJsonAction()}, {"create_elements", new ScMemoryCreateElementsJsonAction()}, {"create_elements_by_scs", new ScMemoryCreateElementsByScsJsonAction()}, + {"parse_scs", new ScMemoryParseSCsJsonAction()}, {"check_elements", new ScMemoryCheckElementsJsonAction()}, {"delete_elements", new ScMemoryDeleteElementsJsonAction()}, {"search_template", new ScMemoryTemplateSearchJsonAction()}, diff --git a/sc-tools/sc-server/src/sc-server-impl/sc-memory-json/sc-memory-json-action/sc_memory_parse_scs_json_action.hpp b/sc-tools/sc-server/src/sc-server-impl/sc-memory-json/sc-memory-json-action/sc_memory_parse_scs_json_action.hpp new file mode 100644 index 0000000000..2b7600c12b --- /dev/null +++ b/sc-tools/sc-server/src/sc-server-impl/sc-memory-json/sc-memory-json-action/sc_memory_parse_scs_json_action.hpp @@ -0,0 +1,46 @@ +/* + * This source file is part of an OSTIS project. For the latest info, see http://ostis.net + * Distributed under the MIT License + * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT) + */ + + +#pragma once + +#include "sc_memory_json_action.hpp" + +#include "sc-memory/scs/scs_parser.hpp" + +class ScMemoryParseSCsJsonAction : public ScMemoryJsonAction +{ +public: + ScMemoryParseSCsJsonAction() + { + m_parser = new scs::Parser(); + } + + ScMemoryJsonPayload Complete( + ScMemoryContext * context, ScMemoryJsonPayload requestPayload, ScMemoryJsonPayload & errorsPayload) override + { + ScMemoryJsonPayload responsePayload = ScMemoryJsonPayload::array(); + + for (auto & atom : requestPayload) + { + std::string const & ast = m_parser->BuildAST(atom.get()); + responsePayload.push_back(ScMemoryJsonPayload::parse(ast)); + } + + if (responsePayload.is_null()) + return "{}"_json; + + return responsePayload; + } + + ~ScMemoryParseSCsJsonAction() override + { + delete m_parser; + } + +private: + scs::Parser * m_parser; +}; From 4852aa0981f3d647455012d76b9f06a367444634 Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Sun, 7 May 2023 13:34:46 +0300 Subject: [PATCH 04/12] [memory][scs] Separate errors info and ast --- sc-memory/sc-memory/scs/scs_parser.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sc-memory/sc-memory/scs/scs_parser.cpp b/sc-memory/sc-memory/scs/scs_parser.cpp index 267f4550f6..8051424492 100644 --- a/sc-memory/sc-memory/scs/scs_parser.cpp +++ b/sc-memory/sc-memory/scs/scs_parser.cpp @@ -331,10 +331,9 @@ std::string Parser::BuildAST(std::string const & str) m_lastError = e.Message(); } - ScJson astJson; - astListener.buildAST(astJson); - - astJson["errors"] = astErrorListener.getErrors(); + ScJson parseResult; + astListener.buildAST(parseResult["root"]); + parseResult["errors"] = astErrorListener.getErrors(); parser.removeParseListener(&astListener); lexer.removeErrorListener(&astErrorListener); From 2947e673d7bbd6be76ab3353a3a5f4dbb6bd366b Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Sun, 7 May 2023 13:43:48 +0300 Subject: [PATCH 05/12] [memory][scs] Update errors position --- sc-memory/sc-memory/scs/ASTJsonListener.cpp | 8 ++++++++ sc-memory/sc-memory/scs/scs_parser.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sc-memory/sc-memory/scs/ASTJsonListener.cpp b/sc-memory/sc-memory/scs/ASTJsonListener.cpp index 753484172d..ae2a5f4fc0 100644 --- a/sc-memory/sc-memory/scs/ASTJsonListener.cpp +++ b/sc-memory/sc-memory/scs/ASTJsonListener.cpp @@ -16,6 +16,14 @@ void ASTErrorListener::syntaxError( errorInfoJson["charPositionInLine"] = charPositionInLine; errorInfoJson["msg"] = msg; + ScJson positionJson; + positionJson["beginLine"] = token->getLine(); + positionJson["beginIndex"] = token->getStartIndex(); + positionJson["endLine"] = token->getLine(); + positionJson["endIndex"] = token->getStopIndex(); + + errorInfoJson["position"] = positionJson; + m_errors.push_back(errorInfoJson); } diff --git a/sc-memory/sc-memory/scs/scs_parser.cpp b/sc-memory/sc-memory/scs/scs_parser.cpp index 8051424492..f6cb21f26b 100644 --- a/sc-memory/sc-memory/scs/scs_parser.cpp +++ b/sc-memory/sc-memory/scs/scs_parser.cpp @@ -339,7 +339,7 @@ std::string Parser::BuildAST(std::string const & str) lexer.removeErrorListener(&astErrorListener); parser.removeErrorListener(&astErrorListener); - return astJson.dump(); + return parseResult.dump(); } ParsedElement & Parser::GetParsedElementRef(ElementHandle const & elID) From ea8cd3b0de65362b98de8f48a2a3f691a6b8b428 Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Sun, 7 May 2023 15:31:00 +0300 Subject: [PATCH 06/12] [memory][scs] Fix grammar terminal rules --- sc-memory/sc-memory/scs/ASTJsonListener.cpp | 24 +++-- sc-memory/sc-memory/scs/ASTJsonListener.hpp | 2 +- sc-memory/sc-memory/scs/scs.g4 | 16 ++- sc-memory/tests/scs/units/test_ast.cpp | 104 +++++++++++++++++++- 4 files changed, 127 insertions(+), 19 deletions(-) diff --git a/sc-memory/sc-memory/scs/ASTJsonListener.cpp b/sc-memory/sc-memory/scs/ASTJsonListener.cpp index ae2a5f4fc0..d4fd9468a4 100644 --- a/sc-memory/sc-memory/scs/ASTJsonListener.cpp +++ b/sc-memory/sc-memory/scs/ASTJsonListener.cpp @@ -18,9 +18,9 @@ void ASTErrorListener::syntaxError( ScJson positionJson; positionJson["beginLine"] = token->getLine(); - positionJson["beginIndex"] = token->getStartIndex(); + positionJson["beginIndex"] = charPositionInLine; positionJson["endLine"] = token->getLine(); - positionJson["endIndex"] = token->getStopIndex(); + positionJson["endIndex"] = token->getText().size() + charPositionInLine; errorInfoJson["position"] = positionJson; @@ -74,7 +74,7 @@ void ASTJsonListener::buildTokenStartInfo(antlr4::ParserRuleContext * ctx, ScJso { ScJson positionJson; positionJson["beginLine"] = ctx->getStart()->getLine(); - positionJson["beginIndex"] = ctx->getStart()->getTokenIndex(); + positionJson["beginIndex"] = ctx->getStart()->getCharPositionInLine(); nodeInfo["ruleType"] = m_ruleNames[ctx->getRuleIndex()]; nodeInfo["position"] = positionJson; @@ -87,17 +87,17 @@ void ASTJsonListener::buildTokenStopInfo(antlr4::ParserRuleContext * ctx, ScJson return; nodeInfo["position"]["endLine"] = ctx->getStop()->getLine(); - nodeInfo["position"]["endIndex"] = ctx->getStop()->getTokenIndex(); + nodeInfo["position"]["endIndex"] = ctx->getStop()->getCharPositionInLine() + ctx->getStop()->getText().size(); } void ASTJsonListener::enterEveryRule(antlr4::ParserRuleContext * ctx) { auto * node = new ASTNode(); - if (m_ast == nullptr) + if (m_root == nullptr) { m_currentNode = node; - m_ast = node; + m_root = node; m_currentNode->parentNode = nullptr; } else @@ -141,10 +141,8 @@ void visitAllASTNodes(ASTNode * node, ScJson & json) void ASTJsonListener::buildAST(ScJson & astJson) { - astJson = ScJson(); - astJson["ruleType"] = "syntax"; - - visitAllASTNodes(m_ast, astJson["children"]); + astJson = m_root->info; + visitAllASTNodes(m_root, astJson["children"]); } void removeAllASTNodes(ASTNode * node) @@ -158,9 +156,9 @@ void removeAllASTNodes(ASTNode * node) ASTJsonListener::~ASTJsonListener() { - removeAllASTNodes(m_ast); - delete m_ast; - m_ast = nullptr; + removeAllASTNodes(m_root); + delete m_root; + m_root = nullptr; m_currentNode = nullptr; m_parentNode = nullptr; } diff --git a/sc-memory/sc-memory/scs/ASTJsonListener.hpp b/sc-memory/sc-memory/scs/ASTJsonListener.hpp index c45c5d8ad5..f34b56b3f6 100644 --- a/sc-memory/sc-memory/scs/ASTJsonListener.hpp +++ b/sc-memory/sc-memory/scs/ASTJsonListener.hpp @@ -84,7 +84,7 @@ class ASTJsonListener : public antlr4::tree::ParseTreeListener { antlr4::Parser & m_parser; std::vector const & m_ruleNames; - ASTNode * m_ast = nullptr; + ASTNode * m_root = nullptr; ASTNode * m_currentNode = nullptr; ASTNode * m_parentNode = nullptr; diff --git a/sc-memory/sc-memory/scs/scs.g4 b/sc-memory/sc-memory/scs/scs.g4 index 883520b4fd..1d014f8228 100644 --- a/sc-memory/sc-memory/scs/scs.g4 +++ b/sc-memory/sc-memory/scs/scs.g4 @@ -57,16 +57,24 @@ content returns [ElementHandle handle] } ; +contour_begin + : CONTOUR_BEGIN + ; + +contour_end + : CONTOUR_END + ; + contour[ElementHandle contourHandle = ElementHandle()] returns [ElementHandle handle] - : CONTOUR_BEGIN + : contour_begin { $ctx->handle = $contourHandle.IsValid() ? $contourHandle : m_parser->ProcessEmptyContour(); m_parser->ProcessContourBegin(); } ( (sentence_wrap | (sentence_lvl_4_list_item[$ctx->handle] ';;'))* ) - CONTOUR_END + contour_end { m_parser->ProcessContourEnd($ctx->handle); } @@ -339,10 +347,10 @@ sentence_lvl_common attr_list returns [std::vector> items] @init { $items = {}; } : ( - ID_SYSTEM + id=idtf_system EDGE_ATTR { - $ctx->items.emplace_back(m_parser->ProcessIdentifier($ID_SYSTEM->getText()), + $ctx->items.emplace_back(m_parser->ProcessIdentifier($ctx->id->getText()), scs::TypeResolver::IsEdgeAttrConst($EDGE_ATTR->getText())); } )+ diff --git a/sc-memory/tests/scs/units/test_ast.cpp b/sc-memory/tests/scs/units/test_ast.cpp index 8bfe4a3670..a8a266942b 100644 --- a/sc-memory/tests/scs/units/test_ast.cpp +++ b/sc-memory/tests/scs/units/test_ast.cpp @@ -12,7 +12,109 @@ TEST(scs_ast, CorrectAST1) { - sc_char const * data = "x -> y;;"; + sc_char const * data = "sc_node_not_relation -> concept_wine;;\n" + "concept_wine=>nrel_idtf:[wine] (* <- lang_en;; *);;\n" + "concept_wine=>nrel_main_idtf:[вино] (* <- lang_ru;; *);;\n" + "\n" + "concept_wine<-rrel_key_sc_element:...\n" + "\t(*\n" + "\t<-definition;;=>nrel_main_idtf:[Опр.(вино)] (* <- lang_ru;; *);;<=nrel_sc_text_translation:...\n" + "\t(*\n" + " ->[Вино — слабоалкогольный напиток, получаемый брожением виноградного сока](* <- lang_ru;; *);;\n" + "\t*);;\n" + "\t\n" + "\t<=nrel_using_constants:...\n" + "\t(*\n" + "\t\t->concept_low_alcoholic_drink;;\n" + " ->concept_juice;;\n" + "\n" + "\t*);;\n" + "\n" + "*);;\n" + "\n" + "\n" + "concept_wine<-rrel_key_sc_element:...\n" + "\t(*\n" + "\t\t<-illustration;;<=nrel_sc_text_translation:...\n" + "\t\t\t(*\n" + "\t\t\t ->rrel_example: \"file://photo//wine.jpg\"\n" + "\t\t\t(*\n" + "\t\t=>nrel_format:format_jpg;;\n" + "\t\t*);;\n" + "\t*);;\n" + "*);;\n" + "\n" + "concept_wine<-rrel_key_sc_element:...\n" + "(*\n" + "\t->rrel_key_sc_element:nrel_beverage_strength;concept_wine;;\n" + "\t<-statement;;\n" + "\t=>nrel_main_idtf:[Утв.(Крепкость напитка*, вино)](* <- lang_ru;; *);;\n" + "\t<=nrel_sc_text_translation:...\n" + "\t(*\n" + "\t\t->rrel_example:[Процент содержания алкоголя : 9-22 %](* <- lang_ru;; *);;\n" + "\t*);;\n" + "*);;\n" + "\n" + "\n" + "concept_wine<-rrel_key_sc_element:...\n" + "(*\n" + "\t=>nrel_main_idtf:[Утв.(вино)](* <- lang_ru;; *);\n" + " <=nrel_sc_text_translation:...\n" + "\t(*\n" + " ->rrel_example:[У каждого сорта вина своя традиция распития](* <- lang_ru;; *);;\n" + "\t*);;\n" + "\t\n" + "\t<=nrel_using_constants:...\n" + "\t(*\n" + " ->concept_drinking_tradition;;\n" + "\n" + "\t*);;\n" + "\n" + "*);;\n" + "\n" + "\n" + "concept_wine<-rrel_key_sc_element:...\n" + "(*\n" + "\t=>nrel_main_idtf:[Утв.(вино)](* <- lang_ru;; *);;\n" + " <=nrel_sc_text_translation:...\n" + "\t(*\n" + " ->rrel_example:[Вино получают из различных сортах винограда,отжимая сок и потом подвиргают брожению](* <- lang_ru;; *);;\n" + "\t*);;\n" + "\t\n" + "\t<=nrel_using_constants:...\n" + "\t(*\n" + " ->nrel_spin;;\n" + " ->concept_juice;;\n" + " ->concept_grade;;\n" + " ->nrel_fermentation;;\n" + "\n" + "\t*);;\n" + "\n" + "*);;\n" + "\n" + "concept_wine<-rrel_key_sc_element:...\n" + "(*\n" + "\t=>nrel_main_idtf:[Утв.(вино)](* <- lang_ru;; *);;\n" + " <=nrel_sc_text_translation:...\n" + "\t(*\n" + " ->rrel_example:[Одна из самых известных марок вина- Chateau Lafite Rothschild](* <- lang_ru;; *);;\n" + "\t*);;\n" + "\t\n" + "\n" + "*);;\n" + "\n" + "concept_wine<-rrel_key_sc_element:...\n" + "\t(*\n" + "\t\t<-illustration;;<=nrel_sc_text_translation:...\n" + "\t\t\t(*\n" + "\t\t\t ->rrel_example: \"file://photo//famous//Chateau Lafite Rothschild.jpg\"\n" + "\t\t\t(*\n" + "\t\t=>nrel_format:format_jpeg;;\n" + "\t\t*);;\n" + "\t*);;\n" + "*);;\n" + "\n" + "concept_wine<=nrel_inclusion:concept_low_alcoholic_drink;;"; scs::Parser parser; std::string const & ast = parser.BuildAST(data); From f5a45f4ca876dbfdaa0ae245664136f66642ba48 Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Thu, 11 May 2023 15:04:26 +0300 Subject: [PATCH 07/12] [tests][memory] Validate tests AST json --- sc-memory/sc-memory/scs/ASTJsonListener.cpp | 11 +- sc-memory/tests/scs/units/test_ast.cpp | 801 ++++++++++++-------- 2 files changed, 476 insertions(+), 336 deletions(-) diff --git a/sc-memory/sc-memory/scs/ASTJsonListener.cpp b/sc-memory/sc-memory/scs/ASTJsonListener.cpp index d4fd9468a4..a3d8c44903 100644 --- a/sc-memory/sc-memory/scs/ASTJsonListener.cpp +++ b/sc-memory/sc-memory/scs/ASTJsonListener.cpp @@ -17,10 +17,13 @@ void ASTErrorListener::syntaxError( errorInfoJson["msg"] = msg; ScJson positionJson; - positionJson["beginLine"] = token->getLine(); - positionJson["beginIndex"] = charPositionInLine; - positionJson["endLine"] = token->getLine(); - positionJson["endIndex"] = token->getText().size() + charPositionInLine; + if (token != nullptr) + { + positionJson["beginLine"] = token->getLine(); + positionJson["beginIndex"] = charPositionInLine; + positionJson["endLine"] = token->getLine(); + positionJson["endIndex"] = token->getText().size() + charPositionInLine; + } errorInfoJson["position"] = positionJson; diff --git a/sc-memory/tests/scs/units/test_ast.cpp b/sc-memory/tests/scs/units/test_ast.cpp index a8a266942b..4af74a8653 100644 --- a/sc-memory/tests/scs/units/test_ast.cpp +++ b/sc-memory/tests/scs/units/test_ast.cpp @@ -12,229 +12,136 @@ TEST(scs_ast, CorrectAST1) { - sc_char const * data = "sc_node_not_relation -> concept_wine;;\n" - "concept_wine=>nrel_idtf:[wine] (* <- lang_en;; *);;\n" - "concept_wine=>nrel_main_idtf:[вино] (* <- lang_ru;; *);;\n" - "\n" - "concept_wine<-rrel_key_sc_element:...\n" - "\t(*\n" - "\t<-definition;;=>nrel_main_idtf:[Опр.(вино)] (* <- lang_ru;; *);;<=nrel_sc_text_translation:...\n" - "\t(*\n" - " ->[Вино — слабоалкогольный напиток, получаемый брожением виноградного сока](* <- lang_ru;; *);;\n" - "\t*);;\n" - "\t\n" - "\t<=nrel_using_constants:...\n" - "\t(*\n" - "\t\t->concept_low_alcoholic_drink;;\n" - " ->concept_juice;;\n" - "\n" - "\t*);;\n" - "\n" - "*);;\n" - "\n" - "\n" - "concept_wine<-rrel_key_sc_element:...\n" - "\t(*\n" - "\t\t<-illustration;;<=nrel_sc_text_translation:...\n" - "\t\t\t(*\n" - "\t\t\t ->rrel_example: \"file://photo//wine.jpg\"\n" - "\t\t\t(*\n" - "\t\t=>nrel_format:format_jpg;;\n" - "\t\t*);;\n" - "\t*);;\n" - "*);;\n" - "\n" - "concept_wine<-rrel_key_sc_element:...\n" - "(*\n" - "\t->rrel_key_sc_element:nrel_beverage_strength;concept_wine;;\n" - "\t<-statement;;\n" - "\t=>nrel_main_idtf:[Утв.(Крепкость напитка*, вино)](* <- lang_ru;; *);;\n" - "\t<=nrel_sc_text_translation:...\n" - "\t(*\n" - "\t\t->rrel_example:[Процент содержания алкоголя : 9-22 %](* <- lang_ru;; *);;\n" - "\t*);;\n" - "*);;\n" - "\n" - "\n" - "concept_wine<-rrel_key_sc_element:...\n" - "(*\n" - "\t=>nrel_main_idtf:[Утв.(вино)](* <- lang_ru;; *);\n" - " <=nrel_sc_text_translation:...\n" - "\t(*\n" - " ->rrel_example:[У каждого сорта вина своя традиция распития](* <- lang_ru;; *);;\n" - "\t*);;\n" - "\t\n" - "\t<=nrel_using_constants:...\n" - "\t(*\n" - " ->concept_drinking_tradition;;\n" - "\n" - "\t*);;\n" - "\n" - "*);;\n" - "\n" - "\n" - "concept_wine<-rrel_key_sc_element:...\n" - "(*\n" - "\t=>nrel_main_idtf:[Утв.(вино)](* <- lang_ru;; *);;\n" - " <=nrel_sc_text_translation:...\n" - "\t(*\n" - " ->rrel_example:[Вино получают из различных сортах винограда,отжимая сок и потом подвиргают брожению](* <- lang_ru;; *);;\n" - "\t*);;\n" - "\t\n" - "\t<=nrel_using_constants:...\n" - "\t(*\n" - " ->nrel_spin;;\n" - " ->concept_juice;;\n" - " ->concept_grade;;\n" - " ->nrel_fermentation;;\n" - "\n" - "\t*);;\n" - "\n" - "*);;\n" - "\n" - "concept_wine<-rrel_key_sc_element:...\n" - "(*\n" - "\t=>nrel_main_idtf:[Утв.(вино)](* <- lang_ru;; *);;\n" - " <=nrel_sc_text_translation:...\n" - "\t(*\n" - " ->rrel_example:[Одна из самых известных марок вина- Chateau Lafite Rothschild](* <- lang_ru;; *);;\n" - "\t*);;\n" - "\t\n" - "\n" - "*);;\n" - "\n" - "concept_wine<-rrel_key_sc_element:...\n" - "\t(*\n" - "\t\t<-illustration;;<=nrel_sc_text_translation:...\n" - "\t\t\t(*\n" - "\t\t\t ->rrel_example: \"file://photo//famous//Chateau Lafite Rothschild.jpg\"\n" - "\t\t\t(*\n" - "\t\t=>nrel_format:format_jpeg;;\n" - "\t\t*);;\n" - "\t*);;\n" - "*);;\n" - "\n" - "concept_wine<=nrel_inclusion:concept_low_alcoholic_drink;;"; + sc_char const * data = "x -> y;;"; scs::Parser parser; std::string const & ast = parser.BuildAST(data); EXPECT_EQ(R"({ - "children": [{ + "errors": [], + "root": { "children": [{ "children": [{ "children": [{ "children": [{ - "children": [], - "position": { - "beginIndex": 2, - "beginLine": 1, - "endIndex": 2, - "endLine": 1 - }, - "ruleType": "connector", - "token": "->" - }, { "children": [{ + "children": [], + "position": { + "beginIndex": 2, + "beginLine": 1, + "endIndex": 4, + "endLine": 1 + }, + "ruleType": "connector", + "token": "->" + }, { "children": [{ "children": [{ - "children": [], + "children": [{ + "children": [], + "position": { + "beginIndex": 5, + "beginLine": 1, + "endIndex": 6, + "endLine": 1 + }, + "ruleType": "idtf_system", + "token": "y" + }], "position": { - "beginIndex": 4, + "beginIndex": 5, "beginLine": 1, - "endIndex": 4, + "endIndex": 6, "endLine": 1 }, - "ruleType": "idtf_system", - "token": "y" + "ruleType": "idtf_atomic" }], "position": { - "beginIndex": 4, + "beginIndex": 5, "beginLine": 1, - "endIndex": 4, + "endIndex": 6, "endLine": 1 }, - "ruleType": "idtf_atomic" + "ruleType": "idtf_common" }], "position": { - "beginIndex": 4, + "beginIndex": 5, "beginLine": 1, - "endIndex": 4, + "endIndex": 6, "endLine": 1 }, - "ruleType": "idtf_common" + "ruleType": "idtf_list" }], "position": { - "beginIndex": 4, + "beginIndex": 2, "beginLine": 1, - "endIndex": 4, + "endIndex": 6, "endLine": 1 }, - "ruleType": "idtf_list" - }], - "position": { - "beginIndex": 2, - "beginLine": 1, - "endIndex": 4, - "endLine": 1 - }, - "ruleType": "sentence_lvl_4_list_item" - }, { - "children": [{ + "ruleType": "sentence_lvl_4_list_item" + }, { "children": [{ - "children": [], + "children": [{ + "children": [], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 1, + "endLine": 1 + }, + "ruleType": "idtf_system", + "token": "x" + }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 0, + "endIndex": 1, "endLine": 1 }, - "ruleType": "idtf_system", - "token": "x" + "ruleType": "idtf_atomic" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 0, + "endIndex": 1, "endLine": 1 }, - "ruleType": "idtf_atomic" + "ruleType": "idtf_common" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 0, + "endIndex": 6, "endLine": 1 }, - "ruleType": "idtf_common" + "ruleType": "sentence_lvl_common" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 4, + "endIndex": 6, "endLine": 1 }, - "ruleType": "sentence_lvl_common" + "ruleType": "sentence" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 4, + "endIndex": 8, "endLine": 1 }, - "ruleType": "sentence" + "ruleType": "sentence_wrap", + "token": ";;" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 5, + "endIndex": 13, "endLine": 1 }, - "ruleType": "sentence_wrap", - "token": ";;" - }], - "errors": [], - "ruleType": "syntax" + "ruleType": "syntax", + "token": "" + } })"_json.dump(), ast); } @@ -246,215 +153,243 @@ TEST(scs_ast, CorrectAST2) std::string const & ast = parser.BuildAST(data); EXPECT_EQ(R"({ - "children": [{ + "errors": [], + "root": { "children": [{ "children": [{ "children": [{ "children": [{ - "children": [], - "position": { - "beginIndex": 2, - "beginLine": 1, - "endIndex": 2, - "endLine": 1 - }, - "ruleType": "connector", - "token": "->" - }, { "children": [{ + "children": [], + "position": { + "beginIndex": 2, + "beginLine": 1, + "endIndex": 4, + "endLine": 1 + }, + "ruleType": "connector", + "token": "->" + }, { "children": [{ "children": [{ "children": [{ + "children": [], + "position": { + "beginIndex": 5, + "beginLine": 1, + "endIndex": 7, + "endLine": 1 + }, + "ruleType": "contour_begin", + "token": "[*" + }, { "children": [{ "children": [{ "children": [{ - "children": [], - "position": { - "beginIndex": 8, - "beginLine": 1, - "endIndex": 8, - "endLine": 1 - }, - "ruleType": "connector", - "token": "_=>" - }, { "children": [{ "children": [{ "children": [], "position": { - "beginIndex": 10, + "beginIndex": 8, "beginLine": 1, - "endIndex": 10, + "endIndex": 9, "endLine": 1 }, - "ruleType": "content", - "token": "[test*]" + "ruleType": "idtf_system", + "token": "y" }], "position": { - "beginIndex": 10, + "beginIndex": 8, "beginLine": 1, - "endIndex": 10, + "endIndex": 9, "endLine": 1 }, - "ruleType": "idtf_common" + "ruleType": "idtf_atomic" }], "position": { - "beginIndex": 10, + "beginIndex": 8, "beginLine": 1, - "endIndex": 10, + "endIndex": 9, "endLine": 1 }, - "ruleType": "idtf_list" - }], - "position": { - "beginIndex": 8, - "beginLine": 1, - "endIndex": 10, - "endLine": 1 - }, - "ruleType": "sentence_lvl_4_list_item" - }, { - "children": [{ + "ruleType": "idtf_common" + }, { "children": [{ "children": [], "position": { - "beginIndex": 6, + "beginIndex": 10, + "beginLine": 1, + "endIndex": 13, + "endLine": 1 + }, + "ruleType": "connector", + "token": "_=>" + }, { + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 14, + "beginLine": 1, + "endIndex": 21, + "endLine": 1 + }, + "ruleType": "content", + "token": "[test*]" + }], + "position": { + "beginIndex": 14, + "beginLine": 1, + "endIndex": 21, + "endLine": 1 + }, + "ruleType": "idtf_common" + }], + "position": { + "beginIndex": 14, "beginLine": 1, - "endIndex": 6, + "endIndex": 21, "endLine": 1 }, - "ruleType": "idtf_system", - "token": "y" + "ruleType": "idtf_list" }], "position": { - "beginIndex": 6, + "beginIndex": 10, "beginLine": 1, - "endIndex": 6, + "endIndex": 21, "endLine": 1 }, - "ruleType": "idtf_atomic" + "ruleType": "sentence_lvl_4_list_item" }], "position": { - "beginIndex": 6, + "beginIndex": 8, "beginLine": 1, - "endIndex": 6, + "endIndex": 21, "endLine": 1 }, - "ruleType": "idtf_common" + "ruleType": "sentence_lvl_common" }], "position": { - "beginIndex": 6, + "beginIndex": 8, "beginLine": 1, - "endIndex": 10, + "endIndex": 21, "endLine": 1 }, - "ruleType": "sentence_lvl_common" + "ruleType": "sentence" }], "position": { - "beginIndex": 6, + "beginIndex": 8, + "beginLine": 1, + "endIndex": 23, + "endLine": 1 + }, + "ruleType": "sentence_wrap", + "token": ";;" + }, { + "children": [], + "position": { + "beginIndex": 24, "beginLine": 1, - "endIndex": 10, + "endIndex": 26, "endLine": 1 }, - "ruleType": "sentence" + "ruleType": "contour_end", + "token": "*]" }], "position": { - "beginIndex": 6, + "beginIndex": 5, "beginLine": 1, - "endIndex": 11, + "endIndex": 26, "endLine": 1 }, - "ruleType": "sentence_wrap", - "token": ";;" + "ruleType": "contour" }], "position": { - "beginIndex": 4, + "beginIndex": 5, "beginLine": 1, - "endIndex": 13, + "endIndex": 26, "endLine": 1 }, - "ruleType": "contour", - "token": "*]" + "ruleType": "idtf_common" }], "position": { - "beginIndex": 4, + "beginIndex": 5, "beginLine": 1, - "endIndex": 13, + "endIndex": 26, "endLine": 1 }, - "ruleType": "idtf_common" + "ruleType": "idtf_list" }], "position": { - "beginIndex": 4, + "beginIndex": 2, "beginLine": 1, - "endIndex": 13, + "endIndex": 26, "endLine": 1 }, - "ruleType": "idtf_list" - }], - "position": { - "beginIndex": 2, - "beginLine": 1, - "endIndex": 13, - "endLine": 1 - }, - "ruleType": "sentence_lvl_4_list_item" - }, { - "children": [{ + "ruleType": "sentence_lvl_4_list_item" + }, { "children": [{ - "children": [], + "children": [{ + "children": [], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 1, + "endLine": 1 + }, + "ruleType": "idtf_system", + "token": "x" + }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 0, + "endIndex": 1, "endLine": 1 }, - "ruleType": "idtf_system", - "token": "x" + "ruleType": "idtf_atomic" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 0, + "endIndex": 1, "endLine": 1 }, - "ruleType": "idtf_atomic" + "ruleType": "idtf_common" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 0, + "endIndex": 26, "endLine": 1 }, - "ruleType": "idtf_common" + "ruleType": "sentence_lvl_common" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 13, + "endIndex": 26, "endLine": 1 }, - "ruleType": "sentence_lvl_common" + "ruleType": "sentence" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 13, + "endIndex": 28, "endLine": 1 }, - "ruleType": "sentence" + "ruleType": "sentence_wrap", + "token": ";;" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 14, + "endIndex": 33, "endLine": 1 }, - "ruleType": "sentence_wrap", - "token": ";;" - }], - "errors": [], - "ruleType": "syntax" + "ruleType": "syntax", + "token": "" + } })"_json.dump(), ast); } @@ -466,46 +401,61 @@ TEST(scs_ast, IncorrectAST1) std::string const & ast = parser.BuildAST(data); EXPECT_EQ(R"({ - "children": [{ + "errors": [{ + "charPositionInLine": 1, + "line": 1, + "msg": "no viable alternative at input 'x'", + "position": { + "beginIndex": 1, + "beginLine": 1, + "endIndex": 6, + "endLine": 1 + }, + "token": "" + }], + "root": { "children": [{ - "children": [], + "children": [{ + "children": [], + "position": { + "beginIndex": 0, + "beginLine": 1 + }, + "ruleType": "sentence" + }], "position": { "beginIndex": 0, "beginLine": 1 }, - "ruleType": "sentence" - }], - "position": { - "beginIndex": 0, - "beginLine": 1 - }, - "ruleType": "sentence_wrap" - }, { - "children": [{ - "children": [], + "ruleType": "sentence_wrap" + }, { + "children": [{ + "children": [], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 1, + "endLine": 1 + }, + "ruleType": "sentence" + }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 0, + "endIndex": 1, "endLine": 1 }, - "ruleType": "sentence" + "ruleType": "sentence_wrap" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 0, + "endIndex": 6, "endLine": 1 }, - "ruleType": "sentence_wrap" - }], - "errors": [{ - "charPositionInLine": 1, - "line": 1, - "msg": "no viable alternative at input 'x'", + "ruleType": "syntax", "token": "" - }], - "ruleType": "syntax" + } })"_json.dump(), ast); } @@ -517,130 +467,317 @@ TEST(scs_ast, IncorrectAST2) std::string const & ast = parser.BuildAST(data); EXPECT_EQ(R"({ - "children": [{ + "errors": [{ + "charPositionInLine": 22, + "line": 1, + "msg": "token recognition error at: ']'", + "position": null, + "token": "Invalid token" + }, { + "charPositionInLine": 23, + "line": 1, + "msg": "missing ';;' at ''", + "position": { + "beginIndex": 23, + "beginLine": 1, + "endIndex": 28, + "endLine": 1 + }, + "token": "" + }], + "root": { "children": [{ "children": [{ "children": [{ "children": [{ - "children": [], + "children": [{ + "children": [], + "position": { + "beginIndex": 2, + "beginLine": 1, + "endIndex": 4, + "endLine": 1 + }, + "ruleType": "connector", + "token": "=>" + }, { + "children": [{ + "children": [], + "position": { + "beginIndex": 5, + "beginLine": 1, + "endIndex": 14, + "endLine": 1 + }, + "ruleType": "idtf_system", + "token": "nrel_idtf" + }], + "position": { + "beginIndex": 5, + "beginLine": 1, + "endIndex": 15, + "endLine": 1 + }, + "ruleType": "attr_list", + "token": ":" + }, { + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 16, + "beginLine": 1, + "endIndex": 22, + "endLine": 1 + }, + "ruleType": "content", + "token": "[text]" + }], + "position": { + "beginIndex": 16, + "beginLine": 1, + "endIndex": 22, + "endLine": 1 + }, + "ruleType": "idtf_common" + }], + "position": { + "beginIndex": 16, + "beginLine": 1, + "endIndex": 22, + "endLine": 1 + }, + "ruleType": "idtf_list" + }], "position": { "beginIndex": 2, "beginLine": 1, - "endIndex": 2, - "endLine": 1 - }, - "ruleType": "connector", - "token": "=>" - }, { - "children": [], - "position": { - "beginIndex": 4, - "beginLine": 1, - "endIndex": 5, + "endIndex": 22, "endLine": 1 }, - "ruleType": "attr_list", - "token": ":" + "ruleType": "sentence_lvl_4_list_item" }, { "children": [{ "children": [{ "children": [], "position": { - "beginIndex": 7, + "beginIndex": 0, "beginLine": 1, - "endIndex": 7, + "endIndex": 1, "endLine": 1 }, - "ruleType": "content", - "token": "[text]" + "ruleType": "idtf_system", + "token": "x" }], "position": { - "beginIndex": 7, + "beginIndex": 0, "beginLine": 1, - "endIndex": 7, + "endIndex": 1, "endLine": 1 }, - "ruleType": "idtf_common" + "ruleType": "idtf_atomic" }], "position": { - "beginIndex": 7, + "beginIndex": 0, "beginLine": 1, - "endIndex": 7, + "endIndex": 1, "endLine": 1 }, - "ruleType": "idtf_list" + "ruleType": "idtf_common" }], "position": { - "beginIndex": 2, + "beginIndex": 0, "beginLine": 1, - "endIndex": 7, + "endIndex": 22, "endLine": 1 }, - "ruleType": "sentence_lvl_4_list_item" - }, { + "ruleType": "sentence_lvl_common" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 22, + "endLine": 1 + }, + "ruleType": "sentence" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 22, + "endLine": 1 + }, + "ruleType": "sentence_wrap" + }], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 28, + "endLine": 1 + }, + "ruleType": "syntax", + "token": "" + } + })"_json.dump(), ast); +} + +TEST(scs_ast, IncorrectAST3) +{ + sc_char const * data = "x => nrel_idtf: adsa;;ж"; + + scs::Parser parser; + std::string const & ast = parser.BuildAST(data); + + EXPECT_EQ(R"({ + "errors": [{ + "charPositionInLine": 22, + "line": 1, + "msg": "token recognition error at: 'ж'", + "position": null, + "token": "Invalid token" + }], + "root": { + "children": [{ + "children": [{ + "children": [{ "children": [{ "children": [{ "children": [], + "position": { + "beginIndex": 2, + "beginLine": 1, + "endIndex": 4, + "endLine": 1 + }, + "ruleType": "connector", + "token": "=>" + }, { + "children": [{ + "children": [], + "position": { + "beginIndex": 5, + "beginLine": 1, + "endIndex": 14, + "endLine": 1 + }, + "ruleType": "idtf_system", + "token": "nrel_idtf" + }], + "position": { + "beginIndex": 5, + "beginLine": 1, + "endIndex": 15, + "endLine": 1 + }, + "ruleType": "attr_list", + "token": ":" + }, { + "children": [{ + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 16, + "beginLine": 1, + "endIndex": 20, + "endLine": 1 + }, + "ruleType": "idtf_system", + "token": "adsa" + }], + "position": { + "beginIndex": 16, + "beginLine": 1, + "endIndex": 20, + "endLine": 1 + }, + "ruleType": "idtf_atomic" + }], + "position": { + "beginIndex": 16, + "beginLine": 1, + "endIndex": 20, + "endLine": 1 + }, + "ruleType": "idtf_common" + }], + "position": { + "beginIndex": 16, + "beginLine": 1, + "endIndex": 20, + "endLine": 1 + }, + "ruleType": "idtf_list" + }], + "position": { + "beginIndex": 2, + "beginLine": 1, + "endIndex": 20, + "endLine": 1 + }, + "ruleType": "sentence_lvl_4_list_item" + }, { + "children": [{ + "children": [{ + "children": [], + "position": { + "beginIndex": 0, + "beginLine": 1, + "endIndex": 1, + "endLine": 1 + }, + "ruleType": "idtf_system", + "token": "x" + }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 0, + "endIndex": 1, "endLine": 1 }, - "ruleType": "idtf_system", - "token": "x" + "ruleType": "idtf_atomic" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 0, + "endIndex": 1, "endLine": 1 }, - "ruleType": "idtf_atomic" + "ruleType": "idtf_common" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 0, + "endIndex": 20, "endLine": 1 }, - "ruleType": "idtf_common" + "ruleType": "sentence_lvl_common" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 7, + "endIndex": 20, "endLine": 1 }, - "ruleType": "sentence_lvl_common" + "ruleType": "sentence" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 7, + "endIndex": 22, "endLine": 1 }, - "ruleType": "sentence" + "ruleType": "sentence_wrap", + "token": ";;" }], "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 7, + "endIndex": 28, "endLine": 1 }, - "ruleType": "sentence_wrap" - }], - "errors": [{ - "charPositionInLine": 22, - "line": 1, - "msg": "token recognition error at: ']'", - "token": "Invalid token" - }, { - "charPositionInLine": 23, - "line": 1, - "msg": "missing ';;' at ''", + "ruleType": "syntax", "token": "" - }], - "ruleType": "syntax" + } })"_json.dump(), ast); } From 9b1e5fa72a306c2fc9151980a6b09d09739f559b Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Thu, 11 May 2023 15:26:55 +0300 Subject: [PATCH 08/12] [memory][scs] Fix token recognition error position --- sc-memory/sc-memory/scs/ASTJsonListener.cpp | 16 +++---- sc-memory/tests/scs/units/test_ast.cpp | 47 +++++++++++++++------ 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/sc-memory/sc-memory/scs/ASTJsonListener.cpp b/sc-memory/sc-memory/scs/ASTJsonListener.cpp index a3d8c44903..3b1c692236 100644 --- a/sc-memory/sc-memory/scs/ASTJsonListener.cpp +++ b/sc-memory/sc-memory/scs/ASTJsonListener.cpp @@ -11,19 +11,15 @@ void ASTErrorListener::syntaxError( std::exception_ptr) { ScJson errorInfoJson; - errorInfoJson["token"] = token ? token->getText() : "Invalid token"; - errorInfoJson["line"] = line; - errorInfoJson["charPositionInLine"] = charPositionInLine; + errorInfoJson["token"] = token ? ScJson(token->getText()) : ScJson(); errorInfoJson["msg"] = msg; ScJson positionJson; - if (token != nullptr) - { - positionJson["beginLine"] = token->getLine(); - positionJson["beginIndex"] = charPositionInLine; - positionJson["endLine"] = token->getLine(); - positionJson["endIndex"] = token->getText().size() + charPositionInLine; - } + positionJson["beginLine"] = token == nullptr ? line : token->getLine(); + positionJson["beginIndex"] = charPositionInLine; + positionJson["endLine"] = token == nullptr ? positionJson["beginLine"].get() : token->getLine(); + positionJson["endIndex"] + = token == nullptr ? positionJson["beginIndex"].get() : token->getText().size() + charPositionInLine; errorInfoJson["position"] = positionJson; diff --git a/sc-memory/tests/scs/units/test_ast.cpp b/sc-memory/tests/scs/units/test_ast.cpp index 4af74a8653..58425ae0eb 100644 --- a/sc-memory/tests/scs/units/test_ast.cpp +++ b/sc-memory/tests/scs/units/test_ast.cpp @@ -402,8 +402,6 @@ TEST(scs_ast, IncorrectAST1) EXPECT_EQ(R"({ "errors": [{ - "charPositionInLine": 1, - "line": 1, "msg": "no viable alternative at input 'x'", "position": { "beginIndex": 1, @@ -468,14 +466,16 @@ TEST(scs_ast, IncorrectAST2) EXPECT_EQ(R"({ "errors": [{ - "charPositionInLine": 22, - "line": 1, "msg": "token recognition error at: ']'", "position": null, - "token": "Invalid token" + "position": { + "beginIndex": 22, + "beginLine": 1, + "endIndex": 22, + "endLine": 1 + }, + "token": null }, { - "charPositionInLine": 23, - "line": 1, "msg": "missing ';;' at ''", "position": { "beginIndex": 23, @@ -623,18 +623,39 @@ TEST(scs_ast, IncorrectAST2) TEST(scs_ast, IncorrectAST3) { - sc_char const * data = "x => nrel_idtf: adsa;;ж"; + sc_char const * data = "x => nrel_idtf: adsa;;жоо"; scs::Parser parser; std::string const & ast = parser.BuildAST(data); EXPECT_EQ(R"({ "errors": [{ - "charPositionInLine": 22, - "line": 1, "msg": "token recognition error at: 'ж'", - "position": null, - "token": "Invalid token" + "position": { + "beginIndex": 22, + "beginLine": 1, + "endIndex": 22, + "endLine": 1 + }, + "token": null + }, { + "msg": "token recognition error at: 'о'", + "position": { + "beginIndex": 23, + "beginLine": 1, + "endIndex": 23, + "endLine": 1 + }, + "token": null + }, { + "msg": "token recognition error at: 'о'", + "position": { + "beginIndex": 24, + "beginLine": 1, + "endIndex": 24, + "endLine": 1 + }, + "token": null }], "root": { "children": [{ @@ -773,7 +794,7 @@ TEST(scs_ast, IncorrectAST3) "position": { "beginIndex": 0, "beginLine": 1, - "endIndex": 28, + "endIndex": 30, "endLine": 1 }, "ruleType": "syntax", From 32b01e8a8162432948e544c80f7a8586d641d9bb Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Thu, 11 May 2023 15:40:23 +0300 Subject: [PATCH 09/12] [tests] Check errors in tests --- sc-memory/sc-memory/scs/ASTJsonListener.hpp | 1 + .../tests/sc-memory/fs-storage/test_defines.hpp | 4 ++++ sc-memory/tests/scs/units/test_ast.cpp | 12 +++++++----- 3 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 sc-memory/tests/sc-memory/fs-storage/test_defines.hpp diff --git a/sc-memory/sc-memory/scs/ASTJsonListener.hpp b/sc-memory/sc-memory/scs/ASTJsonListener.hpp index f34b56b3f6..9105cfe039 100644 --- a/sc-memory/sc-memory/scs/ASTJsonListener.hpp +++ b/sc-memory/sc-memory/scs/ASTJsonListener.hpp @@ -2,6 +2,7 @@ #include "antlr4-runtime.h" +#include #include "nlohmann/json.hpp" using ScJson = nlohmann::json; diff --git a/sc-memory/tests/sc-memory/fs-storage/test_defines.hpp b/sc-memory/tests/sc-memory/fs-storage/test_defines.hpp new file mode 100644 index 0000000000..fbdd1f34e8 --- /dev/null +++ b/sc-memory/tests/sc-memory/fs-storage/test_defines.hpp @@ -0,0 +1,4 @@ +#pragma once + +#define SC_DEPRECATED_DICTIONARY_FS_MEMORY_PATH \ + "/home/nikita/apps/ostis/ostis-ai/ostis-web-platform/sc-machine/sc-memory/tests/sc-memory/fs-storage/deprecated-kb" diff --git a/sc-memory/tests/scs/units/test_ast.cpp b/sc-memory/tests/scs/units/test_ast.cpp index 58425ae0eb..22c7db1a4a 100644 --- a/sc-memory/tests/scs/units/test_ast.cpp +++ b/sc-memory/tests/scs/units/test_ast.cpp @@ -10,6 +10,8 @@ #include "test_scs_utils.hpp" +using ScJson = nlohmann::json; + TEST(scs_ast, CorrectAST1) { sc_char const * data = "x -> y;;"; @@ -142,7 +144,7 @@ TEST(scs_ast, CorrectAST1) "ruleType": "syntax", "token": "" } - })"_json.dump(), ast); + })"_json, ScJson::parse(ast)); } TEST(scs_ast, CorrectAST2) @@ -390,7 +392,7 @@ TEST(scs_ast, CorrectAST2) "ruleType": "syntax", "token": "" } - })"_json.dump(), ast); + })"_json, ScJson::parse(ast)); } TEST(scs_ast, IncorrectAST1) @@ -454,7 +456,7 @@ TEST(scs_ast, IncorrectAST1) "ruleType": "syntax", "token": "" } - })"_json.dump(), ast); + })"_json, ScJson::parse(ast)); } TEST(scs_ast, IncorrectAST2) @@ -618,7 +620,7 @@ TEST(scs_ast, IncorrectAST2) "ruleType": "syntax", "token": "" } - })"_json.dump(), ast); + })"_json, ScJson::parse(ast)); } TEST(scs_ast, IncorrectAST3) @@ -800,5 +802,5 @@ TEST(scs_ast, IncorrectAST3) "ruleType": "syntax", "token": "" } - })"_json.dump(), ast); + })"_json, ScJson::parse(ast)); } From e053a9aa26ae7551f23cd2ca6fa981758eb4c16d Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Wed, 7 Jun 2023 11:33:34 +0300 Subject: [PATCH 10/12] [cmake] Add nlohamn_json library dependency --- sc-memory/sc-memory/CMakeLists.txt | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/sc-memory/sc-memory/CMakeLists.txt b/sc-memory/sc-memory/CMakeLists.txt index f576ca5f18..2b573b4854 100644 --- a/sc-memory/sc-memory/CMakeLists.txt +++ b/sc-memory/sc-memory/CMakeLists.txt @@ -33,21 +33,14 @@ target_include_directories(sc-memory PRIVATE ${SC_MEMORY_SRC} ) -if(${WIN32}) - target_link_libraries(sc-memory - sc-core - ${LIBCURL_LIBRARIES} - antlr4_static - ) -elseif(${UNIX}) - target_link_libraries(sc-memory - sc-core - antlr4_static - ${LIBCURL_LIBRARIES} - ${Boost_LIBRARIES} - ) -endif(${WIN32}) - +find_package(nlohmann_json) +target_link_libraries(sc-memory + sc-core + antlr4_static + ${LIBCURL_LIBRARIES} + ${Boost_LIBRARIES} + nlohmann_json::nlohmann_json +) sc_codegen_ex(sc-memory ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/generated") add_dependencies(sc-memory sc-core From 4dc651c976a6621367902ba744a7765fef67c08a Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Sat, 17 Jun 2023 18:50:30 +0300 Subject: [PATCH 11/12] Review fixes --- sc-memory/sc-memory/scs/ASTJsonListener.hpp | 3 +-- .../fs-storage/deprecated-kb/segments.scdb | Bin 0 -> 2883628 bytes .../string_offsets_link_hashes.scdb | Bin 0 -> 2456 bytes .../fs-storage/deprecated-kb/strings1.scdb | Bin 0 -> 2074 bytes .../deprecated-kb/term_string_offsets.scdb | Bin 0 -> 3788 bytes 5 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 sc-memory/tests/sc-memory/fs-storage/deprecated-kb/segments.scdb create mode 100644 sc-memory/tests/sc-memory/fs-storage/deprecated-kb/string_offsets_link_hashes.scdb create mode 100644 sc-memory/tests/sc-memory/fs-storage/deprecated-kb/strings1.scdb create mode 100644 sc-memory/tests/sc-memory/fs-storage/deprecated-kb/term_string_offsets.scdb diff --git a/sc-memory/sc-memory/scs/ASTJsonListener.hpp b/sc-memory/sc-memory/scs/ASTJsonListener.hpp index 9105cfe039..2b13d45cd0 100644 --- a/sc-memory/sc-memory/scs/ASTJsonListener.hpp +++ b/sc-memory/sc-memory/scs/ASTJsonListener.hpp @@ -1,9 +1,8 @@ #pragma once +#include "nlohmann/json.hpp" #include "antlr4-runtime.h" -#include -#include "nlohmann/json.hpp" using ScJson = nlohmann::json; namespace scs diff --git a/sc-memory/tests/sc-memory/fs-storage/deprecated-kb/segments.scdb b/sc-memory/tests/sc-memory/fs-storage/deprecated-kb/segments.scdb new file mode 100644 index 0000000000000000000000000000000000000000..3cf8daa2af1db327e3c1eff8c06606d3c3146f01 GIT binary patch literal 2883628 zcmeF)KaX7bg5PIq#S!mnwc6EsrQL-iUeACR3Y-~mV!(h%v<)e6bhu|BqGY1YhX5d#~`0x4Esl)R*tUAp_&9b-W_R~PKi^b~d z;-{Ya^4!B7-hc1O`u6YqM}PWn|M&mTS5Myk&;Q~-{lkCpU;StQ{;&Vp)Bp1S`&Zxm zTmRcP|JNV?oqzt{UH#+#`@jA-{)Z?3_<#JTKYjnt{@b7ar+@d~{9FI)zx?)}{ulr9 zKlwlYoB#8V{=@&}FTVcY|KI=oKmOPMgTJ-j<(-$t?Y`t~pFjPh=_}m+`CSiUc?{2g zHE#98AN*Br`4@ij<n5w@?8A-x63cSTrQk^TyA^1zi+1H{OWl7 zSBH(osNI!-H{xX*=`z-yf$h|K096;N>xFcXI6Sn`wXN z zUnD#{JP+%+*Kw}l&Gi0#pR&W{<#{{Z-#63#&d0q^p8T}A?a7^-xnjBB^)ZZd4L8&K zZEk%tZuX%5H$xuW?#1QzwtIv8g4@n9bkHF$i%0RA-)`zS_d1S)Umr8P-fZ9Ywuke- zzrP&!PTvQyxotb{U0z;q+xs1lVH^ivA3yE-;``nEy1jmR483mevfIvObkL!%5gso0 zFrWW@IVIfx9^j?#b|(+#f2aMOk9()@gBUlv=+CU@hlhXjd(*M+;XdZy&GyITF>J3r z|1-CpyXc@pUm-j^JP+%+*RjFp--1^{N=Xi?`eDOa@+MWTpjLX zd#m|p%Wcp7+NamKt!6dB0}l_?!+P#@oNIVGy?;HpZr&EZr~CV6+TZ!Oclm_nw#(1& z`ncS7eGKDV!?WrA#rUP;+c+-1?6`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ZU09$Ld6c;KN0cxVlO;DLu0;Gs4Afd?L1fQQ!b2OfB6 z0UlbzA9&!Q1$bx;f8c?K7T}>Z{DB7^T7ZYv@CP1vXaOEt!ykCyp#^wo4S(Q)hZf+W zHT;1G9$J8h*6;@&cxVA0TEicB;GqS0Xbpehfrl30p*8%02Oe60ht}{19(ZU09$Ld6 zc;KN0cxVlO;DLu0;Gs4Afd?L1fQQ!b2OfB60UlbzA9&!Q1$bx;f8c?K7T}>Z{DB7^ zT7ZYv@CP1vXaOEt!ykCyp#^wo4S(Q)hZf+WHT;1G9$J8h*6;@&cxVA0TEicB;GqS0 zXbpehfrl30p*8%02Oe60ht}{19(ZU09$Ld6c;KN0cxVlO;DLu0;Gs4Afd?L1fQQ!b Hhu^~h5tj=z literal 0 HcmV?d00001 diff --git a/sc-memory/tests/sc-memory/fs-storage/deprecated-kb/string_offsets_link_hashes.scdb b/sc-memory/tests/sc-memory/fs-storage/deprecated-kb/string_offsets_link_hashes.scdb new file mode 100644 index 0000000000000000000000000000000000000000..06fdb660e20c6a6c6827cab8ad3a7c1ed5c8e561 GIT binary patch literal 2456 zcmajfJ7`ov6vpxE#&LYb#Q1(y4&Fe-PQf4|SX{6XOlcv(V#P`n1g&g_0Ywn(6w){l zM1x?FMiCKVD!~wJv=FuMQCL_=AccbGKf-=Z(oF6zXTCXeZgzXV`S-KRmd35NU#|09 zJ>Yko{h@lq->n(+jPGNu^^W~V!~=e`H<%Og-{Kh`Cis6oeS8xS_{h*;ezwQvwag(> zKf^gSf0p{XRL|6(V6E=RJue>ctI|)zdvb2VugKgoeo^M*)>?`ixIX{{{apb8zdd&nX64=N9mv(r1THNPff*GLM>*@F#L^#y?8FTW^iLk$jK8 zkogDvm-OG^b27Jxe-_X9y!2o2FOu&z7<7{3@kMzr0so`U^IlfsnwIAlI4S!QdAFpm zjGvXc7W}llhp^ECrsW6Kag|%u;q`72mF)FyTf-&KN*jbv!DAfNk4`9 zOENdV$u^vl`asTcR<<>P`X!lL!taS^{I2w0@P~Tth#j~nbBHuBD&ErHd+DU|jW-1L2Kn@oW!V^8**$ob2(GHc!KD z@oEl|-+T#6!?Yo_1jE1(Z4`$t+L_(F2s;l{vt-uTZ&hN}wk$S9xy5BI7zOeVm#&3u z`#DwJ!W8+>5Lqe#(vVgTuq3-4w2?iM<~V7k>Zw_X(#YW;*oQPawuQo4PLE1<)(ZM9 zc0Xyme;)p2Srtihn{2BUlAdL_iis$r{1T~dxnN1Gh-uH|?V?eyA==6jGWuiDhdb1# z6&nNGgM0)GOnh*|sbS3m#U1DS3I%VCHZ}*jjg02ih`A`f1t523ebR>Y*4oyWyyZ+i zL(*f;3vA!sQ>xL)h%6{{gaIx+V|z>qw%30y@;zERzJ8PVMUHGtUIjT}`x)Ulz>Q%* zIHRM!Q*szN^6Q+3Q346Xa&Z)vO@yC~nyN(iho9zjWT;@o`l^{6NiFiLQ1ovg1p#LB zL^B&}VlH>MFDf+hiMCh)5Fu+SQ0!UQ%_|>`uEh@Nb2XS?z4b)WR(|qgvcCyGLSviF ztdu)~ACMTIMSY{B6Y@X>>NHRHk@FashMzas*%*`FS@kQNW2JX^Vn)?aNOuGLLzED_ z$geM8*|$Y8+JvVCX`3p_`&hjS^{?VVR7DolwGLdkmnO;ls5m(f?*!ML)5I&~q(IEM n2q%5H+$eOBqtN!n*;c!_wG4w^5>zp=sRhZZgipN@y~zIoxA_Rv literal 0 HcmV?d00001 diff --git a/sc-memory/tests/sc-memory/fs-storage/deprecated-kb/term_string_offsets.scdb b/sc-memory/tests/sc-memory/fs-storage/deprecated-kb/term_string_offsets.scdb new file mode 100644 index 0000000000000000000000000000000000000000..4762707e4b0d2ac1ae0df6da4d2c55522027086b GIT binary patch literal 3788 zcmb`KKd4+q6vnSF{)vBLL{dd5*0t*vl5=UZ?!(i+4d;r9=mrX<9CnEHR)or z_cW42+L*+2zLCxW`RnxtC~fMrDQzJ+Ed(a%BiWN3GuJnz6L+s%n9?>%uXP>mAaUB5 z&Vb#A^6;CWn8SgY-RYuy2D2wbHpY4$3yT7?Ju)sbS2GoqmOM)PIvD4`Fw@v(l6wtF8*yse+vU@`a zP%#Yeid+Q7?Gv4tjM`J8QvFk$9>tK$kg>2Ki&_d-d6y7=Ar57{7`jvp|#FSY)n^|(B~DwiK={YvXga`(PgV2`TO1)#mG4G9^=+02D8 zQ5+Mdzjf@ee7>jyM6|CK&FDLlwnlI9_^^!qsr9&w&b6LVVDD*tMb4o1fXrUi`m7@Q zOe>ZDf&Big6{3~S^wh*xmYYB1#3EUw9A`pQkPD>axENNY@D*eTpu}5NTWky{yTXj&nQK!)^1vA)5z$ivsnI*g zL$s2l>TnS1vVtcZP_|SF6~#q(Q6)?D04Sb=gYR{M+Mc`G&Fpa@0krG9j?=nKCa31W zSeMSahS0Fw=q;+uorq-!c|#wFn#<-dL8b&Cj)YSZM2gpLT(zI>=0yB><+R~%I6fjI zj11THn;DXsj8~iKjmd;TiBXUthtY~LfVqibjJbi~lF5z{gh{nK<)#sH_5aN&?7$^O znnqRt6c$NNW%JnCEB>f@h+g8Vq=)FWl$(2s+>q(+Q=f9}!xRj>lxC zhH;s4X)i4;Ly0${dDXz7L1-mPB$p}Q=|J&sg9H!te+?9dVL3Otn7U{LqFmf|y)*0K zVf|ElzcaBh$gH1gFL=f$=038x@6m2}hDSo?=30bvA)dEKi}vP`Z2#LMA6Hb>-CC;U amYU)|Cfhu}pgUjtHmUSKNq(ITW9dJOqZsr6 literal 0 HcmV?d00001 From d7b4dcb6ecd4d0792a9a4b51d059570f3dac11c2 Mon Sep 17 00:00:00 2001 From: NikitaZotov Date: Sat, 17 Jun 2023 19:01:31 +0300 Subject: [PATCH 12/12] Review fixes --- sc-memory/sc-memory/scs/scs_parser.cpp | 1 - sc-memory/sc-memory/scs/scs_parser.hpp | 2 ++ sc-memory/tests/sc-memory/fs-storage/test_defines.hpp | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sc-memory/sc-memory/scs/scs_parser.cpp b/sc-memory/sc-memory/scs/scs_parser.cpp index f6cb21f26b..fbbcf459cb 100644 --- a/sc-memory/sc-memory/scs/scs_parser.cpp +++ b/sc-memory/sc-memory/scs/scs_parser.cpp @@ -30,7 +30,6 @@ #include "scsLexer.h" #include "scsParser.h" -#include "ASTJsonListener.hpp" #include diff --git a/sc-memory/sc-memory/scs/scs_parser.hpp b/sc-memory/sc-memory/scs/scs_parser.hpp index 10e4595120..2ab359cae8 100644 --- a/sc-memory/sc-memory/scs/scs_parser.hpp +++ b/sc-memory/sc-memory/scs/scs_parser.hpp @@ -10,6 +10,8 @@ #include "sc-memory/scs/scs_types.hpp" +#include "ASTJsonListener.hpp" + #include #include diff --git a/sc-memory/tests/sc-memory/fs-storage/test_defines.hpp b/sc-memory/tests/sc-memory/fs-storage/test_defines.hpp index fbdd1f34e8..dc60f33324 100644 --- a/sc-memory/tests/sc-memory/fs-storage/test_defines.hpp +++ b/sc-memory/tests/sc-memory/fs-storage/test_defines.hpp @@ -1,4 +1,3 @@ #pragma once -#define SC_DEPRECATED_DICTIONARY_FS_MEMORY_PATH \ - "/home/nikita/apps/ostis/ostis-ai/ostis-web-platform/sc-machine/sc-memory/tests/sc-memory/fs-storage/deprecated-kb" +#define SC_DEPRECATED_DICTIONARY_FS_MEMORY_PATH "/home/nikita/apps/ostis/ostis-ai/ostis-web-platform/sc-machine/sc-memory/tests/sc-memory/fs-storage/deprecated-kb"