diff options
author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2000-04-16 12:38:54 +0000 |
---|---|---|
committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2000-04-16 12:38:54 +0000 |
commit | 5bb9c6f60adc1e765094e420212a9f82009b9930 (patch) | |
tree | f1c2cec0fe92e09589d747ab270da5b45eff8220 | |
parent | 993933180b4aae49180bdf8b90595fe5a7443916 (diff) |
fun -> f
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3091 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | tools/ocaml299to3.ml | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/ocaml299to3.ml b/tools/ocaml299to3.ml index f2aaea392..b4d1e9b0c 100644 --- a/tools/ocaml299to3.ml +++ b/tools/ocaml299to3.ml @@ -38,7 +38,8 @@ let convert buffer = and stop = Lexing.lexeme_end buffer and last_token, last_start, last_stop = !last in begin match token with - | LABEL l -> + | LABEL l0 -> + let l = if l0 = "fun" then "f" else l0 in begin match last_token with | PREFIXOP "?(" -> modified := true; @@ -50,12 +51,20 @@ let convert buffer = | QUESTION | LPAREN | LBRACE | SEMI | MINUSGREATER | EQUAL | COLON | COLONGREATER | VAL | MUTABLE | EXTERNAL | METHOD | OF -> - () + if l0 = "fun" then begin + modified := true; + copy_input start; + Buffer.add_string output_buffer l; + Buffer.add_char output_buffer ':'; + input_pos := stop + end | _ -> modified := true; copy_input start; Buffer.add_char output_buffer '~'; - copy_input stop + Buffer.add_string output_buffer l; + Buffer.add_char output_buffer ':'; + input_pos := stop end | LABELID l -> modified := true; @@ -117,7 +126,8 @@ let _ = print_endline "Convert Objective Caml 2.99 O'Labl-style labels in implementation files to"; print_endline - "a syntax compatible with version 3. Other syntactic changes are not handled."; + "a syntax compatible with version 3. Also `fun:' labels are replaced by `f:'."; + print_endline "Other syntactic changes are not handled."; print_endline "Old files are renamed to <file>.bak."; print_endline "Interface files do not need label syntax conversion."; exit 0 |