56800
|
1 |
/* Title: Pure/General/long_name.scala
|
|
2 |
Author: Makarius
|
|
3 |
|
|
4 |
Long names.
|
|
5 |
*/
|
|
6 |
|
|
7 |
package isabelle
|
|
8 |
|
|
9 |
|
75393
|
10 |
object Long_Name {
|
56800
|
11 |
val separator = "."
|
|
12 |
val separator_char = '.'
|
|
13 |
|
|
14 |
def is_qualified(name: String): Boolean = name.contains(separator_char)
|
|
15 |
|
|
16 |
def implode(names: List[String]): String = names.mkString(separator)
|
66923
|
17 |
def explode(name: String): List[String] = space_explode(separator_char, name)
|
56800
|
18 |
|
|
19 |
def qualify(qual: String, name: String): String =
|
|
20 |
if (qual == "" || name == "") name
|
|
21 |
else qual + separator + name
|
|
22 |
|
65440
|
23 |
def qualifier(name: String): String =
|
|
24 |
if (name == "") ""
|
|
25 |
else implode(explode(name).dropRight(1))
|
|
26 |
|
56800
|
27 |
def base_name(name: String): String =
|
|
28 |
if (name == "") ""
|
|
29 |
else explode(name).last
|
|
30 |
}
|