Commit 6d4c8892 authored by POTTIER Francois's avatar POTTIER Francois

Changed [nullable_first_rhs] to [nullable_first_prod] for external

users.
parent c017deea
......@@ -187,14 +187,14 @@ let rec follow1 tok derivation offset' = function
at the moment, so let's skip it. *)
derivation
| (item, _, offset) :: configs ->
let _, _, rhs, pos, length = Item.def item in
let prod, _, rhs, pos, length = Item.def item in
if offset = offset' then
(* This is an epsilon transition. Attack a new line and add
a comment that explains why the lookahead symbol is
produced or inherited. *)
let nullable, first = Analysis.nullable_first_rhs rhs (pos + 1) in
let nullable, first = Analysis.nullable_first_prod prod (pos + 1) in
if TerminalSet.mem tok first then
......@@ -304,7 +304,7 @@ let explain_reduce_item
if pos < length then
match rhs.(pos) with
| Symbol.N nt ->
let nullable, first = Analysis.nullable_first_rhs rhs (pos + 1) in
let nullable, first = Analysis.nullable_first_prod prod (pos + 1) in
let first : bool = TerminalSet.mem tok first in
let lookahead' =
if nullable then first || lookahead else first
......
......@@ -1270,7 +1270,9 @@ module Analysis = struct
let first = Array.get first
let nullable_first_rhs = nullable_first_rhs
let nullable_first_prod prod i =
let rhs = Production.rhs prod in
nullable_first_rhs rhs i
let explain_first_rhs (tok : Terminal.t) (rhs : Symbol.t array) (i : int) =
convert (explain tok rhs i)
......
......@@ -373,12 +373,12 @@ module Analysis : sig
val first: Nonterminal.t -> TerminalSet.t
(* [nullable_first_rhs rhs i] considers the string of symbols found at
offset [i] in the array [rhs]. It returns its NULLABLE flag as well
(* [nullable_first_prod prod i] considers the suffix of the the production
[prod] defined by offset [i]. It returns its NULLABLE flag as well
as its FIRST set. The offset [i] must be contained between [0] and
[n], where [n] is the length of [rhs], inclusive. *)
[n], inclusive, where [n] is the length of production [prod]. *)
val nullable_first_rhs: Symbol.t array -> int -> bool * TerminalSet.t
val nullable_first_prod: Production.index -> int -> bool * TerminalSet.t
(* [explain_first_rhs tok rhs i] explains why the token [tok] appears
in the FIRST set for the string of symbols found at offset [i] in
......
......@@ -171,7 +171,7 @@ module Closure (L : Lookahead.S) = struct
let constant, transmits =
if pos < length then
let nullable, first = Analysis.nullable_first_rhs rhs (pos + 1) in
let nullable, first = Analysis.nullable_first_prod prod (pos + 1) in
L.constant first, nullable
else
(* No epsilon transitions leave this item. *)
......
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