X-Git-Url: https://git.distorted.org.uk/~mdw/anag/blobdiff_plain/a10122de085ddf5c8bec6fc12c7164ad1dc1459c..d9af4a2b674e5ab91df0f9af236283b617bb81c7:/anag.c diff --git a/anag.c b/anag.c index 6be2a4e..e15fb6d 100644 --- a/anag.c +++ b/anag.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: anag.c,v 1.5 2002/08/11 12:58:09 mdw Exp $ + * $Id: anag.c,v 1.7 2003/11/29 23:38:37 mdw Exp $ * * Main driver for anag * @@ -29,6 +29,12 @@ /*----- Revision history --------------------------------------------------* * * $Log: anag.c,v $ + * Revision 1.7 2003/11/29 23:38:37 mdw + * Debianization. + * + * 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. @@ -89,18 +95,24 @@ The basic tests in the expression are:\n\ -subgram WORD matches words which only use letters in WORD\n\ -wildcard PATTERN matches with wildcards `*' and `?'\n\ -trackword WORD matches words which can be found in a trackword\n\ +-mono PATTERN matches words isomorphic to the given PATTERN\n\ " #ifdef HAVE_REGCOMP "\ -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 ------------------------------------------------*/ @@ -118,7 +130,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_ANAG, O_SUBG, O_WILD, O_TRACK, O_REGEXP, O_PCRE, O_MONO, O_EOF }; @@ -148,9 +160,13 @@ static const struct opt opttab[] = { { "subgram", 1, 0, O_SUBG }, { "wildcard", 1, 0, O_WILD }, { "trackword", 1, 0, O_TRACK }, + { "mono", 1, 0, O_MONO }, #ifdef HAVE_REGCOMP { "regexp", 1, 0, O_REGEXP }, #endif +#ifdef HAVE_PCRE + { "pcre", 1, 0, O_PCRE }, +#endif /* --- End marker --- */ @@ -354,6 +370,10 @@ static void p_factor(p_ctx *p, node **nn) #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); } p_next(p);