src/Pure/General/long_name.scala
author wenzelm
Tue, 21 Jun 2022 14:51:17 +0200
changeset 75571 ac5e633ad9b3
parent 75393 87ebf5a50283
child 78961 11045cf2b5c2
permissions -rw-r--r--
tuned signature: more operations;

/*  Title:      Pure/General/long_name.scala
    Author:     Makarius

Long names.
*/

package isabelle


object Long_Name {
  val separator = "."
  val separator_char = '.'

  def is_qualified(name: String): Boolean = name.contains(separator_char)

  def implode(names: List[String]): String = names.mkString(separator)
  def explode(name: String): List[String] = space_explode(separator_char, name)

  def qualify(qual: String, name: String): String =
    if (qual == "" || name == "") name
    else qual + separator + name

  def qualifier(name: String): String =
    if (name == "") ""
    else implode(explode(name).dropRight(1))

  def base_name(name: String): String =
    if (name == "") ""
    else explode(name).last
}