marianoguerra/shrubbery/parser does not have a README file

    Mode

    pub(all) enum Mode {
    Top
    Text
    } derive(Eq)

    What to read.

    The mode decides the shape of the answer, which is why it is a parameter rather than something inferred: Top always gives a multi, Text always gives a brackets.

    Parsed

    A successful parse, and anything reported along the way.

    diagnostics is non-empty only in recovery mode, where parsing continues past a failure so that a file with three mistakes reports three. Outside recovery, the first failure is raised instead.

    Parsed::diagnostics

    default_max_depth

    let default_max_depth : Int

    How many sequences may be open at once, by default.

    One frame per bracket pair and per block, so this is what keeps the stack finite on input that nests without end. Two numbers decide it, and they are not close together:

    • Real source nests nothing like this deep. The 610 Rhombus modules in the corpus come nowhere near it.
    • The smallest stack this library runs on does not go much further. On the wasm backend, nested blocks overflow somewhere between 90 and 100 levels -- so the limit is not "20x what anyone writes", which would be past the point where the check could still be reached. It is a little under half of the smallest ceiling measured.

    A consumer that knows its own stack can raise it: parse takes max_depth. Anything that nests deeper than a person would write is data rather than source, and a refusal it can catch beats a signal it cannot.

    parse

    fn parse(src : String, mode? : Mode, variant? :
    Variant
    , start_column? :
    Column
    , recover? : Bool, max_depth? : Int) -> Parsed raise
    ShrubberyError

    Parse shrubbery notation.

    start_column accounts for characters that logically precede the input, for an embedder splicing this into something larger; it affects indentation only, never the positions reported.

    parse_tokens

    Parse an already-scanned token stream.

    Exposed because a consumer that has its own reason to look at the tokens -- an editor, a highlighter -- should not have to scan twice.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io