diff --git a/lib/src/revset.rs b/lib/src/revset.rs index 8490deac0..9000b0413 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -805,7 +805,7 @@ impl fmt::Display for RevsetAliasId<'_> { } #[derive(Clone, Copy, Debug)] -struct ParseState<'a> { +pub struct ParseState<'a> { aliases_map: &'a RevsetAliasesMap, aliases_expanding: &'a [RevsetAliasId<'a>], locals: &'a HashMap<&'a str, Rc>, @@ -906,7 +906,7 @@ fn parse_program_with_modifier( } } -fn parse_expression_rule( +pub fn parse_expression_rule( pairs: Pairs, state: ParseState, ) -> Result, RevsetParseError> { @@ -1172,7 +1172,7 @@ fn all_function_names(aliases_map: &RevsetAliasesMap) -> impl Iterator, ParseState) -> Result, RevsetParseError>; static BUILTIN_FUNCTION_MAP: Lazy> = Lazy::new(|| { @@ -1372,7 +1372,7 @@ static BUILTIN_FUNCTION_MAP: Lazy> = Lazy: type OptionalArg<'i> = Option>; -fn expect_no_arguments( +pub fn expect_no_arguments( function_name: &str, arguments_pair: Pair, ) -> Result<(), RevsetParseError> { @@ -1380,7 +1380,7 @@ fn expect_no_arguments( Ok(()) } -fn expect_one_argument<'i>( +pub fn expect_one_argument<'i>( function_name: &str, arguments_pair: Pair<'i, Rule>, ) -> Result, RevsetParseError> { @@ -1388,7 +1388,7 @@ fn expect_one_argument<'i>( Ok(arg) } -fn expect_arguments<'i, const N: usize, const M: usize>( +pub fn expect_arguments<'i, const N: usize, const M: usize>( function_name: &str, arguments_pair: Pair<'i, Rule>, ) -> Result<([Pair<'i, Rule>; N], [OptionalArg<'i>; M]), RevsetParseError> { @@ -1399,7 +1399,7 @@ fn expect_arguments<'i, const N: usize, const M: usize>( /// /// `argument_names` is a list of argument names. Unnamed positional arguments /// should be padded with `""`. -fn expect_named_arguments<'i, const N: usize, const M: usize>( +pub fn expect_named_arguments<'i, const N: usize, const M: usize>( function_name: &str, argument_names: &[&str], arguments_pair: Pair<'i, Rule>, @@ -1409,7 +1409,7 @@ fn expect_named_arguments<'i, const N: usize, const M: usize>( Ok((required.try_into().unwrap(), optional.try_into().unwrap())) } -fn expect_named_arguments_vec<'i>( +pub fn expect_named_arguments_vec<'i>( function_name: &str, argument_names: &[&str], arguments_pair: Pair<'i, Rule>, @@ -1486,7 +1486,7 @@ fn expect_named_arguments_vec<'i>( Ok((required, optional)) } -fn parse_function_argument_to_file_pattern( +pub fn parse_function_argument_to_file_pattern( name: &str, pair: Pair, state: ParseState, @@ -1499,7 +1499,7 @@ fn parse_function_argument_to_file_pattern( parse_function_argument_as_pattern("file pattern", name, pair, state, parse_pattern) } -fn parse_function_argument_to_string_pattern( +pub fn parse_function_argument_to_string_pattern( name: &str, pair: Pair, state: ParseState, @@ -1543,7 +1543,7 @@ fn parse_function_argument_as_pattern( +pub fn parse_function_argument_as_literal( type_name: &str, name: &str, pair: Pair,