Commit 0da7c513 authored by POTTIER Francois's avatar POTTIER Francois

Cleanup, and a better error message when two productions in a group

do not define the same identifiers.
parent 0135407c
......@@ -31,9 +31,9 @@ let defined_identifiers producers =
List.fold_right defined_identifiers producers IdSet.empty
let check_production_group right_hand_sides =
match right_hand_sides with
| [] ->
(* A production group cannot be empty. *)
assert false
| (producers, _, _, _) :: right_hand_sides ->
let ids = defined_identifiers producers in
......@@ -46,12 +46,13 @@ let check_production_group right_hand_sides =
(IdSet.diff ids' ids))
Error.error [Positions.position id]
"two productions that share a semantic action must define\n\
exactly the same identifiers."
"two productions that share a semantic action must define exactly\n\
the same identifiers. Here, \"%s\" is defined\n\
in one production, but not in all of them."
(Positions.value id)
with Not_found ->
) right_hand_sides
(* [normalize_producer i p] assigns a name of the form [_i]
to the unnamed producer [p]. *)
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