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; |
Václav Kubernát | 7707cae | 2020-01-16 12:04:53 +0100 | [diff] [blame] | 26 | |
| 27 | struct { |
| 28 | schemaPath_ m_location; |
| 29 | ModuleNodePair m_node; |
| 30 | } m_tmpListKeyLeafPath; |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 31 | bool m_errorHandled = false; |
Václav Kubernát | ac035d6 | 2019-02-18 10:59:08 +0100 | [diff] [blame] | 32 | bool m_completing = false; |
Václav Kubernát | 4108e0d | 2018-10-29 13:32:22 +0100 | [diff] [blame] | 33 | std::set<std::string> m_suggestions; |
| 34 | // Iterator pointing to where suggestions were created |
| 35 | std::string::const_iterator m_completionIterator; |
Václav Kubernát | 4c32548 | 2019-04-11 17:51:55 +0200 | [diff] [blame] | 36 | // If the parser determines that suggestions are unambiguous (after |
| 37 | // filtering by prefix), this suffix gets added to the completion (for |
| 38 | // example a left bracket after a list) |
| 39 | std::string m_completionSuffix; |
Václav Kubernát | 72749c6 | 2020-01-03 16:47:34 +0100 | [diff] [blame] | 40 | |
| 41 | private: |
| 42 | boost::variant<dataPath_, schemaPath_> m_curPath; |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 43 | }; |