addExpression: mulExpression | addExpression ('+' | '-' | '~') mulExpression ;
aliasDeclaration: 'alias' aliasInitializer (',' aliasInitializer)* ';' | 'alias' storageClass* type identifierList ';' ;
aliasInitializer: Identifier templateParameters? '=' storageClass* type | Identifier templateParameters? '=' functionLiteralExpression ;
aliasThisDeclaration: 'alias' Identifier 'this' ';' ;
alignAttribute: 'align' ('(' IntegerLiteral ')')? ;
andAndExpression: orExpression | andAndExpression '&&' orExpression ;
andExpression: cmpExpression | andExpression '&' cmpExpression ;
argumentList: assignExpression (',' assignExpression?)* ;
arguments: '(' argumentList? ')' ;
arrayInitializer: '[' ']' | '[' arrayMemberInitialization (',' arrayMemberInitialization?)* ']' ;
arrayLiteral: '[' argumentList? ']' ;
arrayMemberInitialization: (assignExpression ':')? nonVoidInitializer ;
asmAddExp: asmMulExp | asmAddExp ('+' | '-') asmMulExp ;
asmAndExp: asmEqualExp | asmAndExp '&' asmEqualExp ;
asmBrExp: asmUnaExp | asmBrExp? '[' asmExp ']' ;
asmEqualExp: asmRelExp | asmEqualExp ('==' | '!=') asmRelExp ;
asmExp: asmLogOrExp ('?' asmExp ':' asmExp)? ;
asmInstruction: Identifier | 'align' IntegerLiteral | 'align' Identifier | Identifier ':' asmInstruction | Identifier operands | 'in' operands | 'out' operands | 'int' operands ;
asmLogAndExp: asmOrExp asmLogAndExp '&&' asmOrExp ;
asmLogOrExp: asmLogAndExp | asmLogOrExp '||' asmLogAndExp ;
asmMulExp: asmBrExp | asmMulExp ('*' | '/' | '%') asmBrExp ;
asmOrExp: asmXorExp | asmOrExp '|' asmXorExp ;
asmPrimaryExp: IntegerLiteral | FloatLiteral | StringLiteral | register | identifierChain | '$' ;
asmRelExp: asmShiftExp | asmRelExp (('<' | '<=' | '>' | '>=') asmShiftExp)? ;
asmShiftExp: asmAddExp asmShiftExp ('<<' | '>>' | '>>>') asmAddExp ;
asmStatement: 'asm' functionAttributes? '{' asmInstruction+ '}' ;
asmTypePrefix: Identifier Identifier? | 'byte' Identifier? | 'short' Identifier? | 'int' Identifier? | 'float' Identifier? | 'double' Identifier? | 'real' Identifier? ;
asmUnaExp: asmTypePrefix asmExp | Identifier asmExp | '+' asmUnaExp | '-' asmUnaExp | '!' asmUnaExp | '~' asmUnaExp | asmPrimaryExp ;
asmXorExp: asmAndExp | asmXorExp '^' asmAndExp ;
assertExpression: 'assert' '(' assignExpression (',' assignExpression)? ')' ;
assignExpression: ternaryExpression (assignOperator expression)? ; assignOperator: '=' | '>>>=' | '>>=' | '<<=' | '+=' | '-=' | '*=' | '%=' | '&=' | '/=' | '|=' | '^^=' | '^=' | '~=' ;
assocArrayLiteral: '[' keyValuePairs ']' ;
atAttribute: '@' Identifier | '@' Identifier '(' argumentList? ')' | '@' '(' argumentList ')' | '@' TemplateInstance ;
attribute: | pragmaExpression | alignAttribute | deprecated | atAttribute | linkageAttribute | 'export' | 'package' | 'private' | 'protected' | 'public' | 'static' | 'extern' | 'abstract' | 'final' | 'override' | 'synchronized' | 'auto' | 'scope' | 'const' | 'immutable' | 'inout' | 'shared' | '_gshared' | 'nothrow' | 'pure' | 'ref' ;
attributeDeclaration: attribute ':' ;
autoDeclaration: storageClass+ Identifier '=' initializer (',' Identifier '=' initializer)* ';' ;
blockStatement: '{' declarationsAndStatements? '}' ;
bodyStatement: 'body' blockStatement ;
breakStatement: 'break' Identifier? ';' ;
baseClass: type2 ;
baseClassList: baseClass (',' baseClass)* ;
builtinType: 'bool' | 'byte' | 'ubyte' | 'short' | 'ushort' | 'int' | 'uint' | 'long' | 'ulong' | 'char' | 'wchar' | 'dchar' | 'float' | 'double' | 'real' | 'ifloat' | 'idouble' | 'ireal' | 'cfloat' | 'cdouble' | 'creal' | 'void' ;
caseRangeStatement: 'case' assignExpression ':' '...' 'case' assignExpression ':' declarationsAndStatements ;
caseStatement: 'case' argumentList ':' declarationsAndStatements ;
castExpression: 'cast' '(' (type | castQualifier)? ')' unaryExpression ;
castQualifier: 'const' | 'const' 'shared' | 'immutable' | 'inout' | 'inout' 'shared' | 'shared' | 'shared' 'const' | 'shared' 'inout' ;
catch: 'catch' '(' type Identifier? ')' declarationOrStatement ;
catches: catch+ | catch* lastCatch ;
classDeclaration: 'class' Identifier ';' | 'class' Identifier (':' baseClassList)? structBody | 'class' Identifier templateParameters constraint? (structBody | ';') | 'class' Identifier templateParameters constraint? (':' baseClassList)? structBody | 'class' Identifier templateParameters (':' baseClassList)? constraint? structBody ;
cmpExpression: shiftExpression | equalExpression | identityExpression | relExpression | inExpression ;
compileCondition: versionCondition | debugCondition | staticIfCondition ;
conditionalDeclaration: compileCondition declaration | compileCondition '{' declaration* '}' | compileCondition ':' declaration+ | compileCondition declaration 'else' ':' declaration* | compileCondition declaration 'else' declaration | compileCondition declaration 'else' '{' declaration* '}' | compileCondition '{' declaration* '}' 'else' declaration | compileCondition '{' declaration* '}' 'else' '{' declaration* '}' | compileCondition '{' declaration* '}' 'else' ':' declaration* | compileCondition ':' declaration+ 'else' declaration | compileCondition ':' declaration+ 'else' '{' declaration* '}' | compileCondition ':' declaration+ 'else' ':' declaration* ;
conditionalStatement: compileCondition declarationOrStatement ('else' declarationOrStatement)? ;
constraint: 'if' '(' expression ')' ;
constructor: 'this' templateParameters? parameters memberFunctionAttribute* constraint? (functionBody | ';') ;
continueStatement: 'continue' Identifier? ';' ;
debugCondition: 'debug' ('(' (IntegerLiteral | Identifier) ')')? ;
debugSpecification: 'debug' '=' (Identifier | IntegerLiteral) ';' ;
declaration: attribute* declaration2 | attribute+ '{' declaration* '}' ; declaration2: aliasDeclaration | aliasThisDeclaration | anonymousEnumDeclaration | attributeDeclaration | classDeclaration | conditionalDeclaration | constructor | debugSpecification | destructor | enumDeclaration | eponymousTemplateDeclaration | functionDeclaration | importDeclaration | interfaceDeclaration | invariant | mixinDeclaration | mixinTemplateDeclaration | pragmaDeclaration | sharedStaticConstructor | sharedStaticDestructor | staticAssertDeclaration | staticConstructor | staticDestructor | structDeclaration | templateDeclaration | unionDeclaration | unittest | variableDeclaration | versionSpecification ;
declarationsAndStatements: declarationOrStatement+ ;
declarationOrStatement: declaration | statement ;
declarator: Identifier | Identifier '=' initializer | Identifier templateParameters '=' initializer ;
defaultStatement: 'default' ':' declarationsAndStatements ;
deleteExpression: 'delete' unaryExpression ;
deprecated: 'deprecated' ('(' StringLiteral+ ')')? ;
destructor: '~' 'this' '(' ')' memberFunctionAttribute* (functionBody | ';') ;
doStatement: 'do' statementNoCaseNoDefault 'while' '(' expression ')' ';' ;
enumBody: '{' enumMember (',' enumMember?)* '}' ;
anonymousEnumMember: type identifier '=' assignExpression | identifier '=' assignExpression | identifier ;
anonymousEnumDeclaration: 'enum' (':' type)? '{' anonymousEnumMember+ '}' ;
enumDeclaration: 'enum' Identifier (':' type)? ';' | 'enum' Identifier (':' type)? enumBody ;
enumMember: Identifier | Identifier '=' assignExpression ;
eponymousTemplateDeclaration: 'enum' Identifier templateParameters '=' assignExpression ';' ;
equalExpression: shiftExpression ('==' | '!=') shiftExpression ;
expression: assignExpression (',' assignExpression)* ;
expressionStatement: expression ';' ;
finalSwitchStatement: 'final' switchStatement ;
finally: 'finally' declarationOrStatement ;
forStatement: 'for' '(' (declaration | statementNoCaseNoDefault) expression? ';' expression? ')' declarationOrStatement ;
foreachStatement: ('foreach' | 'foreach_reverse') '(' foreachTypeList ';' expression ')' declarationOrStatement | ('foreach' | 'foreach_reverse') '(' foreachType ';' expression '..' expression ')' declarationOrStatement ;
foreachType: 'ref'? typeConstructors? type? Identifier | typeConstructors? 'ref'? type? Identifier ;
foreachTypeList: foreachType (',' foreachType)* ;
functionAttribute: atAttribute | 'pure' | 'nothrow' ;
functionBody: blockStatement | (inStatement | outStatement | outStatement inStatement | inStatement outStatement)? bodyStatement? ;
functionCallExpression: symbol arguments unaryExpression arguments | type arguments ;
functionDeclaration: (storageClass+ | type) Identifier parameters memberFunctionAttribute* (functionBody | ';') | (storageClass+ | type) Identifier templateParameters parameters memberFunctionAttribute* constraint? (functionBody | ';') ;
functionLiteralExpression: | 'delegate' type? (parameters functionAttribute*)? functionBody | 'function' type? (parameters functionAttribute*)? functionBody | parameters functionAttribute* functionBody | functionBody | Identifier '=>' assignExpression | 'function' type? parameters functionAttribute* '=>' assignExpression | 'delegate' type? parameters functionAttribute* '=>' assignExpression | parameters functionAttribute* '=>' assignExpression ;
gotoStatement: 'goto' (Identifier | 'default' | 'case' expression?) ';' ;
identifierChain: Identifier ('.' Identifier)* ;
identifierList: Identifier (',' Identifier)* ;
identifierOrTemplateChain: identifierOrTemplateInstance ('.' identifierOrTemplateInstance)* ;
identifierOrTemplateInstance: Identifier | templateInstance ;
identityExpression: shiftExpression ('is' | ('!' 'is')) shiftExpression ;
ifStatement: 'if' '(' ifCondition ')' declarationOrStatement ('else' declarationOrStatement)? ifCondition: 'auto' Identifier '=' expression | type Identifier '=' expression | expression ;
importBind: Identifier ('=' Identifier)? ;
importBindings: singleImport ':' importBind (',' importBind)* ;
importDeclaration: 'import' singleImport (',' singleImport)* (',' importBindings)? ';' | 'import' importBindings ';' ;
importExpression: 'import' '(' assignExpression ')' ;
index: assignExpression ('..' assignExpression)? ;
indexExpression: unaryExpression '[' ']' | unaryExpression '[' index (',' index)* ']' ;
inExpression: shiftExpression ('in' | ('!' 'in')) shiftExpression ;
inStatement: 'in' blockStatement ;
initializer: 'void' | nonVoidInitializer ;
interfaceDeclaration: 'interface' Identifier ';' | 'interface' Identifier (':' baseClassList)? structBody | 'interface' Identifier templateParameters constraint? (':' baseClassList)? structBody | 'interface' Identifier templateParameters (':' baseClassList)? constraint? structBody ;
invariant: 'invariant' ('(' ')')? blockStatement ;
isExpression: 'is' '(' type identifier? ')' 'is' '(' type identifier? ':' typeSpecialization ')' 'is' '(' type identifier? '=' typeSpecialization ')' 'is' '(' type identifier? ':' typeSpecialization ',' templateParameterList ')' 'is' '(' type identifier? '=' typeSpecialization ',' templateParameterList ')' ;
keyValuePair: assignExpression ':' assignExpression ;
keyValuePairs: keyValuePair (',' keyValuePair)* ','? ;
labeledStatement: Identifier ':' declarationOrStatement? ;
lastCatch: 'catch' statementNoCaseNoDefault ;
linkageAttribute: 'extern' '(' Identifier ('++' (',' identifierChain)?)? ')' ;
memberFunctionAttribute: functionAttribute | 'immutable' | 'inout' | 'shared' | 'const' | 'return' ;
mixinDeclaration: mixinExpression ';' | templateMixinExpression ';' ;
mixinExpression: 'mixin' '(' assignExpression ')' ;
mixinTemplateDeclaration: 'mixin' templateDeclaration ;
mixinTemplateName: symbol | typeofExpression '.' identifierOrTemplateChain ;
module: moduleDeclaration? declaration* ;
moduleDeclaration: deprecated? 'module' identifierChain ';' ;
mulExpression: powExpression | mulExpression ('*' | '/' | '%') powExpression ;
newAnonClassExpression: 'new' arguments? 'class' arguments? baseClassList? structBody ;
newExpression: 'new' type (('[' assignExpression ']') | arguments)? | newAnonClassExpression ;
nonVoidInitializer: assignExpression | arrayInitializer | structInitializer ;
operands: asmExp | asmExp ',' operands ;
orExpression: xorExpression | orExpression '|' xorExpression ;
orOrExpression: andAndExpression | orOrExpression '||' andAndExpression ;
outStatement: 'out' ('(' Identifier ')')? blockStatement ;
parameter: parameterAttribute* type parameterAttribute* type Identifier? '...' parameterAttribute* type Identifier? ('=' assignExpression)? ;
parameterAttribute: typeConstructor | 'final' | 'in' | 'lazy' | 'out' | 'ref' | 'scope' | 'auto' | 'return' ;
parameters: '(' parameter (',' parameter)* (',' '...')? ')' | '(' '...' ')' | '(' ')' ;
postblit: 'this' '(' 'this' ')' memberFunctionAttribute* (functionBody | ';') ;
powExpression: unaryExpression | powExpression '^^' unaryExpression ;
pragmaDeclaration: pragmaExpression ';' ;
pragmaExpression: 'pragma' '(' Identifier (',' argumentList)? ')' ;
primaryExpression: identifierOrTemplateInstance | '.' identifierOrTemplateInstance | typeConstructor '(' basicType ')' '.' Identifier | basicType '.' Identifier | basicType arguments | typeofExpression | typeidExpression | vector | arrayLiteral | assocArrayLiteral | '(' expression ')' | isExpression | functionLiteralExpression | traitsExpression | mixinExpression | importExpression | '$' | 'this' | 'super' | 'null' | 'true' | 'false' | '__DATE__' | '__TIME__' | '__TIMESTAMP__' | '__VENDOR__' | '__VERSION__' | '__FILE__' | '__LINE__' | '__MODULE__' | '__FUNCTION__' | '__PRETTY_FUNCTION__' | IntegerLiteral | FloatLiteral | StringLiteral+ | CharacterLiteral ;
register: Identifier | Identifier '(' IntegerLiteral ')' ;
relExpression: shiftExpression | relExpression relOperator shiftExpression ; relOperator: '<' | '<=' | '>' | '>=' | '!<>=' | '!<>' | '<>' | '<>=' | '!>' | '!>=' | '!<' | '!<=' ;
returnStatement: 'return' expression? ';' ;
scopeGuardStatement: 'scope' '(' Identifier ')' statementNoCaseNoDefault ;
sharedStaticConstructor: 'shared' 'static' 'this' '(' ')' functionBody ;
sharedStaticDestructor: 'shared' 'static' '~' 'this' '(' ')' functionBody ;
shiftExpression: addExpression | shiftExpression ('<<' | '>>' | '>>>') addExpression ;
singleImport: (Identifier '=')? identifierChain ;
statement: statementNoCaseNoDefault | caseStatement | caseRangeStatement | defaultStatement ;
statementNoCaseNoDefault: labeledStatement | blockStatement | ifStatement | whileStatement | doStatement | forStatement | foreachStatement | switchStatement | finalSwitchStatement | continueStatement | breakStatement | returnStatement | gotoStatement | withStatement | synchronizedStatement | tryStatement | throwStatement | scopeGuardStatement | asmStatement | conditionalStatement | staticAssertStatement | versionSpecification | debugSpecification | expressionStatement ;
staticAssertDeclaration: staticAssertStatement ;
staticAssertStatement: 'static' assertExpression ';' ;
staticConstructor: 'static' 'this' '(' ')' functionBody ;
staticDestructor: 'static' '~' 'this' '(' ')' functionBody ;
staticIfCondition: 'static' 'if' '(' assignExpression ')' ;
storageClass: alignAttribute | linkageAttribute | atAttribute | typeConstructor | deprecated | 'abstract' | 'auto' | 'enum' | 'extern' | 'final' | 'nothrow' | 'override' | 'pure' | 'ref' | '__gshared' | 'scope' | 'static' | 'synchronized' ;
structBody: '{' declaration* '}' ;
structDeclaration: 'struct' Identifier? (templateParameters constraint? structBody | (structBody | ';')) ;
structInitializer: '{' structMemberInitializers? '}' ;
structMemberInitializer: (Identifier ':')? nonVoidInitializer ;
structMemberInitializers: structMemberInitializer (',' structMemberInitializer?)* ;
switchStatement: 'switch' '(' expression ')' statement ;
symbol: '.'? identifierOrTemplateChain ;
synchronizedStatement: 'synchronized' ('(' expression ')')? statementNoCaseNoDefault ;
templateAliasParameter: 'alias' type? Identifier (':' (type | assignExpression))? ('=' (type | assignExpression))? ;
templateArgument: type | assignExpression ;
templateArgumentList: templateArgument (',' templateArgument?)* ;
templateArguments: '!' ('(' templateArgumentList? ')') | templateSingleArgument ;
templateDeclaration: 'template' Identifier templateParameters constraint? '{' declaration* '}' ;
templateInstance: Identifier templateArguments ;
templateMixinExpression: 'mixin' mixinTemplateName templateArguments? Identifier? ;
templateParameter: templateTypeParameter | templateValueParameter | templateAliasParameter | templateTupleParameter | templateThisParameter ;
templateParameterList: templateParameter (',' templateParameter?)* ;
templateParameters: '(' templateParameterList? ')' ;
templateSingleArgument: builtinType | Identifier | CharacterLiteral | StringLiteral | IntegerLiteral | FloatLiteral | 'true' | 'false' | 'null' | 'this' | '__DATE__' | '__TIME__' | '__TIMESTAMP__' | '__VENDOR__' | '__VERSION__' | '__FILE__' | '__LINE__' | '__MODULE__' | '__FUNCTION__' | '__PRETTY_FUNCTION__' ;
templateThisParameter: 'this' templateTypeParameter ;
templateTupleParameter: Identifier '...' ;
templateTypeParameter: Identifier (':' type)? ('=' type)? ;
templateValueParameter: type Identifier (':' assignExpression)? templateValueParameterDefault? ;
templateValueParameterDefault: '=' ('__FILE__' | '__MODULE__' | '__LINE__' | '__FUNCTION__' | '__PRETTY_FUNCTION__' | assignExpression) ;
ternaryExpression: orOrExpression ('?' expression ':' ternaryExpression)? ;
throwStatement: 'throw' expression ';' ;
traitsExpression: '__traits' '(' Identifier ',' TemplateArgumentList ')' ;
tryStatement: 'try' declarationOrStatement (catches | catches finally | finally) ;
type: typeConstructors? type2 typeSuffix* ;
type2: builtinType | symbol | typeofExpression ('.' identifierOrTemplateChain)? | typeConstructor '(' type ')' | vector ;
typeConstructor: 'const' | 'immutable' | 'inout' | 'shared' ;
typeConstructors: typeConstructor+ ;
typeSpecialization: type | 'struct' | 'union' | 'class' | 'interface' | 'enum' | 'function' | 'delegate' | 'super' | 'const' | 'immutable' | 'inout' | 'shared' | 'return' | 'typedef' | '__parameters' ;
typeSuffix: '*' | '[' type? ']' | '[' assignExpression ']' | '[' assignExpression '..' assignExpression ']' | ('delegate' | 'function') parameters memberFunctionAttribute* ;
typeidExpression: 'typeid' '(' (type | expression) ')' ;
typeofExpression: 'typeof' '(' (expression | 'return') ')' ;
unaryExpression: primaryExpression | '&' unaryExpression | '!' unaryExpression | '*' unaryExpression | '+' unaryExpression | '-' unaryExpression | '~' unaryExpression | '++' unaryExpression | '--' unaryExpression | newExpression | deleteExpression | castExpression | assertExpression | functionCallExpression | indexExpression | '(' type ')' '.' identifierOrTemplateInstance | unaryExpression '.' newExpression | unaryExpression '.' identifierOrTemplateInstance | unaryExpression '--' | unaryExpression '++' ;
unionDeclaration: 'union' Identifier templateParameters constraint? structBody | 'union' Identifier (structBody | ';') | 'union' structBody ;
unittest: 'unittest' blockStatement ;
variableDeclaration: storageClass* type declarator (',' declarator)* ';' | storageClass* type identifier '=' functionBody ';' | autoDeclaration ;
vector: '__vector' '(' type ')' ;
versionCondition: 'version' '(' (IntegerLiteral | Identifier | 'unittest' | 'assert') ')' ;
versionSpecification: 'version' '=' (Identifier | IntegerLiteral) ';' ;
whileStatement: 'while' '(' expression ')' declarationOrStatement ;
withStatement: 'with' '(' expression ')' statementNoCaseNoDefault ;
xorExpression: andExpression | xorExpression '^' andExpression ;