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: 5409 Reporter: nb Assigned to:@protz Status: closed (set by @xavierleroy on 2015-12-11T18:04:25Z) Resolution: not a bug Priority: normal Severity: minor Version: 3.12.0 Category: ~DO NOT USE (was: OCaml general) Monitored by: nb
Bug description
Issue similar to 0002954 but in ocaml parser.
When a parse_error exception is thrown during parsing the grammar with ocaml (caml-toplevel), lexbuf.lex_start_p returns the position. In the returned value pos_lnum and pos_bol are incorrect while pos_cnum represents the real position in the file where exception was thrown.
Please find the attached project. It is large enough but the issue-related code is contained in the file use.ml . Run make, then parse any text file in order to have a parsing error. Currently use.ml contains the line
Printf.printf "Wrong character %s at position %i." (Lexing.lexeme lexbuf) (errorPosition.pos_cnum)
If change errorPosition.pos_cnum to errorPosition.pos_lnum, the printed string will look like "Wrong character ... at position 0."
I'm not sure there's an issue here. I did not read your grammar through but you seem to have a parsing error at the very beginning of the file (I would suggest compiling and running your parser with menhir --trace to see what's happening).
pos_lnum is 1 : the line number is indeed 1
pos_cnum is 0 : since the error is at the very beginning of the file, this is column 0 (columns always start with 0)
pos_bol is 0 : we're still at offset 0, i.e. the beginning of the file.
Tested with OCaml version 4.01.0+dev0 (2012-03-12)
Original bug ID: 5409
Reporter: nb
Assigned to: @protz
Status: closed (set by @xavierleroy on 2015-12-11T18:04:25Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 3.12.0
Category: ~DO NOT USE (was: OCaml general)
Monitored by: nb
Bug description
Issue similar to 0002954 but in ocaml parser.
When a parse_error exception is thrown during parsing the grammar with ocaml (caml-toplevel), lexbuf.lex_start_p returns the position. In the returned value pos_lnum and pos_bol are incorrect while pos_cnum represents the real position in the file where exception was thrown.
File attachments
The text was updated successfully, but these errors were encountered: