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: Po Lu
Subject: Re: Implementation direction for shell-script-mode with tree-sitter
Date: Wed, 26 Oct 2022 08:52:27 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

João Paulo Labegalini de Carvalho <jaopaulolc@gmail.com> writes:

> 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.

N.B that shell-script-mode supports shells other than bash, so maybe a
tree-sitter-bash based variant should be spun off into its own
`bash-mode', as opposed to possibly interfering with the support for all
of rest?


reply via email to

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