emacs-devel
[Top][All Lists]
Advanced

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

Re: Why tree-sitter instead of Semantic? (was Re: CC Mode with font-lock


From: Lynn Winebarger
Subject: Re: Why tree-sitter instead of Semantic? (was Re: CC Mode with font-lock-maximum-decoration 2)
Date: Tue, 16 Aug 2022 13:40:21 -0400

On Tue, Aug 16, 2022 at 1:19 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
> > I'm only saying there's a disconnect between Jostein's report and Po's
> > response.  It's probably a UI issue.  There's a checkbox in a dropdown
> > menu that says "Source Code Parsers (Semantic)".
>
> FWIW, I've used (semantic-mode 1) to enable CEDET in Emacs's C source
> files and that was all that was needed to get TAB completion of struct
> field's names working.
> I haven't used it for much more than that, admittedly.

It also works for me, but I also have been mostly looking at Emacs
source with it, and Semantic knows how to use the TAGS file for
context-sensitive completion in C.  And something is working
gangbusters in Elisp, but unfortunately I can't really identify which
package is doing the work.

> > *  "${" and "{" could both open a block closed by "}"
>
> Why do you think it's a problem?
If you want the lexer to tokenize the ${ as a symbol while still
recognizing the text in between as delimited, it seems like a problem.
  I mean, I already deal with that in ordinary font-lock, I was hoping
the parser/lexer generation would address the issue independently of
syntax tables.

>
> > *  if/fi, case/esac, etc, or possibly all keyword blocks are closed by "end"
>
> These aren't handled by syntax tables.
>
> > *  "variadic" structures like try/catch+/finally?
>
> Same.
>
I know they aren't.

> > It's not clear from the doc just how much this reliance on the syntax
> > table based block identification is baked into the lexer/parser
> > generation.
>
> IIRC the syntax-tables are used for speed so as to skip whole blocks
> without fully parsing their contents.

As I wrote, I'm not sure how baked into the parser/lexer generation
these special token types are, and if blocks are used for things like
error recovery or limiting the scope where the syntactic structure is
either illegal or incomplete. That's part of the selling point of the
design.
I can make the necessary modifications for myself, but if it was
already in Semantic I could make use of it immediately without having
to worry about these copyright assignment issues.

Lynn



reply via email to

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