Change clang-format option and cleanup the code
Change-Id: I4157601771370962c3231a1f85185d50667d0d4a
diff --git a/src/grammars.hpp b/src/grammars.hpp
index f3dd6f9..3742e35 100644
--- a/src/grammars.hpp
+++ b/src/grammars.hpp
@@ -66,187 +66,187 @@
#endif
auto const key_identifier_def =
- lexeme[
- ((alpha | char_("_")) >> *(alnum | char_("_") | char_("-") | char_(".")))
- ];
+ lexeme[
+ ((alpha | char_("_")) >> *(alnum | char_("_") | char_("-") | char_(".")))
+ ];
auto const quotedValue =
- ('\'' > +(char_-'\'') > '\'') |
- ('\"' > +(char_-'\"') > '\"');
+ ('\'' > +(char_-'\'') > '\'') |
+ ('\"' > +(char_-'\"') > '\"');
auto const number =
- +x3::digit;
+ +x3::digit;
auto const createKeySuggestions_def =
- x3::eps;
+ x3::eps;
auto const suggestKeysEnd_def =
- x3::eps;
+ x3::eps;
auto const keyValue_def =
- key_identifier > '=' > (quotedValue | number);
+ key_identifier > '=' > (quotedValue | number);
auto const keyValueWrapper =
- lexeme['[' > createKeySuggestions > keyValue > suggestKeysEnd > ']'];
+ lexeme['[' > createKeySuggestions > keyValue > suggestKeysEnd > ']'];
auto const module_identifier_def =
- lexeme[
- ((alpha | char_("_")) >> *(alnum | char_("_") | char_("-") | char_(".")))
- ];
+ lexeme[
+ ((alpha | char_("_")) >> *(alnum | char_("_") | char_("-") | char_(".")))
+ ];
auto const node_identifier_def =
- lexeme[
- ((alpha | char_("_")) >> *(alnum | char_("_") | char_("-") | char_(".")))
- ];
+ lexeme[
+ ((alpha | char_("_")) >> *(alnum | char_("_") | char_("-") | char_(".")))
+ ];
auto const listPrefix_def =
- node_identifier >> &char_('[');
+ node_identifier >> &char_('[');
// even though we don't allow no keys to be supplied, the star allows me to check which keys are missing
auto const listSuffix_def =
- *keyValueWrapper;
+ *keyValueWrapper;
auto const listElement_def =
- listPrefix > listSuffix;
+ listPrefix > listSuffix;
auto const list_def =
- node_identifier >> !char_('[');
+ node_identifier >> !char_('[');
auto const nodeup_def =
- lit("..") > x3::attr(nodeup_());
+ lit("..") > x3::attr(nodeup_());
auto const container_def =
- node_identifier;
+ node_identifier;
auto const module_def =
- module_identifier >> x3::no_skip[':'] >> !x3::no_skip[space];
+ module_identifier >> x3::no_skip[':'] >> !x3::no_skip[space];
auto const leaf_def =
- node_identifier;
+ node_identifier;
auto const createPathSuggestions_def =
- x3::eps;
+ x3::eps;
// leaf cannot be in the middle of a path, however, I need the grammar's attribute to be a vector of variants
auto const schemaNode_def =
- createPathSuggestions >> -(module) >> (container | list | nodeup | leaf);
+ createPathSuggestions >> -(module) >> (container | list | nodeup | leaf);
auto const dataNode_def =
- createPathSuggestions >> -(module) >> (container | listElement | nodeup | leaf);
+ createPathSuggestions >> -(module) >> (container | listElement | nodeup | leaf);
auto const absoluteStart_def =
- x3::omit['/'] >> x3::attr(Scope::Absolute);
+ x3::omit['/'] >> x3::attr(Scope::Absolute);
auto const trailingSlash_def =
- x3::omit['/'] >> x3::attr(TrailingSlash::Present);
+ x3::omit['/'] >> x3::attr(TrailingSlash::Present);
auto const space_separator =
- x3::omit[x3::no_skip[space]];
+ x3::omit[x3::no_skip[space]];
// This is a pseudo-parser, that fails if we're not completing a command
auto const completing_def =
- x3::eps;
+ x3::eps;
// I have to insert an empty vector to the first alternative, otherwise they won't have the same attribute
auto const dataPath_def =
- initializePath >> absoluteStart >> createPathSuggestions >> x3::attr(decltype(dataPath_::m_nodes)()) >> x3::attr(TrailingSlash::NonPresent) >> x3::eoi |
- initializePath >> -(absoluteStart >> createPathSuggestions) >> dataNode % '/' >> (trailingSlash >> createPathSuggestions >> (completing | x3::eoi) | (&space_separator | x3::eoi));
+ initializePath >> absoluteStart >> createPathSuggestions >> x3::attr(decltype(dataPath_::m_nodes)()) >> x3::attr(TrailingSlash::NonPresent) >> x3::eoi |
+ initializePath >> -(absoluteStart >> createPathSuggestions) >> dataNode % '/' >> (trailingSlash >> createPathSuggestions >> (completing | x3::eoi) | (&space_separator | x3::eoi));
auto const dataNodeList_def =
- -(module) >> createPathSuggestions >> list;
+ -(module) >> createPathSuggestions >> list;
// This intermediate rule is mandatory, because we need the first alternative
// to be collapsed to a vector. If we didn't use the intermediate rule,
// Spirit wouldn't know we want it to collapse.
// https://github.com/boostorg/spirit/issues/408
auto const dataNodesListEnd_def =
- initializePath >> dataNode % '/' >> '/' >> dataNodeList >> -(&char_('/') >> createPathSuggestions) |
- initializePath >> x3::attr(decltype(dataPath_::m_nodes)()) >> dataNodeList;
+ initializePath >> dataNode % '/' >> '/' >> dataNodeList >> -(&char_('/') >> createPathSuggestions) |
+ initializePath >> x3::attr(decltype(dataPath_::m_nodes)()) >> dataNodeList;
auto const dataPathListEnd_def =
- initializePath >> absoluteStart >> createPathSuggestions >> x3::attr(decltype(dataPath_::m_nodes)()) >> x3::attr(TrailingSlash::NonPresent) >> x3::eoi |
- initializePath >> -(absoluteStart >> createPathSuggestions) >> dataNodesListEnd >> (trailingSlash >> createPathSuggestions >> (completing | x3::eoi) | (&space_separator | x3::eoi));
+ initializePath >> absoluteStart >> createPathSuggestions >> x3::attr(decltype(dataPath_::m_nodes)()) >> x3::attr(TrailingSlash::NonPresent) >> x3::eoi |
+ initializePath >> -(absoluteStart >> createPathSuggestions) >> dataNodesListEnd >> (trailingSlash >> createPathSuggestions >> (completing | x3::eoi) | (&space_separator | x3::eoi));
auto const schemaPath_def =
- initializePath >> absoluteStart >> createPathSuggestions >> x3::attr(decltype(schemaPath_::m_nodes)()) >> x3::attr(TrailingSlash::NonPresent) >> x3::eoi |
- initializePath >> -(absoluteStart >> createPathSuggestions) >> schemaNode % '/' >> (trailingSlash >> createPathSuggestions >> (completing | x3::eoi) | (&space_separator | x3::eoi));
+ initializePath >> absoluteStart >> createPathSuggestions >> x3::attr(decltype(schemaPath_::m_nodes)()) >> x3::attr(TrailingSlash::NonPresent) >> x3::eoi |
+ initializePath >> -(absoluteStart >> createPathSuggestions) >> schemaNode % '/' >> (trailingSlash >> createPathSuggestions >> (completing | x3::eoi) | (&space_separator | x3::eoi));
auto const leafPath_def =
- dataPath;
+ dataPath;
auto const leaf_data_enum_def =
- +char_;
+ +char_;
auto const leaf_data_decimal_def =
- double_;
+ double_;
struct bool_symbol_table : x3::symbols<bool> {
bool_symbol_table()
{
- add
- ("true", true)
- ("false", false);
+ add
+ ("true", true)
+ ("false", false);
}
} const bool_rule;
auto const leaf_data_bool_def =
- bool_rule;
+ bool_rule;
auto const leaf_data_int_def =
- int_;
+ int_;
auto const leaf_data_uint_def =
- uint_;
+ uint_;
auto const leaf_data_string_def =
- *char_;
+ *char_;
auto const leaf_data_def =
x3::expect[
- leaf_data_enum |
- leaf_data_decimal |
- leaf_data_bool |
- leaf_data_int |
- leaf_data_uint |
- leaf_data_string];
+ leaf_data_enum |
+ leaf_data_decimal |
+ leaf_data_bool |
+ leaf_data_int |
+ leaf_data_uint |
+ leaf_data_string];
struct ls_options_table : x3::symbols<LsOption> {
ls_options_table()
{
- add
- ("--recursive", LsOption::Recursive);
+ add
+ ("--recursive", LsOption::Recursive);
}
} const ls_options;
// A "nothing" parser, which is used to indicate we tried to parse a path
auto const initializePath_def =
- x3::eps;
+ x3::eps;
auto const ls_def =
- ls_::name >> *(space_separator >> ls_options) >> -(space_separator >> (dataPathListEnd | dataPath | schemaPath));
+ ls_::name >> *(space_separator >> ls_options) >> -(space_separator >> (dataPathListEnd | dataPath | schemaPath));
auto const cd_def =
- cd_::name >> space_separator > dataPath;
+ cd_::name >> space_separator > dataPath;
auto const create_def =
- create_::name >> space_separator > dataPath;
+ create_::name >> space_separator > dataPath;
auto const delete_rule_def =
- delete_::name >> space_separator > dataPath;
+ delete_::name >> space_separator > dataPath;
auto const get_def =
- get_::name >> -(space_separator >> (dataPathListEnd | dataPath));
+ get_::name >> -(space_separator >> (dataPathListEnd | dataPath));
auto const set_def =
- set_::name >> space_separator > leafPath > leaf_data;
+ set_::name >> space_separator > leafPath > leaf_data;
auto const commit_def =
- commit_::name >> x3::attr(commit_());
+ commit_::name >> x3::attr(commit_());
auto const discard_def =
- discard_::name >> x3::attr(discard_());
+ discard_::name >> x3::attr(discard_());
auto const createCommandSuggestions_def =
- x3::eps;
+ x3::eps;
auto const command_def =
- createCommandSuggestions >> x3::expect[cd | create | delete_rule | set | commit | get | ls | discard];
+ createCommandSuggestions >> x3::expect[cd | create | delete_rule | set | commit | get | ls | discard];
#if __clang__
#pragma GCC diagnostic pop