src/Pure/Isar/parse.ML
author wenzelm
Mon Nov 14 16:52:19 2011 +0100 (2011-11-14 ago)
changeset 45488 6d71d9e52369
parent 45331 6e0a8aba99ec
child 45596 a27cd85b6028
permissions -rw-r--r--
pass positions for named targets, for formal links in the document model;
wenzelm@36949
     1
(*  Title:      Pure/Isar/parse.ML
wenzelm@5826
     2
    Author:     Markus Wenzel, TU Muenchen
wenzelm@5826
     3
wenzelm@5826
     4
Generic parsers for Isabelle/Isar outer syntax.
wenzelm@5826
     5
*)
wenzelm@5826
     6
wenzelm@36949
     7
signature PARSE =
wenzelm@5826
     8
sig
wenzelm@36959
     9
  type 'a parser = Token.T list -> 'a * Token.T list
wenzelm@36959
    10
  type 'a context_parser = Context.generic * Token.T list -> 'a * (Context.generic * Token.T list)
wenzelm@44357
    11
  val group: (unit -> string) -> (Token.T list -> 'a) -> Token.T list -> 'a
wenzelm@36959
    12
  val !!! : (Token.T list -> 'a) -> Token.T list -> 'a
wenzelm@36959
    13
  val !!!! : (Token.T list -> 'a) -> Token.T list -> 'a
wenzelm@12047
    14
  val triple1: ('a * 'b) * 'c -> 'a * 'b * 'c
wenzelm@12047
    15
  val triple2: 'a * ('b * 'c) -> 'a * 'b * 'c
wenzelm@12047
    16
  val triple_swap: ('a * 'b) * 'c -> ('a * 'c) * 'b
wenzelm@36959
    17
  val not_eof: Token.T parser
wenzelm@42326
    18
  val position: 'a parser -> ('a * Position.T) parser
wenzelm@42657
    19
  val source_position: 'a parser -> (Symbol_Pos.text * Position.T) parser
wenzelm@42326
    20
  val inner_syntax: 'a parser -> string parser
wenzelm@29310
    21
  val command: string parser
wenzelm@29310
    22
  val keyword: string parser
wenzelm@29310
    23
  val short_ident: string parser
wenzelm@29310
    24
  val long_ident: string parser
wenzelm@29310
    25
  val sym_ident: string parser
wenzelm@29310
    26
  val minus: string parser
wenzelm@29310
    27
  val term_var: string parser
wenzelm@29310
    28
  val type_ident: string parser
wenzelm@29310
    29
  val type_var: string parser
wenzelm@29310
    30
  val number: string parser
wenzelm@40290
    31
  val float_number: string parser
wenzelm@29310
    32
  val string: string parser
wenzelm@29310
    33
  val alt_string: string parser
wenzelm@29310
    34
  val verbatim: string parser
wenzelm@29310
    35
  val sync: string parser
wenzelm@29310
    36
  val eof: string parser
wenzelm@29310
    37
  val keyword_with: (string -> bool) -> string parser
wenzelm@29310
    38
  val keyword_ident_or_symbolic: string parser
wenzelm@29310
    39
  val $$$ : string -> string parser
wenzelm@29310
    40
  val reserved: string -> string parser
wenzelm@29310
    41
  val semicolon: string parser
wenzelm@29310
    42
  val underscore: string parser
wenzelm@29310
    43
  val maybe: 'a parser -> 'a option parser
wenzelm@29310
    44
  val tag_name: string parser
wenzelm@29310
    45
  val tags: string list parser
wenzelm@29310
    46
  val opt_unit: unit parser
wenzelm@29310
    47
  val opt_keyword: string -> bool parser
wenzelm@29310
    48
  val begin: string parser
wenzelm@29310
    49
  val opt_begin: bool parser
wenzelm@29310
    50
  val nat: int parser
wenzelm@29310
    51
  val int: int parser
wenzelm@40290
    52
  val real: real parser
wenzelm@29310
    53
  val enum: string -> 'a parser -> 'a list parser
wenzelm@29310
    54
  val enum1: string -> 'a parser -> 'a list parser
wenzelm@29310
    55
  val and_list: 'a parser -> 'a list parser
wenzelm@29310
    56
  val and_list1: 'a parser -> 'a list parser
wenzelm@30511
    57
  val enum': string -> 'a context_parser -> 'a list context_parser
wenzelm@30511
    58
  val enum1': string -> 'a context_parser -> 'a list context_parser
wenzelm@30511
    59
  val and_list': 'a context_parser -> 'a list context_parser
wenzelm@30511
    60
  val and_list1': 'a context_parser -> 'a list context_parser
wenzelm@29310
    61
  val list: 'a parser -> 'a list parser
wenzelm@29310
    62
  val list1: 'a parser -> 'a list parser
wenzelm@43775
    63
  val properties: Properties.T parser
wenzelm@29310
    64
  val name: bstring parser
haftmann@29581
    65
  val binding: binding parser
wenzelm@29310
    66
  val xname: xstring parser
wenzelm@29310
    67
  val text: string parser
wenzelm@29310
    68
  val path: Path.T parser
wenzelm@40800
    69
  val liberal_name: xstring parser
wenzelm@29310
    70
  val parname: string parser
haftmann@29581
    71
  val parbinding: binding parser
wenzelm@29310
    72
  val sort: string parser
wenzelm@29310
    73
  val arity: (string * string list * string) parser
wenzelm@29310
    74
  val multi_arity: (string list * string list * string) parser
wenzelm@29310
    75
  val type_args: string list parser
wenzelm@35838
    76
  val type_args_constrained: (string * string option) list parser
wenzelm@29310
    77
  val typ_group: string parser
wenzelm@29310
    78
  val typ: string parser
wenzelm@29310
    79
  val mixfix: mixfix parser
wenzelm@29310
    80
  val mixfix': mixfix parser
wenzelm@29310
    81
  val opt_mixfix: mixfix parser
wenzelm@29310
    82
  val opt_mixfix': mixfix parser
wenzelm@29310
    83
  val where_: string parser
wenzelm@42299
    84
  val const_decl: (string * string * mixfix) parser
wenzelm@30339
    85
  val const_binding: (binding * string * mixfix) parser
haftmann@29581
    86
  val params: (binding * string option) list parser
haftmann@29581
    87
  val simple_fixes: (binding * string option) list parser
haftmann@29581
    88
  val fixes: (binding * string option * mixfix) list parser
haftmann@29581
    89
  val for_fixes: (binding * string option * mixfix) list parser
haftmann@29581
    90
  val for_simple_fixes: (binding * string option) list parser
wenzelm@30573
    91
  val ML_source: (Symbol_Pos.text * Position.T) parser
wenzelm@30573
    92
  val doc_source: (Symbol_Pos.text * Position.T) parser
wenzelm@29310
    93
  val term_group: string parser
wenzelm@29310
    94
  val prop_group: string parser
wenzelm@29310
    95
  val term: string parser
wenzelm@29310
    96
  val prop: string parser
wenzelm@42300
    97
  val type_const: string parser
wenzelm@42300
    98
  val const: string parser
wenzelm@40793
    99
  val literal_fact: string parser
wenzelm@29310
   100
  val propp: (string * string list) parser
wenzelm@29310
   101
  val termp: (string * string list) parser
wenzelm@45488
   102
  val target: (xstring * Position.T) parser
wenzelm@45488
   103
  val opt_target: (xstring * Position.T) option parser
wenzelm@5826
   104
end;
wenzelm@5826
   105
wenzelm@36949
   106
structure Parse: PARSE =
wenzelm@5826
   107
struct
wenzelm@5826
   108
wenzelm@36959
   109
type 'a parser = Token.T list -> 'a * Token.T list;
wenzelm@36959
   110
type 'a context_parser = Context.generic * Token.T list -> 'a * (Context.generic * Token.T list);
wenzelm@29310
   111
wenzelm@5826
   112
wenzelm@5826
   113
(** error handling **)
wenzelm@5826
   114
wenzelm@5826
   115
(* group atomic parsers (no cuts!) *)
wenzelm@5826
   116
wenzelm@44357
   117
fun group s scan = scan || Scan.fail_with
wenzelm@44357
   118
  (fn [] => (fn () => s () ^ " expected (past end-of-file!)")
wenzelm@42519
   119
    | tok :: _ =>
wenzelm@43947
   120
        (fn () =>
wenzelm@43947
   121
          (case Token.text_of tok of
wenzelm@43947
   122
            (txt, "") =>
wenzelm@44357
   123
              s () ^ " expected,\nbut " ^ txt ^ Token.pos_of tok ^ " was found"
wenzelm@43947
   124
          | (txt1, txt2) =>
wenzelm@44357
   125
              s () ^ " expected,\nbut " ^ txt1 ^ Token.pos_of tok ^ " was found:\n" ^ txt2)));
wenzelm@5826
   126
wenzelm@5826
   127
wenzelm@5877
   128
(* cut *)
wenzelm@5826
   129
wenzelm@8581
   130
fun cut kind scan =
wenzelm@5826
   131
  let
wenzelm@5826
   132
    fun get_pos [] = " (past end-of-file!)"
wenzelm@36959
   133
      | get_pos (tok :: _) = Token.pos_of tok;
wenzelm@5826
   134
wenzelm@43947
   135
    fun err (toks, NONE) = (fn () => kind ^ get_pos toks)
wenzelm@25625
   136
      | err (toks, SOME msg) =
wenzelm@43947
   137
          (fn () =>
wenzelm@43947
   138
            let val s = msg () in
wenzelm@43947
   139
              if String.isPrefix kind s then s
wenzelm@43947
   140
              else kind ^ get_pos toks ^ ": " ^ s
wenzelm@43947
   141
            end);
wenzelm@5826
   142
  in Scan.!! err scan end;
wenzelm@5826
   143
wenzelm@8586
   144
fun !!! scan = cut "Outer syntax error" scan;
wenzelm@8586
   145
fun !!!! scan = cut "Corrupted outer syntax in presentation" scan;
wenzelm@8581
   146
wenzelm@5826
   147
wenzelm@5826
   148
wenzelm@5826
   149
(** basic parsers **)
wenzelm@5826
   150
wenzelm@5826
   151
(* utils *)
wenzelm@5826
   152
wenzelm@5826
   153
fun triple1 ((x, y), z) = (x, y, z);
wenzelm@5826
   154
fun triple2 (x, (y, z)) = (x, y, z);
wenzelm@6430
   155
fun triple_swap ((x, y), z) = ((x, z), y);
wenzelm@5826
   156
wenzelm@5826
   157
wenzelm@5826
   158
(* tokens *)
wenzelm@5826
   159
wenzelm@27815
   160
fun RESET_VALUE atom = (*required for all primitive parsers*)
wenzelm@36959
   161
  Scan.ahead (Scan.one (K true)) -- atom >> (fn (arg, x) => (Token.assign NONE arg; x));
wenzelm@27815
   162
wenzelm@27815
   163
wenzelm@36959
   164
val not_eof = RESET_VALUE (Scan.one Token.not_eof);
wenzelm@15703
   165
wenzelm@36959
   166
fun position scan = (Scan.ahead not_eof >> Token.position_of) -- scan >> Library.swap;
wenzelm@36959
   167
fun source_position atom = Scan.ahead atom |-- not_eof >> Token.source_position_of;
wenzelm@36959
   168
fun inner_syntax atom = Scan.ahead atom |-- not_eof >> Token.source_of;
wenzelm@5826
   169
wenzelm@5826
   170
fun kind k =
wenzelm@44357
   171
  group (fn () => Token.str_of_kind k)
wenzelm@44357
   172
    (RESET_VALUE (Scan.one (Token.is_kind k) >> Token.content_of));
wenzelm@5826
   173
wenzelm@36959
   174
val command = kind Token.Command;
wenzelm@36959
   175
val keyword = kind Token.Keyword;
wenzelm@36959
   176
val short_ident = kind Token.Ident;
wenzelm@36959
   177
val long_ident = kind Token.LongIdent;
wenzelm@36959
   178
val sym_ident = kind Token.SymIdent;
wenzelm@36959
   179
val term_var = kind Token.Var;
wenzelm@36959
   180
val type_ident = kind Token.TypeIdent;
wenzelm@36959
   181
val type_var = kind Token.TypeVar;
wenzelm@36959
   182
val number = kind Token.Nat;
wenzelm@40290
   183
val float_number = kind Token.Float;
wenzelm@36959
   184
val string = kind Token.String;
wenzelm@36959
   185
val alt_string = kind Token.AltString;
wenzelm@36959
   186
val verbatim = kind Token.Verbatim;
wenzelm@36959
   187
val sync = kind Token.Sync;
wenzelm@36959
   188
val eof = kind Token.EOF;
wenzelm@5826
   189
wenzelm@36959
   190
fun keyword_with pred = RESET_VALUE (Scan.one (Token.keyword_with pred) >> Token.content_of);
wenzelm@36959
   191
val keyword_ident_or_symbolic = keyword_with Token.ident_or_symbolic;
wenzelm@27815
   192
wenzelm@5826
   193
fun $$$ x =
wenzelm@44357
   194
  group (fn () => Token.str_of_kind Token.Keyword ^ " " ^ quote x)
wenzelm@44357
   195
    (keyword_with (fn y => x = y));
wenzelm@9131
   196
wenzelm@16030
   197
fun reserved x =
wenzelm@44357
   198
  group (fn () => "reserved identifier " ^ quote x)
wenzelm@36959
   199
    (RESET_VALUE (Scan.one (Token.ident_with (fn y => x = y)) >> Token.content_of));
wenzelm@16030
   200
wenzelm@9131
   201
val semicolon = $$$ ";";
wenzelm@5826
   202
wenzelm@15703
   203
val minus = sym_ident :-- (fn "-" => Scan.succeed () | _ => Scan.fail) >> #1;
wenzelm@11792
   204
val underscore = sym_ident :-- (fn "_" => Scan.succeed () | _ => Scan.fail) >> #1;
wenzelm@15703
   205
fun maybe scan = underscore >> K NONE || scan >> SOME;
wenzelm@11792
   206
wenzelm@14835
   207
val nat = number >> (#1 o Library.read_int o Symbol.explode);
wenzelm@27815
   208
val int = Scan.optional (minus >> K ~1) 1 -- nat >> op *;
wenzelm@40296
   209
val real = float_number >> (the o Real.fromString) || int >> Real.fromInt;
wenzelm@5826
   210
wenzelm@44357
   211
val tag_name = group (fn () => "tag name") (short_ident || string);
wenzelm@17070
   212
val tags = Scan.repeat ($$$ "%" |-- !!! tag_name);
wenzelm@17070
   213
wenzelm@7930
   214
val opt_unit = Scan.optional ($$$ "(" -- $$$ ")" >> (K ())) ();
wenzelm@14646
   215
fun opt_keyword s = Scan.optional ($$$ "(" |-- !!! (($$$ s >> K true) --| $$$ ")")) false;
wenzelm@14646
   216
wenzelm@20983
   217
val begin = $$$ "begin";
wenzelm@20983
   218
val opt_begin = Scan.optional (begin >> K true) false;
wenzelm@20961
   219
wenzelm@5826
   220
wenzelm@5826
   221
(* enumerations *)
wenzelm@5826
   222
wenzelm@25999
   223
fun enum1 sep scan = scan ::: Scan.repeat ($$$ sep |-- !!! scan);
wenzelm@5826
   224
fun enum sep scan = enum1 sep scan || Scan.succeed [];
wenzelm@5826
   225
wenzelm@27815
   226
fun enum1' sep scan = scan ::: Scan.repeat (Scan.lift ($$$ sep) |-- scan);
wenzelm@27815
   227
fun enum' sep scan = enum1' sep scan || Scan.succeed [];
wenzelm@5826
   228
wenzelm@6013
   229
fun and_list1 scan = enum1 "and" scan;
wenzelm@6013
   230
fun and_list scan = enum "and" scan;
wenzelm@6013
   231
wenzelm@27815
   232
fun and_list1' scan = enum1' "and" scan;
wenzelm@27815
   233
fun and_list' scan = enum' "and" scan;
wenzelm@27815
   234
wenzelm@27815
   235
fun list1 scan = enum1 "," scan;
wenzelm@27815
   236
fun list scan = enum "," scan;
wenzelm@27815
   237
wenzelm@43775
   238
val properties = $$$ "(" |-- !!! (list (string -- ($$$ "=" |-- string)) --| $$$ ")");
wenzelm@43775
   239
wenzelm@5826
   240
wenzelm@5960
   241
(* names and text *)
wenzelm@5826
   242
wenzelm@44357
   243
val name = group (fn () => "name declaration") (short_ident || sym_ident || string || number);
wenzelm@44357
   244
wenzelm@30223
   245
val binding = position name >> Binding.make;
wenzelm@44357
   246
wenzelm@44357
   247
val xname = group (fn () => "name reference")
wenzelm@44357
   248
  (short_ident || long_ident || sym_ident || string || number);
wenzelm@44357
   249
wenzelm@44357
   250
val text = group (fn () => "text")
wenzelm@44357
   251
  (short_ident || long_ident || sym_ident || string || number || verbatim);
wenzelm@44357
   252
wenzelm@44357
   253
val path = group (fn () => "file name/path specification") name >> Path.explode;
wenzelm@6553
   254
wenzelm@40800
   255
val liberal_name = keyword_ident_or_symbolic || xname;
wenzelm@40800
   256
wenzelm@18898
   257
val parname = Scan.optional ($$$ "(" |-- name --| $$$ ")") "";
haftmann@28965
   258
val parbinding = Scan.optional ($$$ "(" |-- binding --| $$$ ")") Binding.empty;
wenzelm@18898
   259
wenzelm@6553
   260
wenzelm@6372
   261
(* sorts and arities *)
wenzelm@5826
   262
wenzelm@44357
   263
val sort = group (fn () => "sort") (inner_syntax xname);
wenzelm@5826
   264
wenzelm@22331
   265
val arity = xname -- ($$$ "::" |-- !!!
wenzelm@22331
   266
  (Scan.optional ($$$ "(" |-- !!! (list1 sort --| $$$ ")")) [] -- sort)) >> triple2;
wenzelm@5826
   267
haftmann@25541
   268
val multi_arity = and_list1 xname -- ($$$ "::" |-- !!!
haftmann@25541
   269
  (Scan.optional ($$$ "(" |-- !!! (list1 sort --| $$$ ")")) [] -- sort)) >> triple2;
haftmann@25541
   270
wenzelm@5826
   271
wenzelm@5826
   272
(* types *)
wenzelm@5826
   273
wenzelm@44357
   274
val typ_group =
wenzelm@44357
   275
  group (fn () => "type")
wenzelm@44357
   276
    (short_ident || long_ident || sym_ident || type_ident || type_var || string || number);
wenzelm@5826
   277
wenzelm@27753
   278
val typ = inner_syntax typ_group;
wenzelm@27753
   279
wenzelm@35838
   280
fun type_arguments arg =
wenzelm@35838
   281
  arg >> single ||
wenzelm@35838
   282
  $$$ "(" |-- !!! (list1 arg --| $$$ ")") ||
wenzelm@5826
   283
  Scan.succeed [];
wenzelm@5826
   284
wenzelm@35838
   285
val type_args = type_arguments type_ident;
wenzelm@35838
   286
val type_args_constrained = type_arguments (type_ident -- Scan.option ($$$ "::" |-- !!! sort));
wenzelm@35838
   287
wenzelm@5826
   288
wenzelm@5826
   289
(* mixfix annotations *)
wenzelm@5826
   290
wenzelm@18669
   291
val mfix = string --
wenzelm@18669
   292
  !!! (Scan.optional ($$$ "[" |-- !!! (list nat --| $$$ "]")) [] --
wenzelm@42297
   293
    Scan.optional nat 1000) >> (Mixfix o triple2);
wenzelm@18669
   294
wenzelm@35130
   295
val infx = $$$ "infix" |-- !!! (string -- nat >> Infix);
wenzelm@35130
   296
val infxl = $$$ "infixl" |-- !!! (string -- nat >> Infixl);
wenzelm@35130
   297
val infxr = $$$ "infixr" |-- !!! (string -- nat >> Infixr);
wenzelm@5826
   298
wenzelm@18669
   299
val binder = $$$ "binder" |--
wenzelm@18669
   300
  !!! (string -- ($$$ "[" |-- nat --| $$$ "]" -- nat || nat >> (fn n => (n, n))))
wenzelm@18669
   301
  >> (Binder o triple2);
wenzelm@18669
   302
wenzelm@18669
   303
fun annotation guard fix = $$$ "(" |-- guard (fix --| $$$ ")");
wenzelm@18669
   304
fun opt_annotation guard fix = Scan.optional (annotation guard fix) NoSyn;
wenzelm@18669
   305
wenzelm@18669
   306
val mixfix = annotation !!! (mfix || binder || infxl || infxr || infx);
wenzelm@21609
   307
val mixfix' = annotation I (mfix || binder || infxl || infxr || infx);
wenzelm@18669
   308
val opt_mixfix = opt_annotation !!! (mfix || binder || infxl || infxr || infx);
wenzelm@18669
   309
val opt_mixfix' = opt_annotation I (mfix || binder || infxl || infxr || infx);
wenzelm@5826
   310
wenzelm@5826
   311
wenzelm@18669
   312
(* fixes *)
wenzelm@5826
   313
wenzelm@21400
   314
val where_ = $$$ "where";
wenzelm@21400
   315
wenzelm@42299
   316
val const_decl = name -- ($$$ "::" |-- !!! typ) -- opt_mixfix >> triple1;
wenzelm@30339
   317
val const_binding = binding -- ($$$ "::" |-- !!! typ) -- opt_mixfix >> triple1;
wenzelm@18669
   318
wenzelm@28081
   319
val params = Scan.repeat1 binding -- Scan.option ($$$ "::" |-- !!! typ)
wenzelm@18669
   320
  >> (fn (xs, T) => map (rpair T) xs);
wenzelm@18669
   321
wenzelm@19482
   322
val simple_fixes = and_list1 params >> flat;
wenzelm@18669
   323
wenzelm@18669
   324
val fixes =
wenzelm@45331
   325
  and_list1 (binding -- Scan.option ($$$ "::" |-- typ) -- mixfix' >> (single o triple1) ||
wenzelm@42287
   326
    params >> map (fn (x, y) => (x, y, NoSyn))) >> flat;
wenzelm@5826
   327
wenzelm@19845
   328
val for_fixes = Scan.optional ($$$ "for" |-- !!! fixes) [];
wenzelm@21371
   329
val for_simple_fixes = Scan.optional ($$$ "for" |-- !!! simple_fixes) [];
wenzelm@19845
   330
wenzelm@5826
   331
wenzelm@27877
   332
(* embedded source text *)
wenzelm@27872
   333
wenzelm@44357
   334
val ML_source = source_position (group (fn () => "ML source") text);
wenzelm@44357
   335
val doc_source = source_position (group (fn () => "document source") text);
wenzelm@27872
   336
wenzelm@27872
   337
wenzelm@5826
   338
(* terms *)
wenzelm@5826
   339
wenzelm@40793
   340
val tm = short_ident || long_ident || sym_ident || term_var || number || string;
wenzelm@5826
   341
wenzelm@44357
   342
val term_group = group (fn () => "term") tm;
wenzelm@44357
   343
val prop_group = group (fn () => "proposition") tm;
wenzelm@27753
   344
wenzelm@27753
   345
val term = inner_syntax term_group;
wenzelm@27753
   346
val prop = inner_syntax prop_group;
wenzelm@5826
   347
wenzelm@44357
   348
val type_const = inner_syntax (group (fn () => "type constructor") xname);
wenzelm@44357
   349
val const = inner_syntax (group (fn () => "constant") xname);
wenzelm@42300
   350
wenzelm@44357
   351
val literal_fact = inner_syntax (group (fn () => "literal fact") alt_string);
wenzelm@40793
   352
wenzelm@5826
   353
wenzelm@6949
   354
(* patterns *)
wenzelm@6935
   355
wenzelm@6949
   356
val is_terms = Scan.repeat1 ($$$ "is" |-- term);
wenzelm@6935
   357
val is_props = Scan.repeat1 ($$$ "is" |-- prop);
wenzelm@6935
   358
wenzelm@19585
   359
val propp = prop -- Scan.optional ($$$ "(" |-- !!! (is_props --| $$$ ")")) [];
wenzelm@6949
   360
val termp = term -- Scan.optional ($$$ "(" |-- !!! (is_terms --| $$$ ")")) [];
wenzelm@6935
   361
wenzelm@6935
   362
wenzelm@22119
   363
(* targets *)
wenzelm@19811
   364
wenzelm@45488
   365
val target = ($$$ "(" -- $$$ "in") |-- !!! (position xname --| $$$ ")");
wenzelm@22119
   366
val opt_target = Scan.option target;
wenzelm@12272
   367
wenzelm@12272
   368
end;
wenzelm@30511
   369
wenzelm@36949
   370
type 'a parser = 'a Parse.parser;
wenzelm@36949
   371
type 'a context_parser = 'a Parse.context_parser;
wenzelm@30511
   372