diff --git a/stdx/d/ast.d b/stdx/d/ast.d index bda1001..2fefd2d 100644 --- a/stdx/d/ast.d +++ b/stdx/d/ast.d @@ -284,10 +284,10 @@ class AliasDeclaration : ASTNode public: void accept(ASTVisitor visitor) { - //mixin (visitIfNotNull!(type, declarator, initializers)); + mixin (visitIfNotNull!(type, name, initializers)); } /** */ Type type; - /** */ Declarator declarator; + /** */ Token name; /** */ AliasInitializer[] initializers; } @@ -297,10 +297,10 @@ class AliasInitializer : ASTNode public: override void accept(ASTVisitor visitor) { - mixin (visitIfNotNull!(identifier, type)); + mixin (visitIfNotNull!(name, type)); } - /** */ Token identifier; + /** */ Token name; /** */ Type type; } @@ -1895,14 +1895,14 @@ public: override string toString() { - if (vararg) - return "..."; string rVal; + rVal ~= parameterAttributes.map!(x => " " ~ getTokenValue(x)).join(); if (type !is null) - rVal = type.toString() ~ " "; + rVal = type.toString(); + if (vararg) + rVal ~= "..."; if (name.type != TokenType.invalid) - rVal ~= name.value; - rVal ~= parameterAttributes.map!(x => " " ~ getTokenValue(x)).join(); + rVal ~= " " ~ name.value; return rVal; } diff --git a/stdx/d/parser.d b/stdx/d/parser.d index aae916d..6487f15 100644 --- a/stdx/d/parser.d +++ b/stdx/d/parser.d @@ -111,7 +111,8 @@ struct Parser * Parses an AliasDeclaration. * * $(GRAMMAR $(RULEDEF aliasDeclaration): - * $(LITERAL 'alias') $(LPAREN)$(RULE aliasInitializer) $(LPAREN)$(LITERAL ',') $(RULE aliasInitializer)$(RPAREN)* | $(RULE type) $(RULE declarator)$(RPAREN) $(LITERAL ';') + * $(LITERAL 'alias') $(RULE aliasInitializer) $(LPAREN)$(LITERAL ',') $(RULE aliasInitializer)$(RPAREN)* + * | $(LITERAL 'alias') $(RULE type) $(LITERAL identifier) $(LITERAL ';') * ;) */ AliasDeclaration parseAliasDeclaration() @@ -136,7 +137,10 @@ struct Parser else { if ((node.type = parseType()) is null) return null; - if ((node.declarator = parseDeclarator()) is null) return null; + auto ident = expect(TokenType.identifier); + if (ident is null) + return null; + node.name = *ident; } if (expect(TokenType.semicolon) is null) return null; return node; @@ -170,7 +174,7 @@ alias core.sys.posix.stdio.fileno fileno; auto node = new AliasInitializer; auto i = expect(TokenType.identifier); if (i is null) return null; - node.identifier = *i; + node.name = *i; if (expect(TokenType.assign) is null) return null; node.type = parseType(); return node;