-
Notifications
You must be signed in to change notification settings - Fork 632
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
Add dual-pass capability #80
Comments
You enter just another interesting area. Do you mean running ctags twice or more for file sets? If the target is single input file, ctags has facilities to run multi-pass parsing. |
I was thinking more of implementing this functionality in the core, because it would be something commonly used by all supporting parsers. Nevertheless, let me take a look at what the objc parser is doing. |
Again, do you think running ctags twice on the same input file? |
The idea is to run ctags twice in a set of files. |
So in the 2nd pass, cross reference generated in the 1st stage can be used. It looks big challenge for me. The biggest question is how the cross-reference data generated by the 1st Something like this?
|
Being honest, up until now I've been basically focused on the Verilog parser, so I really do not have any ideas on how to implement this. As such, I was looking for some feedback from the community here :) I was looking more for something like:
The argument is a bit too big, but is just for demonstration purposes. Internally I was thinking about having the parser register a list of kinds that can be used to declare variables. In most languages it should be something like "class", "typedef", etc. After the first parse, ctags replaces its keyword hash table with the class-like tags and runs a new parse using the new table. From a parser point of view, it would only be necessary to add a new list of kinds in the parserDefinition, such that any parser that does not have that definition would not support the 2nd pass and exit cleanly. This way each parser maintainer could gradually implement the support of this feature for any corner-case situations and add relevant test cases. Update: the parser would need to define to which kind the tag would be used. For example, it could be something like:
or even merge everything in the "variable" kind like:
|
I would like to use wiki to research this area with you. |
Don't worry. I'm using my free time to improve the Verilog parser in order to later include SystemVerilog support. I'm also working on an omni completion script in vim. |
I compiled all docuemnts I wrote into hacking guide. I will write internal of ctags next. |
... I would like to hear your idea more with an example. input:
In the first pass Foo is captured as a tag of class kind.
In the second pass bar is captured as a tag of ...what?
I'm sorry but I need an example. input and expected tags pairs are very helpful for me. If we introduced reference field tags file for the input will be...
Multiple pass for multiple files are so powerfull like linker of C language. |
Let try to pass along my ideas.
So, referring to your example, I would expect something like:
Where "type" would be a special extended attribute. Don't know if we can reuse any existing attribute for that purpose. Typically classes are defined in different files, so I'm not sure this is really useful in a single file. But we should definitely support that possibility, because many (most?) languages do not enforce the requirement of having a single class defined per file. |
I think we can introduce "reference tag" and multiple-input-file multi-path (mm) parser separately. We don't have enough knowledge about how to capturing reference tags. However, we can start from extending tags format: introducing |
typeref field is already avaiable. mm parser can used as facility for improving the quality of typeref fields in languages. |
Replying to #1488 (comment) : This is what would be the ideal implementation, IMHO:
|
I found a good way to implement an infrustructure for multiple-input-file multi-path (mm) parser WITHOUT intermediate file. Newly designed barrel API inspired from cork API is a part of mm API. Surprisingly it is not difficult to implement.
I see. I would like you to make tags for the container types found by the parser with marking "putting it to barrel" in the pass0. In the pass1, you can access tags in the barrel. The barrel of tags are shared parsers. However, about SystemVerilog, only tags of container types(class kind for example) are in the barrel. Therefore you can This will be quite powerfull API...There will be many applications. But I myself will just provide API till 6.0. I will not make you wait long time. |
Ignore /sample/scan.
Looking at some omni-completion functions in vim I understood that in order to identify the class of a certain object those functions need to parse the file until the object declaration is found. Since ctags already does this type of work, why not implement this parsing in it?
This is how I see it:
There are more details that need to be looked into, but by using something similar to this we should end up with a complete tag list of the files including object declarations.
This should be specially useful when we have a libctags!
[1] Verilog, for example, has multiple tag types that can be used similarly to object declarations.
The text was updated successfully, but these errors were encountered: