Commit 715f53ed authored by POTTIER Francois's avatar POTTIER Francois

Avoid references to Pervasives in the generated code.

parent bef73a71
......@@ -2,6 +2,10 @@
## 2018/09/10
* Remove all references to `Pervasives` in the generated OCaml code.
These references were infrequent anyway,
and `Pervasives` is about to be deprecated in OCaml 4.08, it seems.
* Coq back-end: add a few newlines in the generated file for readability.
(Suggested by Bernhard Schommer.)
......
......@@ -8,8 +8,6 @@
* Add a command line option to control how "MenhirLib" should be named in the
generated code. (Suggested by Gabriel Scherer.)
Add another option to control the naming of "Pervasives"?
or just avoid referring to Pervasives
* Incremental API: expose a function `lookahead` of type `'a env -> token option`.
......
......@@ -313,7 +313,7 @@ let ptuple = function
let trace (format : string) (args : expr list) : (pattern * expr) list =
if Settings.trace then
[ PUnit, EApp (EVar "Printf.fprintf", (EVar "Pervasives.stderr") :: (EStringConst (format ^"\n%!")) :: args) ]
[ PUnit, EApp (EVar "Printf.fprintf", (EVar "stderr") :: (EStringConst (format ^"\n%!")) :: args) ]
else
[]
......@@ -1535,7 +1535,7 @@ let assertfalsedef = {
EFun ([ PUnit ],
blet ([
PUnit, EApp (EVar "Printf.fprintf",
[ EVar "Pervasives.stderr";
[ EVar "stderr";
EStringConst "Internal failure -- please contact the parser generator's developers.\n%!" ]);
],
EApp (EVar "assert", [ efalse ])
......
......@@ -85,7 +85,7 @@ let rec symbolstartpos ((nullable, epsilon) as analysis) producers i n
else
(* In the general case, a runtime test is required. *)
EIfThenElse (
EApp (EVar "Pervasives.(!=)", [ EVar (posvar_ startp); EVar (posvar_ endp) ]),
EApp (EVar "(!=)", [ EVar (posvar_ startp); EVar (posvar_ endp) ]),
EVar (posvar_ startp),
continue
),
......
......@@ -2270,13 +2270,13 @@ in
in
let _startpos__4_ = _startpos__10_ in
let _endpos = _endpos__7_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
if Pervasives.(!=) _startpos__2_ _endpos__2_ then
if _startpos__2_ != _endpos__2_ then
_startpos__2_
else
if Pervasives.(!=) _startpos__3_ _endpos__3_ then
if _startpos__3_ != _endpos__3_ then
_startpos__3_
else
_startpos__4_ in
......@@ -2390,13 +2390,13 @@ in
in
let _startpos__4_ = _startpos__12_ in
let _endpos = _endpos__11_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
if Pervasives.(!=) _startpos__2_ _endpos__2_ then
if _startpos__2_ != _endpos__2_ then
_startpos__2_
else
if Pervasives.(!=) _startpos__3_ _endpos__3_ then
if _startpos__3_ != _endpos__3_ then
_startpos__3_
else
_startpos__4_ in
......@@ -8450,7 +8450,7 @@ label_declaration:
in
let _startpos__2_ = _startpos__10_ in
let _endpos = _endpos__5_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......@@ -8479,7 +8479,7 @@ label_declaration_semi:
in
let _startpos__2_ = _startpos__10_ in
let _endpos = _endpos__7_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......
......@@ -2451,13 +2451,13 @@ in
in
let _startpos__4_ = _startpos__10_ in
let _endpos = _endpos__7_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
if Pervasives.(!=) _startpos__2_ _endpos__2_ then
if _startpos__2_ != _endpos__2_ then
_startpos__2_
else
if Pervasives.(!=) _startpos__3_ _endpos__3_ then
if _startpos__3_ != _endpos__3_ then
_startpos__3_
else
_startpos__4_ in
......@@ -2565,13 +2565,13 @@ in
in
let _startpos__4_ = _startpos__12_ in
let _endpos = _endpos__11_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
if Pervasives.(!=) _startpos__2_ _endpos__2_ then
if _startpos__2_ != _endpos__2_ then
_startpos__2_
else
if Pervasives.(!=) _startpos__3_ _endpos__3_ then
if _startpos__3_ != _endpos__3_ then
_startpos__3_
else
_startpos__4_ in
......@@ -9050,7 +9050,7 @@ label_declaration:
in
let _startpos__2_ = _startpos__10_ in
let _endpos = _endpos__5_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......@@ -9078,7 +9078,7 @@ label_declaration_semi:
in
let _startpos__2_ = _startpos__10_ in
let _endpos = _endpos__7_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......
......@@ -1658,13 +1658,13 @@ in
in
let _startpos__4_ = _startpos__10_ in
let _endpos = _endpos__7_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
if Pervasives.(!=) _startpos__2_ _endpos__2_ then
if _startpos__2_ != _endpos__2_ then
_startpos__2_
else
if Pervasives.(!=) _startpos__3_ _endpos__3_ then
if _startpos__3_ != _endpos__3_ then
_startpos__3_
else
_startpos__4_ in
......@@ -1682,13 +1682,13 @@ method_:
(mkloc _5 ((make_loc _startpos__5_ _endpos__5_)), _4, Cfk_virtual _7), _2 )}
| _1 = override_flag _2 = attributes _3 = private_flag _4 = label _5 = strict_binding
{let _endpos = _endpos__5_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
if Pervasives.(!=) _startpos__2_ _endpos__2_ then
if _startpos__2_ != _endpos__2_ then
_startpos__2_
else
if Pervasives.(!=) _startpos__3_ _endpos__3_ then
if _startpos__3_ != _endpos__3_ then
_startpos__3_
else
_startpos__4_ in
......@@ -1696,13 +1696,13 @@ else
Cfk_concrete (_1, (ghexp ~loc:(make_loc _symbolstartpos _endpos))(Pexp_poly (_5, None)))), _2 )}
| _1 = override_flag _2 = attributes _3 = private_flag _4 = label _5 = COLON _6 = poly_type _7 = EQUAL _8 = seq_expr
{let _endpos = _endpos__8_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
if Pervasives.(!=) _startpos__2_ _endpos__2_ then
if _startpos__2_ != _endpos__2_ then
_startpos__2_
else
if Pervasives.(!=) _startpos__3_ _endpos__3_ then
if _startpos__3_ != _endpos__3_ then
_startpos__3_
else
_startpos__4_ in
......@@ -1710,13 +1710,13 @@ else
Cfk_concrete (_1, (ghexp ~loc:(make_loc _symbolstartpos _endpos))(Pexp_poly(_8, Some _6)))), _2 )}
| _1 = override_flag _2 = attributes _3 = private_flag _4 = label _5 = COLON _6 = TYPE _7 = lident_list _8 = DOT _9 = core_type _10 = EQUAL _11 = seq_expr
{let _endpos = _endpos__11_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
if Pervasives.(!=) _startpos__2_ _endpos__2_ then
if _startpos__2_ != _endpos__2_ then
_startpos__2_
else
if Pervasives.(!=) _startpos__3_ _endpos__3_ then
if _startpos__3_ != _endpos__3_ then
_startpos__3_
else
_startpos__4_ in
......@@ -3973,7 +3973,7 @@ label_declaration:
in
let _startpos__2_ = _startpos__10_ in
let _endpos = _endpos__5_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......@@ -4002,7 +4002,7 @@ label_declaration_semi:
in
let _startpos__2_ = _startpos__10_ in
let _endpos = _endpos__7_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......
......@@ -1233,7 +1233,7 @@ let _symbolstartpos = _startpos_x_ in
mark_position_cl__class_expr_lets_and_rest_:
x = _class_expr_lets_and_rest
{let _endpos = _endpos_x_ in
let _symbolstartpos = if Pervasives.(!=) _startpos_x_ _endpos_x_ then
let _symbolstartpos = if _startpos_x_ != _endpos_x_ then
_startpos_x_
else
_endpos in
......@@ -1272,7 +1272,7 @@ let _symbolstartpos = _startpos_x_ in
mark_position_pat__class_self_pattern_:
x = _class_self_pattern
{let _endpos = _endpos_x_ in
let _symbolstartpos = if Pervasives.(!=) _startpos_x_ _endpos_x_ then
let _symbolstartpos = if _startpos_x_ != _endpos_x_ then
_startpos_x_
else
_endpos in
......@@ -2492,7 +2492,7 @@ in
let _endpos__4_ = _endpos_x0_ in
let _startpos__4_ = _startpos_x0_ in
let _endpos = _endpos__6_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......@@ -2540,10 +2540,10 @@ in
in
let _startpos__3_ = _startpos_x0_ in
let _endpos = _endpos__6_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
if Pervasives.(!=) _startpos__2_ _endpos__2_ then
if _startpos__2_ != _endpos__2_ then
_startpos__2_
else
_startpos__3_ in
......@@ -2576,7 +2576,7 @@ in
in
let _startpos__2_ = _startpos_x0_ in
let _endpos = _endpos__3_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......@@ -2593,7 +2593,7 @@ else
in
let _startpos__2_ = _startpos_x0_ in
let _endpos = _endpos__6_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......@@ -2610,7 +2610,7 @@ else
in
let _startpos__2_ = _startpos_x0_ in
let _endpos = _endpos__4_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......@@ -2627,7 +2627,7 @@ else
in
let _startpos__2_ = _startpos_x0_ in
let _endpos = _endpos__9_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......@@ -5343,7 +5343,7 @@ label_declaration:
in
let _startpos__2_ = _startpos_x0_ in
let _endpos = _endpos__3_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......@@ -5363,7 +5363,7 @@ else
in
let _startpos__2_ = _startpos_x0_ in
let _endpos = _endpos__6_ in
let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......
......@@ -24,7 +24,7 @@ hop:
bar:
_1 = option_foo_ _2 = B
{let _symbolstartpos = if Pervasives.(!=) _startpos__1_ _endpos__1_ then
{let _symbolstartpos = if _startpos__1_ != _endpos__1_ then
_startpos__1_
else
_startpos__2_ in
......
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