[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/4] dfa: merge calls to SUCCEEDS_IN_CONTEXT
From: |
Paolo Bonzini |
Subject: |
[PATCH 4/4] dfa: merge calls to SUCCEEDS_IN_CONTEXT |
Date: |
Sun, 5 Feb 2012 18:00:46 +0100 |
* src/dfa.c (state_index): use a single call to SUCCEEDS_IN_CONTEXT.
---
src/dfa.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/dfa.c b/src/dfa.c
index 3da6553..ce92077 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -412,7 +412,7 @@ struct dfa
/* ACCEPTS_IN_CONTEXT returns true if the given state accepts in the
specified context. */
#define ACCEPTS_IN_CONTEXT(prev, curr, state, dfa) \
- SUCCEEDS_IN_CONTEXT((dfa).states[state].constraint, prev, curr)
+ SUCCEEDS_IN_CONTEXT ((dfa).states[state].constraint, prev, curr)
static void dfamust (struct dfa *dfa);
static void regexp (void);
@@ -2014,9 +2014,7 @@ state_index (struct dfa *d, position_set const *s, int
context)
if (d->tokens[s->elems[j].index] < 0)
{
constraint = s->elems[j].constraint;
- if (SUCCEEDS_IN_CONTEXT(constraint, context, CTX_NONE)
- || SUCCEEDS_IN_CONTEXT(constraint, context, CTX_NEWLINE)
- || SUCCEEDS_IN_CONTEXT(constraint, context, CTX_LETTER))
+ if (SUCCEEDS_IN_CONTEXT (constraint, context, CTX_ANY))
d->states[i].constraint |= constraint;
if (! d->states[i].first_end)
d->states[i].first_end = d->tokens[s->elems[j].index];
@@ -2503,16 +2501,16 @@ dfastate (int s, struct dfa *d, int trans[])
they fail in the current context. */
if (pos.constraint != NO_CONSTRAINT)
{
- if (! SUCCEEDS_IN_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 (! SUCCEEDS_IN_CONTEXT(pos.constraint,
- d->states[s].context, CTX_LETTER))
+ if (! SUCCEEDS_IN_CONTEXT (pos.constraint,
+ d->states[s].context, CTX_LETTER))
for (j = 0; j < CHARCLASS_INTS; ++j)
matches[j] &= ~letters[j];
- if (! SUCCEEDS_IN_CONTEXT(pos.constraint,
- d->states[s].context, CTX_NONE))
+ if (! SUCCEEDS_IN_CONTEXT (pos.constraint,
+ d->states[s].context, CTX_NONE))
for (j = 0; j < CHARCLASS_INTS; ++j)
matches[j] &= letters[j] | newline[j];
--
1.7.7.6