Skip to content

Conversation

@WillForan
Copy link

No description provided.

@idank
Copy link
Owner

idank commented Dec 30, 2024

Thanks, can you make this work in 3.7 as well?

@WillForan
Copy link
Author

I worried the walrus operator was suspicious, albeit more concise. hopefully removing it does the trick for py3.7

@idank
Copy link
Owner

idank commented Dec 31, 2024

There seems to be more to this function than just single quotes: https://github.com/bminor/bash/blob/master/subst.c#L11892

Like double quotes, escape characters. Can you maybe leave a todo if you're not going to add that part?

@WillForan
Copy link
Author

sorry for the long delay!
The initial start/end strip now handles double quotes.
And within token quotes and escaped-quotes are managed.

I'm not sure I've gotten the edge cases correct. And I'm assuming unbalanced non-escaped quotes would have had a parsing error before getting here. currently string_quote_removal removes all non-escaped quotes without checking if they're paired.

Surprisingly (to me) these are all valid bash HEREDOCs

cat << "HERE\"DOC"
example: quote in quote
HERE"DOC

cat << HERE\"DOC
example: one double quote
HERE"DOC

cat << HERE"x"DOC
example: string 
HERExDOC


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants