public char scanChar() throws StringScanException {
    int idxSave = idx;
    skipWhiteSpace();
    try {
      if (buf[idx] == '\'') {
        return scanQuotedChar();
      } else {
        return scanUnquotedChar();
      }
    } catch (StringScanException e) {
      idx = idxSave;
      throw e;
    }
  }