miner/strgen

support backslashing { and }

andrewguy9 opened this issue · 2 comments

Similar to #6, I'm trying to build regex with literal { and }.

Dot works: (gen/generate (sg/string-generator #"\.")) -> "."

Open curly brace fails: (gen/generate (sg/string-generator #"\{")) -> ;!!CompilerException clojure.lang.ExceptionInfo: Unsupported backslash char { {:unsupported-backslash \{}, compiling:(:175:1)

The fix probably looks similar to 8c932e3

As with #6, the work around is to add use [{] rather than \{.

miner commented

Yes. I think the general policy should be any character that is special for parse-chars should be a literal after a backslash. I added the curly braces {} and pipe | chars to the list. Version 0.1.8 is now on Clojars. I'm going to close the bug, but let me know if there's a problem.

Worked for me! Thanks for quick turn around!