src/Tools/jEdit/src/prover/Prover.scala
changeset 34458 e2aa32bb73c0
parent 34456 14367c0715e8
child 34459 b08299e7bbe6
equal deleted inserted replaced
34457:19bd801975a3 34458:e2aa32bb73c0
    51         }
    51         }
    52       }
    52       }
    53     }
    53     }
    54     else {
    54     else {
    55       val tree = YXML.parse_failsafe(isabelle_symbols.decode(r.result))
    55       val tree = YXML.parse_failsafe(isabelle_symbols.decode(r.result))
    56       if (st == null || (st.phase != Command.Phase.REMOVED && st.phase != Command.Phase.REMOVE)) {
    56       if (st == null || (st.status != Command.Status.REMOVED && st.status != Command.Status.REMOVE)) {
    57         r.kind match {
    57         r.kind match {
    58 
    58 
    59           case IsabelleProcess.Kind.STATUS =>
    59           case IsabelleProcess.Kind.STATUS =>
    60             //{{{ handle all kinds of status messages here
    60             //{{{ handle all kinds of status messages here
    61             tree match {
    61             tree match {
    63                 for (elem <- elems) {
    63                 for (elem <- elems) {
    64                   elem match {
    64                   elem match {
    65                     //{{{
    65                     //{{{
    66                     // command status
    66                     // command status
    67                     case XML.Elem(Markup.FINISHED, _, _) =>
    67                     case XML.Elem(Markup.FINISHED, _, _) =>
    68                       st.phase = Command.Phase.FINISHED
    68                       st.status = Command.Status.FINISHED
    69                       command_change(st)
    69                       command_change(st)
    70                     case XML.Elem(Markup.UNPROCESSED, _, _) =>
    70                     case XML.Elem(Markup.UNPROCESSED, _, _) =>
    71                       st.phase = Command.Phase.UNPROCESSED
    71                       st.status = Command.Status.UNPROCESSED
    72                       command_change(st)
    72                       command_change(st)
    73                     case XML.Elem(Markup.FAILED, _, _) =>
    73                     case XML.Elem(Markup.FAILED, _, _) =>
    74                       st.phase = Command.Phase.FAILED
    74                       st.status = Command.Status.FAILED
    75                       command_change(st)
    75                       command_change(st)
    76                     case XML.Elem(Markup.DISPOSED, _, _) =>
    76                     case XML.Elem(Markup.DISPOSED, _, _) =>
    77                       document.prover.commands.removeKey(st.id)
    77                       document.prover.commands.removeKey(st.id)
    78                       st.phase = Command.Phase.REMOVED
    78                       st.status = Command.Status.REMOVED
    79                       command_change(st)
    79                       command_change(st)
    80 
    80 
    81                     // command and keyword declarations
    81                     // command and keyword declarations
    82                     case XML.Elem(Markup.COMMAND_DECL, (Markup.NAME, name) :: _, _) =>
    82                     case XML.Elem(Markup.COMMAND_DECL, (Markup.NAME, name) :: _, _) =>
    83                       command_decls += name
    83                       command_decls += name
   105               case _ =>
   105               case _ =>
   106             }
   106             }
   107             //}}}
   107             //}}}
   108 
   108 
   109           case IsabelleProcess.Kind.ERROR if st != null =>
   109           case IsabelleProcess.Kind.ERROR if st != null =>
   110             if (st.phase != Command.Phase.REMOVED && st.phase != Command.Phase.REMOVE)
   110             if (st.status != Command.Status.REMOVED && st.status != Command.Status.REMOVE)
   111               st.phase = Command.Phase.FAILED
   111               st.status = Command.Status.FAILED
   112             st.add_result(tree)
   112             st.add_result(tree)
   113             command_change(st)
   113             command_change(st)
   114 
   114 
   115           case IsabelleProcess.Kind.WRITELN | IsabelleProcess.Kind.PRIORITY
   115           case IsabelleProcess.Kind.WRITELN | IsabelleProcess.Kind.PRIORITY
   116             | IsabelleProcess.Kind.WARNING if st != null =>
   116             | IsabelleProcess.Kind.WARNING if st != null =>
   151       activated.event(())
   151       activated.event(())
   152     }
   152     }
   153   }
   153   }
   154 
   154 
   155   private def send(cmd: Command) {
   155   private def send(cmd: Command) {
   156     cmd.phase = Command.Phase.UNPROCESSED
   156     cmd.status = Command.Status.UNPROCESSED
   157     commands.put(cmd.id, cmd)
   157     commands.put(cmd.id, cmd)
   158 
   158 
   159     val props = new Properties
   159     val props = new Properties
   160     props.setProperty(Markup.ID, cmd.id)
   160     props.setProperty(Markup.ID, cmd.id)
   161     props.setProperty(Markup.OFFSET, "1")
   161     props.setProperty(Markup.OFFSET, "1")
   164     process.create_command(props, content)
   164     process.create_command(props, content)
   165     process.insert_command(if (cmd.previous == null) "" else cmd.previous.id, cmd.id)
   165     process.insert_command(if (cmd.previous == null) "" else cmd.previous.id, cmd.id)
   166   }
   166   }
   167 
   167 
   168   def remove(cmd: Command) {
   168   def remove(cmd: Command) {
   169     cmd.phase = Command.Phase.REMOVE
   169     cmd.status = Command.Status.REMOVE
   170     process.remove_command(cmd.id)
   170     process.remove_command(cmd.id)
   171   }
   171   }
   172 }
   172 }