about summary refs log tree commit diff
path: root/posix/regex_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'posix/regex_internal.h')
-rw-r--r--posix/regex_internal.h45
1 files changed, 30 insertions, 15 deletions
diff --git a/posix/regex_internal.h b/posix/regex_internal.h
index 95ae46e297..20622540e8 100644
--- a/posix/regex_internal.h
+++ b/posix/regex_internal.h
@@ -96,8 +96,6 @@ typedef enum
   NON_TYPE = 0,
 
   /* Token type, these are used only by token.  */
-  OP_OPEN_SUBEXP,
-  OP_CLOSE_SUBEXP,
   OP_OPEN_BRACKET,
   OP_CLOSE_BRACKET,
   OP_CHARSET_RANGE,
@@ -124,6 +122,8 @@ typedef enum
 #endif /* RE_ENABLE_I18N */
 
   /* Node type, These are used by token, node, tree.  */
+  OP_OPEN_SUBEXP,
+  OP_CLOSE_SUBEXP,
   OP_PERIOD,
   CHARACTER,
   END_OF_RE,
@@ -142,24 +142,18 @@ typedef enum
 #ifdef RE_ENABLE_I18N
 typedef struct
 {
-  /* If this character set is the non-matching list.  */
-  unsigned int non_match : 1;
-
   /* Multibyte characters.  */
   wchar_t *mbchars;
-  int nmbchars;
 
   /* Collating symbols.  */
 # ifdef _LIBC
   int32_t *coll_syms;
 # endif
-  int ncoll_syms;
 
   /* Equivalence classes. */
 # ifdef _LIBC
   int32_t *equiv_classes;
 # endif
-  int nequiv_classes;
 
   /* Range expressions. */
 # ifdef _LIBC
@@ -169,17 +163,32 @@ typedef struct
   wchar_t *range_starts;
   wchar_t *range_ends;
 # endif /* not _LIBC */
-  int nranges;
 
   /* Character classes. */
   wctype_t *char_classes;
+
+  /* If this character set is the non-matching list.  */
+  unsigned int non_match : 1;
+
+  /* # of multibyte characters.  */
+  int nmbchars;
+
+  /* # of collating symbols.  */
+  int ncoll_syms;
+
+  /* # of equivalence classes. */
+  int nequiv_classes;
+
+  /* # of range expressions. */
+  int nranges;
+
+  /* # of character classes. */
   int nchar_classes;
 } re_charset_t;
 #endif /* RE_ENABLE_I18N */
 
 typedef struct
 {
-  re_token_type_t type;
   union
   {
     unsigned char c;		/* for CHARACTER */
@@ -195,6 +204,11 @@ typedef struct
       re_node_set *bkref_eclosure;
     } *ctx_info;
   } opr;
+#if __GNUC__ >= 2
+  re_token_type_t type : 8;
+#else
+  re_token_type_t type;
+#endif
   unsigned int constraint : 10;	/* context constraint */
   unsigned int duplicated : 1;
 #ifdef RE_ENABLE_I18N
@@ -203,8 +217,9 @@ typedef struct
 } re_token_t;
 
 #define IS_EPSILON_NODE(type) \
-  ((type) == OP_ALT || (type) == OP_DUP_ASTERISK || (type) == OP_DUP_PLUS || \
-   (type) == OP_DUP_QUESTION || (type) == ANCHOR)
+  ((type) == OP_ALT || (type) == OP_DUP_ASTERISK || (type) == OP_DUP_PLUS \
+   || (type) == OP_DUP_QUESTION || (type) == ANCHOR \
+   || (type) == OP_OPEN_SUBEXP || (type) == OP_CLOSE_SUBEXP)
 
 #define ACCEPT_MB_NODE(type) \
   ((type) == COMPLEX_BRACKET || (type) == OP_PERIOD)
@@ -214,9 +229,6 @@ struct re_string_t
   /* Indicate the raw buffer which is the original string passed as an
      argument of regexec(), re_search(), etc..  */
   const unsigned char *raw_mbs;
-  /* Index in RAW_MBS.  Each character mbs[i] corresponds to
-     raw_mbs[raw_mbs_idx + i].  */
-  int raw_mbs_idx;
   /* Store the multibyte string.  In case of "case insensitive mode" like
      REG_ICASE, upper cases of the string are stored, otherwise MBS points
      the same address that RAW_MBS points.  */
@@ -230,6 +242,9 @@ struct re_string_t
   wint_t *wcs;
   mbstate_t cur_state;
 #endif
+  /* Index in RAW_MBS.  Each character mbs[i] corresponds to
+     raw_mbs[raw_mbs_idx + i].  */
+  int raw_mbs_idx;
   /* The length of the valid characters in the buffers.  */
   int valid_len;
   /* The length of the buffers MBS, MBS_CASE, and WCS.  */