Update to match changes in cl-token

This commit is contained in:
John 2024-04-12 16:21:21 -05:00
parent 4342483529
commit 700c990a11

View File

@ -194,7 +194,7 @@ pub mod parser {
pub mod token { pub mod token {
//! Custom token type, plus a [Tokenizer] iterator adapter for cl-lexer's token type //! Custom token type, plus a [Tokenizer] iterator adapter for cl-lexer's token type
use cl_token::*; use cl_token::{token_type::Op as Tkop, *};
pub struct Tokenizer<'t> { pub struct Tokenizer<'t> {
lexer: cl_lexer::lexer_iter::LexerIter<'t>, lexer: cl_lexer::lexer_iter::LexerIter<'t>,
@ -291,44 +291,44 @@ pub mod token {
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Op { pub enum Op {
// Delimiter // Delimiter
#["("] Lpa = TokenKind::LParen, #["("] Lpa = TokenKind::Op(Tkop::LParen),
#[")"] Rpa = TokenKind::RParen, #[")"] Rpa = TokenKind::Op(Tkop::RParen),
#["["] Lbk = TokenKind::LBrack, #["["] Lbk = TokenKind::Op(Tkop::LBrack),
#["]"] Rbk = TokenKind::RBrack, #["]"] Rbk = TokenKind::Op(Tkop::RBrack),
// Member // Member
#["."] Dot = TokenKind::Dot, #["."] Dot = TokenKind::Op(Tkop::Dot),
// Factor // Factor
#["*"] Mul = TokenKind::Star, #["*"] Mul = TokenKind::Op(Tkop::Star),
#["/"] Div = TokenKind::Slash, #["/"] Div = TokenKind::Op(Tkop::Slash),
#["%"] Rem = TokenKind::Rem, #["%"] Rem = TokenKind::Op(Tkop::Rem),
// Term // Term
#["+"] Add = TokenKind::Plus, #["+"] Add = TokenKind::Op(Tkop::Plus),
#["-"] Sub = TokenKind::Minus, #["-"] Sub = TokenKind::Op(Tkop::Minus),
// Shift // Shift
#["<<"] Shl = TokenKind::LtLt, #["<<"] Shl = TokenKind::Op(Tkop::LtLt),
#[">>"] Shr = TokenKind::GtGt, #[">>"] Shr = TokenKind::Op(Tkop::GtGt),
// Bitwise // Bitwise
#["&"] Ban = TokenKind::Amp, #["&"] Ban = TokenKind::Op(Tkop::Amp),
#["|"] Bor = TokenKind::Bar, #["|"] Bor = TokenKind::Op(Tkop::Bar),
#["^"] Bxr = TokenKind::Xor, #["^"] Bxr = TokenKind::Op(Tkop::Xor),
// Logic // Logic
#["&&"] Lan = TokenKind::AmpAmp, #["&&"] Lan = TokenKind::Op(Tkop::AmpAmp),
#["||"] Lor = TokenKind::BarBar, #["||"] Lor = TokenKind::Op(Tkop::BarBar),
#["^^"] Lxr = TokenKind::XorXor, #["^^"] Lxr = TokenKind::Op(Tkop::XorXor),
// Range // Range
#["..="] Inc = TokenKind::DotDotEq, #["..="] Inc = TokenKind::Op(Tkop::DotDotEq),
#[".."] Exc = TokenKind::DotDot, #[".."] Exc = TokenKind::Op(Tkop::DotDot),
// Compare // Compare
#["<"] Lt = TokenKind::Lt, #["<"] Lt = TokenKind::Op(Tkop::Lt),
#["<="] Lte = TokenKind::LtEq, #["<="] Lte = TokenKind::Op(Tkop::LtEq),
#["=="] Eq = TokenKind::EqEq, #["=="] Eq = TokenKind::Op(Tkop::EqEq),
#["!="] Neq = TokenKind::BangEq, #["!="] Neq = TokenKind::Op(Tkop::BangEq),
#[">="] Gte = TokenKind::GtEq, #[">="] Gte = TokenKind::Op(Tkop::GtEq),
#[">"] Gt = TokenKind::Gt, #[">"] Gt = TokenKind::Op(Tkop::Gt),
// Unary-only // Unary-only
#["!"] Not = TokenKind::Bang, #["!"] Not = TokenKind::Op(Tkop::Bang),
// Postfix unary // Postfix unary
#["?"] Huh = TokenKind::Question, #["?"] Huh = TokenKind::Op(Tkop::Question),
} }
} }