1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use crate::;
/// Creates a parser that always succeeds with the given value.
///
/// # Outcome
///
/// This combinator always succeeds.
///
/// # Input consumption
///
/// This combinator never consumes input.
///
/// # Look-ahead and backtracking
///
/// This combinator never performs lookahead.
///
/// # Arguments
///
/// - `success`: The value to return when the parser is applied.
///
/// # Examples
///
/// ```
/// use yapcol::{Input, any, success};
///
/// // Always succeeds, even on empty input.
/// let mut input = Input::new_from_chars("".chars(), None);
/// assert_eq!(success(1)(&mut input), Ok(1));
///
/// // Does not consume any input.
/// let mut input = Input::new_from_chars("hello".chars(), None);
/// assert_eq!(success(1)(&mut input), Ok(1));
/// assert_eq!(any()(&mut input), Ok('h'));
/// ```