|
Haio 0.2.X
Homebrew Asset IO/CDN
|
#include "haio_codec.hpp"#include "haio_formats.hpp"#include <array>#include <boost/spirit/home/x3.hpp>#include <optional>#include <string>#include <string_view>

Go to the source code of this file.
Classes | |
| struct | Haio::Cli::Lexer::Rule |
| struct | Haio::Cli::Lexer::Note |
| struct | Haio::Cli::Lexer::Option |
| struct | Haio::Cli::Lexer::Word |
Namespaces | |
| namespace | Haio |
| namespace | Haio::Cli |
| namespace | Haio::Cli::Lexer |
| namespace | Haio::Cli::Lexer::Detail |
Functions | |
| constexpr std::optional< Word > | Haio::Cli::Lexer::optionOf (std::string_view token) |
| consteval void | Haio::Cli::Lexer::Detail::alternative (std::string &out, size_t &lineStart, std::string_view piece) |
| consteval std::string_view | Haio::Cli::Lexer::Detail::quotedList (auto &&spellings) |
| consteval std::string_view | Haio::Cli::Lexer::Detail::expressionOf (const Option &option) |
| consteval auto | Haio::Cli::Lexer::Detail::optionRules () |
| consteval std::string_view | Haio::Cli::Lexer::Detail::filterAlternation () |
| consteval std::string_view | Haio::Cli::Lexer::Detail::formatAlternation () |
| consteval std::string_view | Haio::Cli::Lexer::Detail::colorAlternation () |
| template<size_t A, size_t B, size_t C> | |
| consteval auto | Haio::Cli::Lexer::Detail::joined (const std::array< Rule, A > &a, const std::array< Rule, B > &b, const std::array< Rule, C > &c) |
Variables | |
| const auto | Haio::Cli::Lexer::paren = x3::string("\\(") | x3::string("\\)") | x3::string("(") | x3::string(")") |
| const auto | Haio::Cli::Lexer::singleQuoted = x3::lexeme['\'' >> *(x3::char_ - '\'') >> '\''] |
| const auto | Haio::Cli::Lexer::doubleQuoted = x3::lexeme['"' >> *(('\\' >> x3::char_) | (x3::char_ - '"')) >> '"'] |
| const auto | Haio::Cli::Lexer::word = x3::lexeme[+(x3::char_ - x3::space - '"' - '\'' - '(' - ')')] |
| const auto | Haio::Cli::Lexer::arg = x3::raw[singleQuoted | doubleQuoted | paren | word] |
| const auto | Haio::Cli::Lexer::cmdline = x3::skip(x3::space)[*arg] |
| constexpr std::array | Haio::Cli::Lexer::ebnfRules |
| constexpr Option | Haio::Cli::Lexer::options [] |
| constexpr std::string_view | Haio::Cli::Lexer::generatorKinds [] = {"xc", "canvas", "gradient", "radial-gradient"} |
| constexpr std::array | Haio::Cli::Lexer::Detail::structureRules |
| constexpr std::array | Haio::Cli::Lexer::Detail::leafRules |
| constexpr auto | Haio::Cli::Lexer::commandRules |
| constexpr std::array | Haio::Cli::Lexer::notes |
| struct Haio::Cli::Lexer::Rule |
Definition at line 23 of file haio_cli_grammar.hpp.
| Class Members | ||
|---|---|---|
| string_view | expression | |
| string_view | name | |
| struct Haio::Cli::Lexer::Note |
Definition at line 28 of file haio_cli_grammar.hpp.
| Class Members | ||
|---|---|---|
| string_view | text | |
| struct Haio::Cli::Lexer::Option |
every option the convert line takes, and how many words follow each.
it is a table because the same facts were written down three times: as an if in the parser, as a rule in the grammar this file documents, and as a line in the usage text. three copies of one list is three chances to disagree, and they did – "--size" was in the grammar and in the usage and in neither branch of the parser, and "--palette=cga" went looking for its value in the next word along, because the equals sign was only ever matched against the spelling the error message used.
the count is the part that matters. reading an option is the same work whatever it means: take the words the table says it takes, from after an equals sign or from one along, and hand them to whoever knows what they are for. that last step is the only thing particular to the option, and it is all the parser's switch is left doing.
Definition at line 75 of file haio_cli_grammar.hpp.
| Class Members | ||
|---|---|---|
| int | args = 1 |
how many words follow it |
| bool | filter = true |
whether it is one of the filters, which is what the grammar calls the options that may repeat between the source and the output. -size is not one: it belongs to the generator that has to follow it. |
| string_view | help | |
| Opt | kind | |
| bool | optional = false |
... and whether it can do without them, which only -crop can |
| string_view | rule |
the name this option's rule has in the grammar |
| array< string_view, 4 > | spellings |
every spelling it answers to; the first is the one the usage text shows |
| string_view | takes |
and the rule the words after it have to match |
| struct Haio::Cli::Lexer::Word |
an option, the spelling it arrived as, and whatever an equals sign carried with it
Definition at line 150 of file haio_cli_grammar.hpp.

| Class Members | ||
|---|---|---|
| bool | hasValue = false | |
| const Option * | option = nullptr | |
| string_view | spelling | |
| string_view | value | |