1 /*
2 * Generated by ./misc/optlib2c from optlib/rdoc.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_L1HEADER,
13 K_L2HEADER,
14 K_L3HEADER,
15 K_L4HEADER,
16 K_L5HEADER,
17 K_L6HEADER,
18 } RDocKind;
19
20
initializeRDocParser(const langType language CTAGS_ATTR_UNUSED)21 static void initializeRDocParser (const langType language CTAGS_ATTR_UNUSED)
22 {
23 addLanguageOptscriptToHook (language, SCRIPT_HOOK_PRELUDE,
24 "{{ /kindTable [\n"
25 " /L1Header /L2Header /L3Header /L4Header /L5Header /L6Header\n"
26 " ] def\n"
27 "\n"
28 " /depthForCork {\n"
29 " :kind kindTable exch _aindex pop\n"
30 " } def\n"
31 " /depthForStr {\n"
32 " length 1 sub\n"
33 " } def\n"
34 "\n"
35 " % endline:int goal:int scopePopUpTo -\n"
36 " /scopePopUpTo\n"
37 " {\n"
38 " {\n"
39 " _scopetop {\n"
40 " dup\n"
41 " % endline goal scope scope\n"
42 " depthForCork 2 index depthForStr ge {\n"
43 " % endline goal scope\n"
44 " 2 index end:\n"
45 " _scopepop\n"
46 " } {\n"
47 " pop\n"
48 " exit\n"
49 " } ifelse\n"
50 " } {\n"
51 " exit\n"
52 " } ifelse\n"
53 " } loop\n"
54 " pop\n"
55 " pop\n"
56 " } def\n"
57 "}}");
58 }
59
RDocParser(void)60 extern parserDefinition* RDocParser (void)
61 {
62 static const char *const extensions [] = {
63 "rdoc",
64 NULL
65 };
66
67 static const char *const aliases [] = {
68 NULL
69 };
70
71 static const char *const patterns [] = {
72 NULL
73 };
74
75 static kindDefinition RDocKindTable [] = {
76 {
77 true, 'h', "L1Header", " Level 1 headers",
78 },
79 {
80 true, 'i', "L2Header", " Level 2 headers",
81 },
82 {
83 true, 'j', "L3Header", " Level 3 headers",
84 },
85 {
86 true, 'k', "L4Header", " Level 4 headers",
87 },
88 {
89 true, 'l', "L5Header", " Level 5 headers",
90 },
91 {
92 true, 'm', "L6Header", " Level 6 headers",
93 },
94 };
95 static tagRegexTable RDocTagRegexTable [] = {
96 {"^(?:#[ \t])*(={1,6})[ \t]*([^=].*)[ \t]*$", "",
97 "", "{pcre2}"
98 "{{\n"
99 " \\1 length kindTable length le {\n"
100 " \\2\n"
101 " kindTable \\1 length 1 sub get\n"
102 " 2 /start _matchloc\n"
103 " _tag _commit\n"
104 " dup :line 1 sub \\1 scopePopUpTo\n"
105 " _scopetop {\n"
106 " 1 index exch scope: _scopepush\n"
107 " } {\n"
108 " _scopepush\n"
109 " } ifelse\n"
110 " } if\n"
111 "}}", NULL, false},
112 };
113
114
115 parserDefinition* const def = parserNew ("RDoc");
116
117 def->enabled = true;
118 def->extensions = extensions;
119 def->patterns = patterns;
120 def->aliases = aliases;
121 def->method = METHOD_NOT_CRAFTED|METHOD_REGEX;
122 def->useCork = CORK_QUEUE;
123 def->kindTable = RDocKindTable;
124 def->kindCount = ARRAY_SIZE(RDocKindTable);
125 def->tagRegexTable = RDocTagRegexTable;
126 def->tagRegexCount = ARRAY_SIZE(RDocTagRegexTable);
127 def->defaultScopeSeparator = "\"\"";
128 def->initialize = initializeRDocParser;
129
130 return def;
131 }
132