For the next release (after this one gets up) I am implementing syntax for regdefs: we used to have this but it got removed, now it's coming back. The idea is to be able to write:
regdef digit = charset "0123456789"; regdef digits = digit +; regdef letter = charset "abcdefghijklmnopqrstuvwxyz"; regdef us = "_"; regdef alphanum = (letter | digit | us)+; regdef id = (letter | us ) alphanum*; to build up regular expressions with regular definitions and a sane combinatorial syntax (instead of the stupid syntax of Perl regexps ... :) The above code parses at the moment (but isn't useful yet). The above stuff is all constants. Since we're actually using Re2 or Tre which are string regexp handlers, we need to support run-time strings. That may be done in the first instance by: regdef dynamic = re (felix_expression); regdef s = str (felix_expression); where felix_expression is any expression to which the str function can be applied (including RE2 compiled regexps). The first form yields a Perl regexp. The second is a yields any string (not a regexp) which is converted to a regexp matching itself by "quoting" away any meta-charactes. Regexps will resolve regdef trees by lookup (on names), quoting, and adding non-capturing groups to keep the tree structure, then the resulting string gets compiled to a regexp using the library functions. So basically all this is just a sane syntax for regexps. -- john skaller skal...@users.sourceforge.net ------------------------------------------------------------------------------ Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more. http://p.sf.net/sfu/oracle-sfdev2dev _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language