[geany/geany] 56936a: lregex: some harmless syncs

Jiří Techet git-noreply at xxxxx
Mon Dec 17 21:05:56 UTC 2018


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Wed, 12 Oct 2016 15:55:59 UTC
Commit:      56936a8614c90d7c3cc60ef8ab9e2e0ee8bfe38d
             https://github.com/geany/geany/commit/56936a8614c90d7c3cc60ef8ab9e2e0ee8bfe38d

Log Message:
-----------
lregex: some harmless syncs


Modified Paths:
--------------
    ctags/main/lregex.c
    ctags/main/parse.c
    ctags/main/parse.h

Modified: ctags/main/lregex.c
33 lines changed, 31 insertions(+), 2 deletions(-)
===================================================================
@@ -320,9 +320,12 @@ static regexPattern* addCompiledTagCommon (const langType language,
 	ptrn = &set->patterns [set->count];
 	memset (ptrn, 0, sizeof (*ptrn));
 	ptrn->pattern = pattern;
+	ptrn->exclusive = false;
+	ptrn->accept_empty_name = false;
 	if (kind_letter)
 		ptrn->u.tag.kind = kind;
 	set->count += 1;
+	useRegexMethod(language);
 	return ptrn;
 }
 
@@ -343,6 +346,9 @@ static regexPattern *addCompiledTagPattern (const langType language, GRegex* con
 	ptrn  = addCompiledTagCommon(language, pattern, kind);
 	ptrn->type    = PTRN_TAG;
 	ptrn->u.tag.name_pattern = eStrdup (name);
+	ptrn->exclusive = exclusive;
+	ptrn->scopeActions = scopeActions;
+	ptrn->disabled = disabled;
 	if (ptrn->u.tag.kind->letter == '\0')
 	{
 		/* This is a newly registered kind. */
@@ -373,6 +379,9 @@ static void addCompiledCallbackPattern (const langType language, GRegex* const p
 	ptrn  = addCompiledTagCommon(language, pattern, '\0');
 	ptrn->type    = PTRN_CALLBACK;
 	ptrn->u.callback.function = callback;
+	ptrn->u.callback.userData = userData;
+	ptrn->exclusive = exclusive;
+	ptrn->disabled = disabled;
 }
 
 static GRegex* compileRegex (const char* const regexp, const char* const flags)
@@ -531,7 +540,7 @@ static void matchCallbackPattern (
 		matches [i].start  = so;
 		matches [i].length = eo - so;
 		/* a valid match may have both offsets == -1,
-		 * e.g. (foo)*(bar) matching "bar" - see CTags bug 2970274.
+		 * e.g. (foo)*(bar) matching "bar" - see CTags bug 271.
 		 * As POSIX regex doesn't seem to have a way to count matches,
 		 * we return the count up to the last non-empty match. */
 		if (so != -1)
@@ -578,8 +587,15 @@ extern bool matchRegex (const vString* const line, const langType language)
 		const patternSet* const set = Sets + language;
 		unsigned int i;
 		for (i = 0  ;  i < set->count  ;  ++i)
-			if (matchRegexPattern (line, set->patterns + i))
+		{
+			regexPattern* ptrn = set->patterns + i;
+			if (matchRegexPattern (line, ptrn))
+			{
 				result = true;
+				if (ptrn->exclusive)
+					break;
+			}
+		}
 	}
 	return result;
 }
@@ -602,6 +618,19 @@ extern void findRegexTags (void)
 	findRegexTagsMainloop (fileReadLineDriver);
 }
 
+extern bool hasScopeActionInRegex (const langType language)
+{
+	bool r = false;
+	unsigned int i;
+
+	if (language <= SetUpper  &&  Sets [language].count > 0)
+		for (i = 0; i < Sets [language].count; i++)
+			if (Sets[language].patterns[i].scopeActions)
+				r= true;
+
+	return r;
+}
+
 static regexPattern *addTagRegexInternal (const langType language,
 					  const char* const regex,
 					  const char* const name,


Modified: ctags/main/parse.c
9 lines changed, 9 insertions(+), 0 deletions(-)
===================================================================
@@ -421,6 +421,15 @@ extern bool processAliasOption (
 	return false;
 }
 
+extern void useRegexMethod (const langType language)
+{
+	parserDefinition* lang;
+
+	Assert (0 <= language  &&  language < (int) LanguageCount);
+	lang = LanguageTable [language];
+	lang->method |= METHOD_REGEX;
+}
+
 static void installTagRegexTable (const langType language)
 {
 	parserDefinition* lang;


Modified: ctags/main/parse.h
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -152,5 +152,6 @@ extern void addCallbackRegex (const langType language, const char *const regexo,
 			      const regexCallback callback, bool *disabled, void *userData);
 extern void freeRegexResources (void);
 extern bool checkRegex (void);
+extern void useRegexMethod (const langType language);
 
 #endif  /* CTAGS_MAIN_PARSE_H */



--------------
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