aboutsummaryrefslogtreecommitdiffstats
path: root/awk.h
diff options
context:
space:
mode:
Diffstat (limited to 'awk.h')
-rw-r--r--awk.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/awk.h b/awk.h
index 4cc3b487..df901190 100644
--- a/awk.h
+++ b/awk.h
@@ -267,6 +267,7 @@ 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 */
@@ -1817,6 +1818,9 @@ 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)
)
@@ -1843,6 +1847,9 @@ 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);
}
@@ -1867,7 +1874,7 @@ force_number(NODE *n)
static inline NODE *
fixtype(NODE *n)
{
- assert(n->type == Node_val);
+ assert(n->type == Node_val || n->type == Node_typedregex);
if (n->type == Node_val) {
if ((n->flags & MAYBE_NUM) != 0)
return force_number(n);