let basic_eval_input_notation (l1,l2) status =
GrafiteParser.extend status l1
(fun env loc ->
- let rec inner_loc default = function
- | [] -> default
- | (_,(NotationEnv.NoType,NotationEnv.LocValue l))::_ -> l
- | _::tl -> inner_loc default tl
+ let rec get_disamb = function
+ | [] -> Stdpp.dummy_loc,None,None
+ | (_,(NotationEnv.NoType,NotationEnv.DisambiguationValue dv))::_ -> dv
+ | _::tl -> get_disamb tl
in
- let inner_loc = inner_loc loc env in
- let l2' = TermContentPres.instantiate_level2 status env inner_loc l2 in
+ let l2' = TermContentPres.instantiate_level2 status env (get_disamb env) l2 in
prerr_endline ("new l2 ast : " ^ (NotationPp.pp_term status l2'));
NotationPt.AttributedTerm (`Loc loc,l2'))
;;
if dir <> Some `RightToLeft then eval_input_notation status (l1,l2)
else status
in
+ let status =
if dir <> Some `LeftToRight then eval_output_notation status (l1,l2)
else status
+ in prerr_endline ("new grammar:\n" ^ (Print_grammar.ebnf_of_term status));
+ status
| GrafiteAst.Alias (loc, spec) ->
let diff =
(*CSC: Warning: this code should be factorized with the corresponding