Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 1 | /* |
| 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át | 48fc383 | 2018-05-28 14:21:22 +0200 | [diff] [blame] | 9 | #include "schema.hpp" |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 10 | struct ParserContext { |
Václav Kubernát | 72749c6 | 2020-01-03 16:47:34 +0100 | [diff] [blame] | 11 | 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át | 48fc383 | 2018-05-28 14:21:22 +0200 | [diff] [blame] | 19 | const Schema& m_schema; |
Václav Kubernát | 72749c6 | 2020-01-03 16:47:34 +0100 | [diff] [blame] | 20 | const dataPath_ m_curPathOrig; |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 21 | boost::optional<std::string> m_curModule; |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 22 | std::string m_errorMsg; |
| 23 | std::string m_tmpListName; |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 24 | bool m_topLevelModulePresent = false; |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 25 | std::set<std::string> m_tmpListKeys; |
| 26 | bool m_errorHandled = false; |
Václav Kubernát | ac035d6 | 2019-02-18 10:59:08 +0100 | [diff] [blame] | 27 | bool m_completing = false; |
Václav Kubernát | 4108e0d | 2018-10-29 13:32:22 +0100 | [diff] [blame] | 28 | std::set<std::string> m_suggestions; |
| 29 | // Iterator pointing to where suggestions were created |
| 30 | std::string::const_iterator m_completionIterator; |
Václav Kubernát | 4c32548 | 2019-04-11 17:51:55 +0200 | [diff] [blame] | 31 | // 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át | 72749c6 | 2020-01-03 16:47:34 +0100 | [diff] [blame] | 35 | |
| 36 | private: |
| 37 | boost::variant<dataPath_, schemaPath_> m_curPath; |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 38 | }; |