Lines Matching refs:ErrorKind

7 use crate::error::ErrorKind;
22 /// # use nom::{Err, error::{ErrorKind, Error}, IResult};
28 /// assert_eq!(parser(" abc"), Err(Err::Error(Error::new(" abc", ErrorKind::Char))));
29 /// assert_eq!(parser("bc"), Err(Err::Error(Error::new("bc", ErrorKind::Char))));
30 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Char))));
52 /// # use nom::{Err, error::{ErrorKind, Error}, Needed, IResult};
58 /// assert_eq!(parser("cd"), Err(Err::Error(Error::new("cd", ErrorKind::Satisfy))));
59 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Satisfy))));
73 _ => Err(Err::Error(Error::from_error_kind(i, ErrorKind::Satisfy))),
83 /// # use nom::{Err, error::ErrorKind};
85 /// assert_eq!(one_of::<_, _, (&str, ErrorKind)>("abc")("b"), Ok(("", 'b')));
86 /// assert_eq!(one_of::<_, _, (&str, ErrorKind)>("a")("bc"), Err(Err::Error(("bc", ErrorKind::OneOf))));
87 /// assert_eq!(one_of::<_, _, (&str, ErrorKind)>("a")(""), Err(Err::Error(("", ErrorKind::OneOf))));
97 _ => Err(Err::Error(Error::from_error_kind(i, ErrorKind::OneOf))),
107 /// # use nom::{Err, error::ErrorKind};
109 /// assert_eq!(none_of::<_, _, (&str, ErrorKind)>("abc")("z"), Ok(("", 'z')));
110 /// assert_eq!(none_of::<_, _, (&str, ErrorKind)>("ab")("a"), Err(Err::Error(("a", ErrorKind::NoneOf))));
111 /// assert_eq!(none_of::<_, _, (&str, ErrorKind)>("a")(""), Err(Err::Error(("", ErrorKind::NoneOf))));
121 _ => Err(Err::Error(Error::from_error_kind(i, ErrorKind::NoneOf))),
131 /// # use nom::{Err, error::{Error, ErrorKind}, IResult};
138 /// assert_eq!(parser("ab\r\nc"), Err(Err::Error(Error::new("ab\r\nc", ErrorKind::CrLf))));
139 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::CrLf))));
151 let e: ErrorKind = ErrorKind::CrLf;
164 /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
174 /// assert_eq!(parser("a\rb\nc"), Err(Err::Error(Error { input: "a\rb\nc", code: ErrorKind::Tag })));
175 /// assert_eq!(parser("a\rbc"), Err(Err::Error(Error { input: "a\rbc", code: ErrorKind::Tag })));
200 let e: ErrorKind = ErrorKind::Tag;
217 /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
224 /// assert_eq!(parser("ab\r\nc"), Err(Err::Error(Error::new("ab\r\nc", ErrorKind::CrLf))));
225 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::CrLf))));
235 CompareResult::Incomplete => Err(Err::Error(E::from_error_kind(input, ErrorKind::CrLf))),
240 _ => Err(Err::Error(E::from_error_kind(input, ErrorKind::CrLf))),
252 /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
259 /// assert_eq!(parser("\r\nc"), Err(Err::Error(Error::new("\r\nc", ErrorKind::Char))));
260 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Char))));
276 /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
283 /// assert_eq!(parser("\r\nc"), Err(Err::Error(Error::new("\r\nc", ErrorKind::Char))));
284 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Char))));
301 /// # use nom::{character::complete::anychar, Err, error::{Error, ErrorKind}, IResult};
307 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Eof))));
316 None => Err(Err::Error(E::from_error_kind(input, ErrorKind::Eof))),
331 /// # use nom::{Err, error::ErrorKind, IResult, Needed};
356 /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
363 /// assert_eq!(parser("1c"), Err(Err::Error(Error::new("1c", ErrorKind::Alpha))));
364 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Alpha))));
371 input.split_at_position1_complete(|item| !item.is_alpha(), ErrorKind::Alpha)
381 /// # use nom::{Err, error::ErrorKind, IResult, Needed};
407 /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
414 /// assert_eq!(parser("c1"), Err(Err::Error(Error::new("c1", ErrorKind::Digit))));
415 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Digit))));
422 /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
440 input.split_at_position1_complete(|item| !item.is_dec_digit(), ErrorKind::Digit)
449 /// # use nom::{Err, error::ErrorKind, IResult, Needed};
473 /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
480 /// assert_eq!(parser("H2"), Err(Err::Error(Error::new("H2", ErrorKind::HexDigit))));
481 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::HexDigit))));
488 input.split_at_position1_complete(|item| !item.is_hex_digit(), ErrorKind::HexDigit)
498 /// # use nom::{Err, error::ErrorKind, IResult, Needed};
523 /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
530 /// assert_eq!(parser("H2"), Err(Err::Error(Error::new("H2", ErrorKind::OctDigit))));
531 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::OctDigit))));
538 input.split_at_position1_complete(|item| !item.is_oct_digit(), ErrorKind::OctDigit)
548 /// # use nom::{Err, error::ErrorKind, IResult, Needed};
573 /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
580 /// assert_eq!(parser("&H2"), Err(Err::Error(Error::new("&H2", ErrorKind::AlphaNumeric))));
581 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::AlphaNumeric))));
588 input.split_at_position1_complete(|item| !item.is_alphanum(), ErrorKind::AlphaNumeric)
598 /// # use nom::{Err, error::ErrorKind, IResult, Needed};
626 /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
633 /// assert_eq!(parser("H2"), Err(Err::Error(Error::new("H2", ErrorKind::Space))));
634 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Space))));
646 ErrorKind::Space,
657 /// # use nom::{Err, error::ErrorKind, IResult, Needed};
685 /// # use nom::{Err, error::{Error, ErrorKind}, IResult, Needed};
692 /// assert_eq!(parser("H2"), Err(Err::Error(Error::new("H2", ErrorKind::MultiSpace))));
693 /// assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::MultiSpace))));
705 ErrorKind::MultiSpace,
742 return Err(Err::Error(E::from_error_kind(input, ErrorKind::Digit)));
751 return Err(Err::Error(E::from_error_kind(input, ErrorKind::Digit)));
757 None => return Err(Err::Error(E::from_error_kind(input, ErrorKind::Digit))),
767 return Err(Err::Error(E::from_error_kind(input, ErrorKind::Digit)));
773 None => return Err(Err::Error(E::from_error_kind(input, ErrorKind::Digit))),
803 return Err(Err::Error(E::from_error_kind(i, ErrorKind::Digit)));
811 return Err(Err::Error(E::from_error_kind(i, ErrorKind::Digit)));
817 None => return Err(Err::Error(E::from_error_kind(i, ErrorKind::Digit))),
840 let res: $crate::IResult<_, _, (_, ErrorKind)> = $left;
854 //assert_eq!(alpha1::<_, (_, ErrorKind)>(a), Err(Err::Incomplete(Needed::Size(1))));
856 assert_eq!(alpha1(b), Err(Err::Error((b, ErrorKind::Alpha))));
857 assert_eq!(alpha1::<_, (_, ErrorKind)>(c), Ok((&c[1..], &b"a"[..])));
859 alpha1::<_, (_, ErrorKind)>(d),
862 assert_eq!(digit1(a), Err(Err::Error((a, ErrorKind::Digit))));
863 assert_eq!(digit1::<_, (_, ErrorKind)>(b), Ok((empty, b)));
864 assert_eq!(digit1(c), Err(Err::Error((c, ErrorKind::Digit))));
865 assert_eq!(digit1(d), Err(Err::Error((d, ErrorKind::Digit))));
866 assert_eq!(hex_digit1::<_, (_, ErrorKind)>(a), Ok((empty, a)));
867 assert_eq!(hex_digit1::<_, (_, ErrorKind)>(b), Ok((empty, b)));
868 assert_eq!(hex_digit1::<_, (_, ErrorKind)>(c), Ok((empty, c)));
870 hex_digit1::<_, (_, ErrorKind)>(d),
873 assert_eq!(hex_digit1(e), Err(Err::Error((e, ErrorKind::HexDigit))));
874 assert_eq!(oct_digit1(a), Err(Err::Error((a, ErrorKind::OctDigit))));
875 assert_eq!(oct_digit1::<_, (_, ErrorKind)>(b), Ok((empty, b)));
876 assert_eq!(oct_digit1(c), Err(Err::Error((c, ErrorKind::OctDigit))));
877 assert_eq!(oct_digit1(d), Err(Err::Error((d, ErrorKind::OctDigit))));
878 assert_eq!(alphanumeric1::<_, (_, ErrorKind)>(a), Ok((empty, a)));
880 assert_eq!(alphanumeric1::<_, (_, ErrorKind)>(c), Ok((empty, c)));
882 alphanumeric1::<_, (_, ErrorKind)>(d),
885 assert_eq!(space1::<_, (_, ErrorKind)>(e), Ok((empty, e)));
886 assert_eq!(space1::<_, (_, ErrorKind)>(f), Ok((&b";"[..], &b" "[..])));
898 assert_eq!(alpha1::<_, (_, ErrorKind)>(a), Ok((empty, a)));
899 assert_eq!(alpha1(b), Err(Err::Error((b, ErrorKind::Alpha))));
900 assert_eq!(alpha1::<_, (_, ErrorKind)>(c), Ok((&c[1..], &"a"[..])));
901 assert_eq!(alpha1::<_, (_, ErrorKind)>(d), Ok(("é12", &"az"[..])));
902 assert_eq!(digit1(a), Err(Err::Error((a, ErrorKind::Digit))));
903 assert_eq!(digit1::<_, (_, ErrorKind)>(b), Ok((empty, b)));
904 assert_eq!(digit1(c), Err(Err::Error((c, ErrorKind::Digit))));
905 assert_eq!(digit1(d), Err(Err::Error((d, ErrorKind::Digit))));
906 assert_eq!(hex_digit1::<_, (_, ErrorKind)>(a), Ok((empty, a)));
907 assert_eq!(hex_digit1::<_, (_, ErrorKind)>(b), Ok((empty, b)));
908 assert_eq!(hex_digit1::<_, (_, ErrorKind)>(c), Ok((empty, c)));
909 assert_eq!(hex_digit1::<_, (_, ErrorKind)>(d), Ok(("zé12", &"a"[..])));
910 assert_eq!(hex_digit1(e), Err(Err::Error((e, ErrorKind::HexDigit))));
911 assert_eq!(oct_digit1(a), Err(Err::Error((a, ErrorKind::OctDigit))));
912 assert_eq!(oct_digit1::<_, (_, ErrorKind)>(b), Ok((empty, b)));
913 assert_eq!(oct_digit1(c), Err(Err::Error((c, ErrorKind::OctDigit))));
914 assert_eq!(oct_digit1(d), Err(Err::Error((d, ErrorKind::OctDigit))));
915 assert_eq!(alphanumeric1::<_, (_, ErrorKind)>(a), Ok((empty, a)));
917 assert_eq!(alphanumeric1::<_, (_, ErrorKind)>(c), Ok((empty, c)));
918 assert_eq!(alphanumeric1::<_, (_, ErrorKind)>(d), Ok(("é12", "az")));
919 assert_eq!(space1::<_, (_, ErrorKind)>(e), Ok((empty, e)));
932 match alpha1::<_, (_, ErrorKind)>(a) {
938 match digit1::<_, (_, ErrorKind)>(b) {
944 match alphanumeric1::<_, (_, ErrorKind)>(c) {
950 match space1::<_, (_, ErrorKind)>(d) {
956 match multispace1::<_, (_, ErrorKind)>(e) {
962 match hex_digit1::<_, (_, ErrorKind)>(f) {
968 match oct_digit1::<_, (_, ErrorKind)>(f) {
980 not_line_ending::<_, (_, ErrorKind)>(a),
986 not_line_ending::<_, (_, ErrorKind)>(b),
992 not_line_ending::<_, (_, ErrorKind)>(c),
998 not_line_ending::<_, (_, ErrorKind)>(d),
1023 assert_eq!(not_line_ending(f), Err(Err::Error((f, ErrorKind::Tag))));
1026 assert_eq!(not_line_ending::<_, (_, ErrorKind)>(g2), Ok(("", g2)));
1037 Err(Err::Error(error_position!(i, ErrorKind::HexDigit)))
1043 Err(Err::Error(error_position!(i, ErrorKind::HexDigit)))
1068 Err(Err::Error(error_position!(i, ErrorKind::OctDigit)))
1124 Err(Err::Error(error_position!(&b"\r"[..], ErrorKind::CrLf)))
1128 Err(Err::Error(error_position!(&b"\ra"[..], ErrorKind::CrLf)))
1134 Err(Err::Error(error_position!(&"\r"[..], ErrorKind::CrLf)))
1138 Err(Err::Error(error_position!("\ra", ErrorKind::CrLf)))
1148 Err(Err::Error(error_position!(&b"\r"[..], ErrorKind::CrLf)))
1152 Err(Err::Error(error_position!(&b"\ra"[..], ErrorKind::CrLf)))
1159 Err(Err::Error(error_position!(&"\r"[..], ErrorKind::CrLf)))
1163 Err(Err::Error(error_position!("\ra", ErrorKind::CrLf)))
1181 ErrorKind::Digit,
1196 ErrorKind::Digit,
1207 ErrorKind::Digit,