| author | wenzelm | 
| Wed, 13 Nov 2024 20:10:34 +0100 | |
| changeset 81438 | 95c9af7483b1 | 
| parent 81294 | 108284c8cbfd | 
| child 81558 | b57996a0688c | 
| permissions | -rw-r--r-- | 
| 45670 | 1  | 
/* Title: Pure/PIDE/markup.scala  | 
| 27958 | 2  | 
Author: Makarius  | 
3  | 
||
| 56743 | 4  | 
Quasi-abstract markup elements.  | 
| 27958 | 5  | 
*/  | 
6  | 
||
7  | 
package isabelle  | 
|
8  | 
||
| 27970 | 9  | 
|
| 75393 | 10  | 
object Markup {
 | 
| 56743 | 11  | 
/* elements */  | 
12  | 
||
| 75393 | 13  | 
  object Elements {
 | 
| 56743 | 14  | 
def apply(elems: Set[String]): Elements = new Elements(elems)  | 
15  | 
def apply(elems: String*): Elements = apply(Set(elems: _*))  | 
|
16  | 
val empty: Elements = apply()  | 
|
17  | 
val full: Elements =  | 
|
| 75393 | 18  | 
      new Elements(Set.empty) {
 | 
| 56743 | 19  | 
override def apply(elem: String): Boolean = true  | 
20  | 
override def toString: String = "Elements.full"  | 
|
21  | 
}  | 
|
22  | 
}  | 
|
23  | 
||
| 75393 | 24  | 
  sealed class Elements private[Markup](private val rep: Set[String]) {
 | 
| 56743 | 25  | 
def apply(elem: String): Boolean = rep.contains(elem)  | 
26  | 
def + (elem: String): Elements = new Elements(rep + elem)  | 
|
27  | 
def ++ (elems: Elements): Elements = new Elements(rep ++ elems.rep)  | 
|
| 65176 | 28  | 
def - (elem: String): Elements = new Elements(rep - elem)  | 
29  | 
def -- (elems: Elements): Elements = new Elements(rep -- elems.rep)  | 
|
| 56743 | 30  | 
    override def toString: String = rep.mkString("Elements(", ",", ")")
 | 
31  | 
}  | 
|
32  | 
||
33  | 
||
| 45666 | 34  | 
/* properties */  | 
| 29184 | 35  | 
|
36  | 
val NAME = "name"  | 
|
| 43780 | 37  | 
val Name = new Properties.String(NAME)  | 
| 42136 | 38  | 
|
| 68997 | 39  | 
val XNAME = "xname"  | 
40  | 
val XName = new Properties.String(XNAME)  | 
|
41  | 
||
| 29184 | 42  | 
val KIND = "kind"  | 
| 43780 | 43  | 
val Kind = new Properties.String(KIND)  | 
| 29184 | 44  | 
|
| 65937 | 45  | 
val CONTENT = "content"  | 
46  | 
val Content = new Properties.String(CONTENT)  | 
|
47  | 
||
| 60744 | 48  | 
val SERIAL = "serial"  | 
49  | 
val Serial = new Properties.Long(SERIAL)  | 
|
50  | 
||
| 
52854
 
92932931bd82
more general Output.result: allow to update arbitrary properties;
 
wenzelm 
parents: 
52800 
diff
changeset
 | 
51  | 
val INSTANCE = "instance"  | 
| 
 
92932931bd82
more general Output.result: allow to update arbitrary properties;
 
wenzelm 
parents: 
52800 
diff
changeset
 | 
52  | 
val Instance = new Properties.String(INSTANCE)  | 
| 
 
92932931bd82
more general Output.result: allow to update arbitrary properties;
 
wenzelm 
parents: 
52800 
diff
changeset
 | 
53  | 
|
| 29184 | 54  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
55  | 
/* basic markup */  | 
| 29184 | 56  | 
|
| 71601 | 57  | 
  val Empty: Markup = Markup("", Nil)
 | 
58  | 
  val Broken: Markup = Markup("broken", Nil)
 | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
59  | 
|
| 75393 | 60  | 
  class Markup_Elem(val name: String) {
 | 
| 74783 | 61  | 
def apply(props: Properties.T = Nil): Markup = Markup(name, props)  | 
62  | 
def unapply(markup: Markup): Option[Properties.T] =  | 
|
63  | 
if (markup.name == name) Some(markup.properties) else None  | 
|
64  | 
}  | 
|
65  | 
||
| 75393 | 66  | 
  class Markup_String(val name: String, prop: String) {
 | 
| 74782 | 67  | 
val Prop: Properties.String = new Properties.String(prop)  | 
| 55551 | 68  | 
|
69  | 
def apply(s: String): Markup = Markup(name, Prop(s))  | 
|
70  | 
def unapply(markup: Markup): Option[String] =  | 
|
71  | 
if (markup.name == name) Prop.unapply(markup.properties) else None  | 
|
| 74782 | 72  | 
    def get(markup: Markup): String = unapply(markup).getOrElse("")
 | 
| 55551 | 73  | 
}  | 
74  | 
||
| 75393 | 75  | 
  class Markup_Int(val name: String, prop: String) {
 | 
| 74782 | 76  | 
val Prop: Properties.Int = new Properties.Int(prop)  | 
| 55551 | 77  | 
|
78  | 
def apply(i: Int): Markup = Markup(name, Prop(i))  | 
|
79  | 
def unapply(markup: Markup): Option[Int] =  | 
|
80  | 
if (markup.name == name) Prop.unapply(markup.properties) else None  | 
|
| 74782 | 81  | 
def get(markup: Markup): Int = unapply(markup).getOrElse(0)  | 
| 55551 | 82  | 
}  | 
83  | 
||
| 75393 | 84  | 
  class Markup_Long(val name: String, prop: String) {
 | 
| 74782 | 85  | 
val Prop: Properties.Long = new Properties.Long(prop)  | 
| 60744 | 86  | 
|
87  | 
def apply(i: Long): Markup = Markup(name, Prop(i))  | 
|
88  | 
def unapply(markup: Markup): Option[Long] =  | 
|
89  | 
if (markup.name == name) Prop.unapply(markup.properties) else None  | 
|
| 74782 | 90  | 
def get(markup: Markup): Long = unapply(markup).getOrElse(0)  | 
| 60744 | 91  | 
}  | 
92  | 
||
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
93  | 
|
| 
69889
 
be04e9a053a7
markup and document markers for some meta data from "Dublin Core Metadata Element Set";
 
wenzelm 
parents: 
69788 
diff
changeset
 | 
94  | 
/* meta data */  | 
| 
 
be04e9a053a7
markup and document markers for some meta data from "Dublin Core Metadata Element Set";
 
wenzelm 
parents: 
69788 
diff
changeset
 | 
95  | 
|
| 
 
be04e9a053a7
markup and document markers for some meta data from "Dublin Core Metadata Element Set";
 
wenzelm 
parents: 
69788 
diff
changeset
 | 
96  | 
val META_TITLE = "meta_title"  | 
| 
 
be04e9a053a7
markup and document markers for some meta data from "Dublin Core Metadata Element Set";
 
wenzelm 
parents: 
69788 
diff
changeset
 | 
97  | 
val META_CREATOR = "meta_creator"  | 
| 
 
be04e9a053a7
markup and document markers for some meta data from "Dublin Core Metadata Element Set";
 
wenzelm 
parents: 
69788 
diff
changeset
 | 
98  | 
val META_CONTRIBUTOR = "meta_contributor"  | 
| 
 
be04e9a053a7
markup and document markers for some meta data from "Dublin Core Metadata Element Set";
 
wenzelm 
parents: 
69788 
diff
changeset
 | 
99  | 
val META_DATE = "meta_date"  | 
| 
69962
 
82e945d472d5
documentation of document markers and re-interpreted command tags;
 
wenzelm 
parents: 
69916 
diff
changeset
 | 
100  | 
val META_LICENSE = "meta_license"  | 
| 
69889
 
be04e9a053a7
markup and document markers for some meta data from "Dublin Core Metadata Element Set";
 
wenzelm 
parents: 
69788 
diff
changeset
 | 
101  | 
val META_DESCRIPTION = "meta_description"  | 
| 
 
be04e9a053a7
markup and document markers for some meta data from "Dublin Core Metadata Element Set";
 
wenzelm 
parents: 
69788 
diff
changeset
 | 
102  | 
|
| 
 
be04e9a053a7
markup and document markers for some meta data from "Dublin Core Metadata Element Set";
 
wenzelm 
parents: 
69788 
diff
changeset
 | 
103  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
104  | 
/* formal entities */  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
105  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
106  | 
val BINDING = "binding"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
107  | 
val ENTITY = "entity"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
108  | 
|
| 75393 | 109  | 
  object Entity {
 | 
| 74782 | 110  | 
val Def = new Markup_Long(ENTITY, "def")  | 
111  | 
val Ref = new Markup_Long(ENTITY, "ref")  | 
|
112  | 
||
| 75393 | 113  | 
    object Occ {
 | 
| 72903 | 114  | 
def unapply(markup: Markup): Option[Long] =  | 
115  | 
Def.unapply(markup) orElse Ref.unapply(markup)  | 
|
116  | 
}  | 
|
117  | 
||
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
118  | 
def unapply(markup: Markup): Option[(String, String)] =  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
119  | 
      markup match {
 | 
| 74782 | 120  | 
case Markup(ENTITY, props) => Some((Kind.get(props), Name.get(props)))  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
121  | 
case _ => None  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
122  | 
}  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
123  | 
}  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
124  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
125  | 
|
| 
55672
 
5e25cc741ab9
support for completion within the formal context;
 
wenzelm 
parents: 
55666 
diff
changeset
 | 
126  | 
/* completion */  | 
| 
 
5e25cc741ab9
support for completion within the formal context;
 
wenzelm 
parents: 
55666 
diff
changeset
 | 
127  | 
|
| 
 
5e25cc741ab9
support for completion within the formal context;
 
wenzelm 
parents: 
55666 
diff
changeset
 | 
128  | 
val COMPLETION = "completion"  | 
| 
55914
 
c5b752d549e3
clarified init_assignable: make double-sure that initial values are reset;
 
wenzelm 
parents: 
55837 
diff
changeset
 | 
129  | 
val NO_COMPLETION = "no_completion"  | 
| 
55672
 
5e25cc741ab9
support for completion within the formal context;
 
wenzelm 
parents: 
55666 
diff
changeset
 | 
130  | 
|
| 69557 | 131  | 
val UPDATE = "update"  | 
132  | 
||
| 
55672
 
5e25cc741ab9
support for completion within the formal context;
 
wenzelm 
parents: 
55666 
diff
changeset
 | 
133  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
134  | 
/* position */  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
135  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
136  | 
val LINE = "line"  | 
| 
58978
 
e42da880c61e
more position information, e.g. relevant for errors in generated ML source;
 
wenzelm 
parents: 
58853 
diff
changeset
 | 
137  | 
val END_LINE = "line"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
138  | 
val OFFSET = "offset"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
139  | 
val END_OFFSET = "end_offset"  | 
| 78021 | 140  | 
val LABEL = "label"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
141  | 
val FILE = "file"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
142  | 
val ID = "id"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
143  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
144  | 
val DEF_LINE = "def_line"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
145  | 
val DEF_OFFSET = "def_offset"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
146  | 
val DEF_END_OFFSET = "def_end_offset"  | 
| 78021 | 147  | 
val DEF_LABEL = "def_label"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
148  | 
val DEF_FILE = "def_file"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
149  | 
val DEF_ID = "def_id"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
150  | 
|
| 74182 | 151  | 
val POSITION = "position"  | 
152  | 
||
| 78021 | 153  | 
val POSITION_PROPERTIES = Set(LINE, OFFSET, END_OFFSET, LABEL, FILE, ID)  | 
| 72708 | 154  | 
def position_property(entry: Properties.Entry): Boolean = POSITION_PROPERTIES(entry._1)  | 
155  | 
||
| 74182 | 156  | 
|
157  | 
/* position "def" name */  | 
|
158  | 
||
159  | 
private val def_names: Map[String, String] =  | 
|
160  | 
Map(LINE -> DEF_LINE, OFFSET -> DEF_OFFSET, END_OFFSET -> DEF_END_OFFSET,  | 
|
| 78021 | 161  | 
LABEL -> DEF_LABEL, FILE -> DEF_FILE, ID -> DEF_ID)  | 
| 74182 | 162  | 
|
163  | 
def def_name(a: String): String = def_names.getOrElse(a, a + "def_")  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
164  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
165  | 
|
| 
80911
 
8ad5e6df050b
block markup for specific notation, notably infix and binder;
 
wenzelm 
parents: 
80017 
diff
changeset
 | 
166  | 
/* notation */  | 
| 
 
8ad5e6df050b
block markup for specific notation, notably infix and binder;
 
wenzelm 
parents: 
80017 
diff
changeset
 | 
167  | 
|
| 
 
8ad5e6df050b
block markup for specific notation, notably infix and binder;
 
wenzelm 
parents: 
80017 
diff
changeset
 | 
168  | 
val NOTATION = "notation"  | 
| 
 
8ad5e6df050b
block markup for specific notation, notably infix and binder;
 
wenzelm 
parents: 
80017 
diff
changeset
 | 
169  | 
  object Notation {
 | 
| 
 
8ad5e6df050b
block markup for specific notation, notably infix and binder;
 
wenzelm 
parents: 
80017 
diff
changeset
 | 
170  | 
def unapply(markup: Markup): Option[(String, String)] =  | 
| 
 
8ad5e6df050b
block markup for specific notation, notably infix and binder;
 
wenzelm 
parents: 
80017 
diff
changeset
 | 
171  | 
      markup match {
 | 
| 
 
8ad5e6df050b
block markup for specific notation, notably infix and binder;
 
wenzelm 
parents: 
80017 
diff
changeset
 | 
172  | 
case Markup(NOTATION, props) => Some((Kind.get(props), Name.get(props)))  | 
| 
 
8ad5e6df050b
block markup for specific notation, notably infix and binder;
 
wenzelm 
parents: 
80017 
diff
changeset
 | 
173  | 
case _ => None  | 
| 
 
8ad5e6df050b
block markup for specific notation, notably infix and binder;
 
wenzelm 
parents: 
80017 
diff
changeset
 | 
174  | 
}  | 
| 
 
8ad5e6df050b
block markup for specific notation, notably infix and binder;
 
wenzelm 
parents: 
80017 
diff
changeset
 | 
175  | 
}  | 
| 
 
8ad5e6df050b
block markup for specific notation, notably infix and binder;
 
wenzelm 
parents: 
80017 
diff
changeset
 | 
176  | 
|
| 
 
8ad5e6df050b
block markup for specific notation, notably infix and binder;
 
wenzelm 
parents: 
80017 
diff
changeset
 | 
177  | 
|
| 58464 | 178  | 
/* expression */  | 
179  | 
||
180  | 
val EXPRESSION = "expression"  | 
|
| 75393 | 181  | 
  object Expression {
 | 
| 62806 | 182  | 
def unapply(markup: Markup): Option[String] =  | 
183  | 
      markup match {
 | 
|
| 74782 | 184  | 
case Markup(EXPRESSION, props) => Some(Kind.get(props))  | 
| 62806 | 185  | 
case _ => None  | 
186  | 
}  | 
|
| 
80941
 
fd7a70babec1
more markup <expression kind="item"> in Isabelle/Scala, with pro-forma Markup_Kind.setup in Isabelle/ML;
 
wenzelm 
parents: 
80911 
diff
changeset
 | 
187  | 
|
| 
 
fd7a70babec1
more markup <expression kind="item"> in Isabelle/Scala, with pro-forma Markup_Kind.setup in Isabelle/ML;
 
wenzelm 
parents: 
80911 
diff
changeset
 | 
188  | 
val item: Markup = Markup(EXPRESSION, Kind(ITEM))  | 
| 62806 | 189  | 
}  | 
| 58464 | 190  | 
|
191  | 
||
| 
58544
 
340f130b3d38
bibtex support in ML: document antiquotation @{cite} with markup;
 
wenzelm 
parents: 
58464 
diff
changeset
 | 
192  | 
/* citation */  | 
| 
 
340f130b3d38
bibtex support in ML: document antiquotation @{cite} with markup;
 
wenzelm 
parents: 
58464 
diff
changeset
 | 
193  | 
|
| 
 
340f130b3d38
bibtex support in ML: document antiquotation @{cite} with markup;
 
wenzelm 
parents: 
58464 
diff
changeset
 | 
194  | 
val CITATION = "citation"  | 
| 
58545
 
30b75b7958d6
citation tooltip/hyperlink based on open buffers with .bib files;
 
wenzelm 
parents: 
58544 
diff
changeset
 | 
195  | 
val Citation = new Markup_String(CITATION, NAME)  | 
| 
58544
 
340f130b3d38
bibtex support in ML: document antiquotation @{cite} with markup;
 
wenzelm 
parents: 
58464 
diff
changeset
 | 
196  | 
|
| 
 
340f130b3d38
bibtex support in ML: document antiquotation @{cite} with markup;
 
wenzelm 
parents: 
58464 
diff
changeset
 | 
197  | 
|
| 55550 | 198  | 
/* embedded languages */  | 
199  | 
||
| 55666 | 200  | 
  val Symbols = new Properties.Boolean("symbols")
 | 
201  | 
  val Antiquotes = new Properties.Boolean("antiquotes")
 | 
|
| 
55828
 
42ac3cfb89f6
clarified language markup: added "delimited" property;
 
wenzelm 
parents: 
55765 
diff
changeset
 | 
202  | 
  val Delimited = new Properties.Boolean("delimited")
 | 
| 
55615
 
bf4bbe72f740
completion of keywords and symbols based on language context;
 
wenzelm 
parents: 
55553 
diff
changeset
 | 
203  | 
|
| 55550 | 204  | 
val LANGUAGE = "language"  | 
| 75393 | 205  | 
  object Language {
 | 
| 67336 | 206  | 
val DOCUMENT = "document"  | 
| 76976 | 207  | 
val ANTIQUOTATION = "antiquotation"  | 
| 55616 | 208  | 
val ML = "ML"  | 
| 
56278
 
2576d3a40ed6
separate tokenization and language context for SML: no symbols, no antiquotes;
 
wenzelm 
parents: 
56202 
diff
changeset
 | 
209  | 
val SML = "SML"  | 
| 
56843
 
b2bfcd8cda80
support for path completion based on file-system content;
 
wenzelm 
parents: 
56743 
diff
changeset
 | 
210  | 
val PATH = "path"  | 
| 55616 | 211  | 
val UNKNOWN = "unknown"  | 
212  | 
||
| 76967 | 213  | 
def apply(name: String, symbols: Boolean, antiquotes: Boolean, delimited: Boolean): Language =  | 
214  | 
new Language(name, symbols, antiquotes, delimited)  | 
|
| 76965 | 215  | 
|
| 76967 | 216  | 
    val outer: Language = apply("", true, false, false)
 | 
| 76966 | 217  | 
|
| 76967 | 218  | 
def unapply(markup: Markup): Option[Language] =  | 
| 
55615
 
bf4bbe72f740
completion of keywords and symbols based on language context;
 
wenzelm 
parents: 
55553 
diff
changeset
 | 
219  | 
      markup match {
 | 
| 
 
bf4bbe72f740
completion of keywords and symbols based on language context;
 
wenzelm 
parents: 
55553 
diff
changeset
 | 
220  | 
case Markup(LANGUAGE, props) =>  | 
| 
55828
 
42ac3cfb89f6
clarified language markup: added "delimited" property;
 
wenzelm 
parents: 
55765 
diff
changeset
 | 
221  | 
          (props, props, props, props) match {
 | 
| 
 
42ac3cfb89f6
clarified language markup: added "delimited" property;
 
wenzelm 
parents: 
55765 
diff
changeset
 | 
222  | 
case (Name(name), Symbols(symbols), Antiquotes(antiquotes), Delimited(delimited)) =>  | 
| 76967 | 223  | 
Some(apply(name, symbols, antiquotes, delimited))  | 
| 
55615
 
bf4bbe72f740
completion of keywords and symbols based on language context;
 
wenzelm 
parents: 
55553 
diff
changeset
 | 
224  | 
case _ => None  | 
| 
 
bf4bbe72f740
completion of keywords and symbols based on language context;
 
wenzelm 
parents: 
55553 
diff
changeset
 | 
225  | 
}  | 
| 
 
bf4bbe72f740
completion of keywords and symbols based on language context;
 
wenzelm 
parents: 
55553 
diff
changeset
 | 
226  | 
case _ => None  | 
| 
 
bf4bbe72f740
completion of keywords and symbols based on language context;
 
wenzelm 
parents: 
55553 
diff
changeset
 | 
227  | 
}  | 
| 
 
bf4bbe72f740
completion of keywords and symbols based on language context;
 
wenzelm 
parents: 
55553 
diff
changeset
 | 
228  | 
}  | 
| 76967 | 229  | 
class Language private(  | 
230  | 
val name: String,  | 
|
231  | 
val symbols: Boolean,  | 
|
232  | 
val antiquotes: Boolean,  | 
|
233  | 
val delimited: Boolean  | 
|
234  | 
  ) {
 | 
|
235  | 
override def toString: String = name  | 
|
236  | 
||
| 76971 | 237  | 
def is_document: Boolean = name == Language.DOCUMENT  | 
| 76976 | 238  | 
def is_antiquotation: Boolean = name == Language.ANTIQUOTATION  | 
| 76971 | 239  | 
def is_path: Boolean = name == Language.PATH  | 
240  | 
||
| 76967 | 241  | 
    def description: String = Word.implode(Word.explode('_', name))
 | 
242  | 
}  | 
|
| 55550 | 243  | 
|
244  | 
||
| 
54702
 
3daeba5130f0
added document antiquotation @{url}, which produces formal markup for LaTeX and PIDE;
 
wenzelm 
parents: 
53378 
diff
changeset
 | 
245  | 
/* external resources */  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
246  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
247  | 
val PATH = "path"  | 
| 55551 | 248  | 
val Path = new Markup_String(PATH, NAME)  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
249  | 
|
| 70016 | 250  | 
val EXPORT_PATH = "export_path"  | 
251  | 
val Export_Path = new Markup_String(EXPORT_PATH, NAME)  | 
|
252  | 
||
| 
54702
 
3daeba5130f0
added document antiquotation @{url}, which produces formal markup for LaTeX and PIDE;
 
wenzelm 
parents: 
53378 
diff
changeset
 | 
253  | 
val URL = "url"  | 
| 55551 | 254  | 
val Url = new Markup_String(URL, NAME)  | 
| 
54702
 
3daeba5130f0
added document antiquotation @{url}, which produces formal markup for LaTeX and PIDE;
 
wenzelm 
parents: 
53378 
diff
changeset
 | 
255  | 
|
| 
61660
 
78b371644654
added antiquotation @{doc}, e.g. useful for demonstration purposes;
 
wenzelm 
parents: 
61598 
diff
changeset
 | 
256  | 
val DOC = "doc"  | 
| 
 
78b371644654
added antiquotation @{doc}, e.g. useful for demonstration purposes;
 
wenzelm 
parents: 
61598 
diff
changeset
 | 
257  | 
val Doc = new Markup_String(DOC, NAME)  | 
| 
 
78b371644654
added antiquotation @{doc}, e.g. useful for demonstration purposes;
 
wenzelm 
parents: 
61598 
diff
changeset
 | 
258  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
259  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
260  | 
/* pretty printing */  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
261  | 
|
| 61864 | 262  | 
  val Consistent = new Properties.Boolean("consistent")
 | 
| 
61862
 
e2a9e46ac0fb
support pretty break indent, like underlying ML systems;
 
wenzelm 
parents: 
61660 
diff
changeset
 | 
263  | 
  val Indent = new Properties.Int("indent")
 | 
| 61864 | 264  | 
  val Width = new Properties.Int("width")
 | 
| 
61862
 
e2a9e46ac0fb
support pretty break indent, like underlying ML systems;
 
wenzelm 
parents: 
61660 
diff
changeset
 | 
265  | 
|
| 75393 | 266  | 
  object Block {
 | 
| 61864 | 267  | 
val name = "block"  | 
| 
81294
 
108284c8cbfd
removed obsolete markup for "open_block" (see also d5ad89fda714): Isabelle/Scala directly supports XML.Elem pretty-printing;
 
wenzelm 
parents: 
81121 
diff
changeset
 | 
268  | 
def apply(consistent: Boolean = false, indent: Int = 0): Markup =  | 
| 61864 | 269  | 
Markup(name,  | 
| 81120 | 270  | 
(if (consistent) Consistent(consistent) else Nil) :::  | 
271  | 
(if (indent != 0) Indent(indent) else Nil))  | 
|
| 
81294
 
108284c8cbfd
removed obsolete markup for "open_block" (see also d5ad89fda714): Isabelle/Scala directly supports XML.Elem pretty-printing;
 
wenzelm 
parents: 
81121 
diff
changeset
 | 
272  | 
def unapply(markup: Markup): Option[(Boolean, Int)] =  | 
| 61864 | 273  | 
      if (markup.name == name) {
 | 
| 81120 | 274  | 
val consistent = Consistent.get(markup.properties)  | 
275  | 
val indent = Indent.get(markup.properties)  | 
|
| 
81294
 
108284c8cbfd
removed obsolete markup for "open_block" (see also d5ad89fda714): Isabelle/Scala directly supports XML.Elem pretty-printing;
 
wenzelm 
parents: 
81121 
diff
changeset
 | 
276  | 
Some((consistent, indent))  | 
| 61864 | 277  | 
}  | 
278  | 
else None  | 
|
279  | 
}  | 
|
280  | 
||
| 75393 | 281  | 
  object Break {
 | 
| 
61862
 
e2a9e46ac0fb
support pretty break indent, like underlying ML systems;
 
wenzelm 
parents: 
61660 
diff
changeset
 | 
282  | 
val name = "break"  | 
| 81120 | 283  | 
def apply(width: Int = 0, indent: Int = 0): Markup =  | 
| 61864 | 284  | 
Markup(name,  | 
| 81120 | 285  | 
(if (width != 0) Width(width) else Nil) :::  | 
286  | 
(if (indent != 0) Indent(indent) else Nil))  | 
|
| 
61862
 
e2a9e46ac0fb
support pretty break indent, like underlying ML systems;
 
wenzelm 
parents: 
61660 
diff
changeset
 | 
287  | 
def unapply(markup: Markup): Option[(Int, Int)] =  | 
| 
 
e2a9e46ac0fb
support pretty break indent, like underlying ML systems;
 
wenzelm 
parents: 
61660 
diff
changeset
 | 
288  | 
      if (markup.name == name) {
 | 
| 81120 | 289  | 
val width = Width.get(markup.properties)  | 
290  | 
val indent = Indent.get(markup.properties)  | 
|
291  | 
Some((width, indent))  | 
|
| 
61862
 
e2a9e46ac0fb
support pretty break indent, like underlying ML systems;
 
wenzelm 
parents: 
61660 
diff
changeset
 | 
292  | 
}  | 
| 
 
e2a9e46ac0fb
support pretty break indent, like underlying ML systems;
 
wenzelm 
parents: 
61660 
diff
changeset
 | 
293  | 
else None  | 
| 
 
e2a9e46ac0fb
support pretty break indent, like underlying ML systems;
 
wenzelm 
parents: 
61660 
diff
changeset
 | 
294  | 
}  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
295  | 
|
| 
51570
 
3633828d80fc
basic support for Pretty.item, which is considered as logical markup and interpreted in Isabelle/Scala, but ignored elsewhere (TTY, latex etc.);
 
wenzelm 
parents: 
50975 
diff
changeset
 | 
296  | 
val ITEM = "item"  | 
| 
51574
 
2b58d7b139d6
ghost bullet via markup, which is painted as bar under text (normally space);
 
wenzelm 
parents: 
51570 
diff
changeset
 | 
297  | 
val BULLET = "bullet"  | 
| 
51570
 
3633828d80fc
basic support for Pretty.item, which is considered as logical markup and interpreted in Isabelle/Scala, but ignored elsewhere (TTY, latex etc.);
 
wenzelm 
parents: 
50975 
diff
changeset
 | 
298  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
299  | 
val SEPARATOR = "separator"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
300  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
301  | 
|
| 56548 | 302  | 
/* text properties */  | 
303  | 
||
304  | 
val WORDS = "words"  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
305  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
306  | 
val HIDDEN = "hidden"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
307  | 
|
| 
68298
 
2c3ce27cf4a8
markup for deleted fragments of token source (NB: quoted tokens transform "\123" implicitly);
 
wenzelm 
parents: 
68148 
diff
changeset
 | 
308  | 
val DELETE = "delete"  | 
| 
 
2c3ce27cf4a8
markup for deleted fragments of token source (NB: quoted tokens transform "\123" implicitly);
 
wenzelm 
parents: 
68148 
diff
changeset
 | 
309  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
310  | 
|
| 
58048
 
aa6296d09e0e
more explicit Method.modifier with reported position;
 
wenzelm 
parents: 
57595 
diff
changeset
 | 
311  | 
/* misc entities */  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
312  | 
|
| 74112 | 313  | 
val SESSION = "session"  | 
314  | 
||
| 72781 | 315  | 
val THEORY = "theory"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
316  | 
val CLASS = "class"  | 
| 74112 | 317  | 
val LOCALE = "locale"  | 
| 
74261
 
d28a51dd9da6
export other entities, e.g. relevant for formal document output;
 
wenzelm 
parents: 
74182 
diff
changeset
 | 
318  | 
val BUNDLE = "bundle"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
319  | 
val TYPE_NAME = "type_name"  | 
| 74112 | 320  | 
val CONSTANT = "constant"  | 
321  | 
val AXIOM = "axiom"  | 
|
322  | 
val FACT = "fact"  | 
|
323  | 
val ORACLE = "oracle"  | 
|
324  | 
||
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
325  | 
val FIXED = "fixed"  | 
| 
53378
 
07990ba8c0ea
cases: more position information and PIDE markup;
 
wenzelm 
parents: 
53055 
diff
changeset
 | 
326  | 
val CASE = "case"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
327  | 
val DYNAMIC_FACT = "dynamic_fact"  | 
| 74112 | 328  | 
val LITERAL_FACT = "literal_fact"  | 
329  | 
||
330  | 
val ATTRIBUTE = "attribute"  | 
|
331  | 
val METHOD = "method"  | 
|
332  | 
val METHOD_MODIFIER = "method_modifier"  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
333  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
334  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
335  | 
/* inner syntax */  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
336  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
337  | 
val TFREE = "tfree"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
338  | 
val TVAR = "tvar"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
339  | 
val FREE = "free"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
340  | 
val SKOLEM = "skolem"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
341  | 
val BOUND = "bound"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
342  | 
val VAR = "var"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
343  | 
val NUMERAL = "numeral"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
344  | 
val LITERAL = "literal"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
345  | 
val DELIMITER = "delimiter"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
346  | 
val INNER_STRING = "inner_string"  | 
| 55033 | 347  | 
val INNER_CARTOUCHE = "inner_cartouche"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
348  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
349  | 
val TOKEN_RANGE = "token_range"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
350  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
351  | 
val SORTING = "sorting"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
352  | 
val TYPING = "typing"  | 
| 63347 | 353  | 
val CLASS_PARAMETER = "class_parameter"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
354  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
355  | 
|
| 55550 | 356  | 
/* antiquotations */  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
357  | 
|
| 55526 | 358  | 
val ANTIQUOTED = "antiquoted"  | 
359  | 
val ANTIQUOTE = "antiquote"  | 
|
360  | 
||
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
361  | 
val ML_ANTIQUOTATION = "ML_antiquotation"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
362  | 
val DOCUMENT_ANTIQUOTATION = "document_antiquotation"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
363  | 
val DOCUMENT_ANTIQUOTATION_OPTION = "document_antiquotation_option"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
364  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
365  | 
|
| 
70135
 
ad6d4a14adb5
report document tags as seen in the text (not the active tag of Thy_Output.present_thy);
 
wenzelm 
parents: 
70016 
diff
changeset
 | 
366  | 
/* document text */  | 
| 
69965
 
da5e7278286b
more markup for various text kinds, notably for nested formal comments;
 
wenzelm 
parents: 
69962 
diff
changeset
 | 
367  | 
|
| 
 
da5e7278286b
more markup for various text kinds, notably for nested formal comments;
 
wenzelm 
parents: 
69962 
diff
changeset
 | 
368  | 
val RAW_TEXT = "raw_text"  | 
| 
 
da5e7278286b
more markup for various text kinds, notably for nested formal comments;
 
wenzelm 
parents: 
69962 
diff
changeset
 | 
369  | 
val PLAIN_TEXT = "plain_text"  | 
| 
 
da5e7278286b
more markup for various text kinds, notably for nested formal comments;
 
wenzelm 
parents: 
69962 
diff
changeset
 | 
370  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
371  | 
val PARAGRAPH = "paragraph"  | 
| 
50545
 
00bdc48c5f71
explicit text_fold markup, which is used by default in Pretty.chunks/chunks2;
 
wenzelm 
parents: 
50543 
diff
changeset
 | 
372  | 
val TEXT_FOLD = "text_fold"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
373  | 
|
| 75393 | 374  | 
  object Document_Tag extends Markup_String("document_tag", NAME) {
 | 
| 
70135
 
ad6d4a14adb5
report document tags as seen in the text (not the active tag of Thy_Output.present_thy);
 
wenzelm 
parents: 
70016 
diff
changeset
 | 
375  | 
val IMPORTANT = "important"  | 
| 
 
ad6d4a14adb5
report document tags as seen in the text (not the active tag of Thy_Output.present_thy);
 
wenzelm 
parents: 
70016 
diff
changeset
 | 
376  | 
val UNIMPORTANT = "unimportant"  | 
| 
 
ad6d4a14adb5
report document tags as seen in the text (not the active tag of Thy_Output.present_thy);
 
wenzelm 
parents: 
70016 
diff
changeset
 | 
377  | 
}  | 
| 
 
ad6d4a14adb5
report document tags as seen in the text (not the active tag of Thy_Output.present_thy);
 
wenzelm 
parents: 
70016 
diff
changeset
 | 
378  | 
|
| 
74784
 
d2522bb4db1b
symbolic latex_output via XML, interpreted in Isabelle/Scala;
 
wenzelm 
parents: 
74783 
diff
changeset
 | 
379  | 
|
| 
80017
 
fb96063456fd
more robust: untyped/unscoped markup elements need to reside in module Markup for minimal static checking (see also 11a1f4d7af51);
 
wenzelm 
parents: 
78279 
diff
changeset
 | 
380  | 
/* HTML */  | 
| 
 
fb96063456fd
more robust: untyped/unscoped markup elements need to reside in module Markup for minimal static checking (see also 11a1f4d7af51);
 
wenzelm 
parents: 
78279 
diff
changeset
 | 
381  | 
|
| 
 
fb96063456fd
more robust: untyped/unscoped markup elements need to reside in module Markup for minimal static checking (see also 11a1f4d7af51);
 
wenzelm 
parents: 
78279 
diff
changeset
 | 
382  | 
val RAW_HTML = "raw_html"  | 
| 
 
fb96063456fd
more robust: untyped/unscoped markup elements need to reside in module Markup for minimal static checking (see also 11a1f4d7af51);
 
wenzelm 
parents: 
78279 
diff
changeset
 | 
383  | 
|
| 
 
fb96063456fd
more robust: untyped/unscoped markup elements need to reside in module Markup for minimal static checking (see also 11a1f4d7af51);
 
wenzelm 
parents: 
78279 
diff
changeset
 | 
384  | 
|
| 
74784
 
d2522bb4db1b
symbolic latex_output via XML, interpreted in Isabelle/Scala;
 
wenzelm 
parents: 
74783 
diff
changeset
 | 
385  | 
/* LaTeX */  | 
| 
 
d2522bb4db1b
symbolic latex_output via XML, interpreted in Isabelle/Scala;
 
wenzelm 
parents: 
74783 
diff
changeset
 | 
386  | 
|
| 74783 | 387  | 
  val Document_Latex = new Markup_Elem("document_latex")
 | 
| 
73780
 
466fae6bf22e
compose Latex text as XML, output exported YXML in Isabelle/Scala;
 
wenzelm 
parents: 
73556 
diff
changeset
 | 
388  | 
|
| 
74784
 
d2522bb4db1b
symbolic latex_output via XML, interpreted in Isabelle/Scala;
 
wenzelm 
parents: 
74783 
diff
changeset
 | 
389  | 
  val Latex_Output = new Markup_Elem("latex_output")
 | 
| 74790 | 390  | 
  val Latex_Macro0 = new Markup_String("latex_macro0", NAME)
 | 
391  | 
  val Latex_Macro = new Markup_String("latex_macro", NAME)
 | 
|
392  | 
  val Latex_Environment = new Markup_String("latex_environment", NAME)
 | 
|
| 74823 | 393  | 
  val Latex_Heading = new Markup_String("latex_heading", KIND)
 | 
394  | 
  val Latex_Body = new Markup_String("latex_body", KIND)
 | 
|
| 
74826
 
0e4d8aa61ad7
more symbolic latex_output via XML (using YXML within text);
 
wenzelm 
parents: 
74823 
diff
changeset
 | 
395  | 
  val Latex_Delim = new Markup_String("latex_delim", NAME)
 | 
| 
 
0e4d8aa61ad7
more symbolic latex_output via XML (using YXML within text);
 
wenzelm 
parents: 
74823 
diff
changeset
 | 
396  | 
  val Latex_Tag = new Markup_String("latex_tag", NAME)
 | 
| 
 
0e4d8aa61ad7
more symbolic latex_output via XML (using YXML within text);
 
wenzelm 
parents: 
74823 
diff
changeset
 | 
397  | 
|
| 76955 | 398  | 
  val Latex_Cite = new Markup_Elem("latex_cite")
 | 
| 
76957
 
deb7dffb3340
avoid confusion of markup element vs. property names;
 
wenzelm 
parents: 
76956 
diff
changeset
 | 
399  | 
  val Citations = new Properties.String("citations")
 | 
| 76955 | 400  | 
|
| 74786 | 401  | 
  val Latex_Index_Item = new Markup_Elem("latex_index_item")
 | 
402  | 
  val Latex_Index_Entry = new Markup_String("latex_index_entry", KIND)
 | 
|
| 
74784
 
d2522bb4db1b
symbolic latex_output via XML, interpreted in Isabelle/Scala;
 
wenzelm 
parents: 
74783 
diff
changeset
 | 
403  | 
|
| 
74836
 
a97ec0954c50
example: alternative document headings, based on more general document output markup;
 
wenzelm 
parents: 
74829 
diff
changeset
 | 
404  | 
  val Optional_Argument = new Properties.String("optional_argument")
 | 
| 
 
a97ec0954c50
example: alternative document headings, based on more general document output markup;
 
wenzelm 
parents: 
74829 
diff
changeset
 | 
405  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
406  | 
|
| 61449 | 407  | 
/* Markdown document structure */  | 
408  | 
||
409  | 
val MARKDOWN_PARAGRAPH = "markdown_paragraph"  | 
|
| 
67323
 
d02208cefbdb
PIDE markup for Markdown items (which may consist of multiple paragraphs or lists);
 
wenzelm 
parents: 
67322 
diff
changeset
 | 
410  | 
val MARKDOWN_ITEM = "markdown_item"  | 
| 67336 | 411  | 
  val Markdown_Bullet = new Markup_Int("markdown_bullet", "depth")
 | 
| 61449 | 412  | 
  val Markdown_List = new Markup_String("markdown_list", "kind")
 | 
| 67336 | 413  | 
|
414  | 
val ITEMIZE = "itemize"  | 
|
415  | 
val ENUMERATE = "enumerate"  | 
|
416  | 
val DESCRIPTION = "description"  | 
|
| 61449 | 417  | 
|
418  | 
||
| 60744 | 419  | 
/* ML */  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
420  | 
|
| 55505 | 421  | 
val ML_KEYWORD1 = "ML_keyword1"  | 
422  | 
val ML_KEYWORD2 = "ML_keyword2"  | 
|
423  | 
val ML_KEYWORD3 = "ML_keyword3"  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
424  | 
val ML_DELIMITER = "ML_delimiter"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
425  | 
val ML_TVAR = "ML_tvar"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
426  | 
val ML_NUMERAL = "ML_numeral"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
427  | 
val ML_CHAR = "ML_char"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
428  | 
val ML_STRING = "ML_string"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
429  | 
val ML_COMMENT = "ML_comment"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
430  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
431  | 
val ML_DEF = "ML_def"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
432  | 
val ML_OPEN = "ML_open"  | 
| 55837 | 433  | 
val ML_STRUCTURE = "ML_structure"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
434  | 
val ML_TYPING = "ML_typing"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
435  | 
|
| 60744 | 436  | 
val ML_BREAKPOINT = "ML_breakpoint"  | 
437  | 
||
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
438  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
439  | 
/* outer syntax */  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
440  | 
|
| 74673 | 441  | 
val COMMAND_SPAN = "command_span"  | 
| 
78279
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
442  | 
  object Command_Span {
 | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
443  | 
    sealed case class Arg(name: String, kind: String) {
 | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
444  | 
def properties: Properties.T =  | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
445  | 
(if (name.isEmpty) Nil else Name(name)) :::  | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
446  | 
(if (kind.isEmpty) Nil else Kind(kind))  | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
447  | 
}  | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
448  | 
|
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
449  | 
def apply(arg: Arg): Markup = Markup(COMMAND_SPAN, arg.properties)  | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
450  | 
def apply(name: String, kind: String): Markup = apply(Arg(name, kind))  | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
451  | 
|
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
452  | 
def unapply(markup: Markup): Option[Arg] =  | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
453  | 
      if (markup.name == COMMAND_SPAN) {
 | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
454  | 
Some(Arg(Name.get(markup.properties), Kind.get(markup.properties)))  | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
455  | 
}  | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
456  | 
else None  | 
| 
 
dab089b25eb6
more markup for command_span: this allows to reconstruct Thy_Element structure without knowing the outer syntax;
 
wenzelm 
parents: 
78021 
diff
changeset
 | 
457  | 
}  | 
| 74673 | 458  | 
|
| 
55744
 
4a4e5686e091
clarified token markup: keyword1/keyword2 is for syntax, and "command" the entity kind;
 
wenzelm 
parents: 
55694 
diff
changeset
 | 
459  | 
val COMMAND = "command"  | 
| 66044 | 460  | 
val KEYWORD = "keyword"  | 
| 
55744
 
4a4e5686e091
clarified token markup: keyword1/keyword2 is for syntax, and "command" the entity kind;
 
wenzelm 
parents: 
55694 
diff
changeset
 | 
461  | 
val KEYWORD1 = "keyword1"  | 
| 
 
4a4e5686e091
clarified token markup: keyword1/keyword2 is for syntax, and "command" the entity kind;
 
wenzelm 
parents: 
55694 
diff
changeset
 | 
462  | 
val KEYWORD2 = "keyword2"  | 
| 55765 | 463  | 
val KEYWORD3 = "keyword3"  | 
| 
55919
 
2eb8c13339a5
more explicit quasi_keyword markup, for Args.$$$ material, which is somewhere in between of outer and inner syntax;
 
wenzelm 
parents: 
55914 
diff
changeset
 | 
464  | 
val QUASI_KEYWORD = "quasi_keyword"  | 
| 56202 | 465  | 
val IMPROPER = "improper"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
466  | 
val OPERATOR = "operator"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
467  | 
val STRING = "string"  | 
| 59081 | 468  | 
val ALT_STRING = "alt_string"  | 
| 55033 | 469  | 
val CARTOUCHE = "cartouche"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
470  | 
val COMMENT = "comment"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
471  | 
|
| 72782 | 472  | 
val LOAD_COMMAND = "load_command"  | 
473  | 
||
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
474  | 
|
| 69320 | 475  | 
/* comments */  | 
476  | 
||
477  | 
val COMMENT1 = "comment1"  | 
|
478  | 
val COMMENT2 = "comment2"  | 
|
479  | 
val COMMENT3 = "comment3"  | 
|
480  | 
||
481  | 
||
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
482  | 
/* timing */  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
483  | 
|
| 50781 | 484  | 
  val Elapsed = new Properties.Double("elapsed")
 | 
485  | 
  val CPU = new Properties.Double("cpu")
 | 
|
486  | 
  val GC = new Properties.Double("gc")
 | 
|
487  | 
||
| 75393 | 488  | 
  object Timing_Properties {
 | 
| 50781 | 489  | 
def apply(timing: isabelle.Timing): Properties.T =  | 
490  | 
Elapsed(timing.elapsed.seconds) ::: CPU(timing.cpu.seconds) ::: GC(timing.gc.seconds)  | 
|
| 
51662
 
3391a493f39a
just one timing protocol function, with 3 implementations: TTY/PG, PIDE/document, build;
 
wenzelm 
parents: 
51574 
diff
changeset
 | 
491  | 
|
| 50781 | 492  | 
def unapply(props: Properties.T): Option[isabelle.Timing] =  | 
493  | 
      (props, props, props) match {
 | 
|
494  | 
case (Elapsed(elapsed), CPU(cpu), GC(gc)) =>  | 
|
495  | 
Some(new isabelle.Timing(Time.seconds(elapsed), Time.seconds(cpu), Time.seconds(gc)))  | 
|
496  | 
case _ => None  | 
|
497  | 
}  | 
|
| 72013 | 498  | 
|
| 74782 | 499  | 
def get(props: Properties.T): isabelle.Timing =  | 
500  | 
unapply(props).getOrElse(isabelle.Timing.zero)  | 
|
| 50781 | 501  | 
}  | 
502  | 
||
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
503  | 
val TIMING = "timing"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
504  | 
|
| 75393 | 505  | 
  object Timing {
 | 
| 50781 | 506  | 
def apply(timing: isabelle.Timing): Markup = Markup(TIMING, Timing_Properties(timing))  | 
| 
51662
 
3391a493f39a
just one timing protocol function, with 3 implementations: TTY/PG, PIDE/document, build;
 
wenzelm 
parents: 
51574 
diff
changeset
 | 
507  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
508  | 
def unapply(markup: Markup): Option[isabelle.Timing] =  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
509  | 
      markup match {
 | 
| 50781 | 510  | 
case Markup(TIMING, Timing_Properties(timing)) => Some(timing)  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
511  | 
case _ => None  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
512  | 
}  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
513  | 
}  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
514  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
515  | 
|
| 65317 | 516  | 
/* process result */  | 
517  | 
||
518  | 
  val Return_Code = new Properties.Int("return_code")
 | 
|
519  | 
||
| 75393 | 520  | 
  object Process_Result {
 | 
| 65317 | 521  | 
def apply(result: Process_Result): Properties.T =  | 
522  | 
Return_Code(result.rc) :::  | 
|
523  | 
(if (result.timing.is_zero) Nil else Timing_Properties(result.timing))  | 
|
524  | 
||
525  | 
def unapply(props: Properties.T): Option[Process_Result] =  | 
|
526  | 
      props match {
 | 
|
527  | 
case Return_Code(rc) =>  | 
|
528  | 
val timing = Timing_Properties.unapply(props).getOrElse(isabelle.Timing.zero)  | 
|
529  | 
Some(isabelle.Process_Result(rc, timing = timing))  | 
|
530  | 
case _ => None  | 
|
531  | 
}  | 
|
532  | 
}  | 
|
533  | 
||
534  | 
||
| 
63474
 
f66e3c3b0fb1
semantic indentation for unstructured proof scripts;
 
wenzelm 
parents: 
63347 
diff
changeset
 | 
535  | 
/* command indentation */  | 
| 
 
f66e3c3b0fb1
semantic indentation for unstructured proof scripts;
 
wenzelm 
parents: 
63347 
diff
changeset
 | 
536  | 
|
| 74782 | 537  | 
  val Command_Indent = new Markup_Int("command_indent", Indent.name)
 | 
| 
63474
 
f66e3c3b0fb1
semantic indentation for unstructured proof scripts;
 
wenzelm 
parents: 
63347 
diff
changeset
 | 
538  | 
|
| 
 
f66e3c3b0fb1
semantic indentation for unstructured proof scripts;
 
wenzelm 
parents: 
63347 
diff
changeset
 | 
539  | 
|
| 
 
f66e3c3b0fb1
semantic indentation for unstructured proof scripts;
 
wenzelm 
parents: 
63347 
diff
changeset
 | 
540  | 
/* goals */  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
541  | 
|
| 50543 | 542  | 
val GOAL = "goal"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
543  | 
val SUBGOAL = "subgoal"  | 
| 50215 | 544  | 
|
| 
50450
 
358b6020f8b6
generalized notion of active area, where sendback is just one application;
 
wenzelm 
parents: 
50255 
diff
changeset
 | 
545  | 
|
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
546  | 
/* command status */  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
547  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
548  | 
val TASK = "task"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
549  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
550  | 
val ACCEPTED = "accepted"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
551  | 
val FORKED = "forked"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
552  | 
val JOINED = "joined"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
553  | 
val RUNNING = "running"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
554  | 
val FINISHED = "finished"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
555  | 
val FAILED = "failed"  | 
| 
68871
 
f5c76072db55
more explicit status for "canceled" command within theory node;
 
wenzelm 
parents: 
68822 
diff
changeset
 | 
556  | 
val CANCELED = "canceled"  | 
| 68323 | 557  | 
val INITIALIZED = "initialized"  | 
| 
68884
 
9b97d0b20d95
clarified quasi_consolidated state: ensure that exports are present for ok nodes;
 
wenzelm 
parents: 
68871 
diff
changeset
 | 
558  | 
val FINALIZED = "finalized"  | 
| 
70780
 
034742453594
more robust: avoid update/interrupt of long-running print_consolidation;
 
wenzelm 
parents: 
70665 
diff
changeset
 | 
559  | 
val CONSOLIDATING = "consolidating"  | 
| 
66379
 
6392766f3c25
maintain "consolidated" status of theory nodes, which means all evals are finished (but not necessarily prints nor imports);
 
wenzelm 
parents: 
66044 
diff
changeset
 | 
560  | 
val CONSOLIDATED = "consolidated"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
561  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
562  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
563  | 
/* interactive documents */  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
564  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
565  | 
val VERSION = "version"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
566  | 
val ASSIGN = "assign"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
567  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
568  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
569  | 
/* prover process */  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
570  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
571  | 
val PROVER_COMMAND = "prover_command"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
572  | 
val PROVER_ARG = "prover_arg"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
573  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
574  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
575  | 
/* messages */  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
576  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
577  | 
val INIT = "init"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
578  | 
val STATUS = "status"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
579  | 
val REPORT = "report"  | 
| 
50500
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
580  | 
val RESULT = "result"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
581  | 
val WRITELN = "writeln"  | 
| 
59184
 
830bb7ddb3ab
explicit message channels for "state", "information";
 
wenzelm 
parents: 
59112 
diff
changeset
 | 
582  | 
val STATE = "state"  | 
| 
 
830bb7ddb3ab
explicit message channels for "state", "information";
 
wenzelm 
parents: 
59112 
diff
changeset
 | 
583  | 
val INFORMATION = "information"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
584  | 
val TRACING = "tracing"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
585  | 
val WARNING = "warning"  | 
| 
59203
 
5f0bd5afc16d
explicit message channel for "legacy", which is nonetheless a variant of "warning";
 
wenzelm 
parents: 
59186 
diff
changeset
 | 
586  | 
val LEGACY = "legacy"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
587  | 
val ERROR = "error"  | 
| 
68770
 
add44e2b8cb0
optional notification of nodes_status (via progress);
 
wenzelm 
parents: 
68323 
diff
changeset
 | 
588  | 
val NODES_STATUS = "nodes_status"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
589  | 
val PROTOCOL = "protocol"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
590  | 
val SYSTEM = "system"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
591  | 
val STDOUT = "stdout"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
592  | 
val STDERR = "stderr"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
593  | 
val EXIT = "exit"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
594  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
595  | 
val WRITELN_MESSAGE = "writeln_message"  | 
| 
59184
 
830bb7ddb3ab
explicit message channels for "state", "information";
 
wenzelm 
parents: 
59112 
diff
changeset
 | 
596  | 
val STATE_MESSAGE = "state_message"  | 
| 
 
830bb7ddb3ab
explicit message channels for "state", "information";
 
wenzelm 
parents: 
59112 
diff
changeset
 | 
597  | 
val INFORMATION_MESSAGE = "information_message"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
598  | 
val TRACING_MESSAGE = "tracing_message"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
599  | 
val WARNING_MESSAGE = "warning_message"  | 
| 
59203
 
5f0bd5afc16d
explicit message channel for "legacy", which is nonetheless a variant of "warning";
 
wenzelm 
parents: 
59186 
diff
changeset
 | 
600  | 
val LEGACY_MESSAGE = "legacy_message"  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
601  | 
val ERROR_MESSAGE = "error_message"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
602  | 
|
| 
59184
 
830bb7ddb3ab
explicit message channels for "state", "information";
 
wenzelm 
parents: 
59112 
diff
changeset
 | 
603  | 
val messages = Map(  | 
| 
 
830bb7ddb3ab
explicit message channels for "state", "information";
 
wenzelm 
parents: 
59112 
diff
changeset
 | 
604  | 
WRITELN -> WRITELN_MESSAGE,  | 
| 
 
830bb7ddb3ab
explicit message channels for "state", "information";
 
wenzelm 
parents: 
59112 
diff
changeset
 | 
605  | 
STATE -> STATE_MESSAGE,  | 
| 
 
830bb7ddb3ab
explicit message channels for "state", "information";
 
wenzelm 
parents: 
59112 
diff
changeset
 | 
606  | 
INFORMATION -> INFORMATION_MESSAGE,  | 
| 
 
830bb7ddb3ab
explicit message channels for "state", "information";
 
wenzelm 
parents: 
59112 
diff
changeset
 | 
607  | 
TRACING -> TRACING_MESSAGE,  | 
| 
 
830bb7ddb3ab
explicit message channels for "state", "information";
 
wenzelm 
parents: 
59112 
diff
changeset
 | 
608  | 
WARNING -> WARNING_MESSAGE,  | 
| 
59203
 
5f0bd5afc16d
explicit message channel for "legacy", which is nonetheless a variant of "warning";
 
wenzelm 
parents: 
59186 
diff
changeset
 | 
609  | 
LEGACY -> LEGACY_MESSAGE,  | 
| 
59184
 
830bb7ddb3ab
explicit message channels for "state", "information";
 
wenzelm 
parents: 
59112 
diff
changeset
 | 
610  | 
ERROR -> ERROR_MESSAGE)  | 
| 
 
830bb7ddb3ab
explicit message channels for "state", "information";
 
wenzelm 
parents: 
59112 
diff
changeset
 | 
611  | 
|
| 52876 | 612  | 
val message: String => String = messages.withDefault((s: String) => s)  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
613  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
614  | 
val NO_REPORT = "no_report"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
615  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
616  | 
val BAD = "bad"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
617  | 
|
| 
50500
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
618  | 
val INTENSIFY = "intensify"  | 
| 
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
619  | 
|
| 
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
620  | 
|
| 73835 | 621  | 
/* ML profiling */  | 
622  | 
||
623  | 
val COUNT = "count"  | 
|
624  | 
val ML_PROFILING_ENTRY = "ML_profiling_entry"  | 
|
625  | 
val ML_PROFILING = "ML_profiling"  | 
|
626  | 
||
| 75393 | 627  | 
  object ML_Profiling {
 | 
| 73835 | 628  | 
def unapply_entry(tree: XML.Tree): Option[isabelle.ML_Profiling.Entry] =  | 
629  | 
      tree match {
 | 
|
630  | 
case XML.Elem(Markup(ML_PROFILING_ENTRY, List((NAME, name), (COUNT, Value.Long(count)))), _) =>  | 
|
631  | 
Some(isabelle.ML_Profiling.Entry(name, count))  | 
|
632  | 
case _ => None  | 
|
633  | 
}  | 
|
634  | 
||
635  | 
def unapply_report(tree: XML.Tree): Option[isabelle.ML_Profiling.Report] =  | 
|
636  | 
      tree match {
 | 
|
637  | 
case XML.Elem(Markup(ML_PROFILING, List((KIND, kind))), body) =>  | 
|
638  | 
Some(isabelle.ML_Profiling.Report(kind, body.flatMap(unapply_entry)))  | 
|
639  | 
case _ => None  | 
|
640  | 
}  | 
|
641  | 
}  | 
|
642  | 
||
643  | 
||
| 
50500
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
644  | 
/* active areas */  | 
| 
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
645  | 
|
| 
50715
 
8cfd585b9162
prefer old graph browser in Isabelle/jEdit, which still produces better layout;
 
wenzelm 
parents: 
50545 
diff
changeset
 | 
646  | 
val BROWSER = "browser"  | 
| 
50500
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
647  | 
val GRAPHVIEW = "graphview"  | 
| 69650 | 648  | 
val THEORY_EXPORTS = "theory_exports"  | 
| 
50500
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
649  | 
|
| 
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
650  | 
val SENDBACK = "sendback"  | 
| 
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
651  | 
val PADDING = "padding"  | 
| 
52697
 
6fb98a20c349
explicit padding on command boundary for "auto" generated sendback -- do not replace the corresponding goal command, but append to it;
 
wenzelm 
parents: 
52643 
diff
changeset
 | 
652  | 
val PADDING_LINE = (PADDING, "line")  | 
| 
 
6fb98a20c349
explicit padding on command boundary for "auto" generated sendback -- do not replace the corresponding goal command, but append to it;
 
wenzelm 
parents: 
52643 
diff
changeset
 | 
653  | 
val PADDING_COMMAND = (PADDING, "command")  | 
| 
50500
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
654  | 
|
| 
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
655  | 
val DIALOG = "dialog"  | 
| 
50503
 
50f141b34bb7
enable Isabelle/ML to produce uninterpreted result messages as well;
 
wenzelm 
parents: 
50501 
diff
changeset
 | 
656  | 
val Result = new Properties.String(RESULT)  | 
| 
50500
 
c94bba7906d2
identify dialogs via official serial and maintain as result message;
 
wenzelm 
parents: 
50499 
diff
changeset
 | 
657  | 
|
| 63681 | 658  | 
val JEDIT_ACTION = "jedit_action"  | 
659  | 
||
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
660  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
661  | 
/* protocol message functions */  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
662  | 
|
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
663  | 
val FUNCTION = "function"  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
664  | 
|
| 75393 | 665  | 
  class Function(val name: String) {
 | 
| 76394 | 666  | 
val THIS: Properties.Entry = (FUNCTION, name)  | 
| 71673 | 667  | 
}  | 
| 
66942
 
91a21a5631ae
proper order of initialization (amending 9953ae603a23);
 
wenzelm 
parents: 
66873 
diff
changeset
 | 
668  | 
|
| 75393 | 669  | 
  class Properties_Function(name: String) extends Function(name) {
 | 
| 71673 | 670  | 
def unapply(props: Properties.T): Option[Properties.T] =  | 
| 
52111
 
1fd184eaa310
explicit management of Session.Protocol_Handlers, with protocol state and functions;
 
wenzelm 
parents: 
51818 
diff
changeset
 | 
671  | 
      props match {
 | 
| 76394 | 672  | 
case THIS :: args => Some(args)  | 
| 
52111
 
1fd184eaa310
explicit management of Session.Protocol_Handlers, with protocol state and functions;
 
wenzelm 
parents: 
51818 
diff
changeset
 | 
673  | 
case _ => None  | 
| 
 
1fd184eaa310
explicit management of Session.Protocol_Handlers, with protocol state and functions;
 
wenzelm 
parents: 
51818 
diff
changeset
 | 
674  | 
}  | 
| 
 
1fd184eaa310
explicit management of Session.Protocol_Handlers, with protocol state and functions;
 
wenzelm 
parents: 
51818 
diff
changeset
 | 
675  | 
}  | 
| 
 
1fd184eaa310
explicit management of Session.Protocol_Handlers, with protocol state and functions;
 
wenzelm 
parents: 
51818 
diff
changeset
 | 
676  | 
|
| 75393 | 677  | 
  class Name_Function(name: String) extends Function(name) {
 | 
| 
72112
 
3546dd4ade74
ML statistics via external process: allows monitoring RTS while ML program sleeps;
 
wenzelm 
parents: 
72107 
diff
changeset
 | 
678  | 
def unapply(props: Properties.T): Option[String] =  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
679  | 
      props match {
 | 
| 76394 | 680  | 
case List(THIS, (NAME, a)) => Some(a)  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
681  | 
case _ => None  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
682  | 
}  | 
| 
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
683  | 
}  | 
| 
52111
 
1fd184eaa310
explicit management of Session.Protocol_Handlers, with protocol state and functions;
 
wenzelm 
parents: 
51818 
diff
changeset
 | 
684  | 
|
| 75393 | 685  | 
  object ML_Statistics extends Function("ML_statistics") {
 | 
| 
72119
 
d115d50a19c0
provide POLYSTATSDIR to keep $HOME/.polyml clean (requires Poly/ML 52881757b127, otherwise ignored);
 
wenzelm 
parents: 
72116 
diff
changeset
 | 
686  | 
def unapply(props: Properties.T): Option[(Long, String)] =  | 
| 
72112
 
3546dd4ade74
ML statistics via external process: allows monitoring RTS while ML program sleeps;
 
wenzelm 
parents: 
72107 
diff
changeset
 | 
687  | 
      props match {
 | 
| 76394 | 688  | 
        case List(THIS, ("pid", Value.Long(pid)), ("stats_dir", stats_dir)) =>
 | 
| 
72119
 
d115d50a19c0
provide POLYSTATSDIR to keep $HOME/.polyml clean (requires Poly/ML 52881757b127, otherwise ignored);
 
wenzelm 
parents: 
72116 
diff
changeset
 | 
689  | 
Some((pid, stats_dir))  | 
| 
72112
 
3546dd4ade74
ML statistics via external process: allows monitoring RTS while ML program sleeps;
 
wenzelm 
parents: 
72107 
diff
changeset
 | 
690  | 
case _ => None  | 
| 
 
3546dd4ade74
ML statistics via external process: allows monitoring RTS while ML program sleeps;
 
wenzelm 
parents: 
72107 
diff
changeset
 | 
691  | 
}  | 
| 
 
3546dd4ade74
ML statistics via external process: allows monitoring RTS while ML program sleeps;
 
wenzelm 
parents: 
72107 
diff
changeset
 | 
692  | 
}  | 
| 
 
3546dd4ade74
ML statistics via external process: allows monitoring RTS while ML program sleeps;
 
wenzelm 
parents: 
72107 
diff
changeset
 | 
693  | 
|
| 
72107
 
1b06ed254943
more compact command_timings, as in former batch-build;
 
wenzelm 
parents: 
72013 
diff
changeset
 | 
694  | 
val command_timing_properties: Set[String] = Set(FILE, OFFSET, NAME, Elapsed.name)  | 
| 72711 | 695  | 
def command_timing_property(entry: Properties.Entry): Boolean = command_timing_properties(entry._1)  | 
| 
72107
 
1b06ed254943
more compact command_timings, as in former batch-build;
 
wenzelm 
parents: 
72013 
diff
changeset
 | 
696  | 
|
| 71673 | 697  | 
  object Command_Timing extends Properties_Function("command_timing")
 | 
698  | 
  object Theory_Timing extends Properties_Function("theory_timing")
 | 
|
| 75393 | 699  | 
  object Session_Timing extends Properties_Function("session_timing") {
 | 
| 72013 | 700  | 
    val Threads = new Properties.Int("threads")
 | 
| 
72008
 
7a53fc156c2b
proper session Timing for build_history log file (see 5c4800f6b25a);
 
wenzelm 
parents: 
72002 
diff
changeset
 | 
701  | 
}  | 
| 71673 | 702  | 
  object Task_Statistics extends Properties_Function("task_statistics")
 | 
703  | 
||
| 
72692
 
22aeec526ffd
support for PIDE markup in batch build (inactive due to pide_reports=false);
 
wenzelm 
parents: 
72332 
diff
changeset
 | 
704  | 
  object Loading_Theory extends Properties_Function("loading_theory")
 | 
| 71673 | 705  | 
  object Build_Session_Finished extends Function("build_session_finished")
 | 
706  | 
||
707  | 
  object Commands_Accepted extends Function("commands_accepted")
 | 
|
708  | 
  object Assign_Update extends Function("assign_update")
 | 
|
709  | 
  object Removed_Versions extends Function("removed_versions")
 | 
|
710  | 
||
| 75393 | 711  | 
  object Invoke_Scala extends Function("invoke_scala") {
 | 
| 
73419
 
22f3f2117ed7
clarified signature: function_thread is determined in Isabelle/Scala, not Isabelle/ML;
 
wenzelm 
parents: 
73360 
diff
changeset
 | 
712  | 
def unapply(props: Properties.T): Option[(String, String)] =  | 
| 
50201
 
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
 
wenzelm 
parents: 
49613 
diff
changeset
 | 
713  | 
      props match {
 | 
| 76394 | 714  | 
case List(THIS, (NAME, name), (ID, id)) => Some((name, id))  | 
| 50255 | 715  | 
case _ => None  | 
716  | 
}  | 
|
717  | 
}  | 
|
| 50975 | 718  | 
|
| 75393 | 719  | 
  object Cancel_Scala extends Function("cancel_scala") {
 | 
| 71673 | 720  | 
def unapply(props: Properties.T): Option[String] =  | 
| 50975 | 721  | 
      props match {
 | 
| 76394 | 722  | 
case List(THIS, (ID, id)) => Some(id)  | 
| 50975 | 723  | 
case _ => None  | 
724  | 
}  | 
|
725  | 
}  | 
|
| 
55316
 
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
 
Lars Hupel <lars.hupel@mytum.de> 
parents: 
55033 
diff
changeset
 | 
726  | 
|
| 69788 | 727  | 
val PRINT_OPERATIONS = "print_operations"  | 
728  | 
||
729  | 
||
730  | 
/* export */  | 
|
731  | 
||
| 68088 | 732  | 
val EXPORT = "export"  | 
| 71624 | 733  | 
val THEORY_NAME = "theory_name"  | 
734  | 
val EXECUTABLE = "executable"  | 
|
735  | 
val COMPRESS = "compress"  | 
|
736  | 
val STRICT = "strict"  | 
|
| 68088 | 737  | 
|
| 
55553
 
99409ccbe04a
more standard names for protocol and markup elements;
 
wenzelm 
parents: 
55551 
diff
changeset
 | 
738  | 
|
| 60830 | 739  | 
/* debugger output */  | 
740  | 
||
| 60842 | 741  | 
val DEBUGGER_STATE = "debugger_state"  | 
| 75393 | 742  | 
  object Debugger_State {
 | 
| 60842 | 743  | 
def unapply(props: Properties.T): Option[String] =  | 
744  | 
      props match {
 | 
|
745  | 
case List((FUNCTION, DEBUGGER_STATE), (NAME, name)) => Some(name)  | 
|
746  | 
case _ => None  | 
|
747  | 
}  | 
|
748  | 
}  | 
|
749  | 
||
| 60830 | 750  | 
val DEBUGGER_OUTPUT = "debugger_output"  | 
| 75393 | 751  | 
  object Debugger_Output {
 | 
| 60834 | 752  | 
def unapply(props: Properties.T): Option[String] =  | 
| 60830 | 753  | 
      props match {
 | 
| 60834 | 754  | 
case List((FUNCTION, DEBUGGER_OUTPUT), (NAME, name)) => Some(name)  | 
| 60830 | 755  | 
case _ => None  | 
756  | 
}  | 
|
757  | 
}  | 
|
758  | 
||
759  | 
||
| 
55316
 
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
 
Lars Hupel <lars.hupel@mytum.de> 
parents: 
55033 
diff
changeset
 | 
760  | 
/* simplifier trace */  | 
| 
 
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
 
Lars Hupel <lars.hupel@mytum.de> 
parents: 
55033 
diff
changeset
 | 
761  | 
|
| 
57594
 
037f3b251df5
regular message to refer to Simplifier Trace panel (unused);
 
wenzelm 
parents: 
56864 
diff
changeset
 | 
762  | 
val SIMP_TRACE_PANEL = "simp_trace_panel"  | 
| 
55316
 
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
 
Lars Hupel <lars.hupel@mytum.de> 
parents: 
55033 
diff
changeset
 | 
763  | 
|
| 
55553
 
99409ccbe04a
more standard names for protocol and markup elements;
 
wenzelm 
parents: 
55551 
diff
changeset
 | 
764  | 
val SIMP_TRACE_LOG = "simp_trace_log"  | 
| 
 
99409ccbe04a
more standard names for protocol and markup elements;
 
wenzelm 
parents: 
55551 
diff
changeset
 | 
765  | 
val SIMP_TRACE_STEP = "simp_trace_step"  | 
| 
 
99409ccbe04a
more standard names for protocol and markup elements;
 
wenzelm 
parents: 
55551 
diff
changeset
 | 
766  | 
val SIMP_TRACE_RECURSE = "simp_trace_recurse"  | 
| 
 
99409ccbe04a
more standard names for protocol and markup elements;
 
wenzelm 
parents: 
55551 
diff
changeset
 | 
767  | 
val SIMP_TRACE_HINT = "simp_trace_hint"  | 
| 
 
99409ccbe04a
more standard names for protocol and markup elements;
 
wenzelm 
parents: 
55551 
diff
changeset
 | 
768  | 
val SIMP_TRACE_IGNORE = "simp_trace_ignore"  | 
| 
55316
 
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
 
Lars Hupel <lars.hupel@mytum.de> 
parents: 
55033 
diff
changeset
 | 
769  | 
|
| 
55553
 
99409ccbe04a
more standard names for protocol and markup elements;
 
wenzelm 
parents: 
55551 
diff
changeset
 | 
770  | 
val SIMP_TRACE_CANCEL = "simp_trace_cancel"  | 
| 75393 | 771  | 
  object Simp_Trace_Cancel {
 | 
| 
55316
 
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
 
Lars Hupel <lars.hupel@mytum.de> 
parents: 
55033 
diff
changeset
 | 
772  | 
def unapply(props: Properties.T): Option[Long] =  | 
| 
 
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
 
Lars Hupel <lars.hupel@mytum.de> 
parents: 
55033 
diff
changeset
 | 
773  | 
      props match {
 | 
| 
55553
 
99409ccbe04a
more standard names for protocol and markup elements;
 
wenzelm 
parents: 
55551 
diff
changeset
 | 
774  | 
case (FUNCTION, SIMP_TRACE_CANCEL) :: Serial(i) => Some(i)  | 
| 
55316
 
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
 
Lars Hupel <lars.hupel@mytum.de> 
parents: 
55033 
diff
changeset
 | 
775  | 
case _ => None  | 
| 
 
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
 
Lars Hupel <lars.hupel@mytum.de> 
parents: 
55033 
diff
changeset
 | 
776  | 
}  | 
| 
 
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
 
Lars Hupel <lars.hupel@mytum.de> 
parents: 
55033 
diff
changeset
 | 
777  | 
}  | 
| 65335 | 778  | 
|
779  | 
||
780  | 
/* XML data representation */  | 
|
781  | 
||
| 75394 | 782  | 
  def encode: XML.Encode.T[Markup] = { (markup: Markup) =>
 | 
| 65335 | 783  | 
import XML.Encode._  | 
784  | 
pair(string, properties)((markup.name, markup.properties))  | 
|
785  | 
}  | 
|
786  | 
||
| 75394 | 787  | 
  def decode: XML.Decode.T[Markup] = { (body: XML.Body) =>
 | 
| 65335 | 788  | 
import XML.Decode._  | 
789  | 
val (name, props) = pair(string, properties)(body)  | 
|
790  | 
Markup(name, props)  | 
|
791  | 
}  | 
|
| 45666 | 792  | 
}  | 
| 
43721
 
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
 
wenzelm 
parents: 
43710 
diff
changeset
 | 
793  | 
|
| 
 
fad8634cee62
echo prover input via raw_messages, for improved protocol tracing;
 
wenzelm 
parents: 
43710 
diff
changeset
 | 
794  | 
|
| 75393 | 795  | 
sealed case class Markup(name: String, properties: Properties.T) {
 | 
| 
73556
 
192bcee4f8b8
more robust treatment of empty markup: it allows to produce formal chunks;
 
wenzelm 
parents: 
73419 
diff
changeset
 | 
796  | 
def is_empty: Boolean = name.isEmpty  | 
| 
 
192bcee4f8b8
more robust treatment of empty markup: it allows to produce formal chunks;
 
wenzelm 
parents: 
73419 
diff
changeset
 | 
797  | 
|
| 
74829
 
f31229171b3b
source positions for document markup commands, e.g. to retrieve PIDE markup in presentation;
 
wenzelm 
parents: 
74826 
diff
changeset
 | 
798  | 
def position_properties: Position.T = properties.filter(Markup.position_property)  | 
| 
 
f31229171b3b
source positions for document markup commands, e.g. to retrieve PIDE markup in presentation;
 
wenzelm 
parents: 
74826 
diff
changeset
 | 
799  | 
|
| 59707 | 800  | 
def markup(s: String): String =  | 
801  | 
YXML.string_of_tree(XML.Elem(this, List(XML.Text(s))))  | 
|
| 64358 | 802  | 
|
803  | 
def update_properties(more_props: Properties.T): Markup =  | 
|
804  | 
if (more_props.isEmpty) this  | 
|
| 73360 | 805  | 
    else Markup(name, more_props.foldRight(properties) { case (p, ps) => Properties.put(ps, p) })
 | 
| 65753 | 806  | 
|
807  | 
def + (entry: Properties.Entry): Markup =  | 
|
808  | 
Markup(name, Properties.put(properties, entry))  | 
|
| 59707 | 809  | 
}  |