http://d.puremagic.com/issues/show_bug.cgi?id=2652

           Summary: DeclDef grammar is wrong
           Product: D
           Version: 2.023
          Platform: PC
               URL: http://www.digitalmars.com/d/2.0/module.html
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: jlqu...@optonline.net
 BugsThisDependsOn: 2651


As described, the DeclDef grammar allows Invariant and UnitTest at module
scope.  The compiler only permits them within classes, structs, and unions,
which seems more correct to me.  Given that and bug 2651, I think the grammar
should be modified as:

Module:
        DeclDefs

DeclDefs:
        DeclDef
        DeclDef DeclDefs

DeclDef:
        AttributeSpecifier
        ImportDeclaration
        EnumDeclaration
        ClassDeclaration
        InterfaceDeclaration
        AggregateDeclaration
        Declaration
        UnitTest
        StaticConstructor
        StaticDestructor
        DebugSpecification
        VersionSpecification
        MixinDeclaration
        ;

ClassBodyDeclaration:
        AggregateDeclDef
        Constructor
        Destructor
        ClassAllocator
        ClassDeallocator

StructBodyDeclaration:
        AggregateDeclDef
        StructAllocator
        StructDeallocator
        StructConstructor
        StructPostblit
        StructDestructor

AggregateDeclDef:
        DeclDef
        Invariant
        UnitTest


-- 

Reply via email to