trafgen: fix CPU IRQ pinning range with --cpu arg
[netsniff-ng.git] / src / trafgen_lexer.l
blob2844f8d9e4cd33382b8e8f8403ba8985d315408d
1 /*
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.
7  */
9 /* lex-func-prefix: yy */
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <string.h>
16 #include <ctype.h>
18 #include "trafgen_parser.tab.h"
19 #include "xmalloc.h"
21 extern void yyerror(const char *);
25 %option align
26 %option nounput
27 %option noyywrap
28 %option noreject
29 %option 8bit
30 %option caseless
31 %option noinput
32 %option nodefault
34 number_oct      ([0][0-9]+)
35 number_hex      ([0][x][a-fA-F0-9]+)
36 number_bin      ([0][b][0-1]+)
37 number_dec      (([0])|([-+]?[1-9][0-9]*))
38 number_ascii    ([a-zA-Z])
42 "cpu"           { return K_CPU; }
43 "fill"          { return K_FILL; }
44 "rnd"           { return K_RND; }
45 "csumip"        { return K_CSUMIP; }
46 "csumip4"       { return K_CSUMIP; }
47 "csumudp"       { return K_CSUMUDP; }
48 "csumtcp"       { return K_CSUMTCP; }
49 "drnd"          { return K_DRND; }
50 "dinc"          { return K_DINC; }
51 "ddec"          { return K_DDEC; }
52 "seqinc"        { return K_SEQINC; }
53 "seqdec"        { return K_SEQDEC; }
55 "{"             { return '{'; }
56 "}"             { return '}'; }
57 "("             { return '('; }
58 ")"             { return ')'; }
59 "["             { return '['; }
60 "]"             { return ']'; }
61 ","             { return ','; }
62 ":"             { return ':'; }
63 "\n"            { yylineno++; }
64 ([ \t\r\n]+)?   { return K_WHITE; }
66 "/*"([^\*]|\*[^/])*"*/" { return K_COMMENT; }
67 "#"[^\n]*       { return K_COMMENT; }
69 {number_hex}    { yylval.number = strtoul(yytext, NULL, 16);
70                   return number; }
72 {number_dec}    { yylval.number = strtol(yytext, NULL, 10);
73                   return number; }
75 {number_oct}    { yylval.number = strtol(yytext + 1, NULL, 8);
76                   return number; }
78 {number_bin}    { yylval.number = strtol(yytext + 2, NULL, 2);
79                   return number; }
81 {number_ascii}  { yylval.number = (uint8_t) (*yytext);
82                   return number; }
84 "'"."'"         { yylval.number = (uint8_t) (*(yytext + 1));
85                   return number; }
87 ";"[^\n]*       {/* NOP */}
88 .               { printf("Unknown character '%s'", yytext);
89                   yyerror("lex Unknown character"); }