[Issue 2652] New: DeclDef grammar is wrong

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 8 20:25:59 PST 2009


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: bugzilla at digitalmars.com
        ReportedBy: jlquinn at 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


-- 



More information about the Digitalmars-d-bugs mailing list