[geany/geany] 7c22ce: Update the go parser to the latest version from ctags
Jiří Techet
git-noreply at xxxxx
Sun Dec 7 21:25:13 UTC 2014
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Sun, 07 Dec 2014 21:25:13 UTC
Commit: 7c22ceacf996ea0ac773349afca39eed6af4b9ea
https://github.com/geany/geany/commit/7c22ceacf996ea0ac773349afca39eed6af4b9ea
Log Message:
-----------
Update the go parser to the latest version from ctags
Modified Paths:
--------------
tagmanager/ctags/go.c
Modified: tagmanager/ctags/go.c
78 lines changed, 34 insertions(+), 44 deletions(-)
===================================================================
@@ -521,20 +521,16 @@ static void makeTag (tokenInfo *const token, const goKind kind)
static void parsePackage (tokenInfo *const token)
{
- tokenInfo *const name = newToken ();
-
- readToken (name);
- if (isType (name, TOKEN_IDENTIFIER))
+ readToken (token);
+ if (isType (token, TOKEN_IDENTIFIER))
{
- makeTag (name, GOTAG_PACKAGE);
+ makeTag (token, GOTAG_PACKAGE);
if (!scope && Option.include.qualifiedTags)
{
scope = vStringNew ();
- vStringCopy (scope, name->string);
+ vStringCopy (scope, token->string);
}
}
-
- deleteToken (name);
}
static void parseFunctionOrMethod (tokenInfo *const token)
@@ -545,15 +541,16 @@ static void parseFunctionOrMethod (tokenInfo *const token)
// MethodDecl = "func" Receiver MethodName Signature [ Body ] .
// Receiver = "(" [ identifier ] [ "*" ] BaseTypeName ")" .
// BaseTypeName = identifier .
- tokenInfo *const name = newToken ();
// Skip over receiver.
- readToken (name);
- if (isType (name, TOKEN_OPEN_PAREN))
- skipToMatched (name);
+ readToken (token);
+ if (isType (token, TOKEN_OPEN_PAREN))
+ skipToMatched (token);
- if (isType (name, TOKEN_IDENTIFIER))
+ if (isType (token, TOKEN_IDENTIFIER))
{
+ makeTag (token, GOTAG_FUNCTION);
+
// Skip over parameters.
readToken (token);
skipToMatched (token);
@@ -564,11 +561,7 @@ static void parseFunctionOrMethod (tokenInfo *const token)
// Skip over function body.
if (isType (token, TOKEN_OPEN_CURLY))
skipToMatched (token);
-
- makeTag (name, GOTAG_FUNCTION);
}
-
- deleteToken (name);
}
static void parseConstTypeVar (tokenInfo *const token, goKind kind)
@@ -581,49 +574,46 @@ static void parseConstTypeVar (tokenInfo *const token, goKind kind)
// TypeSpec = identifier Type .
// VarDecl = "var" ( VarSpec | "(" { VarSpec ";" } ")" ) .
// VarSpec = IdentifierList ( Type [ "=" ExpressionList ] | "=" ExpressionList ) .
- tokenInfo *const name = newToken ();
boolean usesParens = FALSE;
- readToken (name);
+ readToken (token);
- if (isType (name, TOKEN_OPEN_PAREN))
+ if (isType (token, TOKEN_OPEN_PAREN))
{
usesParens = TRUE;
- readToken (name);
+ readToken (token);
}
-again:
- while (1)
+ do
{
- if (isType (name, TOKEN_IDENTIFIER))
+ while (!isType (token, TOKEN_EOF))
{
- makeTag (name, kind);
+ if (isType (token, TOKEN_IDENTIFIER))
+ {
+ makeTag (token, kind);
+ readToken (token);
+ }
+ if (!isType (token, TOKEN_COMMA))
+ break;
readToken (token);
}
- if (!isType (token, TOKEN_COMMA))
- break;
- readToken (name);
- }
- skipType (token);
- while (!isType (token, TOKEN_SEMICOLON) && !isType (token, TOKEN_CLOSE_PAREN)
- && !isType (token, TOKEN_EOF))
- {
- readToken (token);
- skipToMatched (token);
- }
+ skipType (token);
+ while (!isType (token, TOKEN_SEMICOLON) && !isType (token, TOKEN_CLOSE_PAREN)
+ && !isType (token, TOKEN_EOF))
+ {
+ readToken (token);
+ skipToMatched (token);
+ }
- if (usesParens)
- {
- if (!isType (token, TOKEN_CLOSE_PAREN)) // we are at TOKEN_SEMICOLON
+ if (usesParens && !isType (token, TOKEN_CLOSE_PAREN))
{
- readToken (name);
- if (!isType (name, TOKEN_CLOSE_PAREN) && !isType (name, TOKEN_EOF))
- goto again;
+ // we are at TOKEN_SEMICOLON
+ readToken (token);
}
}
-
- deleteToken (name);
+ while (!isType (token, TOKEN_EOF) &&
+ usesParens && !isType (token, TOKEN_CLOSE_PAREN));
}
static void parseGoFile (tokenInfo *const token)
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list