Split pattern parser into individual modules.

This commit is contained in:
KtorZ
2023-07-06 09:55:12 +02:00
committed by Lucas
parent 0650d6152d
commit 5a4a2faa4d
7 changed files with 253 additions and 174 deletions

View File

@@ -0,0 +1,16 @@
use chumsky::prelude::*;
use crate::{
ast::UntypedPattern,
parser::{error::ParseError, token::Token},
};
pub fn parser() -> impl Parser<Token, UntypedPattern, Error = ParseError> {
select! {Token::Int {value, base} => (value, base)}.map_with_span(|(value, base), location| {
UntypedPattern::Int {
location,
value,
base,
}
})
}