Parser.Lexer

is a submodule of common-token parsers: whitespace handling, integers, identifiers, and literal symbols.

identifier

defn

(Fn [] (Parser String))

                        (identifier)
                    

parses a C-style identifier: a letter or underscore, followed by zero or more letters, digits, or underscores. Returns the matched text as a String.

integer

defn

(Fn [] (Parser Int))

                        (integer)
                    

parses an optional - sign followed by decimal digits as an Int. Fused into a single closure.

lexeme

defn

(Fn [(Parser a)] (Parser a))

                        (lexeme p)
                    

runs p, then skips trailing whitespace. Returns p's value.

symbol

defn

(Fn [String] (Parser String))

                        (symbol s)
                    

matches the literal string s, then skips trailing whitespace.

unsigned-int

defn

(Fn [] (Parser Int))

                        (unsigned-int)
                    

parses one or more decimal digits as an Int. Fused into a single closure for performance — does not go through bind/map.

whitespace

defn

(Fn [] (Parser ()))

                        (whitespace)
                    

consumes zero or more ASCII whitespace bytes (space, tab, CR, LF). Always succeeds; the result is unit.