Skip to content
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

Do not treat $ as escape char in plain strings/regexes #120

Merged
merged 4 commits into from
Oct 5, 2018

Conversation

kvch
Copy link
Contributor

@kvch kvch commented Oct 5, 2018

No description provided.

@kvch kvch force-pushed the escaping-the-escaping branch 7 times, most recently from 589a14a to 76733e3 Compare October 5, 2018 13:23
@kvch kvch added review and removed in progress labels Oct 5, 2018
@kvch kvch changed the title [WIP] Do not escape $ in plain strings/regexes Do not treas $ as escape char in plain strings/regexes Oct 5, 2018
@kvch kvch changed the title Do not treas $ as escape char in plain strings/regexes Do not treat $ as escape char in plain strings/regexes Oct 5, 2018
@kvch kvch requested review from ph and urso October 5, 2018 14:54
variables.go Outdated
@@ -429,9 +429,16 @@ func lexer(in string) (<-chan token, <-chan error) {
lex <- openToken
off++
varcount++
default: // escape any symbol
case '$':
if content[off+1] == '{' { // remove $
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really safe? The guard before the switch checks only tests for off >= len(content), but not off + 1.

Why do we need to check for the pattern $${ ? The idea was to escape the pattern $$ -> $ in general.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed. Removing.

@kvch kvch merged commit 3511b88 into elastic:master Oct 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants