@@ -482,7 +482,7 @@ absl::Status ParseSingular(JsonLexer& lex, Field<Traits> field,
482482 Traits::SetBool (field, msg, false );
483483 break ;
484484 case JsonLexer::kStr : {
485- if (!lex.options ().allow_legacy_syntax ) {
485+ if (!lex.options ().allow_legacy_nonconformant_behavior ) {
486486 goto bad;
487487 }
488488
@@ -672,7 +672,7 @@ absl::Status ParseArray(JsonLexer& lex, Field<Traits> field, Msg<Traits>& msg) {
672672 return ParseSingular<Traits>(lex, field, msg);
673673 }
674674
675- if (lex.options ().allow_legacy_syntax ) {
675+ if (lex.options ().allow_legacy_nonconformant_behavior ) {
676676 RETURN_IF_ERROR (lex.Expect (" null" ));
677677 return EmitNull<Traits>(lex, field, msg);
678678 }
@@ -689,7 +689,7 @@ absl::Status ParseArray(JsonLexer& lex, Field<Traits> field, Msg<Traits>& msg) {
689689 // the custom parser handler.
690690 bool can_flatten =
691691 type != MessageType::kValue && type != MessageType::kList ;
692- if (can_flatten && lex.options ().allow_legacy_syntax &&
692+ if (can_flatten && lex.options ().allow_legacy_nonconformant_behavior &&
693693 lex.Peek (JsonLexer::kArr )) {
694694 // You read that right. In legacy mode, if we encounter an array within
695695 // an array, we just flatten it as part of the current array!
@@ -1023,7 +1023,7 @@ absl::Status ParseFieldMask(JsonLexer& lex, const Desc<Traits>& desc,
10231023 } else if (absl::ascii_isupper (c)) {
10241024 snake_path.push_back (' _' );
10251025 snake_path.push_back (absl::ascii_tolower (c));
1026- } else if (lex.options ().allow_legacy_syntax ) {
1026+ } else if (lex.options ().allow_legacy_nonconformant_behavior ) {
10271027 snake_path.push_back (c);
10281028 } else {
10291029 return str->loc .Invalid (" unexpected character in FieldMask" );
@@ -1069,7 +1069,8 @@ absl::Status ParseAny(JsonLexer& lex, const Desc<Traits>& desc,
10691069 // limit.
10701070 JsonLexer any_lex (&in, lex.options (), &lex.path (), mark.loc );
10711071
1072- if (!type_url.has_value () && !lex.options ().allow_legacy_syntax ) {
1072+ if (!type_url.has_value () &&
1073+ !lex.options ().allow_legacy_nonconformant_behavior ) {
10731074 return mark.loc .Invalid (" missing @type in Any" );
10741075 }
10751076
@@ -1085,7 +1086,7 @@ absl::Status ParseAny(JsonLexer& lex, const Desc<Traits>& desc,
10851086 });
10861087 } else {
10871088 // Empty {} is accepted in legacy mode.
1088- ABSL_DCHECK (lex.options ().allow_legacy_syntax );
1089+ ABSL_DCHECK (lex.options ().allow_legacy_nonconformant_behavior );
10891090 RETURN_IF_ERROR (any_lex.VisitObject ([&](auto &) {
10901091 return mark.loc .Invalid (
10911092 " in legacy mode, missing @type in Any is only allowed for an empty "
@@ -1253,9 +1254,9 @@ absl::Status ParseField(JsonLexer& lex, const Desc<Traits>& desc,
12531254 auto pop = lex.path ().Push (name, Traits::FieldType (*field),
12541255 Traits::FieldTypeName (*field));
12551256
1256- if (Traits::HasParsed (
1257- *field, msg,
1258- /* allow_repeated_non_oneof= */ lex.options ().allow_legacy_syntax ) &&
1257+ if (Traits::HasParsed (*field, msg,
1258+ /* allow_repeated_non_oneof= */
1259+ lex.options ().allow_legacy_nonconformant_behavior ) &&
12591260 !lex.Peek (JsonLexer::kNull )) {
12601261 return lex.Invalid (absl::StrFormat (
12611262 " '%s' has already been set (either directly or as part of a oneof)" ,
@@ -1267,7 +1268,8 @@ absl::Status ParseField(JsonLexer& lex, const Desc<Traits>& desc,
12671268 }
12681269
12691270 if (Traits::IsRepeated (*field)) {
1270- if (lex.options ().allow_legacy_syntax && !lex.Peek (JsonLexer::kArr )) {
1271+ if (lex.options ().allow_legacy_nonconformant_behavior &&
1272+ !lex.Peek (JsonLexer::kArr )) {
12711273 // The original ESF parser permits a single element in place of an array
12721274 // thereof.
12731275 return ParseSingular<Traits>(lex, *field, msg);
@@ -1297,7 +1299,8 @@ absl::Status ParseMessage(JsonLexer& lex, const Desc<Traits>& desc,
12971299 // It is not clear if this counts as out-of-spec, but we're treating it as
12981300 // such.
12991301 bool is_upcoming_object = lex.Peek (JsonLexer::kObj );
1300- if (!(is_upcoming_object && lex.options ().allow_legacy_syntax )) {
1302+ if (!(is_upcoming_object &&
1303+ lex.options ().allow_legacy_nonconformant_behavior )) {
13011304 switch (type) {
13021305 case MessageType::kList :
13031306 return ParseListValue<Traits>(lex, desc, msg);
0 commit comments