Skip to content

Commit

Permalink
fix for overflow/underflow numbers #2
Browse files Browse the repository at this point in the history
  • Loading branch information
gabryon99 committed Dec 20, 2021
1 parent 6834bab commit d02f47a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/scanner.mll
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
raise (Lexing_error (Location.to_lexeme_position lexbuf, msg))

let check_num_int32 num lexbuf =
if num > max_int || num < min_int then
if (abs num) > 0x7FFFFFFF then
let msg = Printf.sprintf "The number \"%d\" is not a 32 bit integer!\n" num in
raise (Lexing_error (Location.to_lexeme_position lexbuf, msg))
else
Expand Down

0 comments on commit d02f47a

Please sign in to comment.