| OLD | NEW |
| 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 | 537 |
| 538 if (require_syntax_identifier_ || LookingAt("syntax")) { | 538 if (require_syntax_identifier_ || LookingAt("syntax")) { |
| 539 if (!ParseSyntaxIdentifier(root_location)) { | 539 if (!ParseSyntaxIdentifier(root_location)) { |
| 540 // Don't attempt to parse the file if we didn't recognize the syntax | 540 // Don't attempt to parse the file if we didn't recognize the syntax |
| 541 // identifier. | 541 // identifier. |
| 542 return false; | 542 return false; |
| 543 } | 543 } |
| 544 // Store the syntax into the file. | 544 // Store the syntax into the file. |
| 545 if (file != NULL) file->set_syntax(syntax_identifier_); | 545 if (file != NULL) file->set_syntax(syntax_identifier_); |
| 546 } else if (!stop_after_syntax_identifier_) { | 546 } else if (!stop_after_syntax_identifier_) { |
| 547 GOOGLE_LOG(WARNING) << "No syntax specified for the proto file. " | 547 GOOGLE_LOG(WARNING) << "No syntax specified for the proto file: " |
| 548 << "Please use 'syntax = \"proto2\";' or " | 548 << file->name() << ". Please use 'syntax = \"proto2\";' " |
| 549 << "'syntax = \"proto3\";' to specify a syntax " | 549 << "or 'syntax = \"proto3\";' to specify a syntax " |
| 550 << "version. (Defaulted to proto2 syntax.)"; | 550 << "version. (Defaulted to proto2 syntax.)"; |
| 551 syntax_identifier_ = "proto2"; | 551 syntax_identifier_ = "proto2"; |
| 552 } | 552 } |
| 553 | 553 |
| 554 if (stop_after_syntax_identifier_) return !had_errors_; | 554 if (stop_after_syntax_identifier_) return !had_errors_; |
| 555 | 555 |
| 556 // Repeatedly parse statements until we reach the end of the file. | 556 // Repeatedly parse statements until we reach the end of the file. |
| 557 while (!AtEnd()) { | 557 while (!AtEnd()) { |
| 558 if (!ParseTopLevelStatement(file, root_location)) { | 558 if (!ParseTopLevelStatement(file, root_location)) { |
| 559 // This statement failed to parse. Skip it, but keep looping to parse | 559 // This statement failed to parse. Skip it, but keep looping to parse |
| (...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2100 std::make_pair(line, column); | 2100 std::make_pair(line, column); |
| 2101 } | 2101 } |
| 2102 | 2102 |
| 2103 void SourceLocationTable::Clear() { | 2103 void SourceLocationTable::Clear() { |
| 2104 location_map_.clear(); | 2104 location_map_.clear(); |
| 2105 } | 2105 } |
| 2106 | 2106 |
| 2107 } // namespace compiler | 2107 } // namespace compiler |
| 2108 } // namespace protobuf | 2108 } // namespace protobuf |
| 2109 } // namespace google | 2109 } // namespace google |
| OLD | NEW |