Hello, i am working on improving php parser in geany. Here is my result http://www.pasteall.org/pic/show.php?id=8137
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: 1) is i am right that varType of $hello must be test1? so varType is the type of variable? 2) 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. 3) what varType must be for variables in scope? for example class properties. 4) 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?
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
I used zend engine tokenizer from php. now i am talking only about autocomplete_scope (editor.c) for example i type "$hello->" after that there is searching algorythm, it worked in such way: 1) found tag. 2) get it varType 3) search tag using varType 4) search scoped members of tag with varType 5) show user autocompletion window.
so if varType is not set, then there no be any scoped members.
18.01.2011, 22:15, "Enrico Tröger" enrico.troeger@uvena.de:
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
-- Get my GPG key from http://www.uvena.de/pub.asc
Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
On Tue, 18 Jan 2011 22:28:11 +0300, Константин wrote:
Hi,
I used zend engine tokenizer from php.
Could you elaborate on this a bit? Is this a C library or a PHP tool?
now i am talking only about autocomplete_scope (editor.c) for example i type "$hello->" after that there is searching algorythm, it worked in such way:
- found tag.
- get it varType
- search tag using varType
- search scoped members of tag with varType
- show user autocompletion window.
so if varType is not set, then there no be any scoped members.
Yes, seems right. So actually yes, if you set varType correctly, scoped auto completion might work. I forgot to mention this special case in my first answer as this code is relatively new and for some reason, I tend to ignore it often...sorry.
Regards, Enrico
I used php embed (libphp.so) and function tokens_get_all. So i recieve very powerfull tokenizer. we can take lex source from php, but there is many work with it. How can i show you patches?
19.01.2011, 01:23, "Enrico Tröger" enrico.troeger@uvena.de:
On Tue, 18 Jan 2011 22:28:11 +0300, Константин wrote:
Hi,
I used zend engine tokenizer from php.
Could you elaborate on this a bit? Is this a C library or a PHP tool?
now i am talking only about autocomplete_scope (editor.c) for example i type "$hello->" after that there is searching algorythm, it worked in such way:
- found tag.
- get it varType
- search tag using varType
- search scoped members of tag with varType
- show user autocompletion window.
so if varType is not set, then there no be any scoped members.
Yes, seems right. So actually yes, if you set varType correctly, scoped auto completion might work. I forgot to mention this special case in my first answer as this code is relatively new and for some reason, I tend to ignore it often...sorry.
Regards, Enrico
-- Get my GPG key from http://www.uvena.de/pub.asc
Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
On Wed, 19 Jan 2011 13:02:07 +0300, Константин wrote:
Hi,
I used php embed (libphp.so) and function tokens_get_all. So i recieve
is this an open-source library? Or more specifically, what is its license? Where to get it?
very powerfull tokenizer. we can take lex source from php, but there
That would probably be easier for the project as such as we wouldn't require external libraries like libphp.so (whatever it is).
is many work with it. How can i show you patches?
Just do a 'svn diff' and attach the result to a mail to this list or upload the patches somewhere on the net and post a link here.
Regards, Enrico
You need compile php with --enable-embed, then libphp5.so will appeared in your system.
19.01.2011, 22:16, "Enrico Tröger" enrico.troeger@uvena.de:
On Wed, 19 Jan 2011 13:02:07 +0300, Константин wrote:
Hi,
I used php embed (libphp.so) and function tokens_get_all. So i recieve
is this an open-source library? Or more specifically, what is its license? Where to get it?
very powerfull tokenizer. we can take lex source from php, but there
That would probably be easier for the project as such as we wouldn't require external libraries like libphp.so (whatever it is).
is many work with it. How can i show you patches?
Just do a 'svn diff' and attach the result to a mail to this list or upload the patches somewhere on the net and post a link here.
Regards, Enrico
-- Get my GPG key from http://www.uvena.de/pub.asc
Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
I began learning of flex, i think soon i recieve stand alone parser ;)
Le 18/01/2011 20:15, Enrico Tröger a écrit :
On Tue, 18 Jan 2011 15:22:48 +0300, Константин wrote:
[…]
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.
Well, you are right that PHP variable types are not strict, but in this case it is true that $hello has type "test1", so perhaps it's goodt to set it to this value. However, setting it to another value later in the code would be perfectly valid, and so keeping the type "test1" would be wrong:
$hello = new Test() $hello = 42
Just 2 cents ^^
Cheers, Colomban
On Tue, 18 Jan 2011 20:35:33 +0100, Colomban wrote:
Le 18/01/2011 20:15, Enrico Tröger a écrit :
On Tue, 18 Jan 2011 15:22:48 +0300, Константин wrote:
[…]
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.
Well, you are right that PHP variable types are not strict, but in this case it is true that $hello has type "test1", so perhaps it's goodt to
True. Sorry for my mistake. I didn't read the example carefully enough. But as you also pointed out below, PHP is not strictly typed and so using the varType field is probably not useful or at least very hard to be used correctly in complex code samples.
set it to this value. However, setting it to another value later in the code would be perfectly valid, and so keeping the type "test1" would be wrong:
$hello = new Test() $hello = 42
Regards, Enrico