nfl/reader

Search:
Group by:

The NFL reader: a hand-written recursive-descent tokenizer/parser that turns source text into a sequence of Syntax nodes (see syntax.nim). Handles lists, vectors, strings, escaped |...| symbols, quote/quasiquote/ unquote, Nim pragma clauses {. .}, and ;/#| |# comments.

Procs

proc readAll(source: string; file = "<input>"): seq[Syntax] {.
    ...raises: [ReaderError, Exception], tags: [RootEffect], forbids: [].}
Reads every top-level form in source, labelling spans with file.
proc readOne(source: string; file = "<input>"): Syntax {.
    ...raises: [ReaderError, Exception], tags: [RootEffect], forbids: [].}
Reads source as exactly one top-level form; raises ReaderError if it contains zero or more than one.