mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 00:01:16 +00:00
basic structure
This commit is contained in:
parent
28cc3348a6
commit
703a8de72f
5 changed files with 362 additions and 18 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue