src/Pure/Isar/keyword.ML
changeset 54523 11087efad95e
parent 53571 e58ca0311c0f
child 56146 8453d35e4684
equal deleted inserted replaced
54522:761be40990f1 54523:11087efad95e
    49   val spec: spec -> T
    49   val spec: spec -> T
    50   val command_spec: (string * spec) * Position.T -> (string * T) * Position.T
    50   val command_spec: (string * spec) * Position.T -> (string * T) * Position.T
    51   val get_lexicons: unit -> Scan.lexicon * Scan.lexicon
    51   val get_lexicons: unit -> Scan.lexicon * Scan.lexicon
    52   val is_keyword: string -> bool
    52   val is_keyword: string -> bool
    53   val command_keyword: string -> T option
    53   val command_keyword: string -> T option
    54   val command_files: string -> string list
    54   val command_files: string -> Path.T -> Path.T list
    55   val command_tags: string -> string list
    55   val command_tags: string -> string list
    56   val dest: unit -> string list * string list
    56   val dest: unit -> string list * string list
    57   val define: string * T option -> unit
    57   val define: string * T option -> unit
    58   val is_diag: string -> bool
    58   val is_diag: string -> bool
    59   val is_control: string -> bool
    59   val is_control: string -> bool
   194     val (minor, major) = get_lexicons ();
   194     val (minor, major) = get_lexicons ();
   195     val syms = Symbol.explode s;
   195     val syms = Symbol.explode s;
   196   in Scan.is_literal minor syms orelse Scan.is_literal major syms end;
   196   in Scan.is_literal minor syms orelse Scan.is_literal major syms end;
   197 
   197 
   198 fun command_keyword name = Symtab.lookup (get_commands ()) name;
   198 fun command_keyword name = Symtab.lookup (get_commands ()) name;
   199 val command_files = these o Option.map (#2 o kind_files_of) o command_keyword;
   199 
       
   200 fun command_files name path =
       
   201   (case command_keyword name of
       
   202     NONE => []
       
   203   | SOME (Keyword {kind, files, ...}) =>
       
   204       if kind <> kind_of thy_load then []
       
   205       else if null files then [path]
       
   206       else map (fn ext => Path.ext ext path) files);
       
   207 
   200 val command_tags = these o Option.map tags_of o command_keyword;
   208 val command_tags = these o Option.map tags_of o command_keyword;
   201 
   209 
   202 fun dest () = pairself (sort_strings o Scan.dest_lexicon) (get_lexicons ());
   210 fun dest () = pairself (sort_strings o Scan.dest_lexicon) (get_lexicons ());
   203 
   211 
   204 
   212