bug-grep
[Top][All Lists]
Advanced

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

[PATCH 6/8] dfa: do not use MATCHES_*_CONTEXT directly


From: Paolo Bonzini
Subject: [PATCH 6/8] dfa: do not use MATCHES_*_CONTEXT directly
Date: Fri, 20 Jan 2012 16:35:19 +0100

* src/dfa.c (dfastate): Use SUCCEEDS_IN_CONTEXT.
---
 src/dfa.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/dfa.c b/src/dfa.c
index bc57e3f..60d456d 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -2493,23 +2493,20 @@ dfastate (int s, struct dfa *d, int trans[])
 
       /* Some characters may need to be eliminated from matches because
          they fail in the current context. */
-      if (pos.constraint != 0xFF)
+      if (pos.constraint != NO_CONSTRAINT)
         {
-          if (! MATCHES_NEWLINE_CONTEXT(pos.constraint,
-                                        d->states[s].context, CTX_NEWLINE))
-            clrbit(eolbyte, matches);
-          if (! MATCHES_NEWLINE_CONTEXT(pos.constraint,
-                                        d->states[s].context, ~CTX_NEWLINE))
+          if (! SUCCEEDS_IN_CONTEXT(pos.constraint,
+                                    d->states[s].context, CTX_NEWLINE))
             for (j = 0; j < CHARCLASS_INTS; ++j)
-              matches[j] &= newline[j];
-          if (! MATCHES_LETTER_CONTEXT(pos.constraint,
-                                       d->states[s].context, CTX_LETTER))
+              matches[j] &= ~newline[j];
+          if (! SUCCEEDS_IN_CONTEXT(pos.constraint,
+                                    d->states[s].context, CTX_LETTER))
             for (j = 0; j < CHARCLASS_INTS; ++j)
               matches[j] &= ~letters[j];
-          if (! MATCHES_LETTER_CONTEXT(pos.constraint,
-                                       d->states[s].context, ~CTX_LETTER))
+          if (! SUCCEEDS_IN_CONTEXT(pos.constraint,
+                                    d->states[s].context, CTX_NONE))
             for (j = 0; j < CHARCLASS_INTS; ++j)
-              matches[j] &= letters[j];
+              matches[j] &= letters[j] | newline[j];
 
           /* If there are no characters left, there's no point in going on. */
           for (j = 0; j < CHARCLASS_INTS && !matches[j]; ++j)
-- 
1.7.7.1





reply via email to

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