hoaproject / Regex

The Hoa\Regex library.
https://hoa-project.net/
310 stars 17 forks source link

String generation does not work as expected with negative character classes #39

Open blmage opened 4 years ago

blmage commented 4 years ago

The generation rule for negative character classes does not work as expected: instead of generating a character which does not belong to the character class, it generates a printable ASCII character that is not part of the random characters generated for the class children.

Not quite sure how to fix this though, would you have any pointer as to where to start? Thanks!

blmage commented 4 years ago

After having given it more thought, each element of the AST should probably return a range (or set of ranges) of the characters that it can match, knowing that in the case of alternations and classes, this would require applying some operation to their children's ranges (union or complement). I'll take a stab at it if I can find some time!