camlspotter avatar camlspotter committed f766743 Draft

support of bigint

Comments (0)

Files changed (5)

     | Null -> 
 	pp_print_string fmt "null"
     | Int i -> pp_print_string fmt (string_of_int i)
+    | Bigint i -> pp_print_string fmt i
     | Float f -> pp_print_string fmt (string_of_json_float allow_nan f)
     | String s -> fquote_json_string fmt s
 	
     | Null -> 
 	add_string buf "null"
     | Int i -> add_string buf (string_of_int i)
+    | Bigint i -> add_string buf i
     | Float f -> add_string buf (string_of_json_float allow_nan f)
     | String s -> bquote_json_string buf s
 	
     | Bool b -> fprintf fmt "%s" (if b then "true" else "false")
     | Null -> fprintf fmt "null"
     | Int i -> fprintf fmt "%i" i
+    | Bigint i -> fprintf fmt "%s" i
     | Float f -> fprint_float allow_nan fmt f
     | String s -> fquote_json_string fmt s
 	
   let make_int big_int_mode s =
     try INT (int_of_string s)
     with _ -> 
-      if big_int_mode then STRING s
+      if big_int_mode then BIGINT s
       else json_error (s ^ " is too large for OCaml's type int, sorry")
 
   let utf8_of_point i = Ulib.UTF8.init 1 (fun _ -> Ulib.UChar.chr i)
 %}
 %token <string> STRING
 %token <int> INT
+%token <string> BIGINT
 %token <float> FLOAT
 %token <bool> BOOL
 %token OBJSTART OBJEND ARSTART AREND NULL COMMA COLON
 | BOOL { Bool $1 }
 | NULL { Null }
 | INT  { Int $1 }
+| BIGINT  { Bigint $1 }
 | FLOAT { Float $1 }
 ;
 pair_list:
   | Array of json_type list
   | String of string
   | Int of int
+  | Bigint of string
   | Float of float
   | Bool of bool
   | Null
       Bool true -> "true"
     | Bool false -> "false"
     | Int i -> string_of_int i
+    | Bigint i -> i
     | Float x -> string_of_float x
     | String s -> sprintf "%S" s
     | Object _ -> "an object"
   | Array of json_type list
   | String of string
   | Int of int
+  | Bigint of string
   | Float of float
   | Bool of bool
   | Null
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.