23#ifdef HAVE_SYS_TYPES_H
24# include <sys/types.h>
54#define BACK_REFERENCE_COUNT 10
57#define MTABLE_STACK_MAX_DEPTH 64
65#define MTABLE_MOTIONLESS_MAX (MTABLE_STACK_MAX_DEPTH + 1)
118#define BOUNDARY_START 0
119#define BOUNDARY_END 1
124#define NO_MULTILINE -1
191#define TABLE_INDEX_UNUSED -1
338 const vString*
const name,
int kindIndex,
int roleIndex,
int scopeIndex,
int placeholder,
379 else if (*
name ==
't')
393 else if (*
name ==
'\\')
395 else if (*
name == sep)
417 char*
const regexp,
char**
const name,
418 char**
const kinds,
char**
const flags)
421 const int separator = (
unsigned char) regexp [0];
426 else if (**
name != separator)
431 if (**
name !=
'\0' && (*
name) [strlen (*
name) - 1] ==
'\\')
433 if (*third != separator)
434 error (
WARNING,
"%s: regexp missing final separator", regexp);
444 if (*fourth == separator)
464 bool *exclusive = data;
475 NULL,
"skip testing the other patterns if a line is matched to this pattern"},
479 const char*
const v,
void* data)
481 unsigned int *bfields = data;
483 if (strcmp (v,
"ref") == 0)
485 else if (strcmp (v,
"push") == 0)
487 else if (strcmp (v,
"pop") == 0)
489 else if (strcmp (v,
"clear") == 0)
491 else if (strcmp (v,
"set") == 0)
494 error (
FATAL,
"Unexpected value for scope flag in regex definition: scope=%s", v);
500 unsigned int *bfields = data;
506 "ACTION",
"use scope stack: ACTION = ref|push|pop|clear|set"},
508 NULL,
"don't put this tag to tags file."},
540 guest->
lang.
type = GUEST_LANG_UNKNOWN;
614 return entry->pattern;
633 error (
WARNING,
"out of range(0 ~ %d) %s specification: %s",
656 if ((tmp =
strstr(vdup,
"start")))
661 else if ((tmp =
strstr(vdup,
"end")))
671 error (
WARNING,
"out of range(0 ~ %d) %s specification: %s",
697 char *tmp = strchr (v,
',');
700 error (
WARNING,
"no terminator found for parser name: %s", s);
709 "using placeholder for guest name field is not allowed in multiline regex spec: %s", v);
713 guest->
lang.
type = GUEST_LANG_PLACEHOLDER;
715 else if (*v ==
'\\' || *v ==
'*')
717 const char *n_tmp = v + 1;
718 const char *n = n_tmp;
719 for (; isdigit (*n_tmp); n_tmp++);
721 *(
char *)n_tmp =
'\0';
724 error (
WARNING,
"wrong guest name specification: %s", v);
729 error (
WARNING,
"wrong guest name specification (back reference count is too large): %d",
737 error (
WARNING,
"wrong guest specification (garbage at the end of end guest spec): %s", v);
742 ? GUEST_LANG_PTN_GROUP_FOR_LANGNAME
743 : GUEST_LANG_PTN_GROUP_FOR_FILEMAP;
750 error (
WARNING,
"no parser found for the guest spec: %s", v);
753 guest->
lang.
type = GUEST_LANG_STATIC_LANGNAME;
759 error (
WARNING,
"no area spec found in the guest spec: %s", v);
763 for (
int i = 0; i < 2; i++)
766 const char *current_field_str = (i ==
BOUNDARY_START?
"start":
"end");
772 "using placeholder for %s field is not allowed in multiline regex spec: %s",
773 current_field_str, v);
781 for (; isdigit (*tmp); tmp++);
786 error (
WARNING,
"wrong guest area specification (patternGroup of %s, number expected): %s:%s",
787 current_field_str, v, n);
793 error (
WARNING,
"wrong guest area specification (patternGroup of %s, nether start nor end given): %s",
794 current_field_str, v);
797 else if (strncmp (tmp,
"start", 5) == 0)
802 else if (strncmp (tmp,
"end", 3) == 0)
809 error (
WARNING,
"wrong guest area specification (%s): %s",
810 current_field_str, v);
820 "wrong guest area specification (separator between start and end boundaries): %s", v);
825 else if (i == 1 && (*tmp !=
'\0'))
827 error (
WARNING,
"wrong guest area specification (garbage at the end of end boundary spec): %s", v);
833 guest->
lang.
type = GUEST_LANG_UNKNOWN;
838 "N",
"a group in pattern determining the line number of tag"},
840 "N[start|end]",
"a group in pattern from where the next scan starts [0end]"},
844#define EXPERIMENTAL "_"
846 "PARSERSPEC,N0[start|end],N1[start|end]",
"run guest parser on the area"},
869 error (
WARNING,
"only one message flag may be given per regex (already set to '%s')",
874 if (strcmp (s,
"fatal") == 0)
878 else if (strcmp (s,
"warning") == 0)
887 error (
WARNING,
"no message value is given for {%s}", s);
891 const char* begin = v;
892 const char* end = v + strlen (v);
895 if (*begin !=
'"' || *end !=
'"' || begin == end)
897 error (
WARNING,
"argument for {%s} must be in double-quotes", s);
952 const char*
template;
961 tmp = strchr (v,
':');
962 if (tmp ==
NULL || tmp == v)
982 if (fp->
ftype == ftype)
1034 error (
WARNING,
"an anonymous tag prefix for this pattern (%s) is already given: %s",
1042 error (
WARNING,
"no PREFIX for anonymous regex flag is given (pattern == %s)",
1049 error (
WARNING,
"use \"%s\" regex flag only with an explicitly defined kind", s);
1058 "\"MESSAGE\"",
"print the given MESSAGE and exit"},
1060 "\"MESSAGE\"",
"print the given MESSAGE at WARNING level"},
1061#define EXPERIMENTAL "_"
1063 "EXTRA",
"record the tag only when the extra is enabled"},
1065 "FIELD:VALUE",
"record the matched string(VALUE) to parser own FIELD of the tag"},
1067 "ROLE",
"set the given ROLE to the roles field"},
1069 "PREFIX",
"make an anonymous tag with PREFIX"},
1078 bool taking_table =
true;
1085 if (strcmp (s,
"tenter") == 0)
1087 else if (strcmp (s,
"tleave") == 0)
1090 taking_table =
false;
1092 else if (strcmp (s,
"tjump") == 0)
1094 else if (strcmp (s,
"treset") == 0)
1096 else if (strcmp (s,
"tquit") == 0)
1099 taking_table =
false;
1105 char *continuation =
NULL;
1109 error (
FATAL,
"no table is given for table action: %s", s);
1112 && (continuation = strchr (v,
',')))
1116 tableEnterTo =
eStrndup (v, continuation - v);
1119 error (
FATAL,
"table is not defined: %s", tableEnterTo);
1121 eFree (tableEnterTo);
1123 if (!*(continuation + 1))
1124 error (
FATAL,
"no continuation table is given for: %s", v);
1128 error (
FATAL,
"table for continuation is not defined: %s", continuation + 1);
1135 error (
FATAL,
"table is not defined: %s", v);
1144 "TABLE[,CONT]",
"enter to given regext table (with specifying continuation)"},
1146 NULL,
"leave from the current regext table"},
1148 "TABLE",
"jump to another regext table(don't push the current table to state stack)"},
1150 "TABLE",
"clear the state stack and jump to given regex table"},
1152 NULL,
"stop the parsing with this parser"},
1157 const char kindLetter,
const char* kindName,
1158 const char *
const description,
1159 bool kind_explicitly_defined)
1171 error (
WARNING,
"Don't reuse the kind letter `%c' in a language %s (old: \"%s\", new: \"%s\")",
1173 kdef->
name, kindName);
1179 (!kind_explicitly_defined))
1183 kdef =
kindNew (kindLetter, kindName, description);
1217 .guest = &ptrn->
guest,
1228 const char*
const name,
char kindLetter,
const char* kindName,
1229 char *
const description,
const char* flags,
1230 bool kind_explicitly_defined,
1239 setKind(ptrn, lcb->
owner, kindLetter, kindName, description, kind_explicitly_defined);
1251 bool exclusive =
false;
1266 *cflags &= ~REG_EXTENDED;
1299 NULL,
"interpreted as a Posix basic regular expression."},
1301 NULL,
"interpreted as a Posix extended regular expression (default)"},
1303 NULL,
"applied in a case-insensitive manner"},
1307 const char*
const regexp,
const char*
const flags)
1312 cflags &= ~REG_NEWLINE;
1323 errcode =
regcomp (result, regexp, cflags);
1327 regerror (errcode, result, errmsg, 256);
1339 const char*
const kindSpec,
char*
const kindLetter,
char**
const kindName,
1342 *description =
NULL;
1344 if (kindSpec ==
NULL || kindSpec [0] ==
'\0')
1352 bool explicitly_defined =
false;
1353 const char* k = kindSpec;
1355 if (k [0] !=
',' && (k [1] ==
',' || k [1] ==
'\0'))
1358 explicitly_defined =
true;
1370 const char *
const comma = strchr (k,
',');
1374 if (strlen (k) == 0)
1379 explicitly_defined =
true;
1388 *kindName =
eStrndup (k, comma - k );
1389 explicitly_defined =
true;
1396 return explicitly_defined;
1406 const char*
const in,
const char* out,
1407 const int nmatch,
const regmatch_t*
const pmatch)
1411 for (p = out ; *p !=
'\0' ; p++)
1413 if (*p ==
'\\' && isdigit ((
int) *++p))
1415 const int dig = *p -
'0';
1416 if (0 < dig && dig < nmatch && pmatch [dig].rm_so != -1)
1418 const int diglen = pmatch [dig].
rm_eo - pmatch [dig].
rm_so;
1419 vStringNCatS (result, in + pmatch [dig].rm_so, diglen);
1422 else if (*p !=
'\n' && *p !=
'\r')
1442 && (
entry->extensionFields.endLine == 0))
1444 entry->extensionFields.endLine = endline;
1445 n =
entry->extensionFields.scopeIndex;
1488 if (
entry && (
entry->extensionFields.endLine == 0))
1497 error (
WARNING,
"%s:%lu: null expansion of name pattern \"%s\"",
1506 unsigned long ln = 0;
1526 if (field_trashbox ==
NULL)
1550 unsigned int roleIndex;
1580 unsigned int count = 0;
1590 if (pmatch [i].rm_so != -1)
1601 const char *
const line,
1629 const char *current,
1634 if (guest_spec->
lang.
type == GUEST_LANG_UNKNOWN)
1636 else if (guest_spec->
lang.
type == GUEST_LANG_PLACEHOLDER)
1638 else if (guest_spec->
lang.
type == GUEST_LANG_STATIC_LANGNAME)
1643 else if (guest_spec->
lang.
type == GUEST_LANG_PTN_GROUP_FOR_LANGNAME)
1654 else if (guest_spec->
lang.
type == GUEST_LANG_PTN_GROUP_FOR_FILEMAP)
1669 for (
int i = 0; i < 2; i++)
1688 bool result =
false;
1702 entry->statistics.match++;
1711 if (guest->
lang.
type != GUEST_LANG_UNKNOWN)
1734 entry->statistics.unmatch++;
1739 const vString*
const allLines,
1743 const char *current;
1749 bool result =
false;
1752 unsigned int delta = 1;
1766 entry->statistics.unmatch++;
1776 entry->statistics.match++;
1804 unsigned int pos = current - start;
1806 "a multi line regex pattern doesn't advance the input cursor: %s",
1808 error (
WARNING,
"Language: %s, input file: %s, pos: %u",
1826 bool result =
false;
1866 while (driver () != EOF)
1886 if (
entry->pattern->scopeActions)
1914 while (*pattern !=
'\0')
1935 const char*
const regex,
1936 const char*
const name,
1937 const char*
const kinds,
1938 const char*
const flags,
1956 bool explictly_defined =
parseKinds (kinds, &kindLetter, &kindName, &description);
1958 if (kindLetter == fileKind->
letter)
1960 "Kind letter \'%c\' used in regex definition \"%s\" of %s language is reserved in ctags main",
1964 else if (!isalpha ((
unsigned char)kindLetter))
1966 "Kind letter must be an alphabetical character: \"%c\"",
1969 if (strcmp (kindName, fileKind->
name) == 0)
1971 "Kind name \"%s\" used in regex definition \"%s\" of %s language is reserved in ctags main",
1982 for (
const char * p = kindName; *p; p++)
1988 "A kind name doesn't start with an alphabetical character: "
1989 "'%s' in \"--%s-%s\" option",
2004 "Non-alphanumeric char is used in kind name: "
2005 "'%s' in \"--%s-%s\" option",
2015 kindLetter, kindName, description, flags,
2022 eFree (description);
2033 error (
WARNING,
"%s: regexp missing name pattern", regex);
2040 const char*
const regex,
2041 const char*
const name,
2042 const char*
const kinds,
2043 const char*
const flags,
2051 const char*
const name,
const char*
const kinds,
const char*
const flags,
2059 const char*
const table_name,
2060 const char*
const regex,
2061 const char*
const name,
const char*
const kinds,
const char*
const flags,
2066 if (table_index < 0)
2067 error (
FATAL,
"unknown table name: %s", table_name);
2074 const char*
const regex,
2075 const char*
const flags,
2090 disabled, userData);
2097 const char*
const pattern)
2103 char * regex_pat =
NULL;
2104 char *
name, *kinds, *flags;
2110 for (c = pattern; *c; c++)
2112 if (! (isalnum(*c) || *c ==
'_'))
2114 if (*c && (*(c + 1) !=
'^'))
2130 if (regex_pat ==
NULL || *regex_pat ==
'\0')
2131 error (
FATAL,
"wrong mtable pattern specification: %s", pattern);
2133 char *table_name =
eStrndup(pattern, c - pattern);
2135 if (table_index < 0)
2136 error (
FATAL,
"unknown table name: %s (in %s)", table_name, pattern);
2140 regex_pat =
eStrdup (pattern);
2151 const char*
const parameter)
2153 if (parameter ==
NULL || parameter [0] ==
'\0')
2155 else if (parameter [0] !=
'@')
2161 const char* regexfile = parameter + 1;
2163 verbose (
"open a regex file: %s\n", regexfile);
2250 bool result =
false;
2275 if (strcmp (table->
name,
name) == 0)
2285 for (c =
name; *c; c++)
2286 if (! (isalnum(*c) || *c ==
'_'))
2287 error (
FATAL,
"`%c' in \"%s\" is not acceptable as part of table name", *c,
name);
2305 fprintf (fp,
"scope : ");
2308 fprintf(fp,
"%s",
entry->name);
2312 fprintf(fp,
"%c",
'/');
2330 fprintf(fp,
"%s%s", t->
name, tmp);
2339 for (; *c && (*c !=
'\n'); c++)
2345 fprintf (vfp,
"\ninput : \"%s\" L%lu\n",
2352 const char *
const tableName,
2353 const unsigned int index,
2356 const char *
const current,
2383 const char *current;
2390 current = cstart + *offset;
2417 if (*current ==
'\n')
2423 else if (*current ==
'\t')
2429 else if (*current ==
'\\')
2442 fprintf (vfp,
"match : '%s' %15s[%2u] /", s, table->
name, i);
2443 else if (s[0] ==
'\0')
2444 fprintf (vfp,
"match : '' %15s[%2u] /", table->
name, i);
2446 fprintf (vfp,
"match :'%s' %15s[%2u] / ", s, table->
name, i);
2461 entry->statistics.match++;
2473 fprintf(vfp,
"result: matched %d bytes\n", (
int)(pmatch[0].rm_eo));
2480 *offset, current, pmatch);
2500 fprintf(vfp,
"action: NOP in {%s}, stack: /", table->
name);
2511 next = taction->
table;
2515 fprintf(vfp,
"action: [enter] to {%s}, cont: {%s}, stack: /",
2519 fprintf(vfp,
"action: [enter] to {%s}, stack: /", next->
name);
2527 fprintf(vfp,
"action: [leave] from {%s}, stack: /", table->
name);
2533 error (
WARNING,
"leave is specified as regex table action but the table stack is empty");
2540 next = taction->
table;
2543 fprintf(vfp,
"action: [jump] from {%s} to {%s}, stack: /", table->
name, next->
name);
2550 next = taction->
table;
2553 fprintf(vfp,
"action: [reset] to {%s}, stack: /", next->
name);
2562 fprintf(vfp,
"action: [quit], stack: /");
2574 error (
WARNING,
"Forcefully advance the input pos because");
2575 error (
WARNING,
"following conditions for entering infinite loop are satisfied:");
2578 error (
WARNING,
"+ the input file pos doesn't advance.");
2579 error (
WARNING,
"Language: %s, input file: %s, pos: %u",
2594 entry->statistics.unmatch++;
2599 static int apop_count = 0;
2601 verbose(
"result: no match - autopop<%d> from {%s} to {%s} @ %lu\n", apop_count++, table->
name, next->
name,
2615 verbose (
"extend regex table \"%s\" with \"%s\"\n", dist, src);
2640 fputs(
"==============================================\n", stderr);
2644 fprintf(stderr,
"%s\n", table->
name);
2645 fputs(
"-----------------------\n", stderr);
2650 fprintf(stderr,
"%10u/%-10u%-40s ref: %d\n",
2651 entry->statistics.match,
2652 entry->statistics.unmatch +
entry->statistics.match,
2653 entry->pattern->pattern_string,
2654 entry->pattern->refcount);
2656 fputc(
'\n', stderr);
2666 unsigned int offset = 0;
2668 int motionless_counter = 0;
2669 unsigned int last_offset;
2674 last_offset = offset;
2677 if (last_offset == offset)
2678 motionless_counter++;
2680 motionless_counter = 0;
2684 error (
WARNING,
"mtable<%s/%s>: the input cursor stays at %u in %s so long though the tables are switched",
2695 error (
WARNING,
"mtable<%s/%s>: the tenter/tleave stack overflows at %u in %s",
2723 startLine, startOffset - startLineOffset,
2724 endLine, endOffset - endLineOffset,
2725 startOffset - startLineOffset);
2757 verbose (
"guestRequestSubmit: %s; "
2758 "range: %"PRId64
" - %"PRId64
"\n",
2770#if defined (CHECK_REGCOMP)
2775 if (
regcomp (&patbuf,
"/hello/", 0) != 0)
void colprintTableDelete(struct colprintTable *table)
int makeTagEntry(const tagEntryInfo *const tag)
void assignRole(tagEntryInfo *const e, int roleIndex)
void markTagExtraBit(tagEntryInfo *const tag, xtagType extra)
void initRefTagEntry(tagEntryInfo *const e, const char *const name, int kindIndex, int roleIndex)
tagEntryInfo * getEntryInCorkQueue(int n)
void attachParserField(tagEntryInfo *const tag, bool inCorkQueue, fieldType ftype, const char *value)
#define ROLE_DEFINITION_INDEX
static roleBitsType makeRoleBit(int roleIndex)
void error(const errorSelection selection, const char *const format,...)
bool isFieldEnabled(fieldType type)
fieldType getFieldTypeForNameAndLanguage(const char *fieldName, langType language)
enum eFieldType fieldType
void flagsColprintAddDefinitions(struct colprintTable *table, flagDefinition *def, unsigned int ndefs)
struct colprintTable * flagsColprintTableNew(void)
void flagsColprintTablePrint(struct colprintTable *table, bool withListHeader, bool machinable, FILE *fp)
void flagsEval(const char *flags_original, flagDefinition *defs, unsigned int ndefs, void *data)
#define CTAGS_ATTR_UNUSED
static bool match(const unsigned char *line, const char *word)
#define KIND_REGEX_DEFAULT_LETTER
#define KIND_REGEX_DEFAULT_NAME
static GOptionEntry entries[]
void notifyRegexInputEnd(struct lregexControlBlock *lcb)
static int makePromiseForAreaSpecifiedWithOffsets(const char *parser, off_t startOffset, off_t endOffset)
static void regex_flag_extend_long(const char *const c, const char *const unused, void *data)
static bool parseKinds(const char *const kindSpec, char *const kindLetter, char **const kindName, char **description)
static void addTagRegexOption(struct lregexControlBlock *lcb, enum regexParserType regptype, const char *const pattern)
void printMultitableRegexFlags(bool withListHeader, bool machinable, FILE *fp)
struct lregexControlBlock * allocLregexControlBlock(parserDefinition *parser)
static regexTableEntry * newEntry(regex_t *const pattern, enum regexParserType regptype)
static void regex_flag_icase_long(const char *s, const char *const unused, void *data)
static void clearPatternSet(struct lregexControlBlock *lcb)
static flagDefinition prePtrnFlagDef[]
static regexPattern * addCompiledTagCommon(struct lregexControlBlock *lcb, int table_index, regex_t *const pattern, enum regexParserType regptype)
static flagDefinition guestPtrnFlagDef[]
void addTagMultiTableRegex(struct lregexControlBlock *lcb, const char *const table_name, const char *const regex, const char *const name, const char *const kinds, const char *const flags, bool *disabled)
static bool hasScopeActionInRegex0(ptrArray *entries)
static bool matchCallbackPattern(const vString *const line, const regexPattern *const patbuf, const regmatch_t *const pmatch)
void addCallbackRegex(struct lregexControlBlock *lcb, const char *const regex, const char *const flags, const regexCallback callback, bool *disabled, void *userData)
static void pre_ptrn_flag_guest_long(const char *const s, const char *const v, void *data)
static flagDefinition multilinePtrnFlagDef[]
static void guestRequestClear(struct guestRequest *)
static void pre_ptrn_flag_exclusive_long(const char *const s, const char *const unused, void *data)
void freeRegexResources(void)
static flagDefinition regexFlagDefs[]
static void dumpSstack(FILE *fp, int scope)
#define BACK_REFERENCE_COUNT
static bool isGuestRequestConsistent(struct guestRequest *guest_req)
static void common_flag_msg_long(const char *const s, const char *const v, void *data)
void notifyRegexInputStart(struct lregexControlBlock *lcb)
void extendRegexTable(struct lregexControlBlock *lcb, const char *src, const char *dist)
static void regex_flag_basic_short(char c, void *data)
static flagDefinition scopePtrnFlagDef[]
static char * escapeRegexPattern(const char *pattern)
static unsigned long getInputLineNumberInRegPType(enum regexParserType regptype, off_t offset)
static bool fillGuestRequest(const char *start, const char *current, regmatch_t pmatch[10], struct guestSpec *guest_spec, struct guestRequest *guest_req)
static flagDefinition multitablePtrnFlagDef[]
static void deletePattern(regexPattern *p)
static void patternEvalFlags(struct lregexControlBlock *lcb, regexPattern *ptrn, enum regexParserType regptype, const char *flags)
static void initTaction(struct mTableActionSpec *taction)
static kindDefinition * kindNew(char letter, const char *name, const char *description)
#define MTABLE_STACK_MAX_DEPTH
static void printInputLine(FILE *vfp, const char *c, const off_t offset)
#define MTABLE_MOTIONLESS_MAX
static int fileReadLineDriver(void)
bool matchMultilineRegex(struct lregexControlBlock *lcb, const vString *const allLines)
static bool parseTagRegex(enum regexParserType regptype, char *const regexp, char **const name, char **const kinds, char **const flags)
static bool matchMultilineRegexPattern(struct lregexControlBlock *lcb, const vString *const allLines, regexTableEntry *entry)
void printRegexFlags(bool withListHeader, bool machinable, FILE *fp)
void addTagMultiLineRegex(struct lregexControlBlock *lcb, const char *const regex, const char *const name, const char *const kinds, const char *const flags, bool *disabled)
void freeLregexControlBlock(struct lregexControlBlock *lcb)
static char * scanSeparators(char *name, enum regexParserType regptype)
static void guestRequestDelete(struct guestRequest *)
static void common_flag_extra_long(const char *const s, const char *const v, void *data)
static void regex_flag_basic_long(const char *const s, const char *const unused, void *data)
static regexPattern * refPattern(regexPattern *ptrn)
bool hasScopeActionInRegex(struct lregexControlBlock *lcb)
static void placeholder_ptrn_flag_eval(const char *const f, const char *const v, void *data)
static void common_flag_field_long(const char *const s, const char *const v, void *data)
static regexTableEntry * newRefPatternEntry(regexTableEntry *other)
static vString * substitute(const char *const in, const char *out, const int nmatch, const regmatch_t *const pmatch)
void printMultitableStatistics(struct lregexControlBlock *lcb)
static regexPattern * addTagRegexInternal(struct lregexControlBlock *lcb, int table_index, enum regexParserType regptype, const char *const regex, const char *const name, const char *const kinds, const char *const flags, bool *disabled)
static bool regexAvailable
static regex_t * compileRegex(enum regexParserType regptype, const char *const regexp, const char *const flags)
void findRegexTagsMainloop(int(*driver)(void))
bool regexNeedsMultilineBuffer(struct lregexControlBlock *lcb)
bool matchMultitableRegex(struct lregexControlBlock *lcb, const vString *const allLines)
bool matchRegex(struct lregexControlBlock *lcb, const vString *const line)
static void printMessage(const langType language, const regexPattern *const ptrn, const off_t offset, const char *const line, const regmatch_t *const pmatch)
static void printMultitableMessage(const langType language, const char *const tableName, const unsigned int index, const regexPattern *const ptrn, const off_t offset, const char *const current, const regmatch_t *const pmatch)
static bool guestRequestIsFilled(struct guestRequest *)
static void common_flag_anonymous_long(const char *const s, const char *const v, void *data)
static flagDefinition commonSpecFlagDef[]
static void matchTagPattern(struct lregexControlBlock *lcb, const char *line, const regexPattern *const patbuf, const regmatch_t *const pmatch, off_t offset)
void printMultilineRegexFlags(bool withListHeader, bool machinable, FILE *fp)
void addTagRegex(struct lregexControlBlock *lcb, const char *const regex, const char *const name, const char *const kinds, const char *const flags, bool *disabled)
static void pre_ptrn_flag_mgroup_long(const char *const s, const char *const v, void *data)
static void kindFree(kindDefinition *kind)
static struct regexTable * matchMultitableRegexTable(struct lregexControlBlock *lcb, struct regexTable *table, const vString *const start, unsigned int *offset)
static void scope_ptrn_flag_eval(const char *const f, const char *const v, void *data)
static void setKind(regexPattern *ptrn, const langType owner, const char kindLetter, const char *kindName, const char *const description, bool kind_explicitly_defined)
#define TABLE_INDEX_UNUSED
static void fieldPatternDelete(struct fieldPattern *fp)
static void initMgroup(struct mGroupSpec *mgroup)
static struct fieldPattern * fieldPatternNew(fieldType ftype, const char *template)
static regexPattern * addCompiledCallbackPattern(struct lregexControlBlock *lcb, regex_t *const pattern, const regexCallback callback, const char *flags, bool *disabled, void *userData)
static struct guestRequest * guestRequestNew(void)
static void regex_flag_icase_short(char c, void *data)
static void pre_ptrn_flag_mtable_long(const char *const s, const char *const v, void *data)
static regexPattern * addCompiledTagPattern(struct lregexControlBlock *lcb, int table_index, enum regexParserType regptype, regex_t *const pattern, const char *const name, char kindLetter, const char *kindName, char *const description, const char *flags, bool kind_explicitly_defined, bool *disabled)
static void guestRequestSubmit(struct guestRequest *)
static int getTableIndexForName(const struct lregexControlBlock *const lcb, const char *name)
static void regex_flag_extend_short(char c, void *data)
static void common_flag_role_long(const char *const s, const char *const v, void *data)
static void pre_ptrn_flag_exclusive_short(char c, void *data)
void addRegexTable(struct lregexControlBlock *lcb, const char *name)
static bool hasMessage(const regexPattern *const ptrn)
static void deleteTable(void *ptrn)
static bool matchRegexPattern(struct lregexControlBlock *lcb, const vString *const line, regexTableEntry *entry)
static void pre_ptrn_flag_advanceTo_long(const char *const s, const char *const v, void *data)
static void deleteTableEntry(void *ptrn)
static regexPattern * newPattern(regex_t *const pattern, enum regexParserType regptype)
static void dumpTstack(FILE *fp, ptrArray *tstack)
static void initGuestSpec(struct guestSpec *guest)
static void fillEndLineFieldOfUpperScopes(struct lregexControlBlock *lcb, unsigned long endline)
static void initRegexTag(tagEntryInfo *e, const vString *const name, int kindIndex, int roleIndex, int scopeIndex, int placeholder, unsigned long line, MIOPos *pos, int xtag_type)
void processTagRegexOption(struct lregexControlBlock *lcb, enum regexParserType regptype, const char *const parameter)
bool(* regexCallback)(const char *line, const regexMatch *matches, unsigned int count, void *userData)
MIO * mio_new_file(const char *filename, const char *mode)
mio_new_file: @filename: Filename to open, same as the fopen()'s first argument @mode: Mode in which ...
int mio_unref(MIO *mio)
mio_unref: @mio: A MIO object
void verbose(const char *const format,...)
#define BEGIN_VERBOSE(VFP)
langType getNamedLanguage(const char *const name, size_t len)
kindDefinition * getLanguageKind(const langType language, int kindIndex)
langType getLanguageForFilename(const char *const filename, langType startFrom)
vString * anonGenerateNew(const char *prefix, int kind)
const char * getLanguageName(const langType language)
kindDefinition * getLanguageKindForLetter(const langType language, char kindLetter)
void useRegexMethod(const langType language)
roleDefinition * getLanguageRoleForName(const langType language, int kindIndex, const char *roleName)
unsigned int countLanguageRoles(const langType language, int kindIndex)
int defineLanguageKind(const langType language, kindDefinition *def, freeKindDefFunc freeKindDef)
int makePromise(const char *parser, unsigned long startLine, long startCharOffset, unsigned long endLine, long endCharOffset, unsigned long sourceLineOffset)
unsigned int ptrArrayCount(const ptrArray *const current)
void ptrArrayClear(ptrArray *const current)
void * ptrArrayItem(const ptrArray *const current, const unsigned int indx)
void * ptrArrayLast(const ptrArray *const current)
ptrArray * ptrArrayNew(ptrArrayDeleteFunc deleteFunc)
void ptrArrayDelete(ptrArray *const current)
void * ptrArrayRemoveLast(ptrArray *const current)
unsigned int ptrArrayAdd(ptrArray *const current, void *ptr)
void(* ptrArrayDeleteFunc)(void *data)
MIOPos getInputFilePositionForLine(unsigned int line)
char * readLineRaw(vString *const vLine, MIO *const mio)
const unsigned char * readLineFromInputFile(void)
unsigned long getInputLineNumber(void)
long getInputFileOffsetForLine(unsigned int line)
const char * getInputFileName(void)
unsigned long getInputLineNumberForFileOffset(long offset)
size_t regerror(int errcode, const regex_t *__restrict preg, char *__restrict errbuf, size_t errbuf_size)
int regcomp(regex_t *__restrict preg, const char *__restrict pattern, int cflags)
void regfree(regex_t *preg)
int regexec(const regex_t *__preg, const char *__string, size_t __nmatch, regmatch_t __pmatch[], int __eflags)
char * eStrndup(const char *str, size_t len)
bool doesFileExist(const char *const fileName)
bool strToInt(const char *const str, int base, int *value)
char * strstr(const char *str, const char *substr)
char * eStrdup(const char *str)
void eFree(void *const ptr)
const struct lregexControlBlock *const lcb
union guestLangSpec::@5 spec
enum guestLangSpec::guestLangSpecType type
@ GUEST_LANG_PTN_GROUP_FOR_LANGNAME
@ GUEST_LANG_PTN_GROUP_FOR_FILEMAP
@ GUEST_LANG_STATIC_LANGNAME
enum regexParserType type
struct boundaryInRequest boundary[2]
struct guestLangSpec lang
struct boundarySpec boundary[2]
struct guestRequest * guest_req
int forLineNumberDetermination
struct regexTable * table
struct regexTable * continuation_table
struct regexPattern::@6::@9 callback
unsigned int scopeActions
char * anonymous_tag_prefix
enum regexParserType regptype
struct mTableActionSpec taction
struct regexPattern::@7 message
struct regexPattern::@6::@8 tag
struct sTagEntryInfo::@3 extensionFields
void trashBoxDelete(TrashBox *trash_box)
TrashBox * trashBoxNew(void)
void trashBoxMakeEmpty(TrashBox *trash_box)
void * trashBoxPut(TrashBox *trash_box, void *item, TrashBoxDestroyItemProc destroy)
#define DEFAULT_TRASH_BOX(PTR, PROC)
void(* TrashBoxDestroyItemProc)(void *)
void vStringNCatS(vString *const string, const char *const s, const size_t length)
void vStringStripTrailing(vString *const string)
vString * vStringNew(void)
void vStringDelete(vString *const string)
void vStringStripLeading(vString *const string)
void vStringCatS(vString *const string, const char *const s)
vString * vStringNewInit(const char *const s)
char * vStringDeleteUnwrap(vString *const string)
#define vStringLength(vs)
static void vStringPut(vString *const string, const int c)
bool isXtagEnabled(xtagType type)
xtagType getXtagTypeForNameAndLanguage(const char *name, langType language)