-
Notifications
You must be signed in to change notification settings - Fork 64
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
Heredoc rework #193
Heredoc rework #193
Conversation
LGTM |
2a161c0
to
6c9ad5d
Compare
As I said in #118, they should all be children of the So for this test node <<JS
console.log("hi")
JS It's currently
where and this PR makes it
but I expected this instead
|
I did try to implement that, the issue is commands can be in between a heredoc start and body, it might be possible to partially integrate your goal The main issue is something like this: one <<EOF | grep two
three
EOF |
Also, can you take a look at the action I added? It should run on a release, my question is how does it upload the binaries to the release? |
278127a
to
9f774d7
Compare
In the command |
I managed to get heredocs to work like you wanted, with a hack for pipes. fixing a couple scanner bugs was very annoying...but it ended up being a tiny fix. |
Remove the |
I didn't know/think about that when I made that suggestion, then I think you're right it should be separate, but I still think it should be part of the
I think the end should be with the body so that you don't have to search for it in the tree, unless there can be commands between the body and the end too somehow... |
Okay, just pushed it. Try out heredocs now @verhovsky Reviewing the action now |
1e90f57
to
d4c7b37
Compare
@ObserverOfTime Can you try out my latest changes? I did my best to fix up parameter expansions Damn nvm script fails |
Fixed script failures, try now @ObserverOfTime w/ whatever wacky patterns you can come up w/ |
This was the hardest set of fixes I've worked on in a while, good luck downstream |
@verhovsky I released 0.20.0 on GH to see how the pack action would work, but nothing ran |
I didn't get the chance to review this before it was merged. These are still not parsed as expected: cat <<EOF
${parameter-default}
${!varprefix*}
${!varprefix@}
${parameter@U}
EOF Parse tree
Also, they're not all |
I was debating whether or not to make them all operators, I might as well, totally forgot about the expansions in heredocs! |
It's not a heredoc problem. The expansions are parsed the same way anywhere. |
my fault, so I had parameter-default parsed correctly, inadvertently messed it up, and the test didn't pick up on that:
Since operator is hidden (command
(command_name
(expansion
(variable_name)
(word)))) works either way 😛 |
Note that The other expansions also have the same issue with whitespace. |
The 2nd case seems to work fine for me? Unless you want * to not be parsed as a word but a special character |
Yes, since it can't be a word, just |
Yes. The only time whitespace should be ignored is in |
Speaking of # $parameter or '1' if unset
echo "${parameter:-1}"
# the last character of $parameter
echo "${parameter: -1}"
# also the last character of $parameter
echo "${parameter:(-1)}" Parse tree
In the first case, the operator is correct, but |
what is the third one? an array, subshell, or parenthesized expression? |
Parenthesized expression. |
So, I wanted to separate heredoc bodies and their endings. It wasn't the most pleasant to do it w/o reworking the entire
scan_heredoc_content
function, but I managed to get it work. Since this doesn't really fix a bug but rather separates two nodes, I'd like to get your thoughts @verhovsky @ObserverOfTimeAfter this I'll cut a new release and will add the CI action to publish binaries @verhovsky
Closes #37
Closes #118
Closes #134 (if the action doesn't mess up ;) )
Closes #188
Closes #194
Closes #195