aboutsummaryrefslogtreecommitdiffstats
path: root/awk.h
diff options
context:
space:
mode:
Diffstat (limited to 'awk.h')
-rw-r--r--awk.h15
1 files changed, 4 insertions, 11 deletions
diff --git a/awk.h b/awk.h
index df901190..cc487c3a 100644
--- a/awk.h
+++ b/awk.h
@@ -267,7 +267,6 @@ typedef enum nodevals {
Node_val, /* node is a value - type in flags */
Node_regex, /* a regexp, text, compiled, flags, etc */
Node_dynregex, /* a dynamic regexp */
- Node_typedregex, /* like Node_regex, but is a real type */
/* symbol table values */
Node_var, /* scalar variable, lnode is value */
@@ -385,6 +384,7 @@ typedef struct exp_node {
int idx;
wchar_t *wsp;
size_t wslen;
+ Regexp *preg;
} val;
} sub;
NODETYPE type;
@@ -461,6 +461,7 @@ typedef struct exp_node {
* See cint_array.c */
# define XARRAY 0x20000
# define NUMCONSTSTR 0x40000 /* have string value for numeric constant */
+# define REGEX 0x80000 /* this is a typed regex */
} NODE;
#define vname sub.nodep.name
@@ -508,6 +509,7 @@ typedef struct exp_node {
#else
#define numbr sub.val.fltnum
#endif
+#define tre_regs sub.val.preg
/*
* If stfmt is set to STFMT_UNUSED, it means that the string representation
@@ -1818,9 +1820,6 @@ dupnode(NODE *n)
static inline NODE *
force_string(NODE *s)
{
- if (s->type == Node_typedregex)
- return dupnode(s->re_exp);
-
if ((s->flags & STRCUR) != 0
&& (s->stfmt == STFMT_UNUSED || s->stfmt == CONVFMTidx)
)
@@ -1847,9 +1846,6 @@ unref(NODE *r)
static inline NODE *
force_number(NODE *n)
{
- if (n->type == Node_typedregex)
- return Nnull_string;
-
return (n->flags & NUMCUR) != 0 ? n : str2number(n);
}
@@ -1866,15 +1862,12 @@ force_number(NODE *n)
* It is safe to assume that the return value will be the same NODE,
* since force_number on a MAYBE_NUM should always return the same NODE,
* and force_string on an INTIND should as well.
- *
- * There is no way to handle a Node_typedregex correctly, so we ignore
- * that case.
*/
static inline NODE *
fixtype(NODE *n)
{
- assert(n->type == Node_val || n->type == Node_typedregex);
+ assert(n->type == Node_val);
if (n->type == Node_val) {
if ((n->flags & MAYBE_NUM) != 0)
return force_number(n);