packet-dcerpc: improve dissection of bind time feature negotiation
[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
15 /********************************************************************************
16  *
17  * text2pcap-scanner.l
18  *
19  * Utility to convert an ASCII hexdump into a libpcap-format capture file
20  *
21  * (c) Copyright 2001 Ashok Narayanan <ashokn@cisco.com>
22  *
23  * Wireshark - Network traffic analyzer
24  * By Gerald Combs <gerald@wireshark.org>
25  * Copyright 1998 Gerald Combs
26  *
27  * This program is free software; you can redistribute it and/or
28  * modify it under the terms of the GNU General Public License
29  * as published by the Free Software Foundation; either version 2
30  * of the License, or (at your option) any later version.
31  *
32  * This program is distributed in the hope that it will be useful,
33  * but WITHOUT ANY WARRANTY; without even the implied warranty of
34  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
35  * GNU General Public License for more details.
36  *
37  * You should have received a copy of the GNU General Public License
38  * along with this program; if not, write to the Free Software
39  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
40  *
41  *******************************************************************************/
42
43 #include <stdio.h>
44 #include <stdlib.h>
45
46 #ifdef _WIN32
47 #include <io.h>  /* for isatty() */
48 #endif
49
50 #include "text2pcap.h"
51
52 /*
53  * Flex (v 2.5.35) uses this symbol to "exclude" unistd.h
54  */
55 #ifdef _WIN32
56 #define YY_NO_UNISTD_H
57 #endif
58
59 #ifdef _WIN32
60 /* disable Windows VC compiler warning "signed/unsigned mismatch" associated  */
61 /* with YY_INPUT code generated by flex versions such as 2.5.35.              */
62 #pragma warning (disable:4018)
63 #endif
64
65 %}
66
67 hexdigit [0-9A-Fa-f]
68 directive #TEXT2PCAP.*
69 comment #[^W].*
70 byte [0-9A-Fa-f][0-9A-Fa-f][ \t]
71 byte_eol [0-9A-Fa-f][0-9A-Fa-f]\r?\n
72 offset [0-9A-Fa-f]+[: \t]
73 offset_eol [0-9A-Fa-f]+\r?\n
74 text [^ \n\t]+
75 mailfwd >
76 eol \r?\n\r?
77
78 %%
79
80 {byte}            { parse_token(T_BYTE, yytext); }
81 {byte_eol}        { parse_token(T_BYTE, yytext); parse_token(T_EOL, NULL); }
82 {offset}          { parse_token(T_OFFSET, yytext); }
83 {offset_eol}      { parse_token(T_OFFSET, yytext); parse_token(T_EOL, NULL); }
84 {mailfwd}{offset} { parse_token(T_OFFSET, yytext+1); }
85 {eol}             { parse_token(T_EOL, NULL); }
86 [ \t]             ; /* ignore whitespace */
87 {directive}       { parse_token(T_DIRECTIVE, yytext); }
88 {comment}         ; /* ignore comments */
89 {text}            { parse_token(T_TEXT, yytext); }
90
91 %%
92
93 int yywrap(void)
94 {
95     return 1;
96 }