-
Notifications
You must be signed in to change notification settings - Fork 626
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
Vim: support Vim9 script #3913
Comments
If a .ctags file for Vim9 and some test cases are shown, I can help the author of .ctags integrate them into our source tree. We must know the relation between the .ctags file and our parsers/vim.c. Generally, people think .ctags is just a configuration file. So, they don't put the copyright and license notices on the file. But we need the notices for integration. |
I have read some .vim files in the vim source tree that use vim9script. |
class and export keywords are used. import keyword is used. |
Hello ! I am trying to write _mtable expressions to add better support for classes, enums, interfaces, and to distinguish member variables and methods from local variables and nested (function-local) functions ... I can populate the "access:" and "file:" fields, to describe tags that are private, protected, public or file-scoped. Also I can populate local variables and nested functions (if enabled), much like the I have attached my regexp expressions ( But ctags tells me the parser can no longer progress past the last newline in the input file. despite the regexp are still matching:
Is there something wrong with my regexps ? Or is this an issue in ctags with the regexps parser ? Also my new function tags (generated with my regexps) now duplicate the functions already generated by the built-in parser. Looking at the source code I see the Vim built-in parser is written in C, so it is not a *.ctags file that I could paste into my own regexp list. Can you add some long flag to the regexp to merge the new tag with the same tag generated by the built-in parser ? Or maybe a flag to completely shadow (remove) the built-in tags when the Somehow my regexp bellow at line 6, for nested global function: So how do I prevent
Resulting tag is:
Latest ctags version I have from my distribution is 6.0.0:
|
The test input is quite helpful in driving me to improve the parser. I'll look into this. Please wait for a while. |
Updated version here if someone is still looking : https://gist.github.com/terminatorul/b563855cd6af9a1ed41f36743fe0e9d2 Can now parse both Vim9 script and legacy functions and variables. Still depends on the built-in parser to extract mappings and autocommands, but the other kinds from the built-in parser are disabled (functions, variables, constants).
Note that here-documents are just string literals, and I am not sure they should have been extracted by the built-in parser in the first place. Is there a way to distribute parser files to other people, like uploading them on a repository, that I could also search ? Here is also a Vim syntax file for writing ctags mtable parsers (highlighting for default regular expressions (POSIX ERE) only): |
I assumed all useful .ctags should be part of Universal Ctags. So I have not though much about the way for distributing .ctags separately. I wonder what I should do. I would like to implement all you need by extending existing vim.c. Do you think vim.c should support all you implemented in vim9.ctags? If no, you may want to have a way to turn off the built-in parser implemented in vim.c. So your vim9.ctags can run without affected by the built-in parser.
I have no plan to prepare a official repository. BTW, I recommend you to put Copyright notice at the beginning of vim9.ctags. |
Sorry I do not have test files, and I want to get back to focusing on my Vim plugin instead. I tested manually using the scripts attached previously, plus my local vim config script. And using Tagbar plugin in Vim, to run ctags and show results. I wish I knew about the Units test facility sooner. Which is kind of a point. Most people writing a parser, get there because they are trying to solve something else using their language. They are not on their main task, so to speak. And then the regexps are difficult for parsing a language, often not enough. Optscript sounds great (I didn't use it) but PostScript is foreign to almost all developers, and not easy to jump into. It looks to me users need support for writing a full recursive-descent parser, or a grammar, but as an extension script to ctags. Some script languages like Rakudo (perl 6) have built-in support for writing grammars. and I think external parser generators should be available for some other languages. Any chance ctags would embed a language for something like this ? Or could you add a more involved example in the manual, for adding a language using existing optscript ? But not relying so much on the regexps, more then extracting lines for example, or lexing tokens like strings and operators. I think my regex parser in vim9.ctags should be implemented in vim.c if possible, but some issues need to be called out:
|
It would be nice if u-ctags supports Vim9 scripts by default.
This comment might be helpful:
https://groups.google.com/g/vim_use/c/hp4KeIsDlFU/m/TCGoX5KFAwAJ
(Added by @masatake for tracking TODO items)
#3930
#
comment line#3951
The text was updated successfully, but these errors were encountered: