pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
RE-flex: Fix support for unicode patterns
Module Name: pkgsrc-wip
Committed By: Malte Dehling <mdehling%gmail.com@localhost>
Pushed By: mdehling
Date: Sat Mar 16 15:45:31 2024 -0700
Changeset: 9467c1d4cef8f0274224c133c275e115aab77625
Modified Files:
RE-flex/Makefile
RE-flex/TODO
RE-flex/distinfo
RE-flex/options.mk
RE-flex/patches/patch-examples_Make
Added Files:
RE-flex/patches/patch-lib_convert.cpp
RE-flex/patches/patch-lib_pattern.cpp
RE-flex/patches/patch-src_reflex.cpp
Log Message:
RE-flex: Fix support for unicode patterns
Fixes GH issue Genivia/RE-flex#198. Patches accepted upstream and
should be in the next release.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=9467c1d4cef8f0274224c133c275e115aab77625
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
RE-flex/Makefile | 1 +
RE-flex/TODO | 1 -
RE-flex/distinfo | 5 +-
RE-flex/options.mk | 2 +
RE-flex/patches/patch-examples_Make | 13 +-
RE-flex/patches/patch-lib_convert.cpp | 132 +++++++++++++++++++
RE-flex/patches/patch-lib_pattern.cpp | 25 ++++
RE-flex/patches/patch-src_reflex.cpp | 233 ++++++++++++++++++++++++++++++++++
8 files changed, 399 insertions(+), 13 deletions(-)
diffs:
diff --git a/RE-flex/Makefile b/RE-flex/Makefile
index 1f0d68b237..125790c4c8 100644
--- a/RE-flex/Makefile
+++ b/RE-flex/Makefile
@@ -1,6 +1,7 @@
# $NetBSD$
DISTNAME= RE-flex-4.1.1
+PKGREVISION= 1
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GITHUB:=Genivia/}
GITHUB_TAG= v${PKGVERSION_NOREV}
diff --git a/RE-flex/TODO b/RE-flex/TODO
index a82dcff8e4..2bf97e3738 100644
--- a/RE-flex/TODO
+++ b/RE-flex/TODO
@@ -1,3 +1,2 @@
- fix documentation (investigate doxygen issues)
-- fix examples/braille build (unicode issue?)
- add tests option?
diff --git a/RE-flex/distinfo b/RE-flex/distinfo
index ad0b2c7489..2b552f0ebd 100644
--- a/RE-flex/distinfo
+++ b/RE-flex/distinfo
@@ -3,9 +3,12 @@ $NetBSD$
BLAKE2s (RE-flex-4.1.1.tar.gz) = 8a1ffaa6146926e1ba24587d55a29607023041ae36f851aec4c6151c297450c9
SHA512 (RE-flex-4.1.1.tar.gz) = 277540226c251af2c190435e71b77a946ec5eaf256c0798982245179152cfe319f9686c563fa1dca6bd8dc5b8bd052bdb1f0ba8f3a2af96f9135e068bdc19626
Size (RE-flex-4.1.1.tar.gz) = 6599405 bytes
-SHA1 (patch-examples_Make) = 4b8063bfc0119ec69ffd782a4cb21e1bbbdfe55e
+SHA1 (patch-examples_Make) = 2e7a07f62cf80ef502cb76b8cdb980c7a2d0773b
SHA1 (patch-examples_gz.l) = 09e92adbd4f6aa0b8fa358d6c0fc4778a67209fd
SHA1 (patch-examples_lua.hpp) = adbd495c9818d4feff9a9454ddc1402a2a6aa859
SHA1 (patch-examples_minic.hpp) = bf914d2ca8b9e1bf22dfd339c4be2b5dde1f8852
SHA1 (patch-lib_Makefile.in) = 88346027298afc3a8f92fca9d44e077297bd5b79
+SHA1 (patch-lib_convert.cpp) = cf5dc968fb89d04bdffbcc195b8c23523859c175
+SHA1 (patch-lib_pattern.cpp) = b76731e862a021d334bc6bb9fbbb696a82f5333d
SHA1 (patch-src_Makefile.in) = 504f8e3d7532b5dd26ae7793662c309597015527
+SHA1 (patch-src_reflex.cpp) = 53ae6072b3bdda8334e6c6f1a621b8a5b7e45a17
diff --git a/RE-flex/options.mk b/RE-flex/options.mk
index 52047797a9..053172f28b 100644
--- a/RE-flex/options.mk
+++ b/RE-flex/options.mk
@@ -52,6 +52,8 @@ SUBST_CLASSES+= path
SUBST_FILES.path= examples/Make
SUBST_MESSAGE.path= Updating paths.
SUBST_STAGE.path= pre-install
+SUBST_SED.path+= -e 's|@CC@|${CC}|g'
+SUBST_SED.path+= -e 's|@CXX@|${CXX}|g'
SUBST_SED.path+= -e 's|@PREFIX@|${PREFIX}|g'
.PHONY: post-install-examples
diff --git a/RE-flex/patches/patch-examples_Make b/RE-flex/patches/patch-examples_Make
index 433f92fe38..0e1c6b5f8f 100644
--- a/RE-flex/patches/patch-examples_Make
+++ b/RE-flex/patches/patch-examples_Make
@@ -34,8 +34,8 @@ build examples out of tree and assume pkgsrc for dependencies
+# url_pcre2 and wc_pcre2 require devel/pcre2
+# > make pcre2examples
+
-+CC = /usr/bin/gcc
-+CXX = /usr/bin/g++
++CC = @CC@
++CXX = @CXX@
+
+CFLAGS = -O2 -I. -I@PREFIX@/include -Wall -Wunused -Wextra #-DDEBUG
+CXXFLAGS = $(CFLAGS) -fpermissive
@@ -76,15 +76,6 @@ build examples out of tree and assume pkgsrc for dependencies
.PHONY: examples examplesxx examples3.2 boostexamples pcre2examples
-@@ -85,7 +67,7 @@ examples: flexexample1 \
- indent2 \
- json \
- yaml \
-- braille \
-+ #braille \
- unicode \
- csv \
- scanstrings \
@@ -135,7 +117,7 @@ flexexample2: flexexample2.l
flexexample3: flexexample3.l flexexample3.y
$(YACC) -d flexexample3.y
diff --git a/RE-flex/patches/patch-lib_convert.cpp b/RE-flex/patches/patch-lib_convert.cpp
new file mode 100644
index 0000000000..c7628e7cfd
--- /dev/null
+++ b/RE-flex/patches/patch-lib_convert.cpp
@@ -0,0 +1,132 @@
+$NetBSD$
+
+cast chars to unsigned for ctype functions
+
+--- lib/convert.cpp.orig 2024-03-16 22:11:51.956647653 +0000
++++ lib/convert.cpp
+@@ -283,7 +283,7 @@ static int convert_hex(const char *patte
+ size_t n = pos + 3;
+ if (c == 'u')
+ n += 2;
+- while (k < n && k < len && std::isxdigit(c = pattern[k++]))
++ while (k < n && k < len && std::isxdigit(static_cast<unsigned char>(c = pattern[k++])))
+ *s++ = c;
+ *s = '\0';
+ --k;
+@@ -337,7 +337,7 @@ static const std::string& expand(const s
+ {
+ // lookup {name} and expand without converting
+ size_t k = pos++;
+- while (pos < len && (std::isalnum(pattern[pos]) || pattern[pos] == '_' || (pattern[pos] & 0x80) == 0x80))
++ while (pos < len && (std::isalnum(static_cast<unsigned char>(pattern[pos])) || pattern[pos] == '_' || (pattern[pos] & 0x80) == 0x80))
+ ++pos;
+ if (pos >= len || (pattern[pos] == '\\' ? pattern[pos + 1] != '}' : pattern[pos] != '}'))
+ throw regex_error(regex_error::undefined_name, pattern, pos);
+@@ -501,7 +501,7 @@ static void expand_list(const char *patt
+ else if ((c & 0xC0) == 0xC0 && is_modified(mod, 'u'))
+ {
+ // Unicode normalization may need to combine a previous ASCII character with a Unicode combining character
+- if (loc < pos && std::isalpha(pattern[pos - 1]))
++ if (loc < pos && std::isalpha(static_cast<unsigned char>(pattern[pos - 1])))
+ --pos;
+ regex.append(&pattern[loc], pos - loc);
+ const char *s = &pattern[pos];
+@@ -551,7 +551,7 @@ static void insert_escape_class(const ch
+ wc = Posix::range(name);
+ if (wc == NULL)
+ throw regex_error(regex_error::invalid_class, pattern, pos);
+- if (std::islower(c))
++ if (std::islower(static_cast<unsigned char>(c)))
+ {
+ if (wc[0] <= '\n' && wc[1] >= '\n' && (flags & convert_flag::notnewline))
+ {
+@@ -745,7 +745,7 @@ static int insert_escape(const char *pat
+ pos = k;
+ return -1;
+ }
+- else if (std::isalpha(c))
++ else if (std::isalpha(static_cast<unsigned char>(c)))
+ {
+ const char *s = std::strchr(regex_abtnvfr, c);
+ if (s == NULL)
+@@ -1094,7 +1094,7 @@ static void convert_escape_char(const ch
+ else if (std::strchr(regex_meta, c) == NULL)
+ {
+ char buf[3] = { '^', static_cast<char>(lowercase(c)), '\0' };
+- bool invert = std::isupper(c) != 0;
++ bool invert = std::isupper(static_cast<unsigned char>(c)) != 0;
+ if (c == 'n' || (invert && strchr("DHLUWX", c) != NULL))
+ nl = true;
+ const char *name = buf + !invert;
+@@ -1286,7 +1286,7 @@ static void convert_escape(const char *p
+ throw regex_error(regex_error::invalid_escape, pattern, pos);
+ if (wc == '\n')
+ nl = true;
+- if (std::isalpha(wc) && is_modified(mod, 'i'))
++ if (std::isalpha(static_cast<unsigned char>(wc)) && is_modified(mod, 'i'))
+ {
+ // anycase: translate A to [Aa]
+ regex.append(&pattern[loc], pos - loc - 1).push_back('[');
+@@ -1335,7 +1335,7 @@ static void convert_escape(const char *p
+ if (wc <= 0xFF)
+ {
+ // translate \u{X}, \u00XX (convert_flag::u4) and \x{X} to \xXX
+- if (std::isalpha(wc) && is_modified(mod, 'i'))
++ if (std::isalpha(static_cast<unsigned char>(wc)) && is_modified(mod, 'i'))
+ {
+ // anycase: translate A to [Aa]
+ regex.append(&pattern[loc], pos - loc - 1).push_back('[');
+@@ -1498,7 +1498,7 @@ std::string convert(const char *pattern,
+ mods.push_back('m');
+ size_t k = 2;
+ bool invert = false;
+- while (k < len && (pattern[k] == '-' || std::isalpha(pattern[k])))
++ while (k < len && (pattern[k] == '-' || std::isalpha(static_cast<unsigned char>(pattern[k]))))
+ {
+ if (pattern[k] == '-')
+ {
+@@ -1711,7 +1711,7 @@ std::string convert(const char *pattern,
+ std::string mods, unmods;
+ size_t k = pos;
+ bool invert = false;
+- while (k < len && (pattern[k] == '-' || std::isalnum(pattern[k])))
++ while (k < len && (pattern[k] == '-' || std::isalnum(static_cast<unsigned char>(pattern[k]))))
+ {
+ if (pattern[k] == '-')
+ {
+@@ -2006,7 +2006,7 @@ std::string convert(const char *pattern,
+ }
+ else
+ {
+- if (macros != NULL && pos + 1 < len && (std::isalpha(pattern[pos + 1]) || pattern[pos + 1] == '_' || pattern[pos + 1] == '$' || (pattern[pos + 1] & 0x80) == 0x80))
++ if (macros != NULL && pos + 1 < len && (std::isalpha(static_cast<unsigned char>(pattern[pos + 1])) || pattern[pos + 1] == '_' || pattern[pos + 1] == '$' || (pattern[pos + 1] & 0x80) == 0x80))
+ {
+ // if macros are provided: lookup {name} and expand without converting
+ regex.append(&pattern[loc], pos - loc);
+@@ -2039,7 +2039,7 @@ std::string convert(const char *pattern,
+ if (beg)
+ throw regex_error(regex_error::empty_expression, pattern, pos);
+ ++pos;
+- if (pos >= len || !std::isdigit(pattern[pos]))
++ if (pos >= len || !std::isdigit(static_cast<unsigned char>(pattern[pos])))
+ throw regex_error(regex_error::invalid_repeat, pattern, pos);
+ char *s;
+ size_t n = static_cast<size_t>(std::strtoul(&pattern[pos], &s, 10));
+@@ -2204,7 +2204,7 @@ std::string convert(const char *pattern,
+ beg = false;
+ break;
+ default:
+- if (std::isalpha(pattern[pos]))
++ if (std::isalpha(static_cast<unsigned char>(pattern[pos])))
+ {
+ if (is_modified(mod, 'i'))
+ {
+@@ -2219,7 +2219,7 @@ std::string convert(const char *pattern,
+ else if ((c & 0xC0) == 0xC0 && is_modified(mod, 'u'))
+ {
+ // Unicode normalization may need to combine a previous ASCII character with a Unicode combining character
+- if (loc < pos && std::isalpha(pattern[pos - 1]))
++ if (loc < pos && std::isalpha(static_cast<unsigned char>(pattern[pos - 1])))
+ --pos;
+ regex.append(&pattern[loc], pos - loc);
+ const char *s = &pattern[pos];
diff --git a/RE-flex/patches/patch-lib_pattern.cpp b/RE-flex/patches/patch-lib_pattern.cpp
new file mode 100644
index 0000000000..572dd12779
--- /dev/null
+++ b/RE-flex/patches/patch-lib_pattern.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+- cast chars to unsigned for ctype functions
+- fix debug log statement
+
+--- lib/pattern.cpp.orig 2024-03-16 22:12:13.189685354 +0000
++++ lib/pattern.cpp
+@@ -537,7 +537,7 @@ void Pattern::init_options(const char *o
+ case 'z':
+ for (const char *t = s += (s[1] == '='); *s != ';' && *s != '\0'; ++t)
+ {
+- if (std::isspace(*t) || *t == ';' || *t == '\0')
++ if (std::isspace(static_cast<unsigned char>(*t)) || *t == ';' || *t == '\0')
+ {
+ if (t > s + 1)
+ opt_.z = std::string(s + 1, t - s - 1);
+@@ -4414,7 +4414,7 @@ void Pattern::gen_match_hfa_start(DFA::S
+ hfa_.states[start->index].insert(next_state->index);
+ Char lo = edge->first;
+ Char hi = edge->second.first;
+- DBGLOG("0 HFA %p: %u..%u -> %p", state, lo, hi, next_state);
++ DBGLOG("0 HFA %p: %u..%u -> %p", start, lo, hi, next_state);
+ hashes[next_state][0].insert(lo, hi);
+ }
+ }
diff --git a/RE-flex/patches/patch-src_reflex.cpp b/RE-flex/patches/patch-src_reflex.cpp
new file mode 100644
index 0000000000..f3773f55f0
--- /dev/null
+++ b/RE-flex/patches/patch-src_reflex.cpp
@@ -0,0 +1,233 @@
+$NetBSD$
+
+cast chars to unsigned for ctype functions
+
+--- src/reflex.cpp.orig 2024-03-16 22:12:32.810243725 +0000
++++ src/reflex.cpp
+@@ -274,10 +274,10 @@ static const Reflex::Library library_tab
+ ////////////////////////////////////////////////////////////////////////////////
+
+ /// Convert to lower case
+-inline int lower(int c)
++inline char char_tolower(char c)
+ /// @returns lower case char
+ {
+- return std::isalpha(c) ? (c | 0x20) : c;
++ return static_cast<char>(std::isalpha(static_cast<unsigned char>(c)) ? (c | 0x20) : c);
+ }
+
+ /// Add file extension if not present, modifies the string argument and returns a copy
+@@ -778,7 +778,7 @@ bool Reflex::get_line()
+ line.push_back(c);
+ }
+ linelen = line.length();
+- while (linelen > 0 && std::isspace(line.at(linelen - 1)))
++ while (linelen > 0 && std::isspace(static_cast<unsigned char>(line.at(linelen - 1))))
+ --linelen;
+ line.resize(linelen);
+ if (in.eof() && line.empty())
+@@ -828,7 +828,7 @@ bool Reflex::skip_comment(size_t& pos)
+ /// Match case-insensitive string s while ignoring the rest of the line, return true if OK
+ bool Reflex::is(const char *s)
+ {
+- for (size_t pos = 0; pos < linelen && *s != '\0' && lower(line.at(pos)) == *s; ++pos, ++s)
++ for (size_t pos = 0; pos < linelen && *s != '\0' && char_tolower(line.at(pos)) == *s; ++pos, ++s)
+ continue;
+ return *s == '\0';
+ }
+@@ -837,9 +837,9 @@ bool Reflex::is(const char *s)
+ bool Reflex::ins(const char *s)
+ {
+ size_t pos = 0;
+- while (pos < linelen && std::isspace(line.at(pos)))
++ while (pos < linelen && std::isspace(static_cast<unsigned char>(line.at(pos))))
+ ++pos;
+- while (pos < linelen && *s != '\0' && lower(line.at(pos)) == *s)
++ while (pos < linelen && *s != '\0' && char_tolower(line.at(pos)) == *s)
+ {
+ ++pos;
+ ++s;
+@@ -852,17 +852,17 @@ bool Reflex::br(size_t pos, const char *
+ {
+ if (s != NULL)
+ {
+- if (pos >= linelen || *s == '\0' || lower(line.at(pos)) != *s++)
++ if (pos >= linelen || *s == '\0' || char_tolower(line.at(pos)) != *s++)
+ return false;
+- while (++pos < linelen && *s != '\0' && lower(line.at(pos)) == *s++)
++ while (++pos < linelen && *s != '\0' && char_tolower(line.at(pos)) == *s++)
+ continue;
+ }
+- while (pos < linelen && std::isspace(line.at(pos)))
++ while (pos < linelen && std::isspace(static_cast<unsigned char>(line.at(pos))))
+ ++pos;
+ if (pos >= linelen || line.at(pos) != '{')
+ return false;
+ ++pos;
+- while (pos < linelen && std::isspace(line.at(pos)))
++ while (pos < linelen && std::isspace(static_cast<unsigned char>(line.at(pos))))
+ ++pos;
+ if (pos >= linelen)
+ return true;
+@@ -872,9 +872,9 @@ bool Reflex::br(size_t pos, const char *
+ /// Advance pos to match case-insensitive initial part of the string s followed by white space, return true if OK
+ bool Reflex::as(size_t& pos, const char *s)
+ {
+- if (pos >= linelen || *s == '\0' || lower(line.at(pos)) != *s++)
++ if (pos >= linelen || *s == '\0' || char_tolower(line.at(pos)) != *s++)
+ return false;
+- while (++pos < linelen && *s != '\0' && lower(line.at(pos)) == *s++)
++ while (++pos < linelen && *s != '\0' && char_tolower(line.at(pos)) == *s++)
+ continue;
+ return ws(pos);
+ }
+@@ -882,9 +882,9 @@ bool Reflex::as(size_t& pos, const char
+ /// Advance pos over whitespace, returns true if whitespace was found
+ bool Reflex::ws(size_t& pos)
+ {
+- if (pos >= linelen || (pos > 0 && !std::isspace(line.at(pos))))
++ if (pos >= linelen || (pos > 0 && !std::isspace(static_cast<unsigned char>(line.at(pos)))))
+ return false;
+- while (pos < linelen && std::isspace(line.at(pos)))
++ while (pos < linelen && std::isspace(static_cast<unsigned char>(line.at(pos))))
+ ++pos;
+ return true;
+ }
+@@ -903,7 +903,7 @@ bool Reflex::eq(size_t& pos)
+ /// Advance pos to end of line while skipping whitespace, return true if end of line
+ bool Reflex::nl(size_t& pos)
+ {
+- while (pos < linelen && std::isspace(line.at(pos)))
++ while (pos < linelen && std::isspace(static_cast<unsigned char>(line.at(pos))))
+ ++pos;
+ return pos >= linelen;
+ }
+@@ -911,7 +911,7 @@ bool Reflex::nl(size_t& pos)
+ /// Check if current line starts a block of code or a comment
+ bool Reflex::is_code()
+ {
+- return linelen > 0 && ((std::isspace(line.at(0)) && options["freespace"].empty()) || is("%{") || is("//") || is("/*"));
++ return linelen > 0 && ((std::isspace(static_cast<unsigned char>(line.at(0))) && options["freespace"].empty()) || is("%{") || is("//") || is("/*"));
+ }
+
+ /// Check if current line starts a block of %top code
+@@ -941,12 +941,12 @@ bool Reflex::is_begin_code()
+ /// Advance pos over name (letters, digits, ., -, _ or any non-ASCII character > U+007F), return name
+ std::string Reflex::get_name(size_t& pos)
+ {
+- if (pos >= linelen || (!std::isalnum(line.at(pos)) && line.at(pos) != '_' && (line.at(pos) & 0x80) != 0x80))
++ if (pos >= linelen || (!std::isalnum(static_cast<unsigned char>(line.at(pos))) && line.at(pos) != '_' && (line.at(pos) & 0x80) != 0x80))
+ return "";
+ size_t loc = pos++;
+ while (pos < linelen)
+ {
+- if (!std::isalnum(line.at(pos)) && line.at(pos) != '_' && line.at(pos) != '-' && line.at(pos) != '.' && (line.at(pos) & 0x80) != 0x80)
++ if (!std::isalnum(static_cast<unsigned char>(line.at(pos))) && line.at(pos) != '_' && line.at(pos) != '-' && line.at(pos) != '.' && (line.at(pos) & 0x80) != 0x80)
+ break;
+ ++pos;
+ }
+@@ -961,7 +961,7 @@ std::string Reflex::get_namespace(size_t
+ {
+ if (line.at(pos) == ':' && pos + 1 < linelen && line.at(pos + 1) == ':') // parse ::
+ ++pos;
+- else if (!std::isalnum(line.at(pos)) && line.at(pos) != '_' && line.at(pos) != '-' && line.at(pos) != '.' && (line.at(pos) & 0x80) != 0x80)
++ else if (!std::isalnum(static_cast<unsigned char>(line.at(pos))) && line.at(pos) != '_' && line.at(pos) != '-' && line.at(pos) != '.' && (line.at(pos) & 0x80) != 0x80)
+ break;
+ ++pos;
+ }
+@@ -971,14 +971,14 @@ std::string Reflex::get_namespace(size_t
+ /// Advance pos over option name (letters, digits, +/hyphen/underscore), return name
+ std::string Reflex::get_option(size_t& pos)
+ {
+- if (pos >= linelen || !std::isalnum(line.at(pos)))
++ if (pos >= linelen || !std::isalnum(static_cast<unsigned char>(line.at(pos))))
+ return "";
+ size_t loc = pos++;
+ while (pos < linelen)
+ {
+ if (line.at(pos) == '-' || line.at(pos) == '+') // normalize - and + to _
+ line[pos] = '_';
+- else if (!std::isalnum(line.at(pos)) && line.at(pos) != '_')
++ else if (!std::isalnum(static_cast<unsigned char>(line.at(pos))) && line.at(pos) != '_')
+ break;
+ ++pos;
+ }
+@@ -995,7 +995,7 @@ std::string Reflex::get_start(size_t& po
+ {
+ if (line.at(pos) == '-') // normalize - to _
+ line[pos] = '_';
+- else if (!std::isalnum(line.at(pos)) && line.at(pos) != '_' && (line.at(pos) & 0x80) != 0x80)
++ else if (!std::isalnum(static_cast<unsigned char>(line.at(pos))) && line.at(pos) != '_' && (line.at(pos) & 0x80) != 0x80)
+ break;
+ ++pos;
+ }
+@@ -1047,7 +1047,7 @@ bool Reflex::get_pattern(size_t& pos, st
+ if (fsp)
+ {
+ if (nsp < pos && (
+- (c == '{' && (pos + 1 == linelen || line.at(pos + 1) == '}' || std::isspace(line.at(pos + 1)))) ||
++ (c == '{' && (pos + 1 == linelen || line.at(pos + 1) == '}' || std::isspace(static_cast<unsigned char>(line.at(pos + 1))))) ||
+ (c == '|' && pos + 1 == linelen) ||
+ (c == '/' && pos + 1 < linelen && (line.at(pos + 1) == '/' || line.at(pos + 1) == '*'))))
+ {
+@@ -1055,7 +1055,7 @@ bool Reflex::get_pattern(size_t& pos, st
+ break;
+ }
+ }
+- else if (std::isspace(c))
++ else if (std::isspace(static_cast<unsigned char>(c)))
+ {
+ break;
+ }
+@@ -1134,7 +1134,7 @@ bool Reflex::get_pattern(size_t& pos, st
+ ++pos;
+ }
+ }
+- if (fsp && !std::isspace(c))
++ if (fsp && !std::isspace(static_cast<unsigned char>(c)))
+ nsp = pos;
+ }
+ pattern.append(line.substr(loc, pos - loc));
+@@ -1239,7 +1239,7 @@ std::string Reflex::get_code(size_t& pos
+ }
+ else
+ {
+- if (blk == 0 && lev == 0 && linelen > 0 && (!std::isspace(line.at(0)) || !options["freespace"].empty()))
++ if (blk == 0 && lev == 0 && linelen > 0 && (!std::isspace(static_cast<unsigned char>(line.at(0))) || !options["freespace"].empty()))
+ return code;
+ code.append("\n").append(line);
+ }
+@@ -1312,8 +1312,8 @@ std::string Reflex::upper_name(const std
+ std::string t;
+ for (size_t i = 0; i < s.size(); ++i)
+ {
+- if (std::isalnum(s.at(i)))
+- t.push_back(std::toupper(s.at(i)));
++ if (std::isalnum(static_cast<unsigned char>(s.at(i))))
++ t.push_back(static_cast<char>(std::toupper(static_cast<unsigned char>(s.at(i)))));
+ else
+ t.push_back('_');
+ }
+@@ -1337,11 +1337,11 @@ std::string Reflex::param_args(const std
+ if (i <= from)
+ i = to;
+ while (--i > from)
+- if (!std::isspace(params.at(i)))
++ if (!std::isspace(static_cast<unsigned char>(params.at(i))))
+ break;
+ size_t j = i++;
+ while (--i > from)
+- if (!std::isalnum(params.at(i)) && params.at(i) != '_')
++ if (!std::isalnum(static_cast<unsigned char>(params.at(i))) && params.at(i) != '_')
+ break;
+ if (!args.empty())
+ args.append(", ");
+@@ -1355,7 +1355,7 @@ std::string Reflex::param_args(const std
+ bool Reflex::get_starts(size_t& pos, Starts& starts)
+ {
+ pos = 0;
+- if (linelen > 1 && line.at(0) == '<' && (std::isalpha(line.at(1)) || line.at(1) == '_' || line.at(1) == '*' || (line.at(1) & 0x80) == 0x80 || line.at(1) == '^') && line.find('>') != std::string::npos)
++ if (linelen > 1 && line.at(0) == '<' && (std::isalpha(static_cast<unsigned char>(line.at(1))) || line.at(1) == '_' || line.at(1) == '*' || (line.at(1) & 0x80) == 0x80 || line.at(1) == '^') && line.find('>') != std::string::npos)
+ {
+ do
+ {
Home |
Main Index |
Thread Index |
Old Index