23#ifndef SIM_XSPCIE_PARSER_H_
24#define SIM_XSPCIE_PARSER_H_
28#include <pegtl/eol.hpp>
29#include <pegtl/rules.hpp>
57struct sep : opt<plus<sor<space,
85 : sor<istring<'v', 'd'>,
102 : until<if_must<one<'%'>, sep,
103 sor<portModifierDifferentialNames,
104 portModifiersSingleNames,
113 : seq<sep, opt<portModifierDigital>, opt<portInversion>, rep_min<1, nodeNameSeparated>>
116struct nodeSingle : seq<sep, if_must<portModifiersSingle, sep, rep_min<1, nodeNameSeparated>>>
120 : seq<sep, if_must<portModifiersDifferential, sep, rep_min<2, nodeNameSeparated>>>
129struct vectorPattern : if_must<squareBracketO, until<squareBracketC, nodeSequence>>
132struct vectorExpr : seq<opt<portModifierDigital>, opt<portModifiersDifferential>,
133 opt<portModifiersSingle>, sep, vectorPattern>
139 not_at<squareBracketC>>
146inline constexpr auto errorMessage<plus<sor<vectorExpr, nodeSequence>>> =
147 "Expected at least one '?', are all modifiers and vectors correct?";
149inline constexpr auto errorMessage<until<squareBracketC, nodeSequence>> =
150 "Vectors [ must be closed ] and not nested.";
154 "Port type is invalid. '%%' needs to be followed by a valid name.";
156inline constexpr auto errorMessage<at<rep_min<0, validPortTypes>>> =
"";
158inline constexpr auto errorMessage<rep_min<1, nodeNameSeparated>> =
159 "Port type is invalid. '%%' needs to be followed by a valid name and a '?'.";
161inline constexpr auto errorMessage<not_at<invertionSeparated>> =
"'~~' is not supported.";
164 "'~ %%d' not supported, consider changing to '%%d ~'.";
166inline constexpr auto errorMessage<rep_min<2, nodeNameSeparated>> =
167 "Differential ports need two nodes, and '~' is not supported for those nodes. Also check "
168 "if port modifier name is valid.";
170inline constexpr auto errorMessage<not_at<squareBracketO>> =
"'~[' not supported.";
172inline constexpr auto errorMessage<not_at<squareBracketC>> =
173 "Vector is either empty, open or nested.";
180 template <
typename Rule>
182 template <
typename Rule>
183 static constexpr auto message = errorMessage<Rule>;
185template <
typename Rule>
189template <
typename Rule>
must_if< error >::control< Rule > control
constexpr auto errorMessage< sep >
constexpr const char * errorMessage
static constexpr auto message
static constexpr bool raise_on_failure
Notes: spaces are allowed everywhere in any number ~ can only be before ? ~~ is not allowed [] can en...