324 { |
324 { |
325 val edits_yxml = |
325 val edits_yxml = |
326 { import XML.Encode._ |
326 { import XML.Encode._ |
327 def id: T[Command] = (cmd => long(cmd.id)) |
327 def id: T[Command] = (cmd => long(cmd.id)) |
328 def encode_edit(name: Document.Node.Name) |
328 def encode_edit(name: Document.Node.Name) |
329 : T[Document.Node.Edit[(Option[Command], Option[Command]), Command.Perspective]] = |
329 : T[Document.Node.Edit[Command.Edit, Command.Perspective]] = |
330 variant(List( |
330 variant(List( |
331 { case Document.Node.Clear() => (Nil, Nil) }, // FIXME unused !? |
331 { case Document.Node.Clear() => (Nil, Nil) }, // FIXME unused !? |
332 { case Document.Node.Edits(a) => (Nil, list(pair(option(id), option(id)))(a)) }, |
332 { case Document.Node.Edits(a) => (Nil, list(pair(option(id), option(id)))(a)) }, |
333 { case Document.Node.Deps(header) => |
333 { case Document.Node.Deps(header) => |
334 val dir = Isabelle_System.posix_path(name.dir) |
334 val dir = Isabelle_System.posix_path(name.dir) |
338 pair(Encode.string, pair(Encode.string, pair(list(Encode.string), |
338 pair(Encode.string, pair(Encode.string, pair(list(Encode.string), |
339 pair(list(pair(Encode.string, |
339 pair(list(pair(Encode.string, |
340 option(pair(pair(Encode.string, list(Encode.string)), list(Encode.string))))), |
340 option(pair(pair(Encode.string, list(Encode.string)), list(Encode.string))))), |
341 list(Encode.string)))))( |
341 list(Encode.string)))))( |
342 (dir, (name.theory, (imports, (keywords, header.errors)))))) }, |
342 (dir, (name.theory, (imports, (keywords, header.errors)))))) }, |
343 { case Document.Node.Perspective(a, b) => |
343 { case Document.Node.Perspective(a, b, c) => |
344 (bool_atom(a) :: b.commands.map(c => long_atom(c.id)), Nil) })) |
344 (bool_atom(a) :: b.commands.map(cmd => long_atom(cmd.id)), |
|
345 list(triple(id, Encode.string, list(Encode.string)))(c.dest)) })) |
345 def encode_edits: T[List[Document.Edit_Command]] = list((node_edit: Document.Edit_Command) => |
346 def encode_edits: T[List[Document.Edit_Command]] = list((node_edit: Document.Edit_Command) => |
346 { |
347 { |
347 val (name, edit) = node_edit |
348 val (name, edit) = node_edit |
348 pair(string, encode_edit(name))(name.node, edit) |
349 pair(string, encode_edit(name))(name.node, edit) |
349 }) |
350 }) |