Skip to content

Commit

Permalink
lregex: introduce findRegexTagsMainloop()
Browse files Browse the repository at this point in the history
Does the same thing like the previous code.
  • Loading branch information
techee committed Oct 12, 2016
1 parent ca19e6e commit 112f136
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions ctags/main/lregex.c
Expand Up @@ -36,6 +36,7 @@
#include "routines.h"

static bool regexAvailable = true;
static unsigned long currentScope = CORK_NIL;

/*
* MACROS
Expand Down Expand Up @@ -583,13 +584,24 @@ extern bool matchRegex (const vString* const line, const langType language)
return result;
}

extern void findRegexTags (void)
extern void findRegexTagsMainloop (int (* driver)(void))
{
currentScope = CORK_NIL;
/* merely read all lines of the file */
while (readLineFromInputFile () != NULL)
while (driver () != EOF)
;
}

static int fileReadLineDriver(void)
{
return (readLineFromInputFile () == NULL)? EOF: 1;
}

extern void findRegexTags (void)
{
findRegexTagsMainloop (fileReadLineDriver);
}

static regexPattern *addTagRegexInternal (const langType language,
const char* const regex,
const char* const name,
Expand Down
1 change: 1 addition & 0 deletions ctags/main/parse.h
Expand Up @@ -141,6 +141,7 @@ extern bool processKindOption (const char *const option, const char *const param

/* Regex interface */
extern void findRegexTags (void);
extern void findRegexTagsMainloop (int (* driver)(void));
extern bool matchRegex (const vString* const line, const langType language);
extern bool processRegexOption (const char *const option, const char *const parameter);
extern void addLanguageRegex (const langType language, const char* const regex);
Expand Down

0 comments on commit 112f136

Please sign in to comment.