package archetype

  1. Overview
  2. Docs

Module Archetype.ParseErrorSource

This module demonstrates that we can easily generate contextual error message thanks to the introspection API. Indeed, when a parsing error occurs, there exist items in the stack whose analysis is not completed. Therefore, the non terminals of their productions are probably the syntactically classes that are being recognized when the error occurred.

Sourceval pop_until : (Parser.MenhirInterpreter.element -> 'a list) -> 'b Parser.MenhirInterpreter.env -> 'a list
Sourceval element_contains_prediction_items : Parser.MenhirInterpreter.element -> Parser.MenhirInterpreter.xsymbol list
Sourceval parse_error : Position.t -> string -> (unit -> 'a) -> 'a
Sourceval contextual_error_msg : PureLexer.Lexer.t -> 'a Parser.MenhirInterpreter.checkpoint -> (unit -> 'b) -> 'b
OCaml

Innovation. Community. Security.