ok/jj
1
0
Fork 0
forked from mirrors/jj

revset: remove deprecated "program" rule, rename "program_with_modifier"

This commit is contained in:
Yuya Nishihara 2024-06-04 15:28:03 +09:00
parent eda7069aee
commit 660a917aaa
2 changed files with 3 additions and 5 deletions

View file

@ -105,9 +105,8 @@ expression = {
~ (whitespace* ~ infix_op ~ whitespace* ~ (negate_op ~ whitespace*)* ~ range_expression)* ~ (whitespace* ~ infix_op ~ whitespace* ~ (negate_op ~ whitespace*)* ~ range_expression)*
} }
program = _{ SOI ~ whitespace* ~ expression ~ whitespace* ~ EOI }
program_modifier = { identifier ~ pattern_kind_op ~ !":" } program_modifier = { identifier ~ pattern_kind_op ~ !":" }
program_with_modifier = _{ program = _{
SOI ~ whitespace* ~ (program_modifier ~ whitespace*)? ~ expression ~ whitespace* ~ EOI SOI ~ whitespace* ~ (program_modifier ~ whitespace*)? ~ expression ~ whitespace* ~ EOI
} }

View file

@ -105,9 +105,8 @@ impl Rule {
Rule::neighbors_expression => None, Rule::neighbors_expression => None,
Rule::range_expression => None, Rule::range_expression => None,
Rule::expression => None, Rule::expression => None,
Rule::program => None,
Rule::program_modifier => None, Rule::program_modifier => None,
Rule::program_with_modifier => None, Rule::program => None,
Rule::function_alias_declaration => None, Rule::function_alias_declaration => None,
Rule::alias_declaration => None, Rule::alias_declaration => None,
} }
@ -421,7 +420,7 @@ pub struct ModifierNode<'i> {
} }
pub(super) fn parse_program(revset_str: &str) -> Result<ExpressionNode, RevsetParseError> { pub(super) fn parse_program(revset_str: &str) -> Result<ExpressionNode, RevsetParseError> {
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(); let first = pairs.next().unwrap();
match first.as_rule() { match first.as_rule() {
Rule::expression => parse_expression_node(first.into_inner()), Rule::expression => parse_expression_node(first.into_inner()),