|
From: | Shigio YAMAGUCHI |
Subject: | Re: patch of parser for other languages |
Date: | Wed, 1 Apr 2015 15:30:25 +0900 |
Hi,
This is not a bug report but just a patch suggestion.
I've tested a patch which adding a support of several languages
to GNU GLOBAL:
- add perl/ruby/sh/python parser onto gtags/htags
- add HEREDOC parser for here document
- fix return code handling for the case "\r"
# (THIS WOULD BE WORSE FOR OLDER MAC)
To patch the code, run followings:
# tar -xzf global-6.4.tar.gz
# cd global-6.4
# gzip -dc global-add-perl_sh_python_ruby.patch.gz | patch -p1 -s
re-generate new resources and parsers by the script below:
for lang in c cpp asm php java ruby python sh perl; do
if [ -f libparser/${lang}_res.in ]; then
name=${lang}_res
perl libparser/reserved.pl --prefix=$lang libparser/${name}.in > libparser/${name}.gpf
option=`perl libparser/reserved.pl --prefix=$lang --option`
gperf $option < libparser/${name}.gpf > libparser/${name}.h
fi
if [ -f htags/$lang.l ]; then
flex -ohtags/$lang.c htags/$lang.l
fi
done
And add rules for the parsers onto gtags.conf:
:langmap=python\:.py.pyx.pxd.pxi.scons:\
:langmap=ruby\:.rb:\
:langmap=perl\:.pl:\
:langmap=sh\:.sh.SH.bsh.bash.ksh.zsh
Actually this is not a complete parser, but much faster than
python-pygments. hope this could help your code-reading life:)
Thanks,
Shin'ya
_______________________________________________
Bug-global mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-global
[Prev in Thread] | Current Thread | [Next in Thread] |