The ctags parser


The main code completion parser of codelite is based on a modified ctags code (aka, codelite_indexer) in addition to a small and fast YACC parser which is responsible for the expression parsing and the scope resolving.

In general, codelite uses the codelite_indexer to create a lookup table which is used by the various features in codelite (like the 'Goto implementation', 'Goto Declaration' etc)

The lookup table is used by the context parser (YACC based) to resolve expressions, like:

 ManagerST::Get()->GetActiveEditor()->

In the above example, the YACC parser will break the expression into three tokens:

 ManagerST
 Get
 GetActiveEditor

Each will be search in the lookup table and will be expanded, ManagerST is expanded into:

 typedef Singleton<Manager> ManagerST;

Once the first token is resolved, it will go on to the next token 'Get' and will search for it in the lookup table, but this time
under the 'Singleton' context. In the above example, Get() is resolved into:

 T* Get()

However, the YACC parser knows that T was instantiated with 'Manager' so a simple replace is performed and the expression is changed into:

 Manager* Get()

and so on

The advantage of using the 'ctags' parser (which is the default) are:

  • Fast completion
  • Comments parsing (the comments are displayed along side the completion entry)
  • Does not require a full 'compilation' line to provide completion
  • Reliable and mature
Edit - History - Print - Recent Changes - Search
Page last modified on June 24, 2011, at 07:25 AM