Commit cb955491 authored by POTTIER Francois's avatar POTTIER Francois

Removed the options in the [production_defs] table.

We simply associate an empty right-hand side with the start productions.
parent bf09998f
......@@ -864,16 +864,17 @@ let incoming_symbol_def () =
(* A table that maps a production (i.e., an integer index) to its definition
(i.e., its right-hand side). This table concerns ordinary productions only,
as opposed to the start productions, whose existence is not exposed to the
user. *)
user. We deal with the start productions by considering they have an empty
right-hand side. *)
let production_def prod =
if Production.is_start prod then
enone
else
esome (
elist (
if Production.is_start prod then
[]
else
(* The production's right-hand side. This is a list of symbols. *)
elist (List.map xsymbol (Array.to_list (Production.rhs prod)))
)
List.map xsymbol (Array.to_list (Production.rhs prod))
)
let production_defs () =
assert Settings.inspection;
......
......@@ -139,7 +139,7 @@ module type INSPECTION_TABLES = sig
(* The definition (i.e. left-hand side and right-hand side) of every
(non-start) production. *)
val production_defs: (xsymbol list) option array
val production_defs: xsymbol list array
(* A mapping of every (non-initial) state to its LR(0) core. *)
......
......@@ -174,21 +174,12 @@ module MakeInspection (T : TableFormat.INSPECTION_TABLES) = struct
let symbol =
T.symbol
let production_def prod =
assert (0 <= prod && prod < Array.length T.production_defs);
match T.production_defs.(prod) with
| None ->
(* should not happen; means [prod] is a start production *)
assert false
| Some data ->
data
let lhs prod =
let nt = PackedIntArray.get T.lhs prod in
T.nonterminal nt
let rhs prod =
production_def prod
T.production_defs.(prod)
(* This is a copy of [Item.export]. *)
......
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