summaryrefslogtreecommitdiffstats
path: root/camlp4
diff options
context:
space:
mode:
authorJérémie Dimino <jeremie@dimino.org>2013-05-23 15:12:04 +0000
committerJérémie Dimino <jeremie@dimino.org>2013-05-23 15:12:04 +0000
commit8cee3aedf99a9649d96088e7ce31951b0fac0268 (patch)
treee739d6eaa06af1c118017378d8d86e0e9cf90918 /camlp4
parent3beb7a5da092284677f3f58540d7c0c6374619f2 (diff)
Revert addition of raw literals to the parsetree
It turns out it is not possible to have the exact raw representation since a constant does not always correspond to exactly one token, so there is no point in making the AST more complex. git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13702 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'camlp4')
-rw-r--r--camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml36
-rw-r--r--camlp4/boot/Camlp4.ml36
2 files changed, 36 insertions, 36 deletions
diff --git a/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml b/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml
index e7ee20079..ccf2373df 100644
--- a/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml
+++ b/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml
@@ -487,19 +487,19 @@ module Make (Ast : Sig.Camlp4Ast) = struct
;
value rec deep_mkrangepat loc c1 c2 =
- if c1 = c2 then mkghpat loc (Ppat_constant (Const_char c1, Char.escaped c1))
+ if c1 = c2 then mkghpat loc (Ppat_constant (Const_char c1))
else
mkghpat loc
- (Ppat_or (mkghpat loc (Ppat_constant (Const_char c1, Char.escaped c1)))
+ (Ppat_or (mkghpat loc (Ppat_constant (Const_char c1)))
(deep_mkrangepat loc (Char.chr (Char.code c1 + 1)) c2))
;
value rec mkrangepat loc c1 c2 =
if c1 > c2 then mkrangepat loc c2 c1
- else if c1 = c2 then mkpat loc (Ppat_constant (Const_char c1, Char.escaped c1))
+ else if c1 = c2 then mkpat loc (Ppat_constant (Const_char c1))
else
mkpat loc
- (Ppat_or (mkghpat loc (Ppat_constant (Const_char c1, Char.escaped c1)))
+ (Ppat_or (mkghpat loc (Ppat_constant (Const_char c1)))
(deep_mkrangepat loc (Char.chr (Char.code c1 + 1)) c2))
;
@@ -545,24 +545,24 @@ module Make (Ast : Sig.Camlp4Ast) = struct
"this is not a constructor, it cannot be applied in a pattern" ]
| PaArr loc p -> mkpat loc (Ppat_array (List.map patt (list_of_patt p [])))
| PaChr loc s ->
- mkpat loc (Ppat_constant (Const_char (char_of_char_token loc s), s))
+ mkpat loc (Ppat_constant (Const_char (char_of_char_token loc s)))
| PaInt loc s ->
let i = try int_of_string s with [
Failure _ -> error loc "Integer literal exceeds the range of representable integers of type int"
- ] in mkpat loc (Ppat_constant (Const_int i, s))
+ ] in mkpat loc (Ppat_constant (Const_int i))
| PaInt32 loc s ->
let i32 = try Int32.of_string s with [
Failure _ -> error loc "Integer literal exceeds the range of representable integers of type int32"
- ] in mkpat loc (Ppat_constant (Const_int32 i32, s))
+ ] in mkpat loc (Ppat_constant (Const_int32 i32))
| PaInt64 loc s ->
let i64 = try Int64.of_string s with [
Failure _ -> error loc "Integer literal exceeds the range of representable integers of type int64"
- ] in mkpat loc (Ppat_constant (Const_int64 i64, s))
+ ] in mkpat loc (Ppat_constant (Const_int64 i64))
| PaNativeInt loc s ->
let nati = try Nativeint.of_string s with [
Failure _ -> error loc "Integer literal exceeds the range of representable integers of type nativeint"
- ] in mkpat loc (Ppat_constant (Const_nativeint nati, s))
- | PaFlo loc s -> mkpat loc (Ppat_constant (Const_float (remove_underscores s), s))
+ ] in mkpat loc (Ppat_constant (Const_nativeint nati))
+ | PaFlo loc s -> mkpat loc (Ppat_constant (Const_float (remove_underscores s)))
| PaLab loc _ _ -> error loc "labeled pattern not allowed here"
| PaOlb loc _ _ | PaOlbi loc _ _ _ -> error loc "labeled pattern not allowed here"
| PaOrp loc p1 p2 -> mkpat loc (Ppat_or (patt p1) (patt p2))
@@ -580,7 +580,7 @@ module Make (Ast : Sig.Camlp4Ast) = struct
let is_closed = if wildcards = [] then Closed else Open in
mkpat loc (Ppat_record (List.map mklabpat ps, is_closed))
| PaStr loc s ->
- mkpat loc (Ppat_constant (Const_string (string_of_string_token loc s) None, s))
+ mkpat loc (Ppat_constant (Const_string (string_of_string_token loc s) None))
| <:patt@loc< ($p1$, $p2$) >> ->
mkpat loc (Ppat_tuple
(List.map patt (list_of_patt p1 (list_of_patt p2 []))))
@@ -763,14 +763,14 @@ value varify_constructors var_names =
mkexp loc e
| ExAsr loc e -> mkexp loc (Pexp_assert (expr e))
| ExChr loc s ->
- mkexp loc (Pexp_constant (Const_char (char_of_char_token loc s), s))
+ mkexp loc (Pexp_constant (Const_char (char_of_char_token loc s)))
| ExCoe loc e t1 t2 ->
let t1 =
match t1 with
[ <:ctyp<>> -> None
| t -> Some (ctyp t) ] in
mkexp loc (Pexp_coerce (expr e) t1 (ctyp t2))
- | ExFlo loc s -> mkexp loc (Pexp_constant (Const_float (remove_underscores s), s))
+ | ExFlo loc s -> mkexp loc (Pexp_constant (Const_float (remove_underscores s)))
| ExFor loc i e1 e2 df el ->
let e3 = ExSeq loc el in
mkexp loc (Pexp_for (with_loc i loc) (expr e1) (expr e2) (mkdirection df) (expr e3))
@@ -788,19 +788,19 @@ value varify_constructors var_names =
| ExInt loc s ->
let i = try int_of_string s with [
Failure _ -> error loc "Integer literal exceeds the range of representable integers of type int"
- ] in mkexp loc (Pexp_constant (Const_int i, s))
+ ] in mkexp loc (Pexp_constant (Const_int i))
| ExInt32 loc s ->
let i32 = try Int32.of_string s with [
Failure _ -> error loc "Integer literal exceeds the range of representable integers of type int32"
- ] in mkexp loc (Pexp_constant (Const_int32 i32, s))
+ ] in mkexp loc (Pexp_constant (Const_int32 i32))
| ExInt64 loc s ->
let i64 = try Int64.of_string s with [
Failure _ -> error loc "Integer literal exceeds the range of representable integers of type int64"
- ] in mkexp loc (Pexp_constant (Const_int64 i64, s))
+ ] in mkexp loc (Pexp_constant (Const_int64 i64))
| ExNativeInt loc s ->
let nati = try Nativeint.of_string s with [
Failure _ -> error loc "Integer literal exceeds the range of representable integers of type nativeint"
- ] in mkexp loc (Pexp_constant (Const_nativeint nati, s))
+ ] in mkexp loc (Pexp_constant (Const_nativeint nati))
| ExLab loc _ _ -> error loc "labeled expression not allowed here"
| ExLaz loc e -> mkexp loc (Pexp_lazy (expr e))
| ExLet loc rf bi e ->
@@ -843,7 +843,7 @@ value varify_constructors var_names =
(Pexp_apply (mkexp loc (Pexp_ident (array_function loc "String" "get")))
[("", expr e1); ("", expr e2)])
| ExStr loc s ->
- mkexp loc (Pexp_constant (Const_string (string_of_string_token loc s) None, s))
+ mkexp loc (Pexp_constant (Const_string (string_of_string_token loc s) None))
| ExTry loc e a -> mkexp loc (Pexp_try (expr e) (match_case a []))
| <:expr@loc< ($e1$, $e2$) >> ->
mkexp loc (Pexp_tuple (List.map expr (list_of_expr e1 (list_of_expr e2 []))))
diff --git a/camlp4/boot/Camlp4.ml b/camlp4/boot/Camlp4.ml
index 53064f6e9..85a18d949 100644
--- a/camlp4/boot/Camlp4.ml
+++ b/camlp4/boot/Camlp4.ml
@@ -14664,10 +14664,10 @@ module Struct =
let rec deep_mkrangepat loc c1 c2 =
if c1 = c2
- then mkghpat loc (Ppat_constant (Const_char c1, Char.escaped c1))
+ then mkghpat loc (Ppat_constant (Const_char c1))
else
mkghpat loc
- (Ppat_or ((mkghpat loc (Ppat_constant (Const_char c1, Char.escaped c1))),
+ (Ppat_or ((mkghpat loc (Ppat_constant (Const_char c1))),
(deep_mkrangepat loc (Char.chr ((Char.code c1) + 1)) c2)))
let rec mkrangepat loc c1 c2 =
@@ -14675,10 +14675,10 @@ module Struct =
then mkrangepat loc c2 c1
else
if c1 = c2
- then mkpat loc (Ppat_constant (Const_char c1, Char.escaped c1))
+ then mkpat loc (Ppat_constant (Const_char c1))
else
mkpat loc
- (Ppat_or ((mkghpat loc (Ppat_constant (Const_char c1, Char.escaped c1))),
+ (Ppat_or ((mkghpat loc (Ppat_constant (Const_char c1))),
(deep_mkrangepat loc (Char.chr ((Char.code c1) + 1))
c2)))
@@ -14732,7 +14732,7 @@ module Struct =
mkpat loc (Ppat_array (List.map patt (list_of_patt p [])))
| PaChr (loc, s) ->
mkpat loc
- (Ppat_constant (Const_char (char_of_char_token loc s), s))
+ (Ppat_constant (Const_char (char_of_char_token loc s)))
| PaInt (loc, s) ->
let i =
(try int_of_string s
@@ -14740,7 +14740,7 @@ module Struct =
| Failure _ ->
error loc
"Integer literal exceeds the range of representable integers of type int")
- in mkpat loc (Ppat_constant (Const_int i, s))
+ in mkpat loc (Ppat_constant (Const_int i))
| PaInt32 (loc, s) ->
let i32 =
(try Int32.of_string s
@@ -14748,7 +14748,7 @@ module Struct =
| Failure _ ->
error loc
"Integer literal exceeds the range of representable integers of type int32")
- in mkpat loc (Ppat_constant (Const_int32 i32, s))
+ in mkpat loc (Ppat_constant (Const_int32 i32))
| PaInt64 (loc, s) ->
let i64 =
(try Int64.of_string s
@@ -14756,7 +14756,7 @@ module Struct =
| Failure _ ->
error loc
"Integer literal exceeds the range of representable integers of type int64")
- in mkpat loc (Ppat_constant (Const_int64 i64, s))
+ in mkpat loc (Ppat_constant (Const_int64 i64))
| PaNativeInt (loc, s) ->
let nati =
(try Nativeint.of_string s
@@ -14764,10 +14764,10 @@ module Struct =
| Failure _ ->
error loc
"Integer literal exceeds the range of representable integers of type nativeint")
- in mkpat loc (Ppat_constant (Const_nativeint nati, s))
+ in mkpat loc (Ppat_constant (Const_nativeint nati))
| PaFlo (loc, s) ->
mkpat loc
- (Ppat_constant (Const_float (remove_underscores s), s))
+ (Ppat_constant (Const_float (remove_underscores s)))
| PaLab (loc, _, _) ->
error loc "labeled pattern not allowed here"
| PaOlb (loc, _, _) | PaOlbi (loc, _, _, _) ->
@@ -14794,7 +14794,7 @@ module Struct =
| PaStr (loc, s) ->
mkpat loc
(Ppat_constant
- (Const_string (string_of_string_token loc s, None), s))
+ (Const_string (string_of_string_token loc s, None)))
| Ast.PaTup (loc, (Ast.PaCom (_, p1, p2))) ->
mkpat loc
(Ppat_tuple
@@ -14995,7 +14995,7 @@ module Struct =
| ExAsr (loc, e) -> mkexp loc (Pexp_assert (expr e))
| ExChr (loc, s) ->
mkexp loc
- (Pexp_constant (Const_char (char_of_char_token loc s), s))
+ (Pexp_constant (Const_char (char_of_char_token loc s)))
| ExCoe (loc, e, t1, t2) ->
let t1 =
(match t1 with | Ast.TyNil _ -> None | t -> Some (ctyp t))
@@ -15004,7 +15004,7 @@ module Struct =
(Pexp_coerce ((expr e), t1, ctyp t2))
| ExFlo (loc, s) ->
mkexp loc
- (Pexp_constant (Const_float (remove_underscores s), s))
+ (Pexp_constant (Const_float (remove_underscores s)))
| ExFor (loc, i, e1, e2, df, el) ->
let e3 = ExSeq (loc, el)
in
@@ -15036,7 +15036,7 @@ module Struct =
| Failure _ ->
error loc
"Integer literal exceeds the range of representable integers of type int")
- in mkexp loc (Pexp_constant (Const_int i, s))
+ in mkexp loc (Pexp_constant (Const_int i))
| ExInt32 (loc, s) ->
let i32 =
(try Int32.of_string s
@@ -15044,7 +15044,7 @@ module Struct =
| Failure _ ->
error loc
"Integer literal exceeds the range of representable integers of type int32")
- in mkexp loc (Pexp_constant (Const_int32 i32, s))
+ in mkexp loc (Pexp_constant (Const_int32 i32))
| ExInt64 (loc, s) ->
let i64 =
(try Int64.of_string s
@@ -15052,7 +15052,7 @@ module Struct =
| Failure _ ->
error loc
"Integer literal exceeds the range of representable integers of type int64")
- in mkexp loc (Pexp_constant (Const_int64 i64, s))
+ in mkexp loc (Pexp_constant (Const_int64 i64))
| ExNativeInt (loc, s) ->
let nati =
(try Nativeint.of_string s
@@ -15060,7 +15060,7 @@ module Struct =
| Failure _ ->
error loc
"Integer literal exceeds the range of representable integers of type nativeint")
- in mkexp loc (Pexp_constant (Const_nativeint nati, s))
+ in mkexp loc (Pexp_constant (Const_nativeint nati))
| ExLab (loc, _, _) ->
error loc "labeled expression not allowed here"
| ExLaz (loc, e) -> mkexp loc (Pexp_lazy (expr e))
@@ -15113,7 +15113,7 @@ module Struct =
| ExStr (loc, s) ->
mkexp loc
(Pexp_constant
- (Const_string (string_of_string_token loc s, None), s))
+ (Const_string (string_of_string_token loc s, None)))
| ExTry (loc, e, a) ->
mkexp loc (Pexp_try ((expr e), (match_case a [])))
| Ast.ExTup (loc, (Ast.ExCom (_, e1, e2))) ->