Xion / pyqcy

QuickCheck-like testing framework for Python
http://xion.io/pyqcy
Other
41 stars 0 forks source link

Backreferences to capture groups in regex() #12

Open Xion opened 12 years ago

Xion commented 12 years ago

Currently, the regex generator offers only limited support for capture groups: it just ignores them :) To enhance this, the syntactic elements \1, \2, and so on, need to be interpreted correctly as commands to copy-paste the strings that we generated previously for the corresponding capture groups.

Such an enhancement requires a bit of refactoring to the whole regex-reversal code. It should be best to decouple it from the regex generator itself, because it will need to carry more state than can be stored directly on the call stack of various __reverse_X_node methods: namely, the strings we have generated for earlier capture groups.