Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005598OCamlOCaml generalpublic2012-04-22 03:392014-01-22 14:33
Reportermottl 
Assigned Todoligez 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformAnyOSAnyOS VersionAny
Product Version3.12.1 
Target VersionFixed in Version4.00.0+dev 
Summary0005598: Incompatibility between ocamllex and compiler
DescriptionIt seems ocamllex and the compiler once shared the same parsing code for OCaml-strings, but have since slightly diverged even though the manual states that they both use the same syntax.

lexer.mll for ocamllex defines "backslash_escapes" that are different from the inline pattern used in lexer.mll (rule "string") for the compiler: the latter adds a space character. Furthermore, ocamllex uses '\010' as a pattern for newlines where the compiler uses "newline", which also supports '\013' and DOS-newlines and has hence a different rule body.

ocamllex apparently has some catching up to do...
TagsNo tags attached.
Attached Files

- Relationships
related to 0006165closed Alterations to handling of \013 in source files breaking other tools 

-  Notes
(0007399)
doligez (administrator)
2012-05-02 16:45

For backslash-space, I've fixed ocamllex (commit 12418 in 4.00, commit 12419 in trunk).

For newlines, ocamllex supports both Unix and DOS because it ignores \013 and takes \010 as the newline character.

The \013-as-newline support in the compiler is a leftover from the last century (support for Mac OS 9), which will be removed from the compiler after the 4.00 release (commit 12420 in trunk).
(0007401)
mottl (reporter)
2012-05-02 17:07
edited on: 2012-05-02 17:10

It seems that the fix for this problem accidentally removed DOS-style newlines ("\013\010") rather than the Mac OS 9 "\013" from the definition of "newline" in parsing/lexer.mll. I guess this would lead to double counting of lines on Windows.

Update: "\013" may then probably need to be added to the definition of "blank" instead?

(0007407)
doligez (administrator)
2012-05-03 13:52

Oops, thanks for catching this. Fixed (commit 12424 in trunk).

I don't think we want to add \013 to the definition of blank. I don't see any point in allowing it in source files.
(0010828)
doligez (administrator)
2014-01-22 14:24

I've changed my mind. Now I think the perfect solution would be to utterly ignore all occurrences of \013 everywhere in the source file (even within identifiers or string literals). But that would be too much work for such a small problem.
(0010829)
doligez (administrator)
2014-01-22 14:33

Following the fix of 0006165, I have brought ocamllex in line with ocamlc/ocamlopt (commit 14406 in trunk).

- Issue History
Date Modified Username Field Change
2012-04-22 03:39 mottl New Issue
2012-05-02 16:41 doligez Assigned To => doligez
2012-05-02 16:41 doligez Status new => assigned
2012-05-02 16:45 doligez Note Added: 0007399
2012-05-02 16:45 doligez Status assigned => closed
2012-05-02 16:45 doligez Resolution open => fixed
2012-05-02 16:45 doligez Fixed in Version => 4.00.0+dev
2012-05-02 17:07 mottl Note Added: 0007401
2012-05-02 17:07 mottl Status closed => feedback
2012-05-02 17:07 mottl Resolution fixed => reopened
2012-05-02 17:10 mottl Note Edited: 0007401 View Revisions
2012-05-03 13:52 doligez Note Added: 0007407
2012-05-03 13:52 doligez Status feedback => resolved
2012-05-03 13:52 doligez Resolution reopened => fixed
2013-09-08 10:53 gasche Relationship added related to 0006165
2014-01-22 14:24 doligez Note Added: 0010828
2014-01-22 14:33 doligez Note Added: 0010829


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker