From d1ae2d72c8dc9fd6eeb2c99c04f97bc2ea1e6ef9 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sun, 7 Apr 2024 16:07:04 +0900 Subject: [PATCH] revset: rename Rule::literal_string to string_literal --- lib/src/revset.pest | 6 +++--- lib/src/revset.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/src/revset.pest b/lib/src/revset.pest index a11870147..2fe371aac 100644 --- a/lib/src/revset.pest +++ b/lib/src/revset.pest @@ -19,9 +19,9 @@ identifier = @{ } symbol = { identifier - | literal_string + | string_literal } -literal_string = { "\"" ~ (!"\"" ~ ANY)* ~ "\"" } +string_literal = { "\"" ~ (!"\"" ~ ANY)* ~ "\"" } whitespace = _{ " " | "\t" | "\r" | "\n" | "\x0c" } at_op = { "@" } @@ -67,7 +67,7 @@ formal_parameters = { | "" } -// TODO: change rhs to literal_string to require quoting? #2101 +// TODO: change rhs to string_literal to require quoting? #2101 string_pattern = { identifier ~ pattern_kind_op ~ symbol } primary = { diff --git a/lib/src/revset.rs b/lib/src/revset.rs index 582c16322..77583ebed 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -97,7 +97,7 @@ impl Rule { Rule::identifier_part => None, Rule::identifier => None, Rule::symbol => None, - Rule::literal_string => None, + Rule::string_literal => None, Rule::whitespace => None, Rule::at_op => Some("@"), Rule::pattern_kind_op => Some(":"), @@ -1090,7 +1090,7 @@ fn parse_symbol_rule( Ok(RevsetExpression::symbol(name.to_owned())) } } - Rule::literal_string => parse_string_literal(first).map(RevsetExpression::symbol), + Rule::string_literal => parse_string_literal(first).map(RevsetExpression::symbol), _ => { panic!("unexpected symbol parse rule: {:?}", first.as_str()); } @@ -1102,7 +1102,7 @@ fn parse_symbol_rule_as_literal(mut pairs: Pairs) -> Result Ok(first.as_str().to_owned()), - Rule::literal_string => parse_string_literal(first), + Rule::string_literal => parse_string_literal(first), _ => { panic!("unexpected symbol parse rule: {:?}", first.as_str()); } @@ -1111,7 +1111,7 @@ fn parse_symbol_rule_as_literal(mut pairs: Pairs) -> Result) -> Result { - assert_eq!(pair.as_rule(), Rule::literal_string); + assert_eq!(pair.as_rule(), Rule::string_literal); Ok(pair .as_str() .strip_prefix('"')