src/Pure/General/scan.scala
changeset 73357 31d4274f32de
parent 73340 0ffcad1f6130
child 73359 d8a0e996614b
equal deleted inserted replaced
73356:819f6033fb4e 73357:31d4274f32de
     6 
     6 
     7 package isabelle
     7 package isabelle
     8 
     8 
     9 
     9 
    10 import scala.annotation.tailrec
    10 import scala.annotation.tailrec
    11 import scala.collection.{IndexedSeq, Traversable, TraversableOnce}
    11 import scala.collection.IndexedSeq
    12 import scala.util.matching.Regex
    12 import scala.util.matching.Regex
    13 import scala.util.parsing.input.{OffsetPosition, Position => InputPosition,
    13 import scala.util.parsing.input.{OffsetPosition, Position => InputPosition,
    14   Reader, CharSequenceReader, PagedSeq}
    14   Reader, CharSequenceReader, PagedSeq}
    15 import scala.util.parsing.combinator.RegexParsers
    15 import scala.util.parsing.combinator.RegexParsers
    16 import java.io.{File => JFile, BufferedInputStream, FileInputStream, InputStream}
    16 import java.io.{File => JFile, BufferedInputStream, FileInputStream, InputStream}
   388           }
   388           }
   389           else tree
   389           else tree
   390         new Lexicon(extend(rep, 0))
   390         new Lexicon(extend(rep, 0))
   391       }
   391       }
   392 
   392 
   393     def ++ (elems: TraversableOnce[String]): Lexicon = (this /: elems)(_ + _)
   393     def ++ (elems: IterableOnce[String]): Lexicon = (this /: elems)(_ + _)
   394 
   394 
   395     def ++ (other: Lexicon): Lexicon =
   395     def ++ (other: Lexicon): Lexicon =
   396       if (this eq other) this
   396       if (this eq other) this
   397       else if (is_empty) other
   397       else if (is_empty) other
   398       else this ++ other.raw_iterator
   398       else this ++ other.raw_iterator
   399 
   399 
   400     def -- (remove: Traversable[String]): Lexicon =
   400     def -- (remove: Iterable[String]): Lexicon =
   401       if (remove.exists(contains))
   401       if (remove.exists(contains))
   402         Lexicon.empty ++ iterator.filterNot(a => remove.exists(b => a == b))
   402         Lexicon.empty ++ iterator.filterNot(a => remove.exists(b => a == b))
   403       else this
   403       else this
   404 
   404 
   405 
   405