tuned;
authorwenzelm
Fri Mar 07 16:50:42 2014 +0100 (2014-03-07)
changeset 5598036fd4981c119
parent 55979 06cb126f30ba
child 55981 66739f41d5b2
tuned;
src/Pure/General/scan.scala
     1.1 --- a/src/Pure/General/scan.scala	Fri Mar 07 16:00:45 2014 +0100
     1.2 +++ b/src/Pure/General/scan.scala	Fri Mar 07 16:50:42 2014 +0100
     1.3 @@ -7,6 +7,7 @@
     1.4  package isabelle
     1.5  
     1.6  
     1.7 +import scala.annotation.tailrec
     1.8  import scala.collection.{IndexedSeq, TraversableOnce}
     1.9  import scala.collection.immutable.PagedSeq
    1.10  import scala.util.parsing.input.{OffsetPosition, Position => InputPosition, Reader}
    1.11 @@ -323,14 +324,15 @@
    1.12      private def lookup(str: CharSequence): Option[(Boolean, Lexicon.Tree)] =
    1.13      {
    1.14        val len = str.length
    1.15 -      def look(tree: Lexicon.Tree, tip: Boolean, i: Int): Option[(Boolean, Lexicon.Tree)] =
    1.16 +      @tailrec def look(tree: Lexicon.Tree, tip: Boolean, i: Int): Option[(Boolean, Lexicon.Tree)] =
    1.17        {
    1.18          if (i < len) {
    1.19            tree.branches.get(str.charAt(i)) match {
    1.20              case Some((s, tr)) => look(tr, !s.isEmpty, i + 1)
    1.21              case None => None
    1.22            }
    1.23 -        } else Some(tip, tree)
    1.24 +        }
    1.25 +        else Some(tip, tree)
    1.26        }
    1.27        look(rep, false, 0)
    1.28      }