summaryrefslogtreecommitdiff
path: root/src/character.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/character.cc')
-rw-r--r--src/character.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/character.cc b/src/character.cc
new file mode 100644
index 0000000..98166ee
--- /dev/null
+++ b/src/character.cc
@@ -0,0 +1,31 @@
+// -*- mode: c++; c-basic-offset: 2; -*-
+
+#include "common.hh"
+
+#include "character.hh"
+
+// static
+bool Character::isspace(std::string const& str, size_t pos) {
+ switch (str[pos]) {
+ case ' ':
+ case '\t':
+ case '\r':
+ case '\n':
+ return true;
+ }
+ return false;
+}
+
+// static
+bool Character::isseparator(std::string const& str, size_t pos) {
+ if (isspace(str, pos)) return true;
+ switch (str[pos]) {
+ case '.':
+ case ':':
+ case '-':
+ case ',':
+ case ';':
+ return true;
+ }
+ return false;
+}