-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Herestring not recognized _after_ stdout redirect. #232
Comments
I think the root cause here is that the grammar in this project has explicitly different rules for where herestrings are accepted vs. other redirects, whereas the actual shell grammar doesn't make that distinction (other than heredocs, which are of course super special). |
My branch https://github.com/danfuzz/tree-sitter-bash/tree/danfuzz-redirects has a proposed fix, though (as I write this) it doesn't produce identical output for the Clarification (after looking more closely): I think my proposed change improves the parse output in most cases of the test, specifically wrapping herestring-redirected statements in |
Update: I think the failure I noted above highlights a pre-existing bug in the grammar. In particular, it looks like (non-redirection) arguments after a file redirection are taken to be redirections. For example: x <x a b c Parse tree:
|
It looks like the parser has trouble with herestrings that come after a redirect of stdout. For example, a parse of the following indicates an error on the here-string token
<<<
:Parse tree:
Compare that to the following, which works:
Parse tree:
The text was updated successfully, but these errors were encountered: