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
20 /********************************************************************************
24 * Utility to convert an ASCII hexdump into a libpcap-format capture file
26 * (c) Copyright 2001 Ashok Narayanan <ashokn@cisco.com>
28 * Wireshark - Network traffic analyzer
29 * By Gerald Combs <gerald@wireshark.org>
30 * Copyright 1998 Gerald Combs
32 * This program is free software; you can redistribute it and/or
33 * modify it under the terms of the GNU General Public License
34 * as published by the Free Software Foundation; either version 2
35 * of the License, or (at your option) any later version.
37 * This program is distributed in the hope that it will be useful,
38 * but WITHOUT ANY WARRANTY; without even the implied warranty of
39 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40 * GNU General Public License for more details.
42 * You should have received a copy of the GNU General Public License
43 * along with this program; if not, write to the Free Software
44 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
46 *******************************************************************************/
51 #include "text2pcap.h"
54 * Flex (v 2.5.35) uses this symbol to "exclude" unistd.h
57 #define YY_NO_UNISTD_H
61 /* disable Windows VC compiler warning "signed/unsigned mismatch" associated */
62 /* with YY_INPUT code generated by flex versions such as 2.5.35. */
63 #pragma warning (disable:4018)
69 directive #TEXT2PCAP.*
71 byte [0-9A-Fa-f][0-9A-Fa-f][ \t]
72 byte_eol [0-9A-Fa-f][0-9A-Fa-f]\r?\n
73 offset [0-9A-Fa-f]+[: \t]
74 offset_eol [0-9A-Fa-f]+\r?\n
81 {byte} { parse_token(T_BYTE, yytext); }
82 {byte_eol} { parse_token(T_BYTE, yytext); parse_token(T_EOL, NULL); }
83 {offset} { parse_token(T_OFFSET, yytext); }
84 {offset_eol} { parse_token(T_OFFSET, yytext); parse_token(T_EOL, NULL); }
85 {mailfwd}{offset} { parse_token(T_OFFSET, yytext+1); }
86 {eol} { parse_token(T_EOL, NULL); }
87 [ \t] ; /* ignore whitespace */
88 {directive} { parse_token(T_DIRECTIVE, yytext); }
89 {comment} ; /* ignore comments */
90 {text} { parse_token(T_TEXT, yytext); }