File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
dot-parse/src/main/java/com/google/common/labs/parse Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -1235,20 +1235,15 @@ public Parser<T> notEmpty() {
12351235 * empty value.
12361236 */
12371237 public T parse (String input ) {
1238- return input . isEmpty () ? computeDefaultValue () : notEmpty ().parse (input );
1238+ return asUnsafeZeroWidthParser ().parse (input );
12391239 }
12401240
12411241 /**
12421242 * Parses the entire input string, ignoring patterns matched by {@code skip}, and returns the
12431243 * result; if there's nothing to parse except skippable content, returns the default empty value.
12441244 */
12451245 public T parseSkipping (Parser <?> skip , String input ) {
1246- return notEmpty ()
1247- .followedByEof ()
1248- .skipping (skip )
1249- .parseToStream (input )
1250- .findFirst ()
1251- .orElseGet (defaultSupplier );
1246+ return asUnsafeZeroWidthParser ().parseSkipping (skip , input );
12521247 }
12531248
12541249 /**
@@ -1555,7 +1550,8 @@ <V> MatchResult.Failure<V> expecting(String name, int at) {
15551550
15561551 <V > MatchResult .Failure <V > failAt (int at , String message , Object ... args ) {
15571552 var failure = new MatchResult .Failure <V >(at , message , args );
1558- if (farthestFailure == null || failure .at () > farthestFailure .at ()) {
1553+ // prefer the farthest then the most recent failure
1554+ if (farthestFailure == null || failure .at () >= farthestFailure .at ()) {
15591555 farthestFailure = failure ;
15601556 }
15611557 return failure ;
You can’t perform that action at this time.
0 commit comments