A {@link Parser} that runs {@code consequence} if {@code this} succeeds, or {@code alternative} otherwise.
325080
public final <R> Parser<R> ifelse(Parser<? extends R> consequence, Parser<? extends R> alternative) {
    return ifelse(__ -> consequence, alternative);
  }
196870
private static <T> void checkPreconditions(final Class<T> type, final TextParser<T> parser) {
        if(type == null) {
            throw new NullPointerException("type is null.");
        }
        
        if(parser == null) {
            throw new NullPointerException("parser is null.");
        }
    }
809419
@SuppressWarnings("unchecked")
    private V report(int s) throws ExecutionException {
        Object x = outcome;
        if (s == NORMAL)
            return (V)x;
        if (s >= CANCELLED)
            throw new CancellationException();
        throw new ExecutionException((Throwable)x);
    }
799702
public static <T> Parser<T> or(Iterable<? extends Parser<? extends T>> alternatives) {
    return or(toArray(alternatives));
  }
889058
public final Parser<T> followedBy(Parser<?> parser) {
    return Parsers.sequence(this, parser, InternalFunctors.<T, Object>firstOfTwo());
  }
712010
private ParseTree parseThrowStatement() {
    SourcePosition start = getTreeStartLocation();
    eat(TokenType.THROW);
    ParseTree value = null;
    if (peekImplicitSemiColon()) {
      reportError("semicolon/newline not allowed after 'throw'");
    } else {
      value = parseExpression();
    }
    eatPossibleImplicitSemiColon();
    return new ThrowStatementTree(getTreeLocation(start), value);
  }
578536
public final void consequence_key() throws RecognitionException {
		try {
			// src/main/resources/org/drools/compiler/lang/dsl/DSLMapWalker.g:163:5: ( VT_CONSEQUENCE )
			// src/main/resources/org/drools/compiler/lang/dsl/DSLMapWalker.g:163:7: VT_CONSEQUENCE
			{
			match(input,VT_CONSEQUENCE,FOLLOW_VT_CONSEQUENCE_in_consequence_key524); 
			entry_stack.peek().retval.setSection(DSLMappingEntry.CONSEQUENCE);
			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
		}
	}
45855
function(opts, argv, error)
    {
        var parser = new Parser(opts, argv, error);
        return parser.parse();
    }
165890
final boolean withErrorSuppressed(Parser<?> parser) {
    boolean oldValue = errorSuppressed;
    errorSuppressed = true;
    boolean ok = parser.apply(this);
    errorSuppressed = oldValue;
    return ok;
  }
295846
static <R> BiPredicate<R, Throwable> failurePredicateFor(List<Class<? extends Throwable>> failures) {
    return (t, u) -> {
      if (u == null)
        return false;
      for (Class<? extends Throwable> failureType : failures)
        if (failureType.isAssignableFrom(u.getClass()))
          return true;
      return false;
    };
  }
1339953
public static <T extends Throwable, A> Try<T, A> success(A a) {
        return new Success<>(a);
    }
40049
public void execute() {
    try {
      Command command = new Parser().parse();
      try {
        command.execute(new ContextImpl(), execute);
        close();
      } catch (Exception e) {
        throw new RuntimeException(
            "Error while executing command " + command, e);
      } catch (AssertionError e) {
        throw new RuntimeException(
            "Error while executing command " + command, e);
      }
    } finally {
      try {
        reader.close();
      } catch (IOException e) {
        e.printStackTrace();
      }
      writer.close();
      try {
        close();
      } catch (SQLException e) {
        // ignore
      }
    }
  }
789880
private void propagateAsError(Throwable t) {
        if ( t instanceof InvocationTargetException) {
            t = t.getCause();   
        }
        if ( Error.class.isAssignableFrom(t.getClass())) {
            throw (Error)t;    
        }
        throw new PolledAssertionError(t);
    }
1143716
static <R> BiPredicate<R, Throwable> resultPredicateFor(Predicate<R> resultPredicate) {
    return (t, u) -> {
      if (u == null) {
        return resultPredicate.test(t);
      } else {
        // resultPredicate is only defined over the success type.
        // It doesn't know how to handle a failure of type Throwable,
        // so we return false here.
        return false;
      }
    };
  }
288586
public void parse() throws CompilationFailedException {
        if (this.phase > Phases.PARSING) {
            throw new GroovyBugError("parsing is already complete");
        }

        if (this.phase == Phases.INITIALIZATION) {
            nextPhase();
        }

        //
        // Create a reader on the source and run the parser.

        Reader reader = null;
        try {
            reader = source.getReader();

            // let's recreate the parser each time as it tends to keep around state
            parserPlugin = getConfiguration().getPluginFactory().createParserPlugin();

            cst = parserPlugin.parseCST(this, reader);

            reader.close();

        }
        catch (IOException e) {
            getErrorCollector().addFatalError(new SimpleMessage(e.getMessage(), this));
        }
        finally {
            if (reader != null) {
                try {
                    reader.close();
                }
                catch (IOException e) {
                    // Ignore
                }
            }
        }
    }
549053
public <T> T execute(final Object[] args, final Class<T> clazz, final boolean failOnError) {
        if (this.groovyScript != null) {
            return ScriptingUtils.executeGroovyScript(this.groovyScript, args, clazz, failOnError);
        }
        return null;
    }
691044
public static <T extends Errors> T parseErrorResponse(ObjectMapper mapper, ResponseBody errorResponse, Class<T> cls) throws IOException {
        return mapper.readValue(errorResponse.bytes(), cls);
    }