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

Correctly parse \A (and others) inside %r{...} inside macros #6282

Merged
merged 2 commits into from Jun 29, 2018

Conversation

asterite
Copy link
Member

Hopefully fixes #6180 (let's see what CI says)

The first commit fixes the direct issue: %r(...) is being confused inside macros with a macro var %r... choosing % as the start of a macro var was an unfortunate decision...

The second commit fixes a few other things:

  • | was missing as a delimiter in a few places (it might be worth to extract the list of delimiters into a constant, but it's a bit hard to use inside case when other chars are involved in subsequent conditions, so if someone wants to improve the code later, please go ahead, but in a separate PR please)
  • a few missing next_char after, for example, %r: only one next_char skipped the % but another r was missing. This wasn't a big deal, but one spec in this PR would fail otherwise (so it was incorrect behaviour after all, just very hidden).

@asterite asterite changed the title Bug/6180 regex inside macro Correctly parse \A (and others) inside %r{...} inside macros Jun 28, 2018
@sdogruyol sdogruyol merged commit 89b3867 into crystal-lang:master Jun 29, 2018
@RX14 RX14 added this to the Next milestone Jun 29, 2018
@asterite asterite deleted the bug/6180-regex-inside-macro branch June 30, 2018 13:59
@RX14 RX14 modified the milestones: Next, 0.26.0 Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

%s{\A} inside macro parses incorrectly
3 participants