add Expr type for union of BoolExpr or NumExpr
This commit is contained in:
parent
7c81b30a8f
commit
6632e897ba
6 changed files with 32 additions and 22 deletions
|
|
@ -1,18 +1,19 @@
|
|||
use std::{env, fmt, fs};
|
||||
|
||||
use ariadne::{sources, Color, Label, Report, ReportKind};
|
||||
use chumsky::{input::SpannedInput, prelude::*};
|
||||
use chumsky::input::SpannedInput;
|
||||
use chumsky::prelude::*;
|
||||
|
||||
use crate::lexer::{lexer, Span, Token};
|
||||
use crate::lexer::{lexer, Error as LexError, Span, Token};
|
||||
|
||||
pub type Spanned<T> = (T, Span);
|
||||
|
||||
// The type of the input that our parser operates on. The input is the `&[(Token, Span)]` token buffer generated by the
|
||||
// lexer, wrapped in a `SpannedInput` which 'splits' it apart into its constituent parts, tokens and spans, for chumsky
|
||||
// The type of the input that our parser operates on. The input is the `&[(Token,
|
||||
// Span)]` token buffer generated by the lexer, wrapped in a `SpannedInput` which
|
||||
// 'splits' it apart into its constituent parts, tokens and spans, for chumsky
|
||||
// to understand.
|
||||
type ParserInput<'tokens, 'src> = SpannedInput<Token<'src>, Span, &'tokens [(Token<'src>, Span)]>;
|
||||
|
||||
pub fn parser<'tokens, 'src: 'tokens>(
|
||||
) -> impl Parser<'tokens, ParserInput<'tokens, 'src>, Spanned<Expr<'src>>, extra::Err<Rich<'tokens, Token<'src>, Span>>>
|
||||
+ Clone {
|
||||
) -> impl Parser<'tokens, ParserInput<'tokens, 'src>, Spanned<Expr<'src>>, LexError<'src>> + Clone {
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue