Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xpath metaparser based on libxml2 #740

Merged
merged 13 commits into from
Jan 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ MAIN_SRCS += $(REGEX_SRCS)
MAIN_HEADS += $(REGEX_HEADS)
endif

if HAVE_LIBXML
PARSER_SRCS += $(XML_SRCS)
PARSER_HEADS += $(XML_HEADS)
endif

ctags_CPPFLAGS = -I. -I$(srcdir) -I$(srcdir)/main
if ENABLE_DEBUGGING
ctags_CPPFLAGS+= $(DEBUG_CPPFLAGS)
Expand All @@ -34,6 +39,10 @@ ctags_CFLAGS += $(EXTRA_CFLAGS)
ctags_CFLAGS += $(WARNING_CFLAGS)
ctags_CFLAGS += $(COVERAGE_CFLAGS)
ctags_CFLAGS += $(CGCC_CFLAGS)
ctags_CFLAGS += $(LIBXML_CFLAGS)

ctags_LDADD =
ctags_LDADD += $(LIBXML_LIBS)

nodist_ctags_SOURCES = $(REPOINFO_HEADS)
BUILT_SOURCES = $(REPOINFO_HEADS)
Expand Down
11 changes: 8 additions & 3 deletions Tmain/list-roles.d/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@ title()
echo '#'
}

ignore_xml()
{
grep -v 'Glade\|Ant'
}

title ''
${CTAGS} --quiet --options=NONE --_list-roles=
${CTAGS} --quiet --options=NONE --_list-roles= | ignore_xml

title 'all:*'
${CTAGS} --quiet --options=NONE --_list-roles='all:*'
${CTAGS} --quiet --options=NONE --_list-roles='all:*' | ignore_xml

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

title 'all:h'
${CTAGS} --quiet --options=NONE --_list-roles='all:h'
${CTAGS} --quiet --options=NONE --_list-roles='all:h' | ignore_xml

title 'Sh:s'
${CTAGS} --quiet --options=NONE --_list-roles='Sh:s'
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
MyProject input.xml /^<project name="MyProject" default="deploy" basedir=".">$/;" p
another.ant input.xml /^ <import file="another.ant"\/>$/;" i
clean input.xml /^ <target name="clean" depends="init">$/;" t
compile_something input.xml /^ <target name="compile_something" depends="init">$/;" t
deploy input.xml /^ <target name="deploy" depends="compile_something, generate_h_from_java">$/;" t
Expand Down
1 change: 1 addition & 0 deletions Units/parser-ant.r/regex-based.d/features
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!xpath
3 changes: 3 additions & 0 deletions Units/parser-ant.r/xpath-based.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--language-force=ant
--extra=+r
--fields=+r
9 changes: 9 additions & 0 deletions Units/parser-ant.r/xpath-based.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MyProject input.xml /^<project name="MyProject" default="deploy" basedir=".">$/;" p
another.ant input.xml /^ <import file="another.ant"\/>$/;" i project:MyProject role:imported
clean input.xml /^ <target name="clean" depends="init">$/;" t project:MyProject
compile_something input.xml /^ <target name="compile_something" depends="init">$/;" t project:MyProject
deploy input.xml /^ <target name="deploy" depends="compile_something, generate_h_from_java">$/;" t project:MyProject
generate_h_from_java input.xml /^ <target name="generate_h_from_java" depends="compile_something">$/;" t project:MyProject
init input.xml /^ <target name="init">$/;" t project:MyProject
javadoc input.xml /^ <target name="javadoc">$/;" t project:MyProject
x input.xml /^ <property name="x" value="y" \/>$/;" P project:MyProject
1 change: 1 addition & 0 deletions Units/parser-ant.r/xpath-based.d/features
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xpath
103 changes: 103 additions & 0 deletions Units/parser-ant.r/xpath-based.d/input.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8" ?>

<project name="MyProject" default="deploy" basedir=".">
<import file="another.ant"/>
<property name="x" value="y" />
<target name="init">
<property environment="envvars" />
<property name="rootDir" value="." />
<property name="srcDir" value="${rootDir}/src" />

<path id="base.classpath">
<pathelement location="${buildDir}" />
</path>
</target>

<target name="clean" depends="init">
<delete dir="${buildDir}"
verbose="false"
quiet="false"
/>
</target>

<target name="compile_something" depends="init">
<mkdir dir="${buildDir}" />
<mkdir dir="${buildDir}/images" />
<javac srcdir="${javaDir}"
destdir="${buildDir}"
debug="on"
optimize="off"
verbose="no"
listfiles="yes"
deprecation="no"
classpathref="base.classpath"
/>

<copy toDir="${buildDir}/images">
<fileset dir="${javaImagesDir}" includes="*.*" />
</copy>

</target>

<!--target name="generate_h_from_java" depends="compile_something">
<exec executable="javah" dir="${buildDir}">
</exec>
</target-->

<target name="generate_h_from_java" depends="compile_something">
<javah destdir="${ulgateDir}" classpath="${buildDir}">
</javah>
</target>

<target name="javadoc">
<delete dir="${javaDocDir}"
verbose="false"
quiet="false"
/>
<mkdir dir="${javaDocDir}" />
<javadoc destdir="${javaDocDir}"
classpathref="base.classpath"
link="http://java.sun.com/j2se/1.4.1/docs/api/"
verbose="no"
additionalparam="-breakiterator"
>
<fileset dir="${javaDir}" />
</javadoc>
</target>

<target name="deploy" depends="compile_something, generate_h_from_java">

<delete dir="${deployDir}"
verbose="false"
quiet="false"
/>
<mkdir dir="${deployDir}" />
<mkdir dir="${deployDir}/client" />
<mkdir dir="${deployDir}/server" />

<jar jarfile="${deployDir}/server/something.jar">
<fileset dir="${buildDir}"
includes="images/**"
/>
</jar>

<copy toDir="${deployDir}/client" verbose="Yes" >
<fileset dir="${binDir}" includes="startClient.cmd" />
<fileset dir="${binDir}" includes="killProcess.vbs" />
</copy>

<copy toDir="${deployDir}/server/sql" verbose="Yes" >
<fileset dir="${sqlDir}" includes="*.sql" />
</copy>

<copy toDir="${deployDir}/server/samples">
<fileset dir="${samplesDir}" includes="**/*.*" />
</copy>

<copy toDir="${deployDir}/doc">
<fileset dir="${docDir}" includes="**/*.*" />
</copy>

</target>

</project>
4 changes: 4 additions & 0 deletions Units/simple-dbusinspect.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ClientAdded input.xml /^ <signal name="ClientAdded">$/;" s interface:org.gnome.SessionManager
SessionName input.xml /^ <property name="SessionName" type="s" access="read">$/;" p interface:org.gnome.SessionManager
Setenv input.xml /^ <method name="Setenv">$/;" m interface:org.gnome.SessionManager
org.gnome.SessionManager input.xml /^ <interface name="org.gnome.SessionManager">$/;" i
1 change: 1 addition & 0 deletions Units/simple-dbusinspect.d/features
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xpath
54 changes: 54 additions & 0 deletions Units/simple-dbusinspect.d/input.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
<interface name="org.gnome.SessionManager">

<!-- Initialization phase interfaces -->

<method name="Setenv">
<arg name="variable" type="s" direction="in">
<doc:doc>
<doc:summary>The variable name</doc:summary>
</doc:doc>
</arg>
<arg name="value" type="s" direction="in">
<doc:doc>
<doc:summary>The value</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<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>
</doc:description>
</doc:doc>
</method>

<!-- Signals -->

<signal name="ClientAdded">
<arg name="id" type="o">
<doc:doc>
<doc:summary>The object path for the added client</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>Emitted when a client has been added to the session manager.
</doc:para>
</doc:description>
</doc:doc>
</signal>

<!-- Properties -->

<property name="SessionName" type="s" access="read">
<doc:doc>
<doc:description>
<doc:para>The name of the session that has been loaded.</doc:para>
</doc:description>
</doc:doc>
</property>


</interface>
</node>
5 changes: 5 additions & 0 deletions Units/simple-glade.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--extra=+rf
--fields=+rKn
--regex-Glade=/.*SYSTEM "([^"]*)">/\1/D,DOCTYPE/
--sort=no
--excmd=mixed
7 changes: 7 additions & 0 deletions Units/simple-glade.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
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
window1 input.glade /^<widget class="GtkWindow" id="window1">$/;" id line:6
button1 input.glade /^ <widget class="GtkButton" id="button1">$/;" id line:23
GtkWindow input.glade /^<widget class="GtkWindow" id="window1">$/;" class line:6 role:widget
GtkButton input.glade /^ <widget class="GtkButton" id="button1">$/;" class line:23 role:widget
on_button1_clicked input.glade /^ <signal name="clicked" handler="on_button1_clicked" last_modification_time="Sat, 26 Dec 20/;" handler line:30 role:handler
input.glade input.glade 1;" file line:1
1 change: 1 addition & 0 deletions Units/simple-glade.d/features
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xpath
35 changes: 35 additions & 0 deletions Units/simple-glade.d/input.glade
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">

<glade-interface>

<widget class="GtkWindow" id="window1">
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>

<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">button1</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_button1_clicked" last_modification_time="Sat, 26 Dec 2015 09:22:46 GMT"/>
</widget>
</child>
</widget>

</glade-interface>
9 changes: 9 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,15 @@ AC_CHECK_FUNCS(scandir)
AC_CHECK_FUNCS(fork waitpid execv pipe,[enable_xcmd=yes],[enable_xcmd=no])
AM_CONDITIONAL([ENABLE_XCMD], [test "xyes" = "x$enable_xcmd"])

AH_TEMPLATE([HAVE_LIBXML],
[Define this value if libxml is available.])
PKG_CHECK_MODULES(LIBXML, libxml-2.0,
[have_libxml=yes
AC_DEFINE(HAVE_LIBXML)],
[have_libxml=no])
AM_CONDITIONAL(HAVE_LIBXML, test "x$have_libxml" = xyes)


# Checks for missing prototypes
# -----------------------------
AC_MSG_NOTICE(checking for new missing prototypes)
Expand Down
4 changes: 4 additions & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ The following parsers have been added:
* Clojure
* CSS
* D
* DBusIntrospect *libxml*
* Diff
* DTS
* Falcon
* Glade *libxml*
* Go
* JSON
* ObjectiveC
Expand All @@ -43,6 +45,7 @@ The following parsers have been added:

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

TIPS: you can list newly introduced parsers if you have
exuberant-ctags with following command line:
Expand All @@ -54,6 +57,7 @@ exuberant-ctags with following command line:

Heavily improved language parsers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ant *libxml*
* php
* verilog

Expand Down
4 changes: 4 additions & 0 deletions docs/units.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ have its own directory under Units directory.
enumerate them in this file line by line. If a target ctags
doesn't have one of the features, the test is skipped.

If a file line is started with ``!``, the effect is inverted;
if a target ctags has the feature specified with ``!``, the
test is skipped.

All features built-in can be listed with passing
``--list-features`` to ctags.

Expand Down
Loading