File: datescan.nfa

package info (click to toggle)
mairix 0.23+git20131125-0.3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,296 kB
  • ctags: 1,299
  • sloc: ansic: 11,345; sh: 1,000; yacc: 185; makefile: 135; lex: 87; perl: 34
file content (112 lines) | stat: -rw-r--r-- 2,919 bytes parent folder | download | duplicates (4)
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
#########################################################################
#
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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
        <day:in->out> = DS_D
        <year:in->out> = DS_Y
        <ccyy:in->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
        <scaled:in->out> = DS_SCALED
        <month:in->out> = DS_M
        [1-9] ; <month:in->out> = DS_DM
        <day:in->out> ; <month:in->out> = DS_DM
        <month:in->out> ; [1-9] = DS_MD
        <month:in->out> ; <day:in->out> = DS_MD
        <year:in->out> ; <month:in->out> = DS_YM
        <month:in->out> ; <year:in->out> = DS_MY
        <ccyy:in->out> ; <month:in->out> = DS_YM
        <month:in->out> ; <ccyy:in->out> = DS_MY

        <year:in->out> ; <month:in->out> ; [1-9] = DS_YMD
        <year:in->out> ; <month:in->out> ; <day:in->out> = DS_YMD
        [1-9] ; <month:in->out> ; <year:in->out> = DS_DMY
        <day:in->out> ; <month:in->out> ; <year:in->out> = DS_DMY

        <ccyy:in->out> ; <month:in->out> ; [1-9] = DS_YMD
        <ccyy:in->out> ; <month:in->out> ; <day:in->out> = DS_YMD
        [1-9] ; <month:in->out> ; <ccyy:in->out> = DS_DMY
        <day:in->out> ; <month:in->out> ; <ccyy:in->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