Home | History | Annotate | Download | only in iptables
      1 %{
      2 /*
      3  * (C) 2012 by Pablo Neira Ayuso <pablo (at) netfilter.org>
      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
      7  * the Free Software Foundation; either version 2 of the License, or
      8  * (at your option) any later version.
      9  *
     10  * This software has been sponsored by Sophos Astaro <http://www.sophos.com>
     11  */
     12 
     13 #include <string.h>
     14 #include "xtables-config-parser.h"
     15 %}
     16 
     17 %option yylineno
     18 %option noinput
     19 %option nounput
     20 
     21 ws		[ \t]+
     22 comment         #.*$
     23 nl		[\n\r]
     24 
     25 is_on		[o|O][n|N]
     26 is_off		[o|O][f|F][f|F]
     27 integer		[\-\+]?[0-9]+
     28 string		[a-zA-Z][a-zA-Z0-9\.\-\_]*
     29 
     30 %%
     31 "family"		{ return T_FAMILY; }
     32 "table"			{ return T_TABLE; }
     33 "chain"			{ return T_CHAIN; }
     34 "hook"			{ return T_HOOK; }
     35 "prio"			{ return T_PRIO; }
     36 
     37 {integer}		{ yylval.val = atoi(yytext); return T_INTEGER; }
     38 {string}		{ yylval.string = strdup(yytext); return T_STRING; }
     39 
     40 {comment}	;
     41 {ws}		;
     42 {nl}		;
     43 
     44 <<EOF>>		{ yyterminate(); }
     45 
     46 .		{ return yytext[0]; }
     47 
     48 %%
     49 
     50 int
     51 yywrap()
     52 {
     53 	return 1;
     54 }
     55