- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 353
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: $var#...
is incorrectly parsed as a comment
#1003
Comments
Seems like adding a Line 272 in 9e323b8
|
Nice find - genuinely surprised that noone spotted this bug before. @bouk has the right idea, but unfortunately the fix isn't that easy. I'm investigating. |
$var#...
in argument lists is parsed incorrectly$var#...
is incorrectly parsed as a comment
I spent quite a bit of time overthinking different ways to fix this, but I landed on something relatively simple: a small variation on @bouk's idea. It's not a complete fix, as two other cases still don't parse the way they should, but the cases you showed in this issue are all fixed. |
Thanks for this! Would it be good to open an issue for the remaining cases? I haven't seen |
I left TODOs in the code as a personal reminder, but please feel free to open another issue if you think you'll run into it soon. Particularly if you already have any real example :) |
I'll wait to run into it :) |
@mvdan if you cut a release I'll update babelfish! |
done :) |
Example using shfmt:
None of these contain comments, but the latter two examples get turned into comments (and this actually came up in practice; see bouk/babelfish#23). I'm not sure if it's just variable substitutions or if there are other circumstances where this incorrect parse happens.
The text was updated successfully, but these errors were encountered: