src/Pure/Isar/outer_syntax.ML
changeset 57918 f5d73caba4e5
parent 57905 c0c5652e796e
child 58850 1bb0ad7827b4
equal deleted inserted replaced
57917:8ce97e5d545f 57918:f5d73caba4e5
    29     (bool -> local_theory -> Proof.state) parser -> unit
    29     (bool -> local_theory -> Proof.state) parser -> unit
    30   val local_theory_to_proof: command_spec -> string ->
    30   val local_theory_to_proof: command_spec -> string ->
    31     (local_theory -> Proof.state) parser -> unit
    31     (local_theory -> Proof.state) parser -> unit
    32   val help_outer_syntax: string list -> unit
    32   val help_outer_syntax: string list -> unit
    33   val print_outer_syntax: unit -> unit
    33   val print_outer_syntax: unit -> unit
    34   val scan: Position.T -> string -> Token.T list
    34   val scan: Scan.lexicon * Scan.lexicon -> Position.T -> string -> Token.T list
    35   val parse: Position.T -> string -> Toplevel.transition list
    35   val parse: (Scan.lexicon * Scan.lexicon) * outer_syntax ->
    36   val parse_tokens: Scan.lexicon * Scan.lexicon -> Position.T -> string -> Token.T list
    36     Position.T -> string -> Toplevel.transition list
    37   val parse_spans: Token.T list -> Command_Span.span list
    37   val parse_spans: Token.T list -> Command_Span.span list
    38   type isar
    38   type isar
    39   val isar: TextIO.instream -> bool -> isar
    39   val isar: TextIO.instream -> bool -> isar
    40   val side_comments: Token.T list -> Token.T list
    40   val side_comments: Token.T list -> Token.T list
    41   val command_reports: outer_syntax -> Token.T -> Position.report_text list
    41   val command_reports: outer_syntax -> Token.T -> Position.report_text list
   256   end;
   256   end;
   257 
   257 
   258 
   258 
   259 (* off-line scanning/parsing *)
   259 (* off-line scanning/parsing *)
   260 
   260 
   261 fun scan pos str =
   261 fun scan lexs pos =
   262   Source.of_string str
       
   263   |> Symbol.source
       
   264   |> Token.source {do_recover = SOME false} Keyword.get_lexicons pos
       
   265   |> Source.exhaust;
       
   266 
       
   267 fun parse pos str =
       
   268   Source.of_string str
       
   269   |> Symbol.source
       
   270   |> Token.source {do_recover = SOME false} Keyword.get_lexicons pos
       
   271   |> toplevel_source false NONE lookup_commands_dynamic
       
   272   |> Source.exhaust;
       
   273 
       
   274 fun parse_tokens lexs pos =
       
   275   Source.of_string #>
   262   Source.of_string #>
   276   Symbol.source #>
   263   Symbol.source #>
   277   Token.source {do_recover = SOME false} (K lexs) pos #>
   264   Token.source {do_recover = SOME false} (K lexs) pos #>
   278   Source.exhaust;
   265   Source.exhaust;
       
   266 
       
   267 fun parse (lexs, syntax) pos str =
       
   268   Source.of_string str
       
   269   |> Symbol.source
       
   270   |> Token.source {do_recover = SOME false} (K lexs) pos
       
   271   |> toplevel_source false NONE (K (lookup_commands syntax))
       
   272   |> Source.exhaust;
   279 
   273 
   280 
   274 
   281 (* parse spans *)
   275 (* parse spans *)
   282 
   276 
   283 local
   277 local