src/Pure/General/path.scala
changeset 73360 4123fca23296
parent 73359 d8a0e996614b
child 73361 ef8c9b3d5355
equal deleted inserted replaced
73359:d8a0e996614b 73360:4123fca23296
    52       case (Parent, Basic(_) :: rest) => rest
    52       case (Parent, Basic(_) :: rest) => rest
    53       case _ => y :: xs
    53       case _ => y :: xs
    54     }
    54     }
    55 
    55 
    56   private def norm_elems(elems: List[Elem]): List[Elem] =
    56   private def norm_elems(elems: List[Elem]): List[Elem] =
    57     (elems :\ (Nil: List[Elem]))(apply_elem)
    57     elems.foldRight(Nil: List[Elem])(apply_elem)
    58 
    58 
    59   private def implode_elem(elem: Elem, short: Boolean): String =
    59   private def implode_elem(elem: Elem, short: Boolean): String =
    60     elem match {
    60     elem match {
    61       case Root("") => ""
    61       case Root("") => ""
    62       case Root(s) => "//" + s
    62       case Root(s) => "//" + s
   172   def is_absolute: Boolean = elems.nonEmpty && elems.last.isInstanceOf[Path.Root]
   172   def is_absolute: Boolean = elems.nonEmpty && elems.last.isInstanceOf[Path.Root]
   173   def is_root: Boolean = elems match { case List(Path.Root(_)) => true case _ => false }
   173   def is_root: Boolean = elems match { case List(Path.Root(_)) => true case _ => false }
   174   def is_basic: Boolean = elems match { case List(Path.Basic(_)) => true case _ => false }
   174   def is_basic: Boolean = elems match { case List(Path.Basic(_)) => true case _ => false }
   175   def starts_basic: Boolean = elems.nonEmpty && elems.last.isInstanceOf[Path.Basic]
   175   def starts_basic: Boolean = elems.nonEmpty && elems.last.isInstanceOf[Path.Basic]
   176 
   176 
   177   def +(other: Path): Path = new Path((other.elems :\ elems)(Path.apply_elem))
   177   def +(other: Path): Path = new Path(other.elems.foldRight(elems)(Path.apply_elem))
   178 
   178 
   179 
   179 
   180   /* implode */
   180   /* implode */
   181 
   181 
   182   private def gen_implode(short: Boolean): String =
   182   private def gen_implode(short: Boolean): String =