aboutsummaryrefslogtreecommitdiff
path: root/gramlib
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2018-11-30 15:04:02 +0100
committerPierre-Marie Pédrot2018-12-05 17:58:01 +0100
commit3edf9e19972a11eb652ed2fb9a8288d005dc2927 (patch)
tree1749d7e0f98253d231935c512faf3ec1b8f913a7 /gramlib
parentc03c4ea72e920bf69f29b9ef48c7be64c504d293 (diff)
Remove the Like level modifier from gramlib.
Apart from the fact we did not use it, its semantics was somewhat flaky as it was looking for any rule containing some token.
Diffstat (limited to 'gramlib')
-rw-r--r--gramlib/gramext.ml36
-rw-r--r--gramlib/gramext.mli1
2 files changed, 0 insertions, 37 deletions
diff --git a/gramlib/gramext.ml b/gramlib/gramext.ml
index f8259b4570..46c2688f05 100644
--- a/gramlib/gramext.ml
+++ b/gramlib/gramext.ml
@@ -52,7 +52,6 @@ type position =
| Last
| Before of string
| After of string
- | Like of string
| Level of string
let rec derive_eps =
@@ -154,27 +153,6 @@ let is_level_labelled n lev =
Some n1 -> n = n1
| None -> false
-let rec token_exists_in_level f lev =
- token_exists_in_tree f lev.lprefix || token_exists_in_tree f lev.lsuffix
-and token_exists_in_tree f =
- function
- Node n ->
- token_exists_in_symbol f n.node || token_exists_in_tree f n.brother ||
- token_exists_in_tree f n.son
- | LocAct (_, _) | DeadEnd -> false
-and token_exists_in_symbol f =
- function
- | Slist0 sy -> token_exists_in_symbol f sy
- | Slist0sep (sy, sep, _) ->
- token_exists_in_symbol f sy || token_exists_in_symbol f sep
- | Slist1 sy -> token_exists_in_symbol f sy
- | Slist1sep (sy, sep, _) ->
- token_exists_in_symbol f sy || token_exists_in_symbol f sep
- | Sopt sy -> token_exists_in_symbol f sy
- | Stoken tok -> f tok
- | Stree t -> token_exists_in_tree f t
- | Snterm _ | Snterml (_, _) | Snext | Sself -> false
-
let insert_level ~warning entry_name e1 symbols action slev =
match e1 with
true ->
@@ -265,20 +243,6 @@ let get_level ~warning entry position levs =
let (levs1, rlev, levs2) = get levs in lev :: levs1, rlev, levs2
in
get levs
- | Some (Like n) ->
- let f (tok, prm) = n = tok || n = prm in
- let rec get =
- function
- [] ->
- eprintf "No level with \"%s\" in entry \"%s\"\n" n entry.ename;
- flush stderr;
- failwith "Grammar.extend"
- | lev :: levs ->
- if token_exists_in_level f lev then [], change_lev ~warning lev n, levs
- else
- let (levs1, rlev, levs2) = get levs in lev :: levs1, rlev, levs2
- in
- get levs
| None ->
match levs with
lev :: levs -> [], change_lev ~warning lev "<top>", levs
diff --git a/gramlib/gramext.mli b/gramlib/gramext.mli
index 7fad01c6a4..f1e294fb4c 100644
--- a/gramlib/gramext.mli
+++ b/gramlib/gramext.mli
@@ -50,7 +50,6 @@ type position =
| Last
| Before of string
| After of string
- | Like of string
| Level of string
val levels_of_rules : warning:(string -> unit) option ->