www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Gramamr: Missing production rule

reply Q. Schroll <qs.il.paperinik gmail.com> writes:
Can someone state a production rule according to which `public` 
and `private` can be applied directly to a declaration, e.g. 
`public void main() { }`. (What I don't mean is `public { }` 
blocks or `public:`. Maybe I'm missing it, but I couldn't find 
one. If it is really the case, I'll fix that in the next days.
Dec 08 2020
parent Paul Backus <snarwin gmail.com> writes:
On Wednesday, 9 December 2020 at 02:02:18 UTC, Q. Schroll wrote:
 Can someone state a production rule according to which `public` 
 and `private` can be applied directly to a declaration, e.g. 
 `public void main() { }`. (What I don't mean is `public { }` 
 blocks or `public:`. Maybe I'm missing it, but I couldn't find 
 one. If it is really the case, I'll fix that in the next days.
DeclDef AttributeSpecifier Attribute VisibilityAttribute public DeclarationBlock DeclDef Declaration FuncDeclaration // void main() {} The tricky bit is that "DeclarationBlock" can also be a single declaration, without curly braces.
Dec 08 2020