bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#61849: 29.0.60; Unable to use treesit-install-language-grammar becau


From: Misha Zharov
Subject: bug#61849: 29.0.60; Unable to use treesit-install-language-grammar because repo doesn't have parser.c
Date: Mon, 27 Feb 2023 19:13:59 -0800

Thanks for getting back to me

> (Btw, why not use https://github.com/DerekStride/tree-sitter-sql
> instead?)

I just landed on the other one first, no particular reason.  Initially it
worked until they removed the autogenerated code that was in
the repo.  As a workaround I can switch to the sql grammar that you
have recommended, but the problem might occur again in other
repos.

> I'm not sure we should incorporate in Emacs so much of this
> specialized stuff.

That's fair, but I fear that more repos will remove the autogenerated
parser code, which will make treesit-install-language-grammar
much less useful.  Perhaps this won't occur often, but I wanted to
consult on a possible solution.  However, since this appears to be
working as intended, then that is okay as well.

Thanks for taking the time to look into this.

On Mon, Feb 27, 2023 at 12:00 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Misha Zharov <mishazharov1@gmail.com>
> > Date: Sun, 26 Feb 2023 23:34:57 -0800
> >
> > Add (sql "https://github.com/m-novikov/tree-sitter-sql";) to
> > treesit-language-source-alist. Then use
> > treesit-install-language-grammar. The following error occurs:
> >
> >     Error encountered when installing language grammar: (treesit-error
> >     Command: cc -fPIC -c -I. parser.c Error output: cc1: fatal error:
> >     parser.c: No such file or directory compilation terminated.)
> >
> > This error occurs because we need to run a configuration step on the
> > repo to generate parser.c. I believe this is because we need to either
> > run `npm run generate` or `tree-sitter generate` to generate the
> > `src/parser.c` file. It would be nice if we could implement a patch to:
> >
> >   1. Allow users to specify a configuration step to configure the repo
> >      before searching for parser.c (like passing a lambda into
> >      `treesit-language-source-alist`)
> >   2. Allow users to specify a git hash that should be checked out before
> >      the configuration step is run. I know currently different branches
> >      are supported, but not all projects have release branches.
> >   3. Alternatively this function can be split into 2 function, the first one
> >       would clone and configure the repository, and well as find the
> >       required files. The second function would simply compile the required
> >       files into the shared libraries, and move them to the appropriate 
> > location
>
> I'm not sure we should incorporate in Emacs so much of this
> specialized stuff.  treesit-install-language-grammar is meant for
> doing the simple steps of compiling C/C++ sources in a boilerplate
> repository into a shared library.  Anything significantly more complex
> should IMO be left to manual procedures by people who know what they
> are doing, especially if that requires to have specialized tools
> installed.
>
> (Btw, why not use https://github.com/DerekStride/tree-sitter-sql
> instead?)





reply via email to

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