emacs-devel
[Top][All Lists]
Advanced

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

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


From: João Paulo Labegalini de Carvalho
Subject: Implementation direction for shell-script-mode with tree-sitter
Date: Tue, 25 Oct 2022 09:05:10 -0600

Hi,

The tree-sitter-bash grammar does not include many reserved words and builtin commands that are currently fontified by the regex based fontication in shell-script-mode.

Here a list of the ones that tree-sitter-bash does not recognize:

("time" "coproc" "type" "trap" "exit" "exec" "continue" "break" "return" "logout" "bye")

According to the Bash Reference Manual, all of the above are reserved words.

Should I make a PR to tree-sitter-bash to incorporate the missing keywords or should I just filter them out of the list that I obtain through (and other variables in `shell-script-mode'):

(append (sh-feature sh-leading-keywords)
        (sh-feature sh-other-keywords))

I am attaching the patch so everyone can see code and understand better what I did. I welcome all criticism and feedback.

PS.: I am looking at the tree-sitter-bash and it does not seem very complicated to extend it to recognize the missing keywords. But I can definitely keep working independently of that.
--
João Paulo L. de Carvalho
Ph.D Computer Science |  IC-UNICAMP | Campinas , SP - Brazil
Postdoctoral Research Fellow | University of Alberta | Edmonton, AB - Canada

Attachment: sh-script-treesit.patch
Description: Text Data


reply via email to

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