Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Sun, 07 Aug 2016 00:01:33 UTC Commit: 9745d470c6288d88b455436a918f92e13e271df4 https://github.com/geany/geany/commit/9745d470c6288d88b455436a918f92e13e271d...
Log Message: ----------- Sync whitespace in parsers
Modified Paths: -------------- ctags/parsers/asm.c ctags/parsers/basic.c ctags/parsers/c.c ctags/parsers/fortran.c ctags/parsers/html.c ctags/parsers/jscript.c ctags/parsers/pascal.c ctags/parsers/php.c ctags/parsers/python.c ctags/parsers/r.c ctags/parsers/ruby.c ctags/parsers/sql.c ctags/parsers/tcl.c
Modified: ctags/parsers/asm.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -180,7 +180,7 @@ static AsmKind operatorKind ( static boolean isDefineOperator (const vString *const operator) { const unsigned char *const op = - (unsigned char*) vStringValue (operator); + (unsigned char*) vStringValue (operator); const size_t length = vStringLength (operator); const boolean result = (boolean) (length > 0 && toupper ((int) *op) == 'D' &&
Modified: ctags/parsers/basic.c 3 lines changed, 1 insertions(+), 2 deletions(-) =================================================================== @@ -194,10 +194,9 @@ static int match_keyword (const char *p, KeyWord const *kw) for (j = 0; j < 1; j++) { p = extract_name (p, name); - } + } makeSimpleTag (name, BasicKinds, kw->kind); vStringDelete (name); - return 1; }
Modified: ctags/parsers/c.c 413 lines changed, 203 insertions(+), 210 deletions(-) =================================================================== @@ -11,7 +11,7 @@ /* * INCLUDE FILES */ -#include "general.h" /* must always come first */ +#include "general.h" /* must always come first */
#include <string.h> #include <setjmp.h> @@ -31,17 +31,17 @@ * MACROS */
-#define activeToken(st) ((st)->token [(int) (st)->tokenIndex]) -#define parentDecl(st) ((st)->parent == NULL ? \ - DECL_NONE : (st)->parent->declaration) -#define isType(token,t) (boolean) ((token)->type == (t)) -#define insideEnumBody(st) (boolean) ((st)->parent == NULL ? FALSE : \ +#define activeToken(st) ((st)->token [(int) (st)->tokenIndex]) +#define parentDecl(st) ((st)->parent == NULL ? \ + DECL_NONE : (st)->parent->declaration) +#define isType(token,t) (boolean) ((token)->type == (t)) +#define insideEnumBody(st) (boolean) ((st)->parent == NULL ? FALSE : \ ((st)->parent->declaration == DECL_ENUM)) -#define isExternCDecl(st,c) (boolean) ((c) == STRING_SYMBOL && \ +#define isExternCDecl(st,c) (boolean) ((c) == STRING_SYMBOL && \ ! (st)->haveQualifyingName && \ (st)->scope == SCOPE_EXTERN)
-#define isOneOf(c,s) (boolean) (strchr ((s), (c)) != NULL) +#define isOneOf(c,s) (boolean) (strchr ((s), (c)) != NULL)
/* * DATA DECLARATIONS @@ -109,50 +109,50 @@ typedef struct sKeywordDesc */ typedef enum eTokenType { - TOKEN_NONE, /* none */ - TOKEN_ARGS, /* a parenthetical pair and its contents */ + TOKEN_NONE, /* none */ + TOKEN_ARGS, /* a parenthetical pair and its contents */ TOKEN_BRACE_CLOSE, TOKEN_BRACE_OPEN, - TOKEN_COMMA, /* the comma character */ - TOKEN_DOUBLE_COLON, /* double colon indicates nested-name-specifier */ + TOKEN_COMMA, /* the comma character */ + TOKEN_DOUBLE_COLON, /* double colon indicates nested-name-specifier */ TOKEN_KEYWORD, - TOKEN_NAME, /* an unknown name */ - TOKEN_PACKAGE, /* a Java package name */ - TOKEN_PAREN_NAME, /* a single name in parentheses */ - TOKEN_SEMICOLON, /* the semicolon character */ - TOKEN_SPEC, /* a storage class specifier, qualifier, type, etc. */ - TOKEN_STAR, /* pointer detection */ - TOKEN_ARRAY, /* array detection */ + TOKEN_NAME, /* an unknown name */ + TOKEN_PACKAGE, /* a Java package name */ + TOKEN_PAREN_NAME, /* a single name in parentheses */ + TOKEN_SEMICOLON, /* the semicolon character */ + TOKEN_SPEC, /* a storage class specifier, qualifier, type, etc. */ + TOKEN_STAR, /* pointer detection */ + TOKEN_ARRAY, /* array detection */ TOKEN_COUNT } tokenType;
/* This describes the scoping of the current statement. */ typedef enum eTagScope { - SCOPE_GLOBAL, /* no storage class specified */ - SCOPE_STATIC, /* static storage class */ - SCOPE_EXTERN, /* external storage class */ - SCOPE_FRIEND, /* declares access only */ - SCOPE_TYPEDEF, /* scoping depends upon context */ + SCOPE_GLOBAL, /* no storage class specified */ + SCOPE_STATIC, /* static storage class */ + SCOPE_EXTERN, /* external storage class */ + SCOPE_FRIEND, /* declares access only */ + SCOPE_TYPEDEF, /* scoping depends upon context */ SCOPE_COUNT } tagScope;
typedef enum eDeclaration { DECL_NONE, - DECL_BASE, /* base type (default) */ + DECL_BASE, /* base type (default) */ DECL_CLASS, DECL_ENUM, DECL_EVENT, DECL_SIGNAL, DECL_FUNCTION, DECL_FUNCTION_TEMPLATE, - DECL_IGNORE, /* non-taggable "declaration" */ + DECL_IGNORE, /* non-taggable "declaration" */ DECL_INTERFACE, DECL_MODULE, DECL_NAMESPACE, - DECL_NOMANGLE, /* C++ name demangling block */ + DECL_NOMANGLE, /* C++ name demangling block */ DECL_PACKAGE, DECL_STRUCT, DECL_UNION, @@ -165,25 +165,25 @@ typedef enum eVisibilityType ACCESS_PRIVATE, ACCESS_PROTECTED, ACCESS_PUBLIC, - ACCESS_DEFAULT, /* Java-specific */ + ACCESS_DEFAULT, /* Java-specific */ ACCESS_COUNT } accessType;
/* Information about the parent class of a member (if any). */ typedef struct sMemberInfo { - accessType access; /* access of current statement */ - accessType accessDefault; /* access default for current statement */ + accessType access; /* access of current statement */ + accessType accessDefault; /* access default for current statement */ } memberInfo;
typedef struct sTokenInfo { - tokenType type; - keywordId keyword; - vString* name; /* the name of the token */ - unsigned long lineNumber; /* line number of tag */ - MIOPos filePosition; /* file position of line containing name */ + tokenType type; + keywordId keyword; + vString* name; /* the name of the token */ + unsigned long lineNumber; /* line number of tag */ + MIOPos filePosition; /* file position of line containing name */ } tokenInfo;
typedef enum eImplementation @@ -199,52 +199,52 @@ typedef enum eImplementation */ typedef struct sStatementInfo { - tagScope scope; - declType declaration; /* specifier associated with TOKEN_SPEC */ - boolean gotName; /* was a name parsed yet? */ - boolean haveQualifyingName; /* do we have a name we are considering? */ - boolean gotParenName; /* was a name inside parentheses parsed yet? */ - boolean gotArgs; /* was a list of parameters parsed yet? */ - unsigned int nSemicolons; /* how many semicolons did we see in that statement */ - impType implementation; /* abstract or concrete implementation? */ - unsigned int tokenIndex; /* currently active token */ - tokenInfo* token [((int) NumTokens)]; - tokenInfo* context; /* accumulated scope of current statement */ - tokenInfo* blockName; /* name of current block */ - memberInfo member; /* information regarding parent class/struct */ - vString* parentClasses; /* parent classes */ - struct sStatementInfo *parent; /* statement we are nested within */ - long argEndPosition; /* Position where argument list ended */ - tokenInfo* firstToken; /* First token in the statement */ + tagScope scope; + declType declaration; /* specifier associated with TOKEN_SPEC */ + boolean gotName; /* was a name parsed yet? */ + boolean haveQualifyingName; /* do we have a name we are considering? */ + boolean gotParenName; /* was a name inside parentheses parsed yet? */ + boolean gotArgs; /* was a list of parameters parsed yet? */ + unsigned int nSemicolons; /* how many semicolons did we see in that statement */ + impType implementation; /* abstract or concrete implementation? */ + unsigned int tokenIndex; /* currently active token */ + tokenInfo* token [((int) NumTokens)]; + tokenInfo* context; /* accumulated scope of current statement */ + tokenInfo* blockName; /* name of current block */ + memberInfo member; /* information regarding parent class/struct */ + vString* parentClasses; /* parent classes */ + struct sStatementInfo *parent; /* statement we are nested within */ + long argEndPosition; /* Position where argument list ended */ + tokenInfo* firstToken; /* First token in the statement */ } statementInfo;
/* Describes the type of tag being generated. */ typedef enum eTagType { TAG_UNDEFINED, - TAG_CLASS, /* class name */ - TAG_ENUM, /* enumeration name */ - TAG_ENUMERATOR, /* enumerator (enumeration value) */ - TAG_FIELD, /* field (Java) */ - TAG_FUNCTION, /* function definition */ - TAG_INTERFACE, /* interface declaration */ - TAG_MEMBER, /* structure, class or interface member */ - TAG_METHOD, /* method declaration */ - TAG_NAMESPACE, /* namespace name */ - TAG_PACKAGE, /* package name */ - TAG_PROTOTYPE, /* function prototype or declaration */ - TAG_STRUCT, /* structure name */ - TAG_TYPEDEF, /* typedef name */ - TAG_UNION, /* union name */ - TAG_VARIABLE, /* variable definition */ - TAG_EXTERN_VAR, /* external variable declaration */ - TAG_MACRO, /* #define s */ - TAG_EVENT, /* event */ - TAG_SIGNAL, /* signal */ - TAG_LOCAL, /* local variable definition */ - TAG_PROPERTY, /* property name */ - TAG_COUNT /* must be last */ + TAG_CLASS, /* class name */ + TAG_ENUM, /* enumeration name */ + TAG_ENUMERATOR, /* enumerator (enumeration value) */ + TAG_FIELD, /* field (Java) */ + TAG_FUNCTION, /* function definition */ + TAG_INTERFACE, /* interface declaration */ + TAG_MEMBER, /* structure, class or interface member */ + TAG_METHOD, /* method declaration */ + TAG_NAMESPACE, /* namespace name */ + TAG_PACKAGE, /* package name / D module name */ + TAG_PROTOTYPE, /* function prototype or declaration */ + TAG_STRUCT, /* structure name */ + TAG_TYPEDEF, /* typedef name */ + TAG_UNION, /* union name */ + TAG_VARIABLE, /* variable definition */ + TAG_EXTERN_VAR, /* external variable declaration */ + TAG_MACRO, /* #define s */ + TAG_EVENT, /* event */ + TAG_SIGNAL, /* signal */ + TAG_LOCAL, /* local variable definition */ + TAG_PROPERTY, /* property name */ + TAG_COUNT /* must be last */ } tagType;
typedef struct sParenInfo @@ -606,9 +606,9 @@ static void initToken (tokenInfo* const token) { token->type = TOKEN_NONE; token->keyword = KEYWORD_NONE; - token->lineNumber = getInputLineNumber(); - token->filePosition = getInputFilePosition(); - vStringClear(token->name); + token->lineNumber = getInputLineNumber (); + token->filePosition = getInputFilePosition (); + vStringClear (token->name); }
static void advanceToken (statementInfo* const st) @@ -617,24 +617,23 @@ static void advanceToken (statementInfo* const st) st->tokenIndex = 0; else ++st->tokenIndex; - initToken(st->token[st->tokenIndex]); + initToken (st->token [st->tokenIndex]); }
static tokenInfo *prevToken (const statementInfo *const st, unsigned int n) { unsigned int tokenIndex; unsigned int num = (unsigned int) NumTokens; - Assert(n < num); + Assert (n < num); tokenIndex = (st->tokenIndex + num - n) % num; - - return st->token[tokenIndex]; + return st->token [tokenIndex]; }
static void setToken (statementInfo *const st, const tokenType type) { tokenInfo *token; token = activeToken (st); - initToken(token); + initToken (token); token->type = type; }
@@ -644,23 +643,23 @@ static void retardToken (statementInfo *const st) st->tokenIndex = (unsigned int) NumTokens - 1; else --st->tokenIndex; - setToken(st, TOKEN_NONE); + setToken (st, TOKEN_NONE); }
static tokenInfo *newToken (void) { tokenInfo *const token = xMalloc (1, tokenInfo); - token->name = vStringNew(); - initToken(token); + token->name = vStringNew (); + initToken (token); return token; }
static void deleteToken (tokenInfo *const token) { if (token != NULL) { - vStringDelete(token->name); - eFree(token); + vStringDelete (token->name); + eFree (token); } }
@@ -700,7 +699,7 @@ static const char *tokenString (const tokenType type) }; Assert (sizeof (names) / sizeof (names [0]) == TOKEN_COUNT); Assert ((int) type < TOKEN_COUNT); - return names[(int) type]; + return names [(int) type]; }
static const char *scopeString (const tagScope scope) @@ -710,7 +709,7 @@ static const char *scopeString (const tagScope scope) }; Assert (sizeof (names) / sizeof (names [0]) == SCOPE_COUNT); Assert ((int) scope < SCOPE_COUNT); - return names[(int) scope]; + return names [(int) scope]; }
static const char *declString (const declType declaration) @@ -722,7 +721,7 @@ static const char *declString (const declType declaration) }; Assert (sizeof (names) / sizeof (names [0]) == DECL_COUNT); Assert ((int) declaration < DECL_COUNT); - return names[(int) declaration]; + return names [(int) declaration]; }
static const char *keywordString (const keywordId keyword) @@ -732,8 +731,7 @@ static const char *keywordString (const keywordId keyword) size_t i; for (i = 0 ; i < count ; ++i) { - const keywordDesc *p = &KeywordTable[i]; - + const keywordDesc *p = &KeywordTable [i]; if (p->id == keyword) { name = p->name; @@ -746,16 +744,16 @@ static const char *keywordString (const keywordId keyword) static void UNUSED pt (tokenInfo *const token) { if (isType (token, TOKEN_NAME)) - printf("type: %-12s: %-13s line: %lu\n", - tokenString (token->type), vStringValue (token->name), - token->lineNumber); + printf ("type: %-12s: %-13s line: %lu\n", + tokenString (token->type), vStringValue (token->name), + token->lineNumber); else if (isType (token, TOKEN_KEYWORD)) - printf("type: %-12s: %-13s line: %lu\n", - tokenString (token->type), keywordString (token->keyword), - token->lineNumber); + printf ("type: %-12s: %-13s line: %lu\n", + tokenString (token->type), keywordString (token->keyword), + token->lineNumber); else - printf("type: %-12s line: %lu\n", - tokenString (token->type), token->lineNumber); + printf ("type: %-12s line: %lu\n", + tokenString (token->type), token->lineNumber); }
static void UNUSED ps (statementInfo *const st) @@ -1004,17 +1002,17 @@ static cKind cTagKind (const tagType type) cKind result = CK_UNDEFINED; switch (type) { - case TAG_CLASS: result = CK_CLASS; break; - case TAG_ENUM: result = CK_ENUMERATION; break; - case TAG_ENUMERATOR: result = CK_ENUMERATOR; break; - case TAG_FUNCTION: result = CK_FUNCTION; break; - case TAG_MEMBER: result = CK_MEMBER; break; - case TAG_NAMESPACE: result = CK_NAMESPACE; break; - case TAG_PROTOTYPE: result = CK_PROTOTYPE; break; - case TAG_STRUCT: result = CK_STRUCT; break; - case TAG_TYPEDEF: result = CK_TYPEDEF; break; - case TAG_UNION: result = CK_UNION; break; - case TAG_VARIABLE: result = CK_VARIABLE; break; + case TAG_CLASS: result = CK_CLASS; break; + case TAG_ENUM: result = CK_ENUMERATION; break; + case TAG_ENUMERATOR: result = CK_ENUMERATOR; break; + case TAG_FUNCTION: result = CK_FUNCTION; break; + case TAG_MEMBER: result = CK_MEMBER; break; + case TAG_NAMESPACE: result = CK_NAMESPACE; break; + case TAG_PROTOTYPE: result = CK_PROTOTYPE; break; + case TAG_STRUCT: result = CK_STRUCT; break; + case TAG_TYPEDEF: result = CK_TYPEDEF; break; + case TAG_UNION: result = CK_UNION; break; + case TAG_VARIABLE: result = CK_VARIABLE; break; case TAG_EXTERN_VAR: result = CK_EXTERN_VARIABLE; break;
default: Assert ("Bad C tag type" == NULL); break; @@ -1145,14 +1143,14 @@ static tagType declToTagType (const declType declaration)
switch (declaration) { - case DECL_CLASS: type = TAG_CLASS; break; - case DECL_ENUM: type = TAG_ENUM; break; - case DECL_FUNCTION: type = TAG_FUNCTION; break; + case DECL_CLASS: type = TAG_CLASS; break; + case DECL_ENUM: type = TAG_ENUM; break; + case DECL_FUNCTION: type = TAG_FUNCTION; break; case DECL_FUNCTION_TEMPLATE: type = TAG_FUNCTION; break; - case DECL_INTERFACE:type = TAG_INTERFACE; break; - case DECL_NAMESPACE:type = TAG_NAMESPACE; break; - case DECL_STRUCT: type = TAG_STRUCT; break; - case DECL_UNION: type = TAG_UNION; break; + case DECL_INTERFACE: type = TAG_INTERFACE; break; + case DECL_NAMESPACE: type = TAG_NAMESPACE; break; + case DECL_STRUCT: type = TAG_STRUCT; break; + case DECL_UNION: type = TAG_UNION; break;
default: Assert ("Unexpected declaration" == NULL); break; } @@ -1509,8 +1507,8 @@ static void qualifyFunctionTag (const statementInfo *const st, const tagType type = (isLanguage (Lang_java) || isLanguage (Lang_csharp) || isLanguage (Lang_vala)) ? TAG_METHOD : TAG_FUNCTION; const boolean isFileScope = - (boolean) (st->member.access == ACCESS_PRIVATE || - (!isMember (st) && st->scope == SCOPE_STATIC)); + (boolean) (st->member.access == ACCESS_PRIVATE || + (!isMember (st) && st->scope == SCOPE_STATIC));
makeTag (nameToken, st, isFileScope, type); } @@ -1696,7 +1694,7 @@ static void skipToMatch (const char *const pair) if (c == EOF) { verbose ("%s: failed to find match for '%c' at line %lu\n", - getInputFileName (), begin, inputLineNumber); + getInputFileName (), begin, inputLineNumber); if (braceMatching) longjmp (Exception, (int) ExceptionBraceFormattingError); else @@ -1790,7 +1788,7 @@ static void readIdentifier (tokenInfo *const token, const int firstChar) c = cppGetc (); } while (isident (c) || (isLanguage (Lang_vala) && '.' == c)); vStringTerminate (name); - cppUngetc (c); /* unget non-identifier character */ + cppUngetc (c); /* unget non-identifier character */
/* Vala supports '?' at end of a type (with or without whitespace before) for nullable types */ if (isLanguage (Lang_vala)) @@ -1818,7 +1816,7 @@ static void readPackageName (tokenInfo *const token, const int firstChar) c = cppGetc (); } vStringTerminate (name); - cppUngetc (c); /* unget non-package character */ + cppUngetc (c); /* unget non-package character */ }
static void readPackageOrNamespace (statementInfo *const st, const declType declaration) @@ -1881,7 +1879,7 @@ static void readOperator (statementInfo *const st) else if (c == '(') { /* Verify whether this is a valid function call (i.e. "()") operator. - */ + */ if (cppGetc () == ')') { vStringPut (name, ' '); /* always separate operator from keyword */ @@ -1898,9 +1896,9 @@ static void readOperator (statementInfo *const st) else if (isident1 (c)) { /* Handle "new" and "delete" operators, and conversion functions - * (per 13.3.1.1.2 [2] of the C++ spec). - */ - boolean whiteSpace = TRUE; /* default causes insertion of space */ + * (per 13.3.1.1.2 [2] of the C++ spec). + */ + boolean whiteSpace = TRUE; /* default causes insertion of space */ do { if (isspace (c)) @@ -1920,7 +1918,7 @@ static void readOperator (statementInfo *const st) } else if (isOneOf (c, acceptable)) { - vStringPut (name, ' '); /* always separate operator from keyword */ + vStringPut (name, ' '); /* always separate operator from keyword */ do { vStringPut (name, c); @@ -2034,45 +2032,45 @@ static void processToken (tokenInfo *const token, statementInfo *const st) { default: break;
- case KEYWORD_NONE: processName (st); break; - case KEYWORD_ABSTRACT: st->implementation = IMP_ABSTRACT; break; - case KEYWORD_ATTRIBUTE: skipParens (); initToken (token); break; - case KEYWORD_CATCH: skipParens (); skipBraces (); break; - case KEYWORD_CHAR: st->declaration = DECL_BASE; break; - case KEYWORD_CLASS: checkIsClassEnum (st, DECL_CLASS); break; - case KEYWORD_CONST: st->declaration = DECL_BASE; break; - case KEYWORD_DOUBLE: st->declaration = DECL_BASE; break; - case KEYWORD_ENUM: st->declaration = DECL_ENUM; break; - case KEYWORD_EXTENDS: readParents (st, '.'); - setToken (st, TOKEN_NONE); break; - case KEYWORD_FLOAT: st->declaration = DECL_BASE; break; - case KEYWORD_FRIEND: st->scope = SCOPE_FRIEND; break; + case KEYWORD_NONE: processName (st); break; + case KEYWORD_ABSTRACT: st->implementation = IMP_ABSTRACT; break; + case KEYWORD_ATTRIBUTE: skipParens (); initToken (token); break; + case KEYWORD_CATCH: skipParens (); skipBraces (); break; + case KEYWORD_CHAR: st->declaration = DECL_BASE; break; + case KEYWORD_CLASS: checkIsClassEnum (st, DECL_CLASS); break; + case KEYWORD_CONST: st->declaration = DECL_BASE; break; + case KEYWORD_DOUBLE: st->declaration = DECL_BASE; break; + case KEYWORD_ENUM: st->declaration = DECL_ENUM; break; + case KEYWORD_EXTENDS: readParents (st, '.'); + setToken (st, TOKEN_NONE); break; + case KEYWORD_FLOAT: st->declaration = DECL_BASE; break; + case KEYWORD_FRIEND: st->scope = SCOPE_FRIEND; break; case KEYWORD_IMPLEMENTS:readParents (st, '.'); - setToken (st, TOKEN_NONE); break; - case KEYWORD_IMPORT: st->declaration = DECL_IGNORE; break; - case KEYWORD_INT: st->declaration = DECL_BASE; break; - case KEYWORD_BOOLEAN: st->declaration = DECL_BASE; break; - case KEYWORD_WCHAR_T: st->declaration = DECL_BASE; break; - case KEYWORD_SIZE_T: st->declaration = DECL_BASE; break; - case KEYWORD_INTERFACE: st->declaration = DECL_INTERFACE; break; - case KEYWORD_LONG: st->declaration = DECL_BASE; break; - case KEYWORD_OPERATOR: readOperator (st); break; - case KEYWORD_MODULE: readPackage (st); break; - case KEYWORD_PRIVATE: setAccess (st, ACCESS_PRIVATE); break; - case KEYWORD_PROTECTED: setAccess (st, ACCESS_PROTECTED); break; - case KEYWORD_PUBLIC: setAccess (st, ACCESS_PUBLIC); break; - case KEYWORD_SHORT: st->declaration = DECL_BASE; break; - case KEYWORD_SIGNED: st->declaration = DECL_BASE; break; - case KEYWORD_STRUCT: checkIsClassEnum (st, DECL_STRUCT); break; - case KEYWORD_STATIC_ASSERT: skipParens (); break; - case KEYWORD_THROWS: discardTypeList (token); break; - case KEYWORD_TYPEDEF: st->scope = SCOPE_TYPEDEF; break; - case KEYWORD_UNION: st->declaration = DECL_UNION; break; - case KEYWORD_UNSIGNED: st->declaration = DECL_BASE; break; - case KEYWORD_USING: st->declaration = DECL_IGNORE; break; - case KEYWORD_VOID: st->declaration = DECL_BASE; break; - case KEYWORD_VOLATILE: st->declaration = DECL_BASE; break; - case KEYWORD_VIRTUAL: st->implementation = IMP_VIRTUAL; break; + setToken (st, TOKEN_NONE); break; + case KEYWORD_IMPORT: st->declaration = DECL_IGNORE; break; + case KEYWORD_INT: st->declaration = DECL_BASE; break; + case KEYWORD_BOOLEAN: st->declaration = DECL_BASE; break; + case KEYWORD_WCHAR_T: st->declaration = DECL_BASE; break; + case KEYWORD_SIZE_T: st->declaration = DECL_BASE; break; + case KEYWORD_INTERFACE: st->declaration = DECL_INTERFACE; break; + case KEYWORD_LONG: st->declaration = DECL_BASE; break; + case KEYWORD_OPERATOR: readOperator (st); break; + case KEYWORD_MODULE: readPackage (st); break; + case KEYWORD_PRIVATE: setAccess (st, ACCESS_PRIVATE); break; + case KEYWORD_PROTECTED: setAccess (st, ACCESS_PROTECTED); break; + case KEYWORD_PUBLIC: setAccess (st, ACCESS_PUBLIC); break; + case KEYWORD_SHORT: st->declaration = DECL_BASE; break; + case KEYWORD_SIGNED: st->declaration = DECL_BASE; break; + case KEYWORD_STRUCT: checkIsClassEnum (st, DECL_STRUCT); break; + case KEYWORD_STATIC_ASSERT: skipParens (); break; + case KEYWORD_THROWS: discardTypeList (token); break; + case KEYWORD_TYPEDEF: st->scope = SCOPE_TYPEDEF; break; + case KEYWORD_UNION: st->declaration = DECL_UNION; break; + case KEYWORD_UNSIGNED: st->declaration = DECL_BASE; break; + case KEYWORD_USING: st->declaration = DECL_IGNORE; break; + case KEYWORD_VOID: st->declaration = DECL_BASE; break; + case KEYWORD_VOLATILE: st->declaration = DECL_BASE; break; + case KEYWORD_VIRTUAL: st->implementation = IMP_VIRTUAL; break;
case KEYWORD_NAMESPACE: readPackageOrNamespace (st, DECL_NAMESPACE); break; case KEYWORD_PACKAGE: readPackageOrNamespace (st, DECL_PACKAGE); break; @@ -2137,7 +2135,7 @@ static void restartStatement (statementInfo *const st) processToken (token, st); }
-/* Skips over a the mem-initializer-list of a ctor-initializer, defined as: +/* Skips over a mem-initializer-list of a ctor-initializer, defined as: * * mem-initializer-list: * mem-initializer, mem-initializer-list @@ -2220,8 +2218,8 @@ static boolean isDPostArgumentToken(tokenInfo *const token) * int foo (...) [const|volatile] [throw (...)] try [ctor-initializer] {...} * catch (...) {...} */ -static boolean skipPostArgumentStuff (statementInfo *const st, - parenInfo *const info) +static boolean skipPostArgumentStuff ( + statementInfo *const st, parenInfo *const info) { tokenInfo *const token = activeToken (st); unsigned int parameters = info->parameterCount; @@ -2234,12 +2232,12 @@ static boolean skipPostArgumentStuff (statementInfo *const st, { switch (c) { - case ')': break; - case ':': skipMemIntializerList (token);break; /* ctor-initializer */ - case '[': skipToMatch ("[]"); break; - case '=': cppUngetc (c); end = TRUE; break; - case '{': cppUngetc (c); end = TRUE; break; - case '}': cppUngetc (c); end = TRUE; break; + case ')': break; + case ':': skipMemIntializerList (token);break; /* ctor-initializer */ + case '[': skipToMatch ("[]"); break; + case '=': cppUngetc (c); end = TRUE; break; + case '{': cppUngetc (c); end = TRUE; break; + case '}': cppUngetc (c); end = TRUE; break;
case '(': { @@ -2333,6 +2331,7 @@ static boolean skipPostArgumentStuff (statementInfo *const st, restartStatement (st); else setToken (st, TOKEN_NONE); + return (boolean) (c != EOF); }
@@ -2508,7 +2507,7 @@ static int parseParens (statementInfo *const st, parenInfo *const info) else if (isType (token, TOKEN_PAREN_NAME)) { c = skipToNonWhite (); - if (c == '*') /* check for function pointer */ + if (c == '*') /* check for function pointer */ { skipToMatch ("()"); c = skipToNonWhite (); @@ -2577,12 +2576,12 @@ static int parseParens (statementInfo *const st, parenInfo *const info)
static void initParenInfo (parenInfo *const info) { - info->isParamList = TRUE; - info->isKnrParamList = TRUE; - info->isNameCandidate = TRUE; - info->invalidContents = FALSE; - info->nestedArgs = FALSE; - info->parameterCount = 0; + info->isParamList = TRUE; + info->isKnrParamList = TRUE; + info->isNameCandidate = TRUE; + info->invalidContents = FALSE; + info->nestedArgs = FALSE; + info->parameterCount = 0; }
static void analyzeParens (statementInfo *const st) @@ -2597,9 +2596,7 @@ static void analyzeParens (statementInfo *const st)
initParenInfo (&info); parseParens (st, &info); - c = skipToNonWhite (); - cppUngetc (c); if (info.invalidContents) { @@ -2629,9 +2626,7 @@ static void analyzeParens (statementInfo *const st) analyzePostParens (st, &info); } else - { setToken (st, TOKEN_NONE); - } } }
@@ -2746,7 +2741,7 @@ static int skipInitializer (statementInfo *const st) else if (! isBraceFormat ()) { verbose ("%s: unexpected closing brace at line %lu\n", - getInputFileName (), getInputLineNumber ()); + getInputFileName (), getInputLineNumber ()); longjmp (Exception, (int) ExceptionBraceFormattingError); } break; @@ -2816,24 +2811,24 @@ static void nextToken (statementInfo *const st) c = skipToNonWhite(); switch (c) { - case EOF: longjmp (Exception, (int) ExceptionEOF); break; - case '(': analyzeParens (st); token = activeToken (st); break; - case '*': setToken (st, TOKEN_STAR); break; - case ',': setToken (st, TOKEN_COMMA); break; - case ':': processColon (st); break; - case ';': setToken (st, TOKEN_SEMICOLON); break; - case '<': skipToMatch ("<>"); break; - case '=': processInitializer (st); break; + case EOF: longjmp (Exception, (int) ExceptionEOF); break; + case '(': analyzeParens (st); token = activeToken (st); break; + case '*': setToken (st, TOKEN_STAR); break; + case ',': setToken (st, TOKEN_COMMA); break; + case ':': processColon (st); break; + case ';': setToken (st, TOKEN_SEMICOLON); break; + case '<': skipToMatch ("<>"); break; + case '=': processInitializer (st); break; case '[': /* Hack for Vala: [..] can be a function attribute. * Seems not to have bad side effects, but have to test it more. */ if (!isLanguage (Lang_vala)) setToken (st, TOKEN_ARRAY); skipToMatch ("[]"); break; - case '{': setToken (st, TOKEN_BRACE_OPEN); break; - case '}': setToken (st, TOKEN_BRACE_CLOSE); break; - default: parseGeneralToken (st, c); break; + case '{': setToken (st, TOKEN_BRACE_OPEN); break; + case '}': setToken (st, TOKEN_BRACE_CLOSE); break; + default: parseGeneralToken (st, c); break; } } while (isType (token, TOKEN_NONE));
@@ -2862,10 +2857,10 @@ static statementInfo *newStatement (statementInfo *const parent) for (i = 0 ; i < (unsigned int) NumTokens ; ++i) st->token [i] = newToken ();
- st->context = newToken (); - st->blockName = newToken (); - st->parentClasses = vStringNew (); - st->firstToken = newToken(); + st->context = newToken (); + st->blockName = newToken (); + st->parentClasses = vStringNew (); + st->firstToken = newToken();
initStatement (st, parent); CurrentStatement = st; @@ -2881,11 +2876,11 @@ static void deleteStatement (void)
for (i = 0 ; i < (unsigned int) NumTokens ; ++i) { - deleteToken(st->token[i]); st->token[i] = NULL; + deleteToken (st->token [i]); st->token [i] = NULL; } - deleteToken(st->blockName); st->blockName = NULL; - deleteToken(st->context); st->context = NULL; - vStringDelete(st->parentClasses); st->parentClasses = NULL; + deleteToken (st->blockName); st->blockName = NULL; + deleteToken (st->context); st->context = NULL; + vStringDelete (st->parentClasses); st->parentClasses = NULL; deleteToken(st->firstToken); eFree (st); CurrentStatement = parent; @@ -3115,17 +3110,15 @@ static void createTags (const unsigned int nestLevel, tokenInfo *token;
nextToken (st); - token = activeToken (st); - if (isType (token, TOKEN_BRACE_CLOSE)) { if (nestLevel > 0) break; else { verbose ("%s: unexpected closing brace at line %lu\n", - getInputFileName (), getInputLineNumber ()); + getInputFileName (), getInputLineNumber ()); longjmp (Exception, (int) ExceptionBraceFormattingError); } } @@ -3170,7 +3163,7 @@ static boolean findCTags (const unsigned int passCount) { retry = TRUE; verbose ("%s: retrying file with fallback brace matching algorithm\n", - getInputFileName ()); + getInputFileName ()); } } cppTerminate ();
Modified: ctags/parsers/fortran.c 84 lines changed, 42 insertions(+), 42 deletions(-) =================================================================== @@ -209,22 +209,22 @@ static unsigned int contextual_fake_count = 0;
/* indexed by tagType */ static kindOption FortranKinds [TAG_COUNT] = { - { TRUE, 'b', "blockData", "block data"}, - { TRUE, 'c', "common", "common blocks"}, - { TRUE, 'e', "entry", "entry points"}, - { TRUE, 'f', "function", "functions"}, - { TRUE, 'i', "interface", "interface contents, generic names, and operators"}, - { TRUE, 'k', "component", "type and structure components"}, - { TRUE, 'l', "label", "labels"}, - { FALSE, 'L', "local", "local, common block, and namelist variables"}, - { TRUE, 'm', "module", "modules"}, - { TRUE, 'n', "namelist", "namelists"}, - { TRUE, 'p', "program", "programs"}, - { TRUE, 's', "subroutine", "subroutines"}, - { TRUE, 't', "type", "derived types and structures"}, - { TRUE, 'v', "variable", "program (global) and module variables"}, - { TRUE, 'E', "enum", "enumerations"}, - { TRUE, 'N', "enumerator", "enumeration values"}, + { TRUE, 'b', "blockData", "block data"}, + { TRUE, 'c', "common", "common blocks"}, + { TRUE, 'e', "entry", "entry points"}, + { TRUE, 'f', "function", "functions"}, + { TRUE, 'i', "interface", "interface contents, generic names, and operators"}, + { TRUE, 'k', "component", "type and structure components"}, + { TRUE, 'l', "label", "labels"}, + { FALSE, 'L', "local", "local, common block, and namelist variables"}, + { TRUE, 'm', "module", "modules"}, + { TRUE, 'n', "namelist", "namelists"}, + { TRUE, 'p', "program", "programs"}, + { TRUE, 's', "subroutine", "subroutines"}, + { TRUE, 't', "type", "derived types and structures"}, + { TRUE, 'v', "variable", "program (global) and module variables"}, + { TRUE, 'E', "enum", "enumerations"}, + { TRUE, 'N', "enumerator", "enumeration values"}, };
/* For efinitions of Fortran 77 with extensions: @@ -551,7 +551,7 @@ static lineType getLineType (void) * an asterisk in column 1 may contain any character capable of * representation in the processor in columns 2 through 72. */ - /* EXCEPTION! Some compilers permit '!' as a commment character here. + /* EXCEPTION! Some compilers permit '!' as a comment character here. * * Treat # and $ in column 1 as comment to permit preprocessor directives. * Treat D and d in column 1 as comment for HP debug statements. @@ -966,19 +966,19 @@ static void readToken (tokenInfo *const token) c = getChar ();
token->lineNumber = getInputLineNumber (); - token->filePosition = getInputFilePosition (); + token->filePosition = getInputFilePosition ();
switch (c) { case EOF: longjmp (Exception, (int) ExceptionEOF); break; case ' ': goto getNextChar; case '\t': goto getNextChar; - case ',': token->type = TOKEN_COMMA; break; - case '(': token->type = TOKEN_PAREN_OPEN; break; - case ')': token->type = TOKEN_PAREN_CLOSE; break; - case '[': token->type = TOKEN_SQUARE_OPEN; break; + case ',': token->type = TOKEN_COMMA; break; + case '(': token->type = TOKEN_PAREN_OPEN; break; + case ')': token->type = TOKEN_PAREN_CLOSE; break; + case '[': token->type = TOKEN_SQUARE_OPEN; break; case ']': token->type = TOKEN_SQUARE_CLOSE; break; - case '%': token->type = TOKEN_PERCENT; break; + case '%': token->type = TOKEN_PERCENT; break;
case '*': case '/': @@ -1353,12 +1353,12 @@ static tagType variableTagType (void) const tokenInfo* const parent = ancestorTop (); switch (parent->tag) { - case TAG_MODULE: result = TAG_VARIABLE; break; - case TAG_DERIVED_TYPE: result = TAG_COMPONENT; break; - case TAG_FUNCTION: result = TAG_LOCAL; break; - case TAG_SUBROUTINE: result = TAG_LOCAL; break; + case TAG_MODULE: result = TAG_VARIABLE; break; + case TAG_DERIVED_TYPE: result = TAG_COMPONENT; break; + case TAG_FUNCTION: result = TAG_LOCAL; break; + case TAG_SUBROUTINE: result = TAG_LOCAL; break; case TAG_ENUM: result = TAG_ENUMERATOR; break; - default: result = TAG_VARIABLE; break; + default: result = TAG_VARIABLE; break; } } return result; @@ -1419,7 +1419,7 @@ static void parseEntityDeclList (tokenInfo *const token) !isKeyword (token, KEYWORD_function) && !isKeyword (token, KEYWORD_subroutine))) { - /* compilers accept keywoeds as identifiers */ + /* compilers accept keywords as identifiers */ if (isType (token, TOKEN_KEYWORD)) token->type = TOKEN_IDENTIFIER; parseEntityDecl (token); @@ -1520,16 +1520,16 @@ static void parseMap (tokenInfo *const token)
/* UNION * MAP - * [field-definition] [field-definition] ... + * [field-definition] [field-definition] ... * END MAP * MAP - * [field-definition] [field-definition] ... + * [field-definition] [field-definition] ... * END MAP * [MAP * [field-definition] - * [field-definition] ... + * [field-definition] ... * END MAP] ... - * END UNION + * END UNION * * * * Typed data declarations (variables or arrays) in structure declarations @@ -1544,7 +1544,7 @@ static void parseMap (tokenInfo *const token) * share a common location within the containing structure. When initializing * the fields within a UNION, the final initialization value assigned * overlays any value previously assigned to a field definition that shares - * that field. + * that field. */ static void parseUnionStmt (tokenInfo *const token) { @@ -1566,11 +1566,11 @@ static void parseUnionStmt (tokenInfo *const token) * structure-name * identifies the structure in a subsequent RECORD statement. * Substructures can be established within a structure by means of either - * a nested STRUCTURE declaration or a RECORD statement. + * a nested STRUCTURE declaration or a RECORD statement. * * field-names * (for substructure declarations only) one or more names having the - * structure of the substructure being defined. + * structure of the substructure being defined. * * field-definition * can be one or more of the following: @@ -1585,7 +1585,7 @@ static void parseUnionStmt (tokenInfo *const token) * statements. The syntax of a UNION declaration is described below. * * PARAMETER statements, which do not affect the form of the - * structure. + * structure. */ static void parseStructureStmt (tokenInfo *const token) { @@ -1637,7 +1637,7 @@ static void parseStructureStmt (tokenInfo *const token) * or equivalence-stmt (is EQUIVALENCE equivalence-set-list) * or external-stmt (is EXTERNAL etc.) * or intent-stmt (is INTENT ( intent-spec ) [::] etc.) - * or instrinsic-stmt (is INTRINSIC etc.) + * or intrinsic-stmt (is INTRINSIC etc.) * or namelist-stmt (is NAMELIST / namelist-group-name / etc.) * or optional-stmt (is OPTIONAL [::] etc.) * or pointer-stmt (is POINTER [::] object-name etc.) @@ -1944,9 +1944,9 @@ static boolean parseDeclarationConstruct (tokenInfo *const token) boolean result = TRUE; switch (token->keyword) { - case KEYWORD_entry: parseEntryStmt (token); break; - case KEYWORD_interface: parseInterfaceBlock (token); break; - case KEYWORD_enum: parseEnumBlock (token); break; + case KEYWORD_entry: parseEntryStmt (token); break; + case KEYWORD_interface: parseInterfaceBlock (token); break; + case KEYWORD_enum: parseEnumBlock (token); break; case KEYWORD_stdcall: readToken (token); break; /* derived type handled by parseTypeDeclarationStmt(); */
@@ -2118,7 +2118,7 @@ static void parseModule (tokenInfo *const token) /* execution-part * executable-construct * - * executable-contstruct is + * executable-construct is * execution-part-construct [execution-part-construct] * * execution-part-construct
Modified: ctags/parsers/html.c 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -17,7 +17,6 @@
static tagRegexTable htmlTagRegexTable [] = { #define POSSIBLE_ATTRIBUTES "([ \t]+[a-z]+="?[^>"]*"?)*" - {"<a" POSSIBLE_ATTRIBUTES "[ \t]+name="?([^>"]+)"?" POSSIBLE_ATTRIBUTES "[ \t]*>", "\2",
Modified: ctags/parsers/jscript.c 23 lines changed, 13 insertions(+), 10 deletions(-) =================================================================== @@ -106,7 +106,7 @@ typedef struct sTokenInfo { vString * string; vString * scope; unsigned long lineNumber; - MIOPos filePosition; + MIOPos filePosition; int nestLevel; boolean ignoreTag; } tokenInfo; @@ -232,8 +232,10 @@ static void makeJsTag (tokenInfo *const token, const jsKind kind, vString *const { jsKind parent_kind = JSTAG_CLASS;
- /* if we're creating a function (and not a method), - * guess we're inside another function */ + /* + * If we're creating a function (and not a method), + * guess we're inside another function + */ if (kind == JSTAG_FUNCTION) parent_kind = JSTAG_FUNCTION;
@@ -347,7 +349,7 @@ static void parseString (vString *const string, const int delimiter) * Also, handle the fact that <LineContinuation> produces an empty * sequence. * See ECMA-262 7.8.4 */ - c = getcFromInputFile(); + c = getcFromInputFile (); if (c != '\r' && c != '\n') vStringPut(string, c); else if (c == '\r') @@ -1131,13 +1133,13 @@ static boolean parseMethods (tokenInfo *const token, tokenInfo *const class) * validProperty : 2, * validMethod : function(a,b) {} * 'validMethod2' : function(a,b) {} - * container.dirtyTab = {'url': false, 'title':false, 'snapshot':false, '*': false} + * container.dirtyTab = {'url': false, 'title':false, 'snapshot':false, '*': false} */
do { readToken (token); - if (isType (token, TOKEN_CLOSE_CURLY)) + if (isType (token, TOKEN_CLOSE_CURLY)) { /* * This was most likely a variable declaration of a hash table. @@ -1193,6 +1195,7 @@ static boolean parseMethods (tokenInfo *const token, tokenInfo *const class) { if (isType (token, TOKEN_OPEN_CURLY)) { + /* Recurse to find child properties/methods */ vStringCopy (saveScope, token->scope); addToScope (token, class->string); has_child_methods = parseMethods (token, name); @@ -1580,11 +1583,11 @@ static boolean parseStatement (tokenInfo *const token, tokenInfo *const parent, { /* * Only create variables for global scope - */ + */ if ( token->nestLevel == 0 && is_global ) { /* - * A pointer can be created to the function. + * A pointer can be created to the function. * If we recognize the function/class name ignore the variable. * This format looks identical to a variable definition. * A variable defined outside of a block is considered @@ -1616,10 +1619,10 @@ static boolean parseStatement (tokenInfo *const token, tokenInfo *const parent, vStringDelete (fulltag); } } - if (isType (token, TOKEN_CLOSE_CURLY)) + if (isType (token, TOKEN_CLOSE_CURLY)) { /* - * Assume the closing parantheses terminates + * Assume the closing parentheses terminates * this statements. */ is_terminated = TRUE;
Modified: ctags/parsers/pascal.c 46 lines changed, 24 insertions(+), 22 deletions(-) =================================================================== @@ -29,7 +29,7 @@ typedef enum { } pascalKind;
static kindOption PascalKinds [] = { - { TRUE, 'f', "function", "functions"}, + { TRUE, 'f', "function", "functions"}, { TRUE, 'p', "procedure", "procedures"} };
@@ -156,33 +156,35 @@ static void findPascalTags (void) char *arglist = NULL; char *vartype = NULL; pascalKind kind = K_FUNCTION; - /* each of these flags is TRUE iff: */ + /* each of these flags is TRUE iff: */ boolean incomment = FALSE; /* point is inside a comment */ int comment_char = '\0'; /* type of current comment */ boolean inquote = FALSE; /* point is inside '..' string */ boolean get_tagname = FALSE;/* point is after PROCEDURE/FUNCTION - keyword, so next item = potential tag */ + keyword, so next item = potential tag */ boolean found_tag = FALSE; /* point is after a potential tag */ boolean inparms = FALSE; /* point is within parameter-list */ - boolean verify_tag = FALSE; /* point has passed the parm-list, so the - next token will determine whether this - is a FORWARD/EXTERN to be ignored, or - whether it is a real tag */ + boolean verify_tag = FALSE; + /* point has passed the parm-list, so the next token will determine + * whether this is a FORWARD/EXTERN to be ignored, or whether it is a + * real tag + */
dbp = readLineFromInputFile (); while (dbp != NULL) { int c = *dbp++;
- if (c == '\0') /* if end of line */ + if (c == '\0') /* if end of line */ { dbp = readLineFromInputFile (); if (dbp == NULL || *dbp == '\0') continue; if (!((found_tag && verify_tag) || get_tagname)) - c = *dbp++; /* only if don't need *dbp pointing - to the beginning of the name of - the procedure or function */ + c = *dbp++; + /* only if don't need *dbp pointing to the beginning of + * the name of the procedure or function + */ } if (incomment) { @@ -204,14 +206,14 @@ static void findPascalTags (void) else switch (c) { case ''': - inquote = TRUE; /* found first quote */ + inquote = TRUE; /* found first quote */ continue; - case '{': /* found open { comment */ + case '{': /* found open { comment */ incomment = TRUE; comment_char = c; continue; case '(': - if (*dbp == '*') /* found open (* comment */ + if (*dbp == '*') /* found open (* comment */ { incomment = TRUE; comment_char = c; @@ -220,12 +222,12 @@ static void findPascalTags (void) else if (found_tag) /* found '(' after tag, i.e., parm-list */ inparms = TRUE; continue; - case ')': /* end of parms list */ + case ')': /* end of parms list */ if (inparms) inparms = FALSE; continue; case ';': - if (found_tag && !inparms) /* end of proc or fn stmt */ + if (found_tag && !inparms) /* end of proc or fn stmt */ { verify_tag = TRUE; break; @@ -239,15 +241,15 @@ static void findPascalTags (void) continue; if (tolower ((int) *dbp == 'e')) { - if (tail ("extern")) /* superfluous, really! */ + if (tail ("extern")) /* superfluous, really! */ { found_tag = FALSE; verify_tag = FALSE; } } else if (tolower ((int) *dbp) == 'f') { - if (tail ("forward")) /* check for forward reference */ + if (tail ("forward")) /* check for forward reference */ { found_tag = FALSE; verify_tag = FALSE; @@ -261,15 +263,15 @@ static void findPascalTags (void) verify_tag = FALSE; } } - if (found_tag && verify_tag) /* not external proc, so make tag */ + if (found_tag && verify_tag) /* not external proc, so make tag */ { found_tag = FALSE; verify_tag = FALSE; makePascalTag (&tag); continue; } } - if (get_tagname) /* grab name of proc or fn */ + if (get_tagname) /* grab name of proc or fn */ { const unsigned char *cp;
@@ -288,7 +290,7 @@ static void findPascalTags (void) eFree(vartype); parseArglist((const char*) cp, &arglist, (kind == K_FUNCTION) ? &vartype : NULL); createPascalTag (&tag, name, kind, arglist, (kind == K_FUNCTION) ? vartype : NULL); - dbp = cp; /* set dbp to e-o-token */ + dbp = cp; /* set dbp to e-o-token */ get_tagname = FALSE; found_tag = TRUE; /* and proceed to check for "extern" */ @@ -339,7 +341,7 @@ static void findPascalTags (void) eFree(arglist); if (vartype != NULL) eFree(vartype); - vStringDelete(name); + vStringDelete (name); }
extern parserDefinition* PascalParser (void)
Modified: ctags/parsers/php.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -668,7 +668,7 @@ static int skipWhitespaces (int c) }
/* <script[:white:]+language[:white:]*=[:white:]*(php|'php'|"php")[:white:]*> - * + * * This is ugly, but the whole "<script language=php>" tag is and we can't * really do better without adding a lot of code only for this */ static boolean isOpenScriptLanguagePhp (int c)
Modified: ctags/parsers/python.c 39 lines changed, 19 insertions(+), 20 deletions(-) =================================================================== @@ -492,7 +492,6 @@ static char const *find_triple_start(char const *string, char const **which) { if (*cp == '#') break; - if (*cp == '"' || *cp == ''') { if (strncmp(cp, doubletriple, 3) == 0) @@ -602,7 +601,7 @@ static const char *skipTypeDecl (const char *cp, boolean *is_class) } if (!*ptr || *ptr == '=') return NULL; if (*ptr == '(') { - return lastStart; /* if we stopped on a '(' we are done */ + return lastStart; /* if we stopped on a '(' we are done */ } ptr = skipSpace(ptr); lastStart = ptr; @@ -778,24 +777,24 @@ static void findPythonTags (void) is_class = TRUE; } else if (matchKeyword ("cdef", keyword, &cp)) - { - candidate = skipTypeDecl (cp, &is_class); - if (candidate) - { - found = TRUE; - cp = candidate; - } - - } - else if (matchKeyword ("cpdef", keyword, &cp)) - { - candidate = skipTypeDecl (cp, &is_class); - if (candidate) - { - found = TRUE; - cp = candidate; - } - } + { + candidate = skipTypeDecl (cp, &is_class); + if (candidate) + { + found = TRUE; + cp = candidate; + } + + } + else if (matchKeyword ("cpdef", keyword, &cp)) + { + candidate = skipTypeDecl (cp, &is_class); + if (candidate) + { + found = TRUE; + cp = candidate; + } + }
if (found) {
Modified: ctags/parsers/r.c 37 lines changed, 19 insertions(+), 18 deletions(-) =================================================================== @@ -26,7 +26,7 @@ /*#define R_REGEX*/
#define SKIPSPACE(ch) while (isspace((int)*ch)) \ - ch++ + ch++
#ifndef R_REGEX typedef enum { @@ -37,9 +37,9 @@ typedef enum { } rKind;
static kindOption RKinds [KIND_COUNT] = { - { TRUE, 'f', "function", "functions" }, - { TRUE, 'l', "library", "libraries" }, - { TRUE, 's', "source", "sources" }, + {TRUE, 'f', "function", "functions"}, + {TRUE, 'l', "library", "libraries"}, + {TRUE, 's', "source", "sources"}, }; #endif
@@ -58,29 +58,30 @@ static void installRRegex (const langType language) "^[ \t]*(library|source|load|data)[\(]([a-zA-Z0-9_]+)[\)]", "\2", "s,other", NULL); } #else -static void makeRTag(const vString* const name, rKind kind) +static void makeRTag (const vString * const name, rKind kind) { tagEntryInfo e; initTagEntry(&e, vStringValue(name), &(RKinds[kind]));
- Assert(kind < KIND_COUNT); + Assert (kind < KIND_COUNT);
- makeTagEntry(&e); + makeTagEntry (&e); }
-static void createRTags(void) +static void createRTags (void) { - vString *vLine = vStringNew(); - vString *name = vStringNew(); + vString *vLine = vStringNew (); + vString *name = vStringNew (); int ikind; const unsigned char *line;
- while ((line = readLineFromInputFile()) != NULL) + while ((line = readLineFromInputFile ()) != NULL) { - const unsigned char *cp = (const unsigned char*)line; + const unsigned char *cp = (const unsigned char *) line;
- vStringClear(name); - while ((*cp != '\0') && (*cp != '#')) { + vStringClear (name); + while ((*cp != '\0') && (*cp != '#')) + { /* iterate to the end of line or to a comment */ ikind = -1; switch (*cp) { @@ -175,18 +176,18 @@ static void createRTags(void) } }
- vStringDelete(name); - vStringDelete(vLine); + vStringDelete (name); + vStringDelete (vLine); } #endif
-extern parserDefinition* RParser (void) +extern parserDefinition *RParser (void) { /* *.r: R files * *.s;*.q: S files */ static const char *const extensions [] = { "r", "s", "q", NULL }; - parserDefinition* const def = parserNew ("R"); + parserDefinition *const def = parserNew ("R"); #ifndef R_REGEX def->kinds = RKinds; def->kindCount = ARRAY_SIZE (RKinds);
Modified: ctags/parsers/ruby.c 8 lines changed, 3 insertions(+), 5 deletions(-) =================================================================== @@ -218,8 +218,8 @@ static void emitRubyTag (vString* name, rubyKind kind) Assert (0 <= parent_kind && (size_t) parent_kind < (sizeof RubyKinds / sizeof RubyKinds[0]));
- tag.extensionFields.scopeKind = &(RubyKinds [parent_kind]); - tag.extensionFields.scopeName = vStringValue (scope); + tag.extensionFields.scopeKind = &(RubyKinds [parent_kind]); + tag.extensionFields.scopeName = vStringValue (scope); } makeTagEntry (&tag);
@@ -475,10 +475,8 @@ static void findRubyTags (void) */ if (nl && nl->type == K_CLASS && vStringLength (nl->name) == 0) kind = K_SINGLETON; - readAndEmitTag (&cp, kind); } - while (*cp != '\0') { /* FIXME: we don't cope with here documents, @@ -524,7 +522,7 @@ static void findRubyTags (void) ++cp; } while (*cp != 0 && *cp != '"'); if (*cp == '"') - cp++; /* skip the last found '"' */ + cp++; /* skip the last found '"' */ } else if (*cp == ';') {
Modified: ctags/parsers/sql.c 154 lines changed, 79 insertions(+), 75 deletions(-) =================================================================== @@ -359,11 +359,10 @@ static boolean isCmdTerm (tokenInfo *const token) * enum eTokenType * enum eTokenType */ - return ( isType (token, TOKEN_SEMICOLON) || - isType (token, TOKEN_TILDE) || - isType (token, TOKEN_FORWARD_SLASH) || - isKeyword (token, KEYWORD_go) - ); + return (isType (token, TOKEN_SEMICOLON) || + isType (token, TOKEN_TILDE) || + isType (token, TOKEN_FORWARD_SLASH) || + isKeyword (token, KEYWORD_go)); }
static boolean isMatchedEnd(tokenInfo *const token, int nest_lvl) @@ -594,8 +593,8 @@ static void readToken (tokenInfo *const token) case '/': { int d = getcFromInputFile (); - if ( (d != '*') && /* is this the start of a comment? */ - (d != '/') ) /* is a one line comment? */ + if ((d != '*') && /* is this the start of a comment? */ + (d != '/')) /* is a one line comment? */ { token->type = TOKEN_FORWARD_SLASH; ungetcToInputFile (d); @@ -662,7 +661,7 @@ static void readIdentifier (tokenInfo *const token) tokenInfo *const close_square = newToken ();
readToken (token); - /* eat close swuare */ + /* eat close square */ readToken (close_square); deleteToken (close_square); } @@ -711,9 +710,9 @@ static void findCmdTerm (tokenInfo *const token, const boolean check_first) { int begin_end_nest_lvl = token->begin_end_nest_lvl;
- if ( check_first ) + if (check_first) { - if ( isCmdTerm(token) ) + if (isCmdTerm(token)) return; } do @@ -791,7 +790,7 @@ static void skipArgumentList (tokenInfo *const token) * Other databases can have arguments with fully declared * datatypes: * ( name varchar(30), text binary(10) ) - * So we must check for nested open and closing parantheses + * So we must check for nested open and closing parentheses */
if (isType (token, TOKEN_OPEN_PAREN)) /* arguments? */ @@ -877,7 +876,7 @@ static void parseSubProgram (tokenInfo *const token) * blank and the value just read is the OWNER or CREATOR of the * function and should not be considered part of the scope. */ - if ( vStringLength(saveScope) > 0 ) + if (vStringLength(saveScope) > 0) { addToScope(token, name->string, kind); } @@ -893,14 +892,15 @@ static void parseSubProgram (tokenInfo *const token)
if (kind == SQLTAG_FUNCTION) { - if (isKeyword (token, KEYWORD_return) || isKeyword (token, KEYWORD_returns)) + if (isKeyword (token, KEYWORD_return) || + isKeyword (token, KEYWORD_returns)) { /* Read datatype */ readToken (token); /* * Read token after which could be the * command terminator if a prototype - * or an open parantheses + * or an open parenthesis */ readToken (token); if (isType (token, TOKEN_OPEN_PAREN)) @@ -910,7 +910,7 @@ static void parseSubProgram (tokenInfo *const token) } } } - if( isCmdTerm (token) ) + if (isCmdTerm (token)) { makeSqlTag (name, SQLTAG_PROTOTYPE); } @@ -927,7 +927,7 @@ static void parseSubProgram (tokenInfo *const token) ) ) { - if ( isKeyword (token, KEYWORD_result) ) + if (isKeyword (token, KEYWORD_result)) { readToken (token); if (isType (token, TOKEN_OPEN_PAREN)) @@ -940,9 +940,9 @@ static void parseSubProgram (tokenInfo *const token) } } if (isKeyword (token, KEYWORD_at) || - isKeyword (token, KEYWORD_url) || - isKeyword (token, KEYWORD_internal) || - isKeyword (token, KEYWORD_external) ) + isKeyword (token, KEYWORD_url) || + isKeyword (token, KEYWORD_internal) || + isKeyword (token, KEYWORD_external)) { addToScope(token, name->string, kind); if (isType (name, TOKEN_IDENTIFIER) || @@ -954,14 +954,14 @@ static void parseSubProgram (tokenInfo *const token) vStringClear (token->scope); token->scopeKind = SQLTAG_COUNT; } - if ( isType (token, TOKEN_EQUAL) ) + if (isType (token, TOKEN_EQUAL)) readToken (token);
- if ( isKeyword (token, KEYWORD_declare) ) + if (isKeyword (token, KEYWORD_declare)) parseDeclare (token, FALSE);
if (isKeyword (token, KEYWORD_is) || - isKeyword (token, KEYWORD_begin) ) + isKeyword (token, KEYWORD_begin)) { addToScope(token, name->string, kind); if (isType (name, TOKEN_IDENTIFIER) || @@ -1017,6 +1017,8 @@ static void parseRecord (tokenInfo *const token) isKeyword(token, KEYWORD_constraint) || isKeyword(token, KEYWORD_foreign) ) ) { + /* keyword test above is redundant as only a TOKEN_KEYWORD could + * match any isKeyword() anyway */ if (isType (token, TOKEN_IDENTIFIER) || isType (token, TOKEN_STRING)) makeSqlTag (token, SQLTAG_FIELD); @@ -1173,7 +1175,7 @@ static void parseDeclareANSI (tokenInfo *const token, const boolean local) if (isKeyword (type, KEYWORD_cursor)) makeSqlTag (token, SQLTAG_CURSOR); else if (isKeyword (token, KEYWORD_local) && - isKeyword (type, KEYWORD_temporary)) + isKeyword (type, KEYWORD_temporary)) { /* * DECLARE LOCAL TEMPORARY TABLE table_name ( @@ -1186,14 +1188,14 @@ static void parseDeclareANSI (tokenInfo *const token, const boolean local) { readToken (token); if (isType(token, TOKEN_IDENTIFIER) || - isType(token, TOKEN_STRING) ) + isType(token, TOKEN_STRING)) { makeSqlTag (token, SQLTAG_TABLE); } } } else if (isType (token, TOKEN_IDENTIFIER) || - isType (token, TOKEN_STRING)) + isType (token, TOKEN_STRING)) { if (local) makeSqlTag (token, SQLTAG_LOCAL_VARIABLE); @@ -1234,6 +1236,7 @@ static void parseLabel (tokenInfo *const token)
static void parseStatements (tokenInfo *const token, const boolean exit_on_endif ) { + /* boolean isAnsi = TRUE; */ boolean stmtTerm = FALSE; do { @@ -1309,8 +1312,9 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif readToken (token); }
- if( isKeyword (token, KEYWORD_begin ) ) + if (isKeyword (token, KEYWORD_begin)) { + /* isAnsi = FALSE; */ parseBlock(token, FALSE);
/* @@ -1319,7 +1323,7 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif * token in a command terminator (like GO) * we know we are done with this statement. */ - if ( isCmdTerm (token) ) + if (isCmdTerm (token)) stmtTerm = TRUE; } else @@ -1336,7 +1340,7 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif
parseStatements (token, TRUE);
- if ( isCmdTerm(token) ) + if (isCmdTerm(token)) readToken (token);
} @@ -1347,13 +1351,13 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif * IF...THEN * END IF; */ - if( isKeyword (token, KEYWORD_end ) ) + if (isKeyword (token, KEYWORD_end)) readToken (token);
if( isKeyword (token, KEYWORD_if ) || isKeyword (token, KEYWORD_endif ) ) { readToken (token); - if ( isCmdTerm(token) ) + if (isCmdTerm(token)) stmtTerm = TRUE; } else @@ -1385,7 +1389,7 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif * DO * END FOR; */ - if( isKeyword (token, KEYWORD_for ) ) + if (isKeyword (token, KEYWORD_for)) { /* loop name */ readToken (token); @@ -1418,12 +1422,12 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif
parseStatements (token, FALSE);
- if ( isCmdTerm(token) ) + if (isCmdTerm(token)) readToken (token); }
- if( isKeyword (token, KEYWORD_end ) ) + if (isKeyword (token, KEYWORD_end )) readToken (token);
/* @@ -1437,7 +1441,7 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif isKeyword (token, KEYWORD_for) ) readToken (token);
- if ( isCmdTerm(token) ) + if (isCmdTerm(token)) stmtTerm = TRUE;
break; @@ -1514,12 +1518,12 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif * if we detect them, parse them to completion */ if (isType (token, TOKEN_BLOCK_LABEL_BEGIN) || - isKeyword (token, KEYWORD_exception) || - isKeyword (token, KEYWORD_loop) || - isKeyword (token, KEYWORD_case) || - isKeyword (token, KEYWORD_for) || - isKeyword (token, KEYWORD_begin) ) - parseStatements (token, FALSE); + isKeyword (token, KEYWORD_exception) || + isKeyword (token, KEYWORD_loop) || + isKeyword (token, KEYWORD_case) || + isKeyword (token, KEYWORD_for) || + isKeyword (token, KEYWORD_begin)) + parseStatements (token, FALSE); else if (isKeyword (token, KEYWORD_if)) parseStatements (token, TRUE);
@@ -1530,7 +1534,7 @@ static void parseStatements (tokenInfo *const token, const boolean exit_on_endif * See comment above, now, only read if the current token * is not a command terminator. */ - if ( isCmdTerm(token) && ! stmtTerm ) + if (isCmdTerm(token) && ! stmtTerm) stmtTerm = TRUE; } while (! isKeyword (token, KEYWORD_end) && @@ -1568,7 +1572,7 @@ static void parseBlock (tokenInfo *const token, const boolean local) { parseStatements (token, FALSE);
- if ( isCmdTerm(token) ) + if (isCmdTerm(token)) readToken (token); } token->begin_end_nest_lvl--; @@ -1582,7 +1586,7 @@ static void parseBlock (tokenInfo *const token, const boolean local) /* * Check if the END block is terminated */ - if ( !isCmdTerm (token) ) + if (! isCmdTerm (token)) { /* * Not sure what to do here at the moment. @@ -1647,7 +1651,7 @@ static void parseTable (tokenInfo *const token) /* * This deals with these formats: * create table t1 (c1 int); - * create global tempoary table t2 (c1 int); + * create global temporary table t2 (c1 int); * create table "t3" (c1 int); * create table bob.t4 (c1 int); * create table bob."t5" (c1 int); @@ -1693,7 +1697,7 @@ static void parseTable (tokenInfo *const token) if (isType (token, TOKEN_OPEN_PAREN)) { if (isType (name, TOKEN_IDENTIFIER) || - isType (name, TOKEN_STRING)) + isType (name, TOKEN_STRING)) { makeSqlTag (name, SQLTAG_TABLE); vStringCopy(token->scope, name->string); @@ -1735,8 +1739,9 @@ static void parseIndex (tokenInfo *const token) readIdentifier (name); readToken (token); } - if ( isKeyword (token, KEYWORD_on) && - (isType (name, TOKEN_IDENTIFIER) || isType (name, TOKEN_STRING) ) ) + if (isKeyword (token, KEYWORD_on) && + (isType (name, TOKEN_IDENTIFIER) || + isType (name, TOKEN_STRING))) { readIdentifier (owner); readToken (token); @@ -1777,16 +1782,16 @@ static void parseEvent (tokenInfo *const token) readToken (token); }
- if ( isKeyword (token, KEYWORD_handler) || - isType (token, TOKEN_SEMICOLON) ) + if (isKeyword (token, KEYWORD_handler) || + isType (token, TOKEN_SEMICOLON)) { makeSqlTag (name, SQLTAG_EVENT); }
if (isKeyword (token, KEYWORD_handler)) { readToken (token); - if ( isKeyword (token, KEYWORD_begin) ) + if (isKeyword (token, KEYWORD_begin)) { parseBlock (token, TRUE); } @@ -1826,7 +1831,7 @@ static void parseTrigger (tokenInfo *const token) }
/*if (! isType (token, TOKEN_SEMICOLON) ) */ - if (! isCmdTerm (token) ) + if (! isCmdTerm (token)) { readToken (table); readToken (token); @@ -1840,7 +1845,7 @@ static void parseTrigger (tokenInfo *const token) (isKeyword (token, KEYWORD_call)) || ( isCmdTerm (token))) ) { - if ( isKeyword (token, KEYWORD_declare) ) + if (isKeyword (token, KEYWORD_declare)) { addToScope(token, name->string, SQLTAG_TRIGGER); parseDeclare(token, TRUE); @@ -1851,13 +1856,13 @@ static void parseTrigger (tokenInfo *const token) readToken (token); }
- if ( isKeyword (token, KEYWORD_begin) || - isKeyword (token, KEYWORD_call) ) + if (isKeyword (token, KEYWORD_begin) || + isKeyword (token, KEYWORD_call)) { addToScope(name, table->string, SQLTAG_TABLE); makeSqlTag (name, SQLTAG_TRIGGER); addToScope(token, table->string, SQLTAG_TABLE); - if ( isKeyword (token, KEYWORD_begin) ) + if (isKeyword (token, KEYWORD_begin)) { parseBlock (token, TRUE); } @@ -1893,7 +1898,7 @@ static void parsePublication (tokenInfo *const token) if (isType (token, TOKEN_OPEN_PAREN)) { if (isType (name, TOKEN_IDENTIFIER) || - isType (name, TOKEN_STRING)) + isType (name, TOKEN_STRING)) { makeSqlTag (name, SQLTAG_PUBLICATION); } @@ -1922,7 +1927,7 @@ static void parseService (tokenInfo *const token) if (isKeyword (token, KEYWORD_type)) { if (isType (name, TOKEN_IDENTIFIER) || - isType (name, TOKEN_STRING)) + isType (name, TOKEN_STRING)) { makeSqlTag (name, SQLTAG_SERVICE); } @@ -1947,7 +1952,7 @@ static void parseDomain (tokenInfo *const token) } readToken (token); if (isType (name, TOKEN_IDENTIFIER) || - isType (name, TOKEN_STRING)) + isType (name, TOKEN_STRING)) { makeSqlTag (name, SQLTAG_DOMAIN); } @@ -2037,10 +2042,9 @@ static void parseView (tokenInfo *const token) readIdentifier (name); readToken (token); } - if ( isType (token, TOKEN_OPEN_PAREN) ) + if (isType (token, TOKEN_OPEN_PAREN)) { skipArgumentList(token); - }
while (!(isKeyword (token, KEYWORD_is) || @@ -2075,7 +2079,7 @@ static void parseMLTable (tokenInfo *const token) */
readToken (token); - if ( isType (token, TOKEN_OPEN_PAREN) ) + if (isType (token, TOKEN_OPEN_PAREN)) { readToken (version); readToken (token); @@ -2101,16 +2105,16 @@ static void parseMLTable (tokenInfo *const token) { readToken (event);
- if (isType (version, TOKEN_STRING) && - isType (table, TOKEN_STRING) && - isType (event, TOKEN_STRING) ) + if (isType (version, TOKEN_STRING) && + isType (table, TOKEN_STRING) && + isType (event, TOKEN_STRING)) { addToScope(version, table->string, SQLTAG_TABLE); addToScope(version, event->string, SQLTAG_EVENT); makeSqlTag (version, SQLTAG_MLTABLE); } } - if( !isType (token, TOKEN_CLOSE_PAREN) ) + if (! isType (token, TOKEN_CLOSE_PAREN)) findToken (token, TOKEN_CLOSE_PAREN); } } @@ -2135,7 +2139,7 @@ static void parseMLConn (tokenInfo *const token) */
readToken (token); - if ( isType (token, TOKEN_OPEN_PAREN) ) + if (isType (token, TOKEN_OPEN_PAREN)) { readToken (version); readToken (token); @@ -2150,14 +2154,14 @@ static void parseMLConn (tokenInfo *const token) { readToken (event);
- if (isType (version, TOKEN_STRING) && - isType (event, TOKEN_STRING) ) + if (isType (version, TOKEN_STRING) && + isType (event, TOKEN_STRING)) { addToScope(version, event->string, SQLTAG_EVENT); makeSqlTag (version, SQLTAG_MLCONN); } } - if( !isType (token, TOKEN_CLOSE_PAREN) ) + if (! isType (token, TOKEN_CLOSE_PAREN)) findToken (token, TOKEN_CLOSE_PAREN);
} @@ -2185,7 +2189,7 @@ static void parseMLProp (tokenInfo *const token) */
readToken (token); - if ( isType (token, TOKEN_OPEN_PAREN) ) + if (isType (token, TOKEN_OPEN_PAREN)) { readToken (component); readToken (token); @@ -2211,16 +2215,16 @@ static void parseMLProp (tokenInfo *const token) { readToken (prop_name);
- if (isType (component, TOKEN_STRING) && - isType (prop_set_name, TOKEN_STRING) && - isType (prop_name, TOKEN_STRING) ) + if (isType (component, TOKEN_STRING) && + isType (prop_set_name, TOKEN_STRING) && + isType (prop_name, TOKEN_STRING)) { addToScope(component, prop_set_name->string, SQLTAG_MLPROP /* FIXME */); addToScope(component, prop_name->string, SQLTAG_MLPROP /* FIXME */); makeSqlTag (component, SQLTAG_MLPROP); } } - if( !isType (token, TOKEN_CLOSE_PAREN) ) + if (! isType (token, TOKEN_CLOSE_PAREN)) findToken (token, TOKEN_CLOSE_PAREN); } } @@ -2255,7 +2259,7 @@ static void parseComment (tokenInfo *const token) readToken (token); } readToken (token); - if ( isType(token, TOKEN_OPEN_CURLY) ) + if (isType(token, TOKEN_OPEN_CURLY)) { findToken (token, TOKEN_CLOSE_CURLY); }
Modified: ctags/parsers/tcl.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -76,9 +76,9 @@ static void findTclTags (void) { const unsigned char *cp;
- while (isspace (line [0])) + while (isspace (line [0])) ++line; - + if (line [0] == '\0' || line [0] == '#') continue;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).