Permalink
Browse files

[fix] compiler, parser: Since we compile to js the parser could not c…

…heck the int overflow (todo add backend check)
  • Loading branch information...
1 parent 003fc42 commit 9664b2c39b058913c158492537c26361dccbca62 @BourgerieQuentin BourgerieQuentin committed Aug 7, 2012
View
1 compiler/opalang/classic_syntax/opa_lexer.trx
@@ -139,6 +139,7 @@ strfloat <-
/ [-]? decimal_number exponent $_
int <- Opa_parser.pos:pos strint:s {{ try int_of_string s with Failure "int_of_string" -> error_int_overflow pos }}
+bint <- Opa_parser.pos:pos strint:s {{ Big_int.big_int_of_int64 (Int64.of_string s) }}
float <- strfloat {{ float_of_string __1 }}
int3 <- ([2]([5][0-5] $_ / [0-4][0-9] $_) $_ / [0-1][0-9][0-9] $_ / [0-9][0-9]? $_):s {{ s }}
View
4 compiler/opalang/classic_syntax/opa_parser.trx
@@ -1055,7 +1055,7 @@ opa_in_braces <- lbrace expr:e rbrace {{ e }}
*)
;/** constant **/
const <- float:f {{ CFloat f }}
- / int:i {{ CInt (Big_int.big_int_of_int i) }}
+ / bint:i {{ CInt i }}
/ string:s {{ CString s }}
(**
@@ -1250,7 +1250,7 @@ _fail <- &. &(!.) . $
*)
string <- Opa_lexer.string
char <- Opa_lexer.char
-int <- Opa_lexer.int
+bint <- Opa_lexer.bint
float <- Opa_lexer.float
spacing<- Opa_lexer.spacing
strict_spacing<- Opa_lexer.strict_spacing
View
1 compiler/opalang/js_syntax/opa_lexer.trx
@@ -155,6 +155,7 @@ strfloat <-
/ [-]? decimal_number exponent $_
int <- Opa_parser.pos:pos strint:s {{ try int_of_string s with Failure "int_of_string" -> error_int_overflow pos }}
+bint <- Opa_parser.pos:pos strint:s {{ Big_int.big_int_of_int64 (Int64.of_string s) }}
float <- strfloat {{ float_of_string __1 }}
int3 <- ([2]([5][0-5] $_ / [0-4][0-9] $_) $_ / [0-1][0-9][0-9] $_ / [0-9][0-9]? $_):s {{ s }}
View
4 compiler/opalang/js_syntax/opa_parser.trx
@@ -1299,7 +1299,7 @@ directive <-
*)
;/** constant **/
const <- float:f {{ CFloat f }}
- / int:i {{ CInt (Big_int.big_int_of_int i) }}
+ / bint:i {{ CInt i }}
/ string:s {{ CString s }}
@@ -1466,7 +1466,7 @@ separator <- (Opa_lexer.whitespace / Opa_lexer.opacomment)* (semic / Opa_lexer.n
*)
string <- Opa_lexer.string
char <- Opa_lexer.char
-int <- Opa_lexer.int
+bint <- Opa_lexer.bint
float <- Opa_lexer.float
spacing<- Opa_lexer.spacing
strict_spacing<- Opa_lexer.strict_spacing

0 comments on commit 9664b2c

Please sign in to comment.