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

Support different "comment" conventions for different languages. #474

Open
pmetzger opened this issue Apr 16, 2024 · 1 comment
Open

Support different "comment" conventions for different languages. #474

pmetzger opened this issue Apr 16, 2024 · 1 comment

Comments

@pmetzger
Copy link
Contributor

re2c is in the midst of acquiring a really flexible method for adding new language support thanks to its amazing maintainers. (Thank you, Skvadrik!)

Currently, even though there may be many different types of commenting conventions used in different languages, input files for a given language seem to usually follow a C/C++-like comment convention for the place to stash the re2c directives. This may not really be the case (I haven't delved deeply into the code) and I might be mistaken, but presuming I'm not: it would be nice for the new language support configuration to allow for a native comment convention to be used. I note, for example, that some languages might actually use C-like comments as operators (say, Python's integer division operator, //).

Alternatively, perhaps The Right Thing is indeed to use a convention distinct from the language's native comments (after all, these are not comments but are in fact directives to re2c to generate code!), but in that case, maybe it would be better to use another, prettier convention less likely to cause accidents?

@pmetzger pmetzger changed the title Support different kinds of comments for different languages Support different "comment" conventions for different languages. Apr 16, 2024
@skvadrik
Copy link
Owner

This may be a good idea. My main concern is correctness of the re2c parser wrt. different languages. E.g. it has to parse string literals and character literals (as they may contain comment start), but these literals have slightly different syntax in different languages. See also related #429 which has a wider scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants