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 (loc, N.Theorem(`Definition, name, ty, Some (N.LetRec (ind_kind, defs, body)), `Regular))
77 let nmk_rec_corec ind_kind defs loc index =
78 let loc,t = mk_rec_corec ind_kind defs loc in
82 let nnon_punct_of_punct = function
83 | G.Skip loc -> G.NSkip loc
84 | G.Unfocus loc -> G.NUnfocus loc
85 | G.Focus (loc,l) -> G.NFocus (loc,l)
88 type by_continuation =
90 | BYC_weproved of N.term * string option * N.term option
91 | BYC_letsuchthat of string * N.term * string * N.term
92 | BYC_wehaveand of string * N.term * string * N.term
94 let mk_parser statement lstatus =
95 (* let grammar = CicNotationParser.level2_ast_grammar lstatus in *)
96 let term = CicNotationParser.term lstatus in
97 let let_defs = CicNotationParser.let_defs lstatus in
98 let let_codefs = CicNotationParser.let_codefs lstatus in
99 let protected_binder_vars = CicNotationParser.protected_binder_vars lstatus in
100 (* {{{ parser initialization *)
102 GLOBAL: term statement;
103 constructor: [ [ name = IDENT; SYMBOL ":"; typ = term -> (name, typ) ] ];
104 tactic_term: [ [ t = term LEVEL "90" -> t ] ];
105 ident_list1: [ [ LPAREN; idents = LIST1 IDENT; RPAREN -> idents ] ];
107 [ IDENT "normalize" ; delta = OPT [ IDENT "nodelta" -> () ] ->
108 let delta = match delta with None -> true | _ -> false in
110 | IDENT "whd" ; delta = OPT [ IDENT "nodelta" -> () ] ->
111 let delta = match delta with None -> true | _ -> false in
114 sequent_pattern_spec: [
118 path = OPT [SYMBOL ":" ; path = tactic_term -> path ] ->
119 (id,match path with Some p -> p | None -> N.UserInput) ];
120 goal_path = OPT [ SYMBOL <:unicode<vdash>>; term = tactic_term -> term ] ->
122 match goal_path, hyp_paths with
123 None, [] -> Some N.UserInput
125 | Some goal_path, _ -> Some goal_path
134 [ "match" ; wanted = tactic_term ;
135 sps = OPT [ "in"; sps = sequent_pattern_spec -> sps ] ->
137 | sps = sequent_pattern_spec ->
141 let wanted,hyp_paths,goal_path =
142 match wanted_and_sps with
143 wanted,None -> wanted, [], Some N.UserInput
144 | wanted,Some (hyp_paths,goal_path) -> wanted,hyp_paths,goal_path
146 wanted, hyp_paths, goal_path ] ->
148 None -> None,[],Some N.UserInput
151 inverter_param_list: [
152 [ params = tactic_term ->
153 let deannotate = function
154 | N.AttributedTerm (_,t) | t -> t
155 in match deannotate params with
156 | N.Implicit _ -> [false]
157 | N.UserInput -> [true]
159 List.map (fun x -> match deannotate x with
160 | N.Implicit _ -> false
161 | N.UserInput -> true
162 | _ -> raise (Invalid_argument "malformed target parameter list 1")) l
164 (*CSC: new NCicPp.status is the best I can do here without changing the
166 raise (Invalid_argument ("malformed target parameter list 2\n" ^ NotationPp.pp_term (new NCicPp.status) params)) ]
169 [ SYMBOL ">" -> `LeftToRight
170 | SYMBOL "<" -> `RightToLeft ]
172 int: [ [ num = NUMBER -> int_of_string num ] ];
174 [ SYMBOL "@"; t = tactic_term -> G.NTactic(loc,[G.NApply (loc, t)])
175 | IDENT "applyS"; t = tactic_term -> G.NTactic(loc,[G.NSmartApply(loc, t)])
179 [ id = IDENT ; SYMBOL ":" ; ty = tactic_term -> id,`Decl ty
180 | id = IDENT ; SYMBOL ":" ; ty = tactic_term ;
181 SYMBOL <:unicode<def>> ; bo = tactic_term ->
183 SYMBOL <:unicode<vdash>>;
184 concl = tactic_term -> (List.rev hyps,concl) ] ->
185 G.NTactic(loc,[G.NAssert (loc, seqs)])
186 | SYMBOL "/"; num = OPT NUMBER ;
187 just_and_params = auto_params; SYMBOL "/" ->
188 let just,params = just_and_params in
189 let depth = match num with Some n -> n | None -> "1" in
193 [G.NAuto(loc,(None,["depth",depth]@params))])
194 | Some (`Univ univ) ->
196 [G.NAuto(loc,(Some univ,["depth",depth]@params))])
199 G.NAutoInteractive (loc, (None,["depth",depth]@params))))
200 | SYMBOL "#"; SYMBOL "#" -> G.NMacro (loc, G.NIntroGuess loc)
201 | IDENT "check"; t = tactic_term -> G.NMacro(loc,G.NCheck (loc,t))
202 | IDENT "screenshot"; fname = QSTRING ->
203 G.NMacro(loc,G.Screenshot (loc, fname))
204 | IDENT "cases"; what = tactic_term ; where = pattern_spec ->
205 G.NTactic(loc,[G.NCases (loc, what, where)])
206 | IDENT "change"; "with"; with_what = tactic_term; what = pattern_spec ->
207 G.NTactic(loc,[G.NChange (loc, what, with_what)])
208 | SYMBOL "-"; id = IDENT ->
209 G.NTactic(loc,[G.NClear (loc, [id])])
210 | PLACEHOLDER; num = OPT NUMBER;
211 l = OPT [ SYMBOL "{"; l = LIST1 tactic_term; SYMBOL "}" -> l ] ->
212 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)])
213 | IDENT "cut"; t = tactic_term -> G.NTactic(loc,[G.NCut (loc, t)])
214 | IDENT "destruct"; just = OPT [ dom = ident_list1 -> dom ];
215 exclude = OPT [ IDENT "skip"; skip = ident_list1 -> skip ]
216 -> let exclude' = match exclude with None -> [] | Some l -> l in
217 G.NTactic(loc,[G.NDestruct (loc,just,exclude')])
218 | IDENT "elim"; what = tactic_term ; where = pattern_spec ->
219 G.NTactic(loc,[G.NElim (loc, what, where)])
220 | IDENT "generalize"; p=pattern_spec ->
221 G.NTactic(loc,[G.NGeneralize (loc, p)])
222 | IDENT "inversion"; what = tactic_term ; where = pattern_spec ->
223 G.NTactic(loc,[G.NInversion (loc, what, where)])
224 | IDENT "lapply"; t = tactic_term -> G.NTactic(loc,[G.NLApply (loc, t)])
225 | IDENT "letin"; name = IDENT ; SYMBOL <:unicode<def>> ; t = tactic_term;
226 where = pattern_spec ->
227 G.NTactic(loc,[G.NLetIn (loc,where,t,name)])
228 | kind = nreduction_kind; p = pattern_spec ->
229 G.NTactic(loc,[G.NReduce (loc, kind, p)])
230 | dir = direction; what = tactic_term ; where = pattern_spec ->
231 G.NTactic(loc,[G.NRewrite (loc, dir, what, where)])
232 | IDENT "try"; tac = SELF ->
233 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
234 G.NTactic(loc,[ G.NTry (loc,tac)])
235 | IDENT "repeat"; tac = SELF ->
236 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
237 G.NTactic(loc,[ G.NRepeat (loc,tac)])
238 | LPAREN; l = LIST1 SELF; RPAREN ->
241 (List.map (function G.NTactic(_,t) -> t | _ -> assert false) l) in
242 G.NTactic(loc,[G.NBlock (loc,l)])
243 | IDENT "assumption" -> G.NTactic(loc,[ G.NAssumption loc])
244 | SYMBOL "#"; ns=IDENT -> G.NTactic(loc,[ G.NIntros (loc,[ns])])
245 | SYMBOL "#"; SYMBOL "_" -> G.NTactic(loc,[ G.NIntro (loc,"_")])
246 | SYMBOL "*" -> G.NTactic(loc,[ G.NCase1 (loc,"_")])
247 | SYMBOL "*"; "as"; n=IDENT -> G.NTactic(loc,[ G.NCase1 (loc,n)])
252 | IDENT "fast_paramod"
262 i = auto_fixed_param -> i,""
263 | i = auto_fixed_param ; SYMBOL "="; v = [ v = int ->
264 string_of_int v | v = IDENT -> v ] -> i,v ];
265 just = OPT [ IDENT "by"; by =
266 [ univ = LIST0 tactic_term SEP SYMBOL "," -> `Univ univ
267 | SYMBOL "_" -> `Trace ] -> by ] -> just,params
273 [ 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)
274 | WEPROVED; ty = tactic_term ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] ;
275 "done" -> BYC_weproved (ty,None,t1)
277 | "let" ; id1 = IDENT ; SYMBOL ":" ; t1 = tactic_term ;
278 IDENT "such" ; IDENT "that" ; t2=tactic_term ; LPAREN ;
279 id2 = IDENT ; RPAREN -> BYC_letsuchthat (id1,t1,id2,t2)
280 | WEHAVE; t1=tactic_term ; LPAREN ; id1=IDENT ; RPAREN ;"and" ; t2=tactic_term ; LPAREN ; id2=IDENT ; RPAREN ->
281 BYC_wehaveand (id1,t1,id2,t2)
286 rewriting_step_continuation : [
295 [ t1 = SELF; SYMBOL ";"; t2 = SELF ->
298 | G.Seq (_, l) -> l @ [ t2 ]
304 [ tac = SELF; SYMBOL ";";
305 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
306 (G.Then (loc, tac, tacs))
309 [ IDENT "do"; count = int; tac = SELF ->
310 G.Do (loc, count, tac)
311 | IDENT "repeat"; tac = SELF -> G.Repeat (loc, tac)
315 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
317 | IDENT "try"; tac = SELF -> G.Try (loc, tac)
319 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
321 | IDENT "progress"; tac = SELF -> G.Progress (loc, tac)
322 | LPAREN; tac = SELF; RPAREN -> tac
323 | tac = tactic -> tac
327 npunctuation_tactical:
329 [ SYMBOL "[" -> G.NBranch loc
330 | SYMBOL "|" -> G.NShift loc
331 | i = LIST1 int SEP SYMBOL ","; SYMBOL ":" -> G.NPos (loc, i)
332 | SYMBOL "*"; SYMBOL ":" -> G.NWildcard loc
333 | name = IDENT; SYMBOL ":" -> G.NPosbyname (loc, name)
334 | SYMBOL "]" -> G.NMerge loc
335 | SYMBOL ";" -> G.NSemicolon loc
336 | SYMBOL "." -> G.NDot loc
339 nnon_punctuation_tactical:
341 [ IDENT "focus"; goals = LIST1 int -> G.NFocus (loc, goals)
342 | IDENT "unfocus" -> G.NUnfocus loc
343 | IDENT "skip" -> G.NSkip loc
347 [ [ IDENT "definition" ] -> `Definition
348 | [ IDENT "fact" ] -> `Fact
349 | [ IDENT "lemma" ] -> `Lemma
350 | [ IDENT "example" ] -> `Example
351 | [ IDENT "theorem" ] -> `Theorem
352 | [ IDENT "corollary" ] -> `Corollary
357 params = LIST0 protected_binder_vars;
358 SYMBOL ":"; fst_typ = term; SYMBOL <:unicode<def>>; OPT SYMBOL "|";
359 fst_constructors = LIST0 constructor SEP SYMBOL "|";
362 name = IDENT; SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>;
363 OPT SYMBOL "|"; constructors = LIST0 constructor SEP SYMBOL "|" ->
364 (name, true, typ, constructors) ] SEP "with" -> types
368 (fun (names, typ) acc ->
369 (List.map (fun name -> (name, typ)) names) @ acc)
372 let fst_ind_type = (fst_name, true, fst_typ, fst_constructors) in
373 let tl_ind_types = match tl with None -> [] | Some types -> types in
374 let ind_types = fst_ind_type :: tl_ind_types in
380 params = LIST0 protected_binder_vars;
381 SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>; SYMBOL "{" ;
385 SYMBOL ":" -> false,0
386 | SYMBOL ":"; SYMBOL ">" -> true,0
387 | SYMBOL ":"; arity = int ; SYMBOL ">" -> true,arity
390 let b,n = coercion in
392 ] SEP SYMBOL ";"; SYMBOL "}" ->
395 (fun (names, typ) acc ->
396 (List.map (fun name -> (name, typ)) names) @ acc)
399 (params,name,typ,fields)
403 [ IDENT "id"; id = QSTRING; SYMBOL "="; uri = QSTRING ->
404 let alpha = "[a-zA-Z]" in
405 let num = "[0-9]+" in
406 let ident_cont = "\\("^alpha^"\\|"^num^"\\|_\\|\\\\\\)" in
407 let decoration = "\\'" in
408 let ident = "\\("^alpha^ident_cont^"*"^decoration^"*\\|_"^ident_cont^"+"^decoration^"*\\)" in
409 let rex = Str.regexp ("^"^ident^"$") in
410 if Str.string_match rex id 0 then
411 if (try ignore (NReference.reference_of_string uri); true
412 with NReference.IllFormedReference _ -> false)
414 G.Ident_alias (id, uri)
417 (HExtlib.Localized (loc, CicNotationParser.Parse_error (Printf.sprintf "Not a valid uri: %s" uri)))
419 raise (HExtlib.Localized (loc, CicNotationParser.Parse_error (
420 Printf.sprintf "Not a valid identifier: %s" id)))
421 | IDENT "symbol"; symbol = QSTRING;
422 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
423 SYMBOL "="; dsc = QSTRING ->
425 match instance with Some i -> i | None -> 0
427 G.Symbol_alias (symbol, instance, dsc)
429 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
430 SYMBOL "="; dsc = QSTRING ->
432 match instance with Some i -> i | None -> 0
434 G.Number_alias (instance, dsc)
438 [ l = LIST0 [ SYMBOL <:unicode<eta>> (* η *); SYMBOL "." -> () ];
440 N.IdentArg (List.length l, id)
444 [ IDENT "left"; IDENT "associative" -> Gramext.LeftA
445 | IDENT "right"; IDENT "associative" -> Gramext.RightA
446 | IDENT "non"; IDENT "associative" -> Gramext.NonA
450 [ "with"; IDENT "precedence"; n = NUMBER -> int_of_string n ]
453 [ dir = OPT direction; s = QSTRING;
454 assoc = OPT associativity; prec = precedence;
457 [ blob = UNPARSED_AST ->
458 add_raw_attribute ~text:(Printf.sprintf "@{%s}" blob)
459 (CicNotationParser.parse_level2_ast lstatus
460 (Ulexing.from_utf8_string blob))
461 | blob = UNPARSED_META ->
462 add_raw_attribute ~text:(Printf.sprintf "${%s}" blob)
463 (CicNotationParser.parse_level2_meta lstatus
464 (Ulexing.from_utf8_string blob))
468 | None -> default_associativity
469 | Some assoc -> assoc
472 add_raw_attribute ~text:s
473 (CicNotationParser.parse_level1_pattern lstatus prec
474 (Ulexing.from_utf8_string s))
476 (dir, p1, assoc, prec, p2)
480 [ r = NREF -> N.NRefPattern (NReference.reference_of_string r)
481 | IMPLICIT -> N.ImplicitPattern
482 | id = IDENT -> N.VarPattern id
483 | LPAREN; terms = LIST1 SELF; RPAREN ->
487 | terms -> N.ApplPattern terms)
491 [ s = CSYMBOL; args = LIST0 argument; SYMBOL "="; t = level3_term ->
497 IDENT "include" ; path = QSTRING ->
498 loc,path,G.WithPreferences
499 | IDENT "include" ; IDENT "alias"; path = QSTRING ->
500 loc,path,G.OnlyPreferences
501 | IDENT "include'" ; path = QSTRING ->
502 loc,path,G.WithoutPreferences
505 index: [[ b = OPT SYMBOL "-" -> match b with None -> true | _ -> false ]];
507 grafite_ncommand: [ [
508 IDENT "qed" ; i = index -> G.NQed (loc,i)
509 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL ":"; typ = term;
510 body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
511 G.NObj (loc, N.Theorem (nflavour, name, typ, body,`Regular),true)
512 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL <:unicode<def>> (* ≝ *);
515 N.Theorem(nflavour, name, N.Implicit `JustOne, Some body,`Regular),
517 | IDENT "axiom"; i = index; name = IDENT; SYMBOL ":"; typ = term ->
518 G.NObj (loc, N.Theorem (`Axiom, name, typ, None, `Regular),i)
519 | IDENT "discriminator" ; indty = tactic_term -> G.NDiscriminator (loc,indty)
520 | IDENT "inverter"; name = IDENT; IDENT "for" ; indty = tactic_term ;
521 paramspec = OPT inverter_param_list ;
522 outsort = OPT [ SYMBOL ":" ; outsort = term -> outsort ] ->
523 G.NInverter (loc,name,indty,paramspec,outsort)
524 | LETCOREC ; defs = let_codefs ->
525 nmk_rec_corec `CoInductive defs loc true
526 | LETREC ; defs = let_defs ->
527 nmk_rec_corec `Inductive defs loc true
528 | IDENT "inductive"; spec = inductive_spec ->
529 let (params, ind_types) = spec in
530 G.NObj (loc, N.Inductive (params, ind_types),true)
531 | IDENT "coinductive"; spec = inductive_spec ->
532 let (params, ind_types) = spec in
533 let ind_types = (* set inductive flags to false (coinductive) *)
534 List.map (fun (name, _, term, ctors) -> (name, false, term, ctors))
537 G.NObj (loc, N.Inductive (params, ind_types),true)
538 | IDENT "universe"; IDENT "constraint"; u1 = tactic_term;
539 SYMBOL <:unicode<lt>> ; u2 = tactic_term ->
541 | NotationPt.AttributedTerm (_, NotationPt.Sort (`NType i)) ->
542 NUri.uri_of_string ("cic:/matita/pts/Type"^i^".univ")
543 | _ -> raise (Failure "only a Type[…] sort can be constrained")
547 G.NUnivConstraint (loc,u1,u2)
548 | IDENT "unification"; IDENT "hint"; n = int; t = tactic_term ->
549 G.UnificationHint (loc, t, n)
550 | IDENT "coercion"; name = IDENT;
551 compose = OPT [ IDENT "nocomposites" -> () ];
552 spec = OPT [ SYMBOL ":"; ty = term;
553 SYMBOL <:unicode<def>>; t = term; "on";
554 id = [ IDENT | PIDENT ]; SYMBOL ":"; source = term;
555 "to"; target = term -> t,ty,(id,source),target ] ->
556 let compose = compose = None in
557 G.NCoercion(loc,name,compose,spec)
558 | IDENT "record" ; (params,name,ty,fields) = record_spec ->
559 G.NObj (loc, N.Record (params,name,ty,fields),true)
560 | IDENT "copy" ; s = IDENT; IDENT "from"; u = URI; "with";
561 m = LIST0 [ u1 = URI; SYMBOL <:unicode<mapsto>>; u2 = URI -> u1,u2 ] ->
562 G.NCopy (loc,s,NUri.uri_of_string u,
563 List.map (fun a,b -> NUri.uri_of_string a, NUri.uri_of_string b) m)
564 | lc = lexicon_command -> lc
568 IDENT "alias" ; spec = alias_spec ->
570 | IDENT "notation"; (dir, l1, assoc, prec, l2) = notation ->
571 G.Notation (loc, dir, l1, assoc, prec, l2)
572 | IDENT "interpretation"; id = QSTRING;
573 (symbol, args, l3) = interpretation ->
574 G.Interpretation (loc, id, (symbol, args), l3)
577 [ ncmd = grafite_ncommand; SYMBOL "." -> G.NCommand (loc, ncmd)
578 | punct = npunctuation_tactical -> G.NTactic (loc, [punct])
579 | tac = nnon_punctuation_tactical(*; punct = npunctuation_tactical*) ->
580 G.NTactic (loc, [tac])
581 | tac = ntactic (*; punct = npunctuation_tactical*) ->
584 | tac = nnon_punctuation_tactical;
585 punct = npunctuation_tactical ->
586 G.NTactic (loc, [tac; punct])
591 [ BEGINCOMMENT ; ex = executable ; ENDCOMMENT ->
598 [ ex = executable -> G.Executable (loc, ex)
599 | com = comment -> G.Comment (loc, com)
600 | (iloc,fname,mode) = include_command ; SYMBOL "." ->
601 G.Executable (loc,G.NCommand (loc,G.Include (iloc,mode,fname)))
602 | EOI -> raise End_of_file
610 type db = GrafiteAst.statement Grammar.Entry.e ;;
612 class type g_status =
614 inherit CicNotationParser.g_status
618 class virtual status =
620 inherit CicNotationParser.status ~keywords:[]
621 val mutable db = None (* mutable only to initialize it :-( *)
622 method parser_db = match db with None -> assert false | Some x -> x
623 method set_parser_db v = {< db = Some v >}
624 method set_parser_status
625 : 'status. #g_status as 'status -> 'self
626 = fun o -> {< db = Some o#parser_db >}#set_notation_parser_status o
628 let grammar = CicNotationParser.level2_ast_grammar self in
629 db <- Some (mk_parser (Grammar.Entry.create grammar "statement") self)
632 let extend status l1 action =
633 let status = CicNotationParser.extend status l1 action in
634 let grammar = CicNotationParser.level2_ast_grammar status in
636 (mk_parser (Grammar.Entry.create grammar "statement") status)
640 let parse_statement status =
641 parse_statement status#parser_db
643 (* vim:set foldmethod=marker: *)