We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b6124a6 commit d34d67cCopy full SHA for d34d67c
main/dependency.c
@@ -14,6 +14,7 @@
14
15
#include "debug.h"
16
#include "dependency.h"
17
+#include "entry.h"
18
#include "options.h"
19
#include "parse_p.h"
20
#include "read.h"
@@ -183,14 +184,18 @@ extern void notifyMakeTagEntry (const tagEntryInfo *tag, int corkIndex)
183
184
{
185
subparser *s;
186
187
+ /* running optscript code attaching to --makeTagEntryReflection-<LANG> */
188
+ langType lang = tag->langType;
189
+ notifyLanguageRegexMakeTagEntry (lang, corkIndex);
190
+
191
foreachSubparser(s, false)
192
193
+ enterSubparser(s);
194
if (s->makeTagEntryNotify)
- {
- enterSubparser(s);
195
s->makeTagEntryNotify (s, tag, corkIndex);
- leaveSubparser();
- }
196
+ /* propagate the event recursively */
197
+ notifyMakeTagEntry (tag, corkIndex);
198
+ leaveSubparser();
199
}
200
201
main/dependency.h
@@ -42,4 +42,9 @@ struct sSlaveParser {
42
slaveParser *next;
43
};
44
45
+/* These are for CPreProcessor.
46
+ * Don't use in the other parsers. */
47
+extern void notifyInputStart (void);
48
+extern void notifyInputEnd (void);
49
50
#endif /* CTAGS_MAIN_DEPENDENCY_H */
main/lregex.c
@@ -2027,6 +2027,14 @@ extern void notifyRegexInputEnd (struct lregexControlBlock *lcb)
2027
fillEndLineFieldOfUpperScopes (lcb, endline);
2028
2029
2030
+extern void notifyRegexMakeTagEntry (struct lregexControlBlock *lcb,
2031
+ int corkIndex)
2032
+{
2033
+ optscriptSetup (optvm, lcb->local_dict, corkIndex);
2034
+ scriptEvalHook (optvm, lcb, SCRIPT_HOOK_MAKE_TAG_ENTRY_REFLECTION);
2035
+ optscriptTeardown (optvm, lcb->local_dict);
2036
+}
2037
2038
extern void findRegexTagsMainloop (int (* driver)(void))
2039
2040
/* merely read all lines of the file */
main/lregex_p.h
@@ -69,6 +69,7 @@ extern bool matchMultitableRegex (struct lregexControlBlock *lcb, const vString*
69
70
extern void notifyRegexInputStart (struct lregexControlBlock *lcb);
71
extern void notifyRegexInputEnd (struct lregexControlBlock *lcb);
72
+extern void notifyRegexMakeTagEntry (struct lregexControlBlock *lcb, int corkIndex);
73
74
extern void addRegexTable (struct lregexControlBlock *lcb, const char *name);
75
extern void extendRegexTable (struct lregexControlBlock *lcb, const char *src, const char *dist);
main/options.c
@@ -377,6 +377,8 @@ static optionDescription LongOptionDescription [] = {
377
{1,1," Define new extra for <LANG>. --extras-<LANG>=+{name} enables it."},
378
{1,1," --_fielddef-<LANG>=<name>,<description>"},
379
{1,1," Define new field for <LANG>."},
380
+ {1,1," --_makeTagEnryReflection-<LANG>={{ optscript-code }}"},
381
+ {1,1," Specify code run when <LANG> parser makes a tag."},
382
{1,1," --_mtable-extend-<LANG>=disttable+srctable."},
383
{1,1," Copy patterns of a regex table to another regex table."},
384
{1,1," --_mtable-regex-<LANG>=<table>/<line_pattern>/<name_pattern>/[<flags>]"},
@@ -3337,6 +3339,8 @@ static void processLongOption (
3337
3339
;
3338
3340
else if (processSequelOption (option, parameter))
3341
3342
+ else if (processMakeTagEntryReflectionOption (option, parameter))
3343
+ ;
3344
else if (processPretendOption (option, parameter))
3345
3346
else if (processRolesOption (option, parameter))
main/options_p.h
@@ -176,6 +176,7 @@ extern bool processRoledefOption (const char *const option, const char *const pa
176
extern bool processScopesepOption (const char *const option, const char *const parameter);
177
extern bool processPreludeOption (const char *const option, const char *const parameter);
178
extern bool processSequelOption (const char *const option, const char *const parameter);
179
+extern bool processMakeTagEntryReflectionOption (const char *const option, const char *const parameter);
180
extern bool processPretendOption (const char *const option, const char *const parameter);
181
extern bool processRolesOption (const char *const option, const char *const parameter);
182
main/parse.c
@@ -3739,6 +3739,11 @@ extern void notifyLanguageRegexInputEnd (langType language)
3739
notifyRegexInputEnd((LanguageTable + language)->lregexControlBlock);
3740
3741
3742
+extern void notifyLanguageRegexMakeTagEntry (langType language, int corkIndex)
3743
3744
+ notifyRegexMakeTagEntry((LanguageTable + language)->lregexControlBlock, corkIndex);
3745
3746
3747
static unsigned int parserCorkFlags (parserDefinition *parser)
3748
3749
subparser *tmp;
@@ -5050,6 +5055,11 @@ extern bool processSequelOption (const char *const option, const char *const par
5050
5055
return processHookOption (option, parameter, "_sequel-", SCRIPT_HOOK_SEQUEL);
5051
5056
5052
5057
5058
+extern bool processMakeTagEntryReflectionOption (const char *const option, const char *const parameter)
5059
5060
+ return processHookOption (option, parameter, "_makeTagEntryReflection-", SCRIPT_HOOK_MAKE_TAG_ENTRY_REFLECTION);
5061
5062
5053
5063
extern bool processPretendOption (const char *const option, const char *const parameter)
5054
5064
5065
langType new_language, old_language;
main/parse.h
@@ -74,6 +74,7 @@ typedef enum {
enum scriptHook {
SCRIPT_HOOK_PRELUDE,
76
SCRIPT_HOOK_SEQUEL,
77
+ SCRIPT_HOOK_MAKE_TAG_ENTRY_REFLECTION,
78
SCRIPT_HOOK_MAX,
79
80
main/parse_p.h
@@ -140,6 +140,7 @@ extern void freeEncodingResources (void);
140
extern bool processLanguageRegexOption (langType language, enum regexParserType regptype, const char *const parameter);
141
extern void notifyLanguageRegexInputStart (langType language);
142
extern void notifyLanguageRegexInputEnd (langType language);
143
+extern void notifyLanguageRegexMakeTagEntry (langType language, int corkIndex);
144
145
extern void matchLanguageRegex (const langType language, const vString* const line);
146
extern void freeRegexResources (void);
main/subparser_p.h
@@ -29,8 +29,6 @@ extern langType getSubparserLanguage (subparser *s);
29
30
/* A base parser doesn't have to call the following three functions.
31
The main part calls them internally. */
32
-extern void notifyInputStart (void);
33
-extern void notifyInputEnd (void);
34
extern void notifyMakeTagEntry (const tagEntryInfo *info, int corkIndex);
35
36
extern void setupSubparsersInUse (struct slaveControlBlock *controlBlock);
0 commit comments