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