diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-07-11 19:56:07 +0000 | 
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-07-12 15:05:06 +0000 | 
| commit | 2a23ca6e5293281a3c7d4a2fdbc672151ea851ee (patch) | |
| tree | 03dc35634d9d0b2733ac06fcd316dac235e1eeaa /lib/command_lex.l | |
| parent | bbf5ffa08ddc13339f5dd762f14326f70a576c48 (diff) | |
lib: Change some includes
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_lex.l')
| -rw-r--r-- | lib/command_lex.l | 40 | 
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/command_lex.l b/lib/command_lex.l new file mode 100644 index 0000000000..45f8f8e636 --- /dev/null +++ b/lib/command_lex.l @@ -0,0 +1,40 @@ +%{ +#include "command_parse.h" + +extern void set_buffer_string(const char *); +%} + +WORD            [a-z][-_a-z0-9]+ +IPV4            A\.B\.C\.D +IPV4_PREFIX     A\.B\.C\.D\/M +IPV6            X:X::X:X +IPV6_PREFIX     X:X::X:X\/M +VARIABLE        [A-Z][A-Z_]+ +NUMBER          [0-9]{1,20} +RANGE           \({NUMBER}\-{NUMBER}\) + +/* yytext shall be a pointer */ +%pointer +%option noyywrap +%option nounput +%option noinput +%option outfile="command_lex.c" + +%% +[ /t]           /* ignore whitespace */; +{WORD}          {yylval.string = strdup(yytext); return WORD;} +{IPV4}          {yylval.string = strdup(yytext); return IPV4;} +{IPV4_PREFIX}   {yylval.string = strdup(yytext); return IPV4_PREFIX;} +{IPV6}          {yylval.string = strdup(yytext); return IPV6;} +{IPV6_PREFIX}   {yylval.string = strdup(yytext); return IPV6_PREFIX;} +{VARIABLE}      {yylval.string = strdup(yytext); return VARIABLE;} +{NUMBER}        {yylval.integer = atoi(yytext); return NUMBER;} +{RANGE}         {yylval.string = strdup(yytext); return RANGE;} +.               {return yytext[0];} +%% + +void +set_buffer_string(const char *string) +{ +  yy_scan_string(string); +}  | 
