aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/compiler/parser.h')
-rw-r--r--src/google/protobuf/compiler/parser.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/google/protobuf/compiler/parser.h b/src/google/protobuf/compiler/parser.h
index 01d8a66b..5d98e5e1 100644
--- a/src/google/protobuf/compiler/parser.h
+++ b/src/google/protobuf/compiler/parser.h
@@ -224,6 +224,10 @@ class LIBPROTOBUF_EXPORT Parser {
LocationRecorder(const LocationRecorder& parent, int path1);
LocationRecorder(const LocationRecorder& parent, int path1, int path2);
+ // Creates a recorder that generates locations into given source code info.
+ LocationRecorder(const LocationRecorder& parent, int path1,
+ SourceCodeInfo* source_code_info);
+
~LocationRecorder();
// Add a path component. See SourceCodeInfo.Location.path in
@@ -250,6 +254,9 @@ class LIBPROTOBUF_EXPORT Parser {
void RecordLegacyLocation(const Message* descriptor,
DescriptorPool::ErrorCollector::ErrorLocation location);
+ // Returns the number of path components in the recorder's current location.
+ int CurrentPathSize() const;
+
// Attaches leading and trailing comments to the location. The two strings
// will be swapped into place, so after this is called *leading and
// *trailing will be empty.
@@ -264,9 +271,10 @@ class LIBPROTOBUF_EXPORT Parser {
// SourceCodeInfo.location repeated field. For top-level elements,
// parent_index_ is -1.
Parser* parser_;
+ SourceCodeInfo* source_code_info_;
SourceCodeInfo::Location* location_;
- void Init(const LocationRecorder& parent);
+ void Init(const LocationRecorder& parent, SourceCodeInfo* source_code_info);
};
// =================================================================