chiark / gitweb /
Allow `.' as a wildcard. Makes Scrabble playing easier.
[anag] / anag.c
diff --git a/anag.c b/anag.c
index 56aa565e9f82f33654c51a525b5e703d33925059..616461cdf52188b7b7015e2fcf7bc8109a31d1aa 100644 (file)
--- a/anag.c
+++ b/anag.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: anag.c,v 1.6 2003/09/15 02:48:54 mdw Exp $
+ * $Id: anag.c,v 1.8 2004/04/08 01:36:19 mdw Exp $
  *
  * Main driver for anag
  *
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------* 
- *
- * $Log: anag.c,v $
- * Revision 1.6  2003/09/15 02:48:54  mdw
- * Monoalphabetic match filter.
- *
- * Revision 1.5  2002/08/11 12:58:09  mdw
- * Added support for regular expression matching, if supported by the C
- * library.
- *
- * Revision 1.4  2001/02/19 19:18:50  mdw
- * Minor big fixes to parser.
- *
- * Revision 1.3  2001/02/16 21:45:19  mdw
- * Be more helpful.  Improve full help message.  Special-case error for
- * empty command strings.
- *
- * Revision 1.2  2001/02/07 09:09:11  mdw
- * Fix spurious error when `-file' is used.
- *
- * Revision 1.1  2001/02/04 17:14:42  mdw
- * Initial checkin
- *
- */
-
 /*----- Header files ------------------------------------------------------*/
 
 #include "anag.h"
@@ -99,12 +74,17 @@ The basic tests in the expression are:\n\
 -regexp REGEXP         matches with an (extended) regular expression\n\
 "
 #endif
+#ifdef HAVE_PCRE
+"\
+-pcre REGEXP           matches with a Perl-like regular expression\n\
+"
+#endif
 "\
 \n\
 These simple tests can be combined using the operators `-a', `-o' and `-n'\n\
 (for `and', `or' and `not'; they may also be written `&', `|' and `!' if\n\
 you like), and grouped using parentheses `(' and `)'.\n\
-", fp);
+", fp); /*"*/
 }
 
 /*----- The options parser ------------------------------------------------*/
@@ -122,7 +102,7 @@ enum {
   O_HELP, O_VERSION, O_USAGE,
   O_FILE,
   O_AND, O_OR, O_NOT, O_LPAREN, O_RPAREN,
-  O_ANAG, O_SUBG, O_WILD, O_TRACK, O_REGEXP, O_MONO,
+  O_ANAG, O_SUBG, O_WILD, O_TRACK, O_REGEXP, O_PCRE, O_MONO,
   O_EOF
 };
 
@@ -156,6 +136,9 @@ static const struct opt opttab[] = {
 #ifdef HAVE_REGCOMP
   { "regexp",          1,      0,              O_REGEXP },
 #endif
+#ifdef HAVE_PCRE
+  { "pcre",            1,      0,              O_PCRE },
+#endif
 
   /* --- End marker --- */
 
@@ -358,6 +341,9 @@ static void p_factor(p_ctx *p, node **nn)
       case O_TRACK: *nn = trackword(p->a + 1); break;
 #ifdef HAVE_REGCOMP
       case O_REGEXP: *nn = regexp(p->a + 1); break;
+#endif
+#ifdef HAVE_PCRE
+      case O_PCRE: *nn = pcrenode(p->a + 1); break;
 #endif
       case O_MONO: *nn = mono(p->a + 1); break;
       default: die("syntax error near `%s': unexpected token", *p->a);