diff --git a/lib/src/revset.pest b/lib/src/revset.pest index 17c208fe6..f96f05c7a 100644 --- a/lib/src/revset.pest +++ b/lib/src/revset.pest @@ -14,9 +14,9 @@ identifier_part = @{ (ASCII_ALPHANUMERIC | "_" | "@" | "/")+ } identifier = @{ - (identifier_part+ ~ ("." | "-" | "+" ))+ ~ identifier_part+ - | identifier_part+ -} + identifier_part ~ ("." | "-" | "+" ) ~ identifier + | identifier_part +} symbol = { identifier | literal_string diff --git a/lib/src/revset.rs b/lib/src/revset.rs index e59e38ee7..f2cb9e37f 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -1516,6 +1516,10 @@ mod tests { parse("foo.bar-v1+7"), Ok(RevsetExpression::symbol("foo.bar-v1+7".to_string())) ); + assert_eq!( + parse("foo.bar-v1+7-"), + Ok(RevsetExpression::symbol("foo.bar-v1+7".to_string()).parents()) + ); // '.' is not allowed at the beginning or end assert_matches!(parse(".foo"), Err(RevsetParseError::SyntaxError(_))); assert_matches!(parse("foo."), Err(RevsetParseError::SyntaxError(_)));