forked from universal-ctags/ctags
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
- Loading branch information
Showing
5 changed files
with
74 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright (c) 2016, Masatake YAMATO | ||
* Copyright (c) 2016, Red Hat, Inc. | ||
* | ||
* This source code is released for free distribution under the terms of the | ||
* GNU General Public License version 2 or (at your option) any later version. | ||
* | ||
* Xpath based parer API | ||
*/ | ||
#ifndef CTAGS_LXPATH_PARSE_H | ||
#define CTAGS_LXPATH_PARSE_H | ||
|
||
#include "general.h" /* must always come first */ | ||
#include "types.h" | ||
|
||
#ifdef HAVE_LIBXML | ||
#include <libxml/xpath.h> | ||
#include <libxml/tree.h> | ||
#else | ||
#define xmlNode void | ||
#define xmlXPathCompExpr void | ||
#define xmlXPathContext void | ||
#endif | ||
|
||
typedef struct sTagXpathMakeTagSpec { | ||
int kind; | ||
int role; | ||
/* If make is NULL, just makeTagEntry is used instead. */ | ||
void (*make) (xmlNode *node, | ||
const struct sTagXpathMakeTagSpec *spec, | ||
tagEntryInfo *tag, | ||
void *userData); | ||
} tagXpathMakeTagSpec; | ||
|
||
typedef struct sTagXpathRecurSpec { | ||
void (*enter) (xmlNode *node, | ||
const struct sTagXpathRecurSpec *spec, | ||
xmlXPathContext *ctx, | ||
void *userData); | ||
|
||
int nextTable; /* A parser can use this field any purpose. | ||
main/lxpath part doesn't touch this. */ | ||
|
||
} tagXpathRecurSpec; | ||
|
||
typedef struct sTagXpathTable | ||
{ | ||
const char *const xpath; | ||
enum { LXPATH_TABLE_DO_MAKE, LXPATH_TABLE_DO_RECUR } specType; | ||
union { | ||
tagXpathMakeTagSpec makeTagSpec; | ||
tagXpathRecurSpec recurSpec; | ||
} spec; | ||
xmlXPathCompExpr* xpathCompiled; | ||
} tagXpathTable; | ||
|
||
typedef struct sTagXpathTableTable { | ||
tagXpathTable *table; | ||
unsigned int count; | ||
} tagXpathTableTable; | ||
|
||
/* Xpath interface */ | ||
extern void findXMLTags (xmlXPathContext *ctx, xmlNode *root, | ||
const tagXpathTableTable *xpathTableTable, | ||
const kindOption* const kinds, void *userData); | ||
extern void addTagXpath (const langType language, tagXpathTable *xpathTable); | ||
|
||
#endif /* CTAGS_LXPATH_PARSE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters