| Anonymous | Login | Signup for a new account | 2013-06-19 03:32 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||
| 0003930 | OCaml | OCaml general | public | 2005-12-21 11:42 | 2008-01-22 17:24 | |||
| Reporter | aballier | |||||||
| Assigned To | ||||||||
| Priority | normal | Severity | feature | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | 3.09.0 | |||||||
| Target Version | Fixed in Version | 3.11+dev | ||||||
| Summary | 0003930: Wish: Helper function for maintaining lexer position info | |||||||
| Description | The code required to maintain the line/col info in a lexer is identical in almost any lexer you can imagine. I propose that we add a function to Lexing called "start_next_line" (or any other sensible name) that can be called in a lexer action to update the position info after a line ending has been reached. For example: rule tokenize = parse '\n' { start_next_line lexbuf; tokenize lexbuf } | . . . The code is simple: let start_next_line lexbuf = let lcp = lexbuf.lex_curr_p in lexbuf.lex_curr_p <- { lcp with pos_lnum = lcp.pos_lnum + 1; pos_bol = lcp.pos_cnum; } I've attached a patch against lexing.ml and lexing.mli that implements this, including ocamldoc comments. | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0003459) anonymous (viewer) 2005-12-21 11:44 |
By the way, I reported this. n8gray /at/ caltech \dot\ edu |
|
(0004433) doligez (manager) 2008-01-22 17:24 |
Done in 3.11+dev10 under the name "Lexing.new_line". |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2005-12-21 11:42 | anonymous | New Issue | |
| 2005-12-21 11:42 | anonymous | File Added: lexing_start_line-3.09.patch | |
| 2005-12-21 11:44 | anonymous | Note Added: 0003459 | |
| 2006-01-05 14:26 | doligez | Status | new => acknowledged |
| 2008-01-22 17:24 | doligez | Note Added: 0004433 | |
| 2008-01-22 17:24 | doligez | Reporter | anonymous => aballier |
| 2008-01-22 17:24 | doligez | Status | acknowledged => closed |
| 2008-01-22 17:24 | doligez | Resolution | open => fixed |
| 2008-01-22 17:24 | doligez | Fixed in Version | => 3.11+dev |
| Copyright © 2000 - 2011 MantisBT Group |