aboutsummaryrefslogtreecommitdiff
path: root/parsing
diff options
context:
space:
mode:
authorPierre Roux2018-10-20 11:19:28 +0200
committerPierre Roux2019-04-02 00:02:12 +0200
commita95aacce6cc32726b494d4cc694da49eae86cf96 (patch)
tree07caf6e22fd6ae991786cec51bf304ecd011bc02 /parsing
parent1c8fd0f7134bcc295e31613c981ef4ef2c21af35 (diff)
Rename the INT token to NUMERAL
In anticipation of future uses of this token for non integer numerals.
Diffstat (limited to 'parsing')
-rw-r--r--parsing/cLexer.ml8
-rw-r--r--parsing/g_constr.mlg4
-rw-r--r--parsing/g_prim.mlg8
-rw-r--r--parsing/tok.ml16
-rw-r--r--parsing/tok.mli4
5 files changed, 20 insertions, 20 deletions
diff --git a/parsing/cLexer.ml b/parsing/cLexer.ml
index b81d89edf9..f2e51afff5 100644
--- a/parsing/cLexer.ml
+++ b/parsing/cLexer.ml
@@ -714,7 +714,7 @@ let rec next_token ~diff_mode loc s =
in
let ep = Stream.count s in
comment_stop bp;
- (INT (get_buff len), set_loc_pos loc bp ep)
+ (NUMERAL (get_buff len), set_loc_pos loc bp ep)
| Some '\"' ->
Stream.junk s;
let (loc, len) =
@@ -796,8 +796,8 @@ let token_text : type c. c Tok.p -> string = function
| PKEYWORD t -> "'" ^ t ^ "'"
| PIDENT None -> "identifier"
| PIDENT (Some t) -> "'" ^ t ^ "'"
- | PINT None -> "integer"
- | PINT (Some s) -> "'" ^ s ^ "'"
+ | PNUMERAL None -> "integer"
+ | PNUMERAL (Some s) -> "'" ^ s ^ "'"
| PSTRING None -> "string"
| PSTRING (Some s) -> "STRING \"" ^ s ^ "\""
| PLEFTQMARK -> "LEFTQMARK"
@@ -875,5 +875,5 @@ let terminal s =
let s = strip s in
let () = match s with "" -> failwith "empty token." | _ -> () in
if is_ident_not_keyword s then PIDENT (Some s)
- else if is_number s then PINT (Some s)
+ else if is_number s then PNUMERAL (Some s)
else PKEYWORD s
diff --git a/parsing/g_constr.mlg b/parsing/g_constr.mlg
index 9679474e81..0586dda555 100644
--- a/parsing/g_constr.mlg
+++ b/parsing/g_constr.mlg
@@ -305,7 +305,7 @@ GRAMMAR EXTEND Gram
atomic_constr:
[ [ g=global; i=instance -> { CAst.make ~loc @@ CRef (g,i) }
| s=sort -> { CAst.make ~loc @@ CSort s }
- | n=INT -> { CAst.make ~loc @@ CPrim (Numeral (SPlus,n)) }
+ | n=NUMERAL-> { CAst.make ~loc @@ CPrim (Numeral (SPlus,n)) }
| s=string -> { CAst.make ~loc @@ CPrim (String s) }
| "_" -> { CAst.make ~loc @@ CHole (None, IntroAnonymous, None) }
| "?"; "["; id=ident; "]" -> { CAst.make ~loc @@ CHole (None, IntroIdentifier id, None) }
@@ -424,7 +424,7 @@ GRAMMAR EXTEND Gram
| _ -> p
in
CAst.make ~loc @@ CPatCast (p, ty) }
- | n = INT -> { CAst.make ~loc @@ CPatPrim (Numeral (SPlus,n)) }
+ | n = NUMERAL-> { CAst.make ~loc @@ CPatPrim (Numeral (SPlus,n)) }
| s = string -> { CAst.make ~loc @@ CPatPrim (String s) } ] ]
;
impl_ident_tail:
diff --git a/parsing/g_prim.mlg b/parsing/g_prim.mlg
index 6247a12640..9c5fe2a71d 100644
--- a/parsing/g_prim.mlg
+++ b/parsing/g_prim.mlg
@@ -110,13 +110,13 @@ GRAMMAR EXTEND Gram
[ [ s = string -> { CAst.make ~loc s } ] ]
;
integer:
- [ [ i = INT -> { my_int_of_string loc i }
- | "-"; i = INT -> { - my_int_of_string loc i } ] ]
+ [ [ i = NUMERAL -> { my_int_of_string loc i }
+ | "-"; i = NUMERAL -> { - my_int_of_string loc i } ] ]
;
natural:
- [ [ i = INT -> { my_int_of_string loc i } ] ]
+ [ [ i = NUMERAL -> { my_int_of_string loc i } ] ]
;
bigint: (* Negative numbers are dealt with elsewhere *)
- [ [ i = INT -> { i } ] ]
+ [ [ i = NUMERAL -> { i } ] ]
;
END
diff --git a/parsing/tok.ml b/parsing/tok.ml
index 186d0502fc..36d319d543 100644
--- a/parsing/tok.ml
+++ b/parsing/tok.ml
@@ -17,7 +17,7 @@ type 'c p =
| PPATTERNIDENT : string option -> string p
| PIDENT : string option -> string p
| PFIELD : string option -> string p
- | PINT : string option -> string p
+ | PNUMERAL : string option -> string p
| PSTRING : string option -> string p
| PLEFTQMARK : unit p
| PBULLET : string option -> string p
@@ -30,7 +30,7 @@ let pattern_strings : type c. c p -> string * string option =
| PPATTERNIDENT s -> "PATTERNIDENT", s
| PIDENT s -> "IDENT", s
| PFIELD s -> "FIELD", s
- | PINT s -> "INT", s
+ | PNUMERAL s -> "INT", s
| PSTRING s -> "STRING", s
| PLEFTQMARK -> "LEFTQMARK", None
| PBULLET s -> "BULLET", s
@@ -42,7 +42,7 @@ type t =
| PATTERNIDENT of string
| IDENT of string
| FIELD of string
- | INT of string
+ | NUMERAL of string
| STRING of string
| LEFTQMARK
| BULLET of string
@@ -57,7 +57,7 @@ let equal_p (type a b) (t1 : a p) (t2 : b p) : (a, b) Util.eq option =
| PPATTERNIDENT s1, PPATTERNIDENT s2 when streq s1 s2 -> Some Util.Refl
| PIDENT s1, PIDENT s2 when streq s1 s2 -> Some Util.Refl
| PFIELD s1, PFIELD s2 when streq s1 s2 -> Some Util.Refl
- | PINT s1, PINT s2 when streq s1 s2 -> Some Util.Refl
+ | PNUMERAL s1, PNUMERAL s2 when streq s1 s2 -> Some Util.Refl
| PSTRING s1, PSTRING s2 when streq s1 s2 -> Some Util.Refl
| PLEFTQMARK, PLEFTQMARK -> Some Util.Refl
| PBULLET s1, PBULLET s2 when streq s1 s2 -> Some Util.Refl
@@ -71,7 +71,7 @@ let equal t1 t2 = match t1, t2 with
| PATTERNIDENT s1, PATTERNIDENT s2 -> string_equal s1 s2
| IDENT s1, IDENT s2 -> string_equal s1 s2
| FIELD s1, FIELD s2 -> string_equal s1 s2
-| INT s1, INT s2 -> string_equal s1 s2
+| NUMERAL s1, NUMERAL s2 -> string_equal s1 s2
| STRING s1, STRING s2 -> string_equal s1 s2
| LEFTQMARK, LEFTQMARK -> true
| BULLET s1, BULLET s2 -> string_equal s1 s2
@@ -98,7 +98,7 @@ let extract_string diff_mode = function
else s
| PATTERNIDENT s -> s
| FIELD s -> if diff_mode then "." ^ s else s
- | INT s -> s
+ | NUMERAL s -> s
| LEFTQMARK -> "?"
| BULLET s -> s
| QUOTATION(_,s) -> s
@@ -129,8 +129,8 @@ let match_pattern (type c) (p : c p) : t -> c =
| PPATTERNIDENT (Some s) -> (function PATTERNIDENT s' when seq s s' -> s' | _ -> err ())
| PFIELD None -> (function FIELD s -> s | _ -> err ())
| PFIELD (Some s) -> (function FIELD s' when seq s s' -> s' | _ -> err ())
- | PINT None -> (function INT s -> s | _ -> err ())
- | PINT (Some s) -> (function INT s' when seq s s' -> s' | _ -> err ())
+ | PNUMERAL None -> (function NUMERAL s -> s | _ -> err ())
+ | PNUMERAL (Some s) -> (function NUMERAL s' when seq s s' -> s' | _ -> err ())
| PSTRING None -> (function STRING s -> s | _ -> err ())
| PSTRING (Some s) -> (function STRING s' when seq s s' -> s' | _ -> err ())
| PLEFTQMARK -> (function LEFTQMARK -> () | _ -> err ())
diff --git a/parsing/tok.mli b/parsing/tok.mli
index 678877720d..2b3bb85174 100644
--- a/parsing/tok.mli
+++ b/parsing/tok.mli
@@ -15,7 +15,7 @@ type 'c p =
| PPATTERNIDENT : string option -> string p
| PIDENT : string option -> string p
| PFIELD : string option -> string p
- | PINT : string option -> string p
+ | PNUMERAL : string option -> string p
| PSTRING : string option -> string p
| PLEFTQMARK : unit p
| PBULLET : string option -> string p
@@ -29,7 +29,7 @@ type t =
| PATTERNIDENT of string
| IDENT of string
| FIELD of string
- | INT of string
+ | NUMERAL of string
| STRING of string
| LEFTQMARK
| BULLET of string