diff --git a/lib/src/revset.pest b/lib/src/revset.pest index ae84bd6cfb..7fd6aa09e1 100644 --- a/lib/src/revset.pest +++ b/lib/src/revset.pest @@ -105,9 +105,8 @@ expression = { ~ (whitespace* ~ infix_op ~ whitespace* ~ (negate_op ~ whitespace*)* ~ range_expression)* } -program = _{ SOI ~ whitespace* ~ expression ~ whitespace* ~ EOI } program_modifier = { identifier ~ pattern_kind_op ~ !":" } -program_with_modifier = _{ +program = _{ SOI ~ whitespace* ~ (program_modifier ~ whitespace*)? ~ expression ~ whitespace* ~ EOI } diff --git a/lib/src/revset_parser.rs b/lib/src/revset_parser.rs index 752505397c..ad2f7413a4 100644 --- a/lib/src/revset_parser.rs +++ b/lib/src/revset_parser.rs @@ -105,9 +105,8 @@ impl Rule { Rule::neighbors_expression => None, Rule::range_expression => None, Rule::expression => None, - Rule::program => None, Rule::program_modifier => None, - Rule::program_with_modifier => None, + Rule::program => None, Rule::function_alias_declaration => None, Rule::alias_declaration => None, } @@ -421,7 +420,7 @@ pub struct ModifierNode<'i> { } pub(super) fn parse_program(revset_str: &str) -> Result { - let mut pairs = RevsetParser::parse(Rule::program_with_modifier, revset_str)?; + let mut pairs = RevsetParser::parse(Rule::program, revset_str)?; let first = pairs.next().unwrap(); match first.as_rule() { Rule::expression => parse_expression_node(first.into_inner()),