Description: support camlp5 8.00
Author: Enrico Tassi
Forwarded: upstream https://github.com/LPCIC/elpi/pull/110/commits/f58341831b56ccfe5f2f49158c600e4e36bcb9b5
--- elpi.orig/src/parser.ml
+++ elpi/src/parser.ml
@@ -399,14 +399,14 @@
                 (Ploc.last_pos loc, Ploc.last_pos loc) (Ploc.comment loc)
 
 let lex_fun s =
-  let tab = Hashtbl.create 207 in
+  let tab = Locations.create () in
   (Stream.from (fun id ->
      let tok, loc = lex !last_loc Lexbuf.empty (Stream.count s) s in
 (*      Printf.eprintf "tok: %s, %s, %s\n" (Loc.show (of_ploc loc)) (fst tok) (snd tok); *)
      last_loc := after loc;
-     Hashtbl.add tab id loc;
+     Locations.add tab id loc;
      Some tok)),
-  (fun id -> try Hashtbl.find tab id with Not_found -> !last_loc)
+     tab
 ;;
 
 let tok_match =
@@ -511,14 +511,21 @@
   if nprec < umin_precedence || nprec > umax_precedence then
     raise (ParseError(loc,Printf.sprintf "precedence muse be inside [%d,%d]" umin_precedence umax_precedence))
   else
+    let hash_expr e =
+            e
+            |> Hashtbl.hash
+            |> Printf.sprintf "%08x" in
     let binrule =
      [ Gramext.Sself ; Gramext.Stoken ("SYMBOL",cst); Gramext.Sself ],
+     hash_expr     "(fun t2 cst t1 loc -> mkApp (of_ploc loc) [mkCon cst;t1;t2])",
      Gramext.action (fun t2 cst t1 loc -> mkApp (of_ploc loc) [mkCon cst;t1;t2]) in
     let prerule =
      [ Gramext.Stoken ("SYMBOL",cst); Gramext.Sself ],
+     hash_expr     "(fun t cst loc -> mkApp (of_ploc loc) [mkCon cst;t])",
      Gramext.action (fun t cst loc -> mkApp (of_ploc loc) [mkCon cst;t]) in
     let postrule =
      [ Gramext.Sself ; Gramext.Stoken ("SYMBOL",cst) ],
+     hash_expr     "(fun cst t loc -> mkApp (of_ploc loc) [mkCon cst;t])",
      Gramext.action (fun cst t loc -> mkApp (of_ploc loc) [mkCon cst;t]) in
     let ppinfo = fix, nprec in
     let fixity,rule =
