Implement parser & formater for 'TraceIfFalse'

Interestingly enough, chumsky seems to fail when given a 'choice' with
  more than 25 elements. That's why this commit groups together some of
  the choices as another nested 'choice'.
This commit is contained in:
KtorZ
2023-02-16 13:51:37 +01:00
committed by Lucas
parent 60390fe4f0
commit 6a50bde666
5 changed files with 80 additions and 7 deletions

View File

@@ -35,10 +35,13 @@ pub fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = ParseError> {
just('.').to(Token::Dot),
just("!=").to(Token::NotEqual),
just('!').to(Token::Bang),
just("<=").to(Token::LessEqual),
just('<').to(Token::Less),
just(">=").to(Token::GreaterEqual),
just('>').to(Token::Greater),
just('?').to(Token::Question),
choice((
just("<=").to(Token::LessEqual),
just('<').to(Token::Less),
just(">=").to(Token::GreaterEqual),
just('>').to(Token::Greater),
)),
just('+').to(Token::Plus),
just("->").to(Token::RArrow),
just('-').to(Token::Minus),

View File

@@ -39,8 +39,9 @@ pub enum Token {
// Other Punctuation
Colon,
Comma,
Hash, // '#'
Bang, // '!'
Hash, // '#'
Bang, // '!'
Question, // '?'
Equal,
EqualEqual, // '=='
NotEqual, // '!='
@@ -125,6 +126,7 @@ impl fmt::Display for Token {
Token::Hash => "#",
Token::Bang => "!",
Token::Equal => "=",
Token::Question => "?",
Token::EqualEqual => "==",
Token::NotEqual => "!=",
Token::Vbar => "|",