emacs-devel
[Top][All Lists]
Advanced

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

Re: Plug treesit.el into other emacs constructs


From: Lynn Winebarger
Subject: Re: Plug treesit.el into other emacs constructs
Date: Tue, 27 Dec 2022 10:46:35 -0500

On Thu, Dec 15, 2022 at 2:57 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
> > If this code is plugged into transpose-sexps we get this nice behavior:
>
> It's a bit different from what SMIE would do, but there's a lot of
> overlap and when it's different it's arguably better, so sounds good
> to me.
>
> > Now forward/backward-sexp can actually work a little differently, as you
> > suggest, or we can let it use the same "move over siblings"-semantic.
> > In that case we don't even need the treesit-sexp-type-regexp variables to
> > control this, I think.
> >
> > What do you think?
>
> I'm not sufficiently familiar with the tree-sitter tree to foresee
> precisely how it would affect `forward/backward-sexp`, but I think you
> have a good enough understanding to make a good judgment at this
> point :-)

A while ago, I created a LALR(1) grammar with "generic" symbols that
encapsulated essentially all "standard" syntactic constructs I've seen
in programming languages:  top-level forms, statements, blocks,
sequences, constructors, keyword forms (including ones with op,
l-values, r-values, prefix/postfix/infix & unary/binary operators,
calls, destructuring l-values, quoted data, interpolating quotation
and other interpolating forms, etc.  It was pretty neat.  If I can
ensure it (or some equivalent grammar) is unencumbered I'd like to
document it and extend emacs's syntax tables to be able to analyze a
buffer using these constructs instead of just s-expressions, with
modes just providing a map of language-specific tokens to the generic
symbols.

Lynn



reply via email to

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