Commit 6e48be5f authored by POTTIER Francois's avatar POTTIER Francois

[Front] now relies on [Driver].

parent 93725fdd
(* The module [Driver] serves to offer a unified API to the parser,
which could be produced by either ocamlyacc or Menhir. *)
val grammar :
(Lexing.lexbuf -> Parser.token) -> Lexing.lexbuf -> ConcreteSyntax.grammar
module F = FancyParserMessages
(* The module [Driver] serves to offer a unified API to the parser,
which could be produced by either ocamlyacc or Menhir. *)
(* This is the Menhir-specific driver. We wish to handle syntax errors
in a more ambitious manner, so as to help our end users understand
their mistakes. *)
module F = FancyParserMessages (* TEMPORARY *)
let grammar lexer lexbuf =
try
Parser.grammar lexer lexbuf
with Parsing.Parse_error ->
Error.error (Positions.lexbuf lexbuf) "Syntax error."
......@@ -4,8 +4,6 @@
(* Reading a grammar from a file. *)
module D = Driver
let load_partial_grammar filename =
let validExt = if Settings.coq then ".vy" else ".mly" in
if not (Filename.check_suffix filename validExt) then
......@@ -21,7 +19,7 @@ let load_partial_grammar filename =
let lexbuf = Lexing.from_string contents in
lexbuf.lex_curr_p <- { lexbuf.lex_curr_p with pos_fname = filename };
let grammar =
{ (Parser.grammar Lexer.main lexbuf) with ConcreteSyntax.pg_filename = filename }
{ (Driver.grammar Lexer.main lexbuf) with ConcreteSyntax.pg_filename = filename }
in
Error.file_contents := None;
grammar
......
(* The module [Driver] serves to offer a unified API to the parser,
which could be produced by either ocamlyacc or Menhir. *)
(* This is the ocamlyacc-specific driver. There is nothing special
to do. We handle syntax errors in a minimalistic manner. This
error handling code will be exercised only if there is a syntax
error in [fancy-parser.mly], during stage 2 of the bootstrap
process. *)
let grammar lexer lexbuf =
try
Parser.grammar lexer lexbuf
with Parsing.Parse_error ->
Error.error (Positions.lexbuf lexbuf) "Syntax error."
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment