Commit 9e7dd28
committed
syntax: don't treat '#' as a comment inside [[ ]] tests
The lexer treated '#' as the start of a comment whenever the parser
quote state was not unquotedWordCont, which meant that mid-word '#'
inside [[ ]] tests was wrongly consumed as a comment. This broke
expressions like [[ -n $foo#bar ]] and zsh glob qualifiers like
[[ -n ./(../)#(.jj)(#qN/) ]], where parsing fell off the end of the
test clause.
Allow '#' as a word continuation in testExpr too when adjacent to the
previous token, since '#' has no comment meaning inside [[ ]].
Fixes #1326.1 parent fcd06d4 commit 9e7dd28
2 files changed
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4021 | 4021 | | |
4022 | 4022 | | |
4023 | 4023 | | |
| 4024 | + | |
| 4025 | + | |
| 4026 | + | |
| 4027 | + | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
| 4031 | + | |
4024 | 4032 | | |
4025 | 4033 | | |
4026 | 4034 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
| 298 | + | |
298 | 299 | | |
299 | 300 | | |
300 | 301 | | |
| |||
0 commit comments