blob: b20c6ab00ae1b5bacb045be9025028ac8b0bfb53 [file] [log] [blame]
Václav Kubernát195eeea2018-05-18 13:52:36 +02001/*
2 * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
3 * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
4 *
5 * Written by Václav Kubernát <kubervac@fit.cvut.cz>
6 *
7*/
8
Václav Kubernát48fc3832018-05-28 14:21:22 +02009#include "schema.hpp"
Václav Kubernát195eeea2018-05-18 13:52:36 +020010struct ParserContext {
Václav Kubernát72749c62020-01-03 16:47:34 +010011 ParserContext(const Schema& schema, const dataPath_& curDir);
12 schemaPath_ currentSchemaPath();
13 dataPath_ currentDataPath();
14 void clearPath();
15 void pushPathFragment(const dataNode_& node);
16 void pushPathFragment(const schemaNode_& node);
17 void resetPath();
18
Václav Kubernát48fc3832018-05-28 14:21:22 +020019 const Schema& m_schema;
Václav Kubernát72749c62020-01-03 16:47:34 +010020 const dataPath_ m_curPathOrig;
Václav Kubernát744f57f2018-06-29 22:46:26 +020021 boost::optional<std::string> m_curModule;
Václav Kubernát195eeea2018-05-18 13:52:36 +020022 std::string m_errorMsg;
23 std::string m_tmpListName;
Václav Kubernát744f57f2018-06-29 22:46:26 +020024 bool m_topLevelModulePresent = false;
Václav Kubernát195eeea2018-05-18 13:52:36 +020025 std::set<std::string> m_tmpListKeys;
26 bool m_errorHandled = false;
Václav Kubernátac035d62019-02-18 10:59:08 +010027 bool m_completing = false;
Václav Kubernát4108e0d2018-10-29 13:32:22 +010028 std::set<std::string> m_suggestions;
29 // Iterator pointing to where suggestions were created
30 std::string::const_iterator m_completionIterator;
Václav Kubernát4c325482019-04-11 17:51:55 +020031 // If the parser determines that suggestions are unambiguous (after
32 // filtering by prefix), this suffix gets added to the completion (for
33 // example a left bracket after a list)
34 std::string m_completionSuffix;
Václav Kubernát72749c62020-01-03 16:47:34 +010035
36private:
37 boost::variant<dataPath_, schemaPath_> m_curPath;
Václav Kubernát195eeea2018-05-18 13:52:36 +020038};