Re: (PHP) Resolving Lost Scanned Includes

Andrea Turso <[email protected]> Mon, 10 Aug 2015 21:22:49 +0100
Newsgroups gmane.emacs.semantic
Message-ID <CADL_vS+qcb-ypWxzizjW+TmPmqd3Gq2y_fWwsuE5uxQoc0Zxew@mail.gmail.com>
Dear Eric,

I figured that clicking on the include tag in the buffer doesn't work,
perhaps I was remembering this wrong, or did I break something?

The tags in the ECB Methods Buffer do work and the correct file is opened
when I click them.

Sorry if I had you looking for no reason, using just the original snippet
shown below.

(define-mode-local-override semantic-tag-include-filename php-mode (tag)
  "Maps a PHP qualified class name to a file."
  (ede-php-autoload-find-class-def-file (ede-current-project)
(semantic-tag-name tag)))

One last question if I may, I noticed that certain PHP buffers are fully
parsed despite my grammar only containing rules for 'use' and 'new' and
'class' with no body. Could this be some undesired interaction with
java-tags?

On Mon, Aug 10, 2015 at 1:07 PM, Andrea Turso <[email protected]>
wrote:

> Eric,
>
> It sure does help, that's precisely what I was after!
>
> I did some quick experimentation and found that the function
> `semantic-dependency-tag-file` while reading the docs of `semantic-tag-include-filename`
> which you suggested.
>
> As soon as I changed the body of `semantic-dependency-tag-file`, I was
> able to see the include tags get highlighted in yellow like they do in
> Java, as opposed to red.
>
> (define-mode-local-override semantic-dependency-tag-file php-mode (tag)
>   ""
>   (ede-php-autoload-find-class-def-file (ede-current-project)
> (semantic-tag-name tag)))
>
> In the above code I'm mapping the type name to an absolute path using
> `ede-php-autoload-find-class-def-file`, sadly however, the include tags
> don't do anything when clicked.
>
> Could this be caused by the use of an absolute path, or do I have to
> provide a body to `semantic-tag-include-filename` that's not just
> `(semantic-tag-name tag)`?
>
> Your help is greatly appreciated.
>
> Andrea Turso
>
>
> On Mon, Aug 10, 2015 at 1:58 AM, Eric Ludlam <[email protected]>
> wrote:
>
>> On 08/09/2015 06:25 PM, Andrea Turso wrote:
>>
>>> Dear Eric,
>>>
>>> I have used the the Wisent grammar in semantic/wisent/java-tags.wy to
>>> create a small parser for PHP [1]
>>>
>>> My objective is to extract the list of included classes from a buffer
>>> and make their name clickable (to jump to definition).
>>>
>>> When testing the java-tags parser all import statements are converted
>>> into Semantic Includes, and it's possible to click on the class name to
>>> visit its file.
>>>
>>> My PHP grammar is also using the INCLUDE-TAG macro, but all includes end
>>> up being lost, so I wonder if there is anything non-obvious that must be
>>> done.
>>>
>>> I suppose Semantic/SemanticDB/TypeCache (which one?) needs a function to
>>> map the type name to a file — and for that I might rely on the code from
>>> another user of this mailing list [2].
>>>
>>> In the past I remember getting as far as finding the
>>> semanticdb-find-translate-path-includes-default function, but failed to
>>> understand how to get include tags to be resolved.
>>>
>>> I would appreciate if you could tell me what functions do I need to
>>> override, or write, to achieve similar results to that of the java-tags
>>> grammar?
>>>
>>
>> Hi Andrea, The PHP stuff sounds great.  It is has been unfortunate that
>> the version in cedet/contrib hasn't been usable.
>>
>> The magic you need is `semantic-tag-include-filename', which appears to
>> be in lisp/cedet/semantic/java.el.
>>
>> This converts the string in the tag into a file name.  Without it, the
>> includes infrastructure just trys to use it directly.
>>
>> I hope this helps.
>> Eric
>>
>
>

------------------------------------------------------------------------------

_______________________________________________
cedet-semantic mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cedet-semantic