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

'Invalid macro application' from unbalanced parentheses in comment #27

Open
dariusf opened this issue Mar 9, 2016 · 2 comments
Open

Comments

@dariusf
Copy link

dariusf commented Mar 9, 2016

This seems to have been caused by the parser changes in 1.3.0. Minimal repro:

a(* ( *)

Here's the error message.

$ cppo main.ml
Error: File "main.ml", line 1, characters 0-2
Error: Invalid macro application

The lack of a space before the opening parenthesis of the comment is significant: when added, this parses.

@mjambon
Copy link
Member

mjambon commented Mar 9, 2016

Thanks for reporting the issue.

The immediate workaround is to place a space before the comment.

a( is parsed as a single token, unlike a (, and won't identify the beginning of a comment. We could introduce a new rule that would identify a(* as a single token and return a followed by a comment. It may break existing code that contains something like a(*) although this is discouraged in favor of a( * ). Perhaps we could produce a warning or an error message that gives a tentative solution.

@dariusf
Copy link
Author

dariusf commented Mar 12, 2016

Maybe the warning could appear in the a(*) case, since that's the one you're discouraging. Anyway, thanks for the suggestion, we'll just use the workaround for now.

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

2 participants