[Issue 9529] New: Switch Statement grammar bug for the chain of case statements
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 17 18:28:52 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9529
Summary: Switch Statement grammar bug for the chain of case
statements
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid, spec
Severity: normal
Priority: P2
Component: websites
AssignedTo: nobody at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-02-17 18:28:51 PST ---
Currently the chain of case statement is not allowed in grammar.
void main() {
int c;
switch (c) {
case 1:
case 2: // chain
break;
default: break;
}
}
But it is no sense. Because it is just equivalent with:
switch (c) {
case 1 : .. case 2:
break;
http://dlang.org/statement.html#SwitchStatement
--------
SwitchStatement:
switch ( Expression ) ScopeStatement
CaseStatement:
case ArgumentList : ScopeStatementList
CaseRangeStatement:
case FirstExp : .. case LastExp : ScopeStatementList
FirstExp:
AssignExpression
LastExp:
AssignExpression
DefaultStatement:
default : ScopeStatementList
ScopeStatementList:
StatementListNoCaseNoDefault
StatementListNoCaseNoDefault:
StatementNoCaseNoDefault
StatementNoCaseNoDefault StatementListNoCaseNoDefault
StatementNoCaseNoDefault:
;
NonEmptyStatementNoCaseNoDefault
ScopeBlockStatement
--------
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list