Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocamllex doesn't preserve line directives #5765

Closed
vicuna opened this issue Sep 23, 2012 · 2 comments
Closed

ocamllex doesn't preserve line directives #5765

vicuna opened this issue Sep 23, 2012 · 2 comments
Milestone

Comments

@vicuna
Copy link

vicuna commented Sep 23, 2012

Original bug ID: 5765
Reporter: @mjambon
Status: closed (set by @damiendoligez on 2013-07-11T15:51:40Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.00.0
Target version: 4.01.0+dev
Fixed in version: 4.01.0+dev
Category: tools (ocaml{lex,yacc,dep,debug,...})

Bug description

When ocamllex encounters a line directive in its input, it does not take it into account when outputting new line directives.

This is problematic for ocamllex files that are generated from a template or extracted from a larger source file.

Interestingly, errors in the input of ocamllex are reported correctly, obeying line directives.

Steps to reproduce

martin@m1 ~/tmp $ cat toto.mll

100 "toto.mlx"

rule f = parse
'x' { true }
| "" { false }

martin@m1 ~/tmp $ ocamllex -v
The OCaml lexer generator, version 4.00.0

martin@m1 ~/tmp $ ocamllex toto.mll
2 states, 257 transitions, table size 1040 bytes

martin@m1 ~/tmp $ grep mlx toto.ml || echo nope.
nope.

@vicuna
Copy link
Author

vicuna commented Sep 29, 2012

Comment author: @damiendoligez

It's even stranger than you think: the line numbers are reported correctly, but not the file name.
Try this:

$ cat toto.mll

100 "toto.mlx"

rule f = parse
'x' { true }
| "" { false+1 }
$ ocamllex toto.mll
2 states, 257 transitions, table size 1040 bytes
$ ocamlc -c toto.ml
File "toto.mll", line 102, characters 7-12:
Error: This expression has type bool but an expression was expected of type
int

@vicuna
Copy link
Author

vicuna commented Jul 11, 2013

Comment author: @damiendoligez

Fixed in 4.01 branch (rev 13887).

@vicuna vicuna closed this as completed Jul 11, 2013
@vicuna vicuna added the tools label Mar 14, 2019
@vicuna vicuna added this to the 4.01.0 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant