equal
deleted
inserted
replaced
292 val _ = |
292 val _ = |
293 if len <= Config.get ctxt Syntax.ambiguity_level then () |
293 if len <= Config.get ctxt Syntax.ambiguity_level then () |
294 else if not (Config.get ctxt Syntax.ambiguity_enabled) then error (ambiguity_msg pos) |
294 else if not (Config.get ctxt Syntax.ambiguity_enabled) then error (ambiguity_msg pos) |
295 else if warnings then |
295 else if warnings then |
296 (Context_Position.if_visible ctxt warning (cat_lines |
296 (Context_Position.if_visible ctxt warning (cat_lines |
297 (("Ambiguous input" ^ Position.str_of pos ^ |
297 (("Ambiguous input" ^ Position.str_of (Position.reset_range pos) ^ |
298 "\nproduces " ^ string_of_int len ^ " parse trees" ^ |
298 "\nproduces " ^ string_of_int len ^ " parse trees" ^ |
299 (if len <= limit then "" else " (" ^ string_of_int limit ^ " displayed)") ^ ":") :: |
299 (if len <= limit then "" else " (" ^ string_of_int limit ^ " displayed)") ^ ":") :: |
300 map (Pretty.string_of o Parser.pretty_parsetree) (take limit pts)))) |
300 map (Pretty.string_of o Parser.pretty_parsetree) (take limit pts)))) |
301 else (); |
301 else (); |
302 |
302 |
384 report_result ctxt pos |
384 report_result ctxt pos |
385 [(reports', Exn.Exn (Exn.EXCEPTIONS (map ERROR ambig_msg @ errs)))] |
385 [(reports', Exn.Exn (Exn.EXCEPTIONS (map ERROR ambig_msg @ errs)))] |
386 else if len = 1 then |
386 else if len = 1 then |
387 (if ambiguity > level andalso warnings then |
387 (if ambiguity > level andalso warnings then |
388 Context_Position.if_visible ctxt warning |
388 Context_Position.if_visible ctxt warning |
389 "Fortunately, only one parse tree is type correct.\n\ |
389 ("Fortunately, only one parse tree is type correct" ^ |
390 \You may still want to disambiguate your grammar or your input." |
390 Position.str_of (Position.reset_range pos) ^ |
|
391 ",\nbut you may still want to disambiguate your grammar or your input.") |
391 else (); report_result ctxt pos results') |
392 else (); report_result ctxt pos results') |
392 else |
393 else |
393 report_result ctxt pos |
394 report_result ctxt pos |
394 [(reports', Exn.Exn (ERROR (cat_lines (ambig_msg @ |
395 [(reports', Exn.Exn (ERROR (cat_lines (ambig_msg @ |
395 (("Ambiguous input, " ^ string_of_int len ^ " terms are type correct" ^ |
396 (("Ambiguous input, " ^ string_of_int len ^ " terms are type correct" ^ |