You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 377 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
No. But it certainly is surprising, so explanations are in order.
The lexer from the Genlex module implements the "longest-match" rule,
meaning that "1-2" is read as "the integer 1" followed by "the integer -2".
parse_expr doesn't have a case for "an integer followed by an integer",
but it has one for "an integer", so it just reads the first integer (1)
and return this.
However, parse_expr "1 - 2" will do what you want, because the spaces
force the lexer to see "the integer 1", "the - sign", and "the integer 2".
This issue has been raised so many times that it should be in the FAQ
or maybe even in the tutorial.
Original bug ID: 377
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Temofey
Version: ocaml 3.01
OS: RedHat Linux 6.2
Submission from: as1.d-up.max234.ukrpack.net (195.230.153.129)
parse_expr "1+2";;
But
parse_expr "1-2";;
This is a bug?
The text was updated successfully, but these errors were encountered: