Re: [anjuta-devel] How to get the type of member that is a pointer using symbol-db



Hi,

On 07/29/2013 01:08 PM, Marco Diego Aurélio Mesquita wrote:
On Sun, Jul 28, 2013 at 1:54 PM, Massimo Cora' <maxcvs email it> wrote:
The best choice would be to replace totally ctags in view of a clang based
parser.



That would be a too much work for the feature I want to implement. For
now, I'm thinking on a workaround. Suppose that I want to get type of
"help_window" that is declared as:

GtkWindow *main_window, *help_window;

Currently, it is easy to correctly get the offsets of GtkWindow and
help_window. So, now we'll store the piece of the string between
GtkWindow and help_window in a buffer. Such buffer would then contain:
" *main_window, *". To get the correct type, we'll scan this buffer
backwards and stop scanning once we find a "," or we reach the
beginning of the buffer and store each non-commented char in another
buffer. This other buffer would then contain: " *". This other buffer
can then be concatenated with the first buffer to correctly get the
type of "help_window": "GtkWidget *".

Do you think this approach is acceptable?



in short, no.
The best approach is indeed the lexer one (where this method is already implemented). The top-down method - i.e. proceeding by simple regular expressions - will fail once the complexity of the expression raise.
That's why cxx-parser isn't working good.

Regards,
Massimo




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]