Split pattern parser into individual modules.
This commit is contained in:
16
crates/aiken-lang/src/parser/pattern/int.rs
Normal file
16
crates/aiken-lang/src/parser/pattern/int.rs
Normal 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,
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user