use crate::{RepetitionQuantifierKind, Terminal, grammar::TokenDescription};
#[derive(Debug)]
#[non_exhaustive]
pub enum Error<Span> {
#[non_exhaustive]
ParsingFailed {
what: Vec<MacroRuleNode>,
where_: Span,
},
#[non_exhaustive]
UnexpectedEnd {
last_token: Option<Span>,
},
#[non_exhaustive]
InvalidProducedAst {
span: Span,
expected: Vec<TokenDescription>,
counter_example: Vec<(TokenDescription, Span)>,
},
#[non_exhaustive]
UnboundMetavariable {
name: String,
where_: Span,
},
InvalidRepetitionNesting {
metavariable_name: String,
decl_span: Span,
usage_span: Span,
expected_nesting: Vec<RepetitionQuantifierKind>,
got_nesting: Vec<RepetitionQuantifierKind>,
},
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MacroRuleNode {
Matcher,
Transcriber,
Repetition,
FragmentName,
FragmentSpecifier,
MetaVariableMatch,
RepetitionQuantifier,
RepetitionSeparator,
Terminal(Terminal),
}