I am releasing 0.4.5 of Reg, a tool for pattern matching in arbitrary
ruby Object graphs. Reg includes tools that search for patterns in all
the important core data structures as well as tools for extending the
match criteria to include just about any ruby code you could want. Reg
provides matchers for Strings (via Regexps), Symbols, Hashes, and
several alternatives for matching Objects, but the main feature is the
ability to match Arrays of arbitrary ruby data using vaguely
Regexp-like syntax.
The interface to the above features is a mini-language that's embedded
directly in ruby because it does all its tricks with operator
overloading. I am not going to repost the syntax summary or examples
of this mini-language, since it's a couple pages and hasn't changed
from the last time. But let me say in brief that Reg attempts to
emulate both the obscurity and compact power of regular expressions.
(There was one error in the syntax summary in the first Reg
announcement. The descriptions of binary + and - were inverted.
Thanks to Pit Capitain for spotting it.)
In this release, the backtracking engine seems to be complete. At
least, all the test cases pass now. Documentation has been expanded,
but nowhere near what is needed. Many things have been renamed
internally (put in a namespace), but it shouldn't affect users (if
there are any) very much. For the most part, aliases are provided to
the old name. The one exception is the old Reg module, which is now
named Reg::Reg. (Beware if you had 'include Reg' in your class.)
Important features remain unimplemented at this point. There's still
no substitutions, backreferences, variable binding, item_that, or
lookahead. Users who wanted Reg for traditional lexing and parsing
tasks still need to look elsewhere. Few optimizations are done. And
vector Reg::And and Reg::Xor won't work.