aboutsummaryrefslogtreecommitdiff
path: root/gramlib
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2018-10-07 07:08:42 +0200
committerEmilio Jesus Gallego Arias2018-10-29 01:25:34 +0100
commit641042302f05f6ec42f61a4bdb73fad70bb90c41 (patch)
tree5ff17d4a38d49f631f398e82330ab84ffdf9de2a /gramlib
parent503fa442869978a9e19e738be990ea8c7534962e (diff)
[camlp5] Fix warnings, switch Coq to vendored library.
Diffstat (limited to 'gramlib')
-rw-r--r--gramlib/gramext.ml2
-rw-r--r--gramlib/grammar.ml8
-rw-r--r--gramlib/plexing.ml26
3 files changed, 17 insertions, 19 deletions
diff --git a/gramlib/gramext.ml b/gramlib/gramext.ml
index 028d1fdf12..39da1de56d 100644
--- a/gramlib/gramext.ml
+++ b/gramlib/gramext.ml
@@ -582,7 +582,7 @@ let rec delete_rule_in_prefix entry symbols =
end
| [] -> raise Not_found
-let rec delete_rule_in_level_list entry symbols levs =
+let delete_rule_in_level_list entry symbols levs =
match symbols with
Sself :: symbols -> delete_rule_in_suffix entry symbols levs
| Snterm e :: symbols when e == entry ->
diff --git a/gramlib/grammar.ml b/gramlib/grammar.ml
index 8e33d860bd..0f68c95021 100644
--- a/gramlib/grammar.ml
+++ b/gramlib/grammar.ml
@@ -232,7 +232,7 @@ let loc_of_token_interval bp ep =
else
let loc1 = !floc bp in let loc2 = !floc (pred ep) in Ploc.encl loc1 loc2
-let rec name_of_symbol entry =
+let name_of_symbol entry =
function
Snterm e -> "[" ^ e.ename ^ "]"
| Snterml (e, l) -> "[" ^ e.ename ^ " level " ^ l ^ "]"
@@ -658,7 +658,7 @@ and parser_of_token_list entry s son p1 p2 rev_tokl last_tok =
match peek_nth n strm with
Some tok ->
let r = tematch tok in
- for i = 1 to n do Stream.junk strm done; Obj.repr r
+ for _i = 1 to n do Stream.junk strm done; Obj.repr r
| None -> raise Stream.Failure
in
fun (strm : _ Stream.t) ->
@@ -2624,7 +2624,7 @@ module Entry =
| Predictive -> Obj.magic (entry.estart 0 ts : Obj.t)
| Functional -> failwith "not impl Entry.parse_token_stream functional"
| Backtracking -> failwith "not impl Entry.parse_token_stream backtrack"
- let warned_using_parse_token = ref false
+ let _warned_using_parse_token = ref false
let parse_token (entry : 'a e) ts : 'a =
(* commented: too often warned in Coq...
if not warned_using_parse_token.val then do {
@@ -2807,7 +2807,7 @@ module GMake (L : GLexerType) =
| Predictive -> Obj.magic (e.estart 0 ts : Obj.t)
| Functional -> fparse_token_stream e ts
| Backtracking -> bparse_token_stream e ts
- let warned_using_parse_token = ref false
+ let _warned_using_parse_token = ref false
let parse_token (entry : 'a e) ts : 'a =
(* commented: too often warned in Coq...
if not warned_using_parse_token.val then do {
diff --git a/gramlib/plexing.ml b/gramlib/plexing.ml
index db8e9591b7..beebcd016e 100644
--- a/gramlib/plexing.ml
+++ b/gramlib/plexing.ml
@@ -2,8 +2,6 @@
(* plexing.ml,v *)
(* Copyright (c) INRIA 2007-2017 *)
-open Versdep
-
type pattern = string * string
exception Error of string
@@ -29,7 +27,7 @@ let lexer_text (con, prm) =
else con ^ " '" ^ prm ^ "'"
let locerr () = failwith "Lexer: location function"
-let loct_create () = ref (array_create 1024 None), ref false
+let loct_create () = ref (Array.make 1024 None), ref false
let loct_func (loct, ov) i =
match
if i < 0 || i >= Array.length !loct then
@@ -42,7 +40,7 @@ let loct_add (loct, ov) i loc =
if i >= Array.length !loct then
let new_tmax = Array.length !loct * 2 in
if new_tmax < Sys.max_array_length then
- let new_loct = array_create new_tmax None in
+ let new_loct = Array.make new_tmax None in
Array.blit !loct 0 new_loct 0 (Array.length !loct);
loct := new_loct;
!loct.(i) <- Some loc
@@ -67,7 +65,7 @@ let lexer_func_of_ocamllex lexfun cs =
let lb =
Lexing.from_function
(fun s n ->
- try string_set s 0 (Stream.next cs); 1 with Stream.Failure -> 0)
+ try Bytes.set s 0 (Stream.next cs); 1 with Stream.Failure -> 0)
in
let next_token_loc _ =
let tok = lexfun lb in
@@ -78,13 +76,13 @@ let lexer_func_of_ocamllex lexfun cs =
(* Char and string tokens to real chars and string *)
-let buff = ref (string_create 80)
+let buff = ref (Bytes.create 80)
let store len x =
- if len >= string_length !buff then
- buff := string_cat !buff (string_create (string_length !buff));
- string_set !buff len x;
+ if len >= Bytes.length !buff then
+ buff := Bytes.(cat !buff (create (length !buff)));
+ Bytes.set !buff len x;
succ len
-let get_buff len = string_sub !buff 0 len
+let get_buff len = Bytes.sub !buff 0 len
let valch x = Char.code x - Char.code '0'
let valch_a x = Char.code x - Char.code 'a' + 10
@@ -175,7 +173,7 @@ let eval_string loc s =
in
loop len i
in
- bytes_to_string (loop 0 0)
+ Bytes.to_string (loop 0 0)
let default_match =
function
@@ -196,13 +194,13 @@ let restore_lexing_info = ref None
(* The lexing buffer used by pa_lexer.cmo *)
let rev_implode l =
- let s = string_create (List.length l) in
+ let s = Bytes.create (List.length l) in
let rec loop i =
function
- c :: l -> string_unsafe_set s i c; loop (i - 1) l
+ c :: l -> Bytes.unsafe_set s i c; loop (i - 1) l
| [] -> s
in
- bytes_to_string (loop (string_length s - 1) l)
+ Bytes.to_string (loop (Bytes.length s - 1) l)
module Lexbuf :
sig