author | wenzelm |
Mon, 02 Mar 2009 19:17:20 +0100 | |
changeset 34533 | 35308320713a |
parent 34509 | 839d1f0b2dd1 |
child 34539 | 5d88e0681d44 |
permissions | -rw-r--r-- |
34407 | 1 |
/* |
34501 | 2 |
* Higher-level prover communication: interactive document model |
34407 | 3 |
* |
4 |
* @author Johannes Hölzl, TU Munich |
|
5 |
* @author Fabian Immler, TU Munich |
|
34453 | 6 |
* @author Makarius |
34407 | 7 |
*/ |
8 |
||
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
9 |
package isabelle.prover |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
10 |
|
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
11 |
|
34497 | 12 |
import scala.collection.mutable |
34475
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34471
diff
changeset
|
13 |
import scala.collection.immutable.{TreeSet} |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
14 |
|
34456 | 15 |
import org.gjt.sp.util.Log |
16 |
||
34501 | 17 |
import isabelle.jedit.Isabelle |
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
18 |
import isabelle.proofdocument.{StructureChange, ProofDocument, Text, Token} |
34489
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
19 |
import isabelle.IsarDocument |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
20 |
|
34453 | 21 |
|
34504
4bd676662792
eliminated Prover.start -- part of main constructor;
wenzelm
parents:
34503
diff
changeset
|
22 |
class Prover(isabelle_system: IsabelleSystem, logic: String) |
34453 | 23 |
{ |
34504
4bd676662792
eliminated Prover.start -- part of main constructor;
wenzelm
parents:
34503
diff
changeset
|
24 |
/* prover process */ |
4bd676662792
eliminated Prover.start -- part of main constructor;
wenzelm
parents:
34503
diff
changeset
|
25 |
|
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
26 |
private val process = |
34504
4bd676662792
eliminated Prover.start -- part of main constructor;
wenzelm
parents:
34503
diff
changeset
|
27 |
{ |
4bd676662792
eliminated Prover.start -- part of main constructor;
wenzelm
parents:
34503
diff
changeset
|
28 |
val results = new EventBus[IsabelleProcess.Result] + handle_result |
4bd676662792
eliminated Prover.start -- part of main constructor;
wenzelm
parents:
34503
diff
changeset
|
29 |
results.logger = Log.log(Log.ERROR, null, _) |
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
30 |
new IsabelleProcess(isabelle_system, results, "-m", "xsymbols", logic) with IsarDocument |
34504
4bd676662792
eliminated Prover.start -- part of main constructor;
wenzelm
parents:
34503
diff
changeset
|
31 |
} |
4bd676662792
eliminated Prover.start -- part of main constructor;
wenzelm
parents:
34503
diff
changeset
|
32 |
|
4bd676662792
eliminated Prover.start -- part of main constructor;
wenzelm
parents:
34503
diff
changeset
|
33 |
def stop() { process.kill } |
4bd676662792
eliminated Prover.start -- part of main constructor;
wenzelm
parents:
34503
diff
changeset
|
34 |
|
4bd676662792
eliminated Prover.start -- part of main constructor;
wenzelm
parents:
34503
diff
changeset
|
35 |
|
34509 | 36 |
/* document state information */ |
37 |
||
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
38 |
private val states = new mutable.HashMap[IsarDocument.State_ID, Command] with |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
39 |
mutable.SynchronizedMap[IsarDocument.State_ID, Command] |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
40 |
private val commands = new mutable.HashMap[IsarDocument.Command_ID, Command] with |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
41 |
mutable.SynchronizedMap[IsarDocument.Command_ID, Command] |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
42 |
private val document_id0 = Isabelle.plugin.id() |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
43 |
private var document_id = document_id0 |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
44 |
private var document_versions = Set(document_id) |
34509 | 45 |
|
46 |
private var initialized = false |
|
47 |
||
48 |
||
34485 | 49 |
/* outer syntax keywords */ |
50 |
||
34465
ccadbf63e320
added EventBus for new command- or keyword-declarations
immler@in.tum.de
parents:
34462
diff
changeset
|
51 |
val decl_info = new EventBus[(String, String)] |
34489
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
52 |
|
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
53 |
private val keyword_decls = |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
54 |
new mutable.HashSet[String] with mutable.SynchronizedSet[String] { |
34489
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
55 |
override def +=(name: String) = { |
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
56 |
decl_info.event(name, OuterKeyword.MINOR) |
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
57 |
super.+=(name) |
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
58 |
} |
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
59 |
} |
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
60 |
private val command_decls = |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
61 |
new mutable.HashMap[String, String] with mutable.SynchronizedMap[String, String] { |
34471
1dac47492863
decl_info: cover both commands and keywords, with kind;
wenzelm
parents:
34466
diff
changeset
|
62 |
override def +=(entry: (String, String)) = { |
1dac47492863
decl_info: cover both commands and keywords, with kind;
wenzelm
parents:
34466
diff
changeset
|
63 |
decl_info.event(entry) |
1dac47492863
decl_info: cover both commands and keywords, with kind;
wenzelm
parents:
34466
diff
changeset
|
64 |
super.+=(entry) |
34465
ccadbf63e320
added EventBus for new command- or keyword-declarations
immler@in.tum.de
parents:
34462
diff
changeset
|
65 |
} |
ccadbf63e320
added EventBus for new command- or keyword-declarations
immler@in.tum.de
parents:
34462
diff
changeset
|
66 |
} |
34485 | 67 |
|
68 |
||
34489
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
69 |
/* completions */ |
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
70 |
|
34475
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34471
diff
changeset
|
71 |
var _completions = new TreeSet[String] |
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34471
diff
changeset
|
72 |
def completions = _completions |
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34471
diff
changeset
|
73 |
/* // TODO: ask Makarius to make Interpretation.symbols public (here: read-only as 'symbol_map') |
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34471
diff
changeset
|
74 |
val map = isabelle.jedit.Isabelle.symbols.symbol_map |
34503 | 75 |
for (xsymb <- map.keys) { |
34475
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34471
diff
changeset
|
76 |
_completions += xsymb |
34503 | 77 |
if (map(xsymb).get("abbrev").isDefined) _completions += map(xsymb)("abbrev") |
34475
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34471
diff
changeset
|
78 |
} |
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34471
diff
changeset
|
79 |
*/ |
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34471
diff
changeset
|
80 |
decl_info += (k_v => _completions += k_v._1) |
34489
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
81 |
|
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
82 |
|
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
83 |
/* event handling */ |
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
84 |
|
34456 | 85 |
val activated = new EventBus[Unit] |
86 |
val command_info = new EventBus[Command] |
|
87 |
val output_info = new EventBus[String] |
|
34485 | 88 |
var document: ProofDocument = null |
34399
5b8b89b7e597
interpretation of STATUS messages in one place, deleting inner syntax
immler@in.tum.de
parents:
34397
diff
changeset
|
89 |
|
34444
a245f6cc3105
replaced inUIThread by scala-style swing/swing_async combinators;
wenzelm
parents:
34443
diff
changeset
|
90 |
|
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
91 |
private def handle_result(result: IsabelleProcess.Result): Unit = Swing.now |
34489
7b7ccf0ff629
replaced java.util.Property by plain association list;
wenzelm
parents:
34485
diff
changeset
|
92 |
{ |
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
93 |
def command_change(c: Command) = command_info.event(c) |
34509 | 94 |
val (running, command) = |
95 |
result.props.find(p => p._1 == Markup.ID) match { |
|
96 |
case None => (false, null) |
|
97 |
case Some((_, id)) => |
|
98 |
if (commands.contains(id)) (false, commands(id)) |
|
99 |
else if (states.contains(id)) (true, states(id)) |
|
100 |
else (false, null) |
|
101 |
} |
|
34453 | 102 |
|
34509 | 103 |
if (result.kind == IsabelleProcess.Kind.STDOUT || result.kind == IsabelleProcess.Kind.STDIN) |
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
104 |
output_info.event(result.toString) |
34509 | 105 |
else if (result.kind == IsabelleProcess.Kind.WRITELN && !initialized) { // FIXME !? |
34453 | 106 |
initialized = true |
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
107 |
if (document != null) { |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
108 |
document.activate() |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
109 |
activated.event(()) |
34453 | 110 |
} |
111 |
} |
|
112 |
else { |
|
34509 | 113 |
result.kind match { |
114 |
||
115 |
case IsabelleProcess.Kind.WRITELN | IsabelleProcess.Kind.PRIORITY |
|
116 |
| IsabelleProcess.Kind.WARNING | IsabelleProcess.Kind.ERROR |
|
117 |
if command != null => |
|
118 |
if (result.kind == IsabelleProcess.Kind.ERROR) |
|
119 |
command.status = Command.Status.FAILED |
|
120 |
command.add_result(running, process.parse_message(result)) |
|
121 |
command_change(command) |
|
34404
98155c35d252
delayed repainting new phase in buffer and overview;
immler@in.tum.de
parents:
34401
diff
changeset
|
122 |
|
34509 | 123 |
case IsabelleProcess.Kind.STATUS => |
124 |
//{{{ handle all kinds of status messages here |
|
125 |
process.parse_message(result) match { |
|
126 |
case XML.Elem(Markup.MESSAGE, _, elems) => |
|
127 |
for (elem <- elems) { |
|
128 |
elem match { |
|
129 |
//{{{ |
|
130 |
// command and keyword declarations |
|
131 |
case XML.Elem(Markup.COMMAND_DECL, |
|
132 |
(Markup.NAME, name) :: (Markup.KIND, kind) :: _, _) => |
|
133 |
command_decls += (name -> kind) |
|
134 |
case XML.Elem(Markup.KEYWORD_DECL, (Markup.NAME, name) :: _, _) => |
|
135 |
keyword_decls += name |
|
34404
98155c35d252
delayed repainting new phase in buffer and overview;
immler@in.tum.de
parents:
34401
diff
changeset
|
136 |
|
34509 | 137 |
// document edits |
138 |
case XML.Elem(Markup.EDITS, (Markup.ID, doc_id) :: _, edits) |
|
139 |
if document_versions.contains(doc_id) => |
|
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
140 |
output_info.event(result.toString) |
34509 | 141 |
for { |
142 |
XML.Elem(Markup.EDIT, (Markup.ID, cmd_id) :: (Markup.STATE, state_id) :: _, _) |
|
143 |
<- edits |
|
144 |
} { |
|
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
145 |
if (commands.contains(cmd_id)) { |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
146 |
val cmd = commands(cmd_id) |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
147 |
if (cmd.state_id != null) states -= cmd.state_id |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
148 |
states(state_id) = cmd |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
149 |
cmd.state_id = state_id |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
150 |
cmd.status = Command.Status.UNPROCESSED |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
151 |
command_change(cmd) |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
152 |
} |
34509 | 153 |
} |
34453 | 154 |
|
34509 | 155 |
// command status |
156 |
case XML.Elem(Markup.UNPROCESSED, _, _) |
|
157 |
if command != null => |
|
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
158 |
output_info.event(result.toString) |
34509 | 159 |
command.status = Command.Status.UNPROCESSED |
160 |
command_change(command) |
|
161 |
case XML.Elem(Markup.FINISHED, _, _) |
|
162 |
if command != null => |
|
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
163 |
output_info.event(result.toString) |
34509 | 164 |
command.status = Command.Status.FINISHED |
165 |
command_change(command) |
|
166 |
case XML.Elem(Markup.FAILED, _, _) |
|
167 |
if command != null => |
|
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
168 |
output_info.event(result.toString) |
34509 | 169 |
command.status = Command.Status.FAILED |
170 |
command_change(command) |
|
34453 | 171 |
|
34509 | 172 |
// other markup |
173 |
case XML.Elem(kind, |
|
174 |
(Markup.OFFSET, offset) :: (Markup.END_OFFSET, end_offset) :: |
|
175 |
(Markup.ID, markup_id) :: _, _) => |
|
176 |
val begin = offset.toInt - 1 |
|
177 |
val end = end_offset.toInt - 1 |
|
178 |
||
179 |
val cmd = // FIXME proper command version!? running!? |
|
180 |
// outer syntax: no id in props |
|
181 |
if (command == null) commands.getOrElse(markup_id, null) |
|
182 |
// inner syntax: id from props |
|
183 |
else command |
|
184 |
if (cmd != null) |
|
185 |
cmd.root_node.insert(cmd.node_from(kind, begin, end)) |
|
186 |
||
187 |
case _ => |
|
188 |
//}}} |
|
34453 | 189 |
} |
34509 | 190 |
} |
191 |
case _ => |
|
192 |
} |
|
193 |
//}}} |
|
34453 | 194 |
|
34509 | 195 |
case _ => |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
196 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
197 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
198 |
} |
34453 | 199 |
|
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
200 |
def set_document(text: Text, path: String): Unit = Swing.now |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
201 |
{ |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
202 |
document = new ProofDocument(text, command_decls.contains(_)) |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
203 |
process.ML("()") // FIXME force initial writeln |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
204 |
process.begin_document(document_id0, path) |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
205 |
document.structural_changes += edit_document |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
206 |
// FIXME !? |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
207 |
if (initialized) { |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
208 |
document.activate() |
34456 | 209 |
activated.event(()) |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
210 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
211 |
} |
34453 | 212 |
|
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
213 |
private def edit_document(changes: StructureChange) = Swing.now |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
214 |
{ |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
215 |
val old_id = document_id |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
216 |
document_id = Isabelle.plugin.id() |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
217 |
document_versions += document_id |
34453 | 218 |
|
34533
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
219 |
val removes = |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
220 |
for (cmd <- changes.removed_commands) yield { |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
221 |
commands -= cmd.id |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
222 |
if (cmd.state_id != null) states -= cmd.state_id |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
223 |
(if (cmd.prev == null) document_id0 else cmd.prev.id) -> None |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
224 |
} |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
225 |
val inserts = |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
226 |
for (cmd <- changes.added_commands) yield { |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
227 |
commands += (cmd.id -> cmd) |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
228 |
process.define_command(cmd.id, isabelle_system.symbols.encode(cmd.content)) |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
229 |
(if (cmd.prev == null) document_id0 else cmd.prev.id) -> Some(cmd.id) |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
230 |
} |
35308320713a
preliminary/failed attempt to use the new IsarDocument access model to the prover;
wenzelm
parents:
34509
diff
changeset
|
231 |
process.edit_document(old_id, document_id, removes.reverse ++ inserts) |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
232 |
} |
34453 | 233 |
} |