Skip to content

Commit 2722dce

Browse files
committed
Merge pull request universal-ctags#740 from masatake/xpath
xpath metaparser based on libxml2
2 parents 8b7799a + d8a3d40 commit 2722dce

39 files changed

+1200
-13
lines changed

Makefile.am

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ MAIN_SRCS += $(REGEX_SRCS)
2121
MAIN_HEADS += $(REGEX_HEADS)
2222
endif
2323

24+
if HAVE_LIBXML
25+
PARSER_SRCS += $(XML_SRCS)
26+
PARSER_HEADS += $(XML_HEADS)
27+
endif
28+
2429
ctags_CPPFLAGS = -I. -I$(srcdir) -I$(srcdir)/main
2530
if ENABLE_DEBUGGING
2631
ctags_CPPFLAGS+= $(DEBUG_CPPFLAGS)
@@ -34,6 +39,10 @@ ctags_CFLAGS += $(EXTRA_CFLAGS)
3439
ctags_CFLAGS += $(WARNING_CFLAGS)
3540
ctags_CFLAGS += $(COVERAGE_CFLAGS)
3641
ctags_CFLAGS += $(CGCC_CFLAGS)
42+
ctags_CFLAGS += $(LIBXML_CFLAGS)
43+
44+
ctags_LDADD =
45+
ctags_LDADD += $(LIBXML_LIBS)
3746

3847
nodist_ctags_SOURCES = $(REPOINFO_HEADS)
3948
BUILT_SOURCES = $(REPOINFO_HEADS)

Tmain/list-roles.d/run.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,22 @@ title()
1111
echo '#'
1212
}
1313

14+
ignore_xml()
15+
{
16+
grep -v 'Glade\|Ant'
17+
}
18+
1419
title ''
15-
${CTAGS} --quiet --options=NONE --_list-roles=
20+
${CTAGS} --quiet --options=NONE --_list-roles= | ignore_xml
1621

1722
title 'all:*'
18-
${CTAGS} --quiet --options=NONE --_list-roles='all:*'
23+
${CTAGS} --quiet --options=NONE --_list-roles='all:*' | ignore_xml
1924

2025
title 'C:*'
2126
${CTAGS} --quiet --options=NONE --_list-roles='C:*'
2227

2328
title 'all:h'
24-
${CTAGS} --quiet --options=NONE --_list-roles='all:h'
29+
${CTAGS} --quiet --options=NONE --_list-roles='all:h' | ignore_xml
2530

2631
title 'Sh:s'
2732
${CTAGS} --quiet --options=NONE --_list-roles='Sh:s'

Units/review-needed.r/build.xml.t/expected.tags renamed to Units/parser-ant.r/regex-based.d/expected.tags

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
MyProject input.xml /^<project name="MyProject" default="deploy" basedir=".">$/;" p
2-
another.ant input.xml /^ <import file="another.ant"\/>$/;" i
32
clean input.xml /^ <target name="clean" depends="init">$/;" t
43
compile_something input.xml /^ <target name="compile_something" depends="init">$/;" t
54
deploy input.xml /^ <target name="deploy" depends="compile_something, generate_h_from_java">$/;" t
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!xpath
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--language-force=ant
2+
--extra=+r
3+
--fields=+r
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MyProject input.xml /^<project name="MyProject" default="deploy" basedir=".">$/;" p
2+
another.ant input.xml /^ <import file="another.ant"\/>$/;" i project:MyProject role:imported
3+
clean input.xml /^ <target name="clean" depends="init">$/;" t project:MyProject
4+
compile_something input.xml /^ <target name="compile_something" depends="init">$/;" t project:MyProject
5+
deploy input.xml /^ <target name="deploy" depends="compile_something, generate_h_from_java">$/;" t project:MyProject
6+
generate_h_from_java input.xml /^ <target name="generate_h_from_java" depends="compile_something">$/;" t project:MyProject
7+
init input.xml /^ <target name="init">$/;" t project:MyProject
8+
javadoc input.xml /^ <target name="javadoc">$/;" t project:MyProject
9+
x input.xml /^ <property name="x" value="y" \/>$/;" P project:MyProject
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
xpath
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
3+
<project name="MyProject" default="deploy" basedir=".">
4+
<import file="another.ant"/>
5+
<property name="x" value="y" />
6+
<target name="init">
7+
<property environment="envvars" />
8+
<property name="rootDir" value="." />
9+
<property name="srcDir" value="${rootDir}/src" />
10+
11+
<path id="base.classpath">
12+
<pathelement location="${buildDir}" />
13+
</path>
14+
</target>
15+
16+
<target name="clean" depends="init">
17+
<delete dir="${buildDir}"
18+
verbose="false"
19+
quiet="false"
20+
/>
21+
</target>
22+
23+
<target name="compile_something" depends="init">
24+
<mkdir dir="${buildDir}" />
25+
<mkdir dir="${buildDir}/images" />
26+
<javac srcdir="${javaDir}"
27+
destdir="${buildDir}"
28+
debug="on"
29+
optimize="off"
30+
verbose="no"
31+
listfiles="yes"
32+
deprecation="no"
33+
classpathref="base.classpath"
34+
/>
35+
36+
<copy toDir="${buildDir}/images">
37+
<fileset dir="${javaImagesDir}" includes="*.*" />
38+
</copy>
39+
40+
</target>
41+
42+
<!--target name="generate_h_from_java" depends="compile_something">
43+
<exec executable="javah" dir="${buildDir}">
44+
</exec>
45+
</target-->
46+
47+
<target name="generate_h_from_java" depends="compile_something">
48+
<javah destdir="${ulgateDir}" classpath="${buildDir}">
49+
</javah>
50+
</target>
51+
52+
<target name="javadoc">
53+
<delete dir="${javaDocDir}"
54+
verbose="false"
55+
quiet="false"
56+
/>
57+
<mkdir dir="${javaDocDir}" />
58+
<javadoc destdir="${javaDocDir}"
59+
classpathref="base.classpath"
60+
link="http://java.sun.com/j2se/1.4.1/docs/api/"
61+
verbose="no"
62+
additionalparam="-breakiterator"
63+
>
64+
<fileset dir="${javaDir}" />
65+
</javadoc>
66+
</target>
67+
68+
<target name="deploy" depends="compile_something, generate_h_from_java">
69+
70+
<delete dir="${deployDir}"
71+
verbose="false"
72+
quiet="false"
73+
/>
74+
<mkdir dir="${deployDir}" />
75+
<mkdir dir="${deployDir}/client" />
76+
<mkdir dir="${deployDir}/server" />
77+
78+
<jar jarfile="${deployDir}/server/something.jar">
79+
<fileset dir="${buildDir}"
80+
includes="images/**"
81+
/>
82+
</jar>
83+
84+
<copy toDir="${deployDir}/client" verbose="Yes" >
85+
<fileset dir="${binDir}" includes="startClient.cmd" />
86+
<fileset dir="${binDir}" includes="killProcess.vbs" />
87+
</copy>
88+
89+
<copy toDir="${deployDir}/server/sql" verbose="Yes" >
90+
<fileset dir="${sqlDir}" includes="*.sql" />
91+
</copy>
92+
93+
<copy toDir="${deployDir}/server/samples">
94+
<fileset dir="${samplesDir}" includes="**/*.*" />
95+
</copy>
96+
97+
<copy toDir="${deployDir}/doc">
98+
<fileset dir="${docDir}" includes="**/*.*" />
99+
</copy>
100+
101+
</target>
102+
103+
</project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ClientAdded input.xml /^ <signal name="ClientAdded">$/;" s interface:org.gnome.SessionManager
2+
SessionName input.xml /^ <property name="SessionName" type="s" access="read">$/;" p interface:org.gnome.SessionManager
3+
Setenv input.xml /^ <method name="Setenv">$/;" m interface:org.gnome.SessionManager
4+
org.gnome.SessionManager input.xml /^ <interface name="org.gnome.SessionManager">$/;" i

Units/simple-dbusinspect.d/features

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
xpath

Units/simple-dbusinspect.d/input.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
3+
<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
4+
<interface name="org.gnome.SessionManager">
5+
6+
<!-- Initialization phase interfaces -->
7+
8+
<method name="Setenv">
9+
<arg name="variable" type="s" direction="in">
10+
<doc:doc>
11+
<doc:summary>The variable name</doc:summary>
12+
</doc:doc>
13+
</arg>
14+
<arg name="value" type="s" direction="in">
15+
<doc:doc>
16+
<doc:summary>The value</doc:summary>
17+
</doc:doc>
18+
</arg>
19+
<doc:doc>
20+
<doc:description>
21+
<doc:para>Adds the variable name to the application launch environment with the specified value. May only be used during the Session Manager initialization phase.</doc:para>
22+
</doc:description>
23+
</doc:doc>
24+
</method>
25+
26+
<!-- Signals -->
27+
28+
<signal name="ClientAdded">
29+
<arg name="id" type="o">
30+
<doc:doc>
31+
<doc:summary>The object path for the added client</doc:summary>
32+
</doc:doc>
33+
</arg>
34+
<doc:doc>
35+
<doc:description>
36+
<doc:para>Emitted when a client has been added to the session manager.
37+
</doc:para>
38+
</doc:description>
39+
</doc:doc>
40+
</signal>
41+
42+
<!-- Properties -->
43+
44+
<property name="SessionName" type="s" access="read">
45+
<doc:doc>
46+
<doc:description>
47+
<doc:para>The name of the session that has been loaded.</doc:para>
48+
</doc:description>
49+
</doc:doc>
50+
</property>
51+
52+
53+
</interface>
54+
</node>

Units/simple-glade.d/args.ctags

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--extra=+rf
2+
--fields=+rKn
3+
--regex-Glade=/.*SYSTEM "([^"]*)">/\1/D,DOCTYPE/
4+
--sort=no
5+
--excmd=mixed

Units/simple-glade.d/expected.tags

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
http://glade.gnome.org/glade-2.0.dtd input.glade /^<!DOCTYPE glade-interface SYSTEM "http:\/\/glade.gnome.org\/glade-2.0.dtd">$/;" DOCTYPE line:2
2+
window1 input.glade /^<widget class="GtkWindow" id="window1">$/;" id line:6
3+
button1 input.glade /^ <widget class="GtkButton" id="button1">$/;" id line:23
4+
GtkWindow input.glade /^<widget class="GtkWindow" id="window1">$/;" class line:6 role:widget
5+
GtkButton input.glade /^ <widget class="GtkButton" id="button1">$/;" class line:23 role:widget
6+
on_button1_clicked input.glade /^ <signal name="clicked" handler="on_button1_clicked" last_modification_time="Sat, 26 Dec 20/;" handler line:30 role:handler
7+
input.glade input.glade 1;" file line:1

Units/simple-glade.d/features

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
xpath

Units/simple-glade.d/input.glade

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
2+
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
3+
4+
<glade-interface>
5+
6+
<widget class="GtkWindow" id="window1">
7+
<property name="visible">True</property>
8+
<property name="title" translatable="yes">window1</property>
9+
<property name="type">GTK_WINDOW_TOPLEVEL</property>
10+
<property name="window_position">GTK_WIN_POS_NONE</property>
11+
<property name="modal">False</property>
12+
<property name="resizable">True</property>
13+
<property name="destroy_with_parent">False</property>
14+
<property name="decorated">True</property>
15+
<property name="skip_taskbar_hint">False</property>
16+
<property name="skip_pager_hint">False</property>
17+
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
18+
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
19+
<property name="focus_on_map">True</property>
20+
<property name="urgency_hint">False</property>
21+
22+
<child>
23+
<widget class="GtkButton" id="button1">
24+
<property name="visible">True</property>
25+
<property name="can_focus">True</property>
26+
<property name="label" translatable="yes">button1</property>
27+
<property name="use_underline">True</property>
28+
<property name="relief">GTK_RELIEF_NORMAL</property>
29+
<property name="focus_on_click">True</property>
30+
<signal name="clicked" handler="on_button1_clicked" last_modification_time="Sat, 26 Dec 2015 09:22:46 GMT"/>
31+
</widget>
32+
</child>
33+
</widget>
34+
35+
</glade-interface>

configure.ac

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,15 @@ AC_CHECK_FUNCS(scandir)
584584
AC_CHECK_FUNCS(fork waitpid execv pipe,[enable_xcmd=yes],[enable_xcmd=no])
585585
AM_CONDITIONAL([ENABLE_XCMD], [test "xyes" = "x$enable_xcmd"])
586586

587+
AH_TEMPLATE([HAVE_LIBXML],
588+
[Define this value if libxml is available.])
589+
PKG_CHECK_MODULES(LIBXML, libxml-2.0,
590+
[have_libxml=yes
591+
AC_DEFINE(HAVE_LIBXML)],
592+
[have_libxml=no])
593+
AM_CONDITIONAL(HAVE_LIBXML, test "x$have_libxml" = xyes)
594+
595+
587596
# Checks for missing prototypes
588597
# -----------------------------
589598
AC_MSG_NOTICE(checking for new missing prototypes)

docs/news.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ The following parsers have been added:
2424
* Clojure
2525
* CSS
2626
* D
27+
* DBusIntrospect *libxml*
2728
* Diff
2829
* DTS
2930
* Falcon
31+
* Glade *libxml*
3032
* Go
3133
* JSON
3234
* ObjectiveC
@@ -43,6 +45,7 @@ The following parsers have been added:
4345

4446
See "Option library" about *optlib*.
4547
See "External parser command" about *xcmd*.
48+
Libxml2 is needed to use the parser(s) marked with *libxml*.
4649

4750
TIPS: you can list newly introduced parsers if you have
4851
exuberant-ctags with following command line:
@@ -54,6 +57,7 @@ exuberant-ctags with following command line:
5457
5558
Heavily improved language parsers
5659
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60+
* ant *libxml*
5761
* php
5862
* verilog
5963

docs/units.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ have its own directory under Units directory.
9191
enumerate them in this file line by line. If a target ctags
9292
doesn't have one of the features, the test is skipped.
9393

94+
If a file line is started with ``!``, the effect is inverted;
95+
if a target ctags has the feature specified with ``!``, the
96+
test is skipped.
97+
9498
All features built-in can be listed with passing
9599
``--list-features`` to ctags.
96100

0 commit comments

Comments
 (0)