eliot-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Eliot-dev] Changes to eliot/dic/regexp.c


From: eliot-dev
Subject: [Eliot-dev] Changes to eliot/dic/regexp.c
Date: Thu, 05 May 2005 19:45:15 -0400

Index: eliot/dic/regexp.c
diff -u eliot/dic/regexp.c:1.7 eliot/dic/regexp.c:1.8
--- eliot/dic/regexp.c:1.7      Wed Apr 27 17:35:03 2005
+++ eliot/dic/regexp.c  Thu May  5 23:45:04 2005
@@ -1,13 +1,14 @@
 /* Eliot                                                                     */
-/* Copyright (C) 1999  antoine.fraboulet                                     */
-/* address@hidden                                                 */
+/* Copyright (C) 1999  Antoine Fraboulet                                     */
 /*                                                                           */
-/* This program is free software; you can redistribute it and/or modify      */
+/* This file is part of Eliot.                                               */
+/*                                                                           */
+/* Eliot is free software; you can redistribute it and/or modify             */
 /* it under the terms of the GNU General Public License as published by      */
 /* the Free Software Foundation; either version 2 of the License, or         */
 /* (at your option) any later version.                                       */
 /*                                                                           */
-/* This program is distributed in the hope that it will be useful,           */
+/* Elit is distributed in the hope that it will be useful,                   */
 /* but WITHOUT ANY WARRANTY; without even the implied warranty of            */
 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             */
 /* GNU General Public License for more details.                              */
@@ -16,7 +17,7 @@
 /* along with this program; if not, write to the Free Software               */
 /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
-/* $Id: regexp.c,v 1.7 2005/04/27 17:35:03 afrab Exp $ */
+/* $Id: regexp.c,v 1.8 2005/05/05 23:45:04 afrab Exp $ */
 
 #include "config.h"
 #include <stdio.h>
@@ -106,12 +107,6 @@
       r->PP = (r->fg->annulable) ? (r->fg->PP | r->fd->PP) : r->fg->PP;
       r->DP = (r->fd->annulable) ? (r->fg->DP | r->fd->DP) : r->fd->DP;
       break;
-    case NODE_QMARK:
-      r->position = 0;
-      r->annulable = 1;
-      r->PP = r->fg->PP;
-      r->DP = r->fg->DP;
-      break;
     case NODE_PLUS:
       r->position = 0;
       r->annulable = 0;
@@ -158,20 +153,6 @@
            PS[pos] |= r->fd->PP;
        }
       break;
-    case NODE_QMARK:
-      /************************************************/
-      /* \forall p \in DP(left)                       */
-      /*     PS[p] = PS[p] \cup ( PP(left) \minus p ) */
-      /*                                              */
-      /* TODO : correct  a[bcd]?e                     */ 
-      /* these expression are not handled correctly   */
-      /************************************************/
-      for(pos=1; pos <= PS[0]; pos++)
-       {
-         if (r->DP & (1 << (pos-1)))
-           PS[pos] |= r->PP;
-       }
-      break;
     case NODE_PLUS:
       /************************************/
       /* == same as START                 */
@@ -233,17 +214,17 @@
 /*////////////////////////////////////////////////
 ////////////////////////////////////////////////*/
 
-#ifdef DEBUG_RE
 void regexp_print_letter(FILE* f, char l)
 {
   switch (l)
     {
-    case RE_FINAL_TOK:  fprintf(f,"( #  [%d])",RE_FINAL_TOK);  break;
-    case RE_ALL_MATCH:  fprintf(f,"( .  [%d])",RE_ALL_MATCH);  break;
-    case RE_VOWL_MATCH: fprintf(f,"(:v: [%d])",RE_VOWL_MATCH); break;
-    case RE_CONS_MATCH: fprintf(f,"(:c: [%d])",RE_CONS_MATCH); break;
-    case RE_USR1_MATCH: fprintf(f,"(:1: [%d])",RE_USR1_MATCH); break;
-    case RE_USR2_MATCH: fprintf(f,"(:2: [%d])",RE_USR2_MATCH); break;
+    case RE_EPSILON:    fprintf(f,"( &  [%d])",l); break;
+    case RE_FINAL_TOK:  fprintf(f,"( #  [%d])",l);  break;
+    case RE_ALL_MATCH:  fprintf(f,"( .  [%d])",l);  break;
+    case RE_VOWL_MATCH: fprintf(f,"(:v: [%d])",l); break;
+    case RE_CONS_MATCH: fprintf(f,"(:c: [%d])",l); break;
+    case RE_USR1_MATCH: fprintf(f,"(:1: [%d])",l); break;
+    case RE_USR2_MATCH: fprintf(f,"(:2: [%d])",l); break;
     default: 
       if (l < RE_FINAL_TOK)
        fprintf(f," (%c [%d]) ",l + 'a' - 1, l); 
@@ -252,16 +233,15 @@
        break;
     }
 }
-#endif
 
 /*////////////////////////////////////////////////
 ////////////////////////////////////////////////*/
 
-#ifdef DEBUG_RE
 void regexp_print_letter2(FILE* f, char l)
 {
   switch (l)
     {
+    case RE_EPSILON:    fprintf(f,"&"); break;
     case RE_FINAL_TOK:  fprintf(f,"#");  break;
     case RE_ALL_MATCH:  fprintf(f,".");  break;
     case RE_VOWL_MATCH: fprintf(f,":v:"); break;
@@ -276,7 +256,6 @@
        break;
     }
 }
-#endif
 
 /*////////////////////////////////////////////////
 ////////////////////////////////////////////////*/
@@ -298,11 +277,8 @@
     case NODE_AND:
       fprintf(f,"AND");
       break;
-    case NODE_QMARK:
-      fprintf(f,"?");
-      break;
     case NODE_PLUS:
-      fprintf(f,"*");
+      fprintf(f,"+");
       break;
     case NODE_STAR:
       fprintf(f,"*");
@@ -310,8 +286,8 @@
     }
   if (detail == 2)
     {
-      fprintf(f,"\\n annulable=%d\\n PP=0x%08x\\n DP=0x%08x",
-             n->annulable,n->PP,n->DP);
+      fprintf(f,"\\n pos=%d\\n annul=%d\\n PP=0x%04x\\n DP=0x%04x",
+             n->position,n->annulable,n->PP,n->DP);
     }
 }
 #endif 
@@ -356,7 +332,6 @@
       fprintf(f,"%d -> %d;",n->numero,n->fg->numero);
       fprintf(f,"%d -> %d;",n->numero,n->fd->numero);
       break;
-    case NODE_QMARK:
     case NODE_PLUS:
     case NODE_STAR:
       fprintf(f,"%d -> %d;",n->numero,n->fg->numero);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]