forked from mirrors/jj
revset: reuse parse_symbol_rule_as_literal() to parse string symbol
For the same reason as the previous commit. Single-quoted string literal will be handled there.
This commit is contained in:
parent
37bd966357
commit
a74bf89df5
1 changed files with 4 additions and 6 deletions
|
@ -1082,10 +1082,10 @@ fn parse_string_pattern_rule(
|
||||||
|
|
||||||
/// Parses symbol to expression, expands aliases as needed.
|
/// Parses symbol to expression, expands aliases as needed.
|
||||||
fn parse_symbol_rule(
|
fn parse_symbol_rule(
|
||||||
mut pairs: Pairs<Rule>,
|
pairs: Pairs<Rule>,
|
||||||
state: ParseState,
|
state: ParseState,
|
||||||
) -> Result<Rc<RevsetExpression>, RevsetParseError> {
|
) -> Result<Rc<RevsetExpression>, RevsetParseError> {
|
||||||
let first = pairs.next().unwrap();
|
let first = pairs.peek().unwrap();
|
||||||
match first.as_rule() {
|
match first.as_rule() {
|
||||||
Rule::identifier => {
|
Rule::identifier => {
|
||||||
let name = first.as_str();
|
let name = first.as_str();
|
||||||
|
@ -1101,11 +1101,9 @@ fn parse_symbol_rule(
|
||||||
Ok(RevsetExpression::symbol(name.to_owned()))
|
Ok(RevsetExpression::symbol(name.to_owned()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rule::string_literal => Ok(RevsetExpression::symbol(
|
|
||||||
STRING_LITERAL_PARSER.parse(first.into_inner()),
|
|
||||||
)),
|
|
||||||
_ => {
|
_ => {
|
||||||
panic!("unexpected symbol parse rule: {:?}", first.as_str());
|
let text = parse_symbol_rule_as_literal(pairs);
|
||||||
|
Ok(RevsetExpression::symbol(text))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue