fn parse_fcp_subcommand<'a>(
    setup: &'a RfcbotConfig,
    command: &'a str,
    subcommand: &'a str,
    fcp_context: bool,
) -> DashResult<RfcBotCommand<'a>> {
    Ok(match subcommand {
        // Parse a FCP merge command:
        "merge" | "merged" | "merging" | "merges" => {
            RfcBotCommand::FcpPropose(FcpDisposition::Merge)
        }

        // Parse a FCP close command:
        "close" | "closed" | "closing" | "closes" => {
            RfcBotCommand::FcpPropose(FcpDisposition::Close)
        }

        // Parse a FCP postpone command:
        "postpone" | "postponed" | "postponing" | "postpones" => {
            RfcBotCommand::FcpPropose(FcpDisposition::Postpone)
        }

        // Parse a FCP cancel command:
        "cancel" | "canceled" | "canceling" | "cancels" => RfcBotCommand::FcpCancel,

        // Parse a FCP reviewed command:
        "reviewed" | "review" | "reviewing" | "reviews" => RfcBotCommand::Reviewed,

        // Parse a FCP concern command:
        "concern" | "concerned" | "concerning" | "concerns" => {
            debug!("Parsed command as NewConcern");
            RfcBotCommand::NewConcern(parse_command_text(command, subcommand))
        }

        // Parse a FCP resolve command:
        "resolve" | "resolved" | "resolving" | "resolves" => {
            debug!("Parsed command as ResolveConcern");
            RfcBotCommand::ResolveConcern(parse_command_text(command, subcommand))
        }

        // Parse a StartPoll command:
        "ask" | "asked" | "asking" | "asks" | "poll" | "polled" | "polling" | "polls" | "query"
        | "queried" | "querying" | "queries" | "inquire" | "inquired" | "inquiring"
        | "inquires" | "quiz" | "quizzed" | "quizzing" | "quizzes" | "survey" | "surveyed"
        | "surveying" | "surveys" => {
            debug!("Parsed command as StartPoll");

            let mut question = parse_command_text(command, subcommand);
            let mut teams = BTreeSet::new();
            while let Some(team_candidate) = question.split_whitespace().next() {
                if let Some(team) = match_team_candidate(setup, team_candidate) {
                    question = parse_command_text(question, team_candidate);
                    teams.insert(&*team.0);
                } else {
                    break;
                }
            }
            RfcBotCommand::StartPoll { teams, question }
        }

        _ => throw!(DashError::Misc(if fcp_context {
            error!("unrecognized subcommand for fcp: {}", subcommand);
            Some(format!("found bad subcommand: {}", subcommand))
        } else {
            None
        })),
    })
}
/// Parses all subcommands under the fcp command.
/// If `fcp_context` is set to false, `@rfcbot <subcommand>`
/// was passed and not `@rfcbot fcp <subcommand>`.
///
/// @rfcbot accepts roughly the following grammar:
///
/// merge ::= "merge" | "merged" | "merging" | "merges" ;
/// close ::= "close" | "closed" | "closing" | "closes" ;
/// postpone ::= "postpone" | "postponed" | "postponing" | "postpones" ;
/// cancel ::= "cancel | "canceled" | "canceling" | "cancels" ;
/// review ::= "reviewed" | "review" | "reviewing" | "reviews" ;
/// concern ::= "concern" | "concerned" | "concerning" | "concerns" ;
/// resolve ::= "resolve" | "resolved" | "resolving" | "resolves" ;
/// poll ::=  "ask" | "asked" | "asking" | "asks" |
///          "poll" | "polled" | "polling" | "polls" |
///          "query" | "queried" | "querying" | "queries" |
///          "inquire" | "inquired" | "inquiring" | "inquires" |
///          "quiz" | "quizzed" | "quizzing" | "quizzes" |
///          "survey" | "surveyed" | "surveying" | "surveys" ;
///
/// team_label ::= "T-lang" | .. ;
/// team_label_simple ::= "lang" | .. ;
/// team_ping ::= "@"? "rust-lang/lang" | ..;
/// team_target ::= team_label | team_label_simple | team_ping ;
///
/// line_remainder ::= .+$ ;
/// ws_separated ::= ... ;
///
/// subcommand ::= merge | close | postpone | cancel | review
///              | concern line_remainder
///              | resolve line_remainder
///              | poll [team_target]* line_remainder
///              ;
///
/// invocation ::= "fcp" subcommand
///              | "pr" subcommand
///              | "f?" ws_separated
///              | subcommand
///              ;
///
/// grammar ::= "@rfcbot" ":"? invocation ;
Parses all subcommands under the fcp command.
Parses all subcommands under the fcp command .
fn parse_fcp_subcommand<'a>(
    setup: &'a RfcbotConfig,
    command: &'a str,
    subcommand: &'a str,
    fcp_context: bool,
) -> DashResult<RfcBotCommand<'a>> {
    Ok(match subcommand {
        // Parse a FCP merge command:
        "merge" | "merged" | "merging" | "merges" => {
            RfcBotCommand::FcpPropose(FcpDisposition::Merge)
        }
        // Parse a FCP close command:
        "close" | "closed" | "closing" | "closes" => {
            RfcBotCommand::FcpPropose(FcpDisposition::Close)
        }
        // Parse a FCP postpone command:
        "postpone" | "postponed" | "postponing" | "postpones" => {
            RfcBotCommand::FcpPropose(FcpDisposition::Postpone)
        }
        // Parse a FCP cancel command:
        "cancel" | "canceled" | "canceling" | "cancels" => RfcBotCommand::FcpCancel,
        // Parse a FCP reviewed command:
        "reviewed" | "review" | "reviewing" | "reviews" => RfcBotCommand::Reviewed,
        // Parse a FCP concern command:
        "concern" | "concerned" | "concerning" | "concerns" => {
            debug!("Parsed command as NewConcern");
            RfcBotCommand::NewConcern(parse_command_text(command, subcommand))
        }
        // Parse a FCP resolve command:
        "resolve" | "resolved" | "resolving" | "resolves" => {
            debug!("Parsed command as ResolveConcern");
            RfcBotCommand::ResolveConcern(parse_command_text(command, subcommand))
        }
        // Parse a StartPoll command:
        "ask" | "asked" | "asking" | "asks" | "poll" | "polled" | "polling" | "polls" | "query"
        | "queried" | "querying" | "queries" | "inquire" | "inquired" | "inquiring"
        | "inquires" | "quiz" | "quizzed" | "quizzing" | "quizzes" | "survey" | "surveyed"
        | "surveying" | "surveys" => {
            debug!("Parsed command as StartPoll");
            let mut question = parse_command_text(command, subcommand);
            let mut teams = BTreeSet::new();
            while let Some(team_candidate) = question.split_whitespace().next() {
                if let Some(team) = match_team_candidate(setup, team_candidate) {
                    question = parse_command_text(question, team_candidate);
                    teams.insert(&*team.0);
                } else {
                    break;
                }
            }
            RfcBotCommand::StartPoll { teams, question }
        }
        _ => throw!(DashError::Misc(if fcp_context {
            error!("unrecognized subcommand for fcp: {}", subcommand);
            Some(format!("found bad subcommand: {}", subcommand))
        } else {
            None
        })),
    })
}
fn parse_fcp_subcommand < ' a > ( setup : & ' a RfcbotConfig , command : & ' a str , subcommand : & ' a str , fcp_context : bool , ) -> DashResult < RfcBotCommand < ' a > > { Ok ( match subcommand { // Parse a FCP merge command: " " | " " | " " | " " => { RfcBotCommand :: FcpPropose ( FcpDisposition :: Merge ) } // Parse a FCP close command: " " | " " | " " | " " => { RfcBotCommand :: FcpPropose ( FcpDisposition :: Close ) } // Parse a FCP postpone command: " " | " " | " " | " " => { RfcBotCommand :: FcpPropose ( FcpDisposition :: Postpone ) } // Parse a FCP cancel command: " " | " " | " " | " " => RfcBotCommand :: FcpCancel , // Parse a FCP reviewed command: " " | " " | " " | " " => RfcBotCommand :: Reviewed , // Parse a FCP concern command: " " | " " | " " | " " => { debug ! ( " " ) ; RfcBotCommand :: NewConcern ( parse_command_text ( command , subcommand ) ) } // Parse a FCP resolve command: " " | " " | " " | " " => { debug ! ( " " ) ; RfcBotCommand :: ResolveConcern ( parse_command_text ( command , subcommand ) ) } // Parse a StartPoll command: " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " | " " => { debug ! ( " " ) ; let mut question = parse_command_text ( command , subcommand ) ; let mut teams = BTreeSet :: new ( ) ; while let Some ( team_candidate ) = question . split_whitespace ( ) . next ( ) { if let Some ( team ) = match_team_candidate ( setup , team_candidate ) { question = parse_command_text ( question , team_candidate ) ; teams . insert ( & * team . 0 ) ; } else { break ; } } RfcBotCommand :: StartPoll { teams , question } } _ => throw ! ( DashError Misc ( if fcp_context { error ( " " subcommand ) Some ( format ( " " subcommand ) ) } else { None } ) ) , } ) }
Parses all subcommands under the fcp command.
Parses all subcommands under the fcp command .
setup
&'a RfcbotConfig
command
&'a str
subcommand
&'a str
fcp_context
bool
setup
&'a RfcbotConfig
command
&'a str
subcommand
&'a str
fcp_context
bool
rfcbot
accepts roughly the following grammar:
merge ::= "merge" | "merged" | "merging" | "merges" ;
close ::= "close" | "closed" | "closing" | "closes" ;
postpone ::= "postpone" | "postponed" | "postponing" | "postpones" ;
cancel ::= "cancel | "canceled" | "canceling" | "cancels" ;
review ::= "reviewed" | "review" | "reviewing" | "reviews" ;
concern ::= "concern" | "concerned" | "concerning" | "concerns" ;
resolve ::= "resolve" | "resolved" | "resolving" | "resolves" ;
poll ::=  "ask" | "asked" | "asking" | "asks" |
"poll" | "polled" | "polling" | "polls" |
"query" | "queried" | "querying" | "queries" |
"inquire" | "inquired" | "inquiring" | "inquires" |
"quiz" | "quizzed" | "quizzing" | "quizzes" |
"survey" | "surveyed" | "surveying" | "surveys" .





subcommand ::= merge | close | postpone | cancel | review
| concern line_remainder
| resolve line_remainder
| poll [team_target]* line_remainder
.




accepts roughly the following grammar : merge :: = " merge " | " merged " | " merging " | " merges " ; close :: = " close " | " closed " | " closing " | " closes " ; postpone :: = " postpone " | " postponed " | " postponing " | " postpones " ; cancel :: = " cancel | " canceled " | " canceling " | " cancels " ; review :: = " reviewed " | " review " | " reviewing " | " reviews " ; concern :: = " concern " | " concerned " | " concerning " | " concerns " ; resolve :: = " resolve " | " resolved " | " resolving " | " resolves " ; poll :: = " ask " | " asked " | " asking " | " asks " | " poll " | " polled " | " polling " | " polls " | " query " | " queried " | " querying " | " queries " | " inquire " | " inquired " | " inquiring " | " inquires " | " quiz " | " quizzed " | " quizzing " | " quizzes " | " survey " | " surveyed " | " surveying " | " surveys " . subcommand :: = merge | close | postpone | cancel | review | concern line_remainder | resolve line_remainder | poll [ team_target ] * line_remainder .