Skip to content

Commit

Permalink
released 6.2.0
Browse files Browse the repository at this point in the history
fix #407
fix #408
update #409
  • Loading branch information
genivia-inc committed Jul 9, 2024
1 parent 2f961aa commit 148290c
Show file tree
Hide file tree
Showing 44 changed files with 519 additions and 597 deletions.
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1616,12 +1616,11 @@ same line, like XOR:
### Search this but not that with -v, -e, -N, -f, -L, -w, -x

-e PATTERN, --regexp=PATTERN
Specify a PATTERN used during the search of the input: an input
line is selected if it matches any of the specified patterns.
Note that longer patterns take precedence over shorter patterns.
This option is most useful when multiple -e options are used to
specify multiple patterns, when a pattern begins with a dash (`-'),
to specify a pattern after option -f or after the FILE arguments.
Specify a PATTERN to search the input. An input line is selected
if it matches any of the specified patterns. This option is useful
when multiple -e options are used to specify multiple patterns, or
when a pattern begins with a dash (`-'), or to specify a pattern
after option -f or after the FILE arguments.
-f FILE, --file=FILE
Read newline-separated patterns from FILE. White space in patterns
is significant. Empty lines in FILE are ignored. If FILE does not
Expand Down Expand Up @@ -4189,11 +4188,10 @@ in markdown:

-e PATTERN, --regexp=PATTERN
Specify a PATTERN to search the input. An input line is selected
if it matches any of the specified patterns. Note that longer
patterns take precedence over shorter patterns. This option is
most useful when multiple -e options are used to specify multiple
patterns, when a pattern begins with a dash (`-'), to specify a
pattern after option -f or after the FILE arguments.
if it matches any of the specified patterns. This option is
useful when multiple -e options are used to specify multiple
patterns, or when a pattern begins with a dash (`-'), or to
specify a pattern after option -f or after the FILE arguments.

--encoding=ENCODING
The encoding format of the input. The default ENCODING is binary
Expand Down Expand Up @@ -5297,7 +5295,7 @@ in markdown:

$ ugrep -e FIXME -f cpp/zap_strings myfile.cpp

Find lines with `FIXME' or `TODO', showing line numberes:
Find lines with `FIXME' or `TODO', showing line numbers:

$ ugrep -n -e FIXME -e TODO myfile.cpp

Expand Down Expand Up @@ -5380,7 +5378,7 @@ in markdown:
$ ugrep --help fuzzy

COPYRIGHT
Copyright (c) 2021-2024 Robert A. van Engelen <[email protected]>
Copyright (c) 2021,2024 Robert A. van Engelen <[email protected]>

ugrep is released under the BSD-3 license. All parts of the software
have reasonable copyright terms permitting free redistribution. This
Expand All @@ -5394,7 +5392,7 @@ in markdown:



ugrep 6.1.0 June 3, 2024 UGREP(1)
ugrep 6.2.0 July 9, 2024 UGREP(1)

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

Expand Down
9 changes: 4 additions & 5 deletions bin/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Binaries for Windows 32-bit and 64-bit ugrep.exe are included in the
repository: building ugrep on Windows takes some serious effort to install and
Binaries for Windows 32-bit and 64-bit ugrep.exe and ugrep-indexer.exe are
included: building ugrep on Windows takes some serious effort to install and
compile PCRE2 and all of the compression libraries together with ugrep with the
proper configuration settings of C++ dev tools.

Visual Studio ugrep.exe build instructions can be found in vs/ugrep/README.txt
proper configuration settings of C++ dev tools. Visual Studio ugrep.exe build
instructions can be found in vs/ugrep/README.txt
6 changes: 0 additions & 6 deletions bin/linux_amd64/README.md

This file was deleted.

Binary file removed bin/linux_amd64/ugrep
Binary file not shown.
Binary file removed bin/linux_amd64/ugrep-indexer
Binary file not shown.
6 changes: 0 additions & 6 deletions bin/linux_arm64/README.md

This file was deleted.

Binary file removed bin/linux_arm64/ugrep
Binary file not shown.
Binary file removed bin/linux_arm64/ugrep-indexer
Binary file not shown.
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.
6 changes: 3 additions & 3 deletions completions/zsh/_ug
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ local matchers='(--extended-regexp --fixed-strings --basic-regexp --perl-regexp
local arguments=(
'(-e --regexp -f --file)1: :_guard "^-*" pattern'
'*: :_files'
{-A,--after-context=-}'[Output NUM lines of trailing context after matching lines]'
{-A,--after-context=-}'[Output NUM lines of trailing context after matching lines]:NUM:( )'
{-a,--text}'[Process a binary file as if it were text]'
{--all,-@}'[Search all files except hidden: cancel previous file and directory search restrictions and cancel --ignore-binary and --ignore-files when specified]'
'(1)*'--and'[Specify additional PATTERN that must match]'
'(1)*'--andnot'[Combines --and --not]'
{-B,--before-context=-}'[Output NUM lines of leading context before matching lines]'
{-B,--before-context=-}'[Output NUM lines of leading context before matching lines]:NUM:( )'
{-b,--byte-offset}'[The offset in bytes of a pattern match is displayed in front of the respective matched line]'
--binary-files=-'[Controls searching and reporting pattern matches in binary files]'
{--bool,-%,-%%}'[Specifies Boolean query patterns]'
--break'[Adds a line break between results from different files]'
{-C,--context=-}'[Output NUM lines of leading and trailing context surrounding each matching line]'
{-C,--context=-}'[Output NUM lines of leading and trailing context surrounding each matching line]:NUM:( )'
{-c,--count}'[Only a count of selected lines is written to standard output]'
{--color,--colour}'[Mark up the matching text with the colors specified with option --colors or the GREP_COLOR or GREP_COLORS environment variable]'
{--colors=-,--colours=-}'[Use COLORS to mark up text]'
Expand Down
6 changes: 3 additions & 3 deletions completions/zsh/_ug+
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ local matchers='(--extended-regexp --fixed-strings --basic-regexp --perl-regexp
local arguments=(
'(-e --regexp -f --file)1: :_guard "^-*" pattern'
'*: :_files'
{-A,--after-context=-}'[Output NUM lines of trailing context after matching lines]'
{-A,--after-context=-}'[Output NUM lines of trailing context after matching lines]:NUM:( )'
{-a,--text}'[Process a binary file as if it were text]'
{--all,-@}'[Search all files except hidden: cancel previous file and directory search restrictions and cancel --ignore-binary and --ignore-files when specified]'
'(1)*'--and'[Specify additional PATTERN that must match]'
'(1)*'--andnot'[Combines --and --not]'
{-B,--before-context=-}'[Output NUM lines of leading context before matching lines]'
{-B,--before-context=-}'[Output NUM lines of leading context before matching lines]:NUM:( )'
{-b,--byte-offset}'[The offset in bytes of a pattern match is displayed in front of the respective matched line]'
--binary-files=-'[Controls searching and reporting pattern matches in binary files]'
{--bool,-%,-%%}'[Specifies Boolean query patterns]'
--break'[Adds a line break between results from different files]'
{-C,--context=-}'[Output NUM lines of leading and trailing context surrounding each matching line]'
{-C,--context=-}'[Output NUM lines of leading and trailing context surrounding each matching line]:NUM:( )'
{-c,--count}'[Only a count of selected lines is written to standard output]'
{--color,--colour}'[Mark up the matching text with the colors specified with option --colors or the GREP_COLOR or GREP_COLORS environment variable]'
{--colors=-,--colours=-}'[Use COLORS to mark up text]'
Expand Down
6 changes: 3 additions & 3 deletions completions/zsh/_ugrep
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ local matchers='(--extended-regexp --fixed-strings --basic-regexp --perl-regexp
local arguments=(
'(-e --regexp -f --file)1: :_guard "^-*" pattern'
'*: :_files'
{-A,--after-context=-}'[Output NUM lines of trailing context after matching lines]'
{-A,--after-context=-}'[Output NUM lines of trailing context after matching lines]:NUM:( )'
{-a,--text}'[Process a binary file as if it were text]'
{--all,-@}'[Search all files except hidden: cancel previous file and directory search restrictions and cancel --ignore-binary and --ignore-files when specified]'
'(1)*'--and'[Specify additional PATTERN that must match]'
'(1)*'--andnot'[Combines --and --not]'
{-B,--before-context=-}'[Output NUM lines of leading context before matching lines]'
{-B,--before-context=-}'[Output NUM lines of leading context before matching lines]:NUM:( )'
{-b,--byte-offset}'[The offset in bytes of a pattern match is displayed in front of the respective matched line]'
--binary-files=-'[Controls searching and reporting pattern matches in binary files]'
{--bool,-%,-%%}'[Specifies Boolean query patterns]'
--break'[Adds a line break between results from different files]'
{-C,--context=-}'[Output NUM lines of leading and trailing context surrounding each matching line]'
{-C,--context=-}'[Output NUM lines of leading and trailing context surrounding each matching line]:NUM:( )'
{-c,--count}'[Only a count of selected lines is written to standard output]'
{--color,--colour}'[Mark up the matching text with the colors specified with option --colors or the GREP_COLOR or GREP_COLORS environment variable]'
{--colors=-,--colours=-}'[Use COLORS to mark up text]'
Expand Down
6 changes: 3 additions & 3 deletions completions/zsh/_ugrep+
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ local matchers='(--extended-regexp --fixed-strings --basic-regexp --perl-regexp
local arguments=(
'(-e --regexp -f --file)1: :_guard "^-*" pattern'
'*: :_files'
{-A,--after-context=-}'[Output NUM lines of trailing context after matching lines]'
{-A,--after-context=-}'[Output NUM lines of trailing context after matching lines]:NUM:( )'
{-a,--text}'[Process a binary file as if it were text]'
{--all,-@}'[Search all files except hidden: cancel previous file and directory search restrictions and cancel --ignore-binary and --ignore-files when specified]'
'(1)*'--and'[Specify additional PATTERN that must match]'
'(1)*'--andnot'[Combines --and --not]'
{-B,--before-context=-}'[Output NUM lines of leading context before matching lines]'
{-B,--before-context=-}'[Output NUM lines of leading context before matching lines]:NUM:( )'
{-b,--byte-offset}'[The offset in bytes of a pattern match is displayed in front of the respective matched line]'
--binary-files=-'[Controls searching and reporting pattern matches in binary files]'
{--bool,-%,-%%}'[Specifies Boolean query patterns]'
--break'[Adds a line break between results from different files]'
{-C,--context=-}'[Output NUM lines of leading and trailing context surrounding each matching line]'
{-C,--context=-}'[Output NUM lines of leading and trailing context surrounding each matching line]:NUM:( )'
{-c,--count}'[Only a count of selected lines is written to standard output]'
{--color,--colour}'[Mark up the matching text with the colors specified with option --colors or the GREP_COLOR or GREP_COLORS environment variable]'
{--colors=-,--colours=-}'[Use COLORS to mark up text]'
Expand Down
2 changes: 1 addition & 1 deletion completions/zsh/compgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $UGREP --help 2>&1 \
| sed -E -e "s/ /'[/" -e "s/\.?$/\]/" \
| sed -E -e "s/--hexdump/--hexdump=-/" -e "s/--sort'/--sort=-'/" -e "s/-Z,--fuzzy/-Z-,--fuzzy=-/" \
| sed -E -e "/\{-D/s/$/:ACTION:(read skip)/" -e "/\{-d/s/$/:ACTION:(read recurse skip)/" \
| sed -E -e "/\{-g/s/$/:GLOB:( )/" -e "/\{-[eMN]/s/$/:PATTERN:( )/" -e "/\{-f/s/$/:FILE:_files/" -e "/\{-J/s/$/:NUM:( )/" -e "/\{-[Km]/s/$/:MIN,MAX:( )/" -e "/\{-O/s/$/:EXT:( )/" \
| sed -E -e "/\{-g/s/$/:GLOB:( )/" -e "/\{-[eMN]/s/$/:PATTERN:( )/" -e "/\{-f/s/$/:FILE:_files/" -e "/\{-[ABCJ]/s/$/:NUM:( )/" -e "/\{-[Km]/s/$/:MIN,MAX:( )/" -e "/\{-O/s/$/:EXT:( )/" \
| sed -E -e "/\{-t/s/$/:TYPES:($TYPES)/" -e "/--encoding/s/$/:ENCODING:($ENCODING)/" \
| sed -E -e "/--hexdump/s/$/:NUM:(1a 2a 4ah 6ah 8ah 1aC1 2aC1 4ahC1 6ahC1 8ahC1)/" \
| sed -E -e "/\{-m/s/$/::(1 1, 1,10)/" \
Expand Down
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 6.1.0.
# Generated by GNU Autoconf 2.72 for ugrep 6.2.0.
#
# 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='6.1.0'
PACKAGE_STRING='ugrep 6.1.0'
PACKAGE_VERSION='6.2.0'
PACKAGE_STRING='ugrep 6.2.0'
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 6.1.0 to adapt to many kinds of systems.
'configure' configures ugrep 6.2.0 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 6.1.0:";;
short | recursive ) echo "Configuration of ugrep 6.2.0:";;
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 6.1.0
ugrep configure 6.2.0
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 6.1.0, which was
It was created by ugrep $as_me 6.2.0, 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='6.1.0'
VERSION='6.2.0'


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 6.1.0, which was
This file was extended by ugrep $as_me 6.2.0, 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 6.1.0
ugrep config.status 6.2.0
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],[6.1.0],[https://github.com/Genivia/ugrep/issues],[ugrep],[https://ugrep.com])
AC_INIT([ugrep],[6.2.0],[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
24 changes: 10 additions & 14 deletions include/reflex/pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,28 +355,28 @@ class Pattern {
return ams_;
}
/// Returns true when match is predicted, based on s[0..3..e-1] (e >= s + 4).
static inline bool predict_match(const Pred pmh[], const char *s, size_t n)
inline bool predict_match(const char *s, size_t n) const
{
Hash h = static_cast<uint8_t>(*s);
Pred f = pmh[h] & 1;
Pred f = pmh_[h] & 1;
h = hash(h, static_cast<uint8_t>(*++s));
f |= pmh[h] & 2;
f |= pmh_[h] & 2;
h = hash(h, static_cast<uint8_t>(*++s));
f |= pmh[h] & 4;
f |= pmh_[h] & 4;
h = hash(h, static_cast<uint8_t>(*++s));
f |= pmh[h] & 8;
f |= pmh_[h] & 8;
const char *e = s + n - 3;
Pred m = 16;
while (f == 0 && ++s < e)
{
h = hash(h, static_cast<uint8_t>(*s));
f = pmh[h] & m;
f = pmh_[h] & m;
m <<= 1;
}
return f == 0;
}
/// Returns zero when match is predicted (removed shift distance return, now just returns 0 or 1).
static inline size_t predict_match(const Pred pma[], const char *s)
/// Returns true when match is predicted using my PM4 logic.
inline bool predict_match(const char *s) const
{
uint8_t b0 = s[0];
uint8_t b1 = s[1];
Expand All @@ -385,13 +385,9 @@ class Pattern {
Hash h1 = hash(b0, b1);
Hash h2 = hash(h1, b2);
Hash h3 = hash(h2, b3);
Pred a0 = pma[b0];
Pred a1 = pma[h1];
Pred a2 = pma[h2];
Pred a3 = pma[h3];
Pred p = (a0 & 0xc0) | (a1 & 0x30) | (a2 & 0x0c) | (a3 & 0x03);
Pred p = (pma_[b0] & 0xc0) | (pma_[h1] & 0x30) | (pma_[h2] & 0x0c) | (pma_[h3] & 0x03);
Pred m = ((((((p >> 2) | p) >> 2) | p) >> 1) | p);
return m == 0xff;
return m != 0xff;
}
/// Relative frequency of English letters with upper/lower-case ratio = 0.0563, punctuation and UTF-8 bytes.
static uint8_t frequency(uint8_t c)
Expand Down
4 changes: 2 additions & 2 deletions include/reflex/pcre2matcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class PCRE2Matcher : public PatternMatcher<std::string> {
template<typename T>
static std::string convert(T regex, convert_flag_type flags = convert_flag::none, bool *multiline = NULL)
{
return reflex::convert(regex, "imPRsx!#<>=&|'(0123456789*:abcdefghnrstvwxzABCDGHKNQRSVWXZ0123456789?+", flags, multiline);
return reflex::convert(regex, "iJmnPRsUx!#<>=&|'(0123456789*:abcdefghnrstvwxzABCDGHKNQRSVWXZ0123456789?+", flags, multiline);
}
/// Default constructor.
PCRE2Matcher()
Expand Down Expand Up @@ -465,7 +465,7 @@ class PCRE2UTFMatcher : public PCRE2Matcher {
template<typename T>
static std::string convert(T regex, convert_flag_type flags = convert_flag::none, bool *multiline = NULL)
{
return reflex::convert(regex, "imPRsx!#<>=&|'(0123456789*:abcdefghknprstvwxzABCDGHKNPQRSVWXZ0123456789?+", flags, multiline);
return reflex::convert(regex, "iJmnPRsUx!#<>=&|'(0123456789*:abcdefghknprstvwxzABCDGHKNPQRSVWXZ0123456789?+", flags, multiline);
}
/// Default constructor.
PCRE2UTFMatcher() : PCRE2Matcher()
Expand Down
4 changes: 3 additions & 1 deletion include/reflex/simd.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
#ifdef _MSC_VER
# define cpuidex __cpuidex
#else
# include <cpuid.h>
# ifndef __cpuid_count
# include <cpuid.h>
# endif
# define cpuidex(CPUInfo, id, subid) __cpuid_count(id, subid, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3])
#endif

Expand Down
5 changes: 4 additions & 1 deletion lib/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,16 @@ std::string regex_error::regex_error_message_code(regex_error_type code, const c

std::string regex_error::regex_error_message(const char *message, const char *pattern, size_t pos)
{
const char *p = strrchr(pattern, '\n');
if (p != NULL)
pattern = p + 1;
size_t l = strlen(pattern);
if (pos > l)
pos = l;
l = strlen(message);
size_t n = pos / 40;
size_t k = pos % 40 + (n == 0 ? 0 : 20);
const char *p = n == 0 ? pattern : pattern + 40 * n - 20;
p = n == 0 ? pattern : pattern + 40 * n - 20;
while (p > pattern && (*p & 0xc0) == 0x80)
{
--p;
Expand Down
2 changes: 1 addition & 1 deletion lib/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

/**
@file input.cpp
@brief RE/flex input character sequence class and simd.h CPUID check
@brief RE/flex input character sequence class
@author Robert van Engelen - [email protected]
@copyright (c) 2016-2020, Robert van Engelen, Genivia Inc. All rights reserved.
@copyright (c) BSD-3 License - see LICENSE.txt
Expand Down
Loading

0 comments on commit 148290c

Please sign in to comment.