chromium/third_party/protobuf/src/google/protobuf/util/internal/json_stream_parser.cc

// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc.  All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <google/protobuf/util/internal/json_stream_parser.h>

#include <algorithm>
#include <cctype>
#include <cmath>
#include <memory>
#include <stack>
#include <string>

#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/status.h>
#include <google/protobuf/util/internal/object_writer.h>
#include <google/protobuf/util/internal/json_escaping.h>


namespace google {
namespace protobuf {
namespace util {

namespace converter {

// Number of digits in an escaped UTF-16 code unit ('\\' 'u' X X X X)
static const int kUnicodeEscapedLength =;

static const int kDefaultMaxRecursionDepth =;

// These cannot be constexpr for portability with VS2015.
static const StringPiece kKeywordTrue =;
static const StringPiece kKeywordFalse =;
static const StringPiece kKeywordNull =;

inline bool IsLetter(char c) {}

inline bool IsAlphanumeric(char c) {}

// Indicates a character may not be part of an unquoted key.
inline bool IsKeySeparator(char c) {}

inline void ReplaceInvalidCodePoints(StringPiece str,
                                     const std::string& replacement,
                                     std::string* dst) {}

static bool ConsumeKey(StringPiece* input, StringPiece* key) {}

// Same as 'ConsumeKey', but allows a widened set of key characters.
static bool ConsumeKeyPermissive(StringPiece* input,
                                 StringPiece* key) {}

static bool MatchKey(StringPiece input) {}

JsonStreamParser::JsonStreamParser(ObjectWriter* ow)
    :{}

JsonStreamParser::~JsonStreamParser() {}


util::Status JsonStreamParser::Parse(StringPiece json) {}

util::Status JsonStreamParser::FinishParse() {}

util::Status JsonStreamParser::ParseChunk(StringPiece chunk) {}

bool JsonStreamParser::IsInputAllWhiteSpaces(TokenType type) {}

util::Status JsonStreamParser::RunParser() {}

util::Status JsonStreamParser::ParseValue(TokenType type) {}

util::Status JsonStreamParser::ParseString() {}

util::Status JsonStreamParser::ParseStringHelper() {}

// Converts a unicode escaped character to a decimal value stored in a char32
// for use in UTF8 encoding utility.  We assume that str begins with \uhhhh and
// convert that from the hex number to a decimal value.
//
// There are some security exploits with UTF-8 that we should be careful of:
//   - http://www.unicode.org/reports/tr36/#UTF-8_Exploit
//   - http://sites/intl-eng/design-guide/core-application
util::Status JsonStreamParser::ParseUnicodeEscape() {}

util::Status JsonStreamParser::ParseNumber() {}

util::Status JsonStreamParser::ParseDoubleHelper(const std::string& number,
                                                 NumberResult* result) {}

util::Status JsonStreamParser::ParseNumberHelper(NumberResult* result) {}

util::Status JsonStreamParser::HandleBeginObject() {}

util::Status JsonStreamParser::ParseObjectMid(TokenType type) {}

util::Status JsonStreamParser::ParseEntry(TokenType type) {}

util::Status JsonStreamParser::ParseEntryMid(TokenType type) {}

util::Status JsonStreamParser::HandleBeginArray() {}

util::Status JsonStreamParser::ParseArrayValue(TokenType type) {}

util::Status JsonStreamParser::ParseArrayMid(TokenType type) {}

util::Status JsonStreamParser::ParseTrue() {}

util::Status JsonStreamParser::ParseFalse() {}

util::Status JsonStreamParser::ParseNull() {}

util::Status JsonStreamParser::ParseEmptyNull() {}

bool JsonStreamParser::IsEmptyNullAllowed(TokenType type) {}

util::Status JsonStreamParser::ReportFailure(StringPiece message,
                                             ParseErrorType parse_code) {}

util::Status JsonStreamParser::ReportUnknown(StringPiece message,
                                             ParseErrorType parse_code) {}

util::Status JsonStreamParser::IncrementRecursionDepth(
    StringPiece key) const {}

void JsonStreamParser::SkipWhitespace() {}

void JsonStreamParser::Advance() {}

util::Status JsonStreamParser::ParseKey() {}

JsonStreamParser::TokenType JsonStreamParser::GetNextTokenType() {}

}  // namespace converter
}  // namespace util
}  // namespace protobuf
}  // namespace google