summaryrefslogtreecommitdiff
path: root/ecs.c
diff options
context:
space:
mode:
authorvern <vern>1988-05-08 19:53:13 +0000
committervern <vern>1988-05-08 19:53:13 +0000
commite35b5956bf51d77195bffcf85622d2f2c3288885 (patch)
treee413012cd82834d7555c276ae169499715d5bd88 /ecs.c
parent1c7f99904c44d622f52e3be202d59f06e77d9dac (diff)
downloadflex-e35b5956bf51d77195bffcf85622d2f2c3288885.tar.gz
added RCS id
added PROCFLG to avoid assumption of signed char's
Diffstat (limited to 'ecs.c')
-rw-r--r--ecs.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/ecs.c b/ecs.c
index dc43c5e..16057f3 100644
--- a/ecs.c
+++ b/ecs.c
@@ -14,6 +14,11 @@
#include "flexdef.h"
+#ifndef lint
+static char rcsid[] =
+ "@(#) $Header: /cvsroot/flex/flex/ecs.c,v 1.4 1988/05/08 19:53:13 vern Exp $ (LBL)";
+#endif
+
/* ccl2ecl - convert character classes to set of equivalence classes
*
* synopsis
@@ -110,6 +115,8 @@ int lenccl, fwd[], bck[], llsiz;
int cclp, oldec, newec;
int cclm, i, j;
+#define PROCFLG 0x80
+
/* note that it doesn't matter whether or not the character class is
* negated. The same results will be obtained in either case.
*/
@@ -126,7 +133,7 @@ int lenccl, fwd[], bck[], llsiz;
for ( i = fwd[cclm]; i != NIL && i <= llsiz; i = fwd[i] )
{ /* look for the symbol in the character class */
- for ( ; j < lenccl && ccls[j] <= i; ++j )
+ for ( ; j < lenccl && (ccls[j] <= i || (ccls[j] & PROCFLG)); ++j )
if ( ccls[j] == i )
{
/* we found an old companion of cclm in the ccl.
@@ -137,10 +144,11 @@ int lenccl, fwd[], bck[], llsiz;
bck[i] = newec;
fwd[newec] = i;
newec = i;
- ccls[j] = -i; /* set flag so we don't reprocess */
+ ccls[j] |= PROCFLG; /* set flag so we don't reprocess */
/* get next equivalence class member */
- /* next 2 */ goto next_pt;
+ /* continue 2 */
+ goto next_pt;
}
/* symbol isn't in character class. Put it in the old equivalence
@@ -167,10 +175,10 @@ next_pt:
/* find next ccl member to process */
- for ( ++cclp; ccls[cclp] < 0 && cclp < lenccl; ++cclp )
+ for ( ++cclp; (ccls[cclp] & PROCFLG) && cclp < lenccl; ++cclp )
{
/* reset "doesn't need processing" flag */
- ccls[cclp] = -ccls[cclp];
+ ccls[cclp] &= ~PROCFLG;
}
}
}