src/Pure/Thy/thy_syn.ML
author wenzelm
Tue, 19 May 1998 17:15:30 +0200
changeset 4945 d8c809afafb8
parent 3620 ed1416badb41
child 6206 7d2204fcc1e5
permissions -rw-r--r--
fixed handle_error: cat_lines;

(*  Title:      Pure/Thy/thy_syn.ML
    ID:         $Id$
    Author:     Markus Wenzel, TU Muenchen

Syntax for thy files.
*)

signature THY_SYN =
sig
  val add_syntax: string list ->
    (string * (ThyParse.token list -> (string * string) * ThyParse.token list)) list
    -> unit
  val parse: string -> string -> string
end;

structure ThySyn: THY_SYN =
struct

(* current syntax *)

val keywords = ref ThyParse.pure_keywords;
val sections = ref ThyParse.pure_sections;

fun make_syntax () =
  ThyParse.make_syntax (! keywords) (!sections);

val syntax = ref (make_syntax ());


(* augment syntax *)

fun add_syntax keys sects =
 (keywords := (keys union ! keywords);
  sections := sects @ ! sections;
  syntax := make_syntax ());


(* parse *)

fun parse name txt =
  ThyParse.parse_thy (! syntax) name txt;

end;