aboutsummaryrefslogtreecommitdiffstats
path: root/lib/front.mli
blob: a4e91e664a7b06852ce42321326dba8ac43f73db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(** Front door: text to statements.

    Wraps the generated lexer and parser so callers see one total
    function from source text to syntax or a positioned error. The
    REPL, the file runner, the LSP server, and the tests all enter
    here. *)

type error = {
  line : int;  (** 1-based, as editors count *)
  column : int;  (** 0-based character offset in the line *)
  message : string;
}

val parse : string -> (Ast.statement list, error) result

val parse_string : string -> (Ast.statement list, string) result
(** [parse] with the position folded into the message, for callers
    that only print. *)