aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lexlib/CharacterSet.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/lexlib/CharacterSet.h b/lexlib/CharacterSet.h
index 7c2a1fe48..358f6bed3 100644
--- a/lexlib/CharacterSet.h
+++ b/lexlib/CharacterSet.h
@@ -82,10 +82,9 @@ public:
}
void AddString(const char *setToAdd) {
for (const char *cp=setToAdd; *cp; cp++) {
- int val = static_cast<unsigned char>(*cp);
- assert(val >= 0);
- assert(val < size);
- bset[val] = true;
+ const unsigned char uch = *cp;
+ assert(uch < size);
+ bset[uch] = true;
}
}
bool Contains(int val) const {
@@ -93,6 +92,11 @@ public:
if (val < 0) return false;
return (val < size) ? bset[val] : valueAfter;
}
+ bool Contains(char ch) const {
+ // Overload char as char may be signed
+ const unsigned char uch = ch;
+ return Contains(uch);
+ }
};
// Functions for classifying characters