www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22825] New: #line parsing doesn't follow the spec

https://issues.dlang.org/show_bug.cgi?id=22825

          Issue ID: 22825
           Summary: #line parsing doesn't follow the spec
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Grammar is:

---
SpecialTokenSequence:


---

Because newlines (EndOfLine) is part of the grammar, then any other newlines


This does not apply to multi-line comments, and other such markers that are
consumed and ignored by the lexer.

So while this should be accepted as valid code
---
#line /*
         multi-line comment
*/ 42
int var;
---

This should not compile, but currently does.
---
#line /*
         multi-line comment
*/ 
42
int var;
---

(There are similarities in this to issue 22812 for importC)

--
Feb 26 2022