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

camlp4o lexes comments #3527

Closed
vicuna opened this issue Aug 13, 2002 · 2 comments
Closed

camlp4o lexes comments #3527

vicuna opened this issue Aug 13, 2002 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Aug 13, 2002

Original bug ID: 1322
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

I have the following experience with OCAML from cvs, updated in the last hour.

Put this text in foo.ml:

let yuck = 7;;
(*
[<'"asdf">];;
*)

Then give the command

ocamldep -pp camlp4o foo.ml

This gives the error

File "foo.ml", line 3, characters 0-23:
Lexing error: string not terminated
Preprocessing error

If I leave out the "-pp camlp4o", no error happens. If I omit the
single quote from foo.ml, no error happens.

I don't think a compiler should complain about the text in my
comments.

--
Tim Freeman
tim@fungible.com
GPG public key fingerprint ECDF 46F8 3B80 BB9E 575D 7180 76DF FE00 34B1 5C78

@vicuna
Copy link
Author

vicuna commented Aug 19, 2002

Comment author: administrator

Need to fix camlp4 lexer so that it skips comments like the ocaml lexer.

@vicuna
Copy link
Author

vicuna commented Aug 19, 2002

Comment author: administrator

Put this text in foo.ml:
let yuck = 7;;
(*
[<'"asdf">];;
*)

Then give the command
ocamldep -pp camlp4o foo.ml
This gives the error
File "foo.ml", line 3, characters 0-23:
Lexing error: string not terminated
Preprocessing error
If I leave out the "-pp camlp4o", no error happens. If I omit the
single quote from foo.ml, no error happens.
I don't think a compiler should complain about the text in my
comments.

Well, the compiler must do some amount of lexical analysis on your
comments, otherwise a ) inside a string literal inside a comment
would incorrectly terminate the comment. Consider: (
"*)" *)

You've found a case where the Camlp4 lexer behaves differently than
the default lexer. This will have to be fixed at some point.
It should be possible to work around the problem by putting a space
between ' and the string literal.

  • Xavier Leroy

@vicuna vicuna closed this as completed Jul 9, 2003
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant