raise (HExtlib.Localized
(floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
-type parsable = Grammar.parsable
+type parsable = Grammar.parsable * Ulexing.lexbuf
let parsable_statement status buf =
let grammar = CicNotationParser.level2_ast_grammar status in
- Grammar.parsable grammar (Obj.magic buf)
+ Grammar.parsable grammar (Obj.magic buf), buf
let parse_statement grafite_parser parsable =
exc_located_wrapper
- (fun () -> (Grammar.Entry.parse_parsable (Obj.magic grafite_parser) parsable))
+ (fun () -> (Grammar.Entry.parse_parsable (Obj.magic grafite_parser) (fst parsable)))
+
+let strm_of_parsable (_,buf) = buf
let add_raw_attribute ~text t = N.AttributedTerm (`Raw text, t)
| N.Implicit _ -> false
| N.UserInput -> true
| _ -> raise (Invalid_argument "malformed target parameter list 1")) l
- | _ -> raise (Invalid_argument ("malformed target parameter list 2\n" ^ NotationPp.pp_term params)) ]
+ | _ ->
+ (*CSC: new NCicPp.status is the best I can do here without changing the
+ result type *)
+ raise (Invalid_argument ("malformed target parameter list 2\n" ^ NotationPp.pp_term (new NCicPp.status) params)) ]
];
direction: [
[ SYMBOL ">" -> `LeftToRight
| IDENT "coercion"; name = IDENT; SYMBOL ":"; ty = term;
SYMBOL <:unicode<def>>; t = term; "on";
id = [ IDENT | PIDENT ]; SYMBOL ":"; source = term;
- "to"; target = term ->
- G.NCoercion(loc,name,t,ty,(id,source),target)
+ "to"; target = term; compose = OPT [ IDENT "nocomposites" -> () ] ->
+ let compose = compose = None in
+ G.NCoercion(loc,name,compose,t,ty,(id,source),target)
| IDENT "record" ; (params,name,ty,fields) = record_spec ->
G.NObj (loc, N.Record (params,name,ty,fields))
| IDENT "copy" ; s = IDENT; IDENT "from"; u = URI; "with";
method parser_db: db
end
-class status =
+class virtual status =
object(self)
inherit CicNotationParser.status ~keywords:[]
- val mutable db = None
+ val mutable db = None (* mutable only to initialize it :-( *)
method parser_db = match db with None -> assert false | Some x -> x
method set_parser_db v = {< db = Some v >}
method set_parser_status