xref: /Universal-ctags/optlib/kconfig.c (revision b9a5fba8003e0defa2902c19d591138c74782a0d)
1 /*
2  * Generated by ./misc/optlib2c from optlib/kconfig.ctags, Don't edit this manually.
3  */
4 #include "general.h"
5 #include "parse.h"
6 #include "routines.h"
7 #include "field.h"
8 #include "xtag.h"
9 
10 
11 typedef enum {
12 	K_CONFIG,
13 	K_MENU,
14 	K_MAINMENU,
15 	K_KCONFIG,
16 	K_CHOICE,
17 } KconfigKind;
18 
19 
initializeKconfigParser(const langType language CTAGS_ATTR_UNUSED)20 static void initializeKconfigParser (const langType language CTAGS_ATTR_UNUSED)
21 {
22 }
23 
KconfigParser(void)24 extern parserDefinition* KconfigParser (void)
25 {
26 	static const char *const extensions [] = {
27 		NULL
28 	};
29 
30 	static const char *const aliases [] = {
31 		NULL
32 	};
33 
34 	static const char *const patterns [] = {
35 		"Kconfig*",
36 		NULL
37 	};
38 
39 	static roleDefinition KconfigKconfigRoleTable [] = {
40 		{ true, "source", "kconfig file loaded with source directive" },
41 	};
42 	static kindDefinition KconfigKindTable [] = {
43 		{
44 		  true, 'c', "config", "configs",
45 		},
46 		{
47 		  true, 'm', "menu", "menus",
48 		},
49 		{
50 		  true, 'M', "mainMenu", "the main menu",
51 		},
52 		{
53 		  true, 'k', "kconfig", "kconfig file",
54 		  ATTACH_ROLES(KconfigKconfigRoleTable),
55 		},
56 		{
57 		  true, 'C', "choice", "choices",
58 		},
59 	};
60 	static xtagDefinition KconfigXtagTable [] = {
61 		{
62 		  .enabled     = true,
63 		  .name        = "configPrefixed",
64 		  .description = "prepend CONFIG_ to config names",
65 		},
66 	};
67 	static tagRegexTable KconfigTagRegexTable [] = {
68 		{"^[ \t]*#.*$", "",
69 		"", "{placeholder}", NULL, false},
70 		{"^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*$", "\\2",
71 		"c", "{scope=ref}", NULL, false},
72 		{"^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*$", "CONFIG_\\2",
73 		"c", "{scope=ref}{_extra=configPrefixed}", NULL, false},
74 		{"^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*$", "CONFIG_\\2_MODULE",
75 		"c", "{scope=ref}{_extra=configPrefixed}{exclusive}", NULL, false},
76 		{"^[ \t]*menu[ \t]+\"([^\"]+)\"[ \t]*", "\\1",
77 		"m", "{scope=push}{exclusive}", NULL, false},
78 		{"^[ \t]*endmenu[ \t]*", "",
79 		"", "{scope=pop}{placeholder}{exclusive}", NULL, false},
80 		{"^[ \t]*source[ \t]+\"?([^\"]+)\"?[ \t]*", "\\1",
81 		"k", "{_role=source}{exclusive}{scope=ref}", NULL, false},
82 		{"^[ \t]*choice[ \t]+([A-Za-z0-9_]+)[ \t]*", "\\1",
83 		"C", "{scope=push}{exclusive}", NULL, false},
84 		{"^[ \t]*choice[ \t]*$", "",
85 		"C", "{_anonymous=choice}{scope=push}{exclusive}", NULL, false},
86 		{"^[ \t]*endchoice[ \t]*", "",
87 		"", "{scope=pop}{placeholder}{exclusive}", NULL, false},
88 		{"^[ \t]*mainmenu[ \t]+\"([^\"]+)\"[ \t]*", "\\1",
89 		"M", "{exclusive}", NULL, false},
90 	};
91 
92 
93 	parserDefinition* const def = parserNew ("Kconfig");
94 
95 	def->enabled       = true;
96 	def->extensions    = extensions;
97 	def->patterns      = patterns;
98 	def->aliases       = aliases;
99 	def->method        = METHOD_NOT_CRAFTED|METHOD_REGEX;
100 	def->useCork       = CORK_QUEUE;
101 	def->kindTable     = KconfigKindTable;
102 	def->kindCount     = ARRAY_SIZE(KconfigKindTable);
103 	def->xtagTable     = KconfigXtagTable;
104 	def->xtagCount     = ARRAY_SIZE(KconfigXtagTable);
105 	def->tagRegexTable = KconfigTagRegexTable;
106 	def->tagRegexCount = ARRAY_SIZE(KconfigTagRegexTable);
107 	def->defaultScopeSeparator = "\"\"";
108 	def->initialize    = initializeKconfigParser;
109 
110 	return def;
111 }
112