]> Pileus Git - ~andy/fetchmail/blob - rcfile_l.l
gcc -Wall cleanup.
[~andy/fetchmail] / rcfile_l.l
1 %{
2
3 /*
4  * rcfile_l.l -- lexer for the run control file
5  *
6  * For license terms, see the file COPYING in this directory.
7  */
8
9 #include <config.h>
10 #include "fetchmail.h"
11 #include "rcfile_y.h"
12
13 int prc_lineno = 1;
14 %}
15
16 %o 4000
17
18 %%
19
20 defaults        { return DEFAULTS; }
21 server          { return SERVER; }
22 proto(col)?     { return PROTOCOL; }
23 port            { return PORT; }
24 auth(enticate)? { return AUTHENTICATE; }
25 kerberos        { return KERBEROS; }
26 timeout         { return TIMEOUT;}
27
28 user(name)?     { return USERNAME; }
29 pass(word)?     { return PASSWORD; }
30 remote(folder)? { return FOLDER; }
31 smtp(host)?     { return SMTPHOST; }
32 mda             { return MDA; }
33 is              { return IS; }
34 here            { return HERE; }
35 there           { return THERE; }
36 to              { return TO; }
37 =               { return MAP; }
38
39 keep            { yylval.flag = FLAG_TRUE;  return KEEP; }
40 flush           { yylval.flag = FLAG_TRUE;  return FLUSH; }
41 fetchall        { yylval.flag = FLAG_TRUE;  return FETCHALL; }
42 rewrite         { yylval.flag = FLAG_FALSE; return REWRITE; }
43 skip            { yylval.flag = FLAG_TRUE;  return SKIP; }
44 nokeep          { yylval.flag = FLAG_FALSE; return KEEP; }
45 noflush         { yylval.flag = FLAG_FALSE; return FLUSH; }
46 nofetchall      { yylval.flag = FLAG_FALSE; return FETCHALL; }
47 norewrite       { yylval.flag = FLAG_TRUE;  return REWRITE; }
48 noskip          { yylval.flag = FLAG_FALSE; return SKIP; }
49 limit           { return LIMIT; }
50
51 with            {/* EMPTY */}
52 and             {/* EMPTY */}
53 has             {/* EMPTY */}
54 wants           {/* EMPTY */}
55 options         {/* EMPTY */}
56 [;:,]           {/* EMPTY */}
57
58 (auto)|(AUTO)   { yylval.proto = P_AUTO;  return PROTO; }
59 (pop2)|(POP2)   { yylval.proto = P_POP2;  return PROTO; }
60 (pop3)|(POP3)   { yylval.proto = P_POP3;  return PROTO; }
61 (imap)|(IMAP)   { yylval.proto = P_IMAP;  return PROTO; }
62 (apop)|(APOP)   { yylval.proto = P_APOP;  return PROTO; }
63 (kpop)|(KPOP)   { return KPOP; }
64
65
66 (#.*)?\\?\n     { prc_lineno++; }   /* newline is ignored */
67
68 [0-9]+          { yylval.number = atoi(yytext); return NUMBER; }
69
70 \"[^\"]*\"      {
71                         char buf[POPBUFSIZE];
72
73                         yytext[strlen(yytext)-1] = '\0';
74                         escapes(yytext+1, buf);
75                         yylval.sval = (char *) xstrdup(buf);
76                         return STRING;
77                 }
78 [^;:, \t\r\n]+  {
79                         char buf[POPBUFSIZE];
80
81                         escapes(yytext, buf);
82                         yylval.sval = (char *) xstrdup(buf);
83                         return STRING;
84                 }
85
86 [ \t\r]+        ;       /* whitespace */
87