Author: A1kmm
[ircu2.10.12-pk.git] / ircd / ircd_lexer.l
1 /*
2  * ircd_parser.y: A yacc/bison parser for ircd config files.
3  * This is part of ircu, an Internet Relay Chat server.
4  * The contents of this file are Copyright(C) 2001 by Andrew Miller, the
5  * ircd-hybrid team and the ircu team.
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19  *  USA.
20  * $Id$
21  */
22
23 %{
24 extern int conf_fd, lineno;
25 #include <unistd.h>
26 #include "y.tab.h"
27 #undef YY_INPUT
28 /* Just stop the lexer at EOF or error. */
29 #define YY_INPUT(buf,result,max_size) \
30           if ((result = read(conf_fd, buf, max_size)) <= 0) \
31             result = 0;
32 %}
33 %option noyywrap
34 %option case-insensitive
35 %option nounput
36
37 WHITE [ \t\r]+
38 SHCOMMENT #[^\n]*
39 NUMBER [0-9]+
40 QSTRING \"[^"\n]+[\"\n]
41 %%
42
43 {QSTRING} {yytext[yyleng-1] = 0; yylval.text = yytext+1; return QSTRING;}
44 {NUMBER} {yylval.num = strtoul(yytext, NULL, 10); return NUMBER;}
45 {WHITE} ;
46 {SHCOMMENT} ;
47
48 admin return ADMIN;
49 administrator return ADMIN;
50 general return GENERAL;
51 location return LOCATION;
52 contact return CONTACT;
53 connect return CONNECT;
54 class return CLASS;
55 pingfreq return PINGFREQ;
56 connectfreq return CONNECTFREQ;
57 maxlinks return MAXLINKS;
58 sendq return SENDQ;
59 name return NAME;
60 host return HOST;
61 password return PASS;
62 pass return PASS;
63 seconds return SECONDS;
64 minutes return MINUTES;
65 hours return HOURS;
66 days return DAYS;
67 weeks return WEEKS;
68 months return MONTHS;
69 years return YEARS;
70 decades return DECADES;
71 bytes return BYTES;
72 b return BYTES;
73 kbytes return KBYTES;
74 kilobytes return KBYTES;
75 kb return KBYTES;
76 mbytes return MBYTES;
77 megabytes return MBYTES;
78 mb return MBYTES;
79 gbytes return GBYTES;
80 gigabytes return GBYTES;
81 gb return GBYTES;
82 tbytes return TBYTES;
83 terabytes return TBYTES;
84 tb return TBYTES;
85 port return PORT;
86 server return SERVER;
87 yes return YES;
88 no return NO;
89 hub return HUB;
90 leaf return LEAF;
91 uworld return UWORLD;
92 operator return OPER;
93 oper return OPER;
94 local return LOCAL;
95 vhost return VHOST;
96 mask return MASK;
97 hidden return HIDDEN;
98 motd return MOTD;
99 numeric return NUMERIC;
100 nick return NICK;
101 jupe return JUPE;
102 description return DESCRIPTION;
103 client return CLIENT;
104 real return REAL;
105 realname return REAL;
106 reason return REASON;
107 file return TFILE;
108 rule return RULE;
109 all return ALL;
110 ip return IP;
111 crule return CRULE;
112 kill return KILL;
113 features return FEATURES;
114 \n lineno++;
115 . return yytext[0];