z_01_relax_text_format.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. --- a/src/google/protobuf/map.h (index)
  2. +++ b/src/google/protobuf/map.h (working tree)
  3. @@ -51,7 +51,8 @@
  4. #endif // defined(__cpp_lib_string_view)
  5. #if !defined(GOOGLE_PROTOBUF_NO_RDTSC) && defined(__APPLE__)
  6. -#include <mach/mach_time.h>
  7. +#define GOOGLE_PROTOBUF_NO_RDTSC 1
  8. +//#include <mach/mach_time.h>
  9. #endif
  10. #include <google/protobuf/stubs/common.h>
  11. --- a/src/google/protobuf/text_format.cc (index)
  12. +++ b/src/google/protobuf/text_format.cc (working tree)
  13. @@ -550,13 +550,19 @@
  14. // start with "{" or "<" which indicates the beginning of a message body.
  15. // If there is no ":" or there is a "{" or "<" after ":", this field has
  16. // to be a message or the input is ill-formed.
  17. + bool skip;
  18. if (TryConsumeBeforeWhitespace(":")) {
  19. TryConsumeWhitespace();
  20. if (!LookingAt("{") && !LookingAt("<")) {
  21. - return SkipFieldValue();
  22. + skip = SkipFieldValue();
  23. + } else {
  24. + skip = SkipFieldMessage();
  25. }
  26. + } else {
  27. + skip = SkipFieldMessage();
  28. }
  29. - return SkipFieldMessage();
  30. + TryConsume(";") || TryConsume(",");
  31. + return skip;
  32. }
  33. if (singular_overwrite_policy_ == FORBID_SINGULAR_OVERWRITES) {
  34. --- a/src/google/protobuf/compiler/cpp/helpers.cc
  35. +++ b/src/google/protobuf/compiler/cpp/helpers.cc
  36. @@ -200,7 +200,7 @@ const absl::flat_hash_set<absl::string_view>& Keywords() {
  37. }
  38. TProtoStringType IntTypeName(const Options& options, absl::string_view type) {
  39. - return absl::StrCat("::", type, "_t");
  40. + return absl::StrCat("::NProtoBuf::", type);
  41. }
  42. --- a/src/google/protobuf/io/tokenizer.cc (index)
  43. +++ b/src/google/protobuf/io/tokenizer.cc (working tree)
  44. @@ -704,13 +704,13 @@ bool Tokenizer::Next() {
  45. ConsumeString('\'');
  46. current_.type = TYPE_STRING;
  47. } else {
  48. - // Check if the high order bit is set.
  49. - if (current_char_ & 0x80) {
  50. - error_collector_->RecordError(
  51. - line_, column_,
  52. - absl::StrFormat("Interpreting non ascii codepoint %d.",
  53. - static_cast<unsigned char>(current_char_)));
  54. - }
  55. + // The tokenizer is used to parse tomita grammars with non-ascii utf8 chars
  56. + // if (current_char_ & 0x80) {
  57. + // error_collector_->AddError(
  58. + // line_, column_,
  59. + // StringPrintf("Interpreting non ascii codepoint %d.",
  60. + // static_cast<unsigned char>(current_char_)));
  61. + // }
  62. NextChar();
  63. current_.type = TYPE_SYMBOL;
  64. }