-
Notifications
You must be signed in to change notification settings - Fork 641
Improved Elixir optlib parser #2024
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
Conversation
Imported from https://github.com/mmorearty/elixir-ctags. Close #1758. See also mmorearty/elixir-ctags#5. The change from the original .ctags. * Put the original LICENSE file as the header of the .ctags. * Use --map= option instead of --langmap because optlib2c doesn't handle --langmap option. * Define kinds explicitly with --kinddef-<LANG> option. * Remove backslashes before double quotes chars in the regex pattern for "test". * Use singular forms for kind names. TODO: Test cases for above kinds are needed. c callbacks (defcallback ...) d delegates (defdelegate ...) e exceptions (defexception ...) i implementations (defimpl ...) a macros (defmacro ...) o operators (e.g. "defmacro a <<< b") p protocols (defprotocol...) r records (defrecord...) Signed-off-by: Masatake YAMATO <[email protected]>
I already made a pull request with *detailed commits* to the upstream of the elixir.ctags parser. Said pull request and commits can be found in mmorearty/elixir-ctags#8 This parser is missing basically two things which are annotated in the input.ex test with a TODO keyword, plus an explanation of _why_ they're missing. Said missing features are listed bellow: * exceptions: I don't know how to identificate or differenciate exceptions from one another because they do not have a name. Instead, they resemble an struct. For example, if I have: ``` defmodule MyAppError1 do defexception [:message] # code end defmodule MyAppError2 do defexception [:message] # code end ``` How would/should ctags differenciate between these two exceptions? * word-defined logical operators (`and, or, not`): The elixir parser in this commit already has the regex atom including these logical operators, but since the regex engine used by universal-ctags does not have lookahead, I couldn't think of a way to add them or negate them. The test for them is commented in, for the time someone is brave enough to add them.
optlib/ctags-optlib.ctags \ | ||
optlib/elm.ctags \ | ||
optlib/elixir.ctags \ | ||
optlib/elm.ctags \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not touch elm.ctags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(trying out Github's suggestions feature, sorry if it's messy)
optlib/elm.ctags \ | |
optlib/elixir.ctags \ | |
optlib/elm.ctags \ |
You can run the test with "make units LANGUAGES=Elixir" locally. |
Could you consider a ".b" test case for the TODO items? Some valuable studies about changing the regex engine used in u-ctags are in #1861. |
More info on the bugs can be found in the test cases' `README.md`.
Moved that comment to the README.md of a bugged test case in the Elixir directory.
Fixes the bug where the parser wouldn't correctly generate tags for the 'word' operators (and, or, not, etc...)
I renamed the |
* Diff | ||
* DTD | ||
* DTS | ||
* Elixir *optlib* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent.
Thank you. I will take over this. I will merge this after squashing some commits to keep change history simple. I'm in busy now. So, it will take few days. |
…take Elixir: rearranged-before-merge PR for #2024
Merged after rearranging the commits posted this PR. See #2034. |
Thanks a lot for the support and improving the parser! Much appreciated! |
elixir-optlib
and rebased it to a most recent master.optlib2c
for a better looking C code.elixir.ctags
(sent a pull request to the upstream but made the same improvements here, in fewer commits for conciseness)