コード例 #1
0
 private Result consume(Parser parser, Context context) {
   Result result = parser.parseOn(context);
   while (result.isSuccess()) {
     result = parser.parseOn(result);
   }
   return result;
 }
コード例 #2
0
 @Override
 public Result parseOn(Context context) {
   Result leftResult = consume(left, context);
   Result delegateResult = delegate.parseOn(leftResult);
   if (delegateResult.isFailure()) {
     return delegateResult;
   }
   Result rightResult = consume(right, delegateResult);
   return rightResult.success(delegateResult.get());
 }