use super::*;
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Mac {
pub path: Path,
pub tts: Vec<TokenTree>,
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum TokenTree {
Token(Token),
Delimited(Delimited),
Sequence(SequenceRepetition),
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Delimited {
pub delim: DelimToken,
pub tts: Vec<TokenTree>,
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct SequenceRepetition {
pub tts: Vec<TokenTree>,
pub separator: Option<Token>,
pub op: KleeneOp,
pub num_captures: usize,
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum KleeneOp {
ZeroOrMore,
OneOrMore,
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum Token {
Eq,
Lt,
Le,
EqEq,
Ne,
Ge,
Gt,
AndAnd,
OrOr,
Not,
Tilde,
BinOp(BinOpToken),
BinOpEq(BinOpToken),
At,
Dot,
DotDot,
DotDotDot,
Comma,
Semi,
Colon,
ModSep,
RArrow,
LArrow,
FatArrow,
Pound,
Dollar,
Question,
OpenDelim(DelimToken),
CloseDelim(DelimToken),
Literal(Lit, Option<String>),
Ident(Ident),
Underscore,
Lifetime(Ident),
DocComment(String),
MatchNt(Ident, Ident),
SubstNt(Ident),
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum BinOpToken {
Plus,
Minus,
Star,
Slash,
Percent,
Caret,
And,
Or,
Shl,
Shr,
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum DelimToken {
Paren,
Bracket,
Brace,
NoDelim,
}