4 * We don't use input, so don't generate code for it.
9 * We don't use unput, so don't generate code for it.
14 * We don't read interactively from the terminal.
16 %option never-interactive
19 * We want to stop processing when we get to the end of the input.
25 /********************************************************************************
29 * Utility to convert an ASCII hexdump into a libpcap-format capture file
31 * (c) Copyright 2001 Ashok Narayanan <ashokn@cisco.com>
33 * Wireshark - Network traffic analyzer
34 * By Gerald Combs <gerald@wireshark.org>
35 * Copyright 1998 Gerald Combs
37 * This program is free software; you can redistribute it and/or
38 * modify it under the terms of the GNU General Public License
39 * as published by the Free Software Foundation; either version 2
40 * of the License, or (at your option) any later version.
42 * This program is distributed in the hope that it will be useful,
43 * but WITHOUT ANY WARRANTY; without even the implied warranty of
44 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 * GNU General Public License for more details.
47 * You should have received a copy of the GNU General Public License
48 * along with this program; if not, write to the Free Software
49 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
51 *******************************************************************************/
56 #include "text2pcap.h"
59 * Flex (v 2.5.35) uses this symbol to "exclude" unistd.h
62 #define YY_NO_UNISTD_H
66 /* disable Windows VC compiler warning "signed/unsigned mismatch" associated */
67 /* with YY_INPUT code generated by flex versions such as 2.5.35. */
68 #pragma warning (disable:4018)
74 directive #TEXT2PCAP.*
76 byte [0-9A-Fa-f][0-9A-Fa-f][ \t]
77 byte_eol [0-9A-Fa-f][0-9A-Fa-f]\r?\n
78 offset [0-9A-Fa-f]+[: \t]
79 offset_eol [0-9A-Fa-f]+\r?\n
86 {byte} { parse_token(T_BYTE, yytext); }
87 {byte_eol} { parse_token(T_BYTE, yytext); parse_token(T_EOL, NULL); }
88 {offset} { parse_token(T_OFFSET, yytext); }
89 {offset_eol} { parse_token(T_OFFSET, yytext); parse_token(T_EOL, NULL); }
90 {mailfwd}{offset} { parse_token(T_OFFSET, yytext+1); }
91 {eol} { parse_token(T_EOL, NULL); }
92 [ \t] ; /* ignore whitespace */
93 {directive} { parse_token(T_DIRECTIVE, yytext); }
94 {comment} ; /* ignore comments */
95 {text} { parse_token(T_TEXT, yytext); }