/*
- * ircd_parser.y: A yacc/bison parser for ircd config files.
+ * ircd_lexer.l: A lexical scanner for ircd config files.
* This is part of ircu, an Internet Relay Chat server.
* The contents of this file are Copyright(C) 2001 by Andrew Miller, the
* ircd-hybrid team and the ircu team.
*/
%{
-extern int conf_fd, lineno;
#include <unistd.h>
+#include <stdio.h>
+#include "ircd.h"
#include "y.tab.h"
-#undef YY_INPUT
-/* Just stop the lexer at EOF or error. */
-#define YY_INPUT(buf,result,max_size) \
- if ((result = read(conf_fd, buf, max_size)) <= 0) \
- result = 0;
+
+extern int lineno;
+
+void
+init_lexer(void)
+{
+ yyin = fopen(configfile, "r");
+ if (yyin == NULL)
+ {
+#ifdef YY_FATAL_ERROR
+ YY_FATAL_ERROR("Could not open the configuration file.");
+#else
+ fprintf(stderr, "Could not open the configuration file.");
+#endif
+ }
+#ifdef YY_NEW_FILE
+ YY_NEW_FILE;
+#endif
+ lineno = 1;
+}
%}
-%option noyywrap
-%option case-insensitive
-%option nounput
+
+%e 1500
+%p 3000
+%n 1000
WHITE [ \t\r]+
SHCOMMENT #[^\n]*
ip return IP;
crule return CRULE;
kill return KILL;
+quarantine return QUARANTINE;
+iauth return IAUTH;
+timeout return TIMEOUT;
features return FEATURES;
+channel return CHANNEL;
+chan_limit return TPRIV_CHAN_LIMIT;
+mode_lchan return TPRIV_MODE_LCHAN;
+deop_lchan return TPRIV_DEOP_LCHAN;
+walk_lchan return TPRIV_WALK_LCHAN;
+local_kill return TPRIV_LOCAL_KILL;
+rehash return TPRIV_REHASH;
+restart return TPRIV_RESTART;
+die return TPRIV_DIE;
+gline return TPRIV_GLINE;
+local_gline return TPRIV_LOCAL_GLINE;
+local_jupe return TPRIV_LOCAL_JUPE;
+opmode return TPRIV_OPMODE;
+set return TPRIV_SET;
+whox return TPRIV_WHOX;
+badchan return TPRIV_BADCHAN;
+local_badchan return TPRIV_LOCAL_BADCHAN;
+see_chan return TPRIV_SEE_CHAN;
+show_invis return TPRIV_SHOW_INVIS;
+show_all_invis return TPRIV_SHOW_ALL_INVIS;
+propagate return TPRIV_PROPAGATE;
+unlimit_query return TPRIV_UNLIMIT_QUERY;
+display return TPRIV_DISPLAY;
+see_opers return TPRIV_SEE_OPERS;
+wide_gline return TPRIV_WIDE_GLINE;
+force_opmode return TPRIV_FORCE_OPMODE;
+force_local_opmode return TPRIV_FORCE_LOCAL_OPMODE;
+pseudo return PSEUDO;
+prepend return PREPEND;
+usermode return USERMODE;
\n lineno++;
. return yytext[0];