ferno/greenery — pull request #6 by pjkundert (2013-05-03 21:02:37+00:00)
Title: Implemented handling of expressions matching no input

Previously, attempting to take the intersection of regular expressions with
non-overlapping multipliers (eg "aa" & "aaaa") would raise an Exception, instead
of producing a no match regular expression "[]". These (and other no-match)
expressions are now handled.

o Added a lego.multiplier representing 'never', by making the
multiplier.min/.max both 'inf' (bound(None)), a previously unused
configuration. This turns out to require little additional logic, and
actually cleans up some code.
o Handle multiplying an fsm by None to produce null (no match) fsm
o Optimize search for unused state number slightly to ~O(1) vs. O(n)
o Simplified - , while adding handling for never
o Allow representation of {} (never) and {0} (empty string) multipliers,
since they are always reduced
o Intersection of non-overlapping multipliers now produces new 'never'
multiplier, instead of producing invalid (inverted) multiplier Exception
o Prevent elimination of {}, {0} on lego string rendering; should virtually
never occur anyway, due to elimination by reduce()
o Moved bound/multiplier testing to start of unit tests, due to their
foundational nature.
o Added some empty/no-match unit tests
o Expand main.py to allow playing around with more expression variants,
including timing, and an interactive mode for testing input against union,
intersection and concatenation of supplied expression(s).
o Moved the lego.py multiplier tests to original order to minimize merge
o Restored restriction on representing zero/never multipliers in regexes
o Corrected processing of test input vectors in main.py example code