src/Tools/jEdit/src/prover/Command.scala
author immler@in.tum.de
Sun, 07 Dec 2008 15:39:50 +0100
changeset 34398 2d40e4067c37
parent 34397 86daaf5db016
child 34399 5b8b89b7e597
permissions -rw-r--r--
no syserr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
     1
package isabelle.prover
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
     2
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
     3
import isabelle.proofdocument.Token
34393
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
     4
import isabelle.jedit.Plugin
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
     5
import isabelle.{ YXML, XML }
34393
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
     6
import sidekick.{SideKickParsedData}
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
     7
import sidekick.enhanced.SourceAsset
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
     8
import javax.swing.text.Position
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
     9
import javax.swing.tree.DefaultMutableTreeNode
34318
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
object Command {
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    12
  object Phase extends Enumeration {
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    13
    val UNPROCESSED = Value("UNPROCESSED")
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    14
    val FINISHED = Value("FINISHED")
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    15
    val REMOVE = Value("REMOVE")
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    16
    val REMOVED = Value("REMOVED")
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    17
    val FAILED = Value("FAILED")
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    18
  }
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    19
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    20
  private var nextId : Long = 0
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    21
  def generateId : Long = {
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    22
    nextId = nextId + 1
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    23
    return nextId
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    24
  }
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    25
  
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    26
  def idFromString(id : String) = Long.unbox(java.lang.Long.valueOf(id, 36))
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    27
}
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    28
34397
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
    29
class Command(val document : Document, val first : Token[Command], val last : Token[Command]) {
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    30
  import Command._
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    31
  
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    32
  {
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    33
    var t = first
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    34
    while(t != null) {
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    35
      t.command = this
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    36
      t = if (t == last) null else t.next
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    37
    }
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    38
  }
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    39
  
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    40
  val id : Long = generateId
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    41
  var phase = Phase.UNPROCESSED
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    42
	
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    43
  var results = Nil : List[XML.Tree]
34391
7b5f44553aaf ugly fine-grained buffer markup
immler@in.tum.de
parents: 34388
diff changeset
    44
7b5f44553aaf ugly fine-grained buffer markup
immler@in.tum.de
parents: 34388
diff changeset
    45
  //offsets relative to first.start!
7b5f44553aaf ugly fine-grained buffer markup
immler@in.tum.de
parents: 34388
diff changeset
    46
  class Status(val kind : String,val start : Int, val stop : Int ) { }
7b5f44553aaf ugly fine-grained buffer markup
immler@in.tum.de
parents: 34388
diff changeset
    47
  var statuses = Nil : List[Status]
34397
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
    48
  def statuses_xml = XML.Elem("statuses", List(), statuses.map (s => XML.Text(s.kind + ": " + s.start + "-" + s.stop + "\n")))
34391
7b5f44553aaf ugly fine-grained buffer markup
immler@in.tum.de
parents: 34388
diff changeset
    49
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    50
  def idString = java.lang.Long.toString(id, 36)
34397
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
    51
  def results_xml = XML.document(results match {
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    52
                                case Nil => XML.Elem("message", List(), List())
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    53
                                case List(elem) => elem
34391
7b5f44553aaf ugly fine-grained buffer markup
immler@in.tum.de
parents: 34388
diff changeset
    54
                                case _ =>
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    55
                                  XML.Elem("messages", List(), List(results.first,
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    56
                                                                    results.last))
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    57
                              }, "style")
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    58
  def addResult(tree : XML.Tree) {
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    59
    results = results ::: List(tree)
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    60
  }
34393
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    61
  
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    62
  val root_node = {
34397
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
    63
    val content = document.getContent(this)
34393
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    64
    val ra = new RelativeAsset(this, 0, stop - start, "command", content)
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    65
    new DefaultMutableTreeNode(ra)
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    66
  }
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    67
34393
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    68
  // does cand fit into node?
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    69
  private def fitting(cand : DefaultMutableTreeNode, node : DefaultMutableTreeNode) : boolean = {
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    70
    val node_asset = node.getUserObject.asInstanceOf[RelativeAsset]
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    71
    val n_start = node_asset.rel_start
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    72
    val n_end = node_asset.rel_end
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    73
    val cand_asset = cand.getUserObject.asInstanceOf[RelativeAsset]
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    74
    val c_start = cand_asset.rel_start
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    75
    val c_end = cand_asset.rel_end
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    76
    return c_start >= n_start && c_end <= n_end
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    77
  }
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    78
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    79
  def insert_node(new_node : DefaultMutableTreeNode, node : DefaultMutableTreeNode) {
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    80
    assert(fitting(new_node, node))
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    81
    val children = node.children
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    82
    while (children.hasMoreElements){
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    83
      val child = children.nextElement.asInstanceOf[DefaultMutableTreeNode]
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    84
      if(fitting(new_node, child)) {
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    85
        insert_node(new_node, child)
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    86
      }
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    87
    }
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    88
    if(new_node.getParent == null){
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    89
      while(children.hasMoreElements){
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    90
        val child = children.nextElement.asInstanceOf[DefaultMutableTreeNode]
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    91
        if(fitting(child, new_node)) {
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    92
          node.remove(child.asInstanceOf[DefaultMutableTreeNode])
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    93
          new_node.add(child)
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    94
        }
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    95
      }
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    96
      node.add(new_node)
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    97
    }
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    98
  }
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
    99
f0e1608a774f basic tree structure for sidekick
immler@in.tum.de
parents: 34391
diff changeset
   100
 def addStatus(tree : XML.Tree) {
34397
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   101
    val (state, attr) = tree match { case XML.Elem("message", _, XML.Elem(kind, attr, _) :: _) => (kind, attr)
34391
7b5f44553aaf ugly fine-grained buffer markup
immler@in.tum.de
parents: 34388
diff changeset
   102
                                   case _ => null}
34397
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   103
    if (phase != Phase.REMOVED && phase != Phase.REMOVE) {
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   104
      state match {
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   105
        case "finished" =>
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   106
          phase = Phase.FINISHED
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   107
        case "unprocessed" =>
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   108
          phase = Phase.UNPROCESSED
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   109
        case "failed" =>
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   110
          phase = Phase.FAILED
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   111
        case "removed" =>
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   112
          // TODO: never lose information on command + id ??
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   113
          //document.prover.commands.removeKey(st.idString)
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   114
          phase = Phase.REMOVED
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   115
        case _ =>
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   116
          //process attributes:
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   117
          var markup_begin = -1
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   118
          var markup_end = -1
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   119
          for((n, a) <- attr) {
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   120
            if(n.equals("offset")) markup_begin = Int.unbox(java.lang.Integer.valueOf(a)) - 1
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   121
            if(n.equals("end_offset")) markup_end = Int.unbox(java.lang.Integer.valueOf(a)) - 1
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   122
          }
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   123
          if(markup_begin > -1 && markup_end > -1){
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   124
            statuses = new Status(state, markup_begin, markup_end) :: statuses
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   125
            val markup_content = content.substring(markup_begin, markup_end)
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   126
            val asset = new RelativeAsset(this, markup_begin, markup_end, state, markup_content)
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   127
            val new_node = new DefaultMutableTreeNode(asset)
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   128
            insert_node(new_node, root_node)
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   129
          } else {
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   130
            System.err.println("addStatus - ignored: " + tree)
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   131
          }
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   132
      }
34391
7b5f44553aaf ugly fine-grained buffer markup
immler@in.tum.de
parents: 34388
diff changeset
   133
    }
7b5f44553aaf ugly fine-grained buffer markup
immler@in.tum.de
parents: 34388
diff changeset
   134
  }
7b5f44553aaf ugly fine-grained buffer markup
immler@in.tum.de
parents: 34388
diff changeset
   135
34397
86daaf5db016 handle statuses in Command
immler@in.tum.de
parents: 34396
diff changeset
   136
  def content = document.getContent(this)
34396
de809360c51d command property: offset relative to start of command
immler@in.tum.de
parents: 34394
diff changeset
   137
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   138
  def next = if (last.next != null) last.next.command else null
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   139
  def previous = if (first.previous != null) first.previous.command else null
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   140
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   141
  def start = first start
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   142
  def stop = last stop
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   143
  
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   144
  def properStart = start
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   145
  def properStop = {
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   146
    var i = last
34388
23b8351ecbbe arbitrary type for tokens
immler@in.tum.de
parents: 34318
diff changeset
   147
    while (i != first && i.kind.equals(Token.Kind.COMMENT))
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   148
      i = i.previous
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   149
    i.stop
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   150
  }  	
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
   151
}