Skip to content

Commit

Permalink
released 7.1.1
Browse files Browse the repository at this point in the history
fix #445;
appease -Wshadow warnings in RE/flex library, TUI, and indexer
  • Loading branch information
genivia-inc committed Nov 29, 2024
1 parent 83f45b7 commit be49264
Show file tree
Hide file tree
Showing 22 changed files with 171 additions and 119 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5459,7 +5459,7 @@ in markdown:



ugrep 7.1.0 November 19, 2024 UGREP(1)
ugrep 7.1.1 November 29, 2024 UGREP(1)

🔝 [Back to table of contents](#toc)

Expand Down
Binary file modified bin/win32/ug.exe
Binary file not shown.
Binary file modified bin/win32/ugrep-indexer.exe
Binary file not shown.
Binary file modified bin/win32/ugrep.exe
Binary file not shown.
Binary file modified bin/win64/ug.exe
Binary file not shown.
Binary file modified bin/win64/ugrep-indexer.exe
Binary file not shown.
Binary file modified bin/win64/ugrep.exe
Binary file not shown.
20 changes: 10 additions & 10 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.72 for ugrep 7.1.0.
# Generated by GNU Autoconf 2.72 for ugrep 7.1.1.
#
# Report bugs to <https://github.com/Genivia/ugrep/issues>.
#
Expand Down Expand Up @@ -606,8 +606,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ugrep'
PACKAGE_TARNAME='ugrep'
PACKAGE_VERSION='7.1.0'
PACKAGE_STRING='ugrep 7.1.0'
PACKAGE_VERSION='7.1.1'
PACKAGE_STRING='ugrep 7.1.1'
PACKAGE_BUGREPORT='https://github.com/Genivia/ugrep/issues'
PACKAGE_URL='https://ugrep.com'

Expand Down Expand Up @@ -1382,7 +1382,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
'configure' configures ugrep 7.1.0 to adapt to many kinds of systems.
'configure' configures ugrep 7.1.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1453,7 +1453,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of ugrep 7.1.0:";;
short | recursive ) echo "Configuration of ugrep 7.1.1:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1630,7 +1630,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
ugrep configure 7.1.0
ugrep configure 7.1.1
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2184,7 +2184,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by ugrep $as_me 7.1.0, which was
It was created by ugrep $as_me 7.1.1, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
Expand Down Expand Up @@ -3694,7 +3694,7 @@ fi

# Define the identity of the package.
PACKAGE='ugrep'
VERSION='7.1.0'
VERSION='7.1.1'


printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
Expand Down Expand Up @@ -11790,7 +11790,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by ugrep $as_me 7.1.0, which was
This file was extended by ugrep $as_me 7.1.1, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -11863,7 +11863,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
ugrep config.status 7.1.0
ugrep config.status 7.1.1
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([ugrep],[7.1.0],[https://github.com/Genivia/ugrep/issues],[ugrep],[https://ugrep.com])
AC_INIT([ugrep],[7.1.1],[https://github.com/Genivia/ugrep/issues],[ugrep],[https://ugrep.com])
AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz no-dist-gzip])
AC_CONFIG_HEADERS([config.h])
AC_COPYRIGHT([Copyright (C) 2019-2024 Robert van Engelen, Genivia Inc.])
Expand Down
56 changes: 44 additions & 12 deletions lib/convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static std::string unicode_class(const char *s, int esc, convert_flag_type flags
{
if (wc[0] > 0xDFFF)
{
// exclude U+D800 to U+DFFF
// exclude surrogates U+D800 to U+DFFF
regex.assign(utf8(0x00, 0xD7FF, esc, par, !(flags & convert_flag::permissive))).push_back('|');
if (wc[0] > 0xE000)
regex.append(utf8(0xE000, wc[0] - 1, esc, par, !(flags & convert_flag::permissive))).push_back('|');
Expand All @@ -136,7 +136,7 @@ static std::string unicode_class(const char *s, int esc, convert_flag_type flags
{
if (last <= 0xD800 && wc[0] > 0xDFFF)
{
// exclude U+D800 to U+DFFF
// exclude surrogates U+D800 to U+DFFF
if (last < 0xD800)
regex.append(utf8(last, 0xD7FF, esc, par, !(flags & convert_flag::permissive))).push_back('|');
if (wc[0] > 0xE000)
Expand All @@ -152,7 +152,7 @@ static std::string unicode_class(const char *s, int esc, convert_flag_type flags
{
if (last <= 0xD800)
{
// exclude U+D800 to U+DFFF
// exclude surrogates U+D800 to U+DFFF
if (last < 0xD800)
regex.append(utf8(last, 0xD7FF, esc, par, !(flags & convert_flag::permissive))).push_back('|');
regex.append(utf8(0xE000, 0x10FFFF, esc, par, !(flags & convert_flag::permissive))).push_back('|');
Expand Down Expand Up @@ -402,7 +402,7 @@ static std::string convert_ranges(const char *pattern, size_t pos, ORanges<int>&
{
if (ranges.find('\n') != ranges.end())
nl = true;
if (is_modified(mod, 'i'))
if (is_modified(mod, 'i') || (is_modified(mod, 'a') && is_modified(mod, 'u') && ranges.hi() > 0x7F))
convert_anycase_ranges(ranges);
if (is_modified(mod, 'u') && ranges.hi() > 0x7F)
return convert_unicode_ranges(ranges, flags, signature, par);
Expand Down Expand Up @@ -551,7 +551,7 @@ static void insert_escape_class(const char *pattern, size_t pos, convert_flag_ty
wc = Posix::range(name);
if (wc == NULL)
throw regex_error(regex_error::invalid_class, pattern, pos);
if (std::islower(static_cast<unsigned char>(c)))
if (c >= 'a' && c <= 'z')
{
if (wc[0] <= '\n' && wc[1] >= '\n' && (flags & convert_flag::notnewline))
{
Expand All @@ -573,7 +573,7 @@ static void insert_escape_class(const char *pattern, size_t pos, convert_flag_ty
{
if (last <= 0xD800 && wc[0] > 0xDFFF)
{
// exclude U+D800 to U+DFFF
// exclude surrogates U+D800 to U+DFFF
if (last < 0xD800)
ranges.insert(last, 0xD7FF);
if (wc[0] > 0xE000)
Expand All @@ -590,7 +590,7 @@ static void insert_escape_class(const char *pattern, size_t pos, convert_flag_ty
{
if (last <= 0xD800)
{
// exclude U+D800 to U+DFFF
// exclude surrogates U+D800 to U+DFFF
if (last < 0xD800)
ranges.insert(last, 0xD7FF);
ranges.insert(0xE000, 0x10FFFF);
Expand Down Expand Up @@ -697,7 +697,7 @@ static int insert_escape(const char *pattern, size_t len, size_t& pos, convert_f
{
if (last <= 0xD800 && wc[0] > 0xDFFF)
{
// exclude U+D800 to U+DFFF
// exclude surrogates U+D800 to U+DFFF
if (last < 0xD800)
ranges.insert(last, 0xD7FF);
if (wc[0] > 0xE000)
Expand All @@ -714,7 +714,7 @@ static int insert_escape(const char *pattern, size_t len, size_t& pos, convert_f
{
if (last <= 0xD800)
{
// exclude U+D800 to U+DFFF
// exclude surrogates U+D800 to U+DFFF
if (last < 0xD800)
ranges.insert(last, 0xD7FF);
ranges.insert(0xE000, 0x10FFFF);
Expand Down Expand Up @@ -871,6 +871,9 @@ static void subtract_list(const char *pattern, size_t len, size_t& pos, convert_
{
++pos;
insert_list(pattern, len, pos, flags, mod, subtract, macros);
// always convert case-insensitive Unicode negated character classes (modifier 'a')
if (is_modified(mod, 'a'))
convert_anycase_ranges(subtract);
ranges -= subtract;
}
else if (pattern[pos] == '{' && macros != NULL)
Expand All @@ -881,6 +884,9 @@ static void subtract_list(const char *pattern, size_t len, size_t& pos, convert_
throw regex_error(regex_error::invalid_class_range, pattern, pos);
size_t subpos = 1;
insert_list(list.c_str(), list.size(), subpos, flags, mod, subtract, macros);
// always convert case-insensitive Unicode negated character classes (modifier 'a')
if (is_modified(mod, 'a'))
convert_anycase_ranges(subtract);
ranges -= subtract;
if (subpos + 1 < list.size())
throw regex_error(regex_error::invalid_class_range, pattern, pos);
Expand Down Expand Up @@ -919,7 +925,8 @@ static void extend_list(const char *pattern, size_t len, size_t& pos, convert_fl

static void negate_list(convert_flag_type flags, const std::map<size_t,std::string>& mod, ORanges<int>& ranges)
{
if (is_modified(mod, 'i'))
// always convert case-insensitive Unicode negated character classes (modifier 'a')
if (is_modified(mod, 'a'))
convert_anycase_ranges(ranges);
if (is_modified(mod, 'u'))
{
Expand Down Expand Up @@ -959,6 +966,8 @@ static void insert_list(const char *pattern, size_t len, size_t& pos, convert_fl
c = insert_escape(pattern, len, pos, flags, mod, ranges);
if (range)
{
if (pc >= 'a' && pc <= 'z' && is_modified(mod, 'a'))
pc = lowercase(pc);
if (c == -1 || pc > c)
throw regex_error(regex_error::invalid_class_range, pattern, pos);
ranges.insert(pc, c);
Expand Down Expand Up @@ -1042,6 +1051,8 @@ static void insert_list(const char *pattern, size_t len, size_t& pos, convert_fl
}
if (range)
{
if (pc >= 'a' && pc <= 'z' && is_modified(mod, 'a'))
pc = uppercase(pc);
if (c == -1 || pc > c)
throw regex_error(regex_error::invalid_class_range, pattern, pos);
ranges.insert(pc, c);
Expand Down Expand Up @@ -1098,7 +1109,7 @@ static void convert_escape_char(const char *pattern, size_t len, size_t& loc, si
else if (std::strchr(regex_meta, c) == NULL)
{
char buf[3] = { '^', static_cast<char>(lowercase(c)), '\0' };
bool invert = std::isupper(static_cast<unsigned char>(c)) != 0;
bool invert = (c >= 'A' && c <= 'Z');
if (c == 'n' || (invert && strchr("DHLUWX", c) != NULL))
nl = true;
const char *name = buf + !invert;
Expand Down Expand Up @@ -1512,6 +1523,8 @@ std::string convert(const char *pattern, const char *signature, convert_flag_typ
{
if (supports_modifier(signature, pattern[k]))
{
if (pattern[k] == 'i')
mod[lev].push_back('a'); // convert case-insensitive Unicode negated character classes
mods.push_back(pattern[k]);
}
else if (pattern[k] == 'm')
Expand All @@ -1526,11 +1539,19 @@ std::string convert(const char *pattern, const char *signature, convert_flag_typ
else
{
if (supports_modifier(signature, pattern[k]))
{
if (pattern[k] == 'i')
mod[lev].push_back('A');
unmods.push_back(pattern[k]);
}
else if (pattern[k] == 'm')
{
throw regex_error(regex_error::invalid_modifier, pattern, pos);
}
else
{
disable_modifier(pattern[k], pattern, k, mod, lev);
}
}
++k;
}
Expand Down Expand Up @@ -1724,16 +1745,28 @@ std::string convert(const char *pattern, const char *signature, convert_flag_typ
else if (!invert)
{
if (supports_modifier(signature, pattern[k]))
{
if (pattern[k] == 'i')
mod[lev].push_back('a'); // convert case-insensitive Unicode negated character classes
mods.push_back(pattern[k]);
}
else
{
enable_modifier(pattern[k], pattern, k, mod, lev);
}
}
else
{
if (supports_modifier(signature, pattern[k]))
{
if (pattern[k] == 'i')
mod[lev].push_back('A');
unmods.push_back(pattern[k]);
}
else
{
disable_modifier(pattern[k], pattern, k, mod, lev);
}
}
++k;
}
Expand Down Expand Up @@ -2017,7 +2050,6 @@ std::string convert(const char *pattern, const char *signature, convert_flag_typ
++pos;
loc = pos;
const std::string& subregex = expand(macros, pattern, len, pos);
int c;
if ((flags & convert_flag::lex) && pos + 5 < len && pattern[pos + 1] == '{' && ((c = pattern[pos + 2]) == '+' || c == '|' || c == '&' || c == '-') && pattern[pos + 3] == '}')
{
size_t subpos = 0;
Expand Down
6 changes: 3 additions & 3 deletions lib/matcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3451,7 +3451,7 @@ bool Matcher::advance_string_bm(size_t loc)
}
else
{
size_t k = bms[static_cast<uint8_t>(*q)];
k = bms[static_cast<uint8_t>(*q)];
if (p + k > t + bmd)
s += k - (t - p);
else
Expand Down Expand Up @@ -3510,7 +3510,7 @@ bool Matcher::advance_string_bm_pma(size_t loc)
}
else
{
size_t k = bms[static_cast<uint8_t>(*q)];
k = bms[static_cast<uint8_t>(*q)];
if (p + k > t + bmd)
s += k - (t - p);
else
Expand Down Expand Up @@ -3570,7 +3570,7 @@ bool Matcher::advance_string_bm_pmh(size_t loc)
}
else
{
size_t k = bms[static_cast<uint8_t>(*q)];
k = bms[static_cast<uint8_t>(*q)];
if (p + k > t + bmd)
s += k - (t - p);
else
Expand Down
Loading

0 comments on commit be49264

Please sign in to comment.