| 1 |
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 |
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
| 3 |
/* This Source Code Form is subject to the terms of the Mozilla Public |
| 4 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 6 |
|
| 7 |
#include "mozilla/JSONWriter.h" |
| 8 |
|
| 9 |
namespace mozilla { |
| 10 |
namespace detail { |
| 11 |
|
| 12 |
// The chars with non-'___' entries in this table are those that can be |
| 13 |
// represented with a two-char escape sequence. The value is the second char in |
| 14 |
// the sequence, that which follows the initial backslash. |
| 15 |
#define ___ 0 |
| 16 |
const char gTwoCharEscapes[256] = { |
| 17 |
/* 0 1 2 3 4 5 6 7 8 9 */ |
| 18 |
/* 0+ */ ___, ___, ___, ___, ___, ___, ___, ___, 'b', 't', |
| 19 |
/* 10+ */ 'n', ___, 'f', 'r', ___, ___, ___, ___, ___, ___, |
| 20 |
/* 20+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 21 |
/* 30+ */ ___, ___, ___, ___, '"', ___, ___, ___, ___, ___, |
| 22 |
/* 40+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 23 |
/* 50+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 24 |
/* 60+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 25 |
/* 70+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 26 |
/* 80+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 27 |
/* 90+ */ ___, ___, '\\', ___, ___, ___, ___, ___, ___, ___, |
| 28 |
/* 100+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 29 |
/* 110+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 30 |
/* 120+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 31 |
/* 130+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 32 |
/* 140+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 33 |
/* 150+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 34 |
/* 160+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 35 |
/* 170+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 36 |
/* 180+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 37 |
/* 190+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 38 |
/* 200+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 39 |
/* 210+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 40 |
/* 220+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 41 |
/* 230+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 42 |
/* 240+ */ ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, |
| 43 |
/* 250+ */ ___, ___, ___, ___, ___, ___}; |
| 44 |
#undef ___ |
| 45 |
|
| 46 |
} // namespace detail |
| 47 |
} // namespace mozilla |