universal-ctags / ctags

A maintained ctags implementation
https://ctags.io
GNU General Public License v2.0
6.53k stars 622 forks source link

Can it support AutoHotKey? #2682

Open iesv opened 3 years ago

iesv commented 3 years ago

Can it support AutoHotKey?

masatake commented 3 years ago

Yes if someone writes a parser for it. If you are interested in writing a parser, I can help you. If you are not, you can queue the request for writing a parser to #1566. The queue is so long. Therefore it is a kind of /dev/null.

masatake commented 3 years ago

If you are interested in writing a parser, reopen this.

iesv commented 3 years ago

How I wish I can do it! but I can't. My level is too low.

Masatake YAMATO notifications@github.com 于 2020年10月30日周五 03:47写道:

Reopened #2682 https://github.com/universal-ctags/ctags/issues/2682.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/universal-ctags/ctags/issues/2682#event-3938102124, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBO4IRORI3YJJHYXRC7VELSNHBEVANCNFSM4TCAEMMA .

pidgeon777 commented 3 years ago

I would also be interested in an AutoHotkey parser. It is a language widely used to manipulate each aspect of Windows OS.

masatake commented 3 years ago

I would also be interested in an AutoHotkey parser. It is a language widely used to manipulate each aspect of Windows OS.

So what?

What people (including I myself) would like to hear from you is "I will (try to)? implement a parser for the language. Tell me how to do it?"

In #2678, @pidgeon777, you quoted the code, VhdlKinds. It implies you know C. In the issue, you helped me with the design of VHDL parser. It implies you know the most important concept of ctags, "kind". The description of issue was clear enough. You cannot say "My level is too low."

You may have good knowledges of hardware. Therefore you may know the word "speculative execution". I write hear how to write the parser.

diff --git a/main/parsers_p.h b/main/parsers_p.h
index b463c238..57968c38 100644
--- a/main/parsers_p.h
+++ b/main/parsers_p.h
@@ -49,6 +49,7 @@
    AsmParser, \
    AspParser, \
    AutoconfParser, \
+   AutoHotKeyParser, \
    AutoItParser, \
    AutomakeParser, \
    AwkParser, \
diff --git a/makefiles/optlib2c_input.mak b/makefiles/optlib2c_input.mak
index 49275272..62073be3 100644
--- a/makefiles/optlib2c_input.mak
+++ b/makefiles/optlib2c_input.mak
@@ -1,6 +1,7 @@
 # -*- makefile -*-
 OPTLIB2C_INPUT = \
    optlib/RSpec.ctags          \
+   optlib/autohotkey.ctags         \
    optlib/cmake.ctags          \
    optlib/ctags-optlib.ctags       \
    optlib/elixir.ctags         \
diff --git a/optlib/autohotkey.ctags b/optlib/autohotkey.ctags
new file mode 100644
index 00000000..e3309db6
--- /dev/null
+++ b/optlib/autohotkey.ctags
@@ -0,0 +1,50 @@
+#
+# autohotkey.ctags --- multiline regex parser for AutoHotKey
+#
+# This software is derrived from ahktags (https://github.com/Perlence/ahktags).
+#
+# Copyright 2015 Sviatoslav Abakumov
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#
+#     Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#
+#     Neither the name of the copyright holder nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# The language references are available at
+# https://www.autohotkey.com/docs/Language.htm
+#
+--langdef=AutoHotKey
+--map-AutoHotKey=+.ahk
+
+--kinddef-AutoHotKey=v,variable,variables
+--kinddef-AutoHotKey=l,label,labels
+--kinddef-AutoHotKey=f,function,functions
+--kinddef-AutoHotKey=h,hklabel,hot key lables
+
+--mline-regex-AutoHotKey=/^[ \t]*([a-zA-Z0-9_]+)[ \t\n\r\f\v]*:?=[ \t\n\r\f\v]*(;?.*)?$/\1/v/
+--mline-regex-AutoHotKey=/^[ \t]*([a-zA-Z0-9_]+):[ \t\n\r\f\v]*(;.*)?$/\1/l/
+--mline-regex-AutoHotKey=/^[ \t]*([^ \t\n\r\f\v:]+)::[ \t]*$/\1/h/
+--mline-regex-AutoHotKey=/^[ \t]*([a-zA-Z0-9_]+)\(.*\)[ \t\n\r\f\v]*\{[ \t\n\r\f\v]*(;?.*)$/\1/f/

If you want to capture "class", this code is not enough. But you can start from this code. If you are interested in finishing this work, let me know. I will tell more about tihs parser.

During I'm working on VHDL, you can work on AutoHotKey. How do you call this? pipeline? hyper threading?

pidgeon777 commented 3 years ago

So what? What people (including I myself) would like to hear from you is "I will (try to)? implement a parser for the language. Tell me how to do it?"

Well, sometimes when a user suggests a new feature to be implemented for improving a project, and this is the case of @iesvme , it is important to know if this kind of feature might be of general interest. By doing so, the developer of the project or those willing to contribute with their pulls may decide to prioritize one task or the other. This usually happens with medium to big-sized projects.

Thus, I just expressed my interest in this kind of parser, no more. This happens on almost every Github project, for what I've seen.

However, given that you cited me and the HDL case, I'll reaffirm my will to actively help with the HDL parser development through:

This is what my current knowledge allows me to do. Better than nothing, hopefully.

However I'm also willing to give a try to this AHK parser one day, but unfortunately it won't happen anytime soon, thus hopefully someone will help with this, in the meanwhile.