equal
deleted
inserted
replaced
148 SOME s' => variable_elem s' |
148 SOME s' => variable_elem s' |
149 | NONE => basic_elem s)) |
149 | NONE => basic_elem s)) |
150 handle ERROR msg => cat_error msg ("The error(s) above occurred in " ^ quote str); |
150 handle ERROR msg => cat_error msg ("The error(s) above occurred in " ^ quote str); |
151 |
151 |
152 val (roots, raw_elems) = |
152 val (roots, raw_elems) = |
153 (case take_prefix (equal "") (space_explode "/" str) |>> length of |
153 (case chop_prefix (equal "") (space_explode "/" str) |>> length of |
154 (0, es) => ([], es) |
154 (0, es) => ([], es) |
155 | (1, es) => ([Root ""], es) |
155 | (1, es) => ([Root ""], es) |
156 | (_, []) => ([Root ""], []) |
156 | (_, []) => ([Root ""], []) |
157 | (_, e :: es) => ([root_elem e], es)); |
157 | (_, e :: es) => ([root_elem e], es)); |
158 val elems = raw_elems |> filter_out (fn c => c = "" orelse c = ".") |> map explode_elem; |
158 val elems = raw_elems |> filter_out (fn c => c = "" orelse c = ".") |> map explode_elem; |
188 |
188 |
189 fun ext "" = I |
189 fun ext "" = I |
190 | ext e = split_path (fn (prfx, s) => append prfx (basic (s ^ "." ^ e))); |
190 | ext e = split_path (fn (prfx, s) => append prfx (basic (s ^ "." ^ e))); |
191 |
191 |
192 val split_ext = split_path (fn (prfx, s) => apfst (append prfx) |
192 val split_ext = split_path (fn (prfx, s) => apfst (append prfx) |
193 (case take_suffix (fn c => c <> ".") (raw_explode s) of |
193 (case chop_suffix (fn c => c <> ".") (raw_explode s) of |
194 ([], _) => (Path [Basic s], "") |
194 ([], _) => (Path [Basic s], "") |
195 | (cs, e) => (Path [Basic (implode (take (length cs - 1) cs))], implode e))); |
195 | (cs, e) => (Path [Basic (implode (take (length cs - 1) cs))], implode e))); |
196 |
196 |
197 |
197 |
198 (* expand variables *) |
198 (* expand variables *) |