| author | haftmann | 
| Fri, 05 Mar 2010 17:55:14 +0100 | |
| changeset 35603 | c0db094d0d80 | 
| parent 35399 | 3881972fcfca | 
| child 35613 | 9d3ff36ad4e1 | 
| permissions | -rw-r--r-- | 
| 
5822
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
1  | 
(* Title: Pure/Isar/args.ML  | 
| 
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
2  | 
Author: Markus Wenzel, TU Muenchen  | 
| 
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
3  | 
|
| 35013 | 4  | 
Parsing with implicit value assignment. Concrete argument syntax of  | 
| 27811 | 5  | 
attributes, methods etc.  | 
| 
5822
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
6  | 
*)  | 
| 
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
7  | 
|
| 
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
8  | 
signature ARGS =  | 
| 
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
9  | 
sig  | 
| 30513 | 10  | 
type token = OuterLex.token  | 
| 15703 | 11  | 
type src  | 
| 30513 | 12  | 
val src: (string * token list) * Position.T -> src  | 
13  | 
val dest_src: src -> (string * token list) * Position.T  | 
|
| 21030 | 14  | 
val pretty_src: Proof.context -> src -> Pretty.T  | 
| 15703 | 15  | 
val map_name: (string -> string) -> src -> src  | 
| 21480 | 16  | 
val morph_values: morphism -> src -> src  | 
| 20263 | 17  | 
val maxidx_values: src -> int -> int  | 
| 15703 | 18  | 
val assignable: src -> src  | 
19  | 
val closure: src -> src  | 
|
| 30513 | 20  | 
val context: Proof.context context_parser  | 
21  | 
val theory: theory context_parser  | 
|
22  | 
val $$$ : string -> string parser  | 
|
23  | 
val add: string parser  | 
|
24  | 
val del: string parser  | 
|
25  | 
val colon: string parser  | 
|
26  | 
val query: string parser  | 
|
27  | 
val bang: string parser  | 
|
28  | 
val query_colon: string parser  | 
|
29  | 
val bang_colon: string parser  | 
|
30  | 
  val parens: ('a parser) -> 'a parser
 | 
|
31  | 
  val bracks: ('a parser) -> 'a parser
 | 
|
32  | 
val mode: string -> bool context_parser  | 
|
33  | 
val maybe: 'a parser -> 'a option parser  | 
|
34  | 
val name_source: string parser  | 
|
| 30573 | 35  | 
val name_source_position: (Symbol_Pos.text * Position.T) parser  | 
| 30513 | 36  | 
val name: string parser  | 
37  | 
val binding: binding parser  | 
|
38  | 
val alt_name: string parser  | 
|
39  | 
val symbol: string parser  | 
|
40  | 
val liberal_name: string parser  | 
|
41  | 
val var: indexname parser  | 
|
42  | 
val internal_text: string parser  | 
|
43  | 
val internal_typ: typ parser  | 
|
44  | 
val internal_term: term parser  | 
|
45  | 
val internal_fact: thm list parser  | 
|
46  | 
val internal_attribute: (morphism -> attribute) parser  | 
|
47  | 
val named_text: (string -> string) -> string parser  | 
|
48  | 
val named_typ: (string -> typ) -> typ parser  | 
|
49  | 
val named_term: (string -> term) -> term parser  | 
|
50  | 
val named_fact: (string -> thm list) -> thm list parser  | 
|
51  | 
val named_attribute: (string -> morphism -> attribute) -> (morphism -> attribute) parser  | 
|
52  | 
val typ_abbrev: typ context_parser  | 
|
53  | 
val typ: typ context_parser  | 
|
54  | 
val term: term context_parser  | 
|
55  | 
val term_abbrev: term context_parser  | 
|
56  | 
val prop: term context_parser  | 
|
| 
35360
 
df2b2168e43a
clarified ProofContext.read_type_name/Args.type_name wrt strict logical constructors;
 
wenzelm 
parents: 
35013 
diff
changeset
 | 
57  | 
val type_name: bool -> string context_parser  | 
| 
35399
 
3881972fcfca
clarified ProofContext.read_const(_proper)/Args.const(_proper) wrt. strict logical consts;
 
wenzelm 
parents: 
35360 
diff
changeset
 | 
58  | 
val const: bool -> string context_parser  | 
| 
 
3881972fcfca
clarified ProofContext.read_const(_proper)/Args.const(_proper) wrt. strict logical consts;
 
wenzelm 
parents: 
35360 
diff
changeset
 | 
59  | 
val const_proper: bool -> string context_parser  | 
| 30513 | 60  | 
val bang_facts: thm list context_parser  | 
| 30514 | 61  | 
val goal_spec: ((int -> tactic) -> tactic) context_parser  | 
| 30513 | 62  | 
val parse: token list parser  | 
63  | 
val parse1: (string -> bool) -> token list parser  | 
|
64  | 
val attribs: (string -> string) -> src list parser  | 
|
65  | 
val opt_attribs: (string -> string) -> src list parser  | 
|
66  | 
val thm_name: (string -> string) -> string -> (binding * src list) parser  | 
|
67  | 
val opt_thm_name: (string -> string) -> string -> (binding * src list) parser  | 
|
68  | 
val syntax: string -> 'a context_parser -> src -> Context.generic -> 'a * Context.generic  | 
|
69  | 
val context_syntax: string -> 'a context_parser -> src -> Proof.context -> 'a * Proof.context  | 
|
| 
5822
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
70  | 
end;  | 
| 
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
71  | 
|
| 
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
72  | 
structure Args: ARGS =  | 
| 
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
73  | 
struct  | 
| 
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
74  | 
|
| 27811 | 75  | 
structure T = OuterLex;  | 
76  | 
structure P = OuterParse;  | 
|
| 
5822
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
77  | 
|
| 30513 | 78  | 
type token = T.token;  | 
79  | 
||
| 
5822
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
80  | 
|
| 
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
81  | 
|
| 15703 | 82  | 
(** datatype src **)  | 
83  | 
||
| 30513 | 84  | 
datatype src = Src of (string * token list) * Position.T;  | 
| 15703 | 85  | 
|
86  | 
val src = Src;  | 
|
87  | 
fun dest_src (Src src) = src;  | 
|
88  | 
||
| 21030 | 89  | 
fun pretty_src ctxt src =  | 
90  | 
let  | 
|
| 
32091
 
30e2ffbba718
proper context for Display.pretty_thm etc. or old-style versions Display.pretty_thm_global, Display.pretty_thm_without_context etc.;
 
wenzelm 
parents: 
30573 
diff
changeset
 | 
91  | 
val prt_thm = Pretty.backquote o Display.pretty_thm ctxt;  | 
| 27811 | 92  | 
fun prt arg =  | 
93  | 
(case T.get_value arg of  | 
|
94  | 
SOME (T.Text s) => Pretty.str (quote s)  | 
|
95  | 
| SOME (T.Typ T) => Syntax.pretty_typ ctxt T  | 
|
96  | 
| SOME (T.Term t) => Syntax.pretty_term ctxt t  | 
|
97  | 
      | SOME (T.Fact ths) => Pretty.enclose "(" ")" (Pretty.breaks (map prt_thm ths))
 | 
|
98  | 
| _ => Pretty.str (T.unparse arg));  | 
|
| 21030 | 99  | 
val (s, args) = #1 (dest_src src);  | 
100  | 
in Pretty.block (Pretty.breaks (Pretty.str s :: map prt args)) end;  | 
|
101  | 
||
| 15703 | 102  | 
fun map_name f (Src ((s, args), pos)) = Src ((f s, args), pos);  | 
103  | 
fun map_args f (Src ((s, args), pos)) = Src ((s, map f args), pos);  | 
|
104  | 
||
105  | 
||
106  | 
(* values *)  | 
|
107  | 
||
| 27811 | 108  | 
fun morph_values phi = map_args (T.map_value  | 
109  | 
(fn T.Text s => T.Text s  | 
|
110  | 
| T.Typ T => T.Typ (Morphism.typ phi T)  | 
|
111  | 
| T.Term t => T.Term (Morphism.term phi t)  | 
|
112  | 
| T.Fact ths => T.Fact (Morphism.fact phi ths)  | 
|
113  | 
| T.Attribute att => T.Attribute (Morphism.transform phi att)));  | 
|
| 15703 | 114  | 
|
| 27811 | 115  | 
fun maxidx_values (Src ((_, args), _)) = args |> fold (fn arg =>  | 
116  | 
(case T.get_value arg of  | 
|
117  | 
SOME (T.Typ T) => Term.maxidx_typ T  | 
|
118  | 
| SOME (T.Term t) => Term.maxidx_term t  | 
|
119  | 
| SOME (T.Fact ths) => fold Thm.maxidx_thm ths  | 
|
120  | 
| _ => I));  | 
|
| 15703 | 121  | 
|
| 27811 | 122  | 
val assignable = map_args T.assignable;  | 
123  | 
val closure = map_args T.closure;  | 
|
| 15703 | 124  | 
|
125  | 
||
126  | 
||
| 27811 | 127  | 
(** argument scanners **)  | 
| 
5822
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
128  | 
|
| 27371 | 129  | 
(* context *)  | 
130  | 
||
131  | 
fun context x = (Scan.state >> Context.proof_of) x;  | 
|
132  | 
fun theory x = (Scan.state >> Context.theory_of) x;  | 
|
133  | 
||
134  | 
||
| 27811 | 135  | 
(* basic *)  | 
| 5878 | 136  | 
|
| 27811 | 137  | 
fun token atom = Scan.ahead P.not_eof --| atom;  | 
| 5878 | 138  | 
|
| 27811 | 139  | 
val ident = token  | 
140  | 
(P.short_ident || P.long_ident || P.sym_ident || P.term_var ||  | 
|
141  | 
P.type_ident || P.type_var || P.number);  | 
|
| 5878 | 142  | 
|
| 27811 | 143  | 
val string = token (P.string || P.verbatim);  | 
144  | 
val alt_string = token P.alt_string;  | 
|
145  | 
val symbolic = token P.keyword_ident_or_symbolic;  | 
|
146  | 
||
147  | 
fun $$$ x = (ident >> T.content_of || P.keyword)  | 
|
148  | 
:|-- (fn y => if x = y then Scan.succeed x else Scan.fail);  | 
|
| 5878 | 149  | 
|
150  | 
||
| 27811 | 151  | 
val named = ident || string;  | 
| 5878 | 152  | 
|
| 10035 | 153  | 
val add = $$$ "add";  | 
154  | 
val del = $$$ "del";  | 
|
| 8803 | 155  | 
val colon = $$$ ":";  | 
| 10035 | 156  | 
val query = $$$ "?";  | 
157  | 
val bang = $$$ "!";  | 
|
| 20111 | 158  | 
val query_colon = $$$ "?" ^^ $$$ ":";  | 
159  | 
val bang_colon = $$$ "!" ^^ $$$ ":";  | 
|
| 10035 | 160  | 
|
| 8803 | 161  | 
fun parens scan = $$$ "(" |-- scan --| $$$ ")";
 | 
| 10150 | 162  | 
fun bracks scan = $$$ "[" |-- scan --| $$$ "]";  | 
| 15703 | 163  | 
fun mode s = Scan.lift (Scan.optional (parens ($$$ s) >> K true) false);  | 
164  | 
fun maybe scan = $$$ "_" >> K NONE || scan >> SOME;  | 
|
| 5878 | 165  | 
|
| 
27882
 
eaa9fef9f4c1
Args.name_source(_position) for proper position information;
 
wenzelm 
parents: 
27819 
diff
changeset
 | 
166  | 
val name_source = named >> T.source_of;  | 
| 
 
eaa9fef9f4c1
Args.name_source(_position) for proper position information;
 
wenzelm 
parents: 
27819 
diff
changeset
 | 
167  | 
val name_source_position = named >> T.source_position_of;  | 
| 
 
eaa9fef9f4c1
Args.name_source(_position) for proper position information;
 
wenzelm 
parents: 
27819 
diff
changeset
 | 
168  | 
|
| 27811 | 169  | 
val name = named >> T.content_of;  | 
| 
30223
 
24d975352879
renamed Binding.name_pos to Binding.make, renamed Binding.base_name to Binding.name_of, renamed Binding.map_base to Binding.map_name, added mandatory flag to Binding.qualify;
 
wenzelm 
parents: 
29606 
diff
changeset
 | 
170  | 
val binding = P.position name >> Binding.make;  | 
| 27811 | 171  | 
val alt_name = alt_string >> T.content_of;  | 
172  | 
val symbol = symbolic >> T.content_of;  | 
|
| 17064 | 173  | 
val liberal_name = symbol || name;  | 
| 8233 | 174  | 
|
| 27811 | 175  | 
val var = (ident >> T.content_of) :|-- (fn x =>  | 
176  | 
(case Lexicon.read_variable x of SOME v => Scan.succeed v | NONE => Scan.fail));  | 
|
| 5878 | 177  | 
|
| 
5822
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
178  | 
|
| 15703 | 179  | 
(* values *)  | 
180  | 
||
| 27811 | 181  | 
fun value dest = Scan.some (fn arg =>  | 
182  | 
(case T.get_value arg of SOME v => (SOME (dest v) handle Match => NONE) | NONE => NONE));  | 
|
| 15703 | 183  | 
|
184  | 
fun evaluate mk eval arg =  | 
|
| 27819 | 185  | 
let val x = eval arg in (T.assign (SOME (mk x)) arg; x) end;  | 
| 15703 | 186  | 
|
| 27811 | 187  | 
val internal_text = value (fn T.Text s => s);  | 
188  | 
val internal_typ = value (fn T.Typ T => T);  | 
|
189  | 
val internal_term = value (fn T.Term t => t);  | 
|
190  | 
val internal_fact = value (fn T.Fact ths => ths);  | 
|
191  | 
val internal_attribute = value (fn T.Attribute att => att);  | 
|
| 15703 | 192  | 
|
| 27819 | 193  | 
fun named_text intern = internal_text || named >> evaluate T.Text (intern o T.content_of);  | 
194  | 
fun named_typ readT = internal_typ || named >> evaluate T.Typ (readT o T.source_of);  | 
|
195  | 
fun named_term read = internal_term || named >> evaluate T.Term (read o T.source_of);  | 
|
196  | 
fun named_fact get = internal_fact || named >> evaluate T.Fact (get o T.content_of) ||  | 
|
197  | 
alt_string >> evaluate T.Fact (get o T.source_of);  | 
|
198  | 
fun named_attribute att = internal_attribute || named >> evaluate T.Attribute (att o T.content_of);  | 
|
| 15703 | 199  | 
|
200  | 
||
| 5878 | 201  | 
(* terms and types *)  | 
202  | 
||
| 18635 | 203  | 
val typ_abbrev = Scan.peek (named_typ o ProofContext.read_typ_abbrev o Context.proof_of);  | 
| 25331 | 204  | 
val typ = Scan.peek (named_typ o Syntax.read_typ o Context.proof_of);  | 
| 
24508
 
c8b82fec6447
replaced ProofContext.read_term/prop by general Syntax.read_term/prop;
 
wenzelm 
parents: 
24244 
diff
changeset
 | 
205  | 
val term = Scan.peek (named_term o Syntax.read_term o Context.proof_of);  | 
| 21724 | 206  | 
val term_abbrev = Scan.peek (named_term o ProofContext.read_term_abbrev o Context.proof_of);  | 
| 
24508
 
c8b82fec6447
replaced ProofContext.read_term/prop by general Syntax.read_term/prop;
 
wenzelm 
parents: 
24244 
diff
changeset
 | 
207  | 
val prop = Scan.peek (named_term o Syntax.read_prop o Context.proof_of);  | 
| 18635 | 208  | 
|
| 5878 | 209  | 
|
| 15703 | 210  | 
(* type and constant names *)  | 
211  | 
||
| 
35360
 
df2b2168e43a
clarified ProofContext.read_type_name/Args.type_name wrt strict logical constructors;
 
wenzelm 
parents: 
35013 
diff
changeset
 | 
212  | 
fun type_name strict =  | 
| 
 
df2b2168e43a
clarified ProofContext.read_type_name/Args.type_name wrt strict logical constructors;
 
wenzelm 
parents: 
35013 
diff
changeset
 | 
213  | 
Scan.peek (fn ctxt => named_typ (ProofContext.read_type_name (Context.proof_of ctxt) strict))  | 
| 18998 | 214  | 
>> (fn Type (c, _) => c | TFree (a, _) => a | _ => "");  | 
| 15703 | 215  | 
|
| 
35399
 
3881972fcfca
clarified ProofContext.read_const(_proper)/Args.const(_proper) wrt. strict logical consts;
 
wenzelm 
parents: 
35360 
diff
changeset
 | 
216  | 
fun const strict =  | 
| 
 
3881972fcfca
clarified ProofContext.read_const(_proper)/Args.const(_proper) wrt. strict logical consts;
 
wenzelm 
parents: 
35360 
diff
changeset
 | 
217  | 
Scan.peek (fn ctxt => named_term (ProofContext.read_const (Context.proof_of ctxt) strict))  | 
| 18998 | 218  | 
>> (fn Const (c, _) => c | Free (x, _) => x | _ => "");  | 
| 7553 | 219  | 
|
| 
35399
 
3881972fcfca
clarified ProofContext.read_const(_proper)/Args.const(_proper) wrt. strict logical consts;
 
wenzelm 
parents: 
35360 
diff
changeset
 | 
220  | 
fun const_proper strict =  | 
| 
 
3881972fcfca
clarified ProofContext.read_const(_proper)/Args.const(_proper) wrt. strict logical consts;
 
wenzelm 
parents: 
35360 
diff
changeset
 | 
221  | 
Scan.peek (fn ctxt => named_term (ProofContext.read_const_proper (Context.proof_of ctxt) strict))  | 
| 25343 | 222  | 
>> (fn Const (c, _) => c | _ => "");  | 
223  | 
||
| 15703 | 224  | 
|
| 27811 | 225  | 
(* improper method arguments *)  | 
| 15703 | 226  | 
|
| 18998 | 227  | 
val bang_facts = Scan.peek (fn context =>  | 
| 27811 | 228  | 
P.position ($$$ "!") >> (fn (_, pos) =>  | 
| 33550 | 229  | 
    (legacy_feature ("use of cumulative prems (!) in proof method" ^ Position.str_of pos);
 | 
| 
30473
 
e0b66c11e7e4
Assumption.all_prems_of, Assumption.all_assms_of;
 
wenzelm 
parents: 
30223 
diff
changeset
 | 
230  | 
Assumption.all_prems_of (Context.proof_of context))) || Scan.succeed []);  | 
| 8536 | 231  | 
|
232  | 
val from_to =  | 
|
| 27811 | 233  | 
P.nat -- ($$$ "-" |-- P.nat) >> (fn (i, j) => fn tac => Seq.INTERVAL tac i j) ||  | 
234  | 
P.nat --| $$$ "-" >> (fn i => fn tac => fn st => Seq.INTERVAL tac i (Thm.nprems_of st) st) ||  | 
|
235  | 
P.nat >> (fn i => fn tac => tac i) ||  | 
|
| 15703 | 236  | 
$$$ "!" >> K ALLGOALS;  | 
| 8536 | 237  | 
|
| 27811 | 238  | 
val goal = $$$ "[" |-- P.!!! (from_to --| $$$ "]");  | 
| 30514 | 239  | 
fun goal_spec x = Scan.lift (Scan.optional goal (fn tac => tac 1)) x;  | 
| 8233 | 240  | 
|
241  | 
||
| 27811 | 242  | 
(* arguments within outer syntax *)  | 
| 5878 | 243  | 
|
| 27382 | 244  | 
fun parse_args is_symid =  | 
245  | 
let  | 
|
| 27811 | 246  | 
val keyword_symid = token (P.keyword_with is_symid);  | 
247  | 
fun atom blk = P.group "argument"  | 
|
248  | 
(ident || keyword_symid || string || alt_string ||  | 
|
249  | 
(if blk then token (P.$$$ ",") else Scan.fail));  | 
|
| 
5822
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
250  | 
|
| 27382 | 251  | 
fun args blk x = Scan.optional (args1 blk) [] x  | 
252  | 
and args1 blk x =  | 
|
253  | 
((Scan.repeat1  | 
|
254  | 
(Scan.repeat1 (atom blk) ||  | 
|
255  | 
          argsp "(" ")" ||
 | 
|
256  | 
argsp "[" "]")) >> flat) x  | 
|
| 27811 | 257  | 
and argsp l r x = (token (P.$$$ l) ::: P.!!! (args true @@@ (token (P.$$$ r) >> single))) x;  | 
| 27382 | 258  | 
in (args, args1) end;  | 
| 15703 | 259  | 
|
| 27811 | 260  | 
val parse = #1 (parse_args T.ident_or_symbolic) false;  | 
261  | 
fun parse1 is_symid = #2 (parse_args is_symid) false;  | 
|
| 
5822
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
262  | 
|
| 27811 | 263  | 
|
264  | 
(* attributes *)  | 
|
| 27382 | 265  | 
|
| 15703 | 266  | 
fun attribs intern =  | 
267  | 
let  | 
|
| 27819 | 268  | 
val attrib_name = internal_text || (symbolic || named)  | 
269  | 
>> evaluate T.Text (intern o T.content_of);  | 
|
| 27811 | 270  | 
val attrib = P.position (attrib_name -- P.!!! parse) >> src;  | 
271  | 
in $$$ "[" |-- P.!!! (P.list attrib --| $$$ "]") end;  | 
|
| 15703 | 272  | 
|
273  | 
fun opt_attribs intern = Scan.optional (attribs intern) [];  | 
|
274  | 
||
| 
5822
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
275  | 
|
| 27377 | 276  | 
(* theorem specifications *)  | 
277  | 
||
| 28078 | 278  | 
fun thm_name intern s = binding -- opt_attribs intern --| $$$ s;  | 
| 27811 | 279  | 
|
| 27377 | 280  | 
fun opt_thm_name intern s =  | 
| 28078 | 281  | 
Scan.optional  | 
| 28965 | 282  | 
((binding -- opt_attribs intern || attribs intern >> pair Binding.empty) --| $$$ s)  | 
283  | 
(Binding.empty, []);  | 
|
| 27377 | 284  | 
|
285  | 
||
| 27382 | 286  | 
|
287  | 
(** syntax wrapper **)  | 
|
| 
5822
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
288  | 
|
| 32784 | 289  | 
fun syntax kind scan (Src ((s, args), pos)) st =  | 
| 27811 | 290  | 
(case Scan.error (Scan.finite' T.stopper (Scan.option scan)) (st, args) of  | 
| 21879 | 291  | 
(SOME x, (st', [])) => (x, st')  | 
| 15703 | 292  | 
| (_, (_, args')) =>  | 
293  | 
error (kind ^ " " ^ quote s ^ Position.str_of pos ^ ": bad arguments\n " ^  | 
|
| 27811 | 294  | 
space_implode " " (map T.unparse args')));  | 
| 15703 | 295  | 
|
| 21879 | 296  | 
fun context_syntax kind scan src = apsnd Context.the_proof o syntax kind scan src o Context.Proof;  | 
| 18998 | 297  | 
|
| 
5822
 
3f824514ad88
Concrete argument syntax (for attributes, methods etc.).
 
wenzelm 
parents:  
diff
changeset
 | 
298  | 
end;  |