Closed mvz closed 5 years ago
Hi @mvz and thanks for reporting.
May I ask, did you encounter this in a "real-life" scenario or were you testing for edge cases?
So far, the policy for this gem has been not to support these "quirky" metachar/literal edge cases, as described in #15, particularly in this comment and the following ones.
If these quirks turn out to be commonly depended upon, we might have to reconsider, though.
MRI behavior is quite inconsistent here looking at other metachar pairs, but at least it hasn't changed since Ruby 1.9.3.
/{/ # => /{/
/}/ # => /}/
/[/ # => SyntaxError (premature end of char-class: /[/)
/]/ # => /]/
/(/ # => SyntaxError (end pattern with unmatched parenthesis: /(/)
/)/ # => SyntaxError (unmatched close parenthesis: /)/)
This was a real-life scenario: I was running mutant against the code of my ripper_ruby_parser gem.
However, after reading through #15, I think maybe the best fix is for mutant to catch this error and handle it.
the error is now being caught by mutant
, so i'll close this issue.
Attempting to parse
/{/
results in an error:However, for MRI this is perfectly fine (although it's equivalent to
/\{/
).