GNU bug report logs -
#64017
Wrong conversion from Emacs to Tree-sitter S-expression syntax
Previous Next
Full log
Message #38 received at submit <at> debbugs.gnu.org (full text, mbox):
>
> Yes, so it seemed to me but reading the source code (lib/src/query.c) seems to indicate that what I thought were symbols -- *, +, ?, @thing, #thing -- appear to be special postfix and prefix operators. (Ironically, there doesn't seem to be a grammar for this language anywhere, or am I mistaken?)
>
> Thus a structurally correct Lispish translation of
>
> (teet "toot"* (#equal "fie" @fum))
>
> should arguable be something like
>
> (teet (* "toot") ((# equal) "fie" (@ fum)))
>
> rather than the current
>
> (teet "toot" :* (:equal "fie @fum))
>
> but I'm not demanding that it all be changed at this stage.
IMHO the query syntax is already pretty far away from a “proper sexp” that we expect, so changing these little things don’t have much benefit. For example, the field names and trailing capture names are not conventional, are we going to change them to be more sexpy too?
In a proper sexp they would have been wrapped too, like
(field-name: node) rather than field-name: node
(@fn node) rather than node @fn
Not to mention using colon and @ to distinguish field-names and capture names from nodes—not very conventional either.
Also a more conventional sexp syntax would be much more verbose than the current one, and arguable harder to translate to the tree-sitter string syntax, which is ultimately what we feed to tree-sitter functions.
Yuan
This bug report was last modified 2 years and 33 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.