Skip to content

Support ANSII-C quoting in strings prefixed with $ - #54

Merged
nathansobo merged 1 commit into
masterfrom
ns/ansii-c-quoting
Jul 26, 2019
Merged

nathansobo merged 1 commit into
masterfrom
ns/ansii-c-quoting

Conversation

@nathansobo

Copy link
Copy Markdown
Member

Refs atom/language-shellscript#146

Bash supports ANSII-C quoting in single-quoted strings that are prefixed with $. For example, the string $'Here\'s Johnny' escapes the embedded single quote when prefixed with $. The expanded result is then treated as a single-quoted string.

To support this, I took my cue from raw_string, which is defined via a simple regex. I added a new symbol called ansii_c_string with a slightly more complex regular expression that allows escaped quotes single within the a string prefixed by $. One thing I wondered is whether this node should be aliased to raw_string, but it felt like that was adding complexity just to discard information from the tree, so I held off on it. Happy to adjust this though based on feedback.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

This looks good to me. Thanks! I agree with your choice to keep it as a separate node type.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

I think you have access to merge and publish now, but let me know if not.

@nathansobo
nathansobo merged commit c710c0d into master Jul 26, 2019
@nathansobo
nathansobo deleted the ns/ansii-c-quoting branch July 26, 2019 20:05
@nathansobo

Copy link
Copy Markdown
Member Author

Looks like I don't have permission to publish to npm.

npm ERR! 403 Forbidden - PUT https://registry.npmjs.org/tree-sitter-bash - You do not have permission to publish "tree-sitter-bash". Are you logged in as the correct user?

@nathansobo

Copy link
Copy Markdown
Member Author

Published to npm as [email protected]

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