emacs-devel
[Top][All Lists]
Advanced

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

Re: Implementation direction for shell-script-mode with tree-sitter


From: João Paulo Labegalini de Carvalho
Subject: Re: Implementation direction for shell-script-mode with tree-sitter
Date: Thu, 27 Oct 2022 08:22:00 -0600

Some shells, such as csh, are very syntactically different from
bash.

That should not be a problem for tree-sitter as, once the csh tree-sitter library is loaded, the queries will only match the particular keywords and built-in commands of csh.

However, I am able to test other shell variants as there is no tree-sitter grammar for them. The only one I have access to is for bash, but as I said I am trying to keep the implementation as generic as possible so, once those grammars are available the effort to use them should be low.
 
So won't you end up, in effect, reproducing the existing font-lock code?

That seems to be the case for the keyword fontification generated from the `sh-font-lock-var*' variables. The only way I found to avoid this is to explicitly specify the same regex queries for fontification used currently in sh-mode in the tree-sitter queries. This will create duplication of data but avoids the undesirable duplication of font-lock code.

--
João Paulo L. de Carvalho
Ph.D Computer Science |  IC-UNICAMP | Campinas , SP - Brazil
Postdoctoral Research Fellow | University of Alberta | Edmonton, AB - Canada
joao.carvalho@ic.unicamp.br
joao.carvalho@ualberta.ca

reply via email to

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