blob: a2e68fc3e3d8c24a8f0d097de35f8ac95ab1540e [file] [log] [blame]
Václav Kubernát0a2a2e82018-05-11 13:59:12 +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
9#pragma once
10
Václav Kubernát24df80e2018-06-06 15:18:03 +020011#include "ast_commands.hpp"
Václav Kubernát0a2a2e82018-05-11 13:59:12 +020012#include "ast_handlers.hpp"
13
Václav Kubernát60d6f292018-05-25 09:45:32 +020014
Václav Kubernát0a2a2e82018-05-11 13:59:12 +020015x3::rule<keyValue_class, keyValue_> const keyValue = "keyValue";
Václav Kubernát89728d82018-09-13 16:28:28 +020016x3::rule<key_identifier_class, std::string> const key_identifier = "key_identifier";
Václav Kubernát744f57f2018-06-29 22:46:26 +020017x3::rule<node_identifier_class, std::string> const node_identifier = "node_identifier";
18x3::rule<module_identifier_class, std::string> const module_identifier = "module_identifier";
Václav Kubernát0a2a2e82018-05-11 13:59:12 +020019x3::rule<listPrefix_class, std::string> const listPrefix = "listPrefix";
20x3::rule<listSuffix_class, std::vector<keyValue_>> const listSuffix = "listSuffix";
21x3::rule<listElement_class, listElement_> const listElement = "listElement";
Václav Kubernát2eaceb82018-10-08 19:56:30 +020022x3::rule<list_class, list_> const list = "list";
Václav Kubernát60d6f292018-05-25 09:45:32 +020023x3::rule<nodeup_class, nodeup_> const nodeup = "nodeup";
Václav Kubernát0a2a2e82018-05-11 13:59:12 +020024x3::rule<container_class, container_> const container = "container";
Václav Kubernát07204242018-06-04 18:12:09 +020025x3::rule<leaf_class, leaf_> const leaf = "leaf";
Václav Kubernát744f57f2018-06-29 22:46:26 +020026x3::rule<module_class, module_> const module = "module";
Václav Kubernát2eaceb82018-10-08 19:56:30 +020027x3::rule<dataNode_class, dataNode_> const dataNode = "dataNode";
28x3::rule<schemaNode_class, schemaNode_> const schemaNode = "schemaNode";
Václav Kubernát37171a12018-08-31 17:01:48 +020029x3::rule<absoluteStart_class, Scope> const absoluteStart = "absoluteStart";
Václav Kubernát2eaceb82018-10-08 19:56:30 +020030x3::rule<schemaPath_class, schemaPath_> const schemaPath = "schemaPath";
Václav Kubernátd6fd2492018-11-19 15:11:16 +010031x3::rule<trailingSlash_class, TrailingSlash> const trailingSlash = "trailingSlash";
Václav Kubernát5c75b252018-10-10 18:33:47 +020032x3::rule<dataNodeList_class, decltype(dataPath_::m_nodes)::value_type> const dataNodeList = "dataNodeList";
33x3::rule<dataNodesListEnd_class, decltype(dataPath_::m_nodes)> const dataNodesListEnd = "dataNodesListEnd";
34x3::rule<dataPathListEnd_class, dataPath_> const dataPathListEnd = "dataPathListEnd";
Václav Kubernát2eaceb82018-10-08 19:56:30 +020035x3::rule<dataPath_class, dataPath_> const dataPath = "dataPath";
36x3::rule<leaf_path_class, dataPath_> const leafPath = "leafPath";
Václav Kubernát6797df02019-03-18 20:21:50 +010037x3::rule<presenceContainerPath_class, dataPath_> const presenceContainerPath = "presenceContainerPath";
Václav Kubernátf5f64f02019-03-19 17:15:47 +010038x3::rule<listInstancePath_class, dataPath_> const listInstancePath = "listInstancePath";
Václav Kubernátebca2552018-06-08 19:06:02 +020039
40x3::rule<leaf_data_class, leaf_data_> const leaf_data = "leaf_data";
41x3::rule<leaf_data_enum_class, enum_> const leaf_data_enum = "leaf_data_enum";
42x3::rule<leaf_data_decimal_class, double> const leaf_data_decimal = "leaf_data_decimal";
43x3::rule<leaf_data_bool_class, bool> const leaf_data_bool = "leaf_data_bool";
44x3::rule<leaf_data_int_class, int32_t> const leaf_data_int = "leaf_data_int";
45x3::rule<leaf_data_uint_class, uint32_t> const leaf_data_uint = "leaf_data_uint";
46x3::rule<leaf_data_string_class, std::string> const leaf_data_string = "leaf_data_string";
Václav Kubernátab538992019-03-06 15:30:50 +010047x3::rule<leaf_data_binary_data_class, std::string> const leaf_data_binary_data = "leaf_data_binary_data";
48x3::rule<leaf_data_binary_class, binary_> const leaf_data_binary = "leaf_data_binary";
Václav Kubernátebca2552018-06-08 19:06:02 +020049
Václav Kubernát6d791432018-10-25 16:00:35 +020050x3::rule<discard_class, discard_> const discard = "discard";
Václav Kubernát11afac72018-07-18 14:59:53 +020051x3::rule<ls_class, ls_> const ls = "ls";
Václav Kubernát0a2a2e82018-05-11 13:59:12 +020052x3::rule<cd_class, cd_> const cd = "cd";
Václav Kubernát07204242018-06-04 18:12:09 +020053x3::rule<set_class, set_> const set = "set";
Václav Kubernátb6ff0b62018-08-30 16:14:53 +020054x3::rule<get_class, get_> const get = "get";
Václav Kubernátb61336d2018-05-28 17:35:03 +020055x3::rule<create_class, create_> const create = "create";
56x3::rule<delete_class, delete_> const delete_rule = "delete_rule";
Václav Kubernát812ee282018-08-30 17:10:03 +020057x3::rule<commit_class, commit_> const commit = "commit";
Václav Kubernát054cc992019-02-21 14:23:52 +010058x3::rule<help_class, help_> const help = "help";
Václav Kubernátb61336d2018-05-28 17:35:03 +020059x3::rule<command_class, command_> const command = "command";
Václav Kubernát0a2a2e82018-05-11 13:59:12 +020060
Václav Kubernát4108e0d2018-10-29 13:32:22 +010061x3::rule<initializePath_class, x3::unused_type> const initializePath = "initializePath";
62x3::rule<createPathSuggestions_class, x3::unused_type> const createPathSuggestions = "createPathSuggestions";
Václav Kubernát329c6c32019-02-06 16:41:53 +010063x3::rule<createKeySuggestions_class, x3::unused_type> const createKeySuggestions = "createKeySuggestions";
64x3::rule<suggestKeysEnd_class, x3::unused_type> const suggestKeysEnd = "suggestKeysEnd";
Václav Kubernát57272422019-02-08 12:48:24 +010065x3::rule<createCommandSuggestions_class, x3::unused_type> const createCommandSuggestions = "createCommandSuggestions";
Václav Kubernátac035d62019-02-18 10:59:08 +010066x3::rule<completing_class, x3::unused_type> const completing = "completing";
Václav Kubernát989b5de2019-02-20 16:28:35 +010067x3::rule<createEnumSuggestions_class, x3::unused_type> const createEnumSuggestions = "createEnumSuggestions";
Václav Kubernát5c75b252018-10-10 18:33:47 +020068
Václav Kubernát41378452018-06-06 16:29:40 +020069#if __clang__
70#pragma GCC diagnostic push
71#pragma GCC diagnostic ignored "-Woverloaded-shift-op-parentheses"
72#endif
Václav Kubernát0a2a2e82018-05-11 13:59:12 +020073
Václav Kubernát89728d82018-09-13 16:28:28 +020074auto const key_identifier_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +010075 lexeme[
76 ((alpha | char_("_")) >> *(alnum | char_("_") | char_("-") | char_(".")))
77 ];
Václav Kubernát89728d82018-09-13 16:28:28 +020078
79auto const quotedValue =
Václav Kubernátbf083ec2019-02-19 13:58:09 +010080 ('\'' > +(char_-'\'') > '\'') |
81 ('\"' > +(char_-'\"') > '\"');
Václav Kubernát89728d82018-09-13 16:28:28 +020082
83auto const number =
Václav Kubernátbf083ec2019-02-19 13:58:09 +010084 +x3::digit;
Václav Kubernát89728d82018-09-13 16:28:28 +020085
Václav Kubernát329c6c32019-02-06 16:41:53 +010086auto const createKeySuggestions_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +010087 x3::eps;
Václav Kubernát329c6c32019-02-06 16:41:53 +010088
89auto const suggestKeysEnd_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +010090 x3::eps;
Václav Kubernát329c6c32019-02-06 16:41:53 +010091
Václav Kubernát0a2a2e82018-05-11 13:59:12 +020092auto const keyValue_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +010093 key_identifier > '=' > (quotedValue | number);
Václav Kubernát329c6c32019-02-06 16:41:53 +010094
95auto const keyValueWrapper =
Václav Kubernátbf083ec2019-02-19 13:58:09 +010096 lexeme['[' > createKeySuggestions > keyValue > suggestKeysEnd > ']'];
Václav Kubernát0a2a2e82018-05-11 13:59:12 +020097
Václav Kubernát744f57f2018-06-29 22:46:26 +020098auto const module_identifier_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +010099 lexeme[
100 ((alpha | char_("_")) >> *(alnum | char_("_") | char_("-") | char_(".")))
101 ];
Václav Kubernát744f57f2018-06-29 22:46:26 +0200102
103auto const node_identifier_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100104 lexeme[
105 ((alpha | char_("_")) >> *(alnum | char_("_") | char_("-") | char_(".")))
106 ];
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200107
108auto const listPrefix_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100109 node_identifier >> &char_('[');
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200110
Václav Kubernát7e4e82f2018-05-14 20:04:58 +0200111// even though we don't allow no keys to be supplied, the star allows me to check which keys are missing
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200112auto const listSuffix_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100113 *keyValueWrapper;
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200114
115auto const listElement_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100116 listPrefix > listSuffix;
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200117
Václav Kubernát2eaceb82018-10-08 19:56:30 +0200118auto const list_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100119 node_identifier >> !char_('[');
Václav Kubernát2eaceb82018-10-08 19:56:30 +0200120
Václav Kubernát60d6f292018-05-25 09:45:32 +0200121auto const nodeup_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100122 lit("..") > x3::attr(nodeup_());
Václav Kubernát60d6f292018-05-25 09:45:32 +0200123
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200124auto const container_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100125 node_identifier;
Václav Kubernát744f57f2018-06-29 22:46:26 +0200126
127auto const module_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100128 module_identifier >> x3::no_skip[':'] >> !x3::no_skip[space];
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200129
Václav Kubernát07204242018-06-04 18:12:09 +0200130auto const leaf_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100131 node_identifier;
Václav Kubernát07204242018-06-04 18:12:09 +0200132
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100133auto const createPathSuggestions_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100134 x3::eps;
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100135
Václav Kubernát07204242018-06-04 18:12:09 +0200136// leaf cannot be in the middle of a path, however, I need the grammar's attribute to be a vector of variants
Václav Kubernát2eaceb82018-10-08 19:56:30 +0200137auto const schemaNode_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100138 createPathSuggestions >> -(module) >> (container | list | nodeup | leaf);
Václav Kubernát2eaceb82018-10-08 19:56:30 +0200139
140auto const dataNode_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100141 createPathSuggestions >> -(module) >> (container | listElement | nodeup | leaf);
Václav Kubernát744f57f2018-06-29 22:46:26 +0200142
Václav Kubernát37171a12018-08-31 17:01:48 +0200143auto const absoluteStart_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100144 x3::omit['/'] >> x3::attr(Scope::Absolute);
Václav Kubernát37171a12018-08-31 17:01:48 +0200145
Václav Kubernátd6fd2492018-11-19 15:11:16 +0100146auto const trailingSlash_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100147 x3::omit['/'] >> x3::attr(TrailingSlash::Present);
Václav Kubernátd6fd2492018-11-19 15:11:16 +0100148
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100149auto const space_separator =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100150 x3::omit[x3::no_skip[space]];
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100151
Václav Kubernátac035d62019-02-18 10:59:08 +0100152// This is a pseudo-parser, that fails if we're not completing a command
153auto const completing_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100154 x3::eps;
Václav Kubernátac035d62019-02-18 10:59:08 +0100155
Václav Kubernát37171a12018-08-31 17:01:48 +0200156// I have to insert an empty vector to the first alternative, otherwise they won't have the same attribute
Václav Kubernát2eaceb82018-10-08 19:56:30 +0200157auto const dataPath_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100158 initializePath >> absoluteStart >> createPathSuggestions >> x3::attr(decltype(dataPath_::m_nodes)()) >> x3::attr(TrailingSlash::NonPresent) >> x3::eoi |
159 initializePath >> -(absoluteStart >> createPathSuggestions) >> dataNode % '/' >> (trailingSlash >> createPathSuggestions >> (completing | x3::eoi) | (&space_separator | x3::eoi));
Václav Kubernát2eaceb82018-10-08 19:56:30 +0200160
Václav Kubernát5c75b252018-10-10 18:33:47 +0200161auto const dataNodeList_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100162 -(module) >> createPathSuggestions >> list;
Václav Kubernát5c75b252018-10-10 18:33:47 +0200163
164// This intermediate rule is mandatory, because we need the first alternative
165// to be collapsed to a vector. If we didn't use the intermediate rule,
166// Spirit wouldn't know we want it to collapse.
167// https://github.com/boostorg/spirit/issues/408
168auto const dataNodesListEnd_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100169 initializePath >> dataNode % '/' >> '/' >> dataNodeList >> -(&char_('/') >> createPathSuggestions) |
170 initializePath >> x3::attr(decltype(dataPath_::m_nodes)()) >> dataNodeList;
Václav Kubernát5c75b252018-10-10 18:33:47 +0200171
172auto const dataPathListEnd_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100173 initializePath >> absoluteStart >> createPathSuggestions >> x3::attr(decltype(dataPath_::m_nodes)()) >> x3::attr(TrailingSlash::NonPresent) >> x3::eoi |
174 initializePath >> -(absoluteStart >> createPathSuggestions) >> dataNodesListEnd >> (trailingSlash >> createPathSuggestions >> (completing | x3::eoi) | (&space_separator | x3::eoi));
Václav Kubernát5c75b252018-10-10 18:33:47 +0200175
Václav Kubernát2eaceb82018-10-08 19:56:30 +0200176auto const schemaPath_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100177 initializePath >> absoluteStart >> createPathSuggestions >> x3::attr(decltype(schemaPath_::m_nodes)()) >> x3::attr(TrailingSlash::NonPresent) >> x3::eoi |
178 initializePath >> -(absoluteStart >> createPathSuggestions) >> schemaNode % '/' >> (trailingSlash >> createPathSuggestions >> (completing | x3::eoi) | (&space_separator | x3::eoi));
Václav Kubernát07204242018-06-04 18:12:09 +0200179
Václav Kubernát0b0272f2018-06-13 14:13:08 +0200180auto const leafPath_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100181 dataPath;
Václav Kubernát0b0272f2018-06-13 14:13:08 +0200182
Václav Kubernát6797df02019-03-18 20:21:50 +0100183auto const presenceContainerPath_def =
184 dataPath;
185
Václav Kubernátf5f64f02019-03-19 17:15:47 +0100186auto const listInstancePath_def =
187 dataPath;
188
Václav Kubernát989b5de2019-02-20 16:28:35 +0100189auto const createEnumSuggestions_def =
190 x3::eps;
191
Václav Kubernátebca2552018-06-08 19:06:02 +0200192auto const leaf_data_enum_def =
Václav Kubernát989b5de2019-02-20 16:28:35 +0100193 createEnumSuggestions >> +char_;
Václav Kubernátebca2552018-06-08 19:06:02 +0200194auto const leaf_data_decimal_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100195 double_;
Václav Kubernátebca2552018-06-08 19:06:02 +0200196
197struct bool_symbol_table : x3::symbols<bool> {
198 bool_symbol_table()
199 {
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100200 add
201 ("true", true)
202 ("false", false);
Václav Kubernátebca2552018-06-08 19:06:02 +0200203 }
204} const bool_rule;
205
206auto const leaf_data_bool_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100207 bool_rule;
Václav Kubernátebca2552018-06-08 19:06:02 +0200208auto const leaf_data_int_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100209 int_;
Václav Kubernátebca2552018-06-08 19:06:02 +0200210auto const leaf_data_uint_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100211 uint_;
Václav Kubernátebca2552018-06-08 19:06:02 +0200212auto const leaf_data_string_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100213 *char_;
Václav Kubernátebca2552018-06-08 19:06:02 +0200214
Václav Kubernátab538992019-03-06 15:30:50 +0100215// This intermediate rule is neccessary for coercing to std::string.
216auto const leaf_data_binary_data_def =
217 +(x3::alnum | char_('+') | char_('/')) >> -char_('=') >> -char_('=');
218
219auto const leaf_data_binary_def =
220 leaf_data_binary_data;
221
Václav Kubernátebca2552018-06-08 19:06:02 +0200222auto const leaf_data_def =
Václav Kubernát0b0272f2018-06-13 14:13:08 +0200223x3::expect[
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100224 leaf_data_enum |
225 leaf_data_decimal |
226 leaf_data_bool |
227 leaf_data_int |
228 leaf_data_uint |
Václav Kubernátab538992019-03-06 15:30:50 +0100229 leaf_data_binary |
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100230 leaf_data_string];
Václav Kubernát07204242018-06-04 18:12:09 +0200231
Václav Kubernáte7d4aea2018-09-11 18:15:48 +0200232struct ls_options_table : x3::symbols<LsOption> {
233 ls_options_table()
234 {
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100235 add
236 ("--recursive", LsOption::Recursive);
Václav Kubernáte7d4aea2018-09-11 18:15:48 +0200237 }
238} const ls_options;
239
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100240// A "nothing" parser, which is used to indicate we tried to parse a path
241auto const initializePath_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100242 x3::eps;
Václav Kubernát5c75b252018-10-10 18:33:47 +0200243
Václav Kubernát11afac72018-07-18 14:59:53 +0200244auto const ls_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100245 ls_::name >> *(space_separator >> ls_options) >> -(space_separator >> (dataPathListEnd | dataPath | schemaPath));
Václav Kubernát11afac72018-07-18 14:59:53 +0200246
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200247auto const cd_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100248 cd_::name >> space_separator > dataPath;
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200249
Václav Kubernátb61336d2018-05-28 17:35:03 +0200250auto const create_def =
Václav Kubernátf5f64f02019-03-19 17:15:47 +0100251 create_::name >> space_separator > (presenceContainerPath | listInstancePath);
Václav Kubernátb61336d2018-05-28 17:35:03 +0200252
253auto const delete_rule_def =
Václav Kubernátf5f64f02019-03-19 17:15:47 +0100254 delete_::name >> space_separator > (presenceContainerPath | listInstancePath);
Václav Kubernát07204242018-06-04 18:12:09 +0200255
Václav Kubernátb6ff0b62018-08-30 16:14:53 +0200256auto const get_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100257 get_::name >> -(space_separator >> (dataPathListEnd | dataPath));
Václav Kubernátb6ff0b62018-08-30 16:14:53 +0200258
Václav Kubernát07204242018-06-04 18:12:09 +0200259auto const set_def =
Václav Kubernát989b5de2019-02-20 16:28:35 +0100260 set_::name >> space_separator > leafPath > space_separator > leaf_data;
Václav Kubernátb61336d2018-05-28 17:35:03 +0200261
Václav Kubernát812ee282018-08-30 17:10:03 +0200262auto const commit_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100263 commit_::name >> x3::attr(commit_());
Václav Kubernát812ee282018-08-30 17:10:03 +0200264
Václav Kubernát6d791432018-10-25 16:00:35 +0200265auto const discard_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100266 discard_::name >> x3::attr(discard_());
Václav Kubernát6d791432018-10-25 16:00:35 +0200267
Václav Kubernát054cc992019-02-21 14:23:52 +0100268struct command_names_table : x3::symbols<decltype(help_::m_cmd)> {
269 command_names_table()
270 {
271 boost::mpl::for_each<CommandTypes, boost::type<boost::mpl::_>>([this](auto cmd) {
272 add(commandNamesVisitor()(cmd), decltype(help_::m_cmd)(cmd));
273 });
274 }
275} const command_names;
276
277auto const help_def =
278 help_::name > createCommandSuggestions >> -command_names;
279
Václav Kubernát57272422019-02-08 12:48:24 +0100280auto const createCommandSuggestions_def =
Václav Kubernátbf083ec2019-02-19 13:58:09 +0100281 x3::eps;
Václav Kubernát57272422019-02-08 12:48:24 +0100282
Václav Kubernátb61336d2018-05-28 17:35:03 +0200283auto const command_def =
Václav Kubernát054cc992019-02-21 14:23:52 +0100284 createCommandSuggestions >> x3::expect[cd | create | delete_rule | set | commit | get | ls | discard | help];
Václav Kubernát41378452018-06-06 16:29:40 +0200285
286#if __clang__
287#pragma GCC diagnostic pop
288#endif
Václav Kubernátb61336d2018-05-28 17:35:03 +0200289
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200290BOOST_SPIRIT_DEFINE(keyValue)
Václav Kubernát89728d82018-09-13 16:28:28 +0200291BOOST_SPIRIT_DEFINE(key_identifier)
Václav Kubernát744f57f2018-06-29 22:46:26 +0200292BOOST_SPIRIT_DEFINE(node_identifier)
293BOOST_SPIRIT_DEFINE(module_identifier)
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200294BOOST_SPIRIT_DEFINE(listPrefix)
295BOOST_SPIRIT_DEFINE(listSuffix)
296BOOST_SPIRIT_DEFINE(listElement)
Václav Kubernát2eaceb82018-10-08 19:56:30 +0200297BOOST_SPIRIT_DEFINE(list)
Václav Kubernát60d6f292018-05-25 09:45:32 +0200298BOOST_SPIRIT_DEFINE(nodeup)
Václav Kubernát2eaceb82018-10-08 19:56:30 +0200299BOOST_SPIRIT_DEFINE(schemaNode)
300BOOST_SPIRIT_DEFINE(dataNode)
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200301BOOST_SPIRIT_DEFINE(container)
Václav Kubernát07204242018-06-04 18:12:09 +0200302BOOST_SPIRIT_DEFINE(leaf)
Václav Kubernát0b0272f2018-06-13 14:13:08 +0200303BOOST_SPIRIT_DEFINE(leafPath)
Václav Kubernát6797df02019-03-18 20:21:50 +0100304BOOST_SPIRIT_DEFINE(presenceContainerPath)
Václav Kubernátf5f64f02019-03-19 17:15:47 +0100305BOOST_SPIRIT_DEFINE(listInstancePath)
Václav Kubernát2eaceb82018-10-08 19:56:30 +0200306BOOST_SPIRIT_DEFINE(schemaPath)
307BOOST_SPIRIT_DEFINE(dataPath)
Václav Kubernát5c75b252018-10-10 18:33:47 +0200308BOOST_SPIRIT_DEFINE(dataNodeList)
309BOOST_SPIRIT_DEFINE(dataNodesListEnd)
310BOOST_SPIRIT_DEFINE(dataPathListEnd)
Václav Kubernát37171a12018-08-31 17:01:48 +0200311BOOST_SPIRIT_DEFINE(absoluteStart)
Václav Kubernátd6fd2492018-11-19 15:11:16 +0100312BOOST_SPIRIT_DEFINE(trailingSlash)
Václav Kubernát744f57f2018-06-29 22:46:26 +0200313BOOST_SPIRIT_DEFINE(module)
Václav Kubernátebca2552018-06-08 19:06:02 +0200314BOOST_SPIRIT_DEFINE(leaf_data)
315BOOST_SPIRIT_DEFINE(leaf_data_enum)
316BOOST_SPIRIT_DEFINE(leaf_data_decimal)
317BOOST_SPIRIT_DEFINE(leaf_data_bool)
318BOOST_SPIRIT_DEFINE(leaf_data_int)
319BOOST_SPIRIT_DEFINE(leaf_data_uint)
320BOOST_SPIRIT_DEFINE(leaf_data_string)
Václav Kubernátab538992019-03-06 15:30:50 +0100321BOOST_SPIRIT_DEFINE(leaf_data_binary_data)
322BOOST_SPIRIT_DEFINE(leaf_data_binary)
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100323BOOST_SPIRIT_DEFINE(initializePath)
Václav Kubernát07204242018-06-04 18:12:09 +0200324BOOST_SPIRIT_DEFINE(set)
Václav Kubernát812ee282018-08-30 17:10:03 +0200325BOOST_SPIRIT_DEFINE(commit)
Václav Kubernátb6ff0b62018-08-30 16:14:53 +0200326BOOST_SPIRIT_DEFINE(get)
Václav Kubernát11afac72018-07-18 14:59:53 +0200327BOOST_SPIRIT_DEFINE(ls)
Václav Kubernát6d791432018-10-25 16:00:35 +0200328BOOST_SPIRIT_DEFINE(discard)
Václav Kubernát0a2a2e82018-05-11 13:59:12 +0200329BOOST_SPIRIT_DEFINE(cd)
Václav Kubernátb61336d2018-05-28 17:35:03 +0200330BOOST_SPIRIT_DEFINE(create)
331BOOST_SPIRIT_DEFINE(delete_rule)
Václav Kubernát054cc992019-02-21 14:23:52 +0100332BOOST_SPIRIT_DEFINE(help)
Václav Kubernátb61336d2018-05-28 17:35:03 +0200333BOOST_SPIRIT_DEFINE(command)
Václav Kubernát4108e0d2018-10-29 13:32:22 +0100334BOOST_SPIRIT_DEFINE(createPathSuggestions)
Václav Kubernát329c6c32019-02-06 16:41:53 +0100335BOOST_SPIRIT_DEFINE(createKeySuggestions)
336BOOST_SPIRIT_DEFINE(suggestKeysEnd)
Václav Kubernát57272422019-02-08 12:48:24 +0100337BOOST_SPIRIT_DEFINE(createCommandSuggestions)
Václav Kubernátac035d62019-02-18 10:59:08 +0100338BOOST_SPIRIT_DEFINE(completing)
Václav Kubernát989b5de2019-02-20 16:28:35 +0100339BOOST_SPIRIT_DEFINE(createEnumSuggestions)