Lines Matching refs:input

22 /// Return the remaining input.
31 pub fn rest<T, E: ParseError<T>>(input: T) -> IResult<T, T, E>
36 Ok((input.slice(input.input_len()..), input))
39 /// Return the length of the remaining input.
48 pub fn rest_len<T, E: ParseError<T>>(input: T) -> IResult<T, usize, E>
52 let len = input.input_len();
53 Ok((input, len))
78 move |input: I| {
79 let (input, o1) = parser.parse(input)?;
80 Ok((input, f(o1)))
112 move |input: I| {
113 let i = input.clone();
114 let (input, o1) = parser.parse(input)?;
116 Ok(o2) => Ok((input, o2)),
150 move |input: I| {
151 let i = input.clone();
152 let (input, o1) = parser.parse(input)?;
154 Some(o2) => Ok((input, o2)),
184 move |input: I| {
185 let (input, o1) = parser.parse(input)?;
187 Ok((input, o2))
191 /// Creates a new parser from the output of the first parser, then apply that parser over the rest of the input.
215 move |input: I| {
216 let (input, o1) = parser.parse(input)?;
217 applied_parser(o1).parse(input)
243 move |input: I| {
244 let i = input.clone();
245 match f.parse(input) {
278 move |input: I| {
280 match f.parse(input) {
285 Ok((input, None))
290 /// Tries to apply its parser without consuming the input.
308 move |input: I| {
309 let i = input.clone();
310 match f.parse(input) {
317 /// returns its input if it is at the end of input data
333 pub fn eof<I: InputLength + Clone, E: ParseError<I>>(input: I) -> IResult<I, I, E> {
334 if input.input_len() == 0 {
335 let clone = input.clone();
336 Ok((input, clone))
338 Err(Err::Error(E::from_error_kind(input, ErrorKind::Eof)))
360 move |input: I| {
361 let i = input.clone();
362 match f.parse(input) {
369 /// Succeeds if all the input has been consumed by its child parser.
389 move |input: I| {
390 let (input, res) = f.parse(input)?;
391 if input.input_len() == 0 {
392 Ok((input, res))
394 Err(Err::Error(E::from_error_kind(input, ErrorKind::Eof)))
427 move |input: I| {
428 let i = input.clone();
429 let (input, o) = first.parse(input)?;
432 Ok((input, o))
460 move |input: I| parser.parse(input).map(|(i, _)| (i, val.clone()))
481 move |input: I| {
482 let i = input.clone();
483 match parser.parse(input) {
491 /// If the child parser was successful, return the consumed input as produced value.
512 move |input: I| {
513 let i = input.clone();
516 let index = input.offset(&i);
517 Ok((i, input.slice(..index)))
524 /// if the child parser was successful, return the consumed input with the output
529 /// as the input, or the input is a user defined type.
531 /// Returned tuple is of the format `(consumed input, produced output)`.
540 /// fn inner_parser(input: &str) -> IResult<&str, bool> {
541 /// value(true, tag("1234"))(input)
552 /// // the first output (representing the consumed input)
567 move |input: I| {
568 let i = input.clone();
571 let index = input.offset(&remaining);
572 let consumed = input.slice(..index);
596 /// fn parser(input: &str) -> IResult<&str, &str> {
600 /// ))(input)
619 /// fn parser(input: &str) -> IResult<&str, &str> {
623 /// ))(input)
628 /// assert_eq!(parser("+"), Err(Err::Failure(Error { input: "", code: ErrorKind::Digit })));
635 move |input: I| match parser.parse(input) {
672 move |input: I| match parser.parse(input) {
680 /// Creates an iterator from input data and a parser.
682 /// Call the iterator's [ParserIterator::finish] method to get the remaining input if successful,
700 pub fn iterator<Input, Output, Error, F>(input: Input, f: F) -> ParserIterator<Input, Error, F>
707 input,
715 input: I,
720 /// Returns the remaining input if parsing was successful, or the error if we encountered an error.
723 State::Running | State::Done => Ok((self.input, ())),
739 let input = self.input.clone();
741 match (self.iterator)(input) {
743 self.input = i;
773 /// a parser which always succeeds with given value without consuming any input.
795 move |input: I| Ok((input, val.clone()))