aboutsummaryrefslogtreecommitdiffstats
path: root/src/ragel/smtp_date.rl
blob: da5872439ea4f7fe9beaa15adae5f9036fe70325 (plain)
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
%%{
  machine smtp_date;

  include smtp_whitespace "smtp_whitespace.rl";

  # SMTP date spec
  # Obtained from: http://tools.ietf.org/html/rfc5322#section_3.3

  digit_2         =   digit{2};
  digit_4         =   digit{4};
  day_name        =    "Mon" | "Tue" | "Wed" | "Thu" |
                       "Fri" | "Sat" | "Sun";
  day_of_week     =   FWS? day_name;
  day             =   FWS? digit{1,2} FWS;
  month           =    "Jan" | "Feb" | "Mar" | "Apr" |
                       "May" | "Jun" | "Jul" | "Aug" |
                       "Sep" | "Oct" | "Nov" | "Dec";
  year            =   FWS digit{4,} FWS;
  date            =   day month year;
  hour            =   digit_2;
  minute          =   digit_2;
  second          =   digit_2;
  time_of_day     =   hour ":" minute (":" second )?;
  zone            =   FWS ("+" | "-") >Sign_Start %Sign_End digit_4;
  time            =   time_of_day zone;
  date_time       =   (day_of_week ",")? date time;
}%%