37 #ifndef GOOGLE_PROTOBUF_COMPILER_PARSER_H__
38 #define GOOGLE_PROTOBUF_COMPILER_PARSER_H__
45 #include <google/protobuf/descriptor.pb.h>
46 #include <google/protobuf/io/tokenizer.h>
47 #include <google/protobuf/descriptor.h>
48 #include <google/protobuf/repeated_field.h>
51 #include <google/protobuf/port_def.inc>
62 class SourceLocationTable;
71 class PROTOBUF_EXPORT Parser {
90 source_location_table_ = location_table;
120 stop_after_syntax_identifier_ =
value;
124 class LocationRecorder;
138 void SkipStatement();
142 void SkipRestOfBlock();
153 inline bool LookingAt(
const char*
text);
159 bool TryConsume(
const char*
text);
173 bool ConsumeInteger(
int*
output,
const char*
error);
175 bool ConsumeSignedInteger(
int*
output,
const char*
error);
182 bool ConsumeNumber(
double*
output,
const char*
error);
195 bool TryConsumeEndOfDeclaration(
const char*
text,
196 const LocationRecorder* location);
197 bool TryConsumeEndOfDeclarationFinishScope(
const char*
text,
198 const LocationRecorder* location);
200 bool ConsumeEndOfDeclaration(
const char*
text,
201 const LocationRecorder* location);
222 class PROTOBUF_EXPORT LocationRecorder {
232 LocationRecorder(
const LocationRecorder& parent);
235 LocationRecorder(
const LocationRecorder& parent,
int path1);
236 LocationRecorder(
const LocationRecorder& parent,
int path1,
int path2);
239 LocationRecorder(
const LocationRecorder& parent,
int path1,
246 void AddPath(
int path_component);
254 void StartAt(
const LocationRecorder& other);
265 void RecordLegacyLocation(
272 int CurrentPathSize()
const;
300 bool ParseSyntaxIdentifier(
const LocationRecorder& parent);
314 const LocationRecorder& root_location);
318 const LocationRecorder& message_location,
321 const LocationRecorder& enum_location,
324 const LocationRecorder& service_location,
327 const LocationRecorder& root_location,
332 const LocationRecorder& root_location,
339 const LocationRecorder& message_location,
342 const LocationRecorder& enum_location,
345 const LocationRecorder& service_location,
351 const LocationRecorder& message_location,
354 const LocationRecorder& enum_location,
357 const LocationRecorder& service_location,
370 const LocationRecorder& parent_location,
371 int location_field_number_for_nested_type,
372 const LocationRecorder& field_location,
379 const LocationRecorder& parent_location,
380 int location_field_number_for_nested_type,
381 const LocationRecorder& field_location,
386 const LocationRecorder& extensions_location,
391 const LocationRecorder& message_location);
393 const LocationRecorder& parent_location);
395 const LocationRecorder& parent_location);
397 const LocationRecorder& message_location);
399 const LocationRecorder& parent_location);
401 const LocationRecorder& parent_location);
407 const LocationRecorder& parent_location,
408 int location_field_number_for_nested_type,
409 const LocationRecorder& extend_location,
417 const LocationRecorder& oneof_location,
418 const LocationRecorder& containing_type_location,
423 const LocationRecorder& enum_value_location,
429 const LocationRecorder& enum_value_location,
434 const LocationRecorder& method_location,
439 bool ParseMethodOptions(
const LocationRecorder& parent_location,
441 const int optionsFieldNumber,
447 const LocationRecorder& field_location,
460 const LocationRecorder& field_location,
466 const LocationRecorder& field_location,
470 const LocationRecorder& field_location,
481 bool ParseOption(
Message*
options,
const LocationRecorder& options_location,
490 const LocationRecorder& part_location,
523 return syntax_identifier_ ==
"proto3";
536 bool stop_after_syntax_identifier_;
548 std::vector<std::string> upcoming_detached_comments_;
561 class PROTOBUF_EXPORT SourceLocationTable {
563 SourceLocationTable();
564 ~SourceLocationTable();
589 std::pair<const Message*, DescriptorPool::ErrorCollector::ErrorLocation>,
590 std::pair<int, int> >
593 std::map<std::pair<const Message*, std::string>, std::pair<int, int> >
601 #include <google/protobuf/port_undef.inc>
603 #endif // GOOGLE_PROTOBUF_COMPILER_PARSER_H__