[augeas-devel] [PATCH 0 of 4] Add subtraction of regular expresions

David Lutterkort dlutter at redhat.com
Fri May 9 19:59:25 UTC 2008


It is now possible to subtract regular expressions in the language using
syntax 're1 - re2' where re1 and re2 both have type regexp (or string,
which is automatically coerced to regexp)

The meat of the implementation is in patch 3/4

Evaluation of '-' is somewhat costly, and the first case of where libfa is
used outside of the typechecker. To evaluate 're1 - re2', automata fa1 and
fa2 for re1 and re2 are compiled, the automaton fa is computed as the
set difference of fa1 and fa2, and fa is converted back to a regexp that is
later fed to glibc's regex matcher.

Besides making writing complex regexps more convenient, there's now no
excuse anymore for the faulty typecheck of lens union, which will be
fixed shortly.

9 files changed, 193 insertions(+), 63 deletions(-)
lenses/yum.aug                            |    5 -
src/lens.c                                |   12 --
src/lexer.l                               |    2
src/parser.y                              |   13 ++-
src/regexp.c                              |   57 +++++++++++++
src/syntax.c                              |  121 ++++++++++++++++++-----------
src/syntax.h                              |   15 +++
tests/modules/fail_regexp_minus_empty.aug |    9 ++
tests/modules/pass_regexp_minus.aug       |   22 +++++




More information about the augeas-devel mailing list