Fewer TODO comments
This commit is contained in:
parent
ad8b4fdeaa
commit
859ddd3d20
14
std/d/ast.d
14
std/d/ast.d
|
|
@ -58,7 +58,6 @@ abstract class ASTVisitor
|
|||
/** */ void visit(AssertExpression assertExpression) { assertExpression.accept(this); }
|
||||
/** */ void visit(AssertStatement assertStatement) { assertStatement.accept(this); }
|
||||
/** */ void visit(AssignExpression assignExpression) { assignExpression.accept(this); }
|
||||
/** */ void visit(AssignStatement assignStatement) { assignStatement.accept(this); }
|
||||
/** */ void visit(AssocArrayLiteral assocArrayLiteral) { assocArrayLiteral.accept(this); }
|
||||
/** */ void visit(AtAttribute atAttribute) { atAttribute.accept(this); }
|
||||
/** */ void visit(Attribute attribute) { attribute.accept(this); }
|
||||
|
|
@ -542,18 +541,6 @@ public:
|
|||
/** */ TokenType operator;
|
||||
}
|
||||
|
||||
///
|
||||
class AssignStatement : ASTNode
|
||||
{
|
||||
public:
|
||||
mixin(DEFAULT_ACCEPT);
|
||||
/** */ PreIncDecExpression preIncDecExpression;
|
||||
/** */ PostIncDecExpression postIncDecExpression;
|
||||
/** */ UnaryExpression[] unaryExpressions;
|
||||
/** */ AssignExpression[] assignExpressions;
|
||||
/** */ TokenType[] assignOperators;
|
||||
}
|
||||
|
||||
///
|
||||
class AssocArrayLiteral : ASTNode
|
||||
{
|
||||
|
|
@ -1482,7 +1469,6 @@ public:
|
|||
mixin(DEFAULT_ACCEPT);
|
||||
/** */ LabeledStatement labeledStatement;
|
||||
/** */ BlockStatement blockStatement;
|
||||
/** */ AssignStatement assignStatement;
|
||||
/** */ IfStatement ifStatement;
|
||||
/** */ WhileStatement whileStatement;
|
||||
/** */ DoStatement doStatement;
|
||||
|
|
|
|||
123
std/d/parser.d
123
std/d/parser.d
|
|
@ -375,7 +375,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmAndExp parseAsmAndExp()
|
||||
{
|
||||
auto node = new AsmAndExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -390,7 +390,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmBrExp parseAsmBrExp()
|
||||
{
|
||||
auto node = new AsmBrExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -404,7 +404,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmEqualExp parseAsmEqualExp()
|
||||
{
|
||||
auto node = new AsmEqualExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -418,7 +418,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmExp parseAsmExp()
|
||||
{
|
||||
auto node = new AsmExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -437,7 +437,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmInstruction parseAsmInstruction()
|
||||
{
|
||||
auto node = new AsmInstruction;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -451,7 +451,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmLogAndExp parseAsmLogAndExp()
|
||||
{
|
||||
auto node = new AsmLogAndExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -465,7 +465,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmLogOrExp parseAsmLogOrExp()
|
||||
{
|
||||
auto node = new AsmLogOrExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -479,7 +479,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmMulExp parseAsmMulExp()
|
||||
{
|
||||
auto node = new AsmMulExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -493,7 +493,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmOrExp parseAsmOrExp()
|
||||
{
|
||||
auto node = new AsmOrExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -511,7 +511,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmPrimaryExp parseAsmPrimaryExp()
|
||||
{
|
||||
auto node = new AsmPrimaryExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -525,7 +525,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmRelExp parseAsmRelExp()
|
||||
{
|
||||
auto node = new AsmRelExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -539,7 +539,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmShiftExp parseAsmShiftExp()
|
||||
{
|
||||
auto node = new AsmShiftExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -553,7 +553,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmStatement parseAsmStatement()
|
||||
{
|
||||
auto node = new AsmStatement;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -573,7 +573,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmTypePrefix parseAsmTypePrefix()
|
||||
{
|
||||
auto node = new AsmTypePrefix;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -593,7 +593,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmUnaExp parseAsmUnaExp()
|
||||
{
|
||||
auto node = new AsmUnaExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -607,7 +607,7 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AsmXorExp parseAsmXorExp()
|
||||
{
|
||||
auto node = new AsmXorExp;
|
||||
// TODO
|
||||
// TODO asm
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -674,21 +674,6 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses an AssignStatement
|
||||
*
|
||||
* $(GRAMMAR $(RULEDEF assignStatement):
|
||||
* $(RULE unaryExpression) $(RULE assignOperator) $(RULE assignExpression) ($(LITERAL ',') $(RULE unaryExpression) $(RULE assignOperator) $(RULE assignExpression))* $(LITERAL ';')
|
||||
* ;)
|
||||
*/
|
||||
AssignStatement parseAssignStatement()
|
||||
{
|
||||
auto node = new AssignStatement;
|
||||
// TODO
|
||||
if (expect(TokenType.semicolon) is null) return null;
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses an AssocArrayLiteral
|
||||
*
|
||||
|
|
@ -855,7 +840,22 @@ alias core.sys.posix.stdio.fileno fileno;
|
|||
AutoDeclaration parseAutoDeclaration()
|
||||
{
|
||||
auto node = new AutoDeclaration;
|
||||
// TODO
|
||||
node.storageClass = parseStorageClass();
|
||||
if (node.storageClass is null) return null;
|
||||
do
|
||||
{
|
||||
auto ident = expect(TokenType.identifier);
|
||||
if (ident is null) return null;
|
||||
node.identifiers ~= *ident;
|
||||
if (expect(TokenType.assign) is null) return null;
|
||||
auto init = parseInitializer();
|
||||
if (init is null) return null;
|
||||
node.initializers ~= init;
|
||||
if (currentIs(TokenType.comma))
|
||||
advance();
|
||||
else
|
||||
break;
|
||||
} while (true);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -2014,7 +2014,7 @@ class ClassFour(A, B) if (someTest()) : Super {}}c;
|
|||
EnumMember parseEnumMember()
|
||||
{
|
||||
auto node = new EnumMember;
|
||||
// TODO
|
||||
// TODO: ambiguity between type and identifier
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -2103,13 +2103,17 @@ class ClassFour(A, B) if (someTest()) : Super {}}c;
|
|||
*/
|
||||
ForStatement parseForStatement()
|
||||
{
|
||||
// forStatement:
|
||||
// 'for' '(' declarationOrStatement expression? ';' expression? ')' statementNoCaseNoDefault
|
||||
// ;
|
||||
auto node = new ForStatement;
|
||||
expect(TokenType.for_);
|
||||
expect(TokenType.lParen);
|
||||
if (expect(TokenType.for_) is null) return null;
|
||||
if (expect(TokenType.lParen) is null) return null;
|
||||
// TODO
|
||||
assert (0);
|
||||
expect(TokenType.rParen);
|
||||
if (expect(TokenType.rParen) is null) return null;
|
||||
node.statementNoCaseNoDefault = parseStatementNoCaseNoDefault();
|
||||
if (node.statementNoCaseNoDefault is null) return null;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -2417,7 +2421,31 @@ body {} // six
|
|||
FunctionLiteralExpression parseFunctionLiteralExpression()
|
||||
{
|
||||
auto node = new FunctionLiteralExpression;
|
||||
// TODO
|
||||
if (currentIsOneOf(TokenType.function_, TokenType.delegate_))
|
||||
{
|
||||
node.functionOrDelegate = advance().type;
|
||||
if (!currentIsOneOf(TokenType.lParen, TokenType.in_, TokenType.body_,
|
||||
TokenType.out_, TokenType.rBrace))
|
||||
{
|
||||
node.type = parseType();
|
||||
if (node.type is null) return null;
|
||||
}
|
||||
}
|
||||
if (currentIs(TokenType.lParen))
|
||||
{
|
||||
node.parameters = parseParameters();
|
||||
if (node.parameters is null) return null;
|
||||
do
|
||||
{
|
||||
auto attr = parseFunctionAttribute(false);
|
||||
if (attr is null)
|
||||
break;
|
||||
else
|
||||
node.functionAttributes ~= attr;
|
||||
} while (true);
|
||||
}
|
||||
node.functionBody = parseFunctionBody();
|
||||
if (node.functionBody is null) return null;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -3319,7 +3347,6 @@ invariant() foo();
|
|||
* $(GRAMMAR $(RULEDEF statementNoCaseNoDefault):
|
||||
* $(RULE labeledStatement)
|
||||
* | $(RULE blockStatement)
|
||||
* | $(RULE assignStatement)
|
||||
* | $(RULE ifStatement)
|
||||
* | $(RULE whileStatement)
|
||||
* | $(RULE doStatement)
|
||||
|
|
@ -4801,7 +4828,7 @@ q{(int a, ...)
|
|||
TraitsArgument parseTraitsArgument()
|
||||
{
|
||||
auto node = new TraitsArgument;
|
||||
// TODO
|
||||
if ()
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -5100,7 +5127,16 @@ q{(int a, ...)
|
|||
auto node = new TypeidExpression;
|
||||
expect(TokenType.typeid_);
|
||||
expect(TokenType.lParen);
|
||||
// TODO
|
||||
if (isExpression())
|
||||
{
|
||||
node.expression = parseExpression();
|
||||
if (node.expression is null) return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
node.type = parseType();
|
||||
if (node.type is null) return null;
|
||||
}
|
||||
expect(TokenType.rParen);
|
||||
return node;
|
||||
}
|
||||
|
|
@ -5481,6 +5517,13 @@ private:
|
|||
return parseStatement() !is null;
|
||||
}
|
||||
|
||||
bool isExpression()
|
||||
{
|
||||
auto b = setBookmark();
|
||||
scope (exit) goToBookmark(b);
|
||||
return parseExpression() !is null;
|
||||
}
|
||||
|
||||
bool currentIsMemberFunctionAttribute() const
|
||||
{
|
||||
switch (current.type)
|
||||
|
|
|
|||
Loading…
Reference in New Issue