src/Pure/PIDE/command.scala
changeset 48754 c2c1e5944536
parent 48745 184158734fba
child 48922 6f3ccfa7818d
equal deleted inserted replaced
48753:5e57a6f24cdb 48754:c2c1e5944536
   109   {
   109   {
   110     def same(that: Perspective): Boolean =
   110     def same(that: Perspective): Boolean =
   111     {
   111     {
   112       val cmds1 = this.commands
   112       val cmds1 = this.commands
   113       val cmds2 = that.commands
   113       val cmds2 = that.commands
   114       require(cmds1.forall(_.is_defined))
   114       require(!cmds1.exists(_.is_undefined))
   115       require(cmds2.forall(_.is_defined))
   115       require(!cmds2.exists(_.is_undefined))
   116       cmds1.length == cmds2.length &&
   116       cmds1.length == cmds2.length &&
   117         (cmds1.iterator zip cmds2.iterator).forall({ case (c1, c2) => c1.id == c2.id })
   117         (cmds1.iterator zip cmds2.iterator).forall({ case (c1, c2) => c1.id == c2.id })
   118     }
   118     }
   119   }
   119   }
   120 }
   120 }
   126     val span: Command.Span,
   126     val span: Command.Span,
   127     val source: String)
   127     val source: String)
   128 {
   128 {
   129   /* classification */
   129   /* classification */
   130 
   130 
   131   def is_defined: Boolean = id != Document.no_id
   131   def is_undefined: Boolean = id == Document.no_id
       
   132   val is_unparsed: Boolean = span.exists(_.is_unparsed)
       
   133   val is_unfinished: Boolean = span.exists(_.is_unfinished)
   132 
   134 
   133   val is_ignored: Boolean = !span.exists(_.is_proper)
   135   val is_ignored: Boolean = !span.exists(_.is_proper)
   134   val is_malformed: Boolean = !is_ignored && (!span.head.is_command || span.exists(_.is_unparsed))
   136   val is_malformed: Boolean = !is_ignored && (!span.head.is_command || span.exists(_.is_error))
   135   def is_command: Boolean = !is_ignored && !is_malformed
   137   def is_command: Boolean = !is_ignored && !is_malformed
   136 
   138 
   137   def name: String =
   139   def name: String =
   138     span.find(_.is_command) match { case Some(tok) => tok.source case _ => "" }
   140     span.find(_.is_command) match { case Some(tok) => tok.source case _ => "" }
   139 
   141