Remove executable bit, from not executable files.
[metze/wireshark/wip.git] / text2pcap-scanner.l
1 /* -*-mode: flex-*- */
2
3 %top {
4 /* Include this before everything else, for various large-file definitions */
5 #include "config.h"
6 }
7
8 /*
9  * We don't use input, so don't generate code for it.
10  */
11 %option noinput
12
13 /*
14  * We don't use unput, so don't generate code for it.
15  */
16 %option nounput
17
18 /*
19  * We don't read interactively from the terminal.
20  */
21 %option never-interactive
22
23 /*
24  * We want to stop processing when we get to the end of the input.
25  */
26 %option noyywrap
27
28 %{
29
30 /********************************************************************************
31  *
32  * text2pcap-scanner.l
33  *
34  * Utility to convert an ASCII hexdump into a libpcap-format capture file
35  *
36  * (c) Copyright 2001 Ashok Narayanan <ashokn@cisco.com>
37  *
38  * Wireshark - Network traffic analyzer
39  * By Gerald Combs <gerald@wireshark.org>
40  * Copyright 1998 Gerald Combs
41  *
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.
46  *
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.
51  *
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.
55  *
56  *******************************************************************************/
57
58 #include <stdio.h>
59 #include <stdlib.h>
60
61 #include "text2pcap.h"
62
63 /*
64  * Flex (v 2.5.35) uses this symbol to "exclude" unistd.h
65  */
66 #ifdef _WIN32
67 #define YY_NO_UNISTD_H
68 #endif
69
70 #ifdef _WIN32
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)
74 #endif
75
76 %}
77
78 hexdigit [0-9A-Fa-f]
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
85 text [^ \n\t]+
86 mailfwd >
87 eol \r?\n\r?
88
89 %%
90
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); }