Something went wrong. Try again.
The Monad language. Dependent types, functional programming compiled with LLVM. Hobby project. monad-lang.org
dependent-types language compiler programming-language functional-programming
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546/// Whitespace parsing functions for the self-hosted Monad parser.use parsec::core {ParseResult, custom, is_empty}use parsec::char_preds {is_space_byte}use parsec::combinators {take_while_byte}open ParseResult {fail, success}// --- Whitespace ---#[partial]def spaces (input : String) : ParseResult String := take_while_byte is_space_byte input#[partial]def ws0 (input : String) : ParseResult String := take_while_byte is_space_byte input#[partial]def ws1 (input : String) : ParseResult String := ws1_body (take_while_byte is_space_byte input) input#[partial]def ws1_body (r : ParseResult String) (input : String) : ParseResult String := match r { success rem out => if is_empty out then fail (ParseError.custom "expected whitespace" input) else success rem out, fail e => fail e }#[partial]pub def skip_spaces (input : String) : String := skip_spaces_match (take_while_byte is_space_byte input) input#[partial]def skip_spaces_match (r : ParseResult String) (orig : String) : String := match r { success rem _ => rem, fail _ => orig }