/[eliot]/eliot/dic/automaton.c
ViewVC logotype

Diff of /eliot/dic/automaton.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by ipkiss, Sun Oct 23 14:53:43 2005 UTC revision 1.9.2.1 by afrab, Sun Oct 23 17:13:56 2005 UTC
# Line 17  Line 17 
17  /* along with this program; if not, write to the Free Software               */  /* along with this program; if not, write to the Free Software               */
18  /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */  /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
19    
20    <<<<<<< automaton.c
21    /* $Id$ */
22    
23    /**
24     *  \file   automaton.c
25     *  \brief  (Non)Deterministic Finite Automaton for Regexp
26     *  \author Antoine Fraboulet
27     *  \date   2005
28    =======
29  /*  /*
30   * $Id$   * $Id$
31    >>>>>>> 1.9
32   */   */
33    
34  #include "config.h"  #include "config.h"
# Line 37  Line 47 
47  #include "alist.h"  #include "alist.h"
48  #include "automaton.h"  #include "automaton.h"
49    
50  #ifdef DEBUG_AUTOMATON__  #ifdef DEBUG_AUTOMATON
51  #define DMSG(a) a  #define DMSG(a) a
52  #else  #else
53  #define DMSG(a)  #define DMSG(a)
# Line 174  automaton_dump(automaton a, char* filena Line 184  automaton_dump(automaton a, char* filena
184  {  {
185    int i,l;    int i,l;
186    FILE* f;    FILE* f;
187    #ifdef HAVE_SYS_WAIT_H
188    pid_t   pid;    pid_t   pid;
189    #endif
190    
191    if (a == NULL)    if (a == NULL)
192      return ;      return ;
193    f=fopen(filename,"w");    f=fopen(filename,"w");
# Line 415  s_automaton_successor(alist S, int lette Line 428  s_automaton_successor(alist S, int lette
428            alist_insert(Ry,z->id);                          /* Ry = Ry \cup succ(z)    */            alist_insert(Ry,z->id);                          /* Ry = Ry \cup succ(z)    */
429          }          }
430    
431  #if 0        /* \epsilon transition from start node */
432        if ((z = y->next[RE_EPSILON]) != NULL)               /* \delta (y,z) = \epsilon */        if ((z = y->next[RE_EPSILON]) != NULL)               /* \delta (y,z) = \epsilon */
433          {          {
434            r = s_automaton_successor(z->id,letter,nfa, list);                r = s_automaton_successor(z->id,letter,nfa, list);    
435            alist_insert(Ry,r);                              /* Ry = Ry \cup succ(z)    */            alist_insert(Ry,r);                              /* Ry = Ry \cup succ(z)    */
436            alist_delete(r);            alist_delete(r);
437          }          }
 #endif  
438    
439        if (letter < RE_FINAL_TOK)        if (letter < RE_FINAL_TOK)
440          {          {
# Line 444  s_automaton_successor(alist S, int lette Line 456  s_automaton_successor(alist S, int lette
456                }                }
457          }          }
458    
459        //      if (alist_is_empty(Ry))                              /* Ry = \empty             */  #if 0
460        //        return Ry;        if (alist_is_empty(Ry))                              /* Ry = \empty             */
461            return Ry;
462    #endif
463    
464        alist_insert(R,Ry);                                  /* R = R \cup Ry           */        alist_insert(R,Ry);                                  /* R = R \cup Ry           */
465        alist_delete(Ry);        alist_delete(Ry);
# Line 655  static void Line 669  static void
669  s_automaton_dump(Automaton a, char* filename)  s_automaton_dump(Automaton a, char* filename)
670  {  {
671    FILE* f;    FILE* f;
672    #ifdef HAVE_SYS_WAIT_H
673    pid_t   pid;    pid_t   pid;
674    #endif
675    if (a == NULL)    if (a == NULL)
676      return;      return;
677    f=fopen(filename,"w");    f=fopen(filename,"w");

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.9.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26