]> Pileus Git - ~andy/fetchmail/blob - rcfile_l.l
Remove some dependencies on the name of the rc file.
[~andy/fetchmail] / rcfile_l.l
1 %{
2
3 /* Copyright 1993-95 by Carl Harris, Jr. Copyright 1996 by Eric S. Raymond
4  * All rights reserved.
5  * For license terms, see the file COPYING in this directory.
6  */
7
8 /***********************************************************************
9   module:       poprc_l.l
10   project:      fetchmail
11   programmer:   Carl Harris, ceharris@mal.com
12                 Extensively hacked by esr.
13   description:  .poprc lexer
14
15  ***********************************************************************/
16
17 #include <config.h>
18 #include "poproto.h"
19 #include "rcfile_y.h"
20
21 int prc_lineno = 1;
22 %}
23
24
25 %%
26
27 defaults        { return KW_DEFAULTS; }
28 server          { return KW_SERVER; }
29 proto(col)?     { return KW_PROTOCOL; }
30 user(name)?     { return KW_USERNAME; }
31 pass(word)?     { return KW_PASSWORD; }
32 rpopid          { return KW_RPOPID; }
33 remote(folder)? { return KW_REMOTEFOLDER; }
34 local(folder)?  { return KW_LOCALFOLDER; }
35 smtp(host)?     { return KW_SMTPHOST; }
36 mda             { return KW_MDA; }
37 keep            { yylval.flag = TRUE; return KW_KEEP; }
38 flush           { yylval.flag = TRUE; return KW_FLUSH; }
39 fetchall        { yylval.flag = TRUE; return KW_FETCHALL; }
40 rewrite         { yylval.flag = TRUE; return KW_REWRITE; }
41 nokeep          { yylval.flag = FALSE; return KW_KEEP; }
42 noflush         { yylval.flag = FALSE; return KW_FLUSH; }
43 nofetchall      { yylval.flag = FALSE; return KW_FETCHALL; }
44 norewrite       { yylval.flag = FALSE; return KW_REWRITE; }
45 port            { return KW_PORT; }
46
47 (auto)|(AUTO)   { yylval.proto = P_AUTO;  return PROTO_AUTO; }
48 (pop2)|(POP2)   { yylval.proto = P_POP2;  return PROTO_POP2; }
49 (pop3)|(POP3)   { yylval.proto = P_POP3;  return PROTO_POP3; }
50 (imap)|(IMAP)   { yylval.proto = P_IMAP;  return PROTO_IMAP; }
51 (apop)|(APOP)   { yylval.proto = P_APOP;  return PROTO_APOP; }
52 (rpop)|(RPOP)   { yylval.proto = P_RPOP;  return PROTO_RPOP; }
53
54 (#.*)?\\\n      { prc_lineno++; }   /* escaped newline is ignored */
55
56 (#.*)?\n        { prc_lineno++; return KW_EOL; }
57
58 \"[^\"]*\"      {
59                         yytext[strlen(yytext)-1] = '\0';
60                         yylval.sval = (char *) strdup(yytext+1);
61                         return PARAM_STRING;
62                 }
63 [^ \t\r\n]+     { yylval.sval = (char *) strdup(yytext); return PARAM_STRING; }
64
65 [ \t\r]+        ;       /* whitespace */
66