Skip to content
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

syntax: full support for a regexp following =~ #29

Closed
mvdan opened this issue Sep 17, 2016 · 2 comments
Closed

syntax: full support for a regexp following =~ #29

mvdan opened this issue Sep 17, 2016 · 2 comments
Labels

Comments

@mvdan
Copy link
Owner

mvdan commented Sep 17, 2016

Right now in extended tests we simply read a word after =~. This works most of the time, but it can be broken with some forms of ERE, by using characters that would otherwise be tokens (like () or spaces.

[[ foo =~ bar(a) ]]
[[ foo =~ ba[ r] ]]
@mvdan mvdan added the bash label Sep 17, 2016
@mvdan
Copy link
Owner Author

mvdan commented Oct 4, 2016

Forgot to link to this issue in 4ea5a56. Still not there, but support is better.

@mvdan mvdan changed the title parser: support a regexp following =~ parser: full support for a regexp following =~ Oct 26, 2016
@mvdan
Copy link
Owner Author

mvdan commented Oct 26, 2016

What we're doing now (after the commit above) is read until we find ]]. This will work most of the time, but will break if a tab is used instead of a space, or if the regex itself contains ]].

 $ echo '[[ a =~ ( ]]) ]]' | bash
 $ echo '[[ a =~ ( ]]) ]]' | shfmt
1:13: statements must be separated by &, ; or a newline

@mvdan mvdan changed the title parser: full support for a regexp following =~ syntax: full support for a regexp following =~ Oct 30, 2016
@mvdan mvdan closed this as completed in 50f937a Nov 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant