diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-08-03 21:38:50 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-08-03 21:38:50 +0300 |
commit | f591d307d9af95bfa0ccda4d5eb76a674447ba39 (patch) | |
tree | 65c8e2259634653566fc2c49ec996ff416330361 /awk.h | |
parent | 9907a598dca8f129422c42f8c4fa3b4e2c988221 (diff) | |
download | egawk-f591d307d9af95bfa0ccda4d5eb76a674447ba39.tar.gz egawk-f591d307d9af95bfa0ccda4d5eb76a674447ba39.tar.bz2 egawk-f591d307d9af95bfa0ccda4d5eb76a674447ba39.zip |
Restore typed regexp code in a new branch.
Diffstat (limited to 'awk.h')
-rw-r--r-- | awk.h | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -264,6 +264,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 */ @@ -1804,6 +1805,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) ) @@ -1830,6 +1834,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); } @@ -1854,7 +1861,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); |