third_party/protobuf/src/google/protobuf/compiler/parser.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // Author: kenton@google.com (Kenton Varda)
32 // Based on original Protocol Buffers design by
33 // Sanjay Ghemawat, Jeff Dean, and others.
34 //
35 // Recursive descent FTW.
36 
37 #include <google/protobuf/compiler/parser.h>
38 
39 #include <float.h>
40 
41 #include <cstdint>
42 #include <limits>
43 #include <unordered_map>
44 #include <unordered_set>
45 
46 #include <google/protobuf/stubs/casts.h>
47 #include <google/protobuf/stubs/logging.h>
48 #include <google/protobuf/stubs/common.h>
49 #include <google/protobuf/descriptor.pb.h>
50 #include <google/protobuf/io/tokenizer.h>
51 #include <google/protobuf/descriptor.h>
52 #include <google/protobuf/wire_format.h>
53 #include <google/protobuf/stubs/strutil.h>
54 #include <google/protobuf/stubs/map_util.h>
55 #include <google/protobuf/stubs/hash.h>
56 
57 namespace google {
58 namespace protobuf {
59 namespace compiler {
60 
61 using internal::WireFormat;
62 
63 namespace {
64 
65 typedef std::unordered_map<std::string, FieldDescriptorProto::Type> TypeNameMap;
66 
67 TypeNameMap MakeTypeNameTable() {
68  TypeNameMap result;
69 
78 
87 
88  return result;
89 }
90 
91 const TypeNameMap kTypeNames = MakeTypeNameTable();
92 
93 // Camel-case the field name and append "Entry" for generated map entry name.
94 // e.g. map<KeyType, ValueType> foo_map => FooMapEntry
95 std::string MapEntryName(const std::string& field_name) {
97  static const char kSuffix[] = "Entry";
98  result.reserve(field_name.size() + sizeof(kSuffix));
99  bool cap_next = true;
100  for (const char field_name_char : field_name) {
101  if (field_name_char == '_') {
102  cap_next = true;
103  } else if (cap_next) {
104  // Note: Do not use ctype.h due to locales.
105  if ('a' <= field_name_char && field_name_char <= 'z') {
106  result.push_back(field_name_char - 'a' + 'A');
107  } else {
108  result.push_back(field_name_char);
109  }
110  cap_next = false;
111  } else {
112  result.push_back(field_name_char);
113  }
114  }
115  result.append(kSuffix);
116  return result;
117 }
118 
119 bool IsUppercase(char c) { return c >= 'A' && c <= 'Z'; }
120 
121 bool IsLowercase(char c) { return c >= 'a' && c <= 'z'; }
122 
123 bool IsNumber(char c) { return c >= '0' && c <= '9'; }
124 
125 bool IsUpperCamelCase(const std::string& name) {
126  if (name.empty()) {
127  return true;
128  }
129  // Name must start with an upper case character.
130  if (!IsUppercase(name[0])) {
131  return false;
132  }
133  // Must not contains underscore.
134  for (const char c : name) {
135  if (c == '_') {
136  return false;
137  }
138  }
139  return true;
140 }
141 
142 bool IsUpperUnderscore(const std::string& name) {
143  for (const char c : name) {
144  if (!IsUppercase(c) && c != '_' && !IsNumber(c)) {
145  return false;
146  }
147  }
148  return true;
149 }
150 
151 bool IsLowerUnderscore(const std::string& name) {
152  for (const char c : name) {
153  if (!IsLowercase(c) && c != '_' && !IsNumber(c)) {
154  return false;
155  }
156  }
157  return true;
158 }
159 
160 bool IsNumberFollowUnderscore(const std::string& name) {
161  for (int i = 1; i < name.length(); i++) {
162  const char c = name[i];
163  if (IsNumber(c) && name[i - 1] == '_') {
164  return true;
165  }
166  }
167  return false;
168 }
169 
170 } // anonymous namespace
171 
172 // Makes code slightly more readable. The meaning of "DO(foo)" is
173 // "Execute foo and fail if it fails.", where failure is indicated by
174 // returning false.
175 #define DO(STATEMENT) \
176  if (STATEMENT) { \
177  } else \
178  return false
179 
180 // ===================================================================
181 
183  : input_(NULL),
184  error_collector_(NULL),
185  source_location_table_(NULL),
186  had_errors_(false),
188  stop_after_syntax_identifier_(false) {
189 }
190 
191 Parser::~Parser() {}
192 
193 // ===================================================================
194 
195 inline bool Parser::LookingAt(const char* text) {
196  return input_->current().text == text;
197 }
198 
199 inline bool Parser::LookingAtType(io::Tokenizer::TokenType token_type) {
200  return input_->current().type == token_type;
201 }
202 
203 inline bool Parser::AtEnd() { return LookingAtType(io::Tokenizer::TYPE_END); }
204 
205 bool Parser::TryConsume(const char* text) {
206  if (LookingAt(text)) {
207  input_->Next();
208  return true;
209  } else {
210  return false;
211  }
212 }
213 
214 bool Parser::Consume(const char* text, const char* error) {
215  if (TryConsume(text)) {
216  return true;
217  } else {
218  AddError(error);
219  return false;
220  }
221 }
222 
223 bool Parser::Consume(const char* text) {
224  if (TryConsume(text)) {
225  return true;
226  } else {
227  AddError("Expected \"" + std::string(text) + "\".");
228  return false;
229  }
230 }
231 
232 bool Parser::ConsumeIdentifier(std::string* output, const char* error) {
233  if (LookingAtType(io::Tokenizer::TYPE_IDENTIFIER)) {
234  *output = input_->current().text;
235  input_->Next();
236  return true;
237  } else {
238  AddError(error);
239  return false;
240  }
241 }
242 
243 bool Parser::ConsumeInteger(int* output, const char* error) {
244  if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) {
245  uint64_t value = 0;
246  if (!io::Tokenizer::ParseInteger(input_->current().text,
248  &value)) {
249  AddError("Integer out of range.");
250  // We still return true because we did, in fact, parse an integer.
251  }
252  *output = value;
253  input_->Next();
254  return true;
255  } else {
256  AddError(error);
257  return false;
258  }
259 }
260 
261 bool Parser::ConsumeSignedInteger(int* output, const char* error) {
262  bool is_negative = false;
264  if (TryConsume("-")) {
265  is_negative = true;
266  max_value += 1;
267  }
268  uint64_t value = 0;
269  DO(ConsumeInteger64(max_value, &value, error));
270  if (is_negative) value *= -1;
271  *output = value;
272  return true;
273 }
274 
275 bool Parser::ConsumeInteger64(uint64_t max_value, uint64_t* output,
276  const char* error) {
277  if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) {
278  if (!io::Tokenizer::ParseInteger(input_->current().text, max_value,
279  output)) {
280  AddError("Integer out of range.");
281  // We still return true because we did, in fact, parse an integer.
282  *output = 0;
283  }
284  input_->Next();
285  return true;
286  } else {
287  AddError(error);
288  return false;
289  }
290 }
291 
292 bool Parser::ConsumeNumber(double* output, const char* error) {
293  if (LookingAtType(io::Tokenizer::TYPE_FLOAT)) {
294  *output = io::Tokenizer::ParseFloat(input_->current().text);
295  input_->Next();
296  return true;
297  } else if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) {
298  // Also accept integers.
299  uint64_t value = 0;
300  if (!io::Tokenizer::ParseInteger(input_->current().text,
302  &value)) {
303  AddError("Integer out of range.");
304  // We still return true because we did, in fact, parse a number.
305  }
306  *output = value;
307  input_->Next();
308  return true;
309  } else if (LookingAt("inf")) {
310  *output = std::numeric_limits<double>::infinity();
311  input_->Next();
312  return true;
313  } else if (LookingAt("nan")) {
314  *output = std::numeric_limits<double>::quiet_NaN();
315  input_->Next();
316  return true;
317  } else {
318  AddError(error);
319  return false;
320  }
321 }
322 
323 bool Parser::ConsumeString(std::string* output, const char* error) {
324  if (LookingAtType(io::Tokenizer::TYPE_STRING)) {
325  io::Tokenizer::ParseString(input_->current().text, output);
326  input_->Next();
327  // Allow C++ like concatenation of adjacent string tokens.
328  while (LookingAtType(io::Tokenizer::TYPE_STRING)) {
329  io::Tokenizer::ParseStringAppend(input_->current().text, output);
330  input_->Next();
331  }
332  return true;
333  } else {
334  AddError(error);
335  return false;
336  }
337 }
338 
339 bool Parser::TryConsumeEndOfDeclaration(const char* text,
340  const LocationRecorder* location) {
341  if (LookingAt(text)) {
342  std::string leading, trailing;
343  std::vector<std::string> detached;
344  input_->NextWithComments(&trailing, &detached, &leading);
345 
346  // Save the leading comments for next time, and recall the leading comments
347  // from last time.
348  leading.swap(upcoming_doc_comments_);
349 
350  if (location != NULL) {
351  upcoming_detached_comments_.swap(detached);
352  location->AttachComments(&leading, &trailing, &detached);
353  } else if (strcmp(text, "}") == 0) {
354  // If the current location is null and we are finishing the current scope,
355  // drop pending upcoming detached comments.
356  upcoming_detached_comments_.swap(detached);
357  } else {
358  // Otherwise, append the new detached comments to the existing upcoming
359  // detached comments.
360  upcoming_detached_comments_.insert(upcoming_detached_comments_.end(),
361  detached.begin(), detached.end());
362  }
363 
364  return true;
365  } else {
366  return false;
367  }
368 }
369 
370 bool Parser::ConsumeEndOfDeclaration(const char* text,
371  const LocationRecorder* location) {
372  if (TryConsumeEndOfDeclaration(text, location)) {
373  return true;
374  } else {
375  AddError("Expected \"" + std::string(text) + "\".");
376  return false;
377  }
378 }
379 
380 // -------------------------------------------------------------------
381 
382 void Parser::AddError(int line, int column, const std::string& error) {
383  if (error_collector_ != NULL) {
384  error_collector_->AddError(line, column, error);
385  }
386  had_errors_ = true;
387 }
388 
389 void Parser::AddError(const std::string& error) {
390  AddError(input_->current().line, input_->current().column, error);
391 }
392 
393 void Parser::AddWarning(const std::string& warning) {
394  if (error_collector_ != nullptr) {
395  error_collector_->AddWarning(input_->current().line,
396  input_->current().column, warning);
397  }
398 }
399 
400 // -------------------------------------------------------------------
401 
402 Parser::LocationRecorder::LocationRecorder(Parser* parser)
403  : parser_(parser),
404  source_code_info_(parser->source_code_info_),
405  location_(parser_->source_code_info_->add_location()) {
406  location_->add_span(parser_->input_->current().line);
407  location_->add_span(parser_->input_->current().column);
408 }
409 
410 Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent) {
411  Init(parent, parent.source_code_info_);
412 }
413 
414 Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent,
415  int path1,
416  SourceCodeInfo* source_code_info) {
417  Init(parent, source_code_info);
418  AddPath(path1);
419 }
420 
421 Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent,
422  int path1) {
423  Init(parent, parent.source_code_info_);
424  AddPath(path1);
425 }
426 
427 Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent,
428  int path1, int path2) {
429  Init(parent, parent.source_code_info_);
430  AddPath(path1);
431  AddPath(path2);
432 }
433 
434 void Parser::LocationRecorder::Init(const LocationRecorder& parent,
435  SourceCodeInfo* source_code_info) {
436  parser_ = parent.parser_;
437  source_code_info_ = source_code_info;
438 
439  location_ = source_code_info_->add_location();
440  location_->mutable_path()->CopyFrom(parent.location_->path());
441 
442  location_->add_span(parser_->input_->current().line);
443  location_->add_span(parser_->input_->current().column);
444 }
445 
447  if (location_->span_size() <= 2) {
448  EndAt(parser_->input_->previous());
449  }
450 }
451 
452 void Parser::LocationRecorder::AddPath(int path_component) {
453  location_->add_path(path_component);
454 }
455 
456 void Parser::LocationRecorder::StartAt(const io::Tokenizer::Token& token) {
457  location_->set_span(0, token.line);
458  location_->set_span(1, token.column);
459 }
460 
461 void Parser::LocationRecorder::StartAt(const LocationRecorder& other) {
462  location_->set_span(0, other.location_->span(0));
463  location_->set_span(1, other.location_->span(1));
464 }
465 
466 void Parser::LocationRecorder::EndAt(const io::Tokenizer::Token& token) {
467  if (token.line != location_->span(0)) {
468  location_->add_span(token.line);
469  }
470  location_->add_span(token.end_column);
471 }
472 
474  const Message* descriptor,
476  if (parser_->source_location_table_ != NULL) {
477  parser_->source_location_table_->Add(
478  descriptor, location, location_->span(0), location_->span(1));
479  }
480 }
481 
483  const Message* descriptor, const std::string& name) {
484  if (parser_->source_location_table_ != nullptr) {
485  parser_->source_location_table_->AddImport(
486  descriptor, name, location_->span(0), location_->span(1));
487  }
488 }
489 
491  return location_->path_size();
492 }
493 
495  std::string* leading, std::string* trailing,
496  std::vector<std::string>* detached_comments) const {
497  GOOGLE_CHECK(!location_->has_leading_comments());
498  GOOGLE_CHECK(!location_->has_trailing_comments());
499 
500  if (!leading->empty()) {
501  location_->mutable_leading_comments()->swap(*leading);
502  }
503  if (!trailing->empty()) {
504  location_->mutable_trailing_comments()->swap(*trailing);
505  }
506  for (int i = 0; i < detached_comments->size(); ++i) {
507  location_->add_leading_detached_comments()->swap((*detached_comments)[i]);
508  }
509  detached_comments->clear();
510 }
511 
512 // -------------------------------------------------------------------
513 
514 void Parser::SkipStatement() {
515  while (true) {
516  if (AtEnd()) {
517  return;
519  if (TryConsumeEndOfDeclaration(";", NULL)) {
520  return;
521  } else if (TryConsume("{")) {
522  SkipRestOfBlock();
523  return;
524  } else if (LookingAt("}")) {
525  return;
526  }
527  }
528  input_->Next();
529  }
530 }
531 
533  while (true) {
534  if (AtEnd()) {
535  return;
537  if (TryConsumeEndOfDeclaration("}", NULL)) {
538  return;
539  } else if (TryConsume("{")) {
540  SkipRestOfBlock();
541  }
542  }
543  input_->Next();
544  }
545 }
546 
547 // ===================================================================
548 
549 bool Parser::ValidateEnum(const EnumDescriptorProto* proto) {
550  bool has_allow_alias = false;
551  bool allow_alias = false;
552 
553  for (int i = 0; i < proto->options().uninterpreted_option_size(); i++) {
554  const UninterpretedOption option = proto->options().uninterpreted_option(i);
555  if (option.name_size() > 1) {
556  continue;
557  }
558  if (!option.name(0).is_extension() &&
559  option.name(0).name_part() == "allow_alias") {
560  has_allow_alias = true;
561  if (option.identifier_value() == "true") {
562  allow_alias = true;
563  }
564  break;
565  }
566  }
567 
568  if (has_allow_alias && !allow_alias) {
570  "\"" + proto->name() +
571  "\" declares 'option allow_alias = false;' which has no effect. "
572  "Please remove the declaration.";
573  // This needlessly clutters declarations with nops.
574  AddError(error);
575  return false;
576  }
577 
578  std::set<int> used_values;
579  bool has_duplicates = false;
580  for (int i = 0; i < proto->value_size(); ++i) {
581  const EnumValueDescriptorProto& enum_value = proto->value(i);
582  if (used_values.find(enum_value.number()) != used_values.end()) {
583  has_duplicates = true;
584  break;
585  } else {
586  used_values.insert(enum_value.number());
587  }
588  }
589  if (allow_alias && !has_duplicates) {
591  "\"" + proto->name() +
592  "\" declares support for enum aliases but no enum values share field "
593  "numbers. Please remove the unnecessary 'option allow_alias = true;' "
594  "declaration.";
595  // Generate an error if an enum declares support for duplicate enum values
596  // and does not use it protect future authors.
597  AddError(error);
598  return false;
599  }
600 
601  // Enforce that enum constants must be UPPER_CASE except in case of
602  // enum_alias.
603  if (!allow_alias) {
604  for (const auto& enum_value : proto->value()) {
605  if (!IsUpperUnderscore(enum_value.name())) {
606  AddWarning(
607  "Enum constant should be in UPPER_CASE. Found: " +
608  enum_value.name() +
609  ". See https://developers.google.com/protocol-buffers/docs/style");
610  }
611  }
612  }
613 
614  return true;
615 }
616 
617 bool Parser::Parse(io::Tokenizer* input, FileDescriptorProto* file) {
618  input_ = input;
619  had_errors_ = false;
620  syntax_identifier_.clear();
621 
622  // Note that |file| could be NULL at this point if
623  // stop_after_syntax_identifier_ is true. So, we conservatively allocate
624  // SourceCodeInfo on the stack, then swap it into the FileDescriptorProto
625  // later on.
626  SourceCodeInfo source_code_info;
627  source_code_info_ = &source_code_info;
628 
630  // Advance to first token.
633  }
634 
635  {
636  LocationRecorder root_location(this);
637  root_location.RecordLegacyLocation(file,
639 
640  if (require_syntax_identifier_ || LookingAt("syntax")) {
641  if (!ParseSyntaxIdentifier(root_location)) {
642  // Don't attempt to parse the file if we didn't recognize the syntax
643  // identifier.
644  return false;
645  }
646  // Store the syntax into the file.
647  if (file != NULL) file->set_syntax(syntax_identifier_);
648  } else if (!stop_after_syntax_identifier_) {
649  GOOGLE_LOG(WARNING) << "No syntax specified for the proto file: " << file->name()
650  << ". Please use 'syntax = \"proto2\";' "
651  << "or 'syntax = \"proto3\";' to specify a syntax "
652  << "version. (Defaulted to proto2 syntax.)";
653  syntax_identifier_ = "proto2";
654  }
655 
657 
658  // Repeatedly parse statements until we reach the end of the file.
659  while (!AtEnd()) {
660  if (!ParseTopLevelStatement(file, root_location)) {
661  // This statement failed to parse. Skip it, but keep looping to parse
662  // other statements.
663  SkipStatement();
664 
665  if (LookingAt("}")) {
666  AddError("Unmatched \"}\".");
669  }
670  }
671  }
672  }
673 
674  input_ = NULL;
675  source_code_info_ = NULL;
676  assert(file != NULL);
677  source_code_info.Swap(file->mutable_source_code_info());
678  return !had_errors_;
679 }
680 
681 bool Parser::ParseSyntaxIdentifier(const LocationRecorder& parent) {
682  LocationRecorder syntax_location(parent,
684  DO(Consume(
685  "syntax",
686  "File must begin with a syntax statement, e.g. 'syntax = \"proto2\";'."));
687  DO(Consume("="));
688  io::Tokenizer::Token syntax_token = input_->current();
690  DO(ConsumeString(&syntax, "Expected syntax identifier."));
691  DO(ConsumeEndOfDeclaration(";", &syntax_location));
692 
694 
695  if (syntax != "proto2" && syntax != "proto3" &&
697  AddError(syntax_token.line, syntax_token.column,
698  "Unrecognized syntax identifier \"" + syntax +
699  "\". This parser "
700  "only recognizes \"proto2\" and \"proto3\".");
701  return false;
702  }
703 
704  return true;
705 }
706 
708  const LocationRecorder& root_location) {
709  if (TryConsumeEndOfDeclaration(";", NULL)) {
710  // empty statement; ignore
711  return true;
712  } else if (LookingAt("message")) {
713  LocationRecorder location(root_location,
715  file->message_type_size());
716  return ParseMessageDefinition(file->add_message_type(), location, file);
717  } else if (LookingAt("enum")) {
718  LocationRecorder location(root_location,
720  file->enum_type_size());
721  return ParseEnumDefinition(file->add_enum_type(), location, file);
722  } else if (LookingAt("service")) {
723  LocationRecorder location(root_location,
725  file->service_size());
726  return ParseServiceDefinition(file->add_service(), location, file);
727  } else if (LookingAt("extend")) {
728  LocationRecorder location(root_location,
730  return ParseExtend(
731  file->mutable_extension(), file->mutable_message_type(), root_location,
733  } else if (LookingAt("import")) {
734  return ParseImport(file->mutable_dependency(),
735  file->mutable_public_dependency(),
736  file->mutable_weak_dependency(), root_location, file);
737  } else if (LookingAt("package")) {
738  return ParsePackage(file, root_location, file);
739  } else if (LookingAt("option")) {
740  LocationRecorder location(root_location,
742  return ParseOption(file->mutable_options(), location, file,
744  } else {
745  AddError("Expected top-level statement (e.g. \"message\").");
746  return false;
747  }
748 }
749 
750 // -------------------------------------------------------------------
751 // Messages
752 
754  DescriptorProto* message, const LocationRecorder& message_location,
755  const FileDescriptorProto* containing_file) {
756  DO(Consume("message"));
757  {
758  LocationRecorder location(message_location,
760  location.RecordLegacyLocation(message,
762  DO(ConsumeIdentifier(message->mutable_name(), "Expected message name."));
763  if (!IsUpperCamelCase(message->name())) {
764  AddWarning(
765  "Message name should be in UpperCamelCase. Found: " +
766  message->name() +
767  ". See https://developers.google.com/protocol-buffers/docs/style");
768  }
769  }
770  DO(ParseMessageBlock(message, message_location, containing_file));
771 
772  if (syntax_identifier_ == "proto3") {
773  // Add synthetic one-field oneofs for optional fields, except messages which
774  // already have presence in proto3.
775  //
776  // We have to make sure the oneof names don't conflict with any other
777  // field or oneof.
778  std::unordered_set<std::string> names;
779  for (const auto& field : message->field()) {
780  names.insert(field.name());
781  }
782  for (const auto& oneof : message->oneof_decl()) {
783  names.insert(oneof.name());
784  }
785 
786  for (auto& field : *message->mutable_field()) {
787  if (field.proto3_optional()) {
788  std::string oneof_name = field.name();
789 
790  // Prepend 'XXXXX_' until we are no longer conflicting.
791  // Avoid prepending a double-underscore because such names are
792  // reserved in C++.
793  if (oneof_name.empty() || oneof_name[0] != '_') {
794  oneof_name = '_' + oneof_name;
795  }
796  while (names.count(oneof_name) > 0) {
797  oneof_name = 'X' + oneof_name;
798  }
799 
800  names.insert(oneof_name);
801  field.set_oneof_index(message->oneof_decl_size());
802  OneofDescriptorProto* oneof = message->add_oneof_decl();
803  oneof->set_name(oneof_name);
804  }
805  }
806  }
807 
808  return true;
809 }
810 
811 namespace {
812 
813 const int kMaxRangeSentinel = -1;
814 
815 bool IsMessageSetWireFormatMessage(const DescriptorProto& message) {
816  const MessageOptions& options = message.options();
817  for (int i = 0; i < options.uninterpreted_option_size(); ++i) {
818  const UninterpretedOption& uninterpreted = options.uninterpreted_option(i);
819  if (uninterpreted.name_size() == 1 &&
820  uninterpreted.name(0).name_part() == "message_set_wire_format" &&
821  uninterpreted.identifier_value() == "true") {
822  return true;
823  }
824  }
825  return false;
826 }
827 
828 // Modifies any extension ranges that specified 'max' as the end of the
829 // extension range, and sets them to the type-specific maximum. The actual max
830 // tag number can only be determined after all options have been parsed.
831 void AdjustExtensionRangesWithMaxEndNumber(DescriptorProto* message) {
832  const bool is_message_set = IsMessageSetWireFormatMessage(*message);
833  const int max_extension_number = is_message_set
835  : FieldDescriptor::kMaxNumber + 1;
836  for (int i = 0; i < message->extension_range_size(); ++i) {
837  if (message->extension_range(i).end() == kMaxRangeSentinel) {
838  message->mutable_extension_range(i)->set_end(max_extension_number);
839  }
840  }
841 }
842 
843 // Modifies any reserved ranges that specified 'max' as the end of the
844 // reserved range, and sets them to the type-specific maximum. The actual max
845 // tag number can only be determined after all options have been parsed.
846 void AdjustReservedRangesWithMaxEndNumber(DescriptorProto* message) {
847  const bool is_message_set = IsMessageSetWireFormatMessage(*message);
848  const int max_field_number = is_message_set
850  : FieldDescriptor::kMaxNumber + 1;
851  for (int i = 0; i < message->reserved_range_size(); ++i) {
852  if (message->reserved_range(i).end() == kMaxRangeSentinel) {
853  message->mutable_reserved_range(i)->set_end(max_field_number);
854  }
855  }
856 }
857 
858 } // namespace
859 
861  const LocationRecorder& message_location,
862  const FileDescriptorProto* containing_file) {
863  DO(ConsumeEndOfDeclaration("{", &message_location));
864 
865  while (!TryConsumeEndOfDeclaration("}", NULL)) {
866  if (AtEnd()) {
867  AddError("Reached end of input in message definition (missing '}').");
868  return false;
869  }
870 
871  if (!ParseMessageStatement(message, message_location, containing_file)) {
872  // This statement failed to parse. Skip it, but keep looping to parse
873  // other statements.
874  SkipStatement();
875  }
876  }
877 
878  if (message->extension_range_size() > 0) {
879  AdjustExtensionRangesWithMaxEndNumber(message);
880  }
881  if (message->reserved_range_size() > 0) {
882  AdjustReservedRangesWithMaxEndNumber(message);
883  }
884  return true;
885 }
886 
888  const LocationRecorder& message_location,
889  const FileDescriptorProto* containing_file) {
890  if (TryConsumeEndOfDeclaration(";", NULL)) {
891  // empty statement; ignore
892  return true;
893  } else if (LookingAt("message")) {
894  LocationRecorder location(message_location,
896  message->nested_type_size());
897  return ParseMessageDefinition(message->add_nested_type(), location,
898  containing_file);
899  } else if (LookingAt("enum")) {
900  LocationRecorder location(message_location,
902  message->enum_type_size());
903  return ParseEnumDefinition(message->add_enum_type(), location,
904  containing_file);
905  } else if (LookingAt("extensions")) {
906  LocationRecorder location(message_location,
908  return ParseExtensions(message, location, containing_file);
909  } else if (LookingAt("reserved")) {
910  return ParseReserved(message, message_location);
911  } else if (LookingAt("extend")) {
912  LocationRecorder location(message_location,
914  return ParseExtend(message->mutable_extension(),
915  message->mutable_nested_type(), message_location,
917  containing_file);
918  } else if (LookingAt("option")) {
919  LocationRecorder location(message_location,
921  return ParseOption(message->mutable_options(), location, containing_file,
923  } else if (LookingAt("oneof")) {
924  int oneof_index = message->oneof_decl_size();
925  LocationRecorder oneof_location(
926  message_location, DescriptorProto::kOneofDeclFieldNumber, oneof_index);
927 
928  return ParseOneof(message->add_oneof_decl(), message, oneof_index,
929  oneof_location, message_location, containing_file);
930  } else {
931  LocationRecorder location(message_location,
933  message->field_size());
934  return ParseMessageField(
935  message->add_field(), message->mutable_nested_type(), message_location,
936  DescriptorProto::kNestedTypeFieldNumber, location, containing_file);
937  }
938 }
939 
941  RepeatedPtrField<DescriptorProto>* messages,
942  const LocationRecorder& parent_location,
943  int location_field_number_for_nested_type,
944  const LocationRecorder& field_location,
945  const FileDescriptorProto* containing_file) {
946  {
948  if (ParseLabel(&label, field_location, containing_file)) {
949  field->set_label(label);
951  syntax_identifier_ == "proto3") {
952  field->set_proto3_optional(true);
953  }
954  }
955  }
956 
957  return ParseMessageFieldNoLabel(field, messages, parent_location,
958  location_field_number_for_nested_type,
959  field_location, containing_file);
960 }
961 
963  FieldDescriptorProto* field, RepeatedPtrField<DescriptorProto>* messages,
964  const LocationRecorder& parent_location,
965  int location_field_number_for_nested_type,
966  const LocationRecorder& field_location,
967  const FileDescriptorProto* containing_file) {
968  MapField map_field;
969  // Parse type.
970  {
971  LocationRecorder location(field_location); // add path later
972  location.RecordLegacyLocation(field, DescriptorPool::ErrorCollector::TYPE);
973 
974  bool type_parsed = false;
977 
978  // Special case map field. We only treat the field as a map field if the
979  // field type name starts with the word "map" with a following "<".
980  if (TryConsume("map")) {
981  if (LookingAt("<")) {
982  map_field.is_map_field = true;
983  } else {
984  // False positive
985  type_parsed = true;
986  type_name = "map";
987  }
988  }
989  if (map_field.is_map_field) {
990  if (field->has_oneof_index()) {
991  AddError("Map fields are not allowed in oneofs.");
992  return false;
993  }
994  if (field->has_label()) {
995  AddError(
996  "Field labels (required/optional/repeated) are not allowed on "
997  "map fields.");
998  return false;
999  }
1000  if (field->has_extendee()) {
1001  AddError("Map fields are not allowed to be extensions.");
1002  return false;
1003  }
1005  DO(Consume("<"));
1006  DO(ParseType(&map_field.key_type, &map_field.key_type_name));
1007  DO(Consume(","));
1008  DO(ParseType(&map_field.value_type, &map_field.value_type_name));
1009  DO(Consume(">"));
1010  // Defer setting of the type name of the map field until the
1011  // field name is parsed. Add the source location though.
1013  } else {
1014  // Handle the case where no explicit label is given for a non-map field.
1015  if (!field->has_label() && DefaultToOptionalFields()) {
1017  }
1018  if (!field->has_label()) {
1019  AddError("Expected \"required\", \"optional\", or \"repeated\".");
1020  // We can actually reasonably recover here by just assuming the user
1021  // forgot the label altogether.
1023  }
1024 
1025  // Handle the case where the actual type is a message or enum named "map",
1026  // which we already consumed in the code above.
1027  if (!type_parsed) {
1028  DO(ParseType(&type, &type_name));
1029  }
1030  if (type_name.empty()) {
1031  location.AddPath(FieldDescriptorProto::kTypeFieldNumber);
1032  field->set_type(type);
1033  } else {
1035  field->set_type_name(type_name);
1036  }
1037  }
1038  }
1039 
1040  // Parse name and '='.
1041  io::Tokenizer::Token name_token = input_->current();
1042  {
1043  LocationRecorder location(field_location,
1045  location.RecordLegacyLocation(field, DescriptorPool::ErrorCollector::NAME);
1046  DO(ConsumeIdentifier(field->mutable_name(), "Expected field name."));
1047 
1048  if (!IsLowerUnderscore(field->name())) {
1049  AddWarning(
1050  "Field name should be lowercase. Found: " + field->name() +
1051  ". See: https://developers.google.com/protocol-buffers/docs/style");
1052  }
1053  if (IsNumberFollowUnderscore(field->name())) {
1054  AddWarning(
1055  "Number should not come right after an underscore. Found: " +
1056  field->name() +
1057  ". See: https://developers.google.com/protocol-buffers/docs/style");
1058  }
1059  }
1060  DO(Consume("=", "Missing field number."));
1061 
1062  // Parse field number.
1063  {
1064  LocationRecorder location(field_location,
1066  location.RecordLegacyLocation(field,
1068  int number;
1069  DO(ConsumeInteger(&number, "Expected field number."));
1070  field->set_number(number);
1071  }
1072 
1073  // Parse options.
1074  DO(ParseFieldOptions(field, field_location, containing_file));
1075 
1076  // Deal with groups.
1077  if (field->has_type() && field->type() == FieldDescriptorProto::TYPE_GROUP) {
1078  // Awkward: Since a group declares both a message type and a field, we
1079  // have to create overlapping locations.
1080  LocationRecorder group_location(parent_location);
1081  group_location.StartAt(field_location);
1082  group_location.AddPath(location_field_number_for_nested_type);
1083  group_location.AddPath(messages->size());
1084 
1085  DescriptorProto* group = messages->Add();
1086  group->set_name(field->name());
1087 
1088  // Record name location to match the field name's location.
1089  {
1090  LocationRecorder location(group_location,
1092  location.StartAt(name_token);
1093  location.EndAt(name_token);
1094  location.RecordLegacyLocation(group,
1096  }
1097 
1098  // The field's type_name also comes from the name. Confusing!
1099  {
1100  LocationRecorder location(field_location,
1102  location.StartAt(name_token);
1103  location.EndAt(name_token);
1104  }
1105 
1106  // As a hack for backwards-compatibility, we force the group name to start
1107  // with a capital letter and lower-case the field name. New code should
1108  // not use groups; it should use nested messages.
1109  if (group->name()[0] < 'A' || 'Z' < group->name()[0]) {
1110  AddError(name_token.line, name_token.column,
1111  "Group names must start with a capital letter.");
1112  }
1113  LowerString(field->mutable_name());
1114 
1115  field->set_type_name(group->name());
1116  if (LookingAt("{")) {
1117  DO(ParseMessageBlock(group, group_location, containing_file));
1118  } else {
1119  AddError("Missing group body.");
1120  return false;
1121  }
1122  } else {
1123  DO(ConsumeEndOfDeclaration(";", &field_location));
1124  }
1125 
1126  // Create a map entry type if this is a map field.
1127  if (map_field.is_map_field) {
1128  GenerateMapEntry(map_field, field, messages);
1129  }
1130 
1131  return true;
1132 }
1133 
1134 void Parser::GenerateMapEntry(const MapField& map_field,
1136  RepeatedPtrField<DescriptorProto>* messages) {
1137  DescriptorProto* entry = messages->Add();
1138  std::string entry_name = MapEntryName(field->name());
1139  field->set_type_name(entry_name);
1140  entry->set_name(entry_name);
1141  entry->mutable_options()->set_map_entry(true);
1142  FieldDescriptorProto* key_field = entry->add_field();
1143  key_field->set_name("key");
1145  key_field->set_number(1);
1146  if (map_field.key_type_name.empty()) {
1147  key_field->set_type(map_field.key_type);
1148  } else {
1149  key_field->set_type_name(map_field.key_type_name);
1150  }
1151  FieldDescriptorProto* value_field = entry->add_field();
1152  value_field->set_name("value");
1154  value_field->set_number(2);
1155  if (map_field.value_type_name.empty()) {
1156  value_field->set_type(map_field.value_type);
1157  } else {
1158  value_field->set_type_name(map_field.value_type_name);
1159  }
1160  // Propagate the "enforce_utf8" option to key and value fields if they
1161  // are strings. This helps simplify the implementation of code generators
1162  // and also reflection-based parsing code.
1163  //
1164  // The following definition:
1165  // message Foo {
1166  // map<string, string> value = 1 [enforce_utf8 = false];
1167  // }
1168  // will be interpreted as:
1169  // message Foo {
1170  // message ValueEntry {
1171  // option map_entry = true;
1172  // string key = 1 [enforce_utf8 = false];
1173  // string value = 2 [enforce_utf8 = false];
1174  // }
1175  // repeated ValueEntry value = 1 [enforce_utf8 = false];
1176  // }
1177  //
1178  // TODO(xiaofeng): Remove this when the "enforce_utf8" option is removed
1179  // from protocol compiler.
1180  for (int i = 0; i < field->options().uninterpreted_option_size(); ++i) {
1181  const UninterpretedOption& option =
1182  field->options().uninterpreted_option(i);
1183  if (option.name_size() == 1 &&
1184  option.name(0).name_part() == "enforce_utf8" &&
1185  !option.name(0).is_extension()) {
1186  if (key_field->type() == FieldDescriptorProto::TYPE_STRING) {
1187  key_field->mutable_options()->add_uninterpreted_option()->CopyFrom(
1188  option);
1189  }
1190  if (value_field->type() == FieldDescriptorProto::TYPE_STRING) {
1191  value_field->mutable_options()->add_uninterpreted_option()->CopyFrom(
1192  option);
1193  }
1194  }
1195  }
1196 }
1197 
1199  const LocationRecorder& field_location,
1200  const FileDescriptorProto* containing_file) {
1201  if (!LookingAt("[")) return true;
1202 
1203  LocationRecorder location(field_location,
1205 
1206  DO(Consume("["));
1207 
1208  // Parse field options.
1209  do {
1210  if (LookingAt("default")) {
1211  // We intentionally pass field_location rather than location here, since
1212  // the default value is not actually an option.
1213  DO(ParseDefaultAssignment(field, field_location, containing_file));
1214  } else if (LookingAt("json_name")) {
1215  // Like default value, this "json_name" is not an actual option.
1216  DO(ParseJsonName(field, field_location, containing_file));
1217  } else {
1218  DO(ParseOption(field->mutable_options(), location, containing_file,
1220  }
1221  } while (TryConsume(","));
1222 
1223  DO(Consume("]"));
1224  return true;
1225 }
1226 
1228  FieldDescriptorProto* field, const LocationRecorder& field_location,
1229  const FileDescriptorProto* containing_file) {
1230  if (field->has_default_value()) {
1231  AddError("Already set option \"default\".");
1232  field->clear_default_value();
1233  }
1234 
1235  DO(Consume("default"));
1236  DO(Consume("="));
1237 
1238  LocationRecorder location(field_location,
1240  location.RecordLegacyLocation(field,
1242  std::string* default_value = field->mutable_default_value();
1243 
1244  if (!field->has_type()) {
1245  // The field has a type name, but we don't know if it is a message or an
1246  // enum yet. (If it were a primitive type, |field| would have a type set
1247  // already.) In this case, simply take the current string as the default
1248  // value; we will catch the error later if it is not a valid enum value.
1249  // (N.B. that we do not check whether the current token is an identifier:
1250  // doing so throws strange errors when the user mistypes a primitive
1251  // typename and we assume it's an enum. E.g.: "optional int foo = 1 [default
1252  // = 42]". In such a case the fundamental error is really that "int" is not
1253  // a type, not that "42" is not an identifier. See b/12533582.)
1254  *default_value = input_->current().text;
1255  input_->Next();
1256  return true;
1257  }
1258 
1259  switch (field->type()) {
1267  if (field->type() == FieldDescriptorProto::TYPE_INT32 ||
1270  max_value = std::numeric_limits<int32_t>::max();
1271  }
1272 
1273  // These types can be negative.
1274  if (TryConsume("-")) {
1275  default_value->append("-");
1276  // Two's complement always has one more negative value than positive.
1277  ++max_value;
1278  }
1279  // Parse the integer to verify that it is not out-of-range.
1280  uint64_t value;
1281  DO(ConsumeInteger64(max_value, &value,
1282  "Expected integer for field default value."));
1283  // And stringify it again.
1284  default_value->append(StrCat(value));
1285  break;
1286  }
1287 
1293  if (field->type() == FieldDescriptorProto::TYPE_UINT32 ||
1295  max_value = std::numeric_limits<uint32_t>::max();
1296  }
1297 
1298  // Numeric, not negative.
1299  if (TryConsume("-")) {
1300  AddError("Unsigned field can't have negative default value.");
1301  }
1302  // Parse the integer to verify that it is not out-of-range.
1303  uint64_t value;
1304  DO(ConsumeInteger64(max_value, &value,
1305  "Expected integer for field default value."));
1306  // And stringify it again.
1307  default_value->append(StrCat(value));
1308  break;
1309  }
1310 
1313  // These types can be negative.
1314  if (TryConsume("-")) {
1315  default_value->append("-");
1316  }
1317  // Parse the integer because we have to convert hex integers to decimal
1318  // floats.
1319  double value;
1320  DO(ConsumeNumber(&value, "Expected number."));
1321  // And stringify it again.
1322  default_value->append(SimpleDtoa(value));
1323  break;
1324 
1326  if (TryConsume("true")) {
1327  default_value->assign("true");
1328  } else if (TryConsume("false")) {
1329  default_value->assign("false");
1330  } else {
1331  AddError("Expected \"true\" or \"false\".");
1332  return false;
1333  }
1334  break;
1335 
1337  // Note: When file option java_string_check_utf8 is true, if a
1338  // non-string representation (eg byte[]) is later supported, it must
1339  // be checked for UTF-8-ness.
1340  DO(ConsumeString(default_value,
1341  "Expected string for field default "
1342  "value."));
1343  break;
1344 
1346  DO(ConsumeString(default_value, "Expected string."));
1347  *default_value = CEscape(*default_value);
1348  break;
1349 
1351  DO(ConsumeIdentifier(default_value,
1352  "Expected enum identifier for field "
1353  "default value."));
1354  break;
1355 
1358  AddError("Messages can't have default values.");
1359  return false;
1360  }
1361 
1362  return true;
1363 }
1364 
1366  const LocationRecorder& field_location,
1367  const FileDescriptorProto* containing_file) {
1368  if (field->has_json_name()) {
1369  AddError("Already set option \"json_name\".");
1370  field->clear_json_name();
1371  }
1372 
1373  LocationRecorder location(field_location,
1375  location.RecordLegacyLocation(field,
1377 
1378  DO(Consume("json_name"));
1379  DO(Consume("="));
1380 
1381  LocationRecorder value_location(location);
1382  value_location.RecordLegacyLocation(
1384 
1385  DO(ConsumeString(field->mutable_json_name(),
1386  "Expected string for JSON name."));
1387  return true;
1388 }
1389 
1390 bool Parser::ParseOptionNamePart(UninterpretedOption* uninterpreted_option,
1391  const LocationRecorder& part_location,
1392  const FileDescriptorProto* containing_file) {
1393  UninterpretedOption::NamePart* name = uninterpreted_option->add_name();
1394  std::string identifier; // We parse identifiers into this string.
1395  if (LookingAt("(")) { // This is an extension.
1396  DO(Consume("("));
1397 
1398  {
1399  LocationRecorder location(
1401  // An extension name consists of dot-separated identifiers, and may begin
1402  // with a dot.
1404  DO(ConsumeIdentifier(&identifier, "Expected identifier."));
1405  name->mutable_name_part()->append(identifier);
1406  }
1407  while (LookingAt(".")) {
1408  DO(Consume("."));
1409  name->mutable_name_part()->append(".");
1410  DO(ConsumeIdentifier(&identifier, "Expected identifier."));
1411  name->mutable_name_part()->append(identifier);
1412  }
1413  }
1414 
1415  DO(Consume(")"));
1416  name->set_is_extension(true);
1417  } else { // This is a regular field.
1418  LocationRecorder location(
1420  DO(ConsumeIdentifier(&identifier, "Expected identifier."));
1421  name->mutable_name_part()->append(identifier);
1422  name->set_is_extension(false);
1423  }
1424  return true;
1425 }
1426 
1428  // Note that enclosing braces are not added to *value.
1429  // We do NOT use ConsumeEndOfStatement for this brace because it's delimiting
1430  // an expression, not a block of statements.
1431  DO(Consume("{"));
1432  int brace_depth = 1;
1433  while (!AtEnd()) {
1434  if (LookingAt("{")) {
1435  brace_depth++;
1436  } else if (LookingAt("}")) {
1437  brace_depth--;
1438  if (brace_depth == 0) {
1439  input_->Next();
1440  return true;
1441  }
1442  }
1443  // TODO(sanjay): Interpret line/column numbers to preserve formatting
1444  if (!value->empty()) value->push_back(' ');
1445  value->append(input_->current().text);
1446  input_->Next();
1447  }
1448  AddError("Unexpected end of stream while parsing aggregate value.");
1449  return false;
1450 }
1451 
1452 // We don't interpret the option here. Instead we store it in an
1453 // UninterpretedOption, to be interpreted later.
1455  const LocationRecorder& options_location,
1456  const FileDescriptorProto* containing_file,
1457  OptionStyle style) {
1458  // Create an entry in the uninterpreted_option field.
1459  const FieldDescriptor* uninterpreted_option_field =
1460  options->GetDescriptor()->FindFieldByName("uninterpreted_option");
1461  GOOGLE_CHECK(uninterpreted_option_field != NULL)
1462  << "No field named \"uninterpreted_option\" in the Options proto.";
1463 
1464  const Reflection* reflection = options->GetReflection();
1465 
1466  LocationRecorder location(
1467  options_location, uninterpreted_option_field->number(),
1468  reflection->FieldSize(*options, uninterpreted_option_field));
1469 
1470  if (style == OPTION_STATEMENT) {
1471  DO(Consume("option"));
1472  }
1473 
1474  UninterpretedOption* uninterpreted_option =
1475  down_cast<UninterpretedOption*>(options->GetReflection()->AddMessage(
1476  options, uninterpreted_option_field));
1477 
1478  // Parse dot-separated name.
1479  {
1480  LocationRecorder name_location(location,
1482  name_location.RecordLegacyLocation(
1483  uninterpreted_option, DescriptorPool::ErrorCollector::OPTION_NAME);
1484 
1485  {
1486  LocationRecorder part_location(name_location,
1487  uninterpreted_option->name_size());
1488  DO(ParseOptionNamePart(uninterpreted_option, part_location,
1489  containing_file));
1490  }
1491 
1492  while (LookingAt(".")) {
1493  DO(Consume("."));
1494  LocationRecorder part_location(name_location,
1495  uninterpreted_option->name_size());
1496  DO(ParseOptionNamePart(uninterpreted_option, part_location,
1497  containing_file));
1498  }
1499  }
1500 
1501  DO(Consume("="));
1502 
1503  {
1504  LocationRecorder value_location(location);
1505  value_location.RecordLegacyLocation(
1506  uninterpreted_option, DescriptorPool::ErrorCollector::OPTION_VALUE);
1507 
1508  // All values are a single token, except for negative numbers, which consist
1509  // of a single '-' symbol, followed by a positive number.
1510  bool is_negative = TryConsume("-");
1511 
1512  switch (input_->current().type) {
1514  GOOGLE_LOG(FATAL) << "Trying to read value before any tokens have been read.";
1515  return false;
1516 
1518  AddError("Unexpected end of stream while parsing option value.");
1519  return false;
1520 
1524  << "Whitespace tokens were not requested.";
1525  GOOGLE_LOG(FATAL) << "Tokenizer reported whitespace.";
1526  return false;
1527 
1529  value_location.AddPath(
1531  if (is_negative) {
1532  AddError("Invalid '-' symbol before identifier.");
1533  return false;
1534  }
1536  DO(ConsumeIdentifier(&value, "Expected identifier."));
1537  uninterpreted_option->set_identifier_value(value);
1538  break;
1539  }
1540 
1542  uint64_t value;
1543  uint64_t max_value =
1544  is_negative
1545  ? static_cast<uint64_t>(std::numeric_limits<int64_t>::max()) + 1
1547  DO(ConsumeInteger64(max_value, &value, "Expected integer."));
1548  if (is_negative) {
1549  value_location.AddPath(
1551  uninterpreted_option->set_negative_int_value(
1552  static_cast<int64_t>(0 - value));
1553  } else {
1554  value_location.AddPath(
1556  uninterpreted_option->set_positive_int_value(value);
1557  }
1558  break;
1559  }
1560 
1562  value_location.AddPath(UninterpretedOption::kDoubleValueFieldNumber);
1563  double value;
1564  DO(ConsumeNumber(&value, "Expected number."));
1565  uninterpreted_option->set_double_value(is_negative ? -value : value);
1566  break;
1567  }
1568 
1570  value_location.AddPath(UninterpretedOption::kStringValueFieldNumber);
1571  if (is_negative) {
1572  AddError("Invalid '-' symbol before string.");
1573  return false;
1574  }
1576  DO(ConsumeString(&value, "Expected string."));
1577  uninterpreted_option->set_string_value(value);
1578  break;
1579  }
1580 
1582  if (LookingAt("{")) {
1583  value_location.AddPath(
1586  uninterpreted_option->mutable_aggregate_value()));
1587  } else {
1588  AddError("Expected option value.");
1589  return false;
1590  }
1591  break;
1592  }
1593  }
1594 
1595  if (style == OPTION_STATEMENT) {
1596  DO(ConsumeEndOfDeclaration(";", &location));
1597  }
1598 
1599  return true;
1600 }
1601 
1603  const LocationRecorder& extensions_location,
1604  const FileDescriptorProto* containing_file) {
1605  // Parse the declaration.
1606  DO(Consume("extensions"));
1607 
1608  int old_range_size = message->extension_range_size();
1609 
1610  do {
1611  // Note that kExtensionRangeFieldNumber was already pushed by the parent.
1612  LocationRecorder location(extensions_location,
1613  message->extension_range_size());
1614 
1615  DescriptorProto::ExtensionRange* range = message->add_extension_range();
1616  location.RecordLegacyLocation(range,
1618 
1619  int start, end;
1620  io::Tokenizer::Token start_token;
1621 
1622  {
1623  LocationRecorder start_location(
1625  start_token = input_->current();
1626  DO(ConsumeInteger(&start, "Expected field number range."));
1627  }
1628 
1629  if (TryConsume("to")) {
1630  LocationRecorder end_location(
1632  if (TryConsume("max")) {
1633  // Set to the sentinel value - 1 since we increment the value below.
1634  // The actual value of the end of the range should be set with
1635  // AdjustExtensionRangesWithMaxEndNumber.
1636  end = kMaxRangeSentinel - 1;
1637  } else {
1638  DO(ConsumeInteger(&end, "Expected integer."));
1639  }
1640  } else {
1641  LocationRecorder end_location(
1643  end_location.StartAt(start_token);
1644  end_location.EndAt(start_token);
1645  end = start;
1646  }
1647 
1648  // Users like to specify inclusive ranges, but in code we like the end
1649  // number to be exclusive.
1650  ++end;
1651 
1652  range->set_start(start);
1653  range->set_end(end);
1654  } while (TryConsume(","));
1655 
1656  if (LookingAt("[")) {
1657  int range_number_index = extensions_location.CurrentPathSize();
1658  SourceCodeInfo info;
1659 
1660  // Parse extension range options in the first range.
1662  message->mutable_extension_range(old_range_size)->mutable_options();
1663 
1664  {
1665  LocationRecorder index_location(
1666  extensions_location, 0 /* we fill this in w/ actual index below */,
1667  &info);
1668  LocationRecorder location(
1670  DO(Consume("["));
1671 
1672  do {
1673  DO(ParseOption(options, location, containing_file, OPTION_ASSIGNMENT));
1674  } while (TryConsume(","));
1675 
1676  DO(Consume("]"));
1677  }
1678 
1679  // Then copy the extension range options to all of the other ranges we've
1680  // parsed.
1681  for (int i = old_range_size + 1; i < message->extension_range_size(); i++) {
1682  message->mutable_extension_range(i)->mutable_options()->CopyFrom(
1683  *options);
1684  }
1685  // and copy source locations to the other ranges, too
1686  for (int i = old_range_size; i < message->extension_range_size(); i++) {
1687  for (int j = 0; j < info.location_size(); j++) {
1688  if (info.location(j).path_size() == range_number_index + 1) {
1689  // this location's path is up to the extension range index, but
1690  // doesn't include options; so it's redundant with location above
1691  continue;
1692  }
1694  *dest = info.location(j);
1695  dest->set_path(range_number_index, i);
1696  }
1697  }
1698  }
1699 
1700  DO(ConsumeEndOfDeclaration(";", &extensions_location));
1701  return true;
1702 }
1703 
1704 // This is similar to extension range parsing, except that it accepts field
1705 // name literals.
1707  const LocationRecorder& message_location) {
1708  io::Tokenizer::Token start_token = input_->current();
1709  // Parse the declaration.
1710  DO(Consume("reserved"));
1712  LocationRecorder location(message_location,
1714  location.StartAt(start_token);
1715  return ParseReservedNames(message, location);
1716  } else {
1717  LocationRecorder location(message_location,
1719  location.StartAt(start_token);
1720  return ParseReservedNumbers(message, location);
1721  }
1722 }
1723 
1725  const LocationRecorder& parent_location) {
1726  do {
1727  LocationRecorder location(parent_location, message->reserved_name_size());
1728  DO(ConsumeString(message->add_reserved_name(), "Expected field name."));
1729  } while (TryConsume(","));
1730  DO(ConsumeEndOfDeclaration(";", &parent_location));
1731  return true;
1732 }
1733 
1735  const LocationRecorder& parent_location) {
1736  bool first = true;
1737  do {
1738  LocationRecorder location(parent_location, message->reserved_range_size());
1739 
1740  DescriptorProto::ReservedRange* range = message->add_reserved_range();
1741  int start, end;
1742  io::Tokenizer::Token start_token;
1743  {
1744  LocationRecorder start_location(
1746  start_token = input_->current();
1747  DO(ConsumeInteger(&start, (first ? "Expected field name or number range."
1748  : "Expected field number range.")));
1749  }
1750 
1751  if (TryConsume("to")) {
1752  LocationRecorder end_location(
1754  if (TryConsume("max")) {
1755  // Set to the sentinel value - 1 since we increment the value below.
1756  // The actual value of the end of the range should be set with
1757  // AdjustExtensionRangesWithMaxEndNumber.
1758  end = kMaxRangeSentinel - 1;
1759  } else {
1760  DO(ConsumeInteger(&end, "Expected integer."));
1761  }
1762  } else {
1763  LocationRecorder end_location(
1765  end_location.StartAt(start_token);
1766  end_location.EndAt(start_token);
1767  end = start;
1768  }
1769 
1770  // Users like to specify inclusive ranges, but in code we like the end
1771  // number to be exclusive.
1772  ++end;
1773 
1774  range->set_start(start);
1775  range->set_end(end);
1776  first = false;
1777  } while (TryConsume(","));
1778 
1779  DO(ConsumeEndOfDeclaration(";", &parent_location));
1780  return true;
1781 }
1782 
1784  const LocationRecorder& message_location) {
1785  io::Tokenizer::Token start_token = input_->current();
1786  // Parse the declaration.
1787  DO(Consume("reserved"));
1789  LocationRecorder location(message_location,
1791  location.StartAt(start_token);
1792  return ParseReservedNames(message, location);
1793  } else {
1794  LocationRecorder location(message_location,
1796  location.StartAt(start_token);
1797  return ParseReservedNumbers(message, location);
1798  }
1799 }
1800 
1802  const LocationRecorder& parent_location) {
1803  do {
1804  LocationRecorder location(parent_location, message->reserved_name_size());
1805  DO(ConsumeString(message->add_reserved_name(), "Expected enum value."));
1806  } while (TryConsume(","));
1807  DO(ConsumeEndOfDeclaration(";", &parent_location));
1808  return true;
1809 }
1810 
1812  const LocationRecorder& parent_location) {
1813  bool first = true;
1814  do {
1815  LocationRecorder location(parent_location, message->reserved_range_size());
1816 
1818  message->add_reserved_range();
1819  int start, end;
1820  io::Tokenizer::Token start_token;
1821  {
1822  LocationRecorder start_location(
1824  start_token = input_->current();
1826  (first ? "Expected enum value or number range."
1827  : "Expected enum number range.")));
1828  }
1829 
1830  if (TryConsume("to")) {
1831  LocationRecorder end_location(
1833  if (TryConsume("max")) {
1834  // This is in the enum descriptor path, which doesn't have the message
1835  // set duality to fix up, so it doesn't integrate with the sentinel.
1836  end = INT_MAX;
1837  } else {
1838  DO(ConsumeSignedInteger(&end, "Expected integer."));
1839  }
1840  } else {
1841  LocationRecorder end_location(
1843  end_location.StartAt(start_token);
1844  end_location.EndAt(start_token);
1845  end = start;
1846  }
1847 
1848  range->set_start(start);
1849  range->set_end(end);
1850  first = false;
1851  } while (TryConsume(","));
1852 
1853  DO(ConsumeEndOfDeclaration(";", &parent_location));
1854  return true;
1855 }
1856 
1857 bool Parser::ParseExtend(RepeatedPtrField<FieldDescriptorProto>* extensions,
1858  RepeatedPtrField<DescriptorProto>* messages,
1859  const LocationRecorder& parent_location,
1860  int location_field_number_for_nested_type,
1861  const LocationRecorder& extend_location,
1862  const FileDescriptorProto* containing_file) {
1863  DO(Consume("extend"));
1864 
1865  // Parse the extendee type.
1866  io::Tokenizer::Token extendee_start = input_->current();
1867  std::string extendee;
1868  DO(ParseUserDefinedType(&extendee));
1869  io::Tokenizer::Token extendee_end = input_->previous();
1870 
1871  // Parse the block.
1872  DO(ConsumeEndOfDeclaration("{", &extend_location));
1873 
1874  bool is_first = true;
1875 
1876  do {
1877  if (AtEnd()) {
1878  AddError("Reached end of input in extend definition (missing '}').");
1879  return false;
1880  }
1881 
1882  // Note that kExtensionFieldNumber was already pushed by the parent.
1883  LocationRecorder location(extend_location, extensions->size());
1884 
1886 
1887  {
1888  LocationRecorder extendee_location(
1890  extendee_location.StartAt(extendee_start);
1891  extendee_location.EndAt(extendee_end);
1892 
1893  if (is_first) {
1894  extendee_location.RecordLegacyLocation(
1896  is_first = false;
1897  }
1898  }
1899 
1900  field->set_extendee(extendee);
1901 
1902  if (!ParseMessageField(field, messages, parent_location,
1903  location_field_number_for_nested_type, location,
1904  containing_file)) {
1905  // This statement failed to parse. Skip it, but keep looping to parse
1906  // other statements.
1907  SkipStatement();
1908  }
1909  } while (!TryConsumeEndOfDeclaration("}", NULL));
1910 
1911  return true;
1912 }
1913 
1914 bool Parser::ParseOneof(OneofDescriptorProto* oneof_decl,
1915  DescriptorProto* containing_type, int oneof_index,
1916  const LocationRecorder& oneof_location,
1917  const LocationRecorder& containing_type_location,
1918  const FileDescriptorProto* containing_file) {
1919  DO(Consume("oneof"));
1920 
1921  {
1922  LocationRecorder name_location(oneof_location,
1924  DO(ConsumeIdentifier(oneof_decl->mutable_name(), "Expected oneof name."));
1925  }
1926 
1927  DO(ConsumeEndOfDeclaration("{", &oneof_location));
1928 
1929  do {
1930  if (AtEnd()) {
1931  AddError("Reached end of input in oneof definition (missing '}').");
1932  return false;
1933  }
1934 
1935  if (LookingAt("option")) {
1936  LocationRecorder option_location(
1938  if (!ParseOption(oneof_decl->mutable_options(), option_location,
1939  containing_file, OPTION_STATEMENT)) {
1940  return false;
1941  }
1942  continue;
1943  }
1944 
1945  // Print a nice error if the user accidentally tries to place a label
1946  // on an individual member of a oneof.
1947  if (LookingAt("required") || LookingAt("optional") ||
1948  LookingAt("repeated")) {
1949  AddError(
1950  "Fields in oneofs must not have labels (required / optional "
1951  "/ repeated).");
1952  // We can continue parsing here because we understand what the user
1953  // meant. The error report will still make parsing fail overall.
1954  input_->Next();
1955  }
1956 
1957  LocationRecorder field_location(containing_type_location,
1959  containing_type->field_size());
1960 
1961  FieldDescriptorProto* field = containing_type->add_field();
1963  field->set_oneof_index(oneof_index);
1964 
1965  if (!ParseMessageFieldNoLabel(field, containing_type->mutable_nested_type(),
1966  containing_type_location,
1968  field_location, containing_file)) {
1969  // This statement failed to parse. Skip it, but keep looping to parse
1970  // other statements.
1971  SkipStatement();
1972  }
1973  } while (!TryConsumeEndOfDeclaration("}", NULL));
1974 
1975  return true;
1976 }
1977 
1978 // -------------------------------------------------------------------
1979 // Enums
1980 
1982  const LocationRecorder& enum_location,
1983  const FileDescriptorProto* containing_file) {
1984  DO(Consume("enum"));
1985 
1986  {
1987  LocationRecorder location(enum_location,
1989  location.RecordLegacyLocation(enum_type,
1991  DO(ConsumeIdentifier(enum_type->mutable_name(), "Expected enum name."));
1992  }
1993 
1994  DO(ParseEnumBlock(enum_type, enum_location, containing_file));
1995 
1997 
1998  return true;
1999 }
2000 
2002  const LocationRecorder& enum_location,
2003  const FileDescriptorProto* containing_file) {
2004  DO(ConsumeEndOfDeclaration("{", &enum_location));
2005 
2006  while (!TryConsumeEndOfDeclaration("}", NULL)) {
2007  if (AtEnd()) {
2008  AddError("Reached end of input in enum definition (missing '}').");
2009  return false;
2010  }
2011 
2012  if (!ParseEnumStatement(enum_type, enum_location, containing_file)) {
2013  // This statement failed to parse. Skip it, but keep looping to parse
2014  // other statements.
2015  SkipStatement();
2016  }
2017  }
2018 
2019  return true;
2020 }
2021 
2023  const LocationRecorder& enum_location,
2024  const FileDescriptorProto* containing_file) {
2025  if (TryConsumeEndOfDeclaration(";", NULL)) {
2026  // empty statement; ignore
2027  return true;
2028  } else if (LookingAt("option")) {
2029  LocationRecorder location(enum_location,
2031  return ParseOption(enum_type->mutable_options(), location, containing_file,
2033  } else if (LookingAt("reserved")) {
2034  return ParseReserved(enum_type, enum_location);
2035  } else {
2036  LocationRecorder location(enum_location,
2038  enum_type->value_size());
2039  return ParseEnumConstant(enum_type->add_value(), location, containing_file);
2040  }
2041 }
2042 
2044  const LocationRecorder& enum_value_location,
2045  const FileDescriptorProto* containing_file) {
2046  // Parse name.
2047  {
2048  LocationRecorder location(enum_value_location,
2050  location.RecordLegacyLocation(enum_value,
2052  DO(ConsumeIdentifier(enum_value->mutable_name(),
2053  "Expected enum constant name."));
2054  }
2055 
2056  DO(Consume("=", "Missing numeric value for enum constant."));
2057 
2058  // Parse value.
2059  {
2060  LocationRecorder location(enum_value_location,
2062  location.RecordLegacyLocation(enum_value,
2064 
2065  int number;
2066  DO(ConsumeSignedInteger(&number, "Expected integer."));
2067  enum_value->set_number(number);
2068  }
2069 
2070  DO(ParseEnumConstantOptions(enum_value, enum_value_location,
2071  containing_file));
2072 
2073  DO(ConsumeEndOfDeclaration(";", &enum_value_location));
2074 
2075  return true;
2076 }
2077 
2080  const LocationRecorder& enum_value_location,
2081  const FileDescriptorProto* containing_file) {
2082  if (!LookingAt("[")) return true;
2083 
2084  LocationRecorder location(enum_value_location,
2086 
2087  DO(Consume("["));
2088 
2089  do {
2090  DO(ParseOption(value->mutable_options(), location, containing_file,
2092  } while (TryConsume(","));
2093 
2094  DO(Consume("]"));
2095  return true;
2096 }
2097 
2098 // -------------------------------------------------------------------
2099 // Services
2100 
2102  ServiceDescriptorProto* service, const LocationRecorder& service_location,
2103  const FileDescriptorProto* containing_file) {
2104  DO(Consume("service"));
2105 
2106  {
2107  LocationRecorder location(service_location,
2109  location.RecordLegacyLocation(service,
2111  DO(ConsumeIdentifier(service->mutable_name(), "Expected service name."));
2112  }
2113 
2114  DO(ParseServiceBlock(service, service_location, containing_file));
2115  return true;
2116 }
2117 
2119  const LocationRecorder& service_location,
2120  const FileDescriptorProto* containing_file) {
2121  DO(ConsumeEndOfDeclaration("{", &service_location));
2122 
2123  while (!TryConsumeEndOfDeclaration("}", NULL)) {
2124  if (AtEnd()) {
2125  AddError("Reached end of input in service definition (missing '}').");
2126  return false;
2127  }
2128 
2129  if (!ParseServiceStatement(service, service_location, containing_file)) {
2130  // This statement failed to parse. Skip it, but keep looping to parse
2131  // other statements.
2132  SkipStatement();
2133  }
2134  }
2135 
2136  return true;
2137 }
2138 
2140  const LocationRecorder& service_location,
2141  const FileDescriptorProto* containing_file) {
2142  if (TryConsumeEndOfDeclaration(";", NULL)) {
2143  // empty statement; ignore
2144  return true;
2145  } else if (LookingAt("option")) {
2146  LocationRecorder location(service_location,
2148  return ParseOption(service->mutable_options(), location, containing_file,
2150  } else {
2151  LocationRecorder location(service_location,
2153  service->method_size());
2154  return ParseServiceMethod(service->add_method(), location, containing_file);
2155  }
2156 }
2157 
2159  const LocationRecorder& method_location,
2160  const FileDescriptorProto* containing_file) {
2161  DO(Consume("rpc"));
2162 
2163  {
2164  LocationRecorder location(method_location,
2166  location.RecordLegacyLocation(method, DescriptorPool::ErrorCollector::NAME);
2167  DO(ConsumeIdentifier(method->mutable_name(), "Expected method name."));
2168  }
2169 
2170  // Parse input type.
2171  DO(Consume("("));
2172  {
2173  if (LookingAt("stream")) {
2174  LocationRecorder location(
2176  location.RecordLegacyLocation(method,
2178  method->set_client_streaming(true);
2179  DO(Consume("stream"));
2180 
2181  }
2182  LocationRecorder location(method_location,
2184  location.RecordLegacyLocation(method,
2186  DO(ParseUserDefinedType(method->mutable_input_type()));
2187  }
2188  DO(Consume(")"));
2189 
2190  // Parse output type.
2191  DO(Consume("returns"));
2192  DO(Consume("("));
2193  {
2194  if (LookingAt("stream")) {
2195  LocationRecorder location(
2197  location.RecordLegacyLocation(method,
2199  DO(Consume("stream"));
2200  method->set_server_streaming(true);
2201 
2202  }
2203  LocationRecorder location(method_location,
2205  location.RecordLegacyLocation(method,
2207  DO(ParseUserDefinedType(method->mutable_output_type()));
2208  }
2209  DO(Consume(")"));
2210 
2211  if (LookingAt("{")) {
2212  // Options!
2213  DO(ParseMethodOptions(method_location, containing_file,
2215  method->mutable_options()));
2216  } else {
2217  DO(ConsumeEndOfDeclaration(";", &method_location));
2218  }
2219 
2220  return true;
2221 }
2222 
2223 bool Parser::ParseMethodOptions(const LocationRecorder& parent_location,
2224  const FileDescriptorProto* containing_file,
2225  const int optionsFieldNumber,
2226  Message* mutable_options) {
2227  // Options!
2228  ConsumeEndOfDeclaration("{", &parent_location);
2229  while (!TryConsumeEndOfDeclaration("}", NULL)) {
2230  if (AtEnd()) {
2231  AddError("Reached end of input in method options (missing '}').");
2232  return false;
2233  }
2234 
2235  if (TryConsumeEndOfDeclaration(";", NULL)) {
2236  // empty statement; ignore
2237  } else {
2238  LocationRecorder location(parent_location, optionsFieldNumber);
2239  if (!ParseOption(mutable_options, location, containing_file,
2240  OPTION_STATEMENT)) {
2241  // This statement failed to parse. Skip it, but keep looping to
2242  // parse other statements.
2243  SkipStatement();
2244  }
2245  }
2246  }
2247 
2248  return true;
2249 }
2250 
2251 // -------------------------------------------------------------------
2252 
2254  const LocationRecorder& field_location,
2255  const FileDescriptorProto* containing_file) {
2256  if (!LookingAt("optional") && !LookingAt("repeated") &&
2257  !LookingAt("required")) {
2258  return false;
2259  }
2260  LocationRecorder location(field_location,
2262  if (TryConsume("optional")) {
2264  } else if (TryConsume("repeated")) {
2266  } else {
2267  Consume("required");
2269  }
2270  return true;
2271 }
2272 
2275  TypeNameMap::const_iterator iter = kTypeNames.find(input_->current().text);
2276  if (iter != kTypeNames.end()) {
2277  *type = iter->second;
2278  input_->Next();
2279  } else {
2281  }
2282  return true;
2283 }
2284 
2286  type_name->clear();
2287 
2288  TypeNameMap::const_iterator iter = kTypeNames.find(input_->current().text);
2289  if (iter != kTypeNames.end()) {
2290  // Note: The only place enum types are allowed is for field types, but
2291  // if we are parsing a field type then we would not get here because
2292  // primitives are allowed there as well. So this error message doesn't
2293  // need to account for enums.
2294  AddError("Expected message type.");
2295 
2296  // Pretend to accept this type so that we can go on parsing.
2297  *type_name = input_->current().text;
2298  input_->Next();
2299  return true;
2300  }
2301 
2302  // A leading "." means the name is fully-qualified.
2303  if (TryConsume(".")) type_name->append(".");
2304 
2305  // Consume the first part of the name.
2306  std::string identifier;
2307  DO(ConsumeIdentifier(&identifier, "Expected type name."));
2308  type_name->append(identifier);
2309 
2310  // Consume more parts.
2311  while (TryConsume(".")) {
2312  type_name->append(".");
2313  DO(ConsumeIdentifier(&identifier, "Expected identifier."));
2314  type_name->append(identifier);
2315  }
2316 
2317  return true;
2318 }
2319 
2320 // ===================================================================
2321 
2323  const LocationRecorder& root_location,
2324  const FileDescriptorProto* containing_file) {
2325  if (file->has_package()) {
2326  AddError("Multiple package definitions.");
2327  // Don't append the new package to the old one. Just replace it. Not
2328  // that it really matters since this is an error anyway.
2329  file->clear_package();
2330  }
2331 
2332  LocationRecorder location(root_location,
2334  location.RecordLegacyLocation(file, DescriptorPool::ErrorCollector::NAME);
2335 
2336  DO(Consume("package"));
2337 
2338  while (true) {
2339  std::string identifier;
2340  DO(ConsumeIdentifier(&identifier, "Expected identifier."));
2341  file->mutable_package()->append(identifier);
2342  if (!TryConsume(".")) break;
2343  file->mutable_package()->append(".");
2344  }
2345 
2346  DO(ConsumeEndOfDeclaration(";", &location));
2347 
2348  return true;
2349 }
2350 
2351 bool Parser::ParseImport(RepeatedPtrField<std::string>* dependency,
2352  RepeatedField<int32_t>* public_dependency,
2353  RepeatedField<int32_t>* weak_dependency,
2354  const LocationRecorder& root_location,
2355  const FileDescriptorProto* containing_file) {
2356  LocationRecorder location(root_location,
2358  dependency->size());
2359 
2360  DO(Consume("import"));
2361 
2362  if (LookingAt("public")) {
2363  LocationRecorder public_location(
2365  public_dependency->size());
2366  DO(Consume("public"));
2367  *public_dependency->Add() = dependency->size();
2368  } else if (LookingAt("weak")) {
2369  LocationRecorder weak_location(
2371  weak_dependency->size());
2372  weak_location.RecordLegacyImportLocation(containing_file, "weak");
2373  DO(Consume("weak"));
2374  *weak_dependency->Add() = dependency->size();
2375  }
2376 
2377  std::string import_file;
2378  DO(ConsumeString(&import_file,
2379  "Expected a string naming the file to import."));
2380  *dependency->Add() = import_file;
2381  location.RecordLegacyImportLocation(containing_file, import_file);
2382 
2383  DO(ConsumeEndOfDeclaration(";", &location));
2384 
2385  return true;
2386 }
2387 
2388 // ===================================================================
2389 
2392 
2394  const Message* descriptor,
2396  int* column) const {
2397  const std::pair<int, int>* result =
2398  FindOrNull(location_map_, std::make_pair(descriptor, location));
2399  if (result == NULL) {
2400  *line = -1;
2401  *column = 0;
2402  return false;
2403  } else {
2404  *line = result->first;
2405  *column = result->second;
2406  return true;
2407  }
2408 }
2409 
2411  const std::string& name, int* line,
2412  int* column) const {
2413  const std::pair<int, int>* result =
2414  FindOrNull(import_location_map_, std::make_pair(descriptor, name));
2415  if (result == nullptr) {
2416  *line = -1;
2417  *column = 0;
2418  return false;
2419  } else {
2420  *line = result->first;
2421  *column = result->second;
2422  return true;
2423  }
2424 }
2425 
2427  const Message* descriptor,
2429  int column) {
2430  location_map_[std::make_pair(descriptor, location)] =
2431  std::make_pair(line, column);
2432 }
2433 
2435  const std::string& name, int line,
2436  int column) {
2437  import_location_map_[std::make_pair(descriptor, name)] =
2438  std::make_pair(line, column);
2439 }
2440 
2441 void SourceLocationTable::Clear() { location_map_.clear(); }
2442 
2443 } // namespace compiler
2444 } // namespace protobuf
2445 } // namespace google
google::protobuf::compiler::Parser::ParseOption
bool ParseOption(Message *options, const LocationRecorder &options_location, const FileDescriptorProto *containing_file, OptionStyle style)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1415
google::protobuf::compiler::Parser::ParsePackage
bool ParsePackage(FileDescriptorProto *file, const LocationRecorder &root_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2275
DescriptorProto_ReservedRange::kStartFieldNumber
@ kStartFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1267
DescriptorProto::kReservedRangeFieldNumber
@ kReservedRangeFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1454
google::protobuf::compiler::Parser::ConsumeIdentifier
bool ConsumeIdentifier(std::string *output, const char *error)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:231
FieldDescriptorProto_Type
FieldDescriptorProto_Type
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:172
google::protobuf::compiler::Parser::LocationRecorder::Init
void Init(const LocationRecorder &parent, SourceCodeInfo *source_code_info)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:431
google::protobuf::compiler::Parser::ParseExtensions
bool ParseExtensions(DescriptorProto *message, const LocationRecorder &extensions_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1554
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
ServiceDescriptorProto::kNameFieldNumber
@ kNameFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3320
google::protobuf::compiler::Parser::SkipStatement
void SkipStatement()
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:511
EnumValueDescriptorProto::kNameFieldNumber
@ kNameFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3105
google::protobuf::compiler::Parser::source_code_info_
SourceCodeInfo * source_code_info_
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:529
google::protobuf::compiler::SourceLocationTable::~SourceLocationTable
~SourceLocationTable()
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2344
google::protobuf::compiler::Parser::ConsumeNumber
bool ConsumeNumber(double *output, const char *error)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:290
google::protobuf::io::Tokenizer::current
const Token & current()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h:396
google::protobuf::DescriptorPool::ErrorCollector::INPUT_TYPE
@ INPUT_TYPE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1644
google::protobuf::value
const Descriptor::ReservedRange value
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1954
FieldDescriptorProto::TYPE_UINT32
static constexpr Type TYPE_UINT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2006
absl::str_format_internal::LengthMod::j
@ j
google::protobuf::compiler::SourceLocationTable::AddImport
void AddImport(const Message *descriptor, const string &name, int line, int column)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2387
google::protobuf::compiler::Parser::syntax_identifier_
std::string syntax_identifier_
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:534
EnumDescriptorProto::kOptionsFieldNumber
@ kOptionsFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2844
FileDescriptorProto::kDependencyFieldNumber
@ kDependencyFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:634
UninterpretedOption::kStringValueFieldNumber
@ kStringValueFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:6226
DescriptorProto::kOneofDeclFieldNumber
@ kOneofDeclFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1453
FileDescriptorProto::kSyntaxFieldNumber
@ kSyntaxFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:643
MethodDescriptorProto::kServerStreamingFieldNumber
@ kServerStreamingFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3543
google::protobuf::compiler::Parser
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:68
google::protobuf::compiler::Parser::ConsumeSignedInteger
bool ConsumeSignedInteger(int *output, const char *error)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:259
google::protobuf::compiler::Parser::upcoming_doc_comments_
std::string upcoming_doc_comments_
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:538
fix_build_deps.c
list c
Definition: fix_build_deps.py:490
MethodDescriptorProto::kNameFieldNumber
@ kNameFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3538
google::protobuf::compiler::Parser::AtEnd
bool AtEnd()
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:202
google::protobuf::compiler::SourceLocationTable::Add
void Add(const Message *descriptor, DescriptorPool::ErrorCollector::ErrorLocation location, int line, int column)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2379
MethodDescriptorProto::kOutputTypeFieldNumber
@ kOutputTypeFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3540
google::protobuf::compiler::Parser::ParseExtend
bool ParseExtend(RepeatedPtrField< FieldDescriptorProto > *extensions, RepeatedPtrField< DescriptorProto > *messages, const LocationRecorder &parent_location, int location_field_number_for_nested_type, const LocationRecorder &extend_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1809
false
#define false
Definition: setup_once.h:323
require_syntax_identifier_
bool require_syntax_identifier_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:186
capstone.range
range
Definition: third_party/bloaty/third_party/capstone/bindings/python/capstone/__init__.py:6
google::protobuf::compiler::Parser::require_syntax_identifier_
bool require_syntax_identifier_
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:532
check_version.warning
string warning
Definition: check_version.py:46
google::protobuf::compiler::Parser::ParseReservedNumbers
bool ParseReservedNumbers(DescriptorProto *message, const LocationRecorder &parent_location)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1686
EnumDescriptorProto::name
const std::string & name() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:9683
options
double_dict options[]
Definition: capstone_test.c:55
google::protobuf::io::Tokenizer::TYPE_IDENTIFIER
@ TYPE_IDENTIFIER
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h:105
absl::cord_internal::Consume
void Consume(CordRep *rep, ConsumeFn consume_fn)
Definition: cord_rep_consume.cc:45
names
sub_type names
Definition: cxa_demangle.cpp:4905
UninterpretedOption
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:6089
FieldDescriptorProto
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1851
google::protobuf::compiler::Parser::GenerateMapEntry
void GenerateMapEntry(const MapField &map_field, FieldDescriptorProto *field, RepeatedPtrField< DescriptorProto > *messages)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1095
google::protobuf.text_format.ParseInteger
def ParseInteger(text, is_signed=False, is_long=False)
Definition: bloaty/third_party/protobuf/python/google/protobuf/text_format.py:1634
FieldDescriptorProto::set_number
void set_number(::PROTOBUF_NAMESPACE_ID::int32 value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:8911
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
error
grpc_error_handle error
Definition: retry_filter.cc:499
FieldDescriptorProto::TYPE_SFIXED64
static constexpr Type TYPE_SFIXED64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2012
google::protobuf::compiler::Parser::ParseEnumConstantOptions
bool ParseEnumConstantOptions(EnumValueDescriptorProto *value, const LocationRecorder &enum_value_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2030
UninterpretedOption::name
const PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart & name(int index) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:12945
FileDescriptorProto::kExtensionFieldNumber
@ kExtensionFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:638
file
Definition: bloaty/third_party/zlib/examples/gzappend.c:170
ServiceDescriptorProto
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3186
google::protobuf::CEscape
string CEscape(const string &src)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:615
google::protobuf::compiler::Parser::AddWarning
void AddWarning(const string &warning)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:390
UninterpretedOption_NamePart::kNamePartFieldNumber
@ kNamePartFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:6025
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
google::protobuf::io::Tokenizer::NextWithComments
bool NextWithComments(std::string *prev_trailing_comments, std::vector< std::string > *detached_comments, std::string *next_leading_comments)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.cc:762
google::protobuf::compiler::Parser::ParseFieldOptions
bool ParseFieldOptions(FieldDescriptorProto *field, const LocationRecorder &field_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1159
FileDescriptorProto::kMessageTypeFieldNumber
@ kMessageTypeFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:635
google::protobuf::compiler::Parser::LocationRecorder::AddPath
void AddPath(int path_component)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:449
google::protobuf::DescriptorPool::ErrorCollector::NUMBER
@ NUMBER
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1640
google::protobuf::python::cmessage::Init
static int Init(CMessage *self, PyObject *args, PyObject *kwargs)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:1287
google::protobuf::compiler::Parser::ValidateEnum
bool ValidateEnum(const EnumDescriptorProto *proto)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:546
google::protobuf::compiler::Parser::ConsumeInteger
bool ConsumeInteger(int *output, const char *error)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:242
MethodDescriptorProto
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3405
setup.name
name
Definition: setup.py:542
google::protobuf::compiler::Parser::ParseMessageStatement
bool ParseMessageStatement(DescriptorProto *message, const LocationRecorder &message_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:845
FieldDescriptorProto::kNumberFieldNumber
@ kNumberFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2084
google::protobuf::compiler::Parser::ParseImport
bool ParseImport(RepeatedPtrField< std::string > *dependency, RepeatedField< int32 > *public_dependency, RepeatedField< int32 > *weak_dependency, const LocationRecorder &root_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2304
OneofDescriptorProto::kOptionsFieldNumber
@ kOptionsFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2462
google::protobuf::compiler::Parser::LocationRecorder::RecordLegacyImportLocation
void RecordLegacyImportLocation(const Message *descriptor, const string &name)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:479
google::protobuf::compiler::Parser::stop_after_syntax_identifier_
bool stop_after_syntax_identifier_
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:533
google::protobuf::compiler::Parser::ParseEnumDefinition
bool ParseEnumDefinition(EnumDescriptorProto *enum_type, const LocationRecorder &enum_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1933
SourceCodeInfo::location_size
int location_size() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:13691
google::protobuf::compiler::Parser::OPTION_STATEMENT
@ OPTION_STATEMENT
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:471
google::protobuf::compiler::Parser::LocationRecorder::EndAt
void EndAt(const io::Tokenizer::Token &token)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:463
FileDescriptorProto::kOptionsFieldNumber
@ kOptionsFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:644
EnumDescriptorProto::kReservedNameFieldNumber
@ kReservedNameFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2842
FileDescriptorProto::kPackageFieldNumber
@ kPackageFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:642
FieldDescriptorProto::TYPE_FIXED64
static constexpr Type TYPE_FIXED64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1992
google::protobuf::DescriptorPool::ErrorCollector::OPTION_NAME
@ OPTION_NAME
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1646
google::protobuf::compiler::Parser::input_
io::Tokenizer * input_
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:527
EnumValueDescriptorProto::number
::PROTOBUF_NAMESPACE_ID::int32 number() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:10096
google::protobuf::compiler::SourceLocationTable::FindImport
bool FindImport(const Message *descriptor, const string &name, int *line, int *column) const
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2363
ServiceDescriptorProto::kMethodFieldNumber
@ kMethodFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3319
ExtensionRangeOptions
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1680
MethodDescriptorProto::kInputTypeFieldNumber
@ kInputTypeFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3539
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
FieldDescriptorProto::kExtendeeFieldNumber
@ kExtendeeFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2079
EnumValueDescriptorProto
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2972
google::protobuf::StrCat
string StrCat(const AlphaNum &a, const AlphaNum &b)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1482
FieldDescriptorProto::TYPE_GROUP
static constexpr Type TYPE_GROUP
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2000
RepeatedField::size
int size
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:407
google::protobuf::compiler::SourceLocationTable::Clear
void Clear()
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2393
FieldDescriptorProto::TYPE_INT64
static constexpr Type TYPE_INT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1986
input_
const uint8_t * input_
Definition: json_reader.cc:120
google::protobuf::io::Tokenizer::report_whitespace
bool report_whitespace() const
Definition: protobuf/src/google/protobuf/io/tokenizer.cc:227
EnumDescriptorProto_EnumReservedRange
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2527
google::protobuf::compiler::Parser::TryConsume
bool TryConsume(const char *text)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:204
UninterpretedOption::kDoubleValueFieldNumber
@ kDoubleValueFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:6230
EnumDescriptorProto_EnumReservedRange::kStartFieldNumber
@ kStartFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2660
google::protobuf::DescriptorPool::ErrorCollector::NAME
@ NAME
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1639
DescriptorProto::kFieldFieldNumber
@ kFieldFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1448
FieldDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:133
DescriptorProto::kOptionsFieldNumber
@ kOptionsFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1457
google::protobuf::compiler::Parser::OPTION_ASSIGNMENT
@ OPTION_ASSIGNMENT
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:470
start
static uint64_t start
Definition: benchmark-pound.c:74
google::protobuf::compiler::Parser::ParseEnumBlock
bool ParseEnumBlock(EnumDescriptorProto *enum_type, const LocationRecorder &enum_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1953
EnumDescriptorProto::kValueFieldNumber
@ kValueFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2840
UninterpretedOption::kIdentifierValueFieldNumber
@ kIdentifierValueFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:6225
DescriptorProto::kExtensionRangeFieldNumber
@ kExtensionRangeFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1451
FieldDescriptorProto::LABEL_OPTIONAL
static constexpr Label LABEL_OPTIONAL
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2044
google::protobuf::compiler::Parser::ParseSyntaxIdentifier
bool ParseSyntaxIdentifier(const LocationRecorder &parent)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:678
EnumValueDescriptorProto::kNumberFieldNumber
@ kNumberFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3107
asyncio_get_stats.parser
parser
Definition: asyncio_get_stats.py:34
OneofDescriptorProto::mutable_name
std::string * mutable_name()
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:9466
gen_server_registered_method_bad_client_test_body.text
def text
Definition: gen_server_registered_method_bad_client_test_body.py:50
benchmark.syntax
syntax
Definition: benchmark.py:90
DescriptorProto_ExtensionRange
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:936
google::protobuf::io::Tokenizer::report_newlines
bool report_newlines() const
Definition: protobuf/src/google/protobuf/io/tokenizer.cc:235
end
char * end
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1008
FieldDescriptorProto::TYPE_INT32
static constexpr Type TYPE_INT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1990
FileDescriptorProto::kEnumTypeFieldNumber
@ kEnumTypeFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:636
FieldDescriptorProto::TYPE_DOUBLE
static constexpr Type TYPE_DOUBLE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1982
gen_synthetic_protos.label
label
Definition: gen_synthetic_protos.py:102
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
google::protobuf::io::Tokenizer::Next
bool Next()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.cc:565
FieldDescriptorProto::kDefaultValueFieldNumber
@ kDefaultValueFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2081
max
int max
Definition: bloaty/third_party/zlib/examples/enough.c:170
gmock_output_test.output
output
Definition: bloaty/third_party/googletest/googlemock/test/gmock_output_test.py:175
google::protobuf::compiler::Parser::TryConsumeEndOfDeclaration
bool TryConsumeEndOfDeclaration(const char *text, const LocationRecorder *location)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:336
FieldDescriptorProto::mutable_options
PROTOBUF_NAMESPACE_ID::FieldOptions * mutable_options()
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:9418
FieldDescriptorProto::type
PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type type() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:8960
DescriptorProto::add_field
PROTOBUF_NAMESPACE_ID::FieldDescriptorProto * add_field()
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:8362
google::protobuf::DescriptorPool::ErrorCollector::OUTPUT_TYPE
@ OUTPUT_TYPE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1645
UninterpretedOption::name_size
int name_size() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:12927
EnumDescriptorProto_EnumReservedRange::kEndFieldNumber
@ kEndFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2661
OneofDescriptorProto::set_name
void set_name(const std::string &value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:9462
google::protobuf::compiler::Parser::ParseEnumStatement
bool ParseEnumStatement(EnumDescriptorProto *message, const LocationRecorder &enum_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1974
FileDescriptorProto::kServiceFieldNumber
@ kServiceFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:637
google::protobuf::compiler::Parser::ParseMethodOptions
bool ParseMethodOptions(const LocationRecorder &parent_location, const FileDescriptorProto *containing_file, const int optionsFieldNumber, Message *mutable_options)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2176
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
google::protobuf::DescriptorPool::ErrorCollector::ErrorLocation
ErrorLocation
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1638
google::protobuf::compiler::Parser::Consume
bool Consume(const char *text, const char *error)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:213
FieldDescriptorProto::LABEL_REPEATED
static constexpr Label LABEL_REPEATED
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2048
MessageOptions
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:4359
FieldDescriptorProto::set_label
void set_label(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:8940
google::protobuf::compiler::Parser::ParseType
bool ParseType(FieldDescriptorProto::Type *type, std::string *type_name)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2226
FieldDescriptorProto::TYPE_FIXED32
static constexpr Type TYPE_FIXED32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1994
google::protobuf::compiler::Parser::AddError
void AddError(int line, int column, const std::string &error)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:379
number
int32_t number
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:850
FieldDescriptorProto::TYPE_STRING
static constexpr Type TYPE_STRING
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1998
google::protobuf::io::Tokenizer::TYPE_INTEGER
@ TYPE_INTEGER
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h:109
FieldDescriptorProto::kTypeNameFieldNumber
@ kTypeNameFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2080
EnumValueDescriptorProto::name
const std::string & name() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:10000
google::protobuf::compiler::Parser::ConsumeEndOfDeclaration
bool ConsumeEndOfDeclaration(const char *text, const LocationRecorder *location)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:367
EnumValueDescriptorProto::mutable_name
std::string * mutable_name()
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:10008
google::protobuf::compiler::Parser::LocationRecorder::CurrentPathSize
int CurrentPathSize() const
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:487
EnumDescriptorProto::options
const PROTOBUF_NAMESPACE_ID::EnumOptions & options() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:9821
google::protobuf::WARNING
static const LogLevel WARNING
Definition: bloaty/third_party/protobuf/src/google/protobuf/testing/googletest.h:71
conf.extensions
list extensions
Definition: doc/python/sphinx/conf.py:54
google::protobuf::compiler::Parser::ParseMessageDefinition
bool ParseMessageDefinition(DescriptorProto *message, const LocationRecorder &message_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:750
phone_pb2.containing_type
containing_type
Definition: phone_pb2.py:199
ServiceDescriptorProto::kOptionsFieldNumber
@ kOptionsFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3321
UninterpretedOption::set_double_value
void set_double_value(double value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:13134
google::protobuf::DescriptorPool::ErrorCollector::TYPE
@ TYPE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1641
google::protobuf::io::Tokenizer::TYPE_START
@ TYPE_START
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h:102
SourceCodeInfo::add_location
PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location * add_location()
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:13716
FileDescriptorProto
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:501
EnumValueDescriptorProto::kOptionsFieldNumber
@ kOptionsFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3106
google::protobuf::compiler::Parser::LocationRecorder::RecordLegacyLocation
void RecordLegacyLocation(const Message *descriptor, DescriptorPool::ErrorCollector::ErrorLocation location)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:470
absl::strings_internal::ParseFloat
strings_internal::ParsedFloat ParseFloat(const char *begin, const char *end, chars_format format_flags)
Definition: abseil-cpp/absl/strings/internal/charconv_parse.cc:355
FieldDescriptorProto::kNameFieldNumber
@ kNameFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2078
google::protobuf::compiler::Parser::ParseMessageField
bool ParseMessageField(FieldDescriptorProto *field, RepeatedPtrField< DescriptorProto > *messages, const LocationRecorder &parent_location, int location_field_number_for_nested_type, const LocationRecorder &field_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:898
FieldDescriptorProto::kLabelFieldNumber
@ kLabelFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2086
tests.qps.qps_worker.dest
dest
Definition: qps_worker.py:45
google::protobuf::io::Tokenizer::TYPE_FLOAT
@ TYPE_FLOAT
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h:115
google::protobuf::LowerString
void LowerString(string *s)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:177
MapField
Definition: protobuf/php/ext/google/protobuf/map.c:50
google::protobuf::compiler::Parser::had_errors_
bool had_errors_
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:531
FieldDescriptorProto::set_type_name
void set_type_name(const std::string &value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:8990
google::protobuf::DescriptorPool::ErrorCollector::OTHER
@ OTHER
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1649
value
const char * value
Definition: hpack_parser_table.cc:165
google::protobuf::compiler::Parser::DefaultToOptionalFields
bool DefaultToOptionalFields() const
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:518
google::protobuf::compiler::Parser::LocationRecorder::AttachComments
void AttachComments(std::string *leading, std::string *trailing, std::vector< std::string > *detached_comments) const
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:491
FieldDescriptorProto::TYPE_FLOAT
static constexpr Type TYPE_FLOAT
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1984
google::protobuf::compiler::Parser::Parser
Parser()
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:181
FieldDescriptorProto::TYPE_SINT64
static constexpr Type TYPE_SINT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2016
FATAL
#define FATAL(msg)
Definition: task.h:88
FileDescriptorProto::kPublicDependencyFieldNumber
@ kPublicDependencyFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:639
google::protobuf::compiler::Parser::ParseMessageFieldNoLabel
bool ParseMessageFieldNoLabel(FieldDescriptorProto *field, RepeatedPtrField< DescriptorProto > *messages, const LocationRecorder &parent_location, int location_field_number_for_nested_type, const LocationRecorder &field_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:923
google::protobuf::io::Tokenizer::TYPE_WHITESPACE
@ TYPE_WHITESPACE
Definition: protobuf/src/google/protobuf/io/tokenizer.h:125
FieldDescriptorProto::TYPE_ENUM
static constexpr Type TYPE_ENUM
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2008
google::protobuf::io::Tokenizer::Token::type
TokenType type
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h:128
google::protobuf::SimpleDtoa
string SimpleDtoa(double value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1221
google::protobuf::compiler::Parser::ParseServiceStatement
bool ParseServiceStatement(ServiceDescriptorProto *message, const LocationRecorder &service_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2091
google::protobuf::io::Tokenizer::TYPE_SYMBOL
@ TYPE_SYMBOL
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h:121
FieldDescriptorProto::TYPE_MESSAGE
static constexpr Type TYPE_MESSAGE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2002
google::protobuf::compiler::Parser::ParseOptionNamePart
bool ParseOptionNamePart(UninterpretedOption *uninterpreted_option, const LocationRecorder &part_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1351
google::protobuf::Message
Definition: bloaty/third_party/protobuf/src/google/protobuf/message.h:205
field
const FieldDescriptor * field
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:2692
detached_comments
const char * detached_comments[10]
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer_unittest.cc:526
DescriptorProto_ExtensionRange::kOptionsFieldNumber
@ kOptionsFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1069
upload.group
group
Definition: bloaty/third_party/googletest/googlemock/scripts/upload.py:397
google::protobuf::compiler::Parser::ParseTopLevelStatement
bool ParseTopLevelStatement(FileDescriptorProto *file, const LocationRecorder &root_location)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:704
EnumValueDescriptorProto::set_number
void set_number(::PROTOBUF_NAMESPACE_ID::int32 value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:10104
UninterpretedOption::kNameFieldNumber
@ kNameFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:6224
check_naked_includes.trailing
trailing
Definition: check_naked_includes.py:58
google::protobuf::compiler::Parser::ParseLabel
bool ParseLabel(FieldDescriptorProto::Label *label, const LocationRecorder &field_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2206
google::protobuf::compiler::Parser::LocationRecorder::~LocationRecorder
~LocationRecorder()
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:443
google::protobuf::compiler::Parser::LookingAt
bool LookingAt(const char *text)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:194
google::protobuf::io::Tokenizer::TYPE_NEWLINE
@ TYPE_NEWLINE
Definition: protobuf/src/google/protobuf/io/tokenizer.h:128
EnumDescriptorProto
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2705
google::protobuf::io::Tokenizer::previous
const Token & previous()
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h:398
FieldDescriptorProto::kTypeFieldNumber
@ kTypeFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2087
google::protobuf::compiler::Parser::ParseReserved
bool ParseReserved(DescriptorProto *message, const LocationRecorder &message_location)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1658
DescriptorProto::set_name
void set_name(const std::string &value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:8256
google::protobuf::compiler::Parser::ParseServiceMethod
bool ParseServiceMethod(MethodDescriptorProto *method, const LocationRecorder &method_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2110
SourceCodeInfo_Location
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:6397
UninterpretedOption::identifier_value
const std::string & identifier_value() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:12974
first
StrT first
Definition: cxa_demangle.cpp:4884
DescriptorProto::kReservedNameFieldNumber
@ kReservedNameFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1455
OneofDescriptorProto::mutable_options
PROTOBUF_NAMESPACE_ID::OneofOptions * mutable_options()
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:9583
MethodDescriptorProto::kOptionsFieldNumber
@ kOptionsFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3541
SourceCodeInfo
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:6683
UninterpretedOption::add_name
PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart * add_name()
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:12952
google::protobuf::compiler::Parser::SkipRestOfBlock
void SkipRestOfBlock()
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:529
EnumDescriptorProto::kReservedRangeFieldNumber
@ kReservedRangeFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2841
UninterpretedOption::set_positive_int_value
void set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:13078
regen-readme.line
line
Definition: regen-readme.py:30
DescriptorProto::mutable_options
PROTOBUF_NAMESPACE_ID::MessageOptions * mutable_options()
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:8611
UninterpretedOption::kNegativeIntValueFieldNumber
@ kNegativeIntValueFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:6229
OneofDescriptorProto
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2328
DescriptorProto
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1312
GOOGLE_CHECK
#define GOOGLE_CHECK(EXPRESSION)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:153
google::protobuf::compiler::Parser::ParseUninterpretedBlock
bool ParseUninterpretedBlock(std::string *value)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1388
FileDescriptorProto::kWeakDependencyFieldNumber
@ kWeakDependencyFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:640
google::protobuf::compiler::Parser::ParseServiceDefinition
bool ParseServiceDefinition(ServiceDescriptorProto *service, const LocationRecorder &service_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2053
google::protobuf::compiler::Parser::LocationRecorder::StartAt
void StartAt(const io::Tokenizer::Token &token)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:453
DescriptorProto::kExtensionFieldNumber
@ kExtensionFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1452
FieldDescriptorProto::TYPE_SINT32
static constexpr Type TYPE_SINT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2014
google::protobuf::DescriptorPool::ErrorCollector::EXTENDEE
@ EXTENDEE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1642
google::protobuf::compiler::Parser::ParseReservedNames
bool ParseReservedNames(DescriptorProto *message, const LocationRecorder &parent_location)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1676
DescriptorProto_ReservedRange::kEndFieldNumber
@ kEndFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1268
google::protobuf::io::Tokenizer::Token::text
std::string text
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h:129
input
std::string input
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer_unittest.cc:197
google::protobuf::compiler::Parser::ParseOneof
bool ParseOneof(OneofDescriptorProto *oneof_decl, DescriptorProto *containing_type, int oneof_index, const LocationRecorder &oneof_location, const LocationRecorder &containing_type_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1866
FieldDescriptorProto::TYPE_UINT64
static constexpr Type TYPE_UINT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1988
FieldDescriptorProto::TYPE_SFIXED32
static constexpr Type TYPE_SFIXED32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2010
google::protobuf::compiler::SourceLocationTable::Find
bool Find(const Message *descriptor, DescriptorPool::ErrorCollector::ErrorLocation location, int *line, int *column) const
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2346
FieldDescriptorProto::TYPE_BYTES
static constexpr Type TYPE_BYTES
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2004
google::protobuf::compiler::Parser::ParseDefaultAssignment
bool ParseDefaultAssignment(FieldDescriptorProto *field, const LocationRecorder &field_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1188
google::protobuf::compiler::Parser::upcoming_detached_comments_
std::vector< std::string > upcoming_detached_comments_
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:545
FieldDescriptorProto::kOptionsFieldNumber
@ kOptionsFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2083
iter
Definition: test_winkernel.cpp:47
DescriptorProto_ExtensionRange::kStartFieldNumber
@ kStartFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1070
DescriptorProto::kNameFieldNumber
@ kNameFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1456
SourceCodeInfo::Swap
void Swap(SourceCodeInfo *other)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:6743
EnumDescriptorProto::kNameFieldNumber
@ kNameFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2843
UninterpretedOption::set_string_value
void set_string_value(const std::string &value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:13155
EnumDescriptorProto::value
const PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto & value(int index) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:9786
google::protobuf::compiler::Parser::ParseEnumConstant
bool ParseEnumConstant(EnumValueDescriptorProto *enum_value, const LocationRecorder &enum_value_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1995
FieldDescriptorProto::LABEL_REQUIRED
static constexpr Label LABEL_REQUIRED
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2046
google::protobuf::io::Tokenizer::TYPE_END
@ TYPE_END
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h:103
UninterpretedOption_NamePart
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:5892
google::protobuf::compiler::Parser::ConsumeInteger64
bool ConsumeInteger64(uint64 max_value, uint64 *output, const char *error)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:273
SourceCodeInfo::location
const PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location & location(int index) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:13709
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
FieldDescriptorProto::kJsonNameFieldNumber
@ kJsonNameFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2082
UninterpretedOption::mutable_aggregate_value
std::string * mutable_aggregate_value()
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:13252
google::protobuf::DescriptorPool::ErrorCollector::DEFAULT_VALUE
@ DEFAULT_VALUE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1643
file::name
char * name
Definition: bloaty/third_party/zlib/examples/gzappend.c:176
UninterpretedOption::set_negative_int_value
void set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:13106
google::protobuf::compiler::SourceLocationTable::SourceLocationTable
SourceLocationTable()
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2343
DescriptorProto::kNestedTypeFieldNumber
@ kNestedTypeFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1449
google::protobuf::compiler::Parser::ParseUserDefinedType
bool ParseUserDefinedType(std::string *type_name)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2238
UninterpretedOption::kAggregateValueFieldNumber
@ kAggregateValueFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:6227
google::protobuf::compiler::Parser::LocationRecorder::LocationRecorder
LocationRecorder(Parser *parser)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:399
DescriptorProto::kEnumTypeFieldNumber
@ kEnumTypeFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1450
parser_
std::unique_ptr< Parser > parser_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:185
google::protobuf::compiler::Parser::ParseServiceBlock
bool ParseServiceBlock(ServiceDescriptorProto *service, const LocationRecorder &service_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:2070
GOOGLE_LOG
#define GOOGLE_LOG(LEVEL)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:146
google::protobuf::compiler::Parser::OptionStyle
OptionStyle
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.h:469
EnumDescriptorProto::value_size
int value_size() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:9768
google::protobuf::DescriptorPool::ErrorCollector::OPTION_VALUE
@ OPTION_VALUE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1647
phone_pb2.enum_type
enum_type
Definition: phone_pb2.py:198
google::protobuf::compiler::Parser::LookingAtType
bool LookingAtType(io::Tokenizer::TokenType token_type)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:198
OneofDescriptorProto::kNameFieldNumber
@ kNameFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:2461
descriptor
static const char descriptor[1336]
Definition: certs.upbdefs.c:16
FieldDescriptorProto::set_name
void set_name(const std::string &value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:8811
FieldDescriptorProto::TYPE_BOOL
static constexpr Type TYPE_BOOL
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1996
google_benchmark.option
option
Definition: third_party/benchmark/bindings/python/google_benchmark/__init__.py:115
error_collector_
MockErrorCollector error_collector_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer_unittest.cc:129
google::protobuf::FindOrNull
const Collection::value_type::second_type * FindOrNull(const Collection &collection, const typename Collection::value_type::first_type &key)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/map_util.h:137
FieldDescriptorProto_Label
FieldDescriptorProto_Label
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:211
UninterpretedOption::set_identifier_value
void set_identifier_value(const std::string &value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:12978
UninterpretedOption::kPositiveIntValueFieldNumber
@ kPositiveIntValueFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:6228
google::protobuf::io::Tokenizer::TYPE_STRING
@ TYPE_STRING
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer.h:118
compiler
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc:21
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
google::protobuf::compiler::Parser::ParseMessageBlock
bool ParseMessageBlock(DescriptorProto *message, const LocationRecorder &message_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:818
google::protobuf::compiler::Parser::Parse
bool Parse(io::Tokenizer *input, FileDescriptorProto *file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:614
DO
#define DO(STATEMENT)
Definition: third_party/protobuf/src/google/protobuf/compiler/parser.cc:175
Message
Definition: protobuf/php/ext/google/protobuf/message.c:53
google::protobuf::compiler::Parser::ConsumeString
bool ConsumeString(std::string *output, const char *error)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:320
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
google::protobuf::method
const Descriptor::ReservedRange const EnumValueDescriptor method
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1973
type_name
static const char * type_name(int type)
Definition: adig.c:889
DescriptorProto_ReservedRange
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1134
DescriptorProto_ExtensionRange::kEndFieldNumber
@ kEndFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:1071
google::protobuf::compiler::Parser::ParseJsonName
bool ParseJsonName(FieldDescriptorProto *field, const LocationRecorder &field_location, const FileDescriptorProto *containing_file)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/compiler/parser.cc:1326
MethodDescriptorProto::kClientStreamingFieldNumber
@ kClientStreamingFieldNumber
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:3542
FieldDescriptorProto::set_type
void set_type(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:8969
google::protobuf::service
const Descriptor::ReservedRange const EnumDescriptor::ReservedRange service
Definition: protobuf/src/google/protobuf/descriptor.h:2177
RepeatedField
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:403


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:40