src/Pure/Isar/keyword.scala
changeset 58928 23d0ffd48006
parent 58907 0ee3563803c9
child 58999 ed09ae4ea2d8
equal deleted inserted replaced
58927:cf47382db395 58928:23d0ffd48006
    61   val proof_goal = Set(PRF_GOAL, PRF_ASM_GOAL, PRF_ASM_GOAL_SCRIPT)
    61   val proof_goal = Set(PRF_GOAL, PRF_ASM_GOAL, PRF_ASM_GOAL_SCRIPT)
    62   val qed = Set(QED, QED_SCRIPT, QED_BLOCK)
    62   val qed = Set(QED, QED_SCRIPT, QED_BLOCK)
    63   val qed_global = Set(QED_GLOBAL)
    63   val qed_global = Set(QED_GLOBAL)
    64 
    64 
    65 
    65 
    66   type Spec = ((String, List[String]), List[String])
       
    67 
       
    68 
       
    69 
    66 
    70   /** keyword tables **/
    67   /** keyword tables **/
       
    68 
       
    69   type Spec = ((String, List[String]), List[String])
    71 
    70 
    72   object Keywords
    71   object Keywords
    73   {
    72   {
    74     def empty: Keywords = new Keywords()
    73     def empty: Keywords = new Keywords()
    75   }
    74   }
    97 
    96 
    98     /* add keywords */
    97     /* add keywords */
    99 
    98 
   100     def + (name: String): Keywords = new Keywords(minor + name, major, commands)
    99     def + (name: String): Keywords = new Keywords(minor + name, major, commands)
   101     def + (name: String, kind: String): Keywords = this + (name, (kind, Nil))
   100     def + (name: String, kind: String): Keywords = this + (name, (kind, Nil))
   102     def + (name: String, kind: (String, List[String])): Keywords =
   101     def + (name: String, kind_tags: (String, List[String])): Keywords =
   103     {
   102     {
   104       val major1 = major + name
   103       val major1 = major + name
   105       val commands1 = commands + (name -> kind)
   104       val commands1 = commands + (name -> kind_tags)
   106       new Keywords(minor, major1, commands1)
   105       new Keywords(minor, major1, commands1)
   107     }
   106     }
       
   107 
       
   108     def add_keywords(header: Thy_Header.Keywords): Keywords =
       
   109       (this /: header) {
       
   110         case (keywords, (name, None, _)) =>
       
   111           keywords + Symbol.decode(name) + Symbol.encode(name)
       
   112         case (keywords, (name, Some((kind_tags, _)), _)) =>
       
   113           keywords + (Symbol.decode(name), kind_tags) + (Symbol.encode(name), kind_tags)
       
   114       }
   108 
   115 
   109 
   116 
   110     /* command kind */
   117     /* command kind */
   111 
   118 
   112     def command_kind(name: String): Option[String] = commands.get(name).map(_._1)
   119     def command_kind(name: String): Option[String] = commands.get(name).map(_._1)