basic structure

This commit is contained in:
Folkert 2021-03-12 22:21:27 +01:00
parent 28cc3348a6
commit 703a8de72f
5 changed files with 362 additions and 18 deletions

View file

@ -11,6 +11,20 @@ pub enum NumLiteral<'a> {
},
}
pub fn positive_number_literal<'a>() -> impl Parser<'a, NumLiteral<'a>, Number> {
move |_arena, state: State<'a>| {
match state.bytes.get(0) {
Some(first_byte) if (*first_byte as char).is_ascii_digit() => {
parse_number_base(false, &state.bytes, state)
}
_ => {
// this is not a number at all
Err((Progress::NoProgress, Number::End, state))
}
}
}
}
pub fn number_literal<'a>() -> impl Parser<'a, NumLiteral<'a>, Number> {
move |_arena, state: State<'a>| {
match state.bytes.get(0) {