Closer to having the AST classes completed

This commit is contained in:
Hackerpilot 2013-07-27 03:12:14 +00:00
parent 830bd82ae3
commit 4a9c8699a5
2 changed files with 367 additions and 239 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2573,7 +2573,7 @@ body {} // six
auto node = new IdentifierOrTemplateChain; auto node = new IdentifierOrTemplateChain;
while (moreTokens()) while (moreTokens())
{ {
node.identifierOrTemplateInstances ~= parseIdentifierOrTemplateInstance(); node.identifiersOrTemplateInstances ~= parseIdentifierOrTemplateInstance();
if (!currentIs(TokenType.dot)) if (!currentIs(TokenType.dot))
break; break;
else else
@ -2706,7 +2706,6 @@ body {} // six
if (currentIs(TokenType.assign)) if (currentIs(TokenType.assign))
{ {
advance(); advance();
node.hasRight = true;
auto id = expect(TokenType.identifier); auto id = expect(TokenType.identifier);
if (id is null) return null; if (id is null) return null;
node.right = *id; node.right = *id;
@ -2881,7 +2880,10 @@ import core.stdc.stdio, std.string : KeepTerminator;
auto node = new InExpression; auto node = new InExpression;
node.left = shift is null ? parseShiftExpression() : shift; node.left = shift is null ? parseShiftExpression() : shift;
if (currentIs(TokenType.not)) if (currentIs(TokenType.not))
advance(); {
node.negated = true;
advance();
}
if (expect(TokenType.in_) is null) return null; if (expect(TokenType.in_) is null) return null;
node.right = parseShiftExpression(); node.right = parseShiftExpression();
return node; return node;
@ -3064,7 +3066,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()
@ -3343,7 +3345,8 @@ invariant() foo();
* Parses a MixinTemplateName * Parses a MixinTemplateName
* *
* $(GRAMMAR $(RULEDEF mixinTemplateName): * $(GRAMMAR $(RULEDEF mixinTemplateName):
* ($(RULE typeofExpression)? $(LITERAL '.'))? $(RULE identifierOrTemplateChain) * $(RULE symbol)
* | $(RULE typeofExpression) $(LITERAL '.') $(RULE identifierOrTemplateChain)
* ;) * ;)
*/ */
MixinTemplateName parseMixinTemplateName() MixinTemplateName parseMixinTemplateName()
@ -3354,8 +3357,10 @@ invariant() foo();
{ {
node.typeofExpression = parseTypeofExpression(); node.typeofExpression = parseTypeofExpression();
expect(TokenType.dot); expect(TokenType.dot);
node.identifierOrTemplateChain = parseIdentifierOrTemplateChain();
} }
node.identifierOrTemplateChain = parseIdentifierOrTemplateChain(); else
node.symbol = parseSymbol();
return node; return node;
} }
@ -4303,8 +4308,8 @@ q{(int a, ...)
auto node = new SingleImport; auto node = new SingleImport;
if (startsWith(TokenType.identifier, TokenType.assign)) if (startsWith(TokenType.identifier, TokenType.assign))
{ {
node.identifier = advance(); node.rename = advance();
advance(); advance(); // =
} }
node.identifierChain = parseIdentifierChain(); node.identifierChain = parseIdentifierChain();
return node; return node;