forked from universal-ctags/ctags
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pod.c
123 lines (111 loc) · 2.72 KB
/
pod.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
* Generated by ./misc/optlib2c from optlib/pod.ctags, Don't edit this manually.
*/
#include "general.h"
#include "parse.h"
#include "routines.h"
#include "field.h"
#include "xtag.h"
typedef enum {
K_CHAPTER,
K_SECTION,
K_SUBSECTION,
K_SUBSUBSECTION,
} PodKind;
static void initializePodParser (const langType language CTAGS_ATTR_UNUSED)
{
addLanguageOptscriptToHook (language, SCRIPT_HOOK_PRELUDE,
"{{ /kindTable [\n"
" /chapter /section /subsection /subsubsection\n"
" ] def\n"
"\n"
" % numstr:str TOLEVEL int\n"
" /tolevel {\n"
" 0 get ?1 sub\n"
" } def\n"
"\n"
" /depthForCork {\n"
" :kind kindTable exch _aindex pop\n"
" } def\n"
"\n"
" % endline:int goal:int scopePopUpTo -\n"
" /scopePopUpTo\n"
" {\n"
" {\n"
" _scopetop {\n"
" dup\n"
" % endline goal scope scope\n"
" depthForCork 2 index ge {\n"
" % endline goal scope\n"
" 2 index end:\n"
" _scopepop\n"
" } {\n"
" pop\n"
" exit\n"
" } ifelse\n"
" } {\n"
" exit\n"
" } ifelse\n"
" } loop\n"
" pop\n"
" pop\n"
" } def\n"
"}}");
}
extern parserDefinition* PodParser (void)
{
static const char *const extensions [] = {
"pod",
NULL
};
static const char *const aliases [] = {
NULL
};
static const char *const patterns [] = {
NULL
};
static kindDefinition PodKindTable [] = {
{
true, 'c', "chapter", "chapters",
},
{
true, 's', "section", "sections",
},
{
true, 'S', "subsection", "subsections",
},
{
true, 't', "subsubsection", "subsubsections",
},
};
static tagRegexTable PodTagRegexTable [] = {
{"^=head([1-4])[ \t]+(.+)", "",
"", ""
"{{\n"
" \\2\n"
" kindTable \\1 tolevel get\n"
" 2 /start _matchloc\n"
" _tag _commit\n"
" dup :line 1 sub \\1 tolevel scopePopUpTo\n"
" _scopetop {\n"
" 1 index exch scope: _scopepush\n"
" } {\n"
" _scopepush\n"
" } ifelse\n"
"}}", NULL, false},
};
parserDefinition* const def = parserNew ("Pod");
def->enabled = true;
def->extensions = extensions;
def->patterns = patterns;
def->aliases = aliases;
def->method = METHOD_NOT_CRAFTED|METHOD_REGEX;
def->useCork = CORK_QUEUE;
def->kindTable = PodKindTable;
def->kindCount = ARRAY_SIZE(PodKindTable);
def->tagRegexTable = PodTagRegexTable;
def->tagRegexCount = ARRAY_SIZE(PodTagRegexTable);
def->defaultScopeSeparator = "\"\"";
def->initialize = initializePodParser;
return def;
}