diff options
author | Juergen Kahrs <Juergen.Kahrs@googlemail.com> | 2013-04-28 19:30:52 +0200 |
---|---|---|
committer | Juergen Kahrs <Juergen.Kahrs@googlemail.com> | 2013-04-28 19:30:52 +0200 |
commit | 11c996c675afa475d46834b2b09039097e25afb5 (patch) | |
tree | 8e720e41b15affe811b21d74bddba14c302612fa /re.c | |
parent | 74db9f3cb12c4c45487b8646473daad7d0df641f (diff) | |
parent | 1dd19986291bdd1129ac08eec40d963a65170422 (diff) | |
download | egawk-11c996c675afa475d46834b2b09039097e25afb5.tar.gz egawk-11c996c675afa475d46834b2b09039097e25afb5.tar.bz2 egawk-11c996c675afa475d46834b2b09039097e25afb5.zip |
Merge remote-tracking branch 'origin/master' into cmake
Conflicts:
README_d/ChangeLog
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1991-2012 the Free Software Foundation, Inc. + * Copyright (C) 1991-2013 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -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]) |