src/Tools/jEdit/src/proofdocument/session.scala
changeset 34799 0330a4284a9b
parent 34795 c97335b7e8c3
child 34800 297a3324944a
equal deleted inserted replaced
34798:db0da30bca26 34799:0330a4284a9b
    25 
    25 
    26   /* main actor */
    26   /* main actor */
    27 
    27 
    28   private case class Start(args: List[String])
    28   private case class Start(args: List[String])
    29   private case object Stop
    29   private case object Stop
       
    30 
       
    31   @volatile private var _keywords = new Outer_Keyword(system.symbols)
       
    32   def keywords = _keywords
    30 
    33 
    31   private var prover: Isabelle_Process with Isar_Document = null
    34   private var prover: Isabelle_Process with Isar_Document = null
    32   private var prover_ready = false
    35   private var prover_ready = false
    33 
    36 
    34   private val session_actor = actor {
    37   private val session_actor = actor {
    76   /* selected state */  // FIXME!? races!?
    79   /* selected state */  // FIXME!? races!?
    77 
    80 
    78   private var _selected_state: Command = null
    81   private var _selected_state: Command = null
    79   def selected_state = _selected_state
    82   def selected_state = _selected_state
    80   def selected_state_=(state: Command) { _selected_state = state; results.event(state) }
    83   def selected_state_=(state: Command) { _selected_state = state; results.event(state) }
    81 
       
    82 
       
    83   /* outer syntax keywords and completion */
       
    84 
       
    85   @volatile private var _command_decls = Map[String, String]()
       
    86   def command_decls() = _command_decls
       
    87 
       
    88   @volatile private var _keyword_decls = Set[String]()
       
    89   def keyword_decls() = _keyword_decls
       
    90 
       
    91   @volatile private var _completion = new Completion + system.symbols
       
    92   def completion() = _completion
       
    93 
       
    94   def is_command_keyword(s: String): Boolean = command_decls().contains(s)
       
    95 
    84 
    96 
    85 
    97   /* document state information */
    86   /* document state information */
    98 
    87 
    99   @volatile private var states = Map[Isar_Document.State_ID, Command_State]()
    88   @volatile private var states = Map[Isar_Document.State_ID, Command_State]()
   172               case None =>
   161               case None =>
   173             }
   162             }
   174 
   163 
   175           // command and keyword declarations
   164           // command and keyword declarations
   176           case XML.Elem(Markup.COMMAND_DECL, (Markup.NAME, name) :: (Markup.KIND, kind) :: _, _) =>
   165           case XML.Elem(Markup.COMMAND_DECL, (Markup.NAME, name) :: (Markup.KIND, kind) :: _, _) =>
   177             _command_decls += (name -> kind)
   166             _keywords += (name, kind)
   178             _completion += name
       
   179           case XML.Elem(Markup.KEYWORD_DECL, (Markup.NAME, name) :: _, _) =>
   167           case XML.Elem(Markup.KEYWORD_DECL, (Markup.NAME, name) :: _, _) =>
   180             _keyword_decls += name
   168             _keywords += name
   181             _completion += name
       
   182 
   169 
   183           // process ready (after initialization)
   170           // process ready (after initialization)
   184           case XML.Elem(Markup.READY, _, _) => prover_ready = true
   171           case XML.Elem(Markup.READY, _, _) => prover_ready = true
   185 
   172 
   186         case _ =>
   173         case _ =>