Removed
Showing
1 changed file
with
0 additions
and
110 deletions
sieve/lex-sieve.lex
deleted
100644 → 0
1 | %{ | ||
2 | /* GNU mailutils - a suite of utilities for electronic mail | ||
3 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Library Public License as published by | ||
7 | the Free Software Foundation; either version 2, or (at your option) | ||
8 | any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU Library General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Library General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | ||
18 | |||
19 | #include <stdio.h> | ||
20 | #include "y.tab.h" | ||
21 | /* Scanner for Sieve | ||
22 | created : Alain Magloire | ||
23 | ref: RFC 3028 */ | ||
24 | |||
25 | void count (); | ||
26 | %} | ||
27 | |||
28 | DIGIT [0-9] | ||
29 | WHITE_SPACE [ \r\t] | ||
30 | QUANTIFIER [KMG] | ||
31 | DELIM [ \t\v\f\n] | ||
32 | LETTER [A-Za-z_] | ||
33 | ID [A-Za-z_][A-Za-z0-9_]* | ||
34 | TAG {ID}: | ||
35 | |||
36 | %x COMMENT | ||
37 | %x MULTILINE | ||
38 | %% | ||
39 | |||
40 | "/*" { BEGIN COMMENT; count (); } /* Switch to comment state. */ | ||
41 | <COMMENT>.|\n /* Throw away text. */; | ||
42 | <COMMENT>"*/" { BEGIN INITIAL; count (); } | ||
43 | |||
44 | "text:"\n { BEGIN MULTILINE; count (); } | ||
45 | <MULTILINE>.|\n { count (); } | ||
46 | <MULTILINE>^\.\n { BEGIN INITIAL; count (); return SIEVE_STRING; } | ||
47 | |||
48 | #.* /* Throw away. */; | ||
49 | |||
50 | {DIGIT}+[QUANTIFIER]? { count (); return SIEVE_NUMBER; } | ||
51 | \"[^\n"]+\" { /* " */ count (); return SIEVE_STRING; } | ||
52 | |||
53 | address { count (); return SIEVE_ADDRESS; } | ||
54 | all { count (); return SIEVE_ALL; } | ||
55 | allof { count (); return SIEVE_ALLOF; } | ||
56 | anyof { count (); return SIEVE_ANYOF; } | ||
57 | comparator { count (); return SIEVE_COMPARATOR; } | ||
58 | contains { count (); return SIEVE_CONTAINS; } | ||
59 | discard { count (); return SIEVE_DISCARD; } | ||
60 | domain { count (); return SIEVE_DOMAIN; } | ||
61 | else { count (); return SIEVE_ELSE; } | ||
62 | elsif { count (); return SIEVE_ELSIF; } | ||
63 | envelope { count (); return SIEVE_ENVELOPE; } | ||
64 | exists { count (); return SIEVE_EXISTS; } | ||
65 | false { count (); return SIEVE_FALSE; } | ||
66 | fileinto { count (); return SIEVE_FILEINTO; } | ||
67 | header { count (); return SIEVE_HEADER; } | ||
68 | if { count (); return SIEVE_IF; } | ||
69 | is { count (); return SIEVE_IS; } | ||
70 | keep { count (); return SIEVE_KEEP; } | ||
71 | localpart { count (); return SIEVE_LOCALPART; } | ||
72 | matches { count (); return SIEVE_MATCHES; } | ||
73 | not { count (); return SIEVE_NOT; } | ||
74 | over { count (); return SIEVE_OVER; } | ||
75 | redirect { count (); return SIEVE_REDIRECT; } | ||
76 | reject { count (); return SIEVE_REJECT; } | ||
77 | require { count (); return SIEVE_REQUIRE; } | ||
78 | size { count (); return SIEVE_SIZE; } | ||
79 | stop { count (); return SIEVE_STOP; } | ||
80 | true { count (); return SIEVE_TRUE; } | ||
81 | \: { count (); return ':'; } | ||
82 | \; { count (); return ';'; } | ||
83 | \, { count (); return ','; } | ||
84 | \( { count (); return '('; } | ||
85 | \) { count (); return ')'; } | ||
86 | \[ { count (); return '['; } | ||
87 | \] { count (); return ']'; } | ||
88 | \{ { count (); return '{'; } | ||
89 | \} { count (); return '}'; } | ||
90 | |||
91 | %% | ||
92 | |||
93 | int | ||
94 | yywrap () | ||
95 | { | ||
96 | return (1); | ||
97 | } | ||
98 | |||
99 | void | ||
100 | count () | ||
101 | { | ||
102 | ECHO; | ||
103 | } | ||
104 | |||
105 | int | ||
106 | yyerror (char *s) | ||
107 | { | ||
108 | fflush(stdout); | ||
109 | printf ("\n^ Syntax error.\n"); | ||
110 | } |
-
Please register or sign in to post a comment