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

View File

@ -125,7 +125,6 @@ public:
/** */ void visit(ImportBindings importBindings) { importBindings.accept(this); } /** */ void visit(ImportBindings importBindings) { importBindings.accept(this); }
/** */ void visit(ImportDeclaration importDeclaration) { importDeclaration.accept(this); } /** */ void visit(ImportDeclaration importDeclaration) { importDeclaration.accept(this); }
/** */ void visit(ImportExpression importExpression) { importExpression.accept(this); } /** */ void visit(ImportExpression importExpression) { importExpression.accept(this); }
/** */ void visit(ImportList importList) { importList.accept(this); }
/** */ void visit(IndexExpression indexExpression) { indexExpression.accept(this); } /** */ void visit(IndexExpression indexExpression) { indexExpression.accept(this); }
/** */ void visit(InExpression inExpression) { inExpression.accept(this); } /** */ void visit(InExpression inExpression) { inExpression.accept(this); }
/** */ void visit(InStatement inStatement) { inStatement.accept(this); } /** */ void visit(InStatement inStatement) { inStatement.accept(this); }
@ -1171,7 +1170,11 @@ public:
class ForeachStatement : ASTNode class ForeachStatement : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(foreachTypeList, low, high,
statementNoCaseNoDefault));
}
/** */ TokenType foreachType; /** */ TokenType foreachType;
/** */ ForeachTypeList foreachTypeList; /** */ ForeachTypeList foreachTypeList;
/** */ Expression low; /** */ Expression low;
@ -1183,7 +1186,10 @@ public:
class ForeachType : ASTNode class ForeachType : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(type, identifier));
}
/** */ TokenType[] typeConstructors; /** */ TokenType[] typeConstructors;
/** */ Type type; /** */ Type type;
/** */ Token identifier; /** */ Token identifier;
@ -1193,7 +1199,10 @@ public:
class ForeachTypeList : ASTNode class ForeachTypeList : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(items));
}
/** */ ForeachType[] items; /** */ ForeachType[] items;
} }
@ -1201,7 +1210,10 @@ public:
class FunctionAttribute : ASTNode class FunctionAttribute : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(token, atAttribute));
}
/** */ Token token; /** */ Token token;
/** */ AtAttribute atAttribute; /** */ AtAttribute atAttribute;
} }
@ -1226,7 +1238,10 @@ public:
class FunctionCallExpression : ExpressionNode class FunctionCallExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(unaryExpression, arguments, templateArguments));
}
/** */ UnaryExpression unaryExpression; /** */ UnaryExpression unaryExpression;
/** */ TemplateArguments templateArguments; /** */ TemplateArguments templateArguments;
/** */ Arguments arguments; /** */ Arguments arguments;
@ -1236,7 +1251,10 @@ public:
class FunctionCallStatement : ASTNode class FunctionCallStatement : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(functionCallExpression));
}
/** */ FunctionCallExpression functionCallExpression; /** */ FunctionCallExpression functionCallExpression;
} }
@ -1246,10 +1264,9 @@ class FunctionDeclaration : ASTNode
public: public:
override void accept(ASTVisitor visitor) override void accept(ASTVisitor visitor)
{ {
mixin (visitIfNotNull!(memberFunctionAttributes, returnType, parameters, mixin (visitIfNotNull!(returnType, parameters, templateParameters,
templateParameters, constraint, functionBody)); constraint, memberFunctionAttributes, functionBody));
} }
/** */ bool hasAuto; /** */ bool hasAuto;
/** */ bool hasRef; /** */ bool hasRef;
/** */ Type returnType; /** */ Type returnType;
@ -1265,7 +1282,11 @@ public:
class FunctionLiteralExpression : ExpressionNode class FunctionLiteralExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(type, parameters, functionAttributes,
functionBody));
}
/** */ TokenType functionOrDelegate; /** */ TokenType functionOrDelegate;
/** */ Type type; /** */ Type type;
/** */ Parameters parameters; /** */ Parameters parameters;
@ -1308,13 +1329,16 @@ public:
class IdentifierOrTemplateChain : ASTNode class IdentifierOrTemplateChain : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(identifiersOrTemplateInstances));
}
override string toString() override string toString()
{ {
string rVal; string rVal;
bool first = true; bool first = true;
foreach (iot; identifierOrTemplateInstances) foreach (iot; identifiersOrTemplateInstances)
{ {
if (!first) if (!first)
rVal ~= "."; rVal ~= ".";
@ -1323,14 +1347,17 @@ public:
} }
return rVal; return rVal;
} }
/** */ IdentifierOrTemplateInstance[] identifierOrTemplateInstances; /** */ IdentifierOrTemplateInstance[] identifiersOrTemplateInstances;
} }
/// ///
class IdentifierOrTemplateInstance : ASTNode class IdentifierOrTemplateInstance : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(identifier, templateInstance));
}
override string toString() override string toString()
{ {
@ -1347,7 +1374,10 @@ public:
class IdentityExpression : ExpressionNode class IdentityExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(left, right));
}
/** */ bool negated; /** */ bool negated;
mixin BinaryExpressionBody; mixin BinaryExpressionBody;
} }
@ -1356,7 +1386,11 @@ public:
class IfStatement : ASTNode class IfStatement : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(identifier, type, expression, thenStatement,
elseStatement));
}
/** */ Token identifier; /** */ Token identifier;
/** */ Type type; /** */ Type type;
/** */ Expression expression; /** */ Expression expression;
@ -1371,14 +1405,16 @@ public:
mixin (DEFAULT_ACCEPT); mixin (DEFAULT_ACCEPT);
/** */ Token left; /** */ Token left;
/** */ Token right; /** */ Token right;
/** */ bool hasRight;
} }
/// ///
class ImportBindings : ASTNode class ImportBindings : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(singleImport, importBinds));
}
/** */ SingleImport singleImport; /** */ SingleImport singleImport;
/** */ ImportBind[] importBinds; /** */ ImportBind[] importBinds;
} }
@ -1387,7 +1423,10 @@ public:
class ImportDeclaration : ASTNode class ImportDeclaration : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(singleImports, importBindings));
}
/** */ SingleImport[] singleImports; /** */ SingleImport[] singleImports;
/** */ ImportBindings importBindings; /** */ ImportBindings importBindings;
} }
@ -1396,25 +1435,21 @@ public:
class ImportExpression : ExpressionNode class ImportExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
/** */ AssignExpression assignExpression;
}
///
class ImportList : ASTNode
{ {
public: mixin (visitIfNotNull!(assignExpression));
mixin (DEFAULT_ACCEPT); }
/** */ SingleImport singleImport; /** */ AssignExpression assignExpression;
/** */ ImportList next;
/** */ ImportBindings bindings;
} }
/// ///
class IndexExpression : ExpressionNode class IndexExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(unaryExpression, argumentList));
}
/** */ UnaryExpression unaryExpression; /** */ UnaryExpression unaryExpression;
/** */ ArgumentList argumentList; /** */ ArgumentList argumentList;
} }
@ -1423,16 +1458,22 @@ public:
class InExpression : ExpressionNode class InExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
/** */ Token operator; {
mixin (visitIfNotNull!(left, right));
}
mixin BinaryExpressionBody; mixin BinaryExpressionBody;
bool negated;
} }
/// ///
class InStatement : ASTNode class InStatement : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(blockStatement));
}
/** */ BlockStatement blockStatement; /** */ BlockStatement blockStatement;
} }
@ -1440,7 +1481,10 @@ public:
class Initialize : ASTNode class Initialize : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(statementNoCaseNoDefault));
}
/** */ StatementNoCaseNoDefault statementNoCaseNoDefault; /** */ StatementNoCaseNoDefault statementNoCaseNoDefault;
} }
@ -1448,7 +1492,10 @@ public:
class Initializer : ASTNode class Initializer : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(nonVoidInitializer));
}
/** */ NonVoidInitializer nonVoidInitializer; /** */ NonVoidInitializer nonVoidInitializer;
} }
@ -1472,7 +1519,10 @@ public:
class Invariant : ASTNode class Invariant : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(blockStatement));
}
/** */ BlockStatement blockStatement; /** */ BlockStatement blockStatement;
} }
@ -1480,9 +1530,12 @@ public:
class IsExpression : ExpressionNode class IsExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(type, identifier, typeSpecialization,
templateParameterList));
}
/** */ Type type; /** */ Type type;
/** */ AssignExpression assignExpression;
/** */ Token identifier; /** */ Token identifier;
/** */ TypeSpecialization typeSpecialization; /** */ TypeSpecialization typeSpecialization;
/** */ TemplateParameterList templateParameterList; /** */ TemplateParameterList templateParameterList;
@ -1493,7 +1546,10 @@ public:
class KeyValuePair : ASTNode class KeyValuePair : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(key, value));
}
/** */ AssignExpression key; /** */ AssignExpression key;
/** */ AssignExpression value; /** */ AssignExpression value;
} }
@ -1502,7 +1558,10 @@ public:
class KeyValuePairs : ASTNode class KeyValuePairs : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(keyValuePairs));
}
/** */ KeyValuePair[] keyValuePairs; /** */ KeyValuePair[] keyValuePairs;
} }
@ -1510,7 +1569,10 @@ public:
class LabeledStatement : ASTNode class LabeledStatement : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(identifier, declarationOrStatement));
}
Token identifier; Token identifier;
/** */ DeclarationOrStatement declarationOrStatement; /** */ DeclarationOrStatement declarationOrStatement;
} }
@ -1519,7 +1581,11 @@ public:
class LambdaExpression : ExpressionNode class LambdaExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(identifier, parameters, functionAttributes,
assignExpression));
}
/** */ TokenType functionType; /** */ TokenType functionType;
/** */ Token identifier; /** */ Token identifier;
/** */ Parameters parameters; /** */ Parameters parameters;
@ -1531,7 +1597,10 @@ public:
class LastCatch : ASTNode class LastCatch : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(statementNoCaseNoDefault));
}
/** */ StatementNoCaseNoDefault statementNoCaseNoDefault; /** */ StatementNoCaseNoDefault statementNoCaseNoDefault;
} }
@ -1548,7 +1617,10 @@ public:
class MemberFunctionAttribute : ASTNode class MemberFunctionAttribute : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(atAttribute));
}
/** */ TokenType tokenType; /** */ TokenType tokenType;
/** */ AtAttribute atAttribute; /** */ AtAttribute atAttribute;
} }
@ -1557,7 +1629,10 @@ public:
class MixinDeclaration : ASTNode class MixinDeclaration : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(mixinExpression, templateMixinExpression));
}
/** */ MixinExpression mixinExpression; /** */ MixinExpression mixinExpression;
/** */ TemplateMixinExpression templateMixinExpression; /** */ TemplateMixinExpression templateMixinExpression;
} }
@ -1566,7 +1641,10 @@ public:
class MixinExpression : ExpressionNode class MixinExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(assignExpression));
}
/** */ AssignExpression assignExpression; /** */ AssignExpression assignExpression;
} }
@ -1574,7 +1652,10 @@ public:
class MixinTemplateDeclaration : ASTNode class MixinTemplateDeclaration : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(templateDeclaration));
}
/** */ TemplateDeclaration templateDeclaration; /** */ TemplateDeclaration templateDeclaration;
} }
@ -1582,8 +1663,11 @@ public:
class MixinTemplateName : ASTNode class MixinTemplateName : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
/** */ bool hasDot; {
mixin (visitIfNotNull!(symbol, typeofExpression, identifierOrTemplateChain));
}
/** */ Symbol symbol;
/** */ IdentifierOrTemplateChain identifierOrTemplateChain; /** */ IdentifierOrTemplateChain identifierOrTemplateChain;
/** */ TypeofExpression typeofExpression; /** */ TypeofExpression typeofExpression;
} }
@ -1594,10 +1678,7 @@ class Module : ASTNode
public: public:
override void accept(ASTVisitor visitor) override void accept(ASTVisitor visitor)
{ {
if (moduleDeclaration !is null) mixin (visitIfNotNull!(moduleDeclaration, declarations));
visitor.visit(moduleDeclaration);
foreach(d; declarations)
visitor.visit(d);
} }
/** */ ModuleDeclaration moduleDeclaration; /** */ ModuleDeclaration moduleDeclaration;
/** */ Declaration[] declarations; /** */ Declaration[] declarations;
@ -1609,7 +1690,7 @@ class ModuleDeclaration : ASTNode
public: public:
override void accept(ASTVisitor visitor) override void accept(ASTVisitor visitor)
{ {
if (moduleName !is null) visitor.visit(moduleName); mixin (visitIfNotNull!(moduleName));
} }
/** */ IdentifierChain moduleName; /** */ IdentifierChain moduleName;
} }
@ -1619,7 +1700,10 @@ public:
class MulExpression : ExpressionNode class MulExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(left, right));
}
/** */ TokenType operator; /** */ TokenType operator;
mixin BinaryExpressionBody; mixin BinaryExpressionBody;
} }
@ -1628,7 +1712,11 @@ public:
class NewAnonClassExpression : ExpressionNode class NewAnonClassExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(allocatorArguments, constructorArguments,
baseClassList, structBody));
}
/** */ Arguments allocatorArguments; /** */ Arguments allocatorArguments;
/** */ Arguments constructorArguments; /** */ Arguments constructorArguments;
/** */ BaseClassList baseClassList; /** */ BaseClassList baseClassList;
@ -1639,7 +1727,11 @@ public:
class NewExpression : ExpressionNode class NewExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(newAnonClassExpression, type, arguments,
assignExpression));
}
/** */ Type type; /** */ Type type;
/** */ NewAnonClassExpression newAnonClassExpression; /** */ NewAnonClassExpression newAnonClassExpression;
/** */ Arguments arguments; /** */ Arguments arguments;
@ -1651,7 +1743,17 @@ public:
class StatementNoCaseNoDefault : ASTNode class StatementNoCaseNoDefault : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(labeledStatement, blockStatement, ifStatement,
whileStatement, doStatement, forStatement, foreachStatement,
switchStatement, finalSwitchStatement, continueStatement,
breakStatement, returnStatement, gotoStatement, withStatement,
synchronizedStatement, tryStatement, throwStatement,
scopeGuardStatement, asmStatement, conditionalStatement,
staticAssertStatement, versionSpecification, debugSpecification,
functionCallStatement, expressionStatement));
}
/** */ LabeledStatement labeledStatement; /** */ LabeledStatement labeledStatement;
/** */ BlockStatement blockStatement; /** */ BlockStatement blockStatement;
/** */ IfStatement ifStatement; /** */ IfStatement ifStatement;
@ -1683,7 +1785,10 @@ public:
class NonVoidInitializer : ASTNode class NonVoidInitializer : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(assignExpression, arrayInitializer, structInitializer));
}
/** */ AssignExpression assignExpression; /** */ AssignExpression assignExpression;
/** */ ArrayInitializer arrayInitializer; /** */ ArrayInitializer arrayInitializer;
/** */ StructInitializer structInitializer; /** */ StructInitializer structInitializer;
@ -1710,7 +1815,10 @@ public:
class OrExpression : ExpressionNode class OrExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(left, right));
}
mixin BinaryExpressionBody; mixin BinaryExpressionBody;
} }
@ -1718,7 +1826,10 @@ public:
class OrOrExpression : ExpressionNode class OrOrExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(left, right));
}
mixin BinaryExpressionBody; mixin BinaryExpressionBody;
} }
@ -1726,7 +1837,10 @@ public:
class OutStatement : ASTNode class OutStatement : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(parameter, blockStatement));
}
/** */ Token parameter; /** */ Token parameter;
/** */ BlockStatement blockStatement; /** */ BlockStatement blockStatement;
} }
@ -1737,7 +1851,7 @@ class Parameter : ASTNode
public: public:
override void accept(ASTVisitor visitor) override void accept(ASTVisitor visitor)
{ {
mixin (visitIfNotNull!(type, default_)); mixin (visitIfNotNull!(type, name, default_));
} }
/** */ TokenType[] parameterAttributes; /** */ TokenType[] parameterAttributes;
/** */ Type type; /** */ Type type;
@ -1888,7 +2002,10 @@ public:
class ShiftExpression : ExpressionNode class ShiftExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(left, right));
}
/** */ TokenType operator; /** */ TokenType operator;
mixin BinaryExpressionBody; mixin BinaryExpressionBody;
} }
@ -1897,8 +2014,11 @@ public:
class SingleImport : ASTNode class SingleImport : ASTNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); override void accept(ASTVisitor visitor)
/** */ Token identifier; {
mixin (visitIfNotNull!(rename, identifierChain));
}
/** */ Token rename;
/** */ IdentifierChain identifierChain; /** */ IdentifierChain identifierChain;
} }
@ -1906,7 +2026,10 @@ public:
class SliceExpression : ExpressionNode class SliceExpression : ExpressionNode
{ {
public: public:
mixin (DEFAULT_ACCEPT); /+override+/ void accept(ASTVisitor visitor)
{
mixin (visitIfNotNull!(unaryExpression, lower, upper));
}
/** */ UnaryExpression unaryExpression; /** */ UnaryExpression unaryExpression;
/** */ AssignExpression lower; /** */ AssignExpression lower;
/** */ AssignExpression upper; /** */ AssignExpression upper;

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))
{
node.negated = true;
advance(); 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;