Making "inline" behave like an attribute. Fixes #1
[arduino-ctags.git] / parse.h
blob1dbff351f2215fc15391da1e30e07147280b648b
1 /*
2 * $Id: parse.h 443 2006-05-30 04:37:13Z darren $
4 * Copyright (c) 1998-2003, Darren Hiebert
6 * This source code is released for free distribution under the terms of the
7 * GNU General Public License.
9 * Private definitions for parsing support.
11 #ifndef _PARSE_H
12 #define _PARSE_H
15 * INCLUDE FILES
17 #include "general.h" /* must always come first */
18 #include "parsers.h" /* contains list of parsers */
19 #include "strlist.h"
22 * MACROS
24 #define KIND_COUNT(kindTable) (sizeof(kindTable)/sizeof(kindOption))
26 #define LANG_AUTO (-1)
27 #define LANG_IGNORE (-2)
30 * DATA DECLARATIONS
32 typedef int langType;
34 typedef void (*createRegexTag) (const vString* const name);
35 typedef void (*simpleParser) (void);
36 typedef boolean (*rescanParser) (const unsigned int passCount);
37 typedef void (*parserInitialize) (langType language);
39 typedef struct sKindOption {
40 boolean enabled; /* are tags for kind enabled? */
41 int letter; /* kind letter */
42 const char* name; /* kind name */
43 const char* description; /* displayed in --help output */
44 } kindOption;
46 typedef struct {
47 /* defined by parser */
48 char* name; /* name of language */
49 kindOption* kinds; /* tag kinds handled by parser */
50 unsigned int kindCount; /* size of `kinds' list */
51 const char *const *extensions; /* list of default extensions */
52 const char *const *patterns; /* list of default file name patterns */
53 parserInitialize initialize; /* initialization routine, if needed */
54 simpleParser parser; /* simple parser (common case) */
55 rescanParser parser2; /* rescanning parser (unusual case) */
56 boolean regex; /* is this a regex parser? */
58 /* used internally */
59 unsigned int id; /* id assigned to language */
60 boolean enabled; /* currently enabled? */
61 stringList* currentPatterns; /* current list of file name patterns */
62 stringList* currentExtensions; /* current list of extensions */
63 } parserDefinition;
65 typedef parserDefinition* (parserDefinitionFunc) (void);
67 typedef struct {
68 size_t start; /* character index in line where match starts */
69 size_t length; /* length of match */
70 } regexMatch;
72 typedef void (*regexCallback) (const char *line, const regexMatch *matches, unsigned int count);
75 * FUNCTION PROTOTYPES
78 /* Each parsers' definition function is called. The routine is expected to
79 * return a structure allocated using parserNew(). This structure must,
80 * at minimum, set the `parser' field.
82 extern parserDefinitionFunc PARSER_LIST;
84 /* Legacy interface */
85 extern boolean includingDefineTags (void);
87 /* Language processing and parsing */
88 extern void makeSimpleTag (const vString* const name, kindOption* const kinds, const int kind);
89 extern parserDefinition* parserNew (const char* name);
90 extern const char *getLanguageName (const langType language);
91 extern langType getNamedLanguage (const char *const name);
92 extern langType getFileLanguage (const char *const fileName);
93 extern void installLanguageMapDefault (const langType language);
94 extern void installLanguageMapDefaults (void);
95 extern void clearLanguageMap (const langType language);
96 extern boolean removeLanguageExtensionMap (const char *const extension);
97 extern void addLanguageExtensionMap (const langType language, const char* extension);
98 extern void addLanguagePatternMap (const langType language, const char* ptrn);
99 extern void printLanguageMap (const langType language);
100 extern void printLanguageMaps (const langType language);
101 extern void enableLanguages (const boolean state);
102 extern void enableLanguage (const langType language, const boolean state);
103 extern void initializeParsing (void);
104 extern void freeParserResources (void);
105 extern void processLanguageDefineOption (const char *const option, const char *const parameter);
106 extern boolean processKindOption (const char *const option, const char *const parameter);
107 extern void printKindOptions (void);
108 extern void printLanguageKinds (const langType language);
109 extern void printLanguageList (void);
110 extern boolean parseFile (const char *const fileName);
112 /* Regex interface */
113 #ifdef HAVE_REGEX
114 extern void findRegexTags (void);
115 extern boolean matchRegex (const vString* const line, const langType language);
116 #endif
117 extern boolean processRegexOption (const char *const option, const char *const parameter);
118 extern void addLanguageRegex (const langType language, const char* const regex);
119 extern void addTagRegex (const langType language, const char* const regex, const char* const name, const char* const kinds, const char* const flags);
120 extern void addCallbackRegex (const langType language, const char *const regex, const char *const flags, const regexCallback callback);
121 extern void disableRegexKinds (const langType language);
122 extern boolean enableRegexKind (const langType language, const int kind, const boolean mode);
123 extern void printRegexKinds (const langType language, boolean indent);
124 extern void freeRegexResources (void);
125 extern void checkRegex (void);
127 #endif /* _PARSE_H */
129 /* vi:set tabstop=4 shiftwidth=4: */