aboutsummaryrefslogtreecommitdiffstats
path: root/rcfile_l.l
blob: ffd4fadd3368cb415e79c9109166e99bf554a70c (plain)
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
%{

/*
 * For license terms, see the file COPYING in this directory.
 */

/***********************************************************************
  module:       rcfile_l.l
  project:      fetchmail
  programmer:   Carl Harris, ceharris@mal.com
		Extensively hacked by esr.
  description:  configuration lexer

 ***********************************************************************/

#include <config.h>
#include "fetchmail.h"
#include "rcfile_y.h"

int prc_lineno = 1;
%}

%%

defaults 	{ return DEFAULTS; }
server 		{ return SERVER; }
proto(col)? 	{ return PROTOCOL; }
port		{ return PORT; }
auth(enticate)?	{ return AUTHENTICATE; }
kerberos	{ return KERBEROS; }

user(name)?	{ return USERNAME; }
pass(word)?	{ return PASSWORD; }
remote(folder)? { return FOLDER; }
smtp(host)?	{ return SMTPHOST; }
mda		{ return MDA; }
is		{ return IS; }
here		{ return HERE; }
there		{ return THERE; }

keep		{ yylval.flag = FLAG_TRUE;  return KEEP; }
flush		{ yylval.flag = FLAG_TRUE;  return FLUSH; }
fetchall	{ yylval.flag = FLAG_TRUE;  return FETCHALL; }
rewrite		{ yylval.flag = FLAG_FALSE; return REWRITE; }
skip		{ yylval.flag = FLAG_TRUE;  return SKIP; }
nokeep		{ yylval.flag = FLAG_FALSE; return KEEP; }
noflush		{ yylval.flag = FLAG_FALSE; return FLUSH; }
nofetchall	{ yylval.flag = FLAG_FALSE; return FETCHALL; }
norewrite	{ yylval.flag = FLAG_TRUE;  return REWRITE; }
noskip		{ yylval.flag = FLAG_FALSE; return SKIP; }

with		{/* EMPTY */}
and		{/* EMPTY */}
has		{/* EMPTY */}
wants		{/* EMPTY */}
options		{/* EMPTY */}
[;:,]		{/* EMPTY */}

(auto)|(AUTO)	{ yylval.proto = P_AUTO;  return PROTO; }
(pop2)|(POP2)	{ yylval.proto = P_POP2;  return PROTO; }
(pop3)|(POP3)	{ yylval.proto = P_POP3;  return PROTO; }
(imap)|(IMAP)	{ yylval.proto = P_IMAP;  return PROTO; }
(apop)|(APOP)   { yylval.proto = P_APOP;  return PROTO; }
(kpop)|(KPOP)	{ return KPOP; }


(#.*)?\\?\n	{ prc_lineno++;	}   /* newline is ignored */

\"[^\"]*\"	{
			yytext[strlen(yytext)-1] = '\0';
			yylval.sval = (char *) strdup(yytext+1);
			return STRING;
		}
[^;:, \t\r\n]+	{ yylval.sval = (char *) strdup(yytext); return STRING; }

[ \t\r]+	;	/* whitespace */