4 * We don't use unput, so don't generate code for it.
6 %option nounput noinput
9 * We don't read from the terminal.
11 %option never-interactive
14 * Prefix scanner routines with "text_import" rather than "yy", so this scanner
15 * can coexist with other scanners.
17 %option prefix="text_import"
21 /********************************************************************************
23 * text_import_scanner.l
24 * Scanner for text import
25 * November 2010, Jaap Keuter <jaap.keuter@xs4all.nl>
29 * Wireshark - Network traffic analyzer
30 * By Gerald Combs <gerald@wireshark.org>
31 * Copyright 1998 Gerald Combs
33 * Based on text2pcap-scanner.l by Ashok Narayanan <ashokn@cisco.com>
35 * This program is free software; you can redistribute it and/or
36 * modify it under the terms of the GNU General Public License
37 * as published by the Free Software Foundation; either version 2
38 * of the License, or (at your option) any later version.
40 * This program is distributed in the hope that it will be useful,
41 * but WITHOUT ANY WARRANTY; without even the implied warranty of
42 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43 * GNU General Public License for more details.
45 * You should have received a copy of the GNU General Public License
46 * along with this program; if not, write to the Free Software
47 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
49 *******************************************************************************/
54 #include "text_import_scanner.h"
55 #include "text_import_scanner_lex.h"
58 * Flex (v 2.5.35) uses this symbol to "exclude" unistd.h
61 #define YY_NO_UNISTD_H
65 /* disable Windows VC compiler warning "signed/unsigned mismatch" associated */
66 /* with YY_INPUT code generated by flex versions such as 2.5.35. */
67 #pragma warning (disable:4018)
73 directive #TEXT2PCAP.*
75 byte [0-9A-Fa-f][0-9A-Fa-f][ \t]
76 byte_eol [0-9A-Fa-f][0-9A-Fa-f]\r?\n
77 offset [0-9A-Fa-f]+[: \t]
78 offset_eol [0-9A-Fa-f]+\r?\n
85 {byte} { parse_token(T_BYTE, yytext); }
86 {byte_eol} { parse_token(T_BYTE, yytext); parse_token(T_EOL, NULL); }
87 {offset} { parse_token(T_OFFSET, yytext); }
88 {offset_eol} { parse_token(T_OFFSET, yytext); parse_token(T_EOL, NULL); }
89 {mailfwd}{offset} { parse_token(T_OFFSET, yytext+1); }
90 {eol} { parse_token(T_EOL, NULL); }
91 [ \t] ; /* ignore whitespace */
92 {directive} { parse_token(T_DIRECTIVE, yytext); }
93 {comment} ; /* ignore comments */
94 {text} { parse_token(T_TEXT, yytext); }
96 <<EOF>> { write_current_packet(); yyterminate(); }