let rec start_parser_of_levels entry clevn =
function
| [] ->
(fun _ (__strm : _ Stream.t) -> raise Stream.Failure)
| lev :: levs ->
let p1 = start_parser_of_levels entry (succ clevn) levs
in
(match lev.lprefix with
| DeadEnd -> p1
| tree ->
let alevn =
(match lev.assoc with
| LeftA | NonA -> succ clevn
| RightA -> clevn) in
let p2 =
parser_of_tree entry (succ clevn) alevn tree
in
(match levs with
| [] ->
(fun levn strm ->
let bp = loc_bp strm in
let (__strm : _ Stream.t) = strm in
let (act, loc) =
add_loc bp p2 __strm in
let strm = __strm in
let a = Action.getf act loc
in entry.econtinue levn loc a strm)
| _ ->
(fun levn strm ->
if levn > clevn
then p1 levn strm
else
(let bp = loc_bp strm in
let (__strm : _ Stream.t) = strm
in
match try
Some
(add_loc bp p2 __strm)
with
| Stream.Failure -> None
with
| Some ((act, loc)) ->
let a = Action.getf act loc
in
entry.econtinue levn loc a
strm
| _ -> p1 levn __strm))))