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

Something is rotten in the state of Pattern parsing #804

Open
hellerve opened this issue May 15, 2020 · 3 comments
Open

Something is rotten in the state of Pattern parsing #804

hellerve opened this issue May 15, 2020 · 3 comments

Comments

@hellerve
Copy link
Member

The parser for patterns seems not quite right; specifically there seems to be a problem with backlashes. Consider this example:

(Pattern.substitute #"\b" "w\b" "\\\\b" -1) ; => throws an error about an unexpected quote
(Pattern.substitute &(Pattern.init "\b") "w\b" "\\\\b" -1) ; => works fine

(This is courtesy of the famous, revered, and all around great guy @TimDeve)

I volunteer to look into this.

Cheers

@hellerve hellerve added the bug label May 15, 2020
@hellerve hellerve self-assigned this May 15, 2020
@jacereda
Copy link
Contributor

Could it be related to the Chars change?

@hellerve
Copy link
Member Author

I don’t think so because the error happens at parse time. I think this is before Char plays a role, but I’ll dig into it this weekend and let you know!

@hellerve
Copy link
Member Author

Actually, this is behaving as intended, since \b is a special escape sequence for patterns (used for balanced strings, and takes two arguments in the form of the next two characters). When used in a string, \b is made a backspace, however.

We should probably just document the pattern language better.

@eriksvedang eriksvedang added this to the 0.7.0 – No major bugs milestone Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants