7abff8f26a0aa66d27a30fff5a85372c4a9eea32
[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 #include <unistd.h>
25 #include <stdio.h>
26 #include "ircd.h"
27 #include "y.tab.h"
28
29 extern int lineno;
30
31 void
32 init_lexer(void)
33 {
34   yyin = fopen(configfile, "r");
35   if (yyin == NULL)
36     yy_fatal_error("Could not open the configuration file.");
37   YY_NEW_FILE;
38   lineno = 1;
39 }
40
41 %}
42 %option noyywrap
43 %option case-insensitive
44 %option nounput
45
46
47 WHITE [ \t\r]+
48 SHCOMMENT #[^\n]*
49 NUMBER [0-9]+
50 QSTRING \"[^"\n]+[\"\n]
51 %%
52
53 {QSTRING} {yytext[yyleng-1] = 0; yylval.text = yytext+1; return QSTRING;}
54 {NUMBER} {yylval.num = strtoul(yytext, NULL, 10); return NUMBER;}
55 {WHITE} ;
56 {SHCOMMENT} ;
57
58 admin return ADMIN;
59 administrator return ADMIN;
60 general return GENERAL;
61 location return LOCATION;
62 contact return CONTACT;
63 connect return CONNECT;
64 class return CLASS;
65 pingfreq return PINGFREQ;
66 connectfreq return CONNECTFREQ;
67 maxlinks return MAXLINKS;
68 sendq return SENDQ;
69 name return NAME;
70 host return HOST;
71 password return PASS;
72 pass return PASS;
73 seconds return SECONDS;
74 minutes return MINUTES;
75 hours return HOURS;
76 days return DAYS;
77 weeks return WEEKS;
78 months return MONTHS;
79 years return YEARS;
80 decades return DECADES;
81 bytes return BYTES;
82 b return BYTES;
83 kbytes return KBYTES;
84 kilobytes return KBYTES;
85 kb return KBYTES;
86 mbytes return MBYTES;
87 megabytes return MBYTES;
88 mb return MBYTES;
89 gbytes return GBYTES;
90 gigabytes return GBYTES;
91 gb return GBYTES;
92 tbytes return TBYTES;
93 terabytes return TBYTES;
94 tb return TBYTES;
95 port return PORT;
96 server return SERVER;
97 yes return YES;
98 no return NO;
99 hub return HUB;
100 leaf return LEAF;
101 uworld return UWORLD;
102 operator return OPER;
103 oper return OPER;
104 local return LOCAL;
105 vhost return VHOST;
106 mask return MASK;
107 hidden return HIDDEN;
108 motd return MOTD;
109 numeric return NUMERIC;
110 nick return NICK;
111 jupe return JUPE;
112 description return DESCRIPTION;
113 client return CLIENT;
114 real return REAL;
115 realname return REAL;
116 reason return REASON;
117 file return TFILE;
118 rule return RULE;
119 all return ALL;
120 ip return IP;
121 crule return CRULE;
122 kill return KILL;
123 quarantine return QUARANTINE;
124 iauth return IAUTH;
125 timeout return TIMEOUT;
126 features return FEATURES;
127 channel return CHANNEL;
128 chan_limit return TPRIV_CHAN_LIMIT;
129 mode_lchan return TPRIV_MODE_LCHAN;
130 deop_lchan return TPRIV_DEOP_LCHAN;
131 walk_lchan return TPRIV_WALK_LCHAN;
132 local_kill return TPRIV_LOCAL_KILL;
133 rehash return TPRIV_REHASH;
134 restart return TPRIV_RESTART;
135 die return TPRIV_DIE;
136 gline return TPRIV_GLINE;
137 local_gline return TPRIV_LOCAL_GLINE;
138 local_jupe return TPRIV_LOCAL_JUPE;
139 opmode return TPRIV_OPMODE;
140 set return TPRIV_SET;
141 whox return TPRIV_WHOX;
142 badchan return TPRIV_BADCHAN;
143 local_badchan return TPRIV_LOCAL_BADCHAN;
144 see_chan return TPRIV_SEE_CHAN;
145 show_invis return TPRIV_SHOW_INVIS;
146 show_all_invis return TPRIV_SHOW_ALL_INVIS;
147 propagate return TPRIV_PROPAGATE;
148 unlimit_query return TPRIV_UNLIMIT_QUERY;
149 display return TPRIV_DISPLAY;
150 see_opers return TPRIV_SEE_OPERS;
151 wide_gline return TPRIV_WIDE_GLINE;
152 force_opmode return TPRIV_FORCE_OPMODE;
153 force_local_opmode return TPRIV_FORCE_LOCAL_OPMODE;
154 pseudo return PSEUDO;
155 prepend return PREPEND;
156 usermode return USERMODE;
157 \n lineno++;
158 . return yytext[0];