summaryrefslogtreecommitdiff
path: root/src/character.cc
blob: 98166eea45d41f70569c5738c413ac0fc2dfea21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
}