Grammar cleanup

This commit is contained in:
Hackerpilot 2013-07-02 23:47:21 +00:00
parent 153e7c3b8e
commit 1e9db2e0b0
1 changed files with 25 additions and 23 deletions

View File

@ -23,7 +23,7 @@
* definitions end with a semicolon (;).) * definitions end with a semicolon (;).)
* ) * )
* *
* The grammar for D starts with the $(LINK2 #module, module) rule. * The grammar for D starts with the $(LINK2 #.module, module) rule.
* *
* Examples: * Examples:
* --- * ---
@ -56,7 +56,7 @@
* MACROS: * MACROS:
* GRAMMAR = $(D_CODE $0) * GRAMMAR = $(D_CODE $0)
* RULEDEF = $(DDOC_ANCHOR $0) $(B $0) * RULEDEF = $(DDOC_ANCHOR $0) $(B $0)
* RULE = $(LINK2 #$0, $(B $0)) * RULE = $(LINK2 #.$0, $(B $0))
* LITERAL = $(D_STRING $0) * LITERAL = $(D_STRING $0)
*/ */
@ -391,7 +391,7 @@ alias core.sys.posix.stdio.fileno fileno;
* Parses an AsmBrExp * Parses an AsmBrExp
* *
* $(GRAMMAR $(RULEDEF asmBrExp): * $(GRAMMAR $(RULEDEF asmBrExp):
* $(RULE asmUnaExp) * $(RULE asmUnaExp)
* | $(RULE asmBrExp) $(LITERAL '[') $(RULE asmExp) $(LITERAL ']') * | $(RULE asmBrExp) $(LITERAL '[') $(RULE asmExp) $(LITERAL ']')
* ;) * ;)
*/ */
@ -571,7 +571,7 @@ alias core.sys.posix.stdio.fileno fileno;
* Parses an AsmTypePrefix * Parses an AsmTypePrefix
* *
* $(GRAMMAR $(RULEDEF asmTypePrefix): * $(GRAMMAR $(RULEDEF asmTypePrefix):
* $(LITERAL Identifier) $(LITERAL Identifier) * $(LITERAL Identifier) $(LITERAL Identifier)
* | $(LITERAL 'byte') $(LITERAL Identifier) * | $(LITERAL 'byte') $(LITERAL Identifier)
* | $(LITERAL 'short') $(LITERAL Identifier) * | $(LITERAL 'short') $(LITERAL Identifier)
* | $(LITERAL 'int') $(LITERAL Identifier) * | $(LITERAL 'int') $(LITERAL Identifier)
@ -591,7 +591,7 @@ alias core.sys.posix.stdio.fileno fileno;
* Parses an AsmUnaExp * Parses an AsmUnaExp
* *
* $(GRAMMAR $(RULEDEF asmUnaExp): * $(GRAMMAR $(RULEDEF asmUnaExp):
* $(RULE asmTypePrefix) $(RULE asmExp) * $(RULE asmTypePrefix) $(RULE asmExp)
* | $(LITERAL Identifier) $(RULE asmExp) * | $(LITERAL Identifier) $(RULE asmExp)
* | $(LITERAL '+') $(RULE asmUnaExp) * | $(LITERAL '+') $(RULE asmUnaExp)
* | $(LITERAL '-') $(RULE asmUnaExp) * | $(LITERAL '-') $(RULE asmUnaExp)
@ -1861,7 +1861,7 @@ class ClassFour(A, B) if (someTest()) : Super {}}c;
* $(GRAMMAR $(RULEDEF declarationsAndStatements): * $(GRAMMAR $(RULEDEF declarationsAndStatements):
* $(RULE declarationOrStatement)+ * $(RULE declarationOrStatement)+
* ; * ;
* $(RULEDEF declarationOrStatement): *$(RULEDEF declarationOrStatement):
* $(RULE declaration) * $(RULE declaration)
* | $(RULE statementNoCaseNoDefault) * | $(RULE statementNoCaseNoDefault)
* ;) * ;)
@ -3144,7 +3144,7 @@ invariant() foo();
* Parses an IsExpression * Parses an IsExpression
* *
* $(GRAMMAR $(RULEDEF isExpression): * $(GRAMMAR $(RULEDEF isExpression):
* $(LITERAL'is') $(LITERAL '$(LPAREN)') ($(RULE type) $(LITERAL Identifier)? (($(LITERAL ':') | $(LITERAL '==')) $(RULE typeSpecialization) ($(LITERAL ',') $(RULE templateParameterList))?)?)) $(LITERAL '$(RPAREN)') * $(LITERAL'is') $(LITERAL '$(LPAREN)') $(RULE type) $(LITERAL Identifier)? (($(LITERAL ':') | $(LITERAL '==')) $(RULE typeSpecialization) ($(LITERAL ',') $(RULE templateParameterList))?)? $(LITERAL '$(RPAREN)')
* ;) * ;)
*/ */
IsExpression parseIsExpression() IsExpression parseIsExpression()
@ -4914,16 +4914,16 @@ q{(int a, ...)
* | $(LITERAL '_false') * | $(LITERAL '_false')
* | $(LITERAL '_null') * | $(LITERAL '_null')
* | $(LITERAL 'this') * | $(LITERAL 'this')
* | $(LITERAL '__DATE__') * | $(LITERAL '___DATE__')
* | $(LITERAL '__TIME__') * | $(LITERAL '___TIME__')
* | $(LITERAL '__TIMESTAMP__') * | $(LITERAL '___TIMESTAMP__')
* | $(LITERAL '__VENDOR__') * | $(LITERAL '___VENDOR__')
* | $(LITERAL '__VERSION__') * | $(LITERAL '___VERSION__')
* | $(LITERAL '__FILE__') * | $(LITERAL '___FILE__')
* | $(LITERAL '__LINE__') * | $(LITERAL '___LINE__')
* | $(LITERAL '__MODULE__') * | $(LITERAL '___MODULE__')
* | $(LITERAL '__FUNCTION__') * | $(LITERAL '___FUNCTION__')
* | $(LITERAL '__PRETTY_FUNCTION__') * | $(LITERAL '___PRETTY_FUNCTION__')
* ;) * ;)
*/ */
TemplateSingleArgument parseTemplateSingleArgument() TemplateSingleArgument parseTemplateSingleArgument()
@ -5039,7 +5039,7 @@ q{(int a, ...)
* Parses a TemplateValueParameterDefault * Parses a TemplateValueParameterDefault
* *
* $(GRAMMAR $(RULEDEF templateValueParameterDefault): * $(GRAMMAR $(RULEDEF templateValueParameterDefault):
* $(LITERAL '=') ('__FILE__' | '__MODULE__' | '__LINE__' | '__FUNCTION__' | '__PRETTY_FUNCTION__' | $(RULE assignExpression)) * $(LITERAL '=') ($(LITERAL '___FILE__') | $(LITERAL '___MODULE__') | $(LITERAL '___LINE__') | $(LITERAL '___FUNCTION__') | $(LITERAL '___PRETTY_FUNCTION__') | $(RULE assignExpression))
* ;) * ;)
*/ */
TemplateValueParameterDefault parseTemplateValueParameterDefault() TemplateValueParameterDefault parseTemplateValueParameterDefault()
@ -5104,7 +5104,7 @@ q{(int a, ...)
* Parses an TraitsExpression * Parses an TraitsExpression
* *
* $(GRAMMAR $(RULEDEF traitsExpression): * $(GRAMMAR $(RULEDEF traitsExpression):
* $(LITERAL '__traits') $(LITERAL '$(LPAREN)') $(LITERAL Identifier) ($(LITERAL ',') $(RULE TemplateArgumentList)) $(LITERAL '$(RPAREN)') * $(LITERAL '___traits') $(LITERAL '$(LPAREN)') $(LITERAL Identifier) $(LITERAL ',') $(RULE TemplateArgumentList) $(LITERAL '$(RPAREN)')
* ;) * ;)
*/ */
TraitsExpression parseTraitsExpression() TraitsExpression parseTraitsExpression()
@ -5115,6 +5115,7 @@ q{(int a, ...)
auto ident = expect(TokenType.identifier); auto ident = expect(TokenType.identifier);
if (ident is null) return null; if (ident is null) return null;
node.identifier = *ident; node.identifier = *ident;
if (expect(TokenType.comma) is null) return null;
if ((node.templateArgumentList = parseTemplateArgumentList()) is null) return null; if ((node.templateArgumentList = parseTemplateArgumentList()) is null) return null;
if (expect(TokenType.rParen) is null) return null; if (expect(TokenType.rParen) is null) return null;
return node; return node;
@ -5395,7 +5396,7 @@ q{(int a, ...)
* Parses a TypeidExpression * Parses a TypeidExpression
* *
* $(GRAMMAR $(RULEDEF typeidExpression): * $(GRAMMAR $(RULEDEF typeidExpression):
* $(LITERAL 'typeid') $(LITERAL '$(LPAREN)')($(RULE type) | $(RULE expression)) $(LITERAL '$(RPAREN)') * $(LITERAL 'typeid') $(LITERAL '$(LPAREN)') ($(RULE type) | $(RULE expression)) $(LITERAL '$(RPAREN)')
* ;) * ;)
*/ */
TypeidExpression parseTypeidExpression() TypeidExpression parseTypeidExpression()
@ -5421,7 +5422,7 @@ q{(int a, ...)
* Parses a TypeofExpression * Parses a TypeofExpression
* *
* $(GRAMMAR $(RULEDEF typeofExpression): * $(GRAMMAR $(RULEDEF typeofExpression):
* $(LITERAL 'typeof') $(LITERAL '$(LPAREN)')($(RULE expression) | $(LITERAL 'return')) $(LITERAL '$(RPAREN)') * $(LITERAL 'typeof') $(LITERAL '$(LPAREN)') ($(RULE expression) | $(LITERAL 'return')) $(LITERAL '$(RPAREN)')
* ;) * ;)
*/ */
TypeofExpression parseTypeofExpression() TypeofExpression parseTypeofExpression()
@ -5556,7 +5557,8 @@ q{doStuff(5)}c;
* Parses an UnionDeclaration * Parses an UnionDeclaration
* *
* $(GRAMMAR $(RULEDEF unionDeclaration): * $(GRAMMAR $(RULEDEF unionDeclaration):
* $(LITERAL 'union') $(LITERAL Identifier) (($(RULE templateParameters) $(RULE constraint)? $(RULE structBody))? | ($(RULE structBody) | $(LITERAL ';'))) * $(LITERAL 'union') $(LITERAL Identifier) $(RULE templateParameters) $(RULE constraint)? $(RULE structBody)
* | $(LITERAL 'union') $(LITERAL Identifier) ($(RULE structBody) | $(LITERAL ';'))
* | $(LITERAL 'union') $(RULE structBody) * | $(LITERAL 'union') $(RULE structBody)
* ;) * ;)
*/ */
@ -5646,7 +5648,7 @@ q{doStuff(5)}c;
* Parses a Vector * Parses a Vector
* *
* $(GRAMMAR $(RULEDEF vector): * $(GRAMMAR $(RULEDEF vector):
* $(LITERAL '__vector') $(LITERAL '$(LPAREN)') $(RULE type) $(LITERAL '$(RPAREN)') * $(LITERAL '___vector') $(LITERAL '$(LPAREN)') $(RULE type) $(LITERAL '$(RPAREN)')
* ;) * ;)
*/ */
Vector parseVector() Vector parseVector()