diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2017-02-28 21:50:44 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2017-02-28 21:50:44 +0100 |
| commit | c029d90d1975e124d237605f1edb2be16bd05b5d (patch) | |
| tree | 9df87ffb365354bdb74a969440b32c8304bdbcb7 /src/character.cc | |
Initial commit
Diffstat (limited to 'src/character.cc')
| -rw-r--r-- | src/character.cc | 31 |
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; +} |
