Lines Matching refs:ErrorKind
11 /// There are already implementations of it for `(Input, ErrorKind)`
17 /// Creates an error from the input position and an [ErrorKind]
18 fn from_error_kind(input: I, kind: ErrorKind) -> Self;
21 /// position and an [ErrorKind]. This is useful when backtracking
23 fn append(input: I, kind: ErrorKind, other: Self) -> Self;
27 Self::from_error_kind(input, ErrorKind::Char)
51 /// Creates a new error from an input position, an [ErrorKind] indicating the
53 fn from_external_error(input: I, kind: ErrorKind, e: E) -> Self;
62 pub code: ErrorKind,
67 pub fn new(input: I, code: ErrorKind) -> Error<I> {
73 fn from_error_kind(input: I, kind: ErrorKind) -> Self {
77 fn append(_: I, _: ErrorKind, other: Self) -> Self {
86 fn from_external_error(input: I, kind: ErrorKind, _e: E) -> Self {
103 impl<I> ParseError<I> for (I, ErrorKind) {
104 fn from_error_kind(input: I, kind: ErrorKind) -> Self {
108 fn append(_: I, _: ErrorKind, other: Self) -> Self {
113 impl<I> ContextError<I> for (I, ErrorKind) {}
115 impl<I, E> FromExternalError<I, E> for (I, ErrorKind) {
116 fn from_external_error(input: I, kind: ErrorKind, _e: E) -> Self {
122 fn from_error_kind(_: I, _: ErrorKind) -> Self {}
124 fn append(_: I, _: ErrorKind, _: Self) -> Self {}
130 fn from_external_error(_input: I, _kind: ErrorKind, _e: E) -> Self {}
133 /// Creates an error from the input position and an [ErrorKind]
134 pub fn make_error<I, E: ParseError<I>>(input: I, kind: ErrorKind) -> E {
139 /// position and an [ErrorKind]. This is useful when backtracking
141 pub fn append_error<I, E: ParseError<I>>(input: I, kind: ErrorKind, other: E) -> E {
167 Nom(ErrorKind),
173 fn from_error_kind(input: I, kind: ErrorKind) -> Self {
179 fn append(input: I, kind: ErrorKind, mut other: Self) -> Self {
204 fn from_external_error(input: I, kind: ErrorKind, _e: E) -> Self {
366 pub enum ErrorKind {
424 /// Converts an ErrorKind to a number
425 pub fn error_to_u32(e: &ErrorKind) -> u32 {
427 ErrorKind::Tag => 1,
428 ErrorKind::MapRes => 2,
429 ErrorKind::MapOpt => 3,
430 ErrorKind::Alt => 4,
431 ErrorKind::IsNot => 5,
432 ErrorKind::IsA => 6,
433 ErrorKind::SeparatedList => 7,
434 ErrorKind::SeparatedNonEmptyList => 8,
435 ErrorKind::Many1 => 9,
436 ErrorKind::Count => 10,
437 ErrorKind::TakeUntil => 12,
438 ErrorKind::LengthValue => 15,
439 ErrorKind::TagClosure => 16,
440 ErrorKind::Alpha => 17,
441 ErrorKind::Digit => 18,
442 ErrorKind::AlphaNumeric => 19,
443 ErrorKind::Space => 20,
444 ErrorKind::MultiSpace => 21,
445 ErrorKind::LengthValueFn => 22,
446 ErrorKind::Eof => 23,
447 ErrorKind::Switch => 27,
448 ErrorKind::TagBits => 28,
449 ErrorKind::OneOf => 29,
450 ErrorKind::NoneOf => 30,
451 ErrorKind::Char => 40,
452 ErrorKind::CrLf => 41,
453 ErrorKind::RegexpMatch => 42,
454 ErrorKind::RegexpMatches => 43,
455 ErrorKind::RegexpFind => 44,
456 ErrorKind::RegexpCapture => 45,
457 ErrorKind::RegexpCaptures => 46,
458 ErrorKind::TakeWhile1 => 47,
459 ErrorKind::Complete => 48,
460 ErrorKind::Fix => 49,
461 ErrorKind::Escaped => 50,
462 ErrorKind::EscapedTransform => 51,
463 ErrorKind::NonEmpty => 56,
464 ErrorKind::ManyMN => 57,
465 ErrorKind::HexDigit => 59,
466 ErrorKind::OctDigit => 61,
467 ErrorKind::Many0 => 62,
468 ErrorKind::Not => 63,
469 ErrorKind::Permutation => 64,
470 ErrorKind::ManyTill => 65,
471 ErrorKind::Verify => 66,
472 ErrorKind::TakeTill1 => 67,
473 ErrorKind::TakeWhileMN => 69,
474 ErrorKind::TooLarge => 70,
475 ErrorKind::Many0Count => 71,
476 ErrorKind::Many1Count => 72,
477 ErrorKind::Float => 73,
478 ErrorKind::Satisfy => 74,
479 ErrorKind::Fail => 75,
483 impl ErrorKind {
486 /// Converts an ErrorKind to a text description
489 ErrorKind::Tag => "Tag",
490 ErrorKind::MapRes => "Map on Result",
491 ErrorKind::MapOpt => "Map on Option",
492 ErrorKind::Alt => "Alternative",
493 ErrorKind::IsNot => "IsNot",
494 ErrorKind::IsA => "IsA",
495 ErrorKind::SeparatedList => "Separated list",
496 ErrorKind::SeparatedNonEmptyList => "Separated non empty list",
497 ErrorKind::Many0 => "Many0",
498 ErrorKind::Many1 => "Many1",
499 ErrorKind::Count => "Count",
500 ErrorKind::TakeUntil => "Take until",
501 ErrorKind::LengthValue => "Length followed by value",
502 ErrorKind::TagClosure => "Tag closure",
503 ErrorKind::Alpha => "Alphabetic",
504 ErrorKind::Digit => "Digit",
505 ErrorKind::AlphaNumeric => "AlphaNumeric",
506 ErrorKind::Space => "Space",
507 ErrorKind::MultiSpace => "Multiple spaces",
508 ErrorKind::LengthValueFn => "LengthValueFn",
509 ErrorKind::Eof => "End of file",
510 ErrorKind::Switch => "Switch",
511 ErrorKind::TagBits => "Tag on bitstream",
512 ErrorKind::OneOf => "OneOf",
513 ErrorKind::NoneOf => "NoneOf",
514 ErrorKind::Char => "Char",
515 ErrorKind::CrLf => "CrLf",
516 ErrorKind::RegexpMatch => "RegexpMatch",
517 ErrorKind::RegexpMatches => "RegexpMatches",
518 ErrorKind::RegexpFind => "RegexpFind",
519 ErrorKind::RegexpCapture => "RegexpCapture",
520 ErrorKind::RegexpCaptures => "RegexpCaptures",
521 ErrorKind::TakeWhile1 => "TakeWhile1",
522 ErrorKind::Complete => "Complete",
523 ErrorKind::Fix => "Fix",
524 ErrorKind::Escaped => "Escaped",
525 ErrorKind::EscapedTransform => "EscapedTransform",
526 ErrorKind::NonEmpty => "NonEmpty",
527 ErrorKind::ManyMN => "Many(m, n)",
528 ErrorKind::HexDigit => "Hexadecimal Digit",
529 ErrorKind::OctDigit => "Octal digit",
530 ErrorKind::Not => "Negation",
531 ErrorKind::Permutation => "Permutation",
532 ErrorKind::ManyTill => "ManyTill",
533 ErrorKind::Verify => "predicate verification",
534 ErrorKind::TakeTill1 => "TakeTill1",
535 ErrorKind::TakeWhileMN => "TakeWhileMN",
536 ErrorKind::TooLarge => "Needed data size is too large",
537 ErrorKind::Many0Count => "Count occurrence of >=0 patterns",
538 ErrorKind::Many1Count => "Count occurrence of >=1 patterns",
539 ErrorKind::Float => "Float",
540 ErrorKind::Satisfy => "Satisfy",
541 ErrorKind::Fail => "Fail",
546 /// Creates a parse error from a `nom::ErrorKind`
556 /// Creates a parse error from a `nom::ErrorKind`,
646 pub fn prepare_errors<O, E: Clone>(input: &[u8], e: VerboseError<&[u8]>) -> Option<Vec<(ErrorKind, usize, usize)>> {
647 let mut v: Vec<(ErrorKind, usize, usize)> = Vec::new();
670 pub fn generate_colors<E>(v: &[(ErrorKind, usize, usize)]) -> HashMap<u32, u8> {
682 pub fn code_from_offset(v: &[(ErrorKind, usize, usize)], offset: usize) -> Option<u32> {
747 pub fn print_offsets(input: &[u8], from: usize, offsets: &[(ErrorKind, usize, usize)]) -> String {