1 (* Copyright (C) 2005, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
31 let exc_located_wrapper f =
35 | Ploc.Exc (_, End_of_file) -> raise End_of_file
36 | Ploc.Exc (floc, Stream.Error msg) ->
37 raise (HExtlib.Localized (floc,CicNotationParser.Parse_error msg))
38 | Ploc.Exc (floc, HExtlib.Localized(_,exn)) ->
39 raise (HExtlib.Localized
40 (floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
41 | Ploc.Exc (floc, exn) ->
42 raise (HExtlib.Localized
43 (floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
45 type parsable = Grammar.parsable * Ulexing.lexbuf
47 let parsable_statement status buf =
48 let grammar = CicNotationParser.level2_ast_grammar status in
49 Grammar.parsable grammar (Obj.magic buf), buf
51 let parse_statement grafite_parser parsable =
53 (fun () -> (Grammar.Entry.parse_parsable grafite_parser (fst parsable)))
55 let strm_of_parsable (_,buf) = buf
57 let add_raw_attribute ~text t = N.AttributedTerm (`Raw text, t)
59 let default_associativity = Gramext.NonA
61 let mk_rec_corec ind_kind defs loc =
64 | (params,(N.Ident (name, None), ty),_,_) :: _ ->
65 let ty = match ty with Some ty -> ty | None -> N.Implicit `JustOne in
68 (fun var ty -> N.Binder (`Pi,var,ty)
74 let body = N.Ident (name,None) in
75 let attrs = `Provided, `Definition, `Regular in
76 (loc, N.Theorem(name, ty, Some (N.LetRec (ind_kind, defs, body)), attrs))
78 let nmk_rec_corec ind_kind defs loc index =
79 let loc,t = mk_rec_corec ind_kind defs loc in
83 let nnon_punct_of_punct = function
84 | G.Skip loc -> G.NSkip loc
85 | G.Unfocus loc -> G.NUnfocus loc
86 | G.Focus (loc,l) -> G.NFocus (loc,l)
89 type by_continuation =
91 | BYC_weproved of N.term * string option * N.term option
92 | BYC_letsuchthat of string * N.term * string * N.term
93 | BYC_wehaveand of string * N.term * string * N.term
95 let mk_parser statement lstatus =
96 (* let grammar = CicNotationParser.level2_ast_grammar lstatus in *)
97 let term = CicNotationParser.term lstatus in
98 let let_defs = CicNotationParser.let_defs lstatus in
99 let let_codefs = CicNotationParser.let_codefs lstatus in
100 let protected_binder_vars = CicNotationParser.protected_binder_vars lstatus in
101 (* {{{ parser initialization *)
103 GLOBAL: term statement;
104 constructor: [ [ name = IDENT; SYMBOL ":"; typ = term -> (name, typ) ] ];
105 tactic_term: [ [ t = term LEVEL "90" -> t ] ];
106 ident_list1: [ [ LPAREN; idents = LIST1 IDENT; RPAREN -> idents ] ];
108 [ IDENT "normalize" ; delta = OPT [ IDENT "nodelta" -> () ] ->
109 let delta = match delta with None -> true | _ -> false in
111 | IDENT "whd" ; delta = OPT [ IDENT "nodelta" -> () ] ->
112 let delta = match delta with None -> true | _ -> false in
115 sequent_pattern_spec: [
119 path = OPT [SYMBOL ":" ; path = tactic_term -> path ] ->
120 (id,match path with Some p -> p | None -> N.UserInput) ];
121 goal_path = OPT [ SYMBOL <:unicode<vdash>>; term = tactic_term -> term ] ->
123 match goal_path, hyp_paths with
124 None, [] -> Some N.UserInput
126 | Some goal_path, _ -> Some goal_path
135 [ "match" ; wanted = tactic_term ;
136 sps = OPT [ "in"; sps = sequent_pattern_spec -> sps ] ->
138 | sps = sequent_pattern_spec ->
142 let wanted,hyp_paths,goal_path =
143 match wanted_and_sps with
144 wanted,None -> wanted, [], Some N.UserInput
145 | wanted,Some (hyp_paths,goal_path) -> wanted,hyp_paths,goal_path
147 wanted, hyp_paths, goal_path ] ->
149 None -> None,[],Some N.UserInput
152 inverter_param_list: [
153 [ params = tactic_term ->
154 let deannotate = function
155 | N.AttributedTerm (_,t) | t -> t
156 in match deannotate params with
157 | N.Implicit _ -> [false]
158 | N.UserInput -> [true]
160 List.map (fun x -> match deannotate x with
161 | N.Implicit _ -> false
162 | N.UserInput -> true
163 | _ -> raise (Invalid_argument "malformed target parameter list 1")) l
165 (*CSC: new NCicPp.status is the best I can do here without changing the
167 raise (Invalid_argument ("malformed target parameter list 2\n" ^ NotationPp.pp_term (new NCicPp.status) params)) ]
170 [ SYMBOL ">" -> `LeftToRight
171 | SYMBOL "<" -> `RightToLeft ]
173 int: [ [ num = NUMBER -> int_of_string num ] ];
175 [ SYMBOL "@"; t = tactic_term -> G.NTactic(loc,[G.NApply (loc, t)])
176 | IDENT "applyS"; t = tactic_term -> G.NTactic(loc,[G.NSmartApply(loc, t)])
180 [ id = IDENT ; SYMBOL ":" ; ty = tactic_term -> id,`Decl ty
181 | id = IDENT ; SYMBOL ":" ; ty = tactic_term ;
182 SYMBOL <:unicode<def>> ; bo = tactic_term ->
184 SYMBOL <:unicode<vdash>>;
185 concl = tactic_term -> (List.rev hyps,concl) ] ->
186 G.NTactic(loc,[G.NAssert (loc, seqs)])
187 | SYMBOL "/"; num = OPT NUMBER ;
188 just_and_params = auto_params; SYMBOL "/" ->
189 let just,params = just_and_params in
190 let depth = match num with Some n -> n | None -> "1" in
194 [G.NAuto(loc,(None,["depth",depth]@params))])
195 | Some (`Univ univ) ->
197 [G.NAuto(loc,(Some univ,["depth",depth]@params))])
200 G.NAutoInteractive (loc, (None,["depth",depth]@params))))
201 | SYMBOL "#"; SYMBOL "#" -> G.NMacro (loc, G.NIntroGuess loc)
202 | IDENT "check"; t = tactic_term -> G.NMacro(loc,G.NCheck (loc,t))
203 | IDENT "screenshot"; fname = QSTRING ->
204 G.NMacro(loc,G.Screenshot (loc, fname))
205 | IDENT "cases"; what = tactic_term ; where = pattern_spec ->
206 G.NTactic(loc,[G.NCases (loc, what, where)])
207 | IDENT "change"; "with"; with_what = tactic_term; what = pattern_spec ->
208 G.NTactic(loc,[G.NChange (loc, what, with_what)])
209 | SYMBOL "-"; id = IDENT ->
210 G.NTactic(loc,[G.NClear (loc, [id])])
211 | PLACEHOLDER; num = OPT NUMBER;
212 l = OPT [ SYMBOL "{"; l = LIST1 tactic_term; SYMBOL "}" -> l ] ->
213 G.NTactic(loc,[G.NConstructor (loc, (match num with None -> None | Some x -> Some (int_of_string x)),match l with None -> [] | Some l -> l)])
214 | IDENT "cut"; t = tactic_term -> G.NTactic(loc,[G.NCut (loc, t)])
215 | IDENT "destruct"; just = OPT [ dom = ident_list1 -> dom ];
216 exclude = OPT [ IDENT "skip"; skip = ident_list1 -> skip ]
217 -> let exclude' = match exclude with None -> [] | Some l -> l in
218 G.NTactic(loc,[G.NDestruct (loc,just,exclude')])
219 | IDENT "elim"; what = tactic_term ; where = pattern_spec ->
220 G.NTactic(loc,[G.NElim (loc, what, where)])
221 | IDENT "generalize"; p=pattern_spec ->
222 G.NTactic(loc,[G.NGeneralize (loc, p)])
223 | IDENT "inversion"; what = tactic_term ; where = pattern_spec ->
224 G.NTactic(loc,[G.NInversion (loc, what, where)])
225 | IDENT "lapply"; t = tactic_term -> G.NTactic(loc,[G.NLApply (loc, t)])
226 | IDENT "letin"; name = IDENT ; SYMBOL <:unicode<def>> ; t = tactic_term;
227 where = pattern_spec ->
228 G.NTactic(loc,[G.NLetIn (loc,where,t,name)])
229 | kind = nreduction_kind; p = pattern_spec ->
230 G.NTactic(loc,[G.NReduce (loc, kind, p)])
231 | dir = direction; what = tactic_term ; where = pattern_spec ->
232 G.NTactic(loc,[G.NRewrite (loc, dir, what, where)])
233 | IDENT "try"; tac = SELF ->
234 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
235 G.NTactic(loc,[ G.NTry (loc,tac)])
236 | IDENT "repeat"; tac = SELF ->
237 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
238 G.NTactic(loc,[ G.NRepeat (loc,tac)])
239 | LPAREN; l = LIST1 SELF; RPAREN ->
242 (List.map (function G.NTactic(_,t) -> t | _ -> assert false) l) in
243 G.NTactic(loc,[G.NBlock (loc,l)])
244 | IDENT "assumption" -> G.NTactic(loc,[ G.NAssumption loc])
245 | SYMBOL "#"; ns=IDENT -> G.NTactic(loc,[ G.NIntros (loc,[ns])])
246 | SYMBOL "#"; SYMBOL "_" -> G.NTactic(loc,[ G.NIntro (loc,"_")])
247 | SYMBOL "*" -> G.NTactic(loc,[ G.NCase1 (loc,"_")])
248 | SYMBOL "*"; "as"; n=IDENT -> G.NTactic(loc,[ G.NCase1 (loc,n)])
253 | IDENT "fast_paramod"
263 i = auto_fixed_param -> i,""
264 | i = auto_fixed_param ; SYMBOL "="; v = [ v = int ->
265 string_of_int v | v = IDENT -> v ] -> i,v ];
266 just = OPT [ IDENT "by"; by =
267 [ univ = LIST0 tactic_term SEP SYMBOL "," -> `Univ univ
268 | SYMBOL "_" -> `Trace ] -> by ] -> just,params
274 [ WEPROVED; ty = tactic_term ; LPAREN ; id = IDENT ; RPAREN ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] -> BYC_weproved (ty,Some id,t1)
275 | WEPROVED; ty = tactic_term ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] ;
276 "done" -> BYC_weproved (ty,None,t1)
278 | "let" ; id1 = IDENT ; SYMBOL ":" ; t1 = tactic_term ;
279 IDENT "such" ; IDENT "that" ; t2=tactic_term ; LPAREN ;
280 id2 = IDENT ; RPAREN -> BYC_letsuchthat (id1,t1,id2,t2)
281 | WEHAVE; t1=tactic_term ; LPAREN ; id1=IDENT ; RPAREN ;"and" ; t2=tactic_term ; LPAREN ; id2=IDENT ; RPAREN ->
282 BYC_wehaveand (id1,t1,id2,t2)
287 rewriting_step_continuation : [
296 [ t1 = SELF; SYMBOL ";"; t2 = SELF ->
299 | G.Seq (_, l) -> l @ [ t2 ]
305 [ tac = SELF; SYMBOL ";";
306 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
307 (G.Then (loc, tac, tacs))
310 [ IDENT "do"; count = int; tac = SELF ->
311 G.Do (loc, count, tac)
312 | IDENT "repeat"; tac = SELF -> G.Repeat (loc, tac)
316 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
318 | IDENT "try"; tac = SELF -> G.Try (loc, tac)
320 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
322 | IDENT "progress"; tac = SELF -> G.Progress (loc, tac)
323 | LPAREN; tac = SELF; RPAREN -> tac
324 | tac = tactic -> tac
328 npunctuation_tactical:
330 [ SYMBOL "[" -> G.NBranch loc
331 | SYMBOL "|" -> G.NShift loc
332 | i = LIST1 int SEP SYMBOL ","; SYMBOL ":" -> G.NPos (loc, i)
333 | SYMBOL "*"; SYMBOL ":" -> G.NWildcard loc
334 | name = IDENT; SYMBOL ":" -> G.NPosbyname (loc, name)
335 | SYMBOL "]" -> G.NMerge loc
336 | SYMBOL ";" -> G.NSemicolon loc
337 | SYMBOL "." -> G.NDot loc
340 nnon_punctuation_tactical:
342 [ IDENT "focus"; goals = LIST1 int -> G.NFocus (loc, goals)
343 | IDENT "unfocus" -> G.NUnfocus loc
344 | IDENT "skip" -> G.NSkip loc
348 [ [ IDENT "definition" ] -> `Definition
349 | [ IDENT "fact" ] -> `Fact
350 | [ IDENT "lemma" ] -> `Lemma
351 | [ IDENT "example" ] -> `Example
352 | [ IDENT "theorem" ] -> `Theorem
353 | [ IDENT "corollary" ] -> `Corollary
358 params = LIST0 protected_binder_vars;
359 SYMBOL ":"; fst_typ = term; SYMBOL <:unicode<def>>; OPT SYMBOL "|";
360 fst_constructors = LIST0 constructor SEP SYMBOL "|";
363 name = IDENT; SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>;
364 OPT SYMBOL "|"; constructors = LIST0 constructor SEP SYMBOL "|" ->
365 (name, true, typ, constructors) ] SEP "with" -> types
369 (fun (names, typ) acc ->
370 (List.map (fun name -> (name, typ)) names) @ acc)
373 let fst_ind_type = (fst_name, true, fst_typ, fst_constructors) in
374 let tl_ind_types = match tl with None -> [] | Some types -> types in
375 let ind_types = fst_ind_type :: tl_ind_types in
381 params = LIST0 protected_binder_vars;
382 SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>; SYMBOL "{" ;
386 SYMBOL ":" -> false,0
387 | SYMBOL ":"; SYMBOL ">" -> true,0
388 | SYMBOL ":"; arity = int ; SYMBOL ">" -> true,arity
391 let b,n = coercion in
393 ] SEP SYMBOL ";"; SYMBOL "}" ->
396 (fun (names, typ) acc ->
397 (List.map (fun name -> (name, typ)) names) @ acc)
400 (params,name,typ,fields)
404 [ IDENT "id"; id = QSTRING; SYMBOL "="; uri = QSTRING ->
405 let alpha = "[a-zA-Z]" in
406 let num = "[0-9]+" in
407 let ident_cont = "\\("^alpha^"\\|"^num^"\\|_\\|\\\\\\)" in
408 let decoration = "\\'" in
409 let ident = "\\("^alpha^ident_cont^"*"^decoration^"*\\|_"^ident_cont^"+"^decoration^"*\\)" in
410 let rex = Str.regexp ("^"^ident^"$") in
411 if Str.string_match rex id 0 then
412 if (try ignore (NReference.reference_of_string uri); true
413 with NReference.IllFormedReference _ -> false)
415 G.Ident_alias (id, uri)
418 (HExtlib.Localized (loc, CicNotationParser.Parse_error (Printf.sprintf "Not a valid uri: %s" uri)))
420 raise (HExtlib.Localized (loc, CicNotationParser.Parse_error (
421 Printf.sprintf "Not a valid identifier: %s" id)))
422 | IDENT "symbol"; symbol = QSTRING;
423 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
424 SYMBOL "="; dsc = QSTRING ->
426 match instance with Some i -> i | None -> 0
428 G.Symbol_alias (symbol, instance, dsc)
430 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
431 SYMBOL "="; dsc = QSTRING ->
433 match instance with Some i -> i | None -> 0
435 G.Number_alias (instance, dsc)
439 [ l = LIST0 [ SYMBOL <:unicode<eta>> (* η *); SYMBOL "." -> () ];
441 N.IdentArg (List.length l, id)
445 [ IDENT "left"; IDENT "associative" -> Gramext.LeftA
446 | IDENT "right"; IDENT "associative" -> Gramext.RightA
447 | IDENT "non"; IDENT "associative" -> Gramext.NonA
451 [ "with"; IDENT "precedence"; n = NUMBER -> int_of_string n ]
454 [ dir = OPT direction; s = QSTRING;
455 assoc = OPT associativity; prec = precedence;
458 [ blob = UNPARSED_AST ->
459 add_raw_attribute ~text:(Printf.sprintf "@{%s}" blob)
460 (CicNotationParser.parse_level2_ast lstatus
461 (Ulexing.from_utf8_string blob))
462 | blob = UNPARSED_META ->
463 add_raw_attribute ~text:(Printf.sprintf "${%s}" blob)
464 (CicNotationParser.parse_level2_meta lstatus
465 (Ulexing.from_utf8_string blob))
469 | None -> default_associativity
470 | Some assoc -> assoc
473 add_raw_attribute ~text:s
474 (CicNotationParser.parse_level1_pattern lstatus prec
475 (Ulexing.from_utf8_string s))
477 (dir, p1, assoc, prec, p2)
481 [ r = NREF -> N.NRefPattern (NReference.reference_of_string r)
482 | IMPLICIT -> N.ImplicitPattern
483 | id = IDENT -> N.VarPattern id
484 | LPAREN; terms = LIST1 SELF; RPAREN ->
488 | terms -> N.ApplPattern terms)
492 [ s = CSYMBOL; args = LIST0 argument; SYMBOL "="; t = level3_term ->
498 IDENT "include" ; path = QSTRING ->
499 loc,path,G.WithPreferences
500 | IDENT "include" ; IDENT "alias"; path = QSTRING ->
501 loc,path,G.OnlyPreferences
502 | IDENT "include'" ; path = QSTRING ->
503 loc,path,G.WithoutPreferences
506 index: [[ b = OPT SYMBOL "-" -> match b with None -> true | _ -> false ]];
508 grafite_ncommand: [ [
509 IDENT "qed" ; i = index -> G.NQed (loc,i)
510 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL ":"; typ = term;
511 body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
512 let attrs = `Provided, nflavour, `Regular in
513 G.NObj (loc, N.Theorem (name, typ, body, attrs),true)
514 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL <:unicode<def>> (* ≝ *);
516 let attrs = `Provided, nflavour, `Regular in
518 N.Theorem(name, N.Implicit `JustOne, Some body, attrs),
520 | IDENT "axiom"; i = index; name = IDENT; SYMBOL ":"; typ = term ->
521 let attrs = `Provided, `Axiom, `Regular in
522 G.NObj (loc, N.Theorem (name, typ, None, attrs),i)
523 | IDENT "discriminator" ; indty = tactic_term -> G.NDiscriminator (loc,indty)
524 | IDENT "inverter"; name = IDENT; IDENT "for" ; indty = tactic_term ;
525 paramspec = OPT inverter_param_list ;
526 outsort = OPT [ SYMBOL ":" ; outsort = term -> outsort ] ->
527 G.NInverter (loc,name,indty,paramspec,outsort)
528 | LETCOREC ; defs = let_codefs ->
529 nmk_rec_corec `CoInductive defs loc true
530 | LETREC ; defs = let_defs ->
531 nmk_rec_corec `Inductive defs loc true
532 | IDENT "inductive"; spec = inductive_spec ->
533 let (params, ind_types) = spec in
534 G.NObj (loc, N.Inductive (params, ind_types),true)
535 | IDENT "coinductive"; spec = inductive_spec ->
536 let (params, ind_types) = spec in
537 let ind_types = (* set inductive flags to false (coinductive) *)
538 List.map (fun (name, _, term, ctors) -> (name, false, term, ctors))
541 G.NObj (loc, N.Inductive (params, ind_types),true)
542 | IDENT "universe"; IDENT "constraint"; u1 = tactic_term;
543 SYMBOL <:unicode<lt>> ; u2 = tactic_term ->
545 | NotationPt.AttributedTerm (_, NotationPt.Sort (`NType i)) ->
546 NUri.uri_of_string ("cic:/matita/pts/Type"^i^".univ")
547 | _ -> raise (Failure "only a Type[…] sort can be constrained")
551 G.NUnivConstraint (loc,u1,u2)
552 | IDENT "unification"; IDENT "hint"; n = int; t = tactic_term ->
553 G.UnificationHint (loc, t, n)
554 | IDENT "coercion"; name = IDENT;
555 compose = OPT [ IDENT "nocomposites" -> () ];
556 spec = OPT [ SYMBOL ":"; ty = term;
557 SYMBOL <:unicode<def>>; t = term; "on";
558 id = [ IDENT | PIDENT ]; SYMBOL ":"; source = term;
559 "to"; target = term -> t,ty,(id,source),target ] ->
560 let compose = compose = None in
561 G.NCoercion(loc,name,compose,spec)
562 | IDENT "record" ; (params,name,ty,fields) = record_spec ->
563 G.NObj (loc, N.Record (params,name,ty,fields),true)
564 | IDENT "copy" ; s = IDENT; IDENT "from"; u = URI; "with";
565 m = LIST0 [ u1 = URI; SYMBOL <:unicode<mapsto>>; u2 = URI -> u1,u2 ] ->
566 G.NCopy (loc,s,NUri.uri_of_string u,
567 List.map (fun a,b -> NUri.uri_of_string a, NUri.uri_of_string b) m)
568 | lc = lexicon_command -> lc
572 IDENT "alias" ; spec = alias_spec ->
574 | IDENT "notation"; (dir, l1, assoc, prec, l2) = notation ->
575 G.Notation (loc, dir, l1, assoc, prec, l2)
576 | IDENT "interpretation"; id = QSTRING;
577 (symbol, args, l3) = interpretation ->
578 G.Interpretation (loc, id, (symbol, args), l3)
581 [ ncmd = grafite_ncommand; SYMBOL "." -> G.NCommand (loc, ncmd)
582 | punct = npunctuation_tactical -> G.NTactic (loc, [punct])
583 | tac = nnon_punctuation_tactical(*; punct = npunctuation_tactical*) ->
584 G.NTactic (loc, [tac])
585 | tac = ntactic (*; punct = npunctuation_tactical*) ->
588 | tac = nnon_punctuation_tactical;
589 punct = npunctuation_tactical ->
590 G.NTactic (loc, [tac; punct])
595 [ BEGINCOMMENT ; ex = executable ; ENDCOMMENT ->
602 [ ex = executable -> G.Executable (loc, ex)
603 | com = comment -> G.Comment (loc, com)
604 | (iloc,fname,mode) = include_command ; SYMBOL "." ->
605 G.Executable (loc,G.NCommand (loc,G.Include (iloc,mode,fname)))
606 | EOI -> raise End_of_file
614 type db = GrafiteAst.statement Grammar.Entry.e ;;
616 class type g_status =
618 inherit CicNotationParser.g_status
622 class virtual status =
624 inherit CicNotationParser.status ~keywords:[]
625 val mutable db = None (* mutable only to initialize it :-( *)
626 method parser_db = match db with None -> assert false | Some x -> x
627 method set_parser_db v = {< db = Some v >}
628 method set_parser_status
629 : 'status. #g_status as 'status -> 'self
630 = fun o -> {< db = Some o#parser_db >}#set_notation_parser_status o
632 let grammar = CicNotationParser.level2_ast_grammar self in
633 db <- Some (mk_parser (Grammar.Entry.create grammar "statement") self)
636 let extend status l1 action =
637 let status = CicNotationParser.extend status l1 action in
638 let grammar = CicNotationParser.level2_ast_grammar status in
640 (mk_parser (Grammar.Entry.create grammar "statement") status)
644 let parse_statement status =
645 parse_statement status#parser_db
647 (* vim:set foldmethod=marker: *)