Disable GTK+ by default.
[metze/wireshark/wip.git] / text2pcap-scanner.l
1 /* -*-mode: flex-*- */
2
3 /*
4  * We don't use input, so don't generate code for it.
5  */
6 %option noinput
7
8 /*
9  * We don't use unput, so don't generate code for it.
10  */
11 %option nounput
12
13 /*
14  * We don't read interactively from the terminal.
15  */
16 %option never-interactive
17
18 /*
19  * We want to stop processing when we get to the end of the input.
20  */
21 %option noyywrap
22
23 %{
24
25 /********************************************************************************
26  *
27  * text2pcap-scanner.l
28  *
29  * Utility to convert an ASCII hexdump into a libpcap-format capture file
30  *
31  * (c) Copyright 2001 Ashok Narayanan <ashokn@cisco.com>
32  *
33  * Wireshark - Network traffic analyzer
34  * By Gerald Combs <gerald@wireshark.org>
35  * Copyright 1998 Gerald Combs
36  *
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.
41  *
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.
46  *
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.
50  *
51  *******************************************************************************/
52
53 #include <stdio.h>
54 #include <stdlib.h>
55
56 #include "text2pcap.h"
57
58 /*
59  * Flex (v 2.5.35) uses this symbol to "exclude" unistd.h
60  */
61 #ifdef _WIN32
62 #define YY_NO_UNISTD_H
63 #endif
64
65 #ifdef _WIN32
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)
69 #endif
70
71 %}
72
73 hexdigit [0-9A-Fa-f]
74 directive ^#TEXT2PCAP.*\r?\n
75 comment ^[\t ]*#.*\r?\n
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
80 text [^ \n\t]+
81 mailfwd >
82 eol \r?\n\r?
83
84 %%
85
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); parse_token(T_EOL, NULL); }
94 {comment}         { parse_token(T_EOL, NULL); }
95 {text}            { parse_token(T_TEXT, yytext); }