aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/parser.h
diff options
context:
space:
mode:
authorJisi Liu <jisi.liu@gmail.com>2015-02-28 14:51:22 -0800
committerJisi Liu <jisi.liu@gmail.com>2015-02-28 17:06:49 -0800
commit885b612f74f133678bf82808c589331e4c59dad9 (patch)
treee5f3f65b41af477c52810053b8694896c8bcd1f7 /src/google/protobuf/compiler/parser.h
parent1939efed2db35020b7830a4927f10feac47b6757 (diff)
downloadprotobuf-885b612f74f133678bf82808c589331e4c59dad9.tar.gz
protobuf-885b612f74f133678bf82808c589331e4c59dad9.tar.bz2
protobuf-885b612f74f133678bf82808c589331e4c59dad9.zip
Down integrate from Google internal branch for C++ and Java.
- Maps for C++ lite - C++ Arena optimizations. - Java Lite runtime code size optimization. Change-Id: I7537a4357c1cb385d23f9e8aa7ffdfeefe079f13
Diffstat (limited to 'src/google/protobuf/compiler/parser.h')
-rw-r--r--src/google/protobuf/compiler/parser.h37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/google/protobuf/compiler/parser.h b/src/google/protobuf/compiler/parser.h
index a15cc705..7cb1678a 100644
--- a/src/google/protobuf/compiler/parser.h
+++ b/src/google/protobuf/compiler/parser.h
@@ -185,10 +185,13 @@ class LIBPROTOBUF_EXPORT Parser {
// have been passed around by const reference, for no particularly good
// reason. We should probably go through and change them all to mutable
// pointer to make this more intuitive.
- bool TryConsumeEndOfDeclaration(const char* text,
- const LocationRecorder* location);
- bool ConsumeEndOfDeclaration(const char* text,
- const LocationRecorder* location);
+ bool TryConsumeEndOfDeclaration(
+ const char* text, const LocationRecorder* location);
+ bool TryConsumeEndOfDeclarationFinishScope(
+ const char* text, const LocationRecorder* location);
+
+ bool ConsumeEndOfDeclaration(
+ const char* text, const LocationRecorder* location);
// -----------------------------------------------------------------
// Error logging helpers
@@ -253,9 +256,13 @@ class LIBPROTOBUF_EXPORT Parser {
//
// TODO(kenton): See comment on TryConsumeEndOfDeclaration(), above, for
// why this is const.
- void AttachComments(string* leading, string* trailing) const;
+ void AttachComments(string* leading, string* trailing,
+ vector<string>* detached_comments) const;
private:
+ // Indexes of parent and current location in the parent
+ // SourceCodeInfo.location repeated field. For top-level elements,
+ // parent_index_ is -1.
Parser* parser_;
SourceCodeInfo::Location* location_;
@@ -268,7 +275,7 @@ class LIBPROTOBUF_EXPORT Parser {
// Parses the "syntax = \"proto2\";" line at the top of the file. Returns
// false if it failed to parse or if the syntax identifier was not
// recognized.
- bool ParseSyntaxIdentifier();
+ bool ParseSyntaxIdentifier(const LocationRecorder& parent);
// These methods parse various individual bits of code. They return
// false if they completely fail to parse the construct. In this case,
@@ -302,9 +309,6 @@ class LIBPROTOBUF_EXPORT Parser {
RepeatedField<int32>* weak_dependency,
const LocationRecorder& root_location,
const FileDescriptorProto* containing_file);
- bool ParseOption(Message* options,
- const LocationRecorder& options_location,
- const FileDescriptorProto* containing_file);
// These methods parse the contents of a message, enum, or service type and
// add them to the given object. They consume the entire block including
@@ -397,10 +401,10 @@ class LIBPROTOBUF_EXPORT Parser {
// Parse options of a single method or stream.
- bool ParseOptions(const LocationRecorder& parent_location,
- const FileDescriptorProto* containing_file,
- const int optionsFieldNumber,
- Message* mutable_options);
+ bool ParseMethodOptions(const LocationRecorder& parent_location,
+ const FileDescriptorProto* containing_file,
+ const int optionsFieldNumber,
+ Message* mutable_options);
// Parse "required", "optional", or "repeated" and fill in "label"
// with the value. Returns true if shuch a label is consumed.
@@ -497,6 +501,13 @@ class LIBPROTOBUF_EXPORT Parser {
// yet; use ConsumeEndOfDeclaration() to get the complete comments.
string upcoming_doc_comments_;
+ // Detached comments are not connected to any syntax entities. Elements in
+ // this vector are paragraphs of comments separated by empty lines. The
+ // detached comments will be put into the leading_detached_comments field for
+ // the next element (See SourceCodeInfo.Location in descriptor.proto), when
+ // ConsumeEndOfDeclaration() is called.
+ vector<string> upcoming_detached_comments_;
+
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Parser);
};