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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
use self :: RuleResult :: { Matched , Failed } ; fn escape_default ( s : & str ) -> String { s . chars ( ) . flat_map ( | c | c . escape_default ( ) ) . collect ( ) } fn char_range_at ( s : & str , pos : usize ) -> ( char , usize ) { let c = & s [ pos .. ] . chars ( ) . next ( ) . unwrap ( ) ; let next_pos = pos + c . len_utf8 ( ) ; ( * c , next_pos ) } # [ derive ( Clone ) ] enum RuleResult < T > { Matched ( usize , T ) , Failed , } # [ derive ( PartialEq , Eq , Debug , Clone ) ] pub struct ParseError { pub line : usize , pub column : usize , pub offset : usize , pub expected : :: std :: collections :: HashSet < & 'static str > , } pub type ParseResult < T > = Result < T , ParseError > ; impl :: std :: fmt :: Display for ParseError { fn fmt ( & self , fmt : & mut :: std :: fmt :: Formatter ) -> :: std :: result :: Result < ( ) , :: std :: fmt :: Error > { try ! ( write ! ( fmt , "error at {}:{}: expected " , self . line , self . column ) ) ; if self . expected . len ( ) == 0 { try ! ( write ! ( fmt , "EOF" ) ) ; } else if self . expected . len ( ) == 1 { try ! ( write ! ( fmt , "`{}`" , escape_default ( self . expected . iter ( ) . next ( ) . unwrap ( ) ) ) ) ; } else { let mut iter = self . expected . iter ( ) ; try ! ( write ! ( fmt , "one of `{}`" , escape_default ( iter . next ( ) . unwrap ( ) ) ) ) ; for elem in iter { try ! ( write ! ( fmt , ", `{}`" , escape_default ( elem ) ) ) ; } } Ok ( ( ) ) } } impl :: std :: error :: Error for ParseError { fn description ( & self ) -> & str { "parse error" } } fn slice_eq ( input : & str , state : & mut ParseState , pos : usize , m : & 'static str ) -> RuleResult < ( ) > { # ! [ inline ] # ! [ allow ( dead_code ) ] let l = m . len ( ) ; if input . len ( ) >= pos + l && & input . as_bytes ( ) [ pos .. pos + l ] == m . as_bytes ( ) { Matched ( pos + l , ( ) ) } else { state . mark_failure ( pos , m ) } } fn slice_eq_case_insensitive ( input : & str , state : & mut ParseState , pos : usize , m : & 'static str ) -> RuleResult < ( ) > { # ! [ inline ] # ! [ allow ( dead_code ) ] let mut used = 0usize ; let mut input_iter = input [ pos .. ] . chars ( ) . flat_map ( | x | x . to_uppercase ( ) ) ; for m_char_upper in m . chars ( ) . flat_map ( | x | x . to_uppercase ( ) ) { used += m_char_upper . len_utf8 ( ) ; let input_char_result = input_iter . next ( ) ; if input_char_result . is_none ( ) || input_char_result . unwrap ( ) != m_char_upper { return state . mark_failure ( pos , m ) ; } } Matched ( pos + used , ( ) ) } fn any_char ( input : & str , state : & mut ParseState , pos : usize ) -> RuleResult < ( ) > { # ! [ inline ] # ! [ allow ( dead_code ) ] if input . len ( ) > pos { let ( _ , next ) = char_range_at ( input , pos ) ; Matched ( next , ( ) ) } else { state . mark_failure ( pos , "<character>" ) } } fn pos_to_line ( input : & str , pos : usize ) -> ( usize , usize ) { let before = & input [ .. pos ] ; let line = before . as_bytes ( ) . iter ( ) . filter ( | && c | c == b'\n' ) . count ( ) + 1 ; let col = before . chars ( ) . rev ( ) . take_while ( | & c | c != '\n' ) . count ( ) + 1 ; ( line , col ) } impl < 'input > ParseState < 'input > { fn mark_failure ( & mut self , pos : usize , expected : & 'static str ) -> RuleResult < ( ) > { if self . suppress_fail == 0 { if pos > self . max_err_pos { self . max_err_pos = pos ; self . expected . clear ( ) ; } if pos == self . max_err_pos { self . expected . insert ( expected ) ; } } Failed } } struct ParseState < 'input > { max_err_pos : usize , suppress_fail : usize , expected : :: std :: collections :: HashSet < & 'static str > , _phantom : :: std :: marker :: PhantomData < & 'input ( ) > , } impl < 'input > ParseState < 'input > { fn new ( ) -> ParseState < 'input > { ParseState { max_err_pos : 0 , suppress_fail : 0 , expected : :: std :: collections :: HashSet :: new ( ) , _phantom : :: std :: marker :: PhantomData , } } } fn __parse_session < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < Vec<SmtpInput> > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = { let mut __repeat_pos = __pos ; loop { let __pos = __repeat_pos ; let __step_res = __parse_WS ( __input , __state , __pos ) ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; } , Failed => { break ; } } } Matched ( __repeat_pos , ( ) ) } ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_script ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , i ) => { Matched ( __pos , { i } ) } Failed => Failed , } } } Failed => Failed , } } } fn __parse_script < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < Vec<SmtpInput> > { # ! [ allow ( non_snake_case , unused ) ] { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! ( ) ; loop { let __pos = __repeat_pos ; let __step_res = __parse_input ( __input , __state , __pos ) ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; __repeat_value . push ( __value ) ; } , Failed => { break ; } } } if __repeat_value . len ( ) >= 1 { Matched ( __repeat_pos , __repeat_value ) } else { Failed } } } fn __parse_input < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpInput > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = __parse_inp_none ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_inp_command ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_inp_invalid ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => __parse_inp_incomplete ( __input , __state , __pos ) } } } } } } } fn __parse_inp_command < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpInput > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = Matched ( __pos , __pos ) ; match __seq_res { Matched ( __pos , b ) => { { let __seq_res = __parse_command ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , c ) => { { let __seq_res = Matched ( __pos , __pos ) ; match __seq_res { Matched ( __pos , e ) => { Matched ( __pos , { SmtpInput::Command(b, e - b, c) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_inp_none < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpInput > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = Matched ( __pos , __pos ) ; match __seq_res { Matched ( __pos , b ) => { { let __seq_res = { let str_start = __pos ; match { let __choice_res = __parse_NL ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __seq_res = { let mut __repeat_pos = __pos ; loop { let __pos = __repeat_pos ; let __step_res = __parse_WS ( __input , __state , __pos ) ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; } , Failed => { break ; } } } Matched ( __repeat_pos , ( ) ) } ; match __seq_res { Matched ( __pos , _ ) => { __parse_NL ( __input , __state , __pos ) } Failed => Failed , } } } } { Matched ( __newpos , _ ) => { Matched ( __newpos , & __input [ str_start .. __newpos ] ) } , Failed => Failed , } } ; match __seq_res { Matched ( __pos , s ) => { { let __seq_res = Matched ( __pos , __pos ) ; match __seq_res { Matched ( __pos , e ) => { Matched ( __pos , { SmtpInput::None(b, e - b, s.to_string()) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_inp_invalid < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpInput > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = Matched ( __pos , __pos ) ; match __seq_res { Matched ( __pos , b ) => { { let __seq_res = { let str_start = __pos ; match __parse_str_invalid ( __input , __state , __pos ) { Matched ( __newpos , _ ) => { Matched ( __newpos , & __input [ str_start .. __newpos ] ) } , Failed => Failed , } } ; match __seq_res { Matched ( __pos , s ) => { { let __seq_res = Matched ( __pos , __pos ) ; match __seq_res { Matched ( __pos , e ) => { Matched ( __pos , { SmtpInput::Invalid(b, e - b, Bytes::from(s)) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_inp_incomplete < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpInput > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = Matched ( __pos , __pos ) ; match __seq_res { Matched ( __pos , b ) => { { let __seq_res = { let str_start = __pos ; match __parse_str_incomplete ( __input , __state , __pos ) { Matched ( __newpos , _ ) => { Matched ( __newpos , & __input [ str_start .. __newpos ] ) } , Failed => Failed , } } ; match __seq_res { Matched ( __pos , s ) => { { let __seq_res = Matched ( __pos , __pos ) ; match __seq_res { Matched ( __pos , e ) => { Matched ( __pos , { SmtpInput::Incomplete(b, e - b, Bytes::from(s)) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_str_invalid < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < () > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = { __state . suppress_fail += 1 ; let res = { let __choice_res = slice_eq ( __input , __state , __pos , "\n" ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __seq_res = { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! ( ) ; loop { let __pos = __repeat_pos ; let __step_res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '\n' => __state . mark_failure ( __pos , "[^\n]" ) , _ => Matched ( __next , ( ) ) , } } else { __state . mark_failure ( __pos , "[^\n]" ) } ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; __repeat_value . push ( __value ) ; } , Failed => { break ; } } } if __repeat_value . len ( ) >= 1 { Matched ( __repeat_pos , ( ) ) } else { Failed } } ; match __seq_res { Matched ( __pos , _ ) => { slice_eq ( __input , __state , __pos , "\n" ) } Failed => Failed , } } } } ; __state . suppress_fail -= 1 ; res } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { __state . mark_failure ( __pos , "invalid input" ) ; Failed } } } } fn __parse_str_incomplete < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < () > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = { __state . suppress_fail += 1 ; let res = { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! ( ) ; loop { let __pos = __repeat_pos ; let __step_res = any_char ( __input , __state , __pos ) ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; __repeat_value . push ( __value ) ; } , Failed => { break ; } } } if __repeat_value . len ( ) >= 1 { Matched ( __repeat_pos , ( ) ) } else { Failed } } ; __state . suppress_fail -= 1 ; res } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { __state . mark_failure ( __pos , "incomplete input" ) ; Failed } } } } fn __parse_command < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = __parse_cmd_starttls ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_helo ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_ehlo ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_mail ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_send ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_soml ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_saml ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_rcpt ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_data ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_rset ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_quit ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_noop ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_turn ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_vrfy ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_cmd_expn ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => __parse_cmd_help ( __input , __state , __pos ) } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } fn __parse_cmd_starttls < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "starttls" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::StartTls } ) } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_quit < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "quit" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Quit } ) } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_rset < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "rset" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Rset } ) } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_data < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "data" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Data } ) } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_turn < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "turn" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Turn } ) } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_mail < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "mail from:" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_path_reverse ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , p ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Mail(SmtpMail::Mail(p)) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_send < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "send from:" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_path_reverse ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , p ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Mail(SmtpMail::Send(p)) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_soml < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "soml from:" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_path_reverse ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , p ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Mail(SmtpMail::Soml(p)) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_saml < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "saml from:" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_path_reverse ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , p ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Mail(SmtpMail::Saml(p)) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_rcpt < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "rcpt to:" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_path_forward ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , p ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Rcpt(p) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_helo < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "helo" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_SP ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_host ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , h ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Helo(SmtpHelo::Helo(h)) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_ehlo < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "ehlo" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_SP ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_host ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , h ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Helo(SmtpHelo::Ehlo(h)) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_vrfy < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "vrfy" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_strparam ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , s ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Vrfy(s) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_expn < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "expn" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_strparam ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , s ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Expn(s) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_noop < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "noop" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! ( ) ; loop { let __pos = __repeat_pos ; let __step_res = __parse_strparam ( __input , __state , __pos ) ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; __repeat_value . push ( __value ) ; } , Failed => { break ; } } } Matched ( __repeat_pos , __repeat_value ) } ; match __seq_res { Matched ( __pos , s ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Noop(s) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_cmd_help < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "help" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! ( ) ; loop { let __pos = __repeat_pos ; let __step_res = __parse_strparam ( __input , __state , __pos ) ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; __repeat_value . push ( __value ) ; } , Failed => { break ; } } } Matched ( __repeat_pos , __repeat_value ) } ; match __seq_res { Matched ( __pos , s ) => { { let __seq_res = __parse_NL ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpCommand::Help(s) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_path_forward < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpPath > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = __parse_path_relay ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_path_direct ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => __parse_path_postmaster ( __input , __state , __pos ) } } } } } fn __parse_path_reverse < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpPath > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = __parse_path_relay ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_path_direct ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => __parse_path_null ( __input , __state , __pos ) } } } } } fn __parse_path_relay < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpPath > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq ( __input , __state , __pos , "<" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! ( ) ; loop { let __pos = __repeat_pos ; let __step_res = __parse_athost ( __input , __state , __pos ) ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; __repeat_value . push ( __value ) ; } , Failed => { break ; } } } if __repeat_value . len ( ) >= 1 { Matched ( __repeat_pos , __repeat_value ) } else { Failed } } ; match __seq_res { Matched ( __pos , h ) => { { let __seq_res = __parse_address ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , a ) => { { let __seq_res = slice_eq ( __input , __state , __pos , ">" ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpPath::Relay(h, a) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_path_direct < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpPath > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq ( __input , __state , __pos , "<" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_address ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , a ) => { { let __seq_res = slice_eq ( __input , __state , __pos , ">" ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpPath::Direct(a) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_path_postmaster < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpPath > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq_case_insensitive ( __input , __state , __pos , "<postmaster>" ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpPath::Postmaster } ) } Failed => Failed , } } } fn __parse_path_null < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpPath > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq ( __input , __state , __pos , "<>" ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { SmtpPath::Null } ) } Failed => Failed , } } } fn __parse_address < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpAddress > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = __parse_str ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , s ) => { { let __seq_res = slice_eq ( __input , __state , __pos , "@" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_host ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , h ) => { Matched ( __pos , { SmtpAddress::Mailbox (s, h) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_athost < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpHost > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq ( __input , __state , __pos , "@" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_host ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , h ) => { { let __seq_res = { let __choice_res = { let __seq_res = { __state . suppress_fail += 1 ; let __assert_res = slice_eq ( __input , __state , __pos , ",@" ) ; __state . suppress_fail -= 1 ; match __assert_res { Matched ( _ , __value ) => Matched ( __pos , __value ) , Failed => Failed , } } ; match __seq_res { Matched ( __pos , _ ) => { slice_eq ( __input , __state , __pos , "," ) } Failed => Failed , } } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => slice_eq ( __input , __state , __pos , ":" ) } } ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { h } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_strparam < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < String > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = __parse_SP ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_str ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , s ) => { Matched ( __pos , { s } ) } Failed => Failed , } } } Failed => Failed , } } } fn __parse_host < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpHost > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = __parse_host_numeric ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_host_ipv4 ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_host_ipv6 ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = __parse_host_other ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => __parse_host_domain ( __input , __state , __pos ) } } } } } } } } } fn __parse_host_domain < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpHost > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = { let str_start = __pos ; match { let __seq_res = __parse_label ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { { let mut __repeat_pos = __pos ; loop { let __pos = __repeat_pos ; let __step_res = { let __seq_res = slice_eq ( __input , __state , __pos , "." ) ; match __seq_res { Matched ( __pos , _ ) => { __parse_label ( __input , __state , __pos ) } Failed => Failed , } } ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; } , Failed => { break ; } } } Matched ( __repeat_pos , ( ) ) } } Failed => Failed , } } { Matched ( __newpos , _ ) => { Matched ( __newpos , & __input [ str_start .. __newpos ] ) } , Failed => Failed , } } ; match __seq_res { Matched ( __pos , s ) => { Matched ( __pos , { SmtpHost::Domain(s.to_string()) } ) } Failed => Failed , } } } fn __parse_domain < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < () > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = { __state . suppress_fail += 1 ; let res = { let __seq_res = __parse_label ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { { let mut __repeat_pos = __pos ; loop { let __pos = __repeat_pos ; let __step_res = { let __seq_res = slice_eq ( __input , __state , __pos , "." ) ; match __seq_res { Matched ( __pos , _ ) => { __parse_label ( __input , __state , __pos ) } Failed => Failed , } } ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; } , Failed => { break ; } } } Matched ( __repeat_pos , ( ) ) } } Failed => Failed , } } ; __state . suppress_fail -= 1 ; res } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { __state . mark_failure ( __pos , "domain name" ) ; Failed } } } } fn __parse_label < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < () > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { 'a' ... 'z' | 'A' ... 'Z' | '0' ... '9' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[a-zA-Z0-9]" ) , } } else { __state . mark_failure ( __pos , "[a-zA-Z0-9]" ) } ; match __seq_res { Matched ( __pos , _ ) => { { let mut __repeat_pos = __pos ; loop { let __pos = __repeat_pos ; let __step_res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '-' | 'a' ... 'z' | 'A' ... 'Z' | '0' ... '9' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[-a-zA-Z0-9]" ) , } } else { __state . mark_failure ( __pos , "[-a-zA-Z0-9]" ) } ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; } , Failed => { break ; } } } Matched ( __repeat_pos , ( ) ) } } Failed => Failed , } } } fn __parse_host_numeric < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpHost > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq ( __input , __state , __pos , "#" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = { let str_start = __pos ; match { let __choice_res = { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! ( ) ; loop { let __pos = __repeat_pos ; let __step_res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '0' ... '9' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[0-9]" ) , } } else { __state . mark_failure ( __pos , "[0-9]" ) } ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; __repeat_value . push ( __value ) ; } , Failed => { break ; } } } if __repeat_value . len ( ) >= 1 { Matched ( __repeat_pos , ( ) ) } else { Failed } } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { __state . mark_failure ( __pos , "ipv4 number" ) ; Failed } } } { Matched ( __newpos , _ ) => { Matched ( __newpos , & __input [ str_start .. __newpos ] ) } , Failed => Failed , } } ; match __seq_res { Matched ( __pos , s ) => { Matched ( __pos , { match u32::from_str(s) { Ok(ip) => SmtpHost::Ipv4(Ipv4Addr::from(ip)), Err(e) => SmtpHost::Invalid{label:"numeric".to_string(), literal:s.to_string()}, } } ) } Failed => Failed , } } } Failed => Failed , } } } fn __parse_host_ipv4 < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpHost > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq ( __input , __state , __pos , "[" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = { let str_start = __pos ; match __parse_ipv4addr ( __input , __state , __pos ) { Matched ( __newpos , _ ) => { Matched ( __newpos , & __input [ str_start .. __newpos ] ) } , Failed => Failed , } } ; match __seq_res { Matched ( __pos , s ) => { { let __seq_res = slice_eq ( __input , __state , __pos , "]" ) ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { match Ipv4Addr::from_str(s) { Ok(ip) => SmtpHost::Ipv4(ip), Err(e) => SmtpHost::Invalid{label:"ipv4".to_string(), literal:s.to_string()}, } } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_ipv4addr < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < () > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = { __state . suppress_fail += 1 ; let res = { let __seq_res = __parse_ipv4part ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = slice_eq ( __input , __state , __pos , "." ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_ipv4part ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = slice_eq ( __input , __state , __pos , "." ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_ipv4part ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = slice_eq ( __input , __state , __pos , "." ) ; match __seq_res { Matched ( __pos , _ ) => { __parse_ipv4part ( __input , __state , __pos ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } ; __state . suppress_fail -= 1 ; res } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { __state . mark_failure ( __pos , "ipv4 address" ) ; Failed } } } } fn __parse_ipv4part < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < () > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = { let __seq_res = slice_eq ( __input , __state , __pos , "25" ) ; match __seq_res { Matched ( __pos , _ ) => { if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '0' ... '5' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[0-5]" ) , } } else { __state . mark_failure ( __pos , "[0-5]" ) } } Failed => Failed , } } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = { let __seq_res = slice_eq ( __input , __state , __pos , "2" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '0' ... '4' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[0-4]" ) , } } else { __state . mark_failure ( __pos , "[0-4]" ) } ; match __seq_res { Matched ( __pos , _ ) => { if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '0' ... '9' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[0-9]" ) , } } else { __state . mark_failure ( __pos , "[0-9]" ) } } Failed => Failed , } } } Failed => Failed , } } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = { let __seq_res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '0' ... '1' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[0-1]" ) , } } else { __state . mark_failure ( __pos , "[0-1]" ) } ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '0' ... '9' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[0-9]" ) , } } else { __state . mark_failure ( __pos , "[0-9]" ) } ; match __seq_res { Matched ( __pos , _ ) => { match if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '0' ... '9' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[0-9]" ) , } } else { __state . mark_failure ( __pos , "[0-9]" ) } { Matched ( __newpos , _ ) => { Matched ( __newpos , ( ) ) } , Failed => { Matched ( __pos , ( ) ) } , } } Failed => Failed , } } } Failed => Failed , } } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __seq_res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '0' ... '9' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[0-9]" ) , } } else { __state . mark_failure ( __pos , "[0-9]" ) } ; match __seq_res { Matched ( __pos , _ ) => { match if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '0' ... '9' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[0-9]" ) , } } else { __state . mark_failure ( __pos , "[0-9]" ) } { Matched ( __newpos , _ ) => { Matched ( __newpos , ( ) ) } , Failed => { Matched ( __pos , ( ) ) } , } } Failed => Failed , } } } } } } } } } fn __parse_host_ipv6 < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpHost > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = { let str_start = __pos ; match slice_eq_case_insensitive ( __input , __state , __pos , "IPv6" ) { Matched ( __newpos , _ ) => { Matched ( __newpos , & __input [ str_start .. __newpos ] ) } , Failed => Failed , } } ; match __seq_res { Matched ( __pos , l ) => { { let __seq_res = slice_eq ( __input , __state , __pos , ":" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = { let str_start = __pos ; match __parse_ipv6addr ( __input , __state , __pos ) { Matched ( __newpos , _ ) => { Matched ( __newpos , & __input [ str_start .. __newpos ] ) } , Failed => Failed , } } ; match __seq_res { Matched ( __pos , s ) => { Matched ( __pos , { match Ipv6Addr::from_str(s) { Ok(ip) => SmtpHost::Ipv6(ip), Err(e) => SmtpHost::Invalid{label:l.to_string(), literal:s.to_string()}, } } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_ipv6addr < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < () > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = { __state . suppress_fail += 1 ; let res = { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! ( ) ; loop { let __pos = __repeat_pos ; let __step_res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '0' ... '9' | 'a' ... 'f' | 'A' ... 'F' | ':' | '.' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[0-9a-fA-F:.]" ) , } } else { __state . mark_failure ( __pos , "[0-9a-fA-F:.]" ) } ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; __repeat_value . push ( __value ) ; } , Failed => { break ; } } } if __repeat_value . len ( ) >= 1 { Matched ( __repeat_pos , ( ) ) } else { Failed } } ; __state . suppress_fail -= 1 ; res } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { __state . mark_failure ( __pos , "ipv6 address" ) ; Failed } } } } fn __parse_host_other < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < SmtpHost > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = __parse_str ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , l ) => { { let __seq_res = slice_eq ( __input , __state , __pos , ":" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = __parse_str ( __input , __state , __pos ) ; match __seq_res { Matched ( __pos , s ) => { Matched ( __pos , { SmtpHost::Other{label:l, literal:s} } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_str < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < String > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = __parse_str_quoted ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => __parse_str_plain ( __input , __state , __pos ) } } } fn __parse_str_plain < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < String > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! ( ) ; loop { let __pos = __repeat_pos ; let __step_res = __parse_char ( __input , __state , __pos ) ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; __repeat_value . push ( __value ) ; } , Failed => { break ; } } } Matched ( __repeat_pos , __repeat_value ) } ; match __seq_res { Matched ( __pos , v ) => { Matched ( __pos , { v.iter().fold(String::new(), |s, c| s + c) } ) } Failed => Failed , } } } fn __parse_str_quoted < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < String > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '"' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[\"]" ) , } } else { __state . mark_failure ( __pos , "[\"]" ) } ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = { let mut __repeat_pos = __pos ; let mut __repeat_value = vec ! ( ) ; loop { let __pos = __repeat_pos ; let __step_res = __parse_qchar ( __input , __state , __pos ) ; match __step_res { Matched ( __newpos , __value ) => { __repeat_pos = __newpos ; __repeat_value . push ( __value ) ; } , Failed => { break ; } } } Matched ( __repeat_pos , __repeat_value ) } ; match __seq_res { Matched ( __pos , v ) => { { let __seq_res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '"' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[\"]" ) , } } else { __state . mark_failure ( __pos , "[\"]" ) } ; match __seq_res { Matched ( __pos , _ ) => { Matched ( __pos , { v.iter().fold(String::new(), |s, c| s + c) } ) } Failed => Failed , } } } Failed => Failed , } } } Failed => Failed , } } } fn __parse_qchar < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < &'input str > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = __parse_qchar_regular ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => __parse_char_special ( __input , __state , __pos ) } } } fn __parse_qchar_regular < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < &'input str > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = { let str_start = __pos ; match { let __choice_res = { __state . suppress_fail += 1 ; let res = { let __seq_res = { __state . suppress_fail += 1 ; let __assert_res = { let __choice_res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '"' | '\\' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[\"\\]" ) , } } else { __state . mark_failure ( __pos , "[\"\\]" ) } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = slice_eq ( __input , __state , __pos , "\r" ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => slice_eq ( __input , __state , __pos , "\n" ) } } } } ; __state . suppress_fail -= 1 ; match __assert_res { Failed => Matched ( __pos , ( ) ) , Matched ( .. ) => Failed , } } ; match __seq_res { Matched ( __pos , _ ) => { any_char ( __input , __state , __pos ) } Failed => Failed , } } ; __state . suppress_fail -= 1 ; res } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { __state . mark_failure ( __pos , "quoted character" ) ; Failed } } } { Matched ( __newpos , _ ) => { Matched ( __newpos , & __input [ str_start .. __newpos ] ) } , Failed => Failed , } } ; match __seq_res { Matched ( __pos , s ) => { Matched ( __pos , { s } ) } Failed => Failed , } } } fn __parse_char < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < &'input str > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = __parse_char_regular ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => __parse_char_special ( __input , __state , __pos ) } } } fn __parse_char_regular < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < &'input str > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = { let str_start = __pos ; match { let __choice_res = { __state . suppress_fail += 1 ; let res = if __input . len ( ) > __pos { let ( __ch , __next ) = char_range_at ( __input , __pos ) ; match __ch { '-' | '!' | '#' | '$' | '%' | '&' | '\'' | '*' | '+' | '`' | '/' | '0' ... '1' | 'a' ... 'z' | '-' | 'A' ... 'Z' | '=' | '?' | '~' | '^' | '_' | '{' | '}' | '|' => Matched ( __next , ( ) ) , _ => __state . mark_failure ( __pos , "[-!#$%&'*+`/0-1a-z-A-Z=?~^_{}|]" ) , } } else { __state . mark_failure ( __pos , "[-!#$%&'*+`/0-1a-z-A-Z=?~^_{}|]" ) } ; __state . suppress_fail -= 1 ; res } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { __state . mark_failure ( __pos , "regular character" ) ; Failed } } } { Matched ( __newpos , _ ) => { Matched ( __newpos , & __input [ str_start .. __newpos ] ) } , Failed => Failed , } } ; match __seq_res { Matched ( __pos , s ) => { Matched ( __pos , { s } ) } Failed => Failed , } } } fn __parse_char_special < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < &'input str > { # ! [ allow ( non_snake_case , unused ) ] { let __seq_res = slice_eq ( __input , __state , __pos , "\\" ) ; match __seq_res { Matched ( __pos , _ ) => { { let __seq_res = { let str_start = __pos ; match { let __choice_res = { __state . suppress_fail += 1 ; let res = any_char ( __input , __state , __pos ) ; __state . suppress_fail -= 1 ; res } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { __state . mark_failure ( __pos , "special character" ) ; Failed } } } { Matched ( __newpos , _ ) => { Matched ( __newpos , & __input [ str_start .. __newpos ] ) } , Failed => Failed , } } ; match __seq_res { Matched ( __pos , s ) => { Matched ( __pos , { s } ) } Failed => Failed , } } } Failed => Failed , } } } fn __parse_NL < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < () > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = { __state . suppress_fail += 1 ; let res = slice_eq ( __input , __state , __pos , "\r\n" ) ; __state . suppress_fail -= 1 ; res } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { let __choice_res = { __state . suppress_fail += 1 ; let res = slice_eq ( __input , __state , __pos , "\n" ) ; __state . suppress_fail -= 1 ; res } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { __state . mark_failure ( __pos , "{NL}" ) ; Failed } } } } } } fn __parse_SP < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < () > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = { __state . suppress_fail += 1 ; let res = slice_eq ( __input , __state , __pos , " " ) ; __state . suppress_fail -= 1 ; res } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { __state . mark_failure ( __pos , "{SP}" ) ; Failed } } } } fn __parse_WS < 'input > ( __input : & 'input str , __state : & mut ParseState < 'input > , __pos : usize ) -> RuleResult < () > { # ! [ allow ( non_snake_case , unused ) ] { let __choice_res = { __state . suppress_fail += 1 ; let res = { let __choice_res = __parse_SP ( __input , __state , __pos ) ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => slice_eq ( __input , __state , __pos , "\t" ) } } ; __state . suppress_fail -= 1 ; res } ; match __choice_res { Matched ( __pos , __value ) => Matched ( __pos , __value ) , Failed => { __state . mark_failure ( __pos , "{WS}" ) ; Failed } } } } pub fn session < 'input > ( __input : & 'input str ) -> ParseResult < Vec<SmtpInput> > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_session ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn script < 'input > ( __input : & 'input str ) -> ParseResult < Vec<SmtpInput> > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_script ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn input < 'input > ( __input : & 'input str ) -> ParseResult < SmtpInput > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_input ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn inp_command < 'input > ( __input : & 'input str ) -> ParseResult < SmtpInput > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_inp_command ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn inp_none < 'input > ( __input : & 'input str ) -> ParseResult < SmtpInput > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_inp_none ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn inp_invalid < 'input > ( __input : & 'input str ) -> ParseResult < SmtpInput > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_inp_invalid ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn inp_incomplete < 'input > ( __input : & 'input str ) -> ParseResult < SmtpInput > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_inp_incomplete ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn command < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_command ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_starttls < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_starttls ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_quit < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_quit ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_rset < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_rset ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_data < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_data ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_turn < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_turn ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_mail < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_mail ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_send < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_send ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_soml < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_soml ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_saml < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_saml ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_rcpt < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_rcpt ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_helo < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_helo ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_ehlo < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_ehlo ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_vrfy < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_vrfy ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_expn < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_expn ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_noop < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_noop ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn cmd_help < 'input > ( __input : & 'input str ) -> ParseResult < SmtpCommand > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_cmd_help ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn path_forward < 'input > ( __input : & 'input str ) -> ParseResult < SmtpPath > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_path_forward ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn path_reverse < 'input > ( __input : & 'input str ) -> ParseResult < SmtpPath > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_path_reverse ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn address < 'input > ( __input : & 'input str ) -> ParseResult < SmtpAddress > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_address ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn host < 'input > ( __input : & 'input str ) -> ParseResult < SmtpHost > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_host ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) } pub fn str < 'input > ( __input : & 'input str ) -> ParseResult < String > { # ! [ allow ( non_snake_case , unused ) ] let mut __state = ParseState :: new ( ) ; match __parse_str ( __input , & mut __state , 0 ) { Matched ( __pos , __value ) => { if __pos == __input . len ( ) { return Ok ( __value ) } } _ => { } } let ( __line , __col ) = pos_to_line ( __input , __state . max_err_pos ) ; Err ( ParseError { line : __line , column : __col , offset : __state . max_err_pos , expected : __state . expected , } ) }