diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-03-11 22:50:11 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-03-11 22:50:11 +0200 |
commit | 891b30a5417f93c3fc5e5aa4d54e270282bea380 (patch) | |
tree | 149a8e67e1df432845988a04669f677a77392d25 /re.c | |
parent | 840661815d5063942b4475a908af423cf6bc813c (diff) | |
parent | a7c502a756732ec9a1773d6169376bb7b25f4308 (diff) | |
download | egawk-891b30a5417f93c3fc5e5aa4d54e270282bea380.tar.gz egawk-891b30a5417f93c3fc5e5aa4d54e270282bea380.tar.bz2 egawk-891b30a5417f93c3fc5e5aa4d54e270282bea380.zip |
Merge branch 'gawk-4.0-stable'
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -559,8 +559,22 @@ again: if (*sp == '[') count++; - else if (*sp == ']') - count--; + /* + * ] as first char after open [ is skipped + * \] is skipped + * [^]] is skipped + */ + if (*sp == ']' && sp > sp2) { + if (sp[-1] != '[' + && sp[-1] != '\\') + ; + else if ((sp - sp2) >= 2 + && sp[-1] == '^' && sp[-2] == '[') + ; + else + count--; + } + if (*sp == '-' && do_lint && ! range_warned && count == 1 && sp[-1] != '[' && sp[1] != ']' && ! isdigit((unsigned char) sp[-1]) && ! isdigit((unsigned char) sp[1]) |