bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch of parser for other languages


From: KAICHO
Subject: patch of parser for other languages
Date: Mon, 30 Mar 2015 17:55:41 +0900 (JST)

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

Attachment: global-add-perl_sh_python_ruby.patch.gz
Description: GNU Zip compressed data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]