Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lexer: allow extglob wildcards as function names
the lexer assumes an extglob token if any of the wildcards expressions (such as `@`, and `+`) are succeeded by a left parenthesis but that proves to be an issue if the wildcard is used as a function name. example input: ``` $ cat in.sh @() { echo "$@"; } ``` `bash` and `gosh` comparison: ``` $ bash ./in.sh hello $ ./gosh in.sh in.sh:5:1: "}" can only be used to close a block ``` given `in.sh`, gosh reports about a syntax error - this is because a closing bracket is found while the lexer isn't assuming a function block fix the issue by assuming a function if one of the conditions below is true: * if the expression is found at the beginning of the statement or if its preceded by a "function" * if `(` is immediately succeeded by a `)` - although this is a valid bash syntax, we'll operate on the likelihood that it is a function fixes #739
- Loading branch information