@@ -38,8 +38,6 @@ private TextFormat() {}
38
38
39
39
private static final Logger logger = Logger .getLogger (TextFormat .class .getName ());
40
40
41
- private static final String DEBUG_STRING_SILENT_MARKER = " \t " ;
42
-
43
41
private static final String REDACTED_MARKER = "[REDACTED]" ;
44
42
45
43
/**
@@ -997,15 +995,6 @@ private static final class Tokenizer {
997
995
private int previousLine = 0 ;
998
996
private int previousColumn = 0 ;
999
997
1000
- /**
1001
- * {@link containsSilentMarkerAfterCurrentToken} indicates if there is a silent marker after the
1002
- * current token. This value is moved to {@link containsSilentMarkerAfterPrevToken} every time
1003
- * the next token is parsed.
1004
- */
1005
- private boolean containsSilentMarkerAfterCurrentToken = false ;
1006
-
1007
- private boolean containsSilentMarkerAfterPrevToken = false ;
1008
-
1009
998
/** Construct a tokenizer that parses tokens from the given text. */
1010
999
private Tokenizer (final CharSequence text ) {
1011
1000
this .text = text ;
@@ -1029,14 +1018,6 @@ int getColumn() {
1029
1018
return column ;
1030
1019
}
1031
1020
1032
- boolean getContainsSilentMarkerAfterCurrentToken () {
1033
- return containsSilentMarkerAfterCurrentToken ;
1034
- }
1035
-
1036
- boolean getContainsSilentMarkerAfterPrevToken () {
1037
- return containsSilentMarkerAfterPrevToken ;
1038
- }
1039
-
1040
1021
/** Are we at the end of the input? */
1041
1022
boolean atEnd () {
1042
1023
return currentToken .length () == 0 ;
@@ -1725,19 +1706,6 @@ public static <T extends Message> T parse(
1725
1706
* control the parser behavior.
1726
1707
*/
1727
1708
public static class Parser {
1728
-
1729
- /**
1730
- * A valid silent marker appears between a field name and its value. If there is a ":" in
1731
- * between, the silent marker will only appear after the colon. This is called after a field
1732
- * name is parsed, and before the ":" if it exists. If the current token is ":", then
1733
- * containsSilentMarkerAfterCurrentToken indicates if there is a valid silent marker. Otherwise,
1734
- * the current token is part of the field value, so the silent marker is indicated by
1735
- * containsSilentMarkerAfterPrevToken.
1736
- */
1737
- private void detectSilentMarker (
1738
- Tokenizer tokenizer , Descriptor immediateMessageType , String fieldName ) {
1739
- }
1740
-
1741
1709
/**
1742
1710
* Determines if repeated values for non-repeated fields and oneofs are permitted. For example,
1743
1711
* given required/optional field "foo" and a oneof containing "baz" and "moo":
@@ -2110,14 +2078,12 @@ private void mergeField(
2110
2078
2111
2079
// Skips unknown fields.
2112
2080
if (field == null ) {
2113
- detectSilentMarker (tokenizer , type , name );
2114
2081
guessFieldTypeAndSkip (tokenizer , type , recursionLimit );
2115
2082
return ;
2116
2083
}
2117
2084
2118
2085
// Handle potential ':'.
2119
2086
if (field .getJavaType () == FieldDescriptor .JavaType .MESSAGE ) {
2120
- detectSilentMarker (tokenizer , type , field .getFullName ());
2121
2087
tokenizer .tryConsume (":" ); // optional
2122
2088
if (parseTreeBuilder != null ) {
2123
2089
TextFormatParseInfoTree .Builder childParseTreeBuilder =
@@ -2143,7 +2109,6 @@ private void mergeField(
2143
2109
recursionLimit );
2144
2110
}
2145
2111
} else {
2146
- detectSilentMarker (tokenizer , type , field .getFullName ());
2147
2112
tokenizer .consume (":" ); // required
2148
2113
consumeFieldValues (
2149
2114
tokenizer ,
@@ -2167,27 +2132,26 @@ private void mergeField(
2167
2132
}
2168
2133
}
2169
2134
2170
- private String consumeFullTypeName (Tokenizer tokenizer ) throws ParseException {
2135
+ private void consumeFullTypeName (Tokenizer tokenizer ) throws ParseException {
2171
2136
// If there is not a leading `[`, this is just a type name.
2172
2137
if (!tokenizer .tryConsume ("[" )) {
2173
- return tokenizer .consumeIdentifier ();
2138
+ tokenizer .consumeIdentifier ();
2139
+ return ;
2174
2140
}
2175
2141
2176
2142
// Otherwise, this is an extension or google.protobuf.Any type URL: we consume proto path
2177
2143
// elements until we've addressed the type.
2178
- String name = tokenizer .consumeIdentifier ();
2144
+ tokenizer .consumeIdentifier ();
2179
2145
while (tokenizer .tryConsume ("." )) {
2180
- name += "." + tokenizer .consumeIdentifier ();
2146
+ tokenizer .consumeIdentifier ();
2181
2147
}
2182
2148
if (tokenizer .tryConsume ("/" )) {
2183
- name += "/" + tokenizer .consumeIdentifier ();
2149
+ tokenizer .consumeIdentifier ();
2184
2150
while (tokenizer .tryConsume ("." )) {
2185
- name += "." + tokenizer .consumeIdentifier ();
2151
+ tokenizer .consumeIdentifier ();
2186
2152
}
2187
2153
}
2188
2154
tokenizer .consume ("]" );
2189
-
2190
- return name ;
2191
2155
}
2192
2156
2193
2157
/**
@@ -2433,7 +2397,6 @@ private void mergeAnyFieldValue(
2433
2397
throw tokenizer .parseExceptionPreviousToken ("Expected a valid type URL." );
2434
2398
}
2435
2399
}
2436
- detectSilentMarker (tokenizer , anyDescriptor , typeUrlBuilder .toString ());
2437
2400
tokenizer .tryConsume (":" );
2438
2401
final String anyEndToken ;
2439
2402
if (tokenizer .tryConsume ("<" )) {
@@ -2478,8 +2441,7 @@ private void mergeAnyFieldValue(
2478
2441
/** Skips the next field including the field's name and value. */
2479
2442
private void skipField (Tokenizer tokenizer , Descriptor type , int recursionLimit )
2480
2443
throws ParseException {
2481
- String name = consumeFullTypeName (tokenizer );
2482
- detectSilentMarker (tokenizer , type , name );
2444
+ consumeFullTypeName (tokenizer );
2483
2445
guessFieldTypeAndSkip (tokenizer , type , recursionLimit );
2484
2446
2485
2447
// For historical reasons, fields may optionally be separated by commas or
0 commit comments