tree-sitter / tree-sitter-bash

Bash grammar for tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed parsing compound operator without brackets in function body.

cattokomo opened this issue · comments

commented

In Bash, you can have anything listed in compound operators as function body, including [[ ... ]], ((...)), if ...; then ...; fi, etc. But the parser failed to parse those.

For example:

is_foo() [[ "$1" = foo ]] # The parser failed in here because there's no brackets.
assert()
  if ! $1; then # Failed here because there's no brackets and the parser expected one.
    echo "${2:-assertion failed}" >&2
    return 1
  fi