2 * netsniff-ng - the packet sniffing beast
3 * By Daniel Borkmann <daniel@netsniff-ng.org>
4 * Copyright 2012 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
5 * Swiss federal institute of technology (ETH Zurich)
6 * Subject to the GPL, version 2.
16 #include "trafgen_parser.tab.h"
19 extern void yyerror(const char *);
40 number_dec {digit_n}|{digit_s}{digit}*
41 number_oct {digit_n}{digit}+
42 number_hex {digit_n}{hex_x}{hex}+
43 number_bin {digit_n}{bindigit_b}{bindigit}+
48 "fill" { return K_FILL; }
49 "rnd" { return K_RND; }
50 "drnd" { return K_DRND; }
51 "dinc" { return K_DINC; }
52 "ddec" { return K_DDEC; }
53 "seqinc" { return K_SEQINC; }
54 "seqdec" { return K_SEQDEC; }
63 "\n" { yylineno++; return K_NEWL; }
64 [ \t\r]+ { return K_WHITE; }
66 "/*"([^\*]|\*[^/])*"*/" { return K_COMMENT; }
68 {number_hex} { yylval.number = strtoul(yytext, NULL, 16);
71 {number_dec} { yylval.number = strtol(yytext, NULL, 10);
74 {number_oct} { yylval.number = strtol(yytext, NULL, 8);
77 {number_bin} { yylval.number = strtol(yytext + 2, NULL, 2);
80 {number_ascii} { yylval.number = (uint8_t) (*yytext);
81 return number_ascii; }
83 "'"."'" { yylval.number = (uint8_t) (*(yytext + 1));
84 return number_ascii; }
88 . { printf("Unknown character '%s'", yytext);
89 yyerror("lex Unknown character"); }