Skip to content

Allow nested block comments in parser #774

Open

Description

@nickbattle

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.

Activity

  1. added
    enhancementNot a bug, but nice to have
    languageIssues in parser, TC, interpreter, POG or CG
    on Feb 5, 2021
  2. self-assigned this
    on Feb 5, 2021
  3. added a commit that references this issue on Feb 5, 2021
    100d48d
  4. added
    MergableA fix is available on a branch to merge for release
    on Feb 5, 2021
  5. nickbattle commented on Feb 5, 2021

    @nickbattle
    ContributorAuthor

    Change now available in ncb/development.

  6. nlmave commented on Feb 5, 2021

    @nlmave
  7. nickbattle commented on Feb 5, 2021

    @nickbattle
    ContributorAuthor

    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.

  8. nlmave commented on Feb 5, 2021

    @nlmave
  9. nickbattle commented on Feb 5, 2021

    @nickbattle
    ContributorAuthor

    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).

  10. nlmave commented on Feb 5, 2021

    @nlmave
  11. removed
    MergableA fix is available on a branch to merge for release
    on Feb 9, 2021
  12. nickbattle commented on Feb 9, 2021

    @nickbattle
    ContributorAuthor

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

  13. added
    MergableA fix is available on a branch to merge for release
    on May 3, 2021
  14. nickbattle commented on May 3, 2021

    @nickbattle
    ContributorAuthor

    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

Metadata

Metadata

Assignees

Labels

MergableA fix is available on a branch to merge for releaseenhancementNot a bug, but nice to havelanguageIssues in parser, TC, interpreter, POG or CG

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions