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

Allow nested block comments in parser #774

Open
nickbattle opened this issue Feb 5, 2021 · 8 comments
Open

Allow nested block comments in parser #774

nickbattle opened this issue Feb 5, 2021 · 8 comments
Assignees
Labels
enhancement Not a bug, but nice to have language Issues in parser, TC, interpreter, POG or CG Mergable A fix is available on a branch to merge for release

Comments

@nickbattle
Copy link
Contributor

This was recently raised on VDMJ (via VDM VSCode). It is quite useful to correctly parse nested /* ... */ style block comments because it means you can comment out large blocks of code without worrying about any comments within. The behaviour is unspecified in the LRM, so this is just a usability change.

@nickbattle nickbattle added enhancement Not a bug, but nice to have language Issues in parser, TC, interpreter, POG or CG labels Feb 5, 2021
@nickbattle nickbattle self-assigned this Feb 5, 2021
@nickbattle nickbattle added the Mergable A fix is available on a branch to merge for release label Feb 5, 2021
@nickbattle
Copy link
Contributor Author

Change now available in ncb/development.

@nlmave
Copy link

nlmave commented Feb 5, 2021 via email

@nickbattle
Copy link
Contributor Author

The ISO standard only refers to inline -- style comments, so nesting is not an issue. Block comments were introduced at some point in VDMJ/Overture for convenience.

The "bad practice" point is debatable. If you were using them deliberately, then I would agree. But the original request here was regarding the ability to comment out large sections of a specification which may contain block comments already. In that case, nesting makes this much easier.

@nlmave
Copy link

nlmave commented Feb 5, 2021 via email

@nickbattle
Copy link
Contributor Author

We can run it past the Language Board, I suppose. It didn't strike me as particularly controversial (mostly invisible), so I didn't consider raising an RM. The link you provided does mention that a handful of languages already support this, so it's not unheard of (Haskell, Frege, Scala, Rexx, Modula-2, Modula-3, Oberon).

@nlmave
Copy link

nlmave commented Feb 5, 2021 via email

@nickbattle nickbattle removed the Mergable A fix is available on a branch to merge for release label Feb 9, 2021
@nickbattle
Copy link
Contributor Author

I'll remove the Mergable tag on this until the LB has had a chance to comment.

@nickbattle nickbattle added the Mergable A fix is available on a branch to merge for release label May 3, 2021
@nickbattle
Copy link
Contributor Author

After discussions in the LB, the parser will be changed to use the current behaviour by default/-strict, but to allow a setting to choose nested comments to be warned, errored, or parsed via a configurable tool setting.

This parser and property change is now available in ncb/development. But note that #775 is also required before the configurable feature is usable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Not a bug, but nice to have language Issues in parser, TC, interpreter, POG or CG Mergable A fix is available on a branch to merge for release
Projects
None yet
Development

No branches or pull requests

2 participants