summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2007-07-30 20:22:37 +0000
committerGuy Harris <guy@alum.mit.edu>2007-07-30 20:22:37 +0000
commit968d363f113c73885a4c6c67019b0b8a93bf2524 (patch)
tree9cbfb86dfe1b0a83c37e8528dc019ef3885e0733
parent0d437580eed2149e0d313aa00a64c11a4df37633 (diff)
downloadwireshark-968d363f113c73885a4c6c67019b0b8a93bf2524.tar.gz
Add comments to various %option items to explain what they're doing.
Move the %options to the beginning if they weren't already there, and put them in the same order in all files. Add "prefix=" options to .l files that don't already have them, so we don't have to pass a "-P" option. Add "never-interactive" and "noyywrap" options to our lexical analyzers, to remove extra isatty() checks and to eliminate the need for yywrap() from the Flex library. Get rid of %option nostdinit - that's the default. Add .l.c: rules to Makefile.am files, replacing the rules for specific .l files. Have those rules all check that $(LEX) is set. Update the address for the FSF. svn path=/trunk/; revision=22424
-rw-r--r--epan/Makefile.am20
-rw-r--r--epan/dfilter/Makefile.am4
-rw-r--r--epan/dfilter/scanner.l29
-rw-r--r--epan/diam_dict.l32
-rw-r--r--epan/dtd_parse.l23
-rw-r--r--epan/dtd_preparse.l25
-rw-r--r--epan/radius_dict.l24
-rw-r--r--epan/uat_load.l22
-rw-r--r--plugins/mate/Makefile.am8
-rw-r--r--plugins/mate/mate_parser.l18
-rw-r--r--text2pcap-scanner.l15
-rw-r--r--wiretap/Makefile.am7
-rw-r--r--wiretap/ascend-scanner.l21
-rw-r--r--wiretap/k12text.l22
14 files changed, 209 insertions, 61 deletions
diff --git a/epan/Makefile.am b/epan/Makefile.am
index 8522d07b34..1b8b29c613 100644
--- a/epan/Makefile.am
+++ b/epan/Makefile.am
@@ -125,20 +125,12 @@ tvbtest: tvbtest.o tvbuff.o except.o strutil.o emem.o
exntest: exntest.o except.o
$(LINK) $^ $(GLIB_LIBS)
-radius_dict.c: radius_dict.l
- $(LEX) $^
-
-uat_load.c: uat_load.l
- $(LEX) -ouat_load.c $(srcdir)/uat_load.l
-
-diam_dict.c: diam_dict.l
- $(LEX) -odiam_dict.c $(srcdir)/diam_dict.l
-
-dtd_parse.c : dtd_parse.l
- $(LEX) -odtd_parse.c $(srcdir)/dtd_parse.l
-
-dtd_preparse.c : dtd_preparse.l
- $(LEX) -odtd_preparse.c $(srcdir)/dtd_preparse.l
+.l.c:
+ @if [ ! -x "$(LEX)" ]; then \
+ echo "Neither lex nor flex was found"; \
+ exit 1; \
+ fi
+ $(LEX) -o$@ $<
dtd_grammar.h: dtd_grammar.c
diff --git a/epan/dfilter/Makefile.am b/epan/dfilter/Makefile.am
index 23fdcb804d..7cbec8f763 100644
--- a/epan/dfilter/Makefile.am
+++ b/epan/dfilter/Makefile.am
@@ -93,12 +93,12 @@ EXTRA_DIST = \
scanner.l \
Makefile.nmake
-scanner.c : scanner.l
+.l.c:
@if [ ! -x "$(LEX)" ]; then \
echo "Neither lex nor flex was found"; \
exit 1; \
fi
- $(LEX) -Pdf_ -oscanner.c $(srcdir)/scanner.l
+ $(LEX) -o$@ $<
scanner.o : scanner.c grammar.h
diff --git a/epan/dfilter/scanner.l b/epan/dfilter/scanner.l
index 7f67cb73c3..9dec41e808 100644
--- a/epan/dfilter/scanner.l
+++ b/epan/dfilter/scanner.l
@@ -1,3 +1,24 @@
+/*
+ * We want to stop processing when we get to the end of the input.
+ */
+%option noyywrap
+
+/*
+ * We don't use unput, so don't generate code for it.
+ */
+%option nounput
+
+/*
+ * We don't read from the terminal.
+ */
+%option never-interactive
+
+/*
+ * Prefix scanner routines with "df_" rather than "yy", so this scanner
+ * can coexist with other scanners.
+ */
+%option prefix="df_"
+
%{
/*
* $Id$
@@ -18,7 +39,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -68,12 +89,6 @@ GString* quoted_string = NULL;
%x RANGE_PUNCT
%x DQUOTE
-/* we don't use unput, so don't generate code for it.
- * This is flex-only, but current thinking is that our lexers don't work
- * with non-flex anyway...
- */
-%option nounput
-
%%
[[:blank:]\n]+ /* ignore whitespace */
diff --git a/epan/diam_dict.l b/epan/diam_dict.l
index 8ed7385172..e360672fa9 100644
--- a/epan/diam_dict.l
+++ b/epan/diam_dict.l
@@ -1,10 +1,34 @@
+/*
+ * We want to stop processing when we get to the end of the input.
+ */
%option noyywrap
+
+/*
+ * We don't use unput, so don't generate code for it.
+ */
%option nounput
+
+/*
+ * We don't read from the terminal.
+ */
%option never-interactive
-%option prefix="DiamDict"
+
+/*
+ * The language we're scanning is case-insensitive.
+ */
%option caseless
+
+/*
+ * We use start condition stacks.
+ */
%option stack
+/*
+ * Prefix scanner routines with "DiamDict" rather than "yy", so this scanner
+ * can coexist with other scanners.
+ */
+%option prefix="DiamDict"
+
%option outfile="diam_dict.c"
%{
@@ -27,9 +51,9 @@
** Library General Public License for more details.
**
** You should have received a copy of the GNU Library General Public
- ** License along with this library; if not, write to the
- ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- ** Boston, MA 02111-1307, USA.
+ ** License along with this library; if not, write to the Free Software
+ ** Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ ** Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
diff --git a/epan/dtd_parse.l b/epan/dtd_parse.l
index d57ae355f2..99537f6773 100644
--- a/epan/dtd_parse.l
+++ b/epan/dtd_parse.l
@@ -1,9 +1,26 @@
+/*
+ * We want to stop processing when we get to the end of the input.
+ */
%option noyywrap
+
+/*
+ * We don't use unput, so don't generate code for it.
+ */
%option nounput
-%option outfile="dtd_parse.c"
-%option prefix="Dtd_Parse_"
+
+/*
+ * We don't read from the terminal.
+ */
%option never-interactive
+/*
+ * Prefix scanner routines with "Dtd_Parse_" rather than "yy", so this scanner
+ * can coexist with other scanners.
+ */
+%option prefix="Dtd_Parse_"
+
+%option outfile="dtd_parse.c"
+
%{
/* dtd_parse.l
@@ -30,7 +47,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <glib.h>
diff --git a/epan/dtd_preparse.l b/epan/dtd_preparse.l
index e952ac4f15..9e558551a1 100644
--- a/epan/dtd_preparse.l
+++ b/epan/dtd_preparse.l
@@ -1,8 +1,29 @@
+/*
+ * We want to stop processing when we get to the end of the input.
+ */
%option noyywrap
+
+/*
+ * We don't use unput, so don't generate code for it.
+ */
%option nounput
-%option prefix="Dtd_PreParse_"
+
+/*
+ * We don't read from the terminal.
+ */
%option never-interactive
+
+/*
+ * The language we're scanning is case-insensitive.
+ */
%option caseless
+
+/*
+ * Prefix scanner routines with "Dtd_PreParse_" rather than "yy", so this
+ * scanner can coexist with other scanners.
+ */
+%option prefix="Dtd_PreParse_"
+
%option outfile="dtd_preparse.c"
%{
@@ -35,7 +56,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <glib.h>
diff --git a/epan/radius_dict.l b/epan/radius_dict.l
index aa46792210..fe68cf867c 100644
--- a/epan/radius_dict.l
+++ b/epan/radius_dict.l
@@ -1,10 +1,29 @@
+/*
+ * We want to stop processing when we get to the end of the input.
+ */
%option noyywrap
+/*
+ * We don't use unput, so don't generate code for it.
+ */
%option nounput
+
+/*
+ * We don't read from the terminal.
+ */
%option never-interactive
-%option prefix="Radius"
+
+/*
+ * The language we're scanning is case-insensitive.
+ */
%option caseless
+/*
+ * Prefix scanner routines with "Radius" rather than "yy", so this scanner
+ * can coexist with other scanners.
+ */
+%option prefix="Radius"
+
%option outfile="radius_dict.c"
%{
@@ -30,8 +49,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
diff --git a/epan/uat_load.l b/epan/uat_load.l
index 664ea2c942..e82220e70f 100644
--- a/epan/uat_load.l
+++ b/epan/uat_load.l
@@ -1,8 +1,24 @@
+/*
+ * We want to stop processing when we get to the end of the input.
+ */
%option noyywrap
-%option prefix="uat_load_"
-%option never-interactive
+
+/*
+ * We don't use unput, so don't generate code for it.
+ */
%option nounput
+/*
+ * We don't read from the terminal.
+ */
+%option never-interactive
+
+/*
+ * Prefix scanner routines with "uat_load_" rather than "yy", so this scanner
+ * can coexist with other scanners.
+ */
+%option prefix="uat_load_"
+
%{
/*
* uat_load.l
@@ -31,7 +47,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
diff --git a/plugins/mate/Makefile.am b/plugins/mate/Makefile.am
index ac5037b5dd..fb8f258bb8 100644
--- a/plugins/mate/Makefile.am
+++ b/plugins/mate/Makefile.am
@@ -130,8 +130,12 @@ EXTRA_DIST = \
moduleinfo.nmake \
plugin.rc.in
-mate_parser.c : mate_parser.l
- $(LEX) -Pdf_ -omate_parser.c $(srcdir)/mate_parser.l
+.l.c:
+ @if [ ! -x "$(LEX)" ]; then \
+ echo "Neither lex nor flex was found"; \
+ exit 1; \
+ fi
+ $(LEX) -o$@ $<
LEMON = ../../tools/lemon
diff --git a/plugins/mate/mate_parser.l b/plugins/mate/mate_parser.l
index aa4fdf3cf9..8d1089edee 100644
--- a/plugins/mate/mate_parser.l
+++ b/plugins/mate/mate_parser.l
@@ -1,6 +1,22 @@
+/*
+ * We want to stop processing when we get to the end of the input.
+ */
%option noyywrap
+
+/*
+ * We don't use unput, so don't generate code for it.
+ */
%option nounput
+
+/*
+ * We don't read from the terminal.
+ */
%option never-interactive
+
+/*
+ * Prefix scanner routines with "Mate" rather than "yy", so this scanner
+ * can coexist with other scanners.
+ */
%option prefix="Mate"
%{
@@ -28,7 +44,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "mate.h"
diff --git a/text2pcap-scanner.l b/text2pcap-scanner.l
index 725926df82..6b0b716f45 100644
--- a/text2pcap-scanner.l
+++ b/text2pcap-scanner.l
@@ -1,5 +1,10 @@
/* -*-mode: flex-*- */
+/*
+ * We don't use unput, so don't generate code for it.
+ */
+%option nounput
+
%{
/********************************************************************************
@@ -16,8 +21,6 @@
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
- *
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -30,7 +33,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*******************************************************************************/
@@ -52,12 +55,6 @@ text [^ \n\t]+
mailfwd >
eol \r?\n\r?
-/* we don't use unput, so don't generate code for it.
- * This is flex-only, but current thinking is that our lexers don't work
- * with non-flex anyway...
- */
-%option nounput
-
%%
{byte} { parse_token(T_BYTE, yytext); }
diff --git a/wiretap/Makefile.am b/wiretap/Makefile.am
index 078486cbd4..4aeb98cacc 100644
--- a/wiretap/Makefile.am
+++ b/wiretap/Makefile.am
@@ -79,12 +79,9 @@ ascend-grammar.c : ascend-grammar.y
fi
$(YACC) -d -p ascend -o ascend-grammar.c $(srcdir)/ascend-grammar.y
-ascend-scanner.c : ascend-scanner.l
+.l.c:
@if [ ! -x "$(LEX)" ]; then \
echo "Neither lex nor flex was found"; \
exit 1; \
fi
- $(LEX) -Pascend -oascend-scanner.c $(srcdir)/ascend-scanner.l
-
-k12text.c : k12text.l
- $(LEX) -ok12text.c $(srcdir)/k12text.l
+ $(LEX) -o$@ $<
diff --git a/wiretap/ascend-scanner.l b/wiretap/ascend-scanner.l
index 762e868e55..a586078c63 100644
--- a/wiretap/ascend-scanner.l
+++ b/wiretap/ascend-scanner.l
@@ -1,3 +1,19 @@
+/*
+ * We want to stop processing when we get to the end of the input.
+ */
+%option noyywrap
+
+/*
+ * We don't read from the terminal.
+ */
+%option never-interactive
+
+/*
+ * Prefix scanner routines with "ascend" rather than "yy", so this scanner
+ * can coexist with other scanners.
+ */
+%option prefix="ascend"
+
%{
/* ascend-scanner.l
*
@@ -18,7 +34,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -59,9 +75,6 @@ int mul, scratch;
%}
-%option nostdinit
-%option noyywrap
-
D [0-9]
H [A-Fa-f0-9]
diff --git a/wiretap/k12text.l b/wiretap/k12text.l
index 5c5ec54864..6494c5fee9 100644
--- a/wiretap/k12text.l
+++ b/wiretap/k12text.l
@@ -1,8 +1,26 @@
+/*
+ * We want to stop processing when we get to the end of the input.
+ */
%option noyywrap
+
+/*
+ * We don't use unput, so don't generate code for it.
+ */
%option nounput
-%option outfile="k12text.c"
-%option prefix="K12Text_"
+
+/*
+ * We don't read from the terminal.
+ */
%option never-interactive
+
+/*
+ * Prefix scanner routines with "K12Text_" rather than "yy", so this scanner
+ * can coexist with other scanners.
+ */
+%option prefix="K12Text_"
+
+%option outfile="k12text.c"
+
%{
/* k12text.l
*