diff options
author | Luc Maranget <luc.maranget@inria.fr> | 2007-01-29 17:03:15 +0000 |
---|---|---|
committer | Luc Maranget <luc.maranget@inria.fr> | 2007-01-29 17:03:15 +0000 |
commit | 259eb53e67d5d96ff0e01c4f2ae1ebd44614b6ca (patch) | |
tree | 878501ba9b8d30339e4a1d61691574d7edfe3700 | |
parent | 5ca2e4ee42ddee9b8c8f27df4c3216210210bbe5 (diff) |
hum, bug: take care to compare idents by name (not including location)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7816 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | lex/lexgen.ml | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lex/lexgen.ml b/lex/lexgen.ml index ce4d649d2..cadc153db 100644 --- a/lex/lexgen.ml +++ b/lex/lexgen.ml @@ -82,12 +82,21 @@ type ('args,'action) automata_entry = module Ints = Set.Make(struct type t = int let compare = compare end) -module Tags = Set.Make(struct type t = tag_info let compare = compare end) +let id_compare (id1,_) (id2,_) = String.compare id1 id2 -module TagMap = - Map.Make (struct type t = tag_info let compare = compare end) +let tag_compare t1 t2 = + let c1 = id_compare t1.id t2.id in + if c1 <> 0 then c1 + else + let c2 = Pervasives.compare t1.start t2.start in + if c2 <> 0 then c2 + else + Pervasives.compare t1.action t2.action -let id_compare (id1,_) (id2,_) = String.compare id1 id2 +module Tags = Set.Make(struct type t = tag_info let compare = tag_compare end) + +module TagMap = + Map.Make (struct type t = tag_info let compare = tag_compare end) module IdSet = Set.Make (struct type t = ident let compare = id_compare end) @@ -532,14 +541,14 @@ type t_transition = type transition = t_transition * Tags.t -let compare_trans (t1,tags1) (t2,tags2) = +let trans_compare (t1,tags1) (t2,tags2) = match Pervasives.compare t1 t2 with | 0 -> Tags.compare tags1 tags2 | r -> r module TransSet = - Set.Make(struct type t = transition let compare = compare end) + Set.Make(struct type t = transition let compare = trans_compare end) let rec nullable = function | Empty|Tag _ -> true |