bug-grep
[Top][All Lists]
Advanced

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

Re: [PATCH 02/11] dfa: introduce contexts for the values in d->success


From: Paolo Bonzini
Subject: Re: [PATCH 02/11] dfa: introduce contexts for the values in d->success
Date: Wed, 04 Jan 2012 15:12:55 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0

On 01/04/2012 01:34 PM, address@hidden wrote:
Hi.

diff --git a/src/dfa.c b/src/dfa.c
index 58505bf..2386f76 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -91,6 +91,13 @@ typedef int charclass[CHARCLASS_INTS];
     errors that the cast doesn't.  */
  static inline unsigned char to_uchar (char ch) { return ch; }

+/* Contexts tell us whether a character is a newline or a word constituent.
+   Word-constituent characters are those that satisfy iswalnum(), plus '_'.  */
+
+#define CTX_NONE       1
+#define CTX_LETTER     2
+#define CTX_NEWLINE    4
+

Is there any reason, in this day and age, to still be using defines
instead of enums for something like this?

No real reason, except going along with the rest of the dfa code.

Note that you wouldn't always get meaningful names when debugging, because more than one bit can be set.

Paolo




reply via email to

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