Replaced ad-hoc advance function by Position.advance
authorberghofe
Sat, 15 Jan 2011 22:40:17 +0100
changeset 41584 2b07a4212d6d
parent 41583 12910b69684f
child 41585 45d7da4e4ccf
Replaced ad-hoc advance function by Position.advance
src/HOL/SPARK/Tools/fdl_lexer.ML
--- a/src/HOL/SPARK/Tools/fdl_lexer.ML	Sat Jan 15 21:24:15 2011 +0100
+++ b/src/HOL/SPARK/Tools/fdl_lexer.ML	Sat Jan 15 22:40:17 2011 +0100
@@ -74,25 +74,6 @@
 
 type chars = (string * Position.T) list;
 
-(* a variant of Position.advance (see Pure/General/position.ML) *)
-fun advance x pos =
-  let
-    fun incr i = i+1;
-    fun change_prop s f props = case Properties.get_int props s of
-        NONE => props
-      | SOME i => Properties.put (s, Int.toString (f i)) props;
-  in
-    pos |>
-    Position.properties_of |>
-    change_prop "offset" incr |>
-    (case x of
-       "\n" =>
-         change_prop "line" incr #>
-         change_prop "column" (K 1)
-     | _ => change_prop "column" incr) |>
-    Position.of_properties
-  end;
-
 fun is_char_eof ("", _) = true
   | is_char_eof _ = false;
 
@@ -101,7 +82,7 @@
 fun symbol (x : string, _ : Position.T) = x;
 
 fun explode_pos s pos = fst (fold_map (fn x => fn pos =>
-  ((x, pos), advance x pos)) (raw_explode s) pos);
+  ((x, pos), Position.advance x pos)) (raw_explode s) pos);
 
 
 (** scanners **)