emacs-devel
[Top][All Lists]
Advanced

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

Re: Per-language project-search-path, was: Re: Unified project interface


From: Eric Ludlam
Subject: Re: Per-language project-search-path, was: Re: Unified project interface
Date: Sun, 02 Aug 2015 19:09:18 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0

On 08/02/2015 01:14 PM, Michael Heerdegen wrote:
Nix <address@hidden> writes:

(What I'd really like is something like the el-search pcase-based
searcher Michael Heerdegen recently proposed, only for everything
supported by Semantic, but with most language grammars not being very
amenable to ML-style pattern-matching I doubt this is possible...)
I agree that would be very useful.  But I don't know much about
Semantic, and the info pages seem to be outdated.

Most of the doc is about using some of the user facing tools. The sections about the lex stage should be good.

Is there some function in semantic that parses the expression at point
and returns a parse tree represented as (Lisp) list?  The outdated info
page mentions ast.el which seems to do that, but I can't find it
anymore.

I guess one could try the following, more or less: go through the buffer
and parse it on the fly to ast expressions.  The search command prompts
for a "pattern" using the syntax of the buffer's language plus
placeholders.  The input is parsed and converted to a an ast as well.
Then the matching could be done in Elisp like el-search does.

You can use the lexer from semantic to get the list of parsed tokens. The current parsers output tags instead of an AST. Making an AST would be handy for langauge sensitive tooling past tagging parsers, but would be a bit slow. Large parts of the buffer aren't parsed at all right now as the parser skips over large { bracketed } blocks of code which keeps thing faster.

It may be that the specifics you are looking for are part of the local context parser, which includes functions such as -get-local-variables, -get-local-arguments, and -current-symbol, which gets the whole symbols in a dotted expression. This is in semantic/ctxt.el.

Eric



reply via email to

[Prev in Thread] Current Thread [Next in Thread]