Thread: [Lxr-dev] multi-language identifiers
Brought to you by:
ajlittoz
From: Dave B. <da...@br...> - 2004-07-19 20:59:59
|
The 0.8 release announcement says: "In multi-language environments, keywords in a language are no longer hyperlinked if a different language happens to have them as an identifier" This doesn't seem to be the case for me. Does anybody remember where or how this is supposed to happen? -- Dave Brondsema : da...@br... http://www.brondsema.net : personal http://www.splike.com : programming http://csx.calvin.edu : student org |
From: Malcolm B. <mb...@us...> - 2004-07-20 00:49:27
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dave Brondsema wrote: | The 0.8 release announcement says: | | "In multi-language environments, keywords in a language are no longer | hyperlinked if a different language happens to have them as an identifier" | | This doesn't seem to be the case for me. Does anybody remember where or | how this is supposed to happen? I recall coding this - the keywords are now per-language, and the code in Common.pm switches on the language of the file. Once the file is fragmented by SimpleParse, each fragment recognised as code is fed to $lang->processcode where $lang should depend on the type of the file. This then strips out reserved words before making links to symbols - see Generic.pm line 162. If this isn't working for you, my guess would be that either the setup of $lang is hosed, or that processcode is not accurately reading the languageconf info. Cheers, Malcolm -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with MultiZilla - http://enigmail.mozdev.org iD8DBQFA/GxlQeMefPKyX/QRApFbAKDcq06wchQapfoBo6tHE3GMM0qxXwCgwEXT W35JiA0dIP2MdNvuRlqLD10= =NsQN -----END PGP SIGNATURE----- |
From: Dave B. <da...@br...> - 2004-07-20 18:15:10
|
On Tue, 20 Jul 2004, Malcolm Box wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Dave Brondsema wrote: > | The 0.8 release announcement says: > | > | "In multi-language environments, keywords in a language are no longer > | hyperlinked if a different language happens to have them as an identifier" > | > | This doesn't seem to be the case for me. Does anybody remember where or > | how this is supposed to happen? > > I recall coding this - the keywords are now per-language, and the code > in Common.pm switches on the language of the file. Once the file is > fragmented by SimpleParse, each fragment recognised as code is fed to > $lang->processcode where $lang should depend on the type of the file. > > This then strips out reserved words before making links to symbols - see > Generic.pm line 162. > > If this isn't working for you, my guess would be that either the setup > of $lang is hosed, or that processcode is not accurately reading the > languageconf info. > > Cheers, It's still marked as a TODO on processcode :-) -- Dave Brondsema : da...@br... http://www.brondsema.net : personal http://www.splike.com : programming http://csx.calvin.edu : student org |
From: Malcolm B. <ma...@br...> - 2004-07-21 14:03:58
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dave Brondsema wrote: | On Tue, 20 Jul 2004, Malcolm Box wrote: |>If this isn't working for you, my guess would be that either the setup |>of $lang is hosed, or that processcode is not accurately reading the |>languageconf info. |> |>Cheers, | | | It's still marked as a TODO on processcode :-) I think that's a misleading comment :-) The code does a !grep(/^$2$/, $self->langinfo('reserved')) which should filter out any reserved words as specified in the language info block. So there is a bug in the comment :-) Cheers, Malcolm -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with MultiZilla - http://enigmail.mozdev.org iD8DBQFA/ngOQeMefPKyX/QRAvYcAJ4oqIcH3vdcScb7QQ58HQP6Rkr0BgCgxQMj D1qnBIMiVMjsCwLAyKLbPXA= =UXio -----END PGP SIGNATURE----- |
From: Dave B. <da...@br...> - 2004-07-21 14:07:13
|
On Wed, 21 Jul 2004, Malcolm Box wrote: > Dave Brondsema wrote: > | On Tue, 20 Jul 2004, Malcolm Box wrote: > |>If this isn't working for you, my guess would be that either the setup > |>of $lang is hosed, or that processcode is not accurately reading the > |>languageconf info. > |> > |>Cheers, > | > | > | It's still marked as a TODO on processcode :-) > > I think that's a misleading comment :-) The code does a !grep(/^$2$/, > $self->langinfo('reserved')) which should filter out any reserved words > as specified in the language info block. > > So there is a bug in the comment :-) > Yes, reserved words are correctly limited to the current language. But identifiers are not. -- Dave Brondsema : da...@br... http://www.brondsema.net : personal http://www.splike.com : programming http://csx.calvin.edu : student org |
From: Malcolm B. <ma...@br...> - 2004-07-22 16:58:12
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dave Brondsema wrote: | On Wed, 21 Jul 2004, Malcolm Box wrote: |>I think that's a misleading comment :-) The code does a !grep(/^$2$/, |>$self->langinfo('reserved')) which should filter out any reserved words |>as specified in the language info block. |> |>So there is a bug in the comment :-) | | Yes, reserved words are correctly limited to the current language. But | identifiers are not. Good point - the comment and the problem you originally reported are talking about different things: 1. ignoring any string which is a reserved word when checking if it is a symbol and 2. making the lookup of identifiers language dependent so that if e.g. a perl file defines foo and a C file defines foo then the correct one will be linked to. AFAICT the code does the former correctly, but as commented doesn't do the latter. This would require tagging each symbol with the language it was defined in. Also suspect that it might break clever code like the Javascript/C++ bridging in Mozilla - or at least make the LXR less useful. Cheers, Malcolm -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with MultiZilla - http://enigmail.mozdev.org iD8DBQFA//KOQeMefPKyX/QRAsfnAJ9CeWy/Ulu5Zz4a1ZvM/i2EFwQjEQCfWsoB +cQAw/vd32lewKKIrSoSG5w= =2dR2 -----END PGP SIGNATURE----- |
From: Dave B. <da...@br...> - 2004-07-22 20:35:41
|
On Thu, 22 Jul 2004, Malcolm Box wrote: > Dave Brondsema wrote: > > | On Wed, 21 Jul 2004, Malcolm Box wrote: > |>I think that's a misleading comment :-) The code does a !grep(/^$2$/, > |>$self->langinfo('reserved')) which should filter out any reserved words > |>as specified in the language info block. > |> > |>So there is a bug in the comment :-) > | > | Yes, reserved words are correctly limited to the current language. But > | identifiers are not. > > Good point - the comment and the problem you originally reported are > talking about different things: > > 1. ignoring any string which is a reserved word when checking if it is a > symbol > and > 2. making the lookup of identifiers language dependent so that if e.g. a > perl file defines foo and a C file defines foo then the correct one will > be linked to. > > AFAICT the code does the former correctly, but as commented doesn't do > the latter. This would require tagging each symbol with the language it > was defined in. Also suspect that it might break clever code like the > Javascript/C++ bridging in Mozilla - or at least make the LXR less useful. > Right. It'll be configurable then :-) The database already holds all the relationships, the code just has to take advantage of that. If configured to do so, it should be limited by version too. -- Dave Brondsema : da...@br... http://www.brondsema.net : personal http://www.splike.com : programming http://csx.calvin.edu : student org |