equal
deleted
inserted
replaced
4 Algebra of file-system paths: basic POSIX notation, extended by named |
4 Algebra of file-system paths: basic POSIX notation, extended by named |
5 roots (e.g. //foo) and variables (e.g. $BAR). |
5 roots (e.g. //foo) and variables (e.g. $BAR). |
6 */ |
6 */ |
7 |
7 |
8 package isabelle |
8 package isabelle |
|
9 |
|
10 |
|
11 import scala.util.matching.Regex |
9 |
12 |
10 |
13 |
11 object Path |
14 object Path |
12 { |
15 { |
13 /* path elements */ |
16 /* path elements */ |
137 else { |
140 else { |
138 val (prfx, s) = split_path |
141 val (prfx, s) = split_path |
139 prfx + Path.basic(s + "." + e) |
142 prfx + Path.basic(s + "." + e) |
140 } |
143 } |
141 |
144 |
|
145 private val Ext = new Regex("(.*)\\.([^.]*)") |
|
146 |
|
147 def split_ext: (Path, String) = |
|
148 { |
|
149 val (prefix, base) = split_path |
|
150 base match { |
|
151 case Ext(b, e) => (prefix + Path.basic(b), e) |
|
152 case _ => (Path.basic(base), "") |
|
153 } |
|
154 } |
|
155 |
142 |
156 |
143 /* expand */ |
157 /* expand */ |
144 |
158 |
145 def expand: Path = |
159 def expand: Path = |
146 { |
160 { |