X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=regcomp.h;h=bbe3a4139942121a2160dcd6a8ab8bdcb5fa7033;hb=f7916ddb4507eb1374c2aa49d31cb87cd7b69add;hp=066e31f01d2f51d4693a87709b1e4e48cf5b3f92;hpb=0e06870bf080a38cda51c06c6612359afc2334e1;p=p5sagit%2Fp5-mst-13.2.git diff --git a/regcomp.h b/regcomp.h index 066e31f..bbe3a41 100644 --- a/regcomp.h +++ b/regcomp.h @@ -95,16 +95,16 @@ struct regnode_charclass { U8 type; U16 next_off; U32 arg1; - char bitmap[ANYOF_BITMAP_SIZE]; + char bitmap[ANYOF_BITMAP_SIZE]; /* only compile-time */ }; -struct regnode_charclass_class { - U8 flags; +struct regnode_charclass_class { /* has [[:blah:]] classes */ + U8 flags; /* should have ANYOF_CLASS here */ U8 type; U16 next_off; U32 arg1; - char bitmap[ANYOF_BITMAP_SIZE]; - char classflags[ANYOF_CLASSBITMAP_SIZE]; + char bitmap[ANYOF_BITMAP_SIZE]; /* both compile-time */ + char classflags[ANYOF_CLASSBITMAP_SIZE]; /* and run-time */ }; /* XXX fix this description. @@ -132,6 +132,10 @@ struct regnode_charclass_class { #define ARG_VALUE(arg) (arg) #define ARG__SET(arg,val) ((arg) = (val)) +#undef ARG +#undef ARG1 +#undef ARG2 + #define ARG(p) ARG_VALUE(ARG_LOC(p)) #define ARG1(p) ARG_VALUE(ARG1_LOC(p)) #define ARG2(p) ARG_VALUE(ARG2_LOC(p)) @@ -139,6 +143,9 @@ struct regnode_charclass_class { #define ARG1_SET(p, val) ARG__SET(ARG1_LOC(p), (val)) #define ARG2_SET(p, val) ARG__SET(ARG2_LOC(p), (val)) +#undef NEXT_OFF +#undef NODE_ALIGN + #ifndef lint # define NEXT_OFF(p) ((p)->next_off) # define NODE_ALIGN(node) @@ -151,6 +158,11 @@ struct regnode_charclass_class { #define SIZE_ALIGN NODE_ALIGN +#undef OP +#undef OPERAND +#undef MASK +#undef STRING + #define OP(p) ((p)->type) #define OPERAND(p) (((struct regnode_string *)p)->string) #define MASK(p) ((char*)OPERAND(p)) @@ -159,6 +171,11 @@ struct regnode_charclass_class { #define STR_SZ(l) ((l + sizeof(regnode) - 1) / sizeof(regnode)) #define NODE_SZ_STR(p) (STR_SZ(STR_LEN(p))+1) +#undef NODE_ALIGN +#undef ARG_LOC +#undef NEXTOPER +#undef PREVOPER + #define NODE_ALIGN(node) #define ARG_LOC(p) (((struct regnode_1 *)p)->arg1) #define ARG1_LOC(p) (((struct regnode_2 *)p)->arg1) @@ -182,7 +199,7 @@ struct regnode_charclass_class { /* Flags for node->flags of ANYOF */ -#define ANYOF_CLASS 0x08 +#define ANYOF_CLASS 0x08 /* has [[:blah:]] classes */ #define ANYOF_INVERT 0x04 #define ANYOF_FOLD 0x02 #define ANYOF_LOCALE 0x01 @@ -194,6 +211,9 @@ struct regnode_charclass_class { #define ANYOF_UNICODE 0x20 #define ANYOF_UNICODE_ALL 0x40 /* Can match any char past 0xff */ +/* size of node is large (includes class pointer) */ +#define ANYOF_LARGE 0x80 + /* Are there any runtime flags on in this node? */ #define ANYOF_RUNTIME(s) (ANYOF_FLAGS(s) & 0x0f) @@ -285,10 +305,12 @@ struct regnode_charclass_class { #define EXTRA_SIZE(guy) ((sizeof(guy)-1)/sizeof(struct regnode)) -#define REG_SEEN_ZERO_LEN 1 -#define REG_SEEN_LOOKBEHIND 2 -#define REG_SEEN_GPOS 4 -#define REG_SEEN_EVAL 8 +#define REG_SEEN_ZERO_LEN 1 +#define REG_SEEN_LOOKBEHIND 2 +#define REG_SEEN_GPOS 4 +#define REG_SEEN_EVAL 8 +#define REG_SEEN_CANY 16 +#define REG_SEEN_SANY REG_SEEN_CANY /* src bckwrd cmpt */ START_EXTERN_C @@ -310,7 +332,7 @@ EXTCONST U8 PL_varies[] = { EXTCONST U8 PL_simple[]; #else EXTCONST U8 PL_simple[] = { - REG_ANY, SANY, + REG_ANY, SANY, CANY, ANYOF, ALNUM, ALNUML, NALNUM, NALNUML, @@ -329,6 +351,16 @@ typedef struct re_scream_pos_data_s I32 *scream_pos; /* Internal iterator of scream. */ } re_scream_pos_data; +/* .what is a character array with one character for each member of .data + * The character describes the function of the corresponding .data item: + * f - start-class data for regstclass optimization + * n - Root of op tree for (?{EVAL}) item + * o - Start op for (?{EVAL}) item + * p - Pad for (?{EVAL} item + * s - swash for unicode-style character class + * 20010712 mjd@plover.com + * (Remember to update re_dup() and pregfree() if you add any items.) + */ struct reg_data { U32 count; U8 *what;