Added destructors, constructors, and invariants to ctags output
This commit is contained in:
parent
9722183249
commit
3798387c19
25
ctags.d
25
ctags.d
|
@ -90,6 +90,26 @@ class CTagsPrinter : ASTVisitor
|
||||||
context = c;
|
context = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override void visit(const Constructor dec)
|
||||||
|
{
|
||||||
|
tagLines ~= "this\t%s\t%d;\"\tf\tarity:%d%s\n".format(fileName,
|
||||||
|
dec.line, dec.parameters.parameters.length, context);
|
||||||
|
auto c = context;
|
||||||
|
context = "\tfunction: this";
|
||||||
|
dec.accept(this);
|
||||||
|
context = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
override void visit(const Destructor dec)
|
||||||
|
{
|
||||||
|
tagLines ~= "~this\t%s\t%d;\"\tf%s\n".format(fileName, dec.line,
|
||||||
|
context);
|
||||||
|
auto c = context;
|
||||||
|
context = "\tfunction: this";
|
||||||
|
dec.accept(this);
|
||||||
|
context = c;
|
||||||
|
}
|
||||||
|
|
||||||
override void visit(const EnumDeclaration dec)
|
override void visit(const EnumDeclaration dec)
|
||||||
{
|
{
|
||||||
if (dec.name == tok!"")
|
if (dec.name == tok!"")
|
||||||
|
@ -136,6 +156,11 @@ class CTagsPrinter : ASTVisitor
|
||||||
dec.accept(this);
|
dec.accept(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override void visit(const Invariant dec)
|
||||||
|
{
|
||||||
|
tagLines ~= "invariant\t%s\t%d;\"\tv%s\n".format(fileName, dec.line, context);
|
||||||
|
}
|
||||||
|
|
||||||
alias visit = ASTVisitor.visit;
|
alias visit = ASTVisitor.visit;
|
||||||
|
|
||||||
string fileName;
|
string fileName;
|
||||||
|
|
10
std/d/ast.d
10
std/d/ast.d
|
@ -1239,7 +1239,9 @@ public:
|
||||||
}
|
}
|
||||||
/** */ MemberFunctionAttribute[] memberFunctionAttributes;
|
/** */ MemberFunctionAttribute[] memberFunctionAttributes;
|
||||||
/** */ FunctionBody functionBody;
|
/** */ FunctionBody functionBody;
|
||||||
/** */ size_t location;
|
/** */ size_t line;
|
||||||
|
/** */ size_t column;
|
||||||
|
/** */ size_t index;
|
||||||
/** */ string comment;
|
/** */ string comment;
|
||||||
mixin OpEquals;
|
mixin OpEquals;
|
||||||
}
|
}
|
||||||
|
@ -1780,6 +1782,8 @@ public:
|
||||||
}
|
}
|
||||||
/** */ BlockStatement blockStatement;
|
/** */ BlockStatement blockStatement;
|
||||||
/** */ string comment;
|
/** */ string comment;
|
||||||
|
size_t line;
|
||||||
|
size_t index;
|
||||||
mixin OpEquals;
|
mixin OpEquals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1873,12 +1877,12 @@ final class LinkageAttribute : ASTNode
|
||||||
public:
|
public:
|
||||||
override void accept(ASTVisitor visitor) const
|
override void accept(ASTVisitor visitor) const
|
||||||
{
|
{
|
||||||
version (DIP61) mixin (visitIfNotNull!(identifier, identifierChain));
|
version (DIP61) mixin (visitIfNotNull!(identifier, identifierChain));
|
||||||
else mixin (visitIfNotNull!(identifier));
|
else mixin (visitIfNotNull!(identifier));
|
||||||
}
|
}
|
||||||
/** */ Token identifier;
|
/** */ Token identifier;
|
||||||
/** */ bool hasPlusPlus;
|
/** */ bool hasPlusPlus;
|
||||||
version (DIP61) /** */ IdentifierChain identifierChain;
|
version (DIP61) /** */ IdentifierChain identifierChain;
|
||||||
mixin OpEquals;
|
mixin OpEquals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ class Parser
|
||||||
node.linkageAttribute = parseLinkageAttribute();
|
node.linkageAttribute = parseLinkageAttribute();
|
||||||
}
|
}
|
||||||
warn("Prefer the new \"'alias' identifier '=' type ';'\" syntax"
|
warn("Prefer the new \"'alias' identifier '=' type ';'\" syntax"
|
||||||
~ " to the old \"'alias' type identifier ';'\" syntax");
|
~ " to the old \"'alias' type identifier ';'\" syntax");
|
||||||
if ((node.type = parseType()) is null) return null;
|
if ((node.type = parseType()) is null) return null;
|
||||||
auto ident = expect(tok!"identifier");
|
auto ident = expect(tok!"identifier");
|
||||||
if (ident is null)
|
if (ident is null)
|
||||||
|
@ -1976,20 +1976,23 @@ class ClassFour(A, B) if (someTest()) : Super {}}c;
|
||||||
node.comment = comment;
|
node.comment = comment;
|
||||||
comment = null;
|
comment = null;
|
||||||
if (expect(tok!"~") is null) return null;
|
if (expect(tok!"~") is null) return null;
|
||||||
|
node.index = current.index;
|
||||||
|
node.line = current.line;
|
||||||
|
node.column = current.column;
|
||||||
if (expect(tok!"this") is null) return null;
|
if (expect(tok!"this") is null) return null;
|
||||||
if (expect(tok!"(") is null) return null;
|
if (expect(tok!"(") is null) return null;
|
||||||
if (expect(tok!")") is null) return null;
|
if (expect(tok!")") is null) return null;
|
||||||
if (currentIs(tok!";"))
|
if (currentIs(tok!";"))
|
||||||
advance();
|
advance();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MemberFunctionAttribute[] memberFunctionAttributes;
|
MemberFunctionAttribute[] memberFunctionAttributes;
|
||||||
while(moreTokens() && currentIsMemberFunctionAttribute())
|
while(moreTokens() && currentIsMemberFunctionAttribute())
|
||||||
memberFunctionAttributes ~= parseMemberFunctionAttribute();
|
memberFunctionAttributes ~= parseMemberFunctionAttribute();
|
||||||
node.memberFunctionAttributes = ownArray(memberFunctionAttributes);
|
node.memberFunctionAttributes = ownArray(memberFunctionAttributes);
|
||||||
|
|
||||||
node.functionBody = parseFunctionBody();
|
node.functionBody = parseFunctionBody();
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3185,6 +3188,8 @@ interface "Four"
|
||||||
Invariant parseInvariant()
|
Invariant parseInvariant()
|
||||||
{
|
{
|
||||||
auto node = allocate!Invariant;
|
auto node = allocate!Invariant;
|
||||||
|
node.index = current.index;
|
||||||
|
node.line = current.line;
|
||||||
if (expect(tok!"invariant") is null) return null;
|
if (expect(tok!"invariant") is null) return null;
|
||||||
if (currentIs(tok!"("))
|
if (currentIs(tok!"("))
|
||||||
{
|
{
|
||||||
|
@ -3414,11 +3419,11 @@ invariant() foo();
|
||||||
{
|
{
|
||||||
advance();
|
advance();
|
||||||
node.hasPlusPlus = true;
|
node.hasPlusPlus = true;
|
||||||
version(DIP61) if (currentIs(tok!","))
|
version(DIP61) if (currentIs(tok!","))
|
||||||
{
|
{
|
||||||
advance();
|
advance();
|
||||||
node.identifierChain = parseIdentifierChain();
|
node.identifierChain = parseIdentifierChain();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expect(tok!")");
|
expect(tok!")");
|
||||||
return node;
|
return node;
|
||||||
|
@ -4545,18 +4550,18 @@ q{(int a, ...)
|
||||||
if (!currentIs(tok!"]"))
|
if (!currentIs(tok!"]"))
|
||||||
{
|
{
|
||||||
node.lower = parseAssignExpression();
|
node.lower = parseAssignExpression();
|
||||||
if (node.lower is null)
|
if (node.lower is null)
|
||||||
{
|
{
|
||||||
error("assignExpression expected");
|
error("assignExpression expected");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
expect(tok!"..");
|
expect(tok!"..");
|
||||||
node.upper = parseAssignExpression();
|
node.upper = parseAssignExpression();
|
||||||
if (node.upper is null)
|
if (node.upper is null)
|
||||||
{
|
{
|
||||||
error("assignExpression expected");
|
error("assignExpression expected");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (expect(tok!"]") is null) return null;
|
if (expect(tok!"]") is null) return null;
|
||||||
return node;
|
return node;
|
||||||
|
@ -4810,13 +4815,13 @@ q{(int a, ...)
|
||||||
mixin(traceEnterAndExit!(__FUNCTION__));
|
mixin(traceEnterAndExit!(__FUNCTION__));
|
||||||
auto node = allocate!StructInitializer;
|
auto node = allocate!StructInitializer;
|
||||||
expect(tok!"{");
|
expect(tok!"{");
|
||||||
if (currentIs(tok!"}"))
|
if (currentIs(tok!"}"))
|
||||||
advance();
|
advance();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
node.structMemberInitializers = parseStructMemberInitializers();
|
node.structMemberInitializers = parseStructMemberInitializers();
|
||||||
expect(tok!"}");
|
expect(tok!"}");
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6349,7 +6354,7 @@ protected:
|
||||||
case tok!"abstract":
|
case tok!"abstract":
|
||||||
case tok!"pure":
|
case tok!"pure":
|
||||||
case tok!"nothrow":
|
case tok!"nothrow":
|
||||||
return true;
|
return true;
|
||||||
mixin(BASIC_TYPE_CASES);
|
mixin(BASIC_TYPE_CASES);
|
||||||
return !peekIs(tok!".");
|
return !peekIs(tok!".");
|
||||||
case tok!"case":
|
case tok!"case":
|
||||||
|
|
Loading…
Reference in New Issue