Update all parsers and related files to ctags p6.1.20240421.0
[geany-mirror.git] / ctags / main / lxpath.h
blobde27f100d4e068195802e725100bc472e2f9cf1b
1 /*
2 * Copyright (c) 2016, Masatake YAMATO
3 * Copyright (c) 2016, Red Hat, Inc.
5 * This source code is released for free distribution under the terms of the
6 * GNU General Public License version 2 or (at your option) any later version.
8 * Xpath based parer API
9 */
10 #ifndef CTAGS_LXPATH_PARSE_H
11 #define CTAGS_LXPATH_PARSE_H
14 * INCLUDE FILES
17 #include "general.h" /* must always come first */
18 #include "types.h"
20 #ifdef HAVE_LIBXML
21 #include <libxml/xpath.h>
22 #include <libxml/tree.h>
23 #else
24 #define xmlNode void
25 #define xmlXPathCompExpr void
26 #define xmlXPathContext void
27 #endif
31 * DATA DECLARATIONS
34 typedef struct sTagXpathMakeTagSpec {
35 /* Kind used in making a tag.
36 If kind is KIND_GHOST_INDEX, a function
37 specified with decideKind is called to decide
38 the kind for the tag. */
39 int kind;
40 int role;
41 /* If make is NULL, just makeTagEntry is used instead. */
42 void (*make) (xmlNode *node,
43 const char *xpath,
44 const struct sTagXpathMakeTagSpec *spec,
45 tagEntryInfo *tag,
46 void *userData);
47 int (*decideKind) (xmlNode *node,
48 const char *xpath,
49 const struct sTagXpathMakeTagSpec *spec,
50 void *userData);
51 /* TODO: decideRole */
52 } tagXpathMakeTagSpec;
54 typedef struct sTagXpathRecurSpec {
55 void (*enter) (xmlNode *node,
56 const char *xpath,
57 const struct sTagXpathRecurSpec *spec,
58 xmlXPathContext *ctx,
59 void *userData);
61 int nextTable; /* A parser can use this field any purpose.
62 main/lxpath part doesn't touch this. */
64 } tagXpathRecurSpec;
66 typedef struct sTagXpathTable
68 const char *const xpath;
69 enum { LXPATH_TABLE_DO_MAKE, LXPATH_TABLE_DO_RECUR } specType;
70 union {
71 tagXpathMakeTagSpec makeTagSpec;
72 tagXpathRecurSpec recurSpec;
73 } spec;
74 xmlXPathCompExpr* xpathCompiled;
75 } tagXpathTable;
77 typedef struct sTagXpathTableTable {
78 tagXpathTable *table;
79 unsigned int count;
80 } tagXpathTableTable;
82 typedef struct sXpathFileSpec {
84 NULL represents the associated field in DTD is not examined.
85 "" (an empty string) represents the associated field in DTD
86 (and root element) must not exist. */
87 const char *rootElementName;
88 const char *nameInDTD;
89 const char *externalID;
90 const char *systemID;
91 const char *rootNSPrefix;
92 const char *rootNSHref;
93 } xpathFileSpec;
97 * FUNCTION PROTOTYPES
100 /* Xpath interface */
101 extern void findXMLTagsFull (xmlXPathContext *ctx, xmlNode *root,
102 int tableTableIndex,
103 void (* runAfter) (xmlXPathContext *, xmlNode *, void *),
104 void *userData);
106 extern void findXMLTags (xmlXPathContext *ctx, xmlNode *root,
107 int tableTableIndex,
108 void *userData);
110 extern void updateXMLTagLine (tagEntryInfo *e, xmlNode *node);
112 #endif /* CTAGS_LXPATH_PARSE_H */