Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006087OCaml-for ocamlbuild use 14:512016-12-07 11:34
Assigned Togasche 
PrioritynormalSeverityminorReproducibilityhave not tried
PlatformOSOS Version
Product Version4.00.0 
Target Version4.02.0+devFixed in Version 
Summary0006087: ocamlbuild, improve _tags parsing and error report
DescriptionGreat to see there are people willing to improve ocamlbuild !

So here are a few things:

1) The following _tags file works:

true : package(gg), \

2) But not the following one:

true : \
package(gg), package(vg)

3) Neither the following one:

true \
: package(gg), package(vg)

Could we

Either be more consistant in the \ treatement or even better, avoid it altogether (I don't know if it would render the grammar ambiguous)

Have a gnu-style error messages ( [^])
so that we can easily jump to the location of the error from our editors. This is what is currently reported:

Lexical analysis error: _tags: Bad key in configuration line at line 1 (from file: "_tags")

Attached Files

- Relationships
related to 0005212resolved ocamlbuild does not warn for bad input 
related to 0004598closeddoligez Loc.to_string: bad support for multiple lines 
related to 0006518acknowledged Consider supporting GNU-style error messages 

-  Notes
gasche (developer)
2013-07-26 18:40

Thanks, this kind of bug report is indeed helpful to give us a concrete repro case to work on.

(a) should definitely be fixed (\ should not change the validity of the syntax unless it splits words)

I'm not sure about (b) GNU style error messages; I think we should rather follow the global convention of the OCaml compiler error messages (which means that if you run ocamlbuild from any place that knows how to parse those messages, such as Emacs "compile" mode, you'll get the location parsed as well). Enabling GNU style error messages instead of the current one OCaml uses is a distribution-wide issue that has been discussed in the past (I think having patches for this would be interesting, but it's not on my radar of urgent things to do right now).
meyer (developer)
2013-07-26 19:04

Regarding (b): Maybe we can provide a flag for GNU message format. It's additional maintainance cost but probably relaively minimal.

I'd do the same for the rest of the toolchain where it's possible, but not that that I don't like the current situation.
dbuenzli (reporter)
2013-07-26 19:12

(b) Having what the general toolchain does is fine with me and I'd rather avoid adding new flags to the tools for that kind of details.
meyer (developer)
2013-07-26 19:38

OK, we should then be fixing it, so it behaves like the rest of the system, along with the newline separator fix. Thanks for the report.
meyer (developer)
2013-07-26 19:41

Let's tentatively schedule the fix for the release, it might slip away, but at least better support for Emacs mode is important, and comes at minimal cost and risk.

The other interesing way of dealing it with newlines would be via identation, so the spaces in the begining of line would be significant. (my mistake I am reporting it at the moment)
dbuenzli (reporter)
2013-07-29 16:20

Note error also occurs when you have a space (0x20) at the end of a _tags file line. Could you also check that please.

> hexdump -C _tags
00000000 74 72 75 65 3a 20 70 61 63 6b 61 67 65 28 67 67 |true: package(gg|
00000010 29 20 |) |
> ocamlbuild test.native
Lexical analysis error: _tags: Bad values in configuration line at line 1 (from file: "_tags")
doligez (administrator)
2013-08-19 16:42

Note for the future: the toolchain's error report format will have to be changed at some point because it gives: (filename, line, char1, char2) where char1 and char2 relative to the beginning of line, while emacs wants (filename, line1, char1, line2, char2) where char2 is relative to the beginning of line2. (see 0004598)
dbuenzli (reporter)
2013-08-19 17:00

Since it has to change anyways why not switch GNU style error messages (which are detected by default by emacs's compilation mode) ?
doligez (administrator)
2014-07-24 22:55

That's what I intend to do.
gasche (developer)
2014-08-21 07:41
edited on: 2014-08-21 07:41

Regarding the _tags syntax: I went with (a) make escape-newline placement more consistent, because I don't want to try to guess whether a given blurb is a pattern or a tag (it depends on whether a ':' follows, which does not cope very well with the fact that those are currently implemented with no-readahead lexers).

Patch 4.02@15118 makes all three examples accepted by ocamlbuild. These are in fact the only cases that have changed (escaped newlines before and after the ':'), so there were no consistency improvements in the rest of the grammar. But I didn't see any other place where accepting escaped newline would be natural.

The computation of error positions in presence of escaped newlines was also improved.

I think we can consider this particular PR resolved. If it doesn't already exists, I will open a new PR regarding the error-message format (so that we don't lose track of this issue), and you should feel free to open new PRs for other inconsistencies in the ocamlbuild parsing behavior.

- Issue History
Date Modified Username Field Change
2013-07-26 14:51 dbuenzli New Issue
2013-07-26 18:35 gasche Relationship added related to 0005212
2013-07-26 18:40 gasche Note Added: 0009869
2013-07-26 18:40 gasche Assigned To => gasche
2013-07-26 18:40 gasche Status new => confirmed
2013-07-26 18:40 gasche Assigned To gasche =>
2013-07-26 18:41 gasche Assigned To => gasche
2013-07-26 18:41 gasche Status confirmed => assigned
2013-07-26 18:41 gasche Target Version => 4.01.1+dev
2013-07-26 19:04 meyer Note Added: 0009871
2013-07-26 19:12 dbuenzli Note Added: 0009872
2013-07-26 19:38 meyer Note Added: 0009873
2013-07-26 19:38 meyer Target Version 4.01.1+dev => 4.01.0+dev
2013-07-26 19:41 meyer Note Added: 0009874
2013-07-28 09:05 gasche Tag Attached: junior_job
2013-07-29 16:20 dbuenzli Note Added: 0009984
2013-08-19 16:42 doligez Note Added: 0010199
2013-08-19 16:42 doligez Target Version 4.01.0+dev => 4.01.1+dev
2013-08-19 16:42 doligez Relationship added related to 0004598
2013-08-19 17:00 dbuenzli Note Added: 0010202
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-07-24 22:55 doligez Note Added: 0011908
2014-08-21 07:41 gasche Note Added: 0012033
2014-08-21 07:41 gasche Status assigned => resolved
2014-08-21 07:41 gasche Resolution open => fixed
2014-08-21 07:41 gasche Note Edited: 0012033 View Revisions
2014-08-21 07:47 gasche Relationship added related to 0006518
2016-12-07 11:34 xleroy Status resolved => closed
2017-02-23 16:34 doligez Category OCamlbuild (the tool) => for ocamlbuild use [^]
2017-02-23 16:44 doligez Category for ocamlbuild use [^] => -for ocamlbuild use [^]

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker