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 module LE = LexiconEngine
33 exception NoInclusionPerformed of string (* full path *)
35 type 'a localized_option =
39 type ast_statement = G.statement
41 let exc_located_wrapper f =
45 | Stdpp.Exc_located (_, End_of_file) -> raise End_of_file
46 | Stdpp.Exc_located (floc, Stream.Error msg) ->
47 raise (HExtlib.Localized (floc,CicNotationParser.Parse_error msg))
48 | Stdpp.Exc_located (floc, HExtlib.Localized(_,exn)) ->
49 raise (HExtlib.Localized
50 (floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
51 | Stdpp.Exc_located (floc, exn) ->
52 raise (HExtlib.Localized
53 (floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
55 let parse_statement grafite_parser lexbuf =
57 (fun () -> (Grammar.Entry.parse (Obj.magic grafite_parser) (Obj.magic lexbuf)))
59 let add_raw_attribute ~text t = N.AttributedTerm (`Raw text, t)
61 let default_associativity = Gramext.NonA
63 let mk_rec_corec ind_kind defs loc =
66 | (params,(N.Ident (name, None), ty),_,_) :: _ ->
67 let ty = match ty with Some ty -> ty | None -> N.Implicit `JustOne in
70 (fun var ty -> N.Binder (`Pi,var,ty)
76 let body = N.Ident (name,None) in
77 (loc, N.Theorem(`Definition, name, ty, Some (N.LetRec (ind_kind, defs, body)), `Regular))
79 let nmk_rec_corec ind_kind defs loc =
80 let loc,t = mk_rec_corec ind_kind defs loc in
84 let nnon_punct_of_punct = function
85 | G.Skip loc -> G.NSkip loc
86 | G.Unfocus loc -> G.NUnfocus loc
87 | G.Focus (loc,l) -> G.NFocus (loc,l)
90 type by_continuation =
92 | BYC_weproved of N.term * string option * N.term option
93 | BYC_letsuchthat of string * N.term * string * N.term
94 | BYC_wehaveand of string * N.term * string * N.term
96 let mk_parser statement lstatus =
97 (* let grammar = CicNotationParser.level2_ast_grammar lstatus in *)
98 let term = CicNotationParser.term lstatus in
99 let let_defs = CicNotationParser.let_defs 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 ] ];
109 | id = IDENT -> Some id ]
112 ident_list1: [ [ LPAREN; idents = LIST1 IDENT; RPAREN -> idents ] ];
114 [ tactic_terms = LIST1 tactic_term SEP SYMBOL "," -> tactic_terms ]
117 [ IDENT "normalize" ; delta = OPT [ IDENT "nodelta" -> () ] ->
118 let delta = match delta with None -> true | _ -> false in
120 (*| IDENT "unfold"; t = OPT tactic_term -> `Unfold t*)
121 | IDENT "whd" ; delta = OPT [ IDENT "nodelta" -> () ] ->
122 let delta = match delta with None -> true | _ -> false in
125 sequent_pattern_spec: [
129 path = OPT [SYMBOL ":" ; path = tactic_term -> path ] ->
130 (id,match path with Some p -> p | None -> N.UserInput) ];
131 goal_path = OPT [ SYMBOL <:unicode<vdash>>; term = tactic_term -> term ] ->
133 match goal_path, hyp_paths with
134 None, [] -> Some N.UserInput
136 | Some goal_path, _ -> Some goal_path
145 [ "match" ; wanted = tactic_term ;
146 sps = OPT [ "in"; sps = sequent_pattern_spec -> sps ] ->
148 | sps = sequent_pattern_spec ->
151 let wanted,hyp_paths,goal_path =
152 match wanted_and_sps with
153 wanted,None -> wanted, [], Some N.UserInput
154 | wanted,Some (hyp_paths,goal_path) -> wanted,hyp_paths,goal_path
156 wanted, hyp_paths, goal_path ] ->
158 None -> None,[],Some N.UserInput
161 inverter_param_list: [
162 [ params = tactic_term ->
163 let deannotate = function
164 | N.AttributedTerm (_,t) | t -> t
165 in match deannotate params with
166 | N.Implicit _ -> [false]
167 | N.UserInput -> [true]
169 List.map (fun x -> match deannotate x with
170 | N.Implicit _ -> false
171 | N.UserInput -> true
172 | _ -> raise (Invalid_argument "malformed target parameter list 1")) l
173 | _ -> raise (Invalid_argument ("malformed target parameter list 2\n" ^ NotationPp.pp_term params)) ]
176 [ SYMBOL ">" -> `LeftToRight
177 | SYMBOL "<" -> `RightToLeft ]
179 int: [ [ num = NUMBER -> int_of_string num ] ];
182 [ OPT [ IDENT "names" ];
183 num = OPT [ num = int -> num ];
184 idents = intros_names ->
189 (* MATITA 1.0 using: [ [ using = OPT [ IDENT "using"; t = tactic_term -> t ] -> using ] ]; *)
191 [ SYMBOL "@"; t = tactic_term -> G.NTactic(loc,[G.NApply (loc, t)])
192 | IDENT "apply"; t = tactic_term -> G.NTactic(loc,[G.NApply (loc, t)])
193 | IDENT "applyS"; t = tactic_term -> G.NTactic(loc,[G.NSmartApply(loc, t)])
197 [ id = IDENT ; SYMBOL ":" ; ty = tactic_term -> id,`Decl ty
198 | id = IDENT ; SYMBOL ":" ; ty = tactic_term ;
199 SYMBOL <:unicode<def>> ; bo = tactic_term ->
201 SYMBOL <:unicode<vdash>>;
202 concl = tactic_term -> (List.rev hyps,concl) ] ->
203 G.NTactic(loc,[G.NAssert (loc, seqs)])
204 (*| IDENT "auto"; params = auto_params ->
205 G.NTactic(loc,[G.NAuto (loc, params)])*)
206 | SYMBOL "/"; num = OPT NUMBER ;
207 just_and_params = auto_params; SYMBOL "/" ->
208 let just,params = just_and_params in
209 let depth = match num with Some n -> n | None -> "1" in
213 [G.NAuto(loc,(None,["depth",depth]@params))])
214 | Some (`Univ univ) ->
216 [G.NAuto(loc,(Some univ,["depth",depth]@params))])
219 [G.NAuto(loc,(Some [],["depth",depth]@params))])
222 G.NAutoInteractive (loc, (None,["depth",depth]@params))))
223 | IDENT "intros" -> G.NMacro (loc, G.NIntroGuess loc)
224 | IDENT "check"; t = term -> G.NMacro(loc,G.NCheck (loc,t))
225 | IDENT "screenshot"; fname = QSTRING ->
226 G.NMacro(loc,G.Screenshot (loc, fname))
227 | IDENT "cases"; what = tactic_term ; where = pattern_spec ->
228 G.NTactic(loc,[G.NCases (loc, what, where)])
229 | IDENT "change"; what = pattern_spec; "with"; with_what = tactic_term ->
230 G.NTactic(loc,[G.NChange (loc, what, with_what)])
231 | SYMBOL "@"; num = OPT NUMBER; l = LIST0 tactic_term ->
232 G.NTactic(loc,[G.NConstructor (loc, (match num with None -> None | Some x -> Some (int_of_string x)),l)])
233 | IDENT "cut"; t = tactic_term -> G.NTactic(loc,[G.NCut (loc, t)])
234 (* | IDENT "discriminate"; t = tactic_term -> G.NDiscriminate (loc, t)
235 | IDENT "subst"; t = tactic_term -> G.NSubst (loc, t) *)
236 | IDENT "destruct"; just = OPT [ dom = ident_list1 -> dom ];
237 exclude = OPT [ IDENT "skip"; skip = ident_list1 -> skip ]
238 -> let exclude' = match exclude with None -> [] | Some l -> l in
239 G.NTactic(loc,[G.NDestruct (loc,just,exclude')])
240 | IDENT "elim"; what = tactic_term ; where = pattern_spec ->
241 G.NTactic(loc,[G.NElim (loc, what, where)])
242 | IDENT "generalize"; p=pattern_spec ->
243 G.NTactic(loc,[G.NGeneralize (loc, p)])
244 | IDENT "inversion"; what = tactic_term ; where = pattern_spec ->
245 G.NTactic(loc,[G.NInversion (loc, what, where)])
246 | IDENT "lapply"; t = tactic_term -> G.NTactic(loc,[G.NLApply (loc, t)])
247 | IDENT "letin"; name = IDENT ; SYMBOL <:unicode<def>> ; t = tactic_term;
248 where = pattern_spec ->
249 G.NTactic(loc,[G.NLetIn (loc,where,t,name)])
250 | kind = nreduction_kind; p = pattern_spec ->
251 G.NTactic(loc,[G.NReduce (loc, kind, p)])
252 | dir = direction; what = tactic_term ; where = pattern_spec ->
253 G.NTactic(loc,[G.NRewrite (loc, dir, what, where)])
254 | IDENT "rewrite"; dir = direction; what = tactic_term ; where = pattern_spec ->
255 G.NTactic(loc,[G.NRewrite (loc, dir, what, where)])
256 | IDENT "try"; tac = SELF ->
257 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
258 G.NTactic(loc,[ G.NTry (loc,tac)])
259 | IDENT "repeat"; tac = SELF ->
260 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
261 G.NTactic(loc,[ G.NRepeat (loc,tac)])
262 | LPAREN; l = LIST1 SELF; RPAREN ->
265 (List.map (function G.NTactic(_,t) -> t | _ -> assert false) l) in
266 G.NTactic(loc,[G.NBlock (loc,l)])
267 | IDENT "assumption" -> G.NTactic(loc,[ G.NAssumption loc])
268 | SYMBOL "#"; ns=IDENT -> G.NTactic(loc,[ G.NIntros (loc,[ns])])
269 | SYMBOL "#"; SYMBOL "_" -> G.NTactic(loc,[ G.NIntro (loc,"_")])
270 | SYMBOL "*" -> G.NTactic(loc,[ G.NCase1 (loc,"_")])
271 | SYMBOL "*"; n=IDENT -> G.NTactic(loc,[ G.NCase1 (loc,n)])
276 | IDENT "fast_paramod"
290 i = auto_fixed_param -> i,""
291 | i = auto_fixed_param ; SYMBOL "="; v = [ v = int ->
292 string_of_int v | v = IDENT -> v ] -> i,v ];
293 just = OPT [ IDENT "by"; by =
294 [ univ = tactic_term_list1 -> `Univ univ
295 | SYMBOL "{"; SYMBOL "}" -> `EmptyUniv
296 | SYMBOL "_" -> `Trace ] -> by ] -> just,params
302 [ 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)
303 | WEPROVED; ty = tactic_term ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] ;
304 "done" -> BYC_weproved (ty,None,t1)
306 | "let" ; id1 = IDENT ; SYMBOL ":" ; t1 = tactic_term ;
307 IDENT "such" ; IDENT "that" ; t2=tactic_term ; LPAREN ;
308 id2 = IDENT ; RPAREN -> BYC_letsuchthat (id1,t1,id2,t2)
309 | WEHAVE; t1=tactic_term ; LPAREN ; id1=IDENT ; RPAREN ;"and" ; t2=tactic_term ; LPAREN ; id2=IDENT ; RPAREN ->
310 BYC_wehaveand (id1,t1,id2,t2)
315 rewriting_step_continuation : [
324 [ t1 = SELF; SYMBOL ";"; t2 = SELF ->
327 | G.Seq (_, l) -> l @ [ t2 ]
333 [ tac = SELF; SYMBOL ";";
334 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
335 (G.Then (loc, tac, tacs))
338 [ IDENT "do"; count = int; tac = SELF ->
339 G.Do (loc, count, tac)
340 | IDENT "repeat"; tac = SELF -> G.Repeat (loc, tac)
344 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
346 | IDENT "try"; tac = SELF -> G.Try (loc, tac)
348 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
350 | IDENT "progress"; tac = SELF -> G.Progress (loc, tac)
351 | LPAREN; tac = SELF; RPAREN -> tac
352 | tac = tactic -> tac
356 npunctuation_tactical:
358 [ SYMBOL "[" -> G.NBranch loc
359 | SYMBOL "|" -> G.NShift loc
360 | i = LIST1 int SEP SYMBOL ","; SYMBOL ":" -> G.NPos (loc, i)
361 | SYMBOL "*"; SYMBOL ":" -> G.NWildcard loc
362 | name = IDENT; SYMBOL ":" -> G.NPosbyname (loc, name)
363 | SYMBOL "]" -> G.NMerge loc
364 | SYMBOL ";" -> G.NSemicolon loc
365 | SYMBOL "." -> G.NDot loc
368 nnon_punctuation_tactical:
370 [ IDENT "focus"; goals = LIST1 int -> G.NFocus (loc, goals)
371 | IDENT "unfocus" -> G.NUnfocus loc
372 | IDENT "skip" -> G.NSkip loc
376 [ [ IDENT "definition" ] -> `Definition
377 | [ IDENT "fact" ] -> `Fact
378 | [ IDENT "lemma" ] -> `Lemma
379 | [ IDENT "example" ] -> `Example
380 | [ IDENT "theorem" ] -> `Theorem
381 | [ IDENT "corollary" ] -> `Corollary
386 params = LIST0 protected_binder_vars;
387 SYMBOL ":"; fst_typ = term; SYMBOL <:unicode<def>>; OPT SYMBOL "|";
388 fst_constructors = LIST0 constructor SEP SYMBOL "|";
391 name = IDENT; SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>;
392 OPT SYMBOL "|"; constructors = LIST0 constructor SEP SYMBOL "|" ->
393 (name, true, typ, constructors) ] SEP "with" -> types
397 (fun (names, typ) acc ->
398 (List.map (fun name -> (name, typ)) names) @ acc)
401 let fst_ind_type = (fst_name, true, fst_typ, fst_constructors) in
402 let tl_ind_types = match tl with None -> [] | Some types -> types in
403 let ind_types = fst_ind_type :: tl_ind_types in
409 params = LIST0 protected_binder_vars;
410 SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>; SYMBOL "{" ;
414 SYMBOL ":" -> false,0
415 | SYMBOL ":"; SYMBOL ">" -> true,0
416 | SYMBOL ":"; arity = int ; SYMBOL ">" -> true,arity
419 let b,n = coercion in
421 ] SEP SYMBOL ";"; SYMBOL "}" ->
424 (fun (names, typ) acc ->
425 (List.map (fun name -> (name, typ)) names) @ acc)
428 (params,name,typ,fields)
432 [ IDENT "id"; id = QSTRING; SYMBOL "="; uri = QSTRING ->
433 let alpha = "[a-zA-Z]" in
434 let num = "[0-9]+" in
435 let ident_cont = "\\("^alpha^"\\|"^num^"\\|_\\|\\\\\\)" in
436 let decoration = "\\'" in
437 let ident = "\\("^alpha^ident_cont^"*"^decoration^"*\\|_"^ident_cont^"+"^decoration^"*\\)" in
438 let rex = Str.regexp ("^"^ident^"$") in
439 if Str.string_match rex id 0 then
440 if (try ignore (NReference.reference_of_string uri); true
441 with NReference.IllFormedReference _ -> false)
443 L.Ident_alias (id, uri)
446 (HExtlib.Localized (loc, CicNotationParser.Parse_error (Printf.sprintf "Not a valid uri: %s" uri)))
448 raise (HExtlib.Localized (loc, CicNotationParser.Parse_error (
449 Printf.sprintf "Not a valid identifier: %s" id)))
450 | IDENT "symbol"; symbol = QSTRING;
451 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
452 SYMBOL "="; dsc = QSTRING ->
454 match instance with Some i -> i | None -> 0
456 L.Symbol_alias (symbol, instance, dsc)
458 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
459 SYMBOL "="; dsc = QSTRING ->
461 match instance with Some i -> i | None -> 0
463 L.Number_alias (instance, dsc)
467 [ l = LIST0 [ SYMBOL <:unicode<eta>> (* η *); SYMBOL "." -> () ];
469 N.IdentArg (List.length l, id)
473 [ IDENT "left"; IDENT "associative" -> Gramext.LeftA
474 | IDENT "right"; IDENT "associative" -> Gramext.RightA
475 | IDENT "non"; IDENT "associative" -> Gramext.NonA
479 [ "with"; IDENT "precedence"; n = NUMBER -> int_of_string n ]
482 [ dir = OPT direction; s = QSTRING;
483 assoc = OPT associativity; prec = precedence;
486 [ blob = UNPARSED_AST ->
487 add_raw_attribute ~text:(Printf.sprintf "@{%s}" blob)
488 (CicNotationParser.parse_level2_ast lstatus
489 (Ulexing.from_utf8_string blob))
490 | blob = UNPARSED_META ->
491 add_raw_attribute ~text:(Printf.sprintf "${%s}" blob)
492 (CicNotationParser.parse_level2_meta lstatus
493 (Ulexing.from_utf8_string blob))
497 | None -> default_associativity
498 | Some assoc -> assoc
501 add_raw_attribute ~text:s
502 (CicNotationParser.parse_level1_pattern lstatus prec
503 (Ulexing.from_utf8_string s))
505 (dir, p1, assoc, prec, p2)
509 [ r = NREF -> N.NRefPattern (NReference.reference_of_string r)
510 | IMPLICIT -> N.ImplicitPattern
511 | id = IDENT -> N.VarPattern id
512 | LPAREN; terms = LIST1 SELF; RPAREN ->
516 | terms -> N.ApplPattern terms)
520 [ s = CSYMBOL; args = LIST0 argument; SYMBOL "="; t = level3_term ->
526 IDENT "include" ; path = QSTRING ->
527 loc,path,true,L.WithPreferences
528 | IDENT "include" ; IDENT "source" ; path = QSTRING ->
529 loc,path,false,L.WithPreferences
530 | IDENT "include'" ; path = QSTRING ->
531 loc,path,true,L.WithoutPreferences
534 grafite_ncommand: [ [
535 IDENT "qed" -> G.NQed loc
536 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL ":"; typ = term;
537 body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
538 G.NObj (loc, N.Theorem (nflavour, name, typ, body,`Regular))
539 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL <:unicode<def>> (* ≝ *);
541 G.NObj (loc, N.Theorem (nflavour, name, N.Implicit `JustOne, Some body,`Regular))
542 | IDENT "axiom"; name = IDENT; SYMBOL ":"; typ = term ->
543 G.NObj (loc, N.Theorem (`Axiom, name, typ, None, `Regular))
544 | IDENT "discriminator" ; indty = tactic_term -> G.NDiscriminator (loc,indty)
545 | IDENT "inverter"; name = IDENT; IDENT "for" ; indty = tactic_term ;
546 paramspec = OPT inverter_param_list ;
547 outsort = OPT [ SYMBOL ":" ; outsort = term -> outsort ] ->
548 G.NInverter (loc,name,indty,paramspec,outsort)
549 | NLETCOREC ; defs = let_defs ->
550 nmk_rec_corec `CoInductive defs loc
551 | NLETREC ; defs = let_defs ->
552 nmk_rec_corec `Inductive defs loc
553 | IDENT "inductive"; spec = inductive_spec ->
554 let (params, ind_types) = spec in
555 G.NObj (loc, N.Inductive (params, ind_types))
556 | IDENT "coinductive"; spec = inductive_spec ->
557 let (params, ind_types) = spec in
558 let ind_types = (* set inductive flags to false (coinductive) *)
559 List.map (fun (name, _, term, ctors) -> (name, false, term, ctors))
562 G.NObj (loc, N.Inductive (params, ind_types))
563 | IDENT "universe"; IDENT "constraint"; u1 = tactic_term;
564 SYMBOL <:unicode<lt>> ; u2 = tactic_term ->
566 | NotationPt.AttributedTerm (_, NotationPt.Sort (`NType i)) ->
567 NUri.uri_of_string ("cic:/matita/pts/Type"^i^".univ")
568 | _ -> raise (Failure "only a Type[…] sort can be constrained")
572 G.NUnivConstraint (loc,u1,u2)
573 | IDENT "unification"; IDENT "hint"; n = int; t = tactic_term ->
574 G.UnificationHint (loc, t, n)
575 | IDENT "coercion"; name = IDENT; SYMBOL ":"; ty = term;
576 SYMBOL <:unicode<def>>; t = term; "on";
577 id = [ IDENT | PIDENT ]; SYMBOL ":"; source = term;
578 "to"; target = term ->
579 G.NCoercion(loc,name,t,ty,(id,source),target)
580 | IDENT "record" ; (params,name,ty,fields) = record_spec ->
581 G.NObj (loc, N.Record (params,name,ty,fields))
582 | IDENT "copy" ; s = IDENT; IDENT "from"; u = URI; "with";
583 m = LIST0 [ u1 = URI; SYMBOL <:unicode<mapsto>>; u2 = URI -> u1,u2 ] ->
584 G.NCopy (loc,s,NUri.uri_of_string u,
585 List.map (fun a,b -> NUri.uri_of_string a, NUri.uri_of_string b) m)
589 IDENT "alias" ; spec = alias_spec ->
591 | IDENT "notation"; (dir, l1, assoc, prec, l2) = notation ->
592 L.Notation (loc, dir, l1, assoc, prec, l2)
593 | IDENT "interpretation"; id = QSTRING;
594 (symbol, args, l3) = interpretation ->
595 L.Interpretation (loc, id, (symbol, args), l3)
598 [ ncmd = grafite_ncommand; SYMBOL "." -> G.NCommand (loc, ncmd)
599 | punct = npunctuation_tactical -> G.NTactic (loc, [punct])
600 | tac = nnon_punctuation_tactical(*; punct = npunctuation_tactical*) ->
601 G.NTactic (loc, [tac])
602 | tac = ntactic (*; punct = npunctuation_tactical*) ->
605 | tac = nnon_punctuation_tactical;
606 punct = npunctuation_tactical ->
607 G.NTactic (loc, [tac; punct])
612 [ BEGINCOMMENT ; ex = executable ; ENDCOMMENT ->
620 LSome (G.Executable (loc, ex))
622 LSome (G.Comment (loc, com))
623 | (iloc,fname,normal,mode) = include_command ; SYMBOL "." ->
625 (loc,G.Command (loc,G.Include (iloc,fname,(),""))))
626 | scom = lexicon_command ; SYMBOL "." ->
629 fun ?(never_include=false) ~include_paths status ->
630 let status = LE.eval_command status scom in
633 | EOI -> raise End_of_file
641 type db = ast_statement localized_option Grammar.Entry.e ;;
643 class type g_status =
645 inherit LexiconEngine.g_status
650 let lstatus = assert false in
651 let grammar = CicNotationParser.level2_ast_grammar lstatus in
653 inherit LexiconEngine.status
655 mk_parser (Grammar.Entry.create grammar "statement") lstatus
656 method parser_db = db
657 method set_parser_db v = {< db = v >}
658 method set_parser_status
659 : 'status. #g_status as 'status -> 'self
660 = fun o -> {< db = o#parser_db >}#set_lexicon_engine_status o
663 let parse_statement status =
664 parse_statement status#parser_db
666 (* vim:set foldmethod=marker: *)