Internal changes

PiperOrigin-RevId: 534875127
pull/12893/head
Mike Kruskal 2 years ago committed by Copybara-Service
parent 254a571cb0
commit 087cbcd6f5
  1. 5
      src/google/protobuf/compiler/parser.cc
  2. 3
      src/google/protobuf/compiler/parser.h

@ -663,7 +663,7 @@ bool Parser::Parse(io::Tokenizer* input, FileDescriptorProto* file) {
if (require_syntax_identifier_ || LookingAt("syntax")
) {
if (!ParseSyntaxIdentifier(root_location)) {
if (!ParseSyntaxIdentifier(file, root_location)) {
// Don't attempt to parse the file if we didn't recognize the syntax
// identifier.
return false;
@ -706,7 +706,8 @@ bool Parser::Parse(io::Tokenizer* input, FileDescriptorProto* file) {
return !had_errors_;
}
bool Parser::ParseSyntaxIdentifier(const LocationRecorder& parent) {
bool Parser::ParseSyntaxIdentifier(const FileDescriptorProto* file,
const LocationRecorder& parent) {
LocationRecorder syntax_location(parent,
FileDescriptorProto::kSyntaxFieldNumber);
DO(Consume("syntax",

@ -304,7 +304,8 @@ class PROTOBUF_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(const LocationRecorder& parent);
bool ParseSyntaxIdentifier(const FileDescriptorProto* file,
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,

Loading…
Cancel
Save