bug-global
[Top][All Lists]
Advanced

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

Re: patch of parser for other languages


From: Shigio YAMAGUCHI
Subject: Re: patch of parser for other languages
Date: Wed, 1 Apr 2015 15:30:25 +0900

Hi,
Thank you for the parsers.

By the way, could you please make a plug-in parser of them for gtags(1)?
Though I would like to include your code into GLOBAL, it is hard for me
to support new languages. I would like to include it as
'a library by third party'. Since users should accept it as is, you need
not support it too.

Anyway, they are very useful enough. Thank you!

Regards,
Shigio


2015-03-30 17:55 GMT+09:00 KAICHO <address@hidden>:
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




--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3

reply via email to

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