ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/hopm/trunk/src/config-lexer.l
(Generate patch)

Comparing hopm/trunk/src/config-lexer.l (file contents):
Revision 7729 by michael, Mon Sep 26 15:53:23 2016 UTC vs.
Revision 8564 by michael, Wed Sep 26 19:23:54 2018 UTC

# Line 1 | Line 1
1   /*
2   *  Copyright (c) 2002 Erik Fears
3 < *  Copyright (c) 2014-2016 ircd-hybrid development team
3 > *  Copyright (c) 2014-2018 ircd-hybrid development team
4   *
5   *  This program is free software; you can redistribute it and/or modify
6   *  it under the terms of the GNU General Public License as published by
# Line 20 | Line 20
20  
21   %option case-insensitive
22   %option noyywrap
23 + %option noinput
24   %option nounput
25   %option never-interactive
26  
27 + %x IN_COMMENT
28 +
29   %{
30   #include <stdio.h>
31   #include <string.h>
# Line 32 | Line 35
35   #include "config-parser.h"  /* autogenerated header file */
36   #include "log.h"
37  
38 + /* libopm includes */
39 + #include "libopm/src/opm_types.h"
40 +
41   #undef YY_FATAL_ERROR
42   #define YY_FATAL_ERROR(msg) conf_yy_fatal_error(msg)
43  
# Line 57 | Line 63 | static struct included_file
63   static unsigned int include_stack_ptr;
64  
65  
60 static void ccomment(void);
66   static void conf_include(void);
67   static int conf_eof(void);
68  
# Line 81 | Line 86 | qstring   \"[^\"\n]*[\"\n]
86   include   \.include{WS}(\<.*\>|\".*\")
87  
88   %%
89 +
90 + "/*"                { BEGIN IN_COMMENT; }
91 + <IN_COMMENT>"*/"    { BEGIN INITIAL;    }
92 + <IN_COMMENT>.       ;  /* Eat everything but a newline */
93 + <IN_COMMENT>\n      { ++lineno; }
94 + <IN_COMMENT><<EOF>> { BEGIN INITIAL; if (conf_eof()) yyterminate(); }
95 +
96   {include}       { conf_include(); }
85 "/*"            { ccomment(); }
97   \n.*            { strlcpy(linebuf, yytext + 1, sizeof(linebuf)); ++lineno; yyless(1); }
98   {WS}            ;
99   {COMMENT}       ;
# Line 128 | Line 139 | include   \.include{WS}(\<.*\>|\".*\")
139                    }
140                  }
141  
142 + ADDRESS_FAMILY          { return ADDRESS_FAMILY; }
143   AWAY                    { return AWAY;         }
144   BAN_UNKNOWN             { return BAN_UNKNOWN;  }
145   BLACKLIST               { return BLACKLIST;    }
# Line 143 | Line 155 | DNSBL_TO                { return DNSBL_T
155   EXEMPT                  { return EXEMPT;       }
156   FD                      { return FD;           }
157   INVITE                  { return INVITE;       }
158 + IPV4                    { return IPV4;         }
159 + IPV6                    { return IPV6;         }
160   IRC                     { return IRC;          }
161   KLINE                   { return KLINE;        }
162   KEY                     { return KEY;          }
# Line 254 | Line 268 | DREAMBOX                {
268                          }
269  
270  
271 + SSH                     {
272 +                          yylval.number = OPM_TYPE_SSH;
273 +                          return PROTOCOLTYPE;
274 +                        }
275 +
276   TRUE                     {
277                             yylval.number=1;
278                             return NUMBER;
# Line 289 | Line 308 | OFF                      {
308  
309   %%
310  
292
293 /* C-comment ignoring routine -kre*/
294 static void
295 ccomment(void)
296 {
297  int c = 0;
298
299  /* log(L_NOTICE, "got comment"); */
300  while (1)
301  {
302    while ((c = input()) != '*' && c != EOF)
303      if (c == '\n')
304        ++lineno;
305
306    if (c == '*')
307    {
308      while ((c = input()) == '*')
309        /* Nothing */ ;
310      if (c == '/')
311        break;
312      else if (c == '\n')
313        ++lineno;
314    }
315
316    if (c == EOF)
317    {
318      YY_FATAL_ERROR("EOF in comment");
319
320      /* XXX hack alert this disables
321       * the stupid unused function warning
322       * gcc generates
323       */
324      if (1 == 0)
325        yy_fatal_error("EOF in comment");
326      break;
327    }
328  }
329 }
330
311   static void
312   conf_include(void)
313   {
# Line 367 | Line 347 | conf_include(void)
347  
348    lineno = 1;
349    conf_file = tmp_fbfile_in;
350 +  strlcpy(conffilebuf, filenamebuf, sizeof(conffilebuf));
351  
371  snprintf(conffilebuf, sizeof(conffilebuf), "%s", filenamebuf);
352    yy_switch_to_buffer(yy_create_buffer(NULL, YY_BUF_SIZE));
353   }
354  
# Line 376 | Line 356 | static int
356   conf_eof(void)
357   {
358    if (include_stack_ptr == 0)
379  {
380    lineno = 1;
359      return 1;
382  }
360  
361    /* switch buffer */
362    struct included_file *file = &include_stack[--include_stack_ptr];

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)