######################################################################### # # mairix - message index builder and finder for maildir folders. # # Copyright (C) Richard P. Curnow 2002-2004,2006 # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # # ======================================================================= # NFA description for parsing dates # Stuff to pass through verbatim %{ #include "dates.h" %} Abbrev A = [a-zA-Z] BLOCK day { State in [12] ; [0-9] -> out [3] ; [01] -> out } # Match 2 digit year BLOCK year { State in [04-9] ; [0-9] -> out [3] ; [2-9] -> out } BLOCK month { State in A ; A ; A -> out } BLOCK scaled { State in [0-9] -> in, after_value State after_value A -> out } BLOCK ccyy { State in [1-9] ; [0-9] ; [0-9] ; [0-9] -> out } BLOCK main { State in [1-9] = DS_D out> = DS_D out> = DS_Y out> = DS_Y [0-9] ; [0-9] ; [0-9] ; [0-9] ; [0-9] ; [0-9] = DS_YYMMDD [0-9] ; [0-9] ; [0-9] ; [0-9] ; [0-9] ; [0-9] ; [0-9] ; [0-9] = DS_YYMMDD out> = DS_SCALED out> = DS_M [1-9] ; out> = DS_DM out> ; out> = DS_DM out> ; [1-9] = DS_MD out> ; out> = DS_MD out> ; out> = DS_YM out> ; out> = DS_MY out> ; out> = DS_YM out> ; out> = DS_MY out> ; out> ; [1-9] = DS_YMD out> ; out> ; out> = DS_YMD [1-9] ; out> ; out> = DS_DMY out> ; out> ; out> = DS_DMY out> ; out> ; [1-9] = DS_YMD out> ; out> ; out> = DS_YMD [1-9] ; out> ; out> = DS_DMY out> ; out> ; out> = DS_DMY } ATTR DS_D ATTR DS_Y ATTR DS_YYMMDD ATTR DS_SCALED ATTR DS_M ATTR DS_DM ATTR DS_MD ATTR DS_YM ATTR DS_MY ATTR DS_YMD ATTR DS_DMY DEFATTR DS_FAILURE TYPE "enum DATESCAN_TYPE" PREFIX datescan # vim:ft=txt:et:sw=4:sts=4:ht=4