moodmosaic / Fare

Port of Java dk.brics.automaton and xeger, mostly used for generating strings that match a specific regular expression.
http://www.brics.dk/automaton/
MIT License
182 stars 43 forks source link

Prevent invalid character ranges #65

Closed gukoff closed 2 months ago

gukoff commented 3 months ago

--

Throwing exception from Xeger ctor is a somewhat controversial choice.

The original library seems to not do so, and we accept the other invalid constructions such as \w{7,1}. At the same time, in the function MakeInterval there's already a precedent of throwing.

Alternatively, I thought of of adding examples of unsolvable regexes to the README, and in the error message link to this section of README. The only examples I can think of are [\w-.] and \w{7,1}.

--

Should solve https://github.com/moodmosaic/Fare/issues/44

gukoff commented 2 months ago

@moodmosaic ping!

moodmosaic commented 2 months ago

@gukoff, thank you 👍