Hi,
I started working on decoupling the code parser from my old project, well it seems like alot of work
..
So, What I have come out so far is:
I created a small app that does the following:
- Create an empty db with all indexes defined
- Parse sample input files (in batch mode) and populate the db
In the main frame there is a function that called: InitDb()
this is the function the one that should intrest you (all the other files, can be ignored for the moment they are used internally or I will use them later when I will update the demo)
In this file what I do is:
- Open the sample input files and loads their data
- Create language parser (e.g. CPP) - this can easily be extended to other languages as well
- Create the ctags interface
- Execute
- Store the results into SQLite
The db class is called
- USDb
The DB is consistent with 4 tables:
- member_table
- function_table
- class_table
- prototype_table (this is special case of prototype function)
to prevent duplicates, there are indexes on the tables - so duplicate entries are not allowed (but of course, same name different prototype is allowed ...)
This example shows how you can use ctags to create a db with all workspace information saved.
Things it
can do but I did not had time to present how to do them (but i will):
- It does not show how to get
localmember type (qualifier).
- It does not show how to get the current function class name from cursor location (like the two combo boxes in VC71 located on top of the file)
- It does not suggest members/functions list
- It does not show how to parse local scope (ctags cant parse local variables, this is where my internal parser come to help - lex.yy.cpp & USCPPScanner )
Hopefully tomorrow or during the weekend (the weekend starts here tomorrow
I will update the sample with more functionality so you will get the impression of the idea.
To run the sample, place the exe "ctags.exe" udner a valid path - it can be found under "SQLite_db/bin/ctags.exe"In addition, in order to view the results, I am also providing SQLite browser which I found on SF. it is called "SQLite Database Browser" and can be found under "SQLite_db/bin/" or you can use the simple command line "sqlite.exe"
The database name is "./internals/ctags.db" simply open it with the browser and have a look at the results of the parsing.
The parsing input files (it is actually the Tinyxml code) can be found under "Samples/"
The project can be found here:
http://www.eistware.com/wx/ctags/ctags.zipLet me know if you had problems or questions,
Eran