This commit is contained in:
Hackerpilot 2013-04-21 14:09:52 -07:00
parent adf8f09c7d
commit 63a254b9cb
1 changed files with 38 additions and 40 deletions

78
D.g4
View File

@ -430,7 +430,7 @@ staticIfCondition: 'static' 'if' '(' assignExpression ')'
staticAssert: 'static' 'assert' '(' assignExpression (',' assignExpression)? ')' ';' staticAssert: 'static' 'assert' '(' assignExpression (',' assignExpression)? ')' ';'
; ;
templateMixinStatement: 'mixin' mixinTemplateName (templateArguments | Identifier | templateArguments Identifier) ';' templateMixinStatement: 'mixin' mixinTemplateName templateArguments? Identifier? ';'
; ;
mixinTemplateName: '.' qualifiedIdentifierChain mixinTemplateName: '.' qualifiedIdentifierChain
@ -454,6 +454,22 @@ assignStatement: unaryExpression assignOperator assignExpression ';'
| postIncDecExpression ';' | postIncDecExpression ';'
; ;
assignOperator: '='
| '>>>='
| '>>='
| '<<='
| '+='
| '-='
| '*='
| '%='
| '&='
| '/='
| '|='
| '^^='
| '^='
| '~='
;
ifStatement: 'if' '(' expression ')' statement ('else' statement)? ifStatement: 'if' '(' expression ')' statement ('else' statement)?
; ;
@ -655,7 +671,7 @@ arguments: '(' argumentList? ')'
argumentList: assignExpression (',' argumentList?)? argumentList: assignExpression (',' argumentList?)?
; ;
newExpression: 'new' type ('[' assignExpression ']' | arguments | ) newExpression: 'new' type ('[' assignExpression ']' | arguments)?
| newAnonClassExpression | newAnonClassExpression
; ;
@ -665,15 +681,12 @@ newAnonClassExpression: 'new' arguments? 'class' arguments? Identifier identifie
deleteExpression: 'delete' unaryExpression deleteExpression: 'delete' unaryExpression
; ;
ternaryexpression: orOrExpression '?' expression ':' conditionalExpression assignExpression: ternaryExpression
| ternaryExpression assignOperator assignExpression
; ;
assignExpression: conditionalExpression ternaryExpression: orOrExpression
| conditionalExpression assignOperator assignExpression | orOrExpression '?' expression ':' ternaryExpression
;
conditionalExpression: orOrExpression
| ternaryexpression
; ;
orOrExpression: andAndExpression orOrExpression: andAndExpression
@ -710,34 +723,6 @@ identityExpression: shiftExpression ('is' | '!is') shiftExpression;
relExpression: shiftExpression relOperator shiftExpression; relExpression: shiftExpression relOperator shiftExpression;
inExpression: shiftExpression ('in' | '!in') shiftExpression;
shiftExpression: addExpression
| shiftExpression ('<<' | '>>' | '>>>') addExpression;
addExpression: mulExpression
| addExpression ('+' | '-' | '~') mulExpression
;
mulExpression: unaryExpression
| mulExpression ('*' | '/' | '%') unaryExpression;
assignOperator: '='
| '>>>='
| '>>='
| '<<='
| '+='
| '-='
| '*='
| '%='
| '&='
| '/='
| '|='
| '^^='
| '^='
| '~='
;
relOperator: '<' relOperator: '<'
| '<=' | '<='
| '>' | '>'
@ -752,6 +737,19 @@ relOperator: '<'
| '!<=' | '!<='
; ;
inExpression: shiftExpression ('in' | '!in') shiftExpression;
shiftExpression: addExpression
| shiftExpression ('<<' | '>>' | '>>>') addExpression;
addExpression: mulExpression
| addExpression ('+' | '-' | '~') mulExpression
;
mulExpression: unaryExpression
| mulExpression ('*' | '/' | '%') unaryExpression
;
whileStatement: 'while' '(' expression ')' blockStatement whileStatement: 'while' '(' expression ')' blockStatement
; ;
@ -770,8 +768,8 @@ functionTemplateDeclaration: type Identifier templateParameters parameters const
type: typeConstructors? type2 type: typeConstructors? type2
; ;
type2: type3 typesuffix? type2: type3 typeSuffix?
| type2 typesuffix | type2 typeSuffix
; ;
type3: builtinType type3: builtinType
@ -787,7 +785,7 @@ type3: builtinType
| 'function' parameters memberFunctionAttributes? | 'function' parameters memberFunctionAttributes?
; ;
typesuffix: '*' typeSuffix: '*'
| '[' ']' | '[' ']'
| '[' type ']' | '[' type ']'
| '[' assignExpression ']' | '[' assignExpression ']'