src/Pure/Isar/outer_lex.ML
author wenzelm
Mon May 03 14:25:56 2010 +0200 (2010-05-03)
changeset 36610 bafd82950e24
parent 32738 15bb09ca0378
permissions -rw-r--r--
renamed ProofContext.init to ProofContext.init_global to emphasize that this is not the real thing;
wenzelm@5825
     1
(*  Title:      Pure/Isar/outer_lex.ML
wenzelm@5825
     2
    Author:     Markus Wenzel, TU Muenchen
wenzelm@5825
     3
wenzelm@5825
     4
Outer lexical syntax for Isabelle/Isar.
wenzelm@5825
     5
*)
wenzelm@5825
     6
wenzelm@5825
     7
signature OUTER_LEX =
wenzelm@5825
     8
sig
wenzelm@5825
     9
  datatype token_kind =
wenzelm@27814
    10
    Command | Keyword | Ident | LongIdent | SymIdent | Var | TypeIdent | TypeVar |
wenzelm@27814
    11
    Nat | String | AltString | Verbatim | Space | Comment | InternalValue |
wenzelm@27814
    12
    Malformed | Error of string | Sync | EOF
wenzelm@27814
    13
  datatype value =
wenzelm@27814
    14
    Text of string | Typ of typ | Term of term | Fact of thm list |
wenzelm@27814
    15
    Attribute of morphism -> attribute
wenzelm@27814
    16
  type token
wenzelm@5825
    17
  val str_of_kind: token_kind -> string
wenzelm@5825
    18
  val position_of: token -> Position.T
wenzelm@27752
    19
  val end_position_of: token -> Position.T
wenzelm@5825
    20
  val pos_of: token -> string
wenzelm@27733
    21
  val eof: token
wenzelm@27733
    22
  val is_eof: token -> bool
wenzelm@27733
    23
  val not_eof: token -> bool
wenzelm@27733
    24
  val not_sync: token -> bool
wenzelm@27733
    25
  val stopper: token Scan.stopper
wenzelm@23721
    26
  val kind_of: token -> token_kind
wenzelm@5825
    27
  val is_kind: token_kind -> token -> bool
wenzelm@7026
    28
  val keyword_with: (string -> bool) -> token -> bool
wenzelm@16029
    29
  val ident_with: (string -> bool) -> token -> bool
wenzelm@5825
    30
  val is_proper: token -> bool
wenzelm@9130
    31
  val is_semicolon: token -> bool
wenzelm@17069
    32
  val is_comment: token -> bool
wenzelm@8580
    33
  val is_begin_ignore: token -> bool
wenzelm@8580
    34
  val is_end_ignore: token -> bool
wenzelm@17069
    35
  val is_blank: token -> bool
wenzelm@8651
    36
  val is_newline: token -> bool
wenzelm@27747
    37
  val source_of: token -> string
wenzelm@30573
    38
  val source_position_of: token -> Symbol_Pos.text * Position.T
wenzelm@27814
    39
  val content_of: token -> string
wenzelm@14991
    40
  val unparse: token -> string
wenzelm@23788
    41
  val text_of: token -> string * string
wenzelm@27814
    42
  val get_value: token -> value option
wenzelm@27814
    43
  val map_value: (value -> value) -> token -> token
wenzelm@27814
    44
  val mk_text: string -> token
wenzelm@27814
    45
  val mk_typ: typ -> token
wenzelm@27814
    46
  val mk_term: term -> token
wenzelm@27814
    47
  val mk_fact: thm list -> token
wenzelm@27814
    48
  val mk_attribute: (morphism -> attribute) -> token
wenzelm@27814
    49
  val assignable: token -> token
wenzelm@27814
    50
  val assign: value option -> token -> unit
wenzelm@27814
    51
  val closure: token -> token
wenzelm@27814
    52
  val ident_or_symbolic: string -> bool
wenzelm@30573
    53
  val !!! : string -> (Symbol_Pos.T list -> 'a) -> Symbol_Pos.T list -> 'a
wenzelm@27769
    54
  val source_proper: (token, 'a) Source.source -> (token, (token, 'a) Source.source) Source.source
wenzelm@27835
    55
  val source': {do_recover: bool Option.option} -> (unit -> Scan.lexicon * Scan.lexicon) ->
wenzelm@30573
    56
    (Symbol_Pos.T, 'a) Source.source -> (token, (Symbol_Pos.T, 'a) Source.source) Source.source
wenzelm@27835
    57
  val source: {do_recover: bool Option.option} -> (unit -> Scan.lexicon * Scan.lexicon) ->
wenzelm@27769
    58
    Position.T -> (Symbol.symbol, 'a) Source.source -> (token,
wenzelm@30573
    59
      (Symbol_Pos.T, Position.T * (Symbol.symbol, 'a) Source.source) Source.source) Source.source
wenzelm@30586
    60
  val read_antiq: Scan.lexicon -> (token list -> 'a * token list) ->
wenzelm@30586
    61
    Symbol_Pos.T list * Position.T -> 'a
wenzelm@5825
    62
end;
wenzelm@5825
    63
wenzelm@5825
    64
structure OuterLex: OUTER_LEX =
wenzelm@5825
    65
struct
wenzelm@5825
    66
wenzelm@5825
    67
(** tokens **)
wenzelm@5825
    68
wenzelm@27814
    69
(* token values *)
wenzelm@27814
    70
wenzelm@27814
    71
(*The value slot assigns an (optional) internal value to a token,
wenzelm@27814
    72
  usually as a side-effect of special scanner setup (see also
wenzelm@27814
    73
  args.ML).  Note that an assignable ref designates an intermediate
wenzelm@27814
    74
  state of internalization -- it is NOT meant to persist.*)
wenzelm@27814
    75
wenzelm@27814
    76
datatype value =
wenzelm@27814
    77
  Text of string |
wenzelm@27814
    78
  Typ of typ |
wenzelm@27814
    79
  Term of term |
wenzelm@27814
    80
  Fact of thm list |
wenzelm@27814
    81
  Attribute of morphism -> attribute;
wenzelm@27814
    82
wenzelm@27814
    83
datatype slot =
wenzelm@27814
    84
  Slot |
wenzelm@27814
    85
  Value of value option |
wenzelm@32738
    86
  Assignable of value option Unsynchronized.ref;
wenzelm@27814
    87
wenzelm@27814
    88
wenzelm@5825
    89
(* datatype token *)
wenzelm@5825
    90
wenzelm@5825
    91
datatype token_kind =
wenzelm@27814
    92
  Command | Keyword | Ident | LongIdent | SymIdent | Var | TypeIdent | TypeVar |
wenzelm@27814
    93
  Nat | String | AltString | Verbatim | Space | Comment | InternalValue |
wenzelm@27814
    94
  Malformed | Error of string | Sync | EOF;
wenzelm@5825
    95
wenzelm@30573
    96
datatype token = Token of (Symbol_Pos.text * Position.range) * (token_kind * string) * slot;
wenzelm@5825
    97
wenzelm@5825
    98
val str_of_kind =
wenzelm@7026
    99
 fn Command => "command"
wenzelm@7026
   100
  | Keyword => "keyword"
wenzelm@5825
   101
  | Ident => "identifier"
wenzelm@5825
   102
  | LongIdent => "long identifier"
wenzelm@5825
   103
  | SymIdent => "symbolic identifier"
wenzelm@5825
   104
  | Var => "schematic variable"
wenzelm@5825
   105
  | TypeIdent => "type variable"
wenzelm@5825
   106
  | TypeVar => "schematic type variable"
wenzelm@5825
   107
  | Nat => "number"
wenzelm@5825
   108
  | String => "string"
wenzelm@17164
   109
  | AltString => "back-quoted string"
wenzelm@5825
   110
  | Verbatim => "verbatim text"
wenzelm@7682
   111
  | Space => "white space"
wenzelm@7682
   112
  | Comment => "comment text"
wenzelm@27814
   113
  | InternalValue => "internal value"
wenzelm@23729
   114
  | Malformed => "malformed symbolic character"
wenzelm@23729
   115
  | Error _ => "bad input"
wenzelm@23788
   116
  | Sync => "sync marker"
wenzelm@5825
   117
  | EOF => "end-of-file";
wenzelm@5825
   118
wenzelm@5825
   119
wenzelm@27733
   120
(* position *)
wenzelm@5825
   121
wenzelm@27814
   122
fun position_of (Token ((_, (pos, _)), _, _)) = pos;
wenzelm@27814
   123
fun end_position_of (Token ((_, (_, pos)), _, _)) = pos;
wenzelm@27663
   124
wenzelm@5825
   125
val pos_of = Position.str_of o position_of;
wenzelm@5825
   126
wenzelm@5825
   127
wenzelm@27733
   128
(* control tokens *)
wenzelm@27733
   129
wenzelm@27814
   130
fun mk_eof pos = Token (("", (pos, Position.none)), (EOF, ""), Slot);
wenzelm@27733
   131
val eof = mk_eof Position.none;
wenzelm@27733
   132
wenzelm@27814
   133
fun is_eof (Token (_, (EOF, _), _)) = true
wenzelm@27733
   134
  | is_eof _ = false;
wenzelm@27733
   135
wenzelm@27733
   136
val not_eof = not o is_eof;
wenzelm@27733
   137
wenzelm@27814
   138
fun not_sync (Token (_, (Sync, _), _)) = false
wenzelm@27733
   139
  | not_sync _ = true;
wenzelm@27733
   140
wenzelm@27752
   141
val stopper =
wenzelm@27752
   142
  Scan.stopper (fn [] => eof | toks => mk_eof (end_position_of (List.last toks))) is_eof;
wenzelm@27733
   143
wenzelm@27733
   144
wenzelm@5825
   145
(* kind of token *)
wenzelm@5825
   146
wenzelm@27814
   147
fun kind_of (Token (_, (k, _), _)) = k;
wenzelm@27814
   148
fun is_kind k (Token (_, (k', _), _)) = k = k';
wenzelm@5825
   149
wenzelm@27814
   150
fun keyword_with pred (Token (_, (Keyword, x), _)) = pred x
wenzelm@7026
   151
  | keyword_with _ _ = false;
wenzelm@5825
   152
wenzelm@27814
   153
fun ident_with pred (Token (_, (Ident, x), _)) = pred x
wenzelm@16029
   154
  | ident_with _ _ = false;
wenzelm@16029
   155
wenzelm@27814
   156
fun is_proper (Token (_, (Space, _), _)) = false
wenzelm@27814
   157
  | is_proper (Token (_, (Comment, _), _)) = false
wenzelm@5825
   158
  | is_proper _ = true;
wenzelm@5825
   159
wenzelm@27814
   160
fun is_semicolon (Token (_, (Keyword, ";"), _)) = true
wenzelm@9130
   161
  | is_semicolon _ = false;
wenzelm@9130
   162
wenzelm@27814
   163
fun is_comment (Token (_, (Comment, _), _)) = true
wenzelm@17069
   164
  | is_comment _ = false;
wenzelm@17069
   165
wenzelm@27814
   166
fun is_begin_ignore (Token (_, (Comment, "<"), _)) = true
wenzelm@8580
   167
  | is_begin_ignore _ = false;
wenzelm@8580
   168
wenzelm@27814
   169
fun is_end_ignore (Token (_, (Comment, ">"), _)) = true
wenzelm@8580
   170
  | is_end_ignore _ = false;
wenzelm@8580
   171
wenzelm@8651
   172
wenzelm@17069
   173
(* blanks and newlines -- space tokens obey lines *)
wenzelm@8651
   174
wenzelm@27814
   175
fun is_blank (Token (_, (Space, x), _)) = not (String.isSuffix "\n" x)
wenzelm@17069
   176
  | is_blank _ = false;
wenzelm@17069
   177
wenzelm@27814
   178
fun is_newline (Token (_, (Space, x), _)) = String.isSuffix "\n" x
wenzelm@8651
   179
  | is_newline _ = false;
wenzelm@8651
   180
wenzelm@5825
   181
wenzelm@14991
   182
(* token content *)
wenzelm@9155
   183
wenzelm@27814
   184
fun source_of (Token ((source, (pos, _)), _, _)) =
wenzelm@27814
   185
  YXML.string_of (XML.Elem (Markup.tokenN, Position.properties_of pos, [XML.Text source]));
wenzelm@25642
   186
wenzelm@27885
   187
fun source_position_of (Token ((source, (pos, _)), _, _)) = (source, pos);
wenzelm@27873
   188
wenzelm@27814
   189
fun content_of (Token (_, (_, x), _)) = x;
wenzelm@27747
   190
wenzelm@27747
   191
wenzelm@27747
   192
(* unparse *)
wenzelm@27747
   193
wenzelm@18547
   194
fun escape q =
wenzelm@18547
   195
  implode o map (fn s => if s = q orelse s = "\\" then "\\" ^ s else s) o Symbol.explode;
wenzelm@18547
   196
wenzelm@27814
   197
fun unparse (Token (_, (kind, x), _)) =
wenzelm@14991
   198
  (case kind of
wenzelm@18547
   199
    String => x |> quote o escape "\""
wenzelm@18547
   200
  | AltString => x |> enclose "`" "`" o escape "`"
wenzelm@14991
   201
  | Verbatim => x |> enclose "{*" "*}"
wenzelm@14991
   202
  | Comment => x |> enclose "(*" "*)"
wenzelm@28034
   203
  | Malformed => space_implode " " (explode x)
wenzelm@23729
   204
  | Sync => ""
wenzelm@23729
   205
  | EOF => ""
wenzelm@14991
   206
  | _ => x);
wenzelm@14991
   207
wenzelm@23788
   208
fun text_of tok =
wenzelm@23788
   209
  if is_semicolon tok then ("terminator", "")
wenzelm@23729
   210
  else
wenzelm@23788
   211
    let
wenzelm@23788
   212
      val k = str_of_kind (kind_of tok);
wenzelm@25642
   213
      val s = unparse tok
wenzelm@27814
   214
        handle ERROR _ => Symbol.separate_chars (content_of tok);
wenzelm@23788
   215
    in
wenzelm@23788
   216
      if s = "" then (k, "")
wenzelm@23788
   217
      else if size s < 40 andalso not (exists_string (fn c => c = "\n") s) then (k ^ " " ^ s, "")
wenzelm@23788
   218
      else (k, s)
wenzelm@23788
   219
    end;
wenzelm@23729
   220
wenzelm@5825
   221
wenzelm@5825
   222
wenzelm@27814
   223
(** associated values **)
wenzelm@27814
   224
wenzelm@27814
   225
(* access values *)
wenzelm@27814
   226
wenzelm@27814
   227
fun get_value (Token (_, _, Value v)) = v
wenzelm@27814
   228
  | get_value _ = NONE;
wenzelm@27814
   229
wenzelm@27814
   230
fun map_value f (Token (x, y, Value (SOME v))) = Token (x, y, Value (SOME (f v)))
wenzelm@27814
   231
  | map_value _ tok = tok;
wenzelm@27814
   232
wenzelm@27814
   233
wenzelm@27814
   234
(* make values *)
wenzelm@27814
   235
wenzelm@27814
   236
fun mk_value k v = Token ((k, Position.no_range), (InternalValue, k), Value (SOME v));
wenzelm@27814
   237
wenzelm@27814
   238
val mk_text = mk_value "<text>" o Text;
wenzelm@27814
   239
val mk_typ = mk_value "<typ>" o Typ;
wenzelm@27814
   240
val mk_term = mk_value "<term>" o Term;
wenzelm@27814
   241
val mk_fact = mk_value "<fact>" o Fact;
wenzelm@27814
   242
val mk_attribute = mk_value "<attribute>" o Attribute;
wenzelm@27814
   243
wenzelm@27814
   244
wenzelm@27814
   245
(* static binding *)
wenzelm@27814
   246
wenzelm@27814
   247
(*1st stage: make empty slots assignable*)
wenzelm@32738
   248
fun assignable (Token (x, y, Slot)) = Token (x, y, Assignable (Unsynchronized.ref NONE))
wenzelm@27814
   249
  | assignable tok = tok;
wenzelm@27814
   250
wenzelm@27814
   251
(*2nd stage: assign values as side-effect of scanning*)
wenzelm@27814
   252
fun assign v (Token (_, _, Assignable r)) = r := v
wenzelm@27814
   253
  | assign _ _ = ();
wenzelm@27814
   254
wenzelm@27814
   255
(*3rd stage: static closure of final values*)
wenzelm@32738
   256
fun closure (Token (x, y, Assignable (Unsynchronized.ref v))) = Token (x, y, Value v)
wenzelm@27814
   257
  | closure tok = tok;
wenzelm@27814
   258
wenzelm@27814
   259
wenzelm@27814
   260
wenzelm@5825
   261
(** scanners **)
wenzelm@5825
   262
wenzelm@30573
   263
open Basic_Symbol_Pos;
wenzelm@5825
   264
wenzelm@30573
   265
fun !!! msg = Symbol_Pos.!!! ("Outer lexical error: " ^ msg);
wenzelm@5825
   266
wenzelm@5825
   267
wenzelm@5825
   268
(* scan symbolic idents *)
wenzelm@5825
   269
wenzelm@20664
   270
val is_sym_char = member (op =) (explode "!#$%&*+-/<=>?@^_|~");
wenzelm@5825
   271
wenzelm@8231
   272
val scan_symid =
wenzelm@27769
   273
  Scan.many1 (is_sym_char o symbol) ||
wenzelm@27769
   274
  Scan.one (Symbol.is_symbolic o symbol) >> single;
wenzelm@5825
   275
wenzelm@8231
   276
fun is_symid str =
wenzelm@8231
   277
  (case try Symbol.explode str of
skalberg@15531
   278
    SOME [s] => Symbol.is_symbolic s orelse is_sym_char s
skalberg@15531
   279
  | SOME ss => forall is_sym_char ss
wenzelm@8231
   280
  | _ => false);
wenzelm@8231
   281
wenzelm@27814
   282
fun ident_or_symbolic "begin" = false
wenzelm@27814
   283
  | ident_or_symbolic ":" = true
wenzelm@27814
   284
  | ident_or_symbolic "::" = true
wenzelm@27814
   285
  | ident_or_symbolic s = Syntax.is_identifier s orelse is_symid s;
wenzelm@5825
   286
wenzelm@5825
   287
wenzelm@5825
   288
(* scan verbatim text *)
wenzelm@5825
   289
wenzelm@5825
   290
val scan_verb =
wenzelm@27769
   291
  $$$ "*" --| Scan.ahead (~$$$ "}") ||
wenzelm@27769
   292
  Scan.one (fn (s, _) => s <> "*" andalso Symbol.is_regular s) >> single;
wenzelm@5825
   293
wenzelm@5825
   294
val scan_verbatim =
wenzelm@30573
   295
  (Symbol_Pos.scan_pos --| $$$ "{" --| $$$ "*") -- !!! "missing end of verbatim text"
wenzelm@30586
   296
    (Symbol_Pos.change_prompt
wenzelm@30586
   297
      ((Scan.repeat scan_verb >> flat) -- ($$$ "*" |-- $$$ "}" |-- Symbol_Pos.scan_pos)));
wenzelm@5825
   298
wenzelm@5825
   299
wenzelm@5825
   300
(* scan space *)
wenzelm@5825
   301
wenzelm@19305
   302
fun is_space s = Symbol.is_blank s andalso s <> "\n";
wenzelm@5825
   303
wenzelm@5825
   304
val scan_space =
wenzelm@27769
   305
  Scan.many1 (is_space o symbol) @@@ Scan.optional ($$$ "\n") [] ||
wenzelm@27769
   306
  Scan.many (is_space o symbol) @@@ $$$ "\n";
wenzelm@5825
   307
wenzelm@5825
   308
wenzelm@27780
   309
(* scan comment *)
wenzelm@5825
   310
wenzelm@5825
   311
val scan_comment =
wenzelm@30573
   312
  Symbol_Pos.scan_pos -- (Symbol_Pos.scan_comment_body !!! -- Symbol_Pos.scan_pos);
wenzelm@5825
   313
wenzelm@5825
   314
wenzelm@23678
   315
(* scan malformed symbols *)
wenzelm@23678
   316
wenzelm@23678
   317
val scan_malformed =
wenzelm@27769
   318
  $$$ Symbol.malformed |--
wenzelm@30586
   319
    Symbol_Pos.change_prompt (Scan.many (Symbol.is_regular o symbol))
wenzelm@27769
   320
  --| Scan.option ($$$ Symbol.end_malformed);
wenzelm@27752
   321
wenzelm@27752
   322
wenzelm@27663
   323
wenzelm@27769
   324
(** token sources **)
wenzelm@5825
   325
wenzelm@27769
   326
fun source_proper src = src |> Source.filter is_proper;
wenzelm@5825
   327
wenzelm@23678
   328
local
wenzelm@23678
   329
wenzelm@27769
   330
fun token_leq ((_, syms1), (_, syms2)) = length syms1 <= length syms2;
wenzelm@27780
   331
wenzelm@27799
   332
fun token k ss =
wenzelm@30573
   333
  Token ((Symbol_Pos.implode ss, Symbol_Pos.range ss), (k, Symbol_Pos.untabify_content ss), Slot);
wenzelm@27799
   334
wenzelm@27799
   335
fun token_range k (pos1, (ss, pos2)) =
wenzelm@30573
   336
  Token (Symbol_Pos.implode_range pos1 pos2 ss, (k, Symbol_Pos.untabify_content ss), Slot);
wenzelm@23678
   337
wenzelm@27769
   338
fun scan (lex1, lex2) = !!! "bad input"
wenzelm@30586
   339
  (Symbol_Pos.scan_string >> token_range String ||
wenzelm@30586
   340
    Symbol_Pos.scan_alt_string >> token_range AltString ||
wenzelm@27799
   341
    scan_verbatim >> token_range Verbatim ||
wenzelm@27799
   342
    scan_comment >> token_range Comment ||
wenzelm@27780
   343
    scan_space >> token Space ||
wenzelm@27780
   344
    scan_malformed >> token Malformed ||
wenzelm@27780
   345
    Scan.one (Symbol.is_sync o symbol) >> (token Sync o single) ||
wenzelm@27780
   346
    (Scan.max token_leq
wenzelm@27769
   347
      (Scan.max token_leq
wenzelm@27769
   348
        (Scan.literal lex2 >> pair Command)
wenzelm@27769
   349
        (Scan.literal lex1 >> pair Keyword))
wenzelm@27769
   350
      (Syntax.scan_longid >> pair LongIdent ||
wenzelm@27769
   351
        Syntax.scan_id >> pair Ident ||
wenzelm@27769
   352
        Syntax.scan_var >> pair Var ||
wenzelm@27769
   353
        Syntax.scan_tid >> pair TypeIdent ||
wenzelm@27769
   354
        Syntax.scan_tvar >> pair TypeVar ||
wenzelm@27769
   355
        Syntax.scan_nat >> pair Nat ||
wenzelm@27780
   356
        scan_symid >> pair SymIdent) >> uncurry token));
wenzelm@27769
   357
wenzelm@27769
   358
fun recover msg =
wenzelm@27769
   359
  Scan.many ((Symbol.is_regular andf (not o Symbol.is_blank)) o symbol)
wenzelm@27780
   360
  >> (single o token (Error msg));
wenzelm@23678
   361
wenzelm@23678
   362
in
wenzelm@5825
   363
wenzelm@27835
   364
fun source' {do_recover} get_lex =
wenzelm@30573
   365
  Source.source Symbol_Pos.stopper (Scan.bulk (fn xs => scan (get_lex ()) xs))
wenzelm@27780
   366
    (Option.map (rpair recover) do_recover);
wenzelm@27780
   367
wenzelm@5825
   368
fun source do_recover get_lex pos src =
wenzelm@30573
   369
  Symbol_Pos.source pos src
wenzelm@27780
   370
  |> source' do_recover get_lex;
wenzelm@23678
   371
wenzelm@23678
   372
end;
wenzelm@5825
   373
wenzelm@30586
   374
wenzelm@30586
   375
(* read_antiq *)
wenzelm@30586
   376
wenzelm@30586
   377
fun read_antiq lex scan (syms, pos) =
wenzelm@30586
   378
  let
wenzelm@30586
   379
    fun err msg = cat_error msg ("Malformed antiquotation" ^ Position.str_of pos ^ ":\n" ^
wenzelm@30586
   380
      "@{" ^ Symbol_Pos.content syms ^ "}");
wenzelm@30586
   381
wenzelm@30586
   382
    val res =
wenzelm@30586
   383
      Source.of_list syms
wenzelm@30586
   384
      |> source' {do_recover = NONE} (K (lex, Scan.empty_lexicon))
wenzelm@30586
   385
      |> source_proper
wenzelm@30586
   386
      |> Source.source stopper (Scan.error (Scan.bulk scan)) NONE
wenzelm@30586
   387
      |> Source.exhaust;
wenzelm@30586
   388
  in (case res of [x] => x | _ => err "") handle ERROR msg => err msg end;
wenzelm@30586
   389
wenzelm@5825
   390
end;