On Tue, 18 Jan 2011 15:22:48 +0300, Константин wrote:
Hi,
Hello, i am working on improving php parser in geany. Here is my result
Cool! I assume you are rewriting the parser completely, not using regular expressions? That's awesome!
But i can't understand fully tag system of geany. We have structure: typedef struct sTagEntryInfo { boolean lineNumberEntry;/* pattern or line number entry */ unsigned long lineNumber; /* line number of tag */ fpos_t filePosition; /* file position of line containing tag */ int bufferPosition; /* buffer position of line containing tag */ const char* language; /* language of source file */ boolean isFileScope; /* is tag visibile only within source file? */ boolean isFileEntry; /* is this just an entry for a file name? */ boolean truncateLine; /* truncate tag line at end of tag name? */ const char *sourceFileName; /* name of source file */ const char *name; /* name of the tag */ const char *kindName; /* kind of tag */ char kind; /* single character representation of kind */ struct { const char* access; const char* fileScope; const char* implementation; const char* inheritance; const char* scope [2]; /* value and key */ const char *arglist; /* Argument list for functions and macros with arguments */ const char *varType; } extensionFields; /* list of extension fields*/ int type; unsigned long seekPosition; } tagEntryInfo;
Now we have such php code:
<?php class test1{ var $abc;var $test; function test567(){ echo "{$a}"; echo '{$a1}'; } } $hello=new test1(); ?>
so questions:
- is i am right that varType of $hello must be test1? so varType is
the type of variable?
Nope. varType is the type of the variable, e.g. string, integer, list, etc. As far as I know PHP doesn't use strict typing at all, so it's probably best to leave it at NULL.
- what must be done to be visible for $abc in autocompletion for
test1 class? Now i have see autocompletion only for functions of class, not variables.
$abc should work as well. Maybe just the particular test case "$abc" is a bit unfortunate as auto completion by default first starts at the fourth character, so you could test with something like $abcde, then the auto completion should show up once 'd' is typed. You can also force the auto completion with Ctrl-Space before the four character limit or you can change the limit of needed characters to activate auto completion in the preferences dialog, Editor tab.
- what varType must be for variables in scope? for example class
properties.
See answer of 1), I think you can completely ignore varType for PHP. After a quick grep on the tagamanager/ctags sources, varType is only used in the C and Pascal parser.
- can be access and inheritance be used for autocompletion? for
example autocompletion will not shown for private functions. or if inheritance is used for autocompletion?
Nope. The tagmanager/ctags system does support this AFAIK but Geany doesn't support this (yet). It needs to implemented but is not that trivial.
Hope that helps. If you have further questions, just ask. We'll try to help you as we really want a better PHP parser :). Your work is very appreciated.
Regards, Enrico