Bug 16603 – [Lexical] comment definition is incorrrect
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P3
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-10-08T03:49:16Z
Last change time
2023-02-07T21:45:07Z
Keywords
spec
Assigned to
No Owner
Creator
Kevin
Comments
Comment #0 by kevin — 2016-10-08T03:49:16Z
Both of the block comment definitions are incorrect.
BlockComment:
/* Characters */
Character:
any Unicode character
The ending comment tags are included in the definition of "any unicode character", which would make the block comment in quotes "/* abc */ */" a single comment instead of a comment followed by an invalid sequence, if you follow the maximal munch technique.
The nesting block comment suffers from the same definition.
The c++ spec handles this by describing comments in a non technical manner. See [lex.comment] in the spec.
A solution could be perhaps, to mention that comments take a minimum munch in the exceptions note.
Comment #1 by razvan.nitu1305 — 2023-02-07T10:42:21Z
The grammar is correct and the spec states: "Block comments can span multiple lines, but do not nest."
This should suffice.
Comment #2 by kevin — 2023-02-07T16:23:06Z
1) The technical language specification which one would use to build a parser is still incorrect, regardless of any flavour text in the description.
2) you only addressed the second part of the issue, completely ignoring the first.
3) your "it's good enough" comment is just another reminder as to why I pivoted away from the language.