diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-09-01 20:47:26 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-09-01 20:47:26 +0300 |
commit | 6400e2ed3ad3eca3d6bc8957820b43f9ee8e0dc6 (patch) | |
tree | 7e19f5c28c54a2b99785dff68274717e7fd73006 /re.c | |
parent | e2607077715b14bc033e62d0203bd34d32b708c2 (diff) | |
parent | b02f580f06996bd88f741f9c7330aff79216a169 (diff) | |
download | egawk-6400e2ed3ad3eca3d6bc8957820b43f9ee8e0dc6.tar.gz egawk-6400e2ed3ad3eca3d6bc8957820b43f9ee8e0dc6.tar.bz2 egawk-6400e2ed3ad3eca3d6bc8957820b43f9ee8e0dc6.zip |
Merge branch 'master' into feature/typed-regex
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -25,10 +25,14 @@ #include "awk.h" +#include "localeinfo.h" + static reg_syntax_t syn; static void check_bracket_exp(char *s, size_t len); const char *regexflags2str(int flags); +static struct localeinfo localeinfo; + /* make_regexp --- generate compiled regular expressions */ Regexp * @@ -223,7 +227,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) rp->pat.newline_anchor = false; /* don't get \n in middle of string */ if (dfa && ! no_dfa) { rp->dfareg = dfaalloc(); - dfasyntax(rp->dfareg, dfa_syn, ignorecase, '\n'); + dfasyntax(rp->dfareg, & localeinfo, dfa_syn, ignorecase, '\n'); dfacomp(buf, len, rp->dfareg, true); } else rp->dfareg = NULL; @@ -399,6 +403,9 @@ re_update(NODE *t) void resetup() { + // init localeinfo for dfa + init_localeinfo(& localeinfo); + /* * Syntax bits: _that_ is yet another mind trip. Recreational drugs * are helpful for recovering from the experience. @@ -422,8 +429,14 @@ resetup() syn |= RE_INTERVALS | RE_INVALID_INTERVAL_ORD | RE_NO_BK_BRACES; (void) re_set_syntax(syn); +} + +/* using_utf8 --- are we using utf8 */ - dfa_init(); +bool +using_utf8(void) +{ + return localeinfo.using_utf8; } /* reisstring --- return true if the RE match is a simple string match */ |