Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Side by Side Diff: third_party/protobuf/src/google/protobuf/compiler/parser.h

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // FileDescriptor. 64 // FileDescriptor.
65 class LIBPROTOBUF_EXPORT Parser { 65 class LIBPROTOBUF_EXPORT Parser {
66 public: 66 public:
67 Parser(); 67 Parser();
68 ~Parser(); 68 ~Parser();
69 69
70 // Parse the entire input and construct a FileDescriptorProto representing 70 // Parse the entire input and construct a FileDescriptorProto representing
71 // it. Returns true if no errors occurred, false otherwise. 71 // it. Returns true if no errors occurred, false otherwise.
72 bool Parse(io::Tokenizer* input, FileDescriptorProto* file); 72 bool Parse(io::Tokenizer* input, FileDescriptorProto* file);
73 73
74 // Optional fetaures: 74 // Optional features:
75 75
76 // DEPRECATED: New code should use the SourceCodeInfo embedded in the 76 // DEPRECATED: New code should use the SourceCodeInfo embedded in the
77 // FileDescriptorProto. 77 // FileDescriptorProto.
78 // 78 //
79 // Requests that locations of certain definitions be recorded to the given 79 // Requests that locations of certain definitions be recorded to the given
80 // SourceLocationTable while parsing. This can be used to look up exact line 80 // SourceLocationTable while parsing. This can be used to look up exact line
81 // and column numbers for errors reported by DescriptorPool during validation. 81 // and column numbers for errors reported by DescriptorPool during validation.
82 // Set to NULL (the default) to discard source location information. 82 // Set to NULL (the default) to discard source location information.
83 void RecordSourceLocationsTo(SourceLocationTable* location_table) { 83 void RecordSourceLocationsTo(SourceLocationTable* location_table) {
84 source_location_table_ = location_table; 84 source_location_table_ = location_table;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 void RecordLegacyLocation(const Message* descriptor, 250 void RecordLegacyLocation(const Message* descriptor,
251 DescriptorPool::ErrorCollector::ErrorLocation location); 251 DescriptorPool::ErrorCollector::ErrorLocation location);
252 252
253 // Attaches leading and trailing comments to the location. The two strings 253 // Attaches leading and trailing comments to the location. The two strings
254 // will be swapped into place, so after this is called *leading and 254 // will be swapped into place, so after this is called *leading and
255 // *trailing will be empty. 255 // *trailing will be empty.
256 // 256 //
257 // TODO(kenton): See comment on TryConsumeEndOfDeclaration(), above, for 257 // TODO(kenton): See comment on TryConsumeEndOfDeclaration(), above, for
258 // why this is const. 258 // why this is const.
259 void AttachComments(string* leading, string* trailing, 259 void AttachComments(string* leading, string* trailing,
260 vector<string>* detached_comments) const; 260 std::vector<string>* detached_comments) const;
261 261
262 private: 262 private:
263 // Indexes of parent and current location in the parent 263 // Indexes of parent and current location in the parent
264 // SourceCodeInfo.location repeated field. For top-level elements, 264 // SourceCodeInfo.location repeated field. For top-level elements,
265 // parent_index_ is -1. 265 // parent_index_ is -1.
266 Parser* parser_; 266 Parser* parser_;
267 SourceCodeInfo::Location* location_; 267 SourceCodeInfo::Location* location_;
268 268
269 void Init(const LocationRecorder& parent); 269 void Init(const LocationRecorder& parent);
270 }; 270 };
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 513
514 // Leading doc comments for the next declaration. These are not complete 514 // Leading doc comments for the next declaration. These are not complete
515 // yet; use ConsumeEndOfDeclaration() to get the complete comments. 515 // yet; use ConsumeEndOfDeclaration() to get the complete comments.
516 string upcoming_doc_comments_; 516 string upcoming_doc_comments_;
517 517
518 // Detached comments are not connected to any syntax entities. Elements in 518 // Detached comments are not connected to any syntax entities. Elements in
519 // this vector are paragraphs of comments separated by empty lines. The 519 // this vector are paragraphs of comments separated by empty lines. The
520 // detached comments will be put into the leading_detached_comments field for 520 // detached comments will be put into the leading_detached_comments field for
521 // the next element (See SourceCodeInfo.Location in descriptor.proto), when 521 // the next element (See SourceCodeInfo.Location in descriptor.proto), when
522 // ConsumeEndOfDeclaration() is called. 522 // ConsumeEndOfDeclaration() is called.
523 vector<string> upcoming_detached_comments_; 523 std::vector<string> upcoming_detached_comments_;
524 524
525 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Parser); 525 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Parser);
526 }; 526 };
527 527
528 // A table mapping (descriptor, ErrorLocation) pairs -- as reported by 528 // A table mapping (descriptor, ErrorLocation) pairs -- as reported by
529 // DescriptorPool when validating descriptors -- to line and column numbers 529 // DescriptorPool when validating descriptors -- to line and column numbers
530 // within the original source code. 530 // within the original source code.
531 // 531 //
532 // This is semi-obsolete: FileDescriptorProto.source_code_info now contains 532 // This is semi-obsolete: FileDescriptorProto.source_code_info now contains
533 // far more complete information about source locations. However, as of this 533 // far more complete information about source locations. However, as of this
(...skipping 15 matching lines...) Expand all
549 549
550 // Adds a location to the table. 550 // Adds a location to the table.
551 void Add(const Message* descriptor, 551 void Add(const Message* descriptor,
552 DescriptorPool::ErrorCollector::ErrorLocation location, 552 DescriptorPool::ErrorCollector::ErrorLocation location,
553 int line, int column); 553 int line, int column);
554 554
555 // Clears the contents of the table. 555 // Clears the contents of the table.
556 void Clear(); 556 void Clear();
557 557
558 private: 558 private:
559 typedef map< 559 typedef std::map<
560 pair<const Message*, DescriptorPool::ErrorCollector::ErrorLocation>, 560 std::pair<const Message*, DescriptorPool::ErrorCollector::ErrorLocation>,
561 pair<int, int> > LocationMap; 561 std::pair<int, int> > LocationMap;
562 LocationMap location_map_; 562 LocationMap location_map_;
563 }; 563 };
564 564
565 } // namespace compiler 565 } // namespace compiler
566 } // namespace protobuf 566 } // namespace protobuf
567 567
568 } // namespace google 568 } // namespace google
569 #endif // GOOGLE_PROTOBUF_COMPILER_PARSER_H__ 569 #endif // GOOGLE_PROTOBUF_COMPILER_PARSER_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698