[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Call for volunteers: add tree-sitter support to major modes
From: |
Yuan Fu |
Subject: |
Re: Call for volunteers: add tree-sitter support to major modes |
Date: |
Sun, 23 Oct 2022 21:20:24 -0700 |
> On Oct 22, 2022, at 8:51 AM, João Paulo Labegalini de Carvalho
> <jaopaulolc@gmail.com> wrote:
>
> I am getting a query error but I don't understand why.
>
> The following query is fine:
>
> (defvar sh-script--treesit-bash-keywords
> '("case" "do" "done" "elif" "else" "esac" "export" "fi" "for"
> "function" "if" "in" "unset" "while" "then"))
>
> (treesit-validate-query 'bash `([ ,@sh-script--treesit-bash-keywords ]
> @font-lock-keyword-face))
>
> However the following query is said INVALID by `treesit-validate-query':
> (treesit-validate-query 'bash `([ ,@(sh-feature sh-leading-keywords) ]
> @font-lock-keyword-face))
> Node type error at: 3
> ["time" "!" "do" "done" ...] @font-lock-keyword-face
>
> time" is highlighted in the *tree-sitter check query* buffer.
>
> Even though the forms below evaluate to equivalent forms:
> `([ ,@sh-script--treesit-bash-keywords] @font-lock-keyword-face)
> evaluates to:
> ([ "case" "do" "done" "elif" ... ] @font-lock-keyword-face)
>
> `([ ,@(sh-feature sh-leading-keywords) ] @font-lock-keyword-face)
> evaluates to:
> (["time" "!" "do" "done" ...] @font-lock-keyword-face)
>
>
> Any clues to what I am doing wrong?
It is saying that there is no “time” node in bash grammar. You probably need to
consult the grammar file of tree-sitter-bash to see what are the keywords it
recognizes.
For example, running the following snippet
(let (collection)
(goto-char (point-min))
(while (re-search-forward "'[^ ][^ ]+?'" nil t)
(push (match-string 0) collection))
(pop-to-buffer "*result*")
(dolist (keyword (cl-remove-duplicates collection :test #'equal))
(insert keyword "\n")))
in the grammar.js gives me
'\\\\'
'>('
'<('
'$('
':-'
':?'
'${'
')*'
'([^'
'[^'
'--'
'++'
'alternative'
'consequence'
'right'
'>='
'<='
'-='
'!='
'operator'
'left'
'<<<'
'destination'
'>|'
'>&'
'<&'
'&>>'
'&>'
'>>'
'descriptor'
'index'
'=='
'=~'
'argument'
'unsetenv'
'unset'
'local'
'readonly'
'export'
'typeset'
'declare'
']]'
'[['
'||'
'&&'
'|&'
'name'
'function'
';;&'
';&'
'fallthrough'
';;'
'termination'
'esac'
'case'
'else'
'elif'
'fi'
'then'
'if'
'done'
'do'
'until'
'while'
'))'
'update'
'condition'
'initializer'
'(('
'value'
'in'
'variable'
'select'
'for'
'redirect'
'body'
'\n'
'<<-'
'<<'
'+='
'bash'
'\\s'
'\\'
'\\]'
'\\['
Yuan
- Re: Call for volunteers: add tree-sitter support to major modes, (continued)
- Re: Call for volunteers: add tree-sitter support to major modes, João Paulo Labegalini de Carvalho, 2022/10/11
- Re: Call for volunteers: add tree-sitter support to major modes, Eli Zaretskii, 2022/10/12
- Re: Call for volunteers: add tree-sitter support to major modes, João Paulo Labegalini de Carvalho, 2022/10/12
- Re: Call for volunteers: add tree-sitter support to major modes, Eli Zaretskii, 2022/10/12
- Re: Call for volunteers: add tree-sitter support to major modes, João Paulo Labegalini de Carvalho, 2022/10/21
- Re: Call for volunteers: add tree-sitter support to major modes, João Paulo Labegalini de Carvalho, 2022/10/21
- Re: Call for volunteers: add tree-sitter support to major modes, Yuan Fu, 2022/10/21
- Re: Call for volunteers: add tree-sitter support to major modes, Yuan Fu, 2022/10/21
- Re: Call for volunteers: add tree-sitter support to major modes, Eli Zaretskii, 2022/10/22
- Re: Call for volunteers: add tree-sitter support to major modes, João Paulo Labegalini de Carvalho, 2022/10/22
- Re: Call for volunteers: add tree-sitter support to major modes,
Yuan Fu <=
- Re: Call for volunteers: add tree-sitter support to major modes, João Paulo Labegalini de Carvalho, 2022/10/24
- Re: Call for volunteers: add tree-sitter support to major modes, João Paulo Labegalini de Carvalho, 2022/10/24
- Re: Call for volunteers: add tree-sitter support to major modes, Theodor Thornhill, 2022/10/24
- Re: Call for volunteers: add tree-sitter support to major modes, João Paulo Labegalini de Carvalho, 2022/10/24
- Re: Call for volunteers: add tree-sitter support to major modes, Theodor Thornhill, 2022/10/24
Re: Call for volunteers: add tree-sitter support to major modes, Payas Relekar, 2022/10/12