summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@debian.org>2016-01-22 13:51:30 -0800
committerManoj Srivastava <srivasta@debian.org>2016-01-22 13:51:30 -0800
commitf753f2b7b6d97014110dbe418861353a2f3f445d (patch)
tree7f248ce2f59fbb79cab24b4727955e37e9a5ab81 /src
parent306163051847aaaabe7ae0f4cfc7d23f15923f3a (diff)
parenta646b6cd438dc4bd957c6c6afd89b5e8e59468fe (diff)
Merge branch 'upstream'
Signed-off-by: Manoj Srivastava <srivasta@debian.org> # Conflicts: # INSTALL # Makefile.in # aclocal.m4 # build-aux/compile # build-aux/config.guess # build-aux/config.sub # build-aux/depcomp # build-aux/install-sh # build-aux/mdate-sh # build-aux/texinfo.tex # configure # doc/Makefile.in # doc/flex.1 # doc/flex.info # doc/flex.info-1 # doc/flex.info-2 # doc/flex.pdf # doc/stamp-vti # doc/version.texi # examples/Makefile.in # examples/fastwc/Makefile.in # examples/manual/Makefile.in # src/config.h.in # tests/Makefile.in # tests/test-bison-nr/Makefile.am # tests/test-bison-yylloc/Makefile.am # tests/test-bison-yylval/Makefile.am # tools/Makefile.in
Diffstat (limited to 'src')
-rw-r--r--src/FlexLexer.h225
-rw-r--r--src/Makefile.am144
-rw-r--r--src/Makefile.in1010
-rw-r--r--src/buf.c274
-rw-r--r--src/ccl.c310
-rw-r--r--src/dfa.c1096
-rw-r--r--src/ecs.c219
-rw-r--r--src/filter.c439
-rw-r--r--src/flex.skl3552
-rw-r--r--src/flexdef.h1232
-rw-r--r--src/flexint.h63
-rw-r--r--src/gen.c2195
-rw-r--r--src/gettext.h59
-rw-r--r--src/libmain.c34
-rw-r--r--src/libyywrap.c29
-rw-r--r--src/main.c1866
-rw-r--r--src/misc.c1015
-rwxr-xr-xsrc/mkskel.sh37
-rw-r--r--src/nfa.c719
-rw-r--r--src/options.c282
-rw-r--r--src/options.h135
-rw-r--r--src/parse.c2953
-rw-r--r--src/parse.h154
-rw-r--r--src/parse.y1090
-rw-r--r--src/regex.c171
-rw-r--r--src/scan.c5105
-rw-r--r--src/scan.l1029
-rw-r--r--src/scanflags.c68
-rw-r--r--src/scanopt.c866
-rw-r--r--src/scanopt.h132
-rw-r--r--src/skel.c3835
-rw-r--r--src/sym.c272
-rw-r--r--src/tables.c502
-rw-r--r--src/tables.h85
-rw-r--r--src/tables_shared.c70
-rw-r--r--src/tables_shared.h144
-rw-r--r--src/tblcmp.c853
-rw-r--r--src/version.h1
-rw-r--r--src/yylex.c212
39 files changed, 32477 insertions, 0 deletions
diff --git a/src/FlexLexer.h b/src/FlexLexer.h
new file mode 100644
index 0000000..b725b1f
--- /dev/null
+++ b/src/FlexLexer.h
@@ -0,0 +1,225 @@
+// -*-C++-*-
+// FlexLexer.h -- define interfaces for lexical analyzer classes generated
+// by flex
+
+// Copyright (c) 1993 The Regents of the University of California.
+// All rights reserved.
+//
+// This code is derived from software contributed to Berkeley by
+// Kent Williams and Tom Epperly.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+
+// Neither the name of the University nor the names of its contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+
+// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE.
+
+// This file defines FlexLexer, an abstract class which specifies the
+// external interface provided to flex C++ lexer objects, and yyFlexLexer,
+// which defines a particular lexer class.
+//
+// If you want to create multiple lexer classes, you use the -P flag
+// to rename each yyFlexLexer to some other xxFlexLexer. You then
+// include <FlexLexer.h> in your other sources once per lexer class:
+//
+// #undef yyFlexLexer
+// #define yyFlexLexer xxFlexLexer
+// #include <FlexLexer.h>
+//
+// #undef yyFlexLexer
+// #define yyFlexLexer zzFlexLexer
+// #include <FlexLexer.h>
+// ...
+
+#ifndef __FLEX_LEXER_H
+// Never included before - need to define base class.
+#define __FLEX_LEXER_H
+
+#include <iostream>
+# ifndef FLEX_STD
+# define FLEX_STD std::
+# endif
+
+extern "C++" {
+
+struct yy_buffer_state;
+typedef int yy_state_type;
+
+class FlexLexer {
+public:
+ virtual ~FlexLexer() { }
+
+ const char* YYText() const { return yytext; }
+ int YYLeng() const { return yyleng; }
+
+ virtual void
+ yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
+ virtual struct yy_buffer_state*
+ yy_create_buffer( FLEX_STD istream* s, int size ) = 0;
+ virtual struct yy_buffer_state*
+ yy_create_buffer( FLEX_STD istream& s, int size ) = 0;
+ virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
+ virtual void yyrestart( FLEX_STD istream* s ) = 0;
+ virtual void yyrestart( FLEX_STD istream& s ) = 0;
+
+ virtual int yylex() = 0;
+
+ // Call yylex with new input/output sources.
+ int yylex( FLEX_STD istream& new_in, FLEX_STD ostream& new_out )
+ {
+ switch_streams( new_in, new_out );
+ return yylex();
+ }
+
+ int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0)
+ {
+ switch_streams( new_in, new_out );
+ return yylex();
+ }
+
+ // Switch to new input/output streams. A nil stream pointer
+ // indicates "keep the current one".
+ virtual void switch_streams( FLEX_STD istream* new_in,
+ FLEX_STD ostream* new_out ) = 0;
+ virtual void switch_streams( FLEX_STD istream& new_in,
+ FLEX_STD ostream& new_out ) = 0;
+
+ int lineno() const { return yylineno; }
+
+ int debug() const { return yy_flex_debug; }
+ void set_debug( int flag ) { yy_flex_debug = flag; }
+
+protected:
+ char* yytext;
+ int yyleng;
+ int yylineno; // only maintained if you use %option yylineno
+ int yy_flex_debug; // only has effect with -d or "%option debug"
+};
+
+}
+#endif // FLEXLEXER_H
+
+#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
+// Either this is the first time through (yyFlexLexerOnce not defined),
+// or this is a repeated include to define a different flavor of
+// yyFlexLexer, as discussed in the flex manual.
+#define yyFlexLexerOnce
+
+extern "C++" {
+
+class yyFlexLexer : public FlexLexer {
+public:
+ // arg_yyin and arg_yyout default to the cin and cout, but we
+ // only make that assignment when initializing in yylex().
+ yyFlexLexer( FLEX_STD istream& arg_yyin, FLEX_STD ostream& arg_yyout );
+ yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 );
+private:
+ void ctor_common();
+
+public:
+
+ virtual ~yyFlexLexer();
+
+ void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
+ struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size );
+ struct yy_buffer_state* yy_create_buffer( FLEX_STD istream& s, int size );
+ void yy_delete_buffer( struct yy_buffer_state* b );
+ void yyrestart( FLEX_STD istream* s );
+ void yyrestart( FLEX_STD istream& s );
+
+ void yypush_buffer_state( struct yy_buffer_state* new_buffer );
+ void yypop_buffer_state();
+
+ virtual int yylex();
+ virtual void switch_streams( FLEX_STD istream& new_in, FLEX_STD ostream& new_out );
+ virtual void switch_streams( FLEX_STD istream* new_in = 0, FLEX_STD ostream* new_out = 0 );
+ virtual int yywrap();
+
+protected:
+ virtual int LexerInput( char* buf, int max_size );
+ virtual void LexerOutput( const char* buf, int size );
+ virtual void LexerError( const char* msg );
+
+ void yyunput( int c, char* buf_ptr );
+ int yyinput();
+
+ void yy_load_buffer_state();
+ void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream& s );
+ void yy_flush_buffer( struct yy_buffer_state* b );
+
+ int yy_start_stack_ptr;
+ int yy_start_stack_depth;
+ int* yy_start_stack;
+
+ void yy_push_state( int new_state );
+ void yy_pop_state();
+ int yy_top_state();
+
+ yy_state_type yy_get_previous_state();
+ yy_state_type yy_try_NUL_trans( yy_state_type current_state );
+ int yy_get_next_buffer();
+
+ FLEX_STD istream yyin; // input source for default LexerInput
+ FLEX_STD ostream yyout; // output sink for default LexerOutput
+
+ // yy_hold_char holds the character lost when yytext is formed.
+ char yy_hold_char;
+
+ // Number of characters read into yy_ch_buf.
+ int yy_n_chars;
+
+ // Points to current character in buffer.
+ char* yy_c_buf_p;
+
+ int yy_init; // whether we need to initialize
+ int yy_start; // start state number
+
+ // Flag which is used to allow yywrap()'s to do buffer switches
+ // instead of setting up a fresh yyin. A bit of a hack ...
+ int yy_did_buffer_switch_on_eof;
+
+
+ size_t yy_buffer_stack_top; /**< index of top of stack. */
+ size_t yy_buffer_stack_max; /**< capacity of stack. */
+ struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
+ void yyensure_buffer_stack(void);
+
+ // The following are not always needed, but may be depending
+ // on use of certain flex features (like REJECT or yymore()).
+
+ yy_state_type yy_last_accepting_state;
+ char* yy_last_accepting_cpos;
+
+ yy_state_type* yy_state_buf;
+ yy_state_type* yy_state_ptr;
+
+ char* yy_full_match;
+ int* yy_full_state;
+ int yy_full_lp;
+
+ int yy_lp;
+ int yy_looking_for_trail_begin;
+
+ int yy_more_flag;
+ int yy_more_len;
+ int yy_more_offset;
+ int yy_prev_more_offset;
+};
+
+}
+
+#endif // yyFlexLexer || ! yyFlexLexerOnce
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..e324854
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,144 @@
+AM_YFLAGS = -d
+localedir = $(datadir)/locale
+AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/intl
+LIBS = @LIBINTL@ @LIBS@
+
+m4 = @M4@
+
+bin_PROGRAMS = flex
+lib_LTLIBRARIES = \
+ libfl.la \
+ libfl_pic.la
+
+flex_SOURCES = \
+ ccl.c \
+ dfa.c \
+ ecs.c \
+ scanflags.c \
+ gen.c \
+ main.c \
+ misc.c \
+ nfa.c \
+ parse.y \
+ scan.l \
+ skel.c \
+ sym.c \
+ tblcmp.c \
+ yylex.c \
+ options.c \
+ scanopt.c \
+ buf.c \
+ tables.c \
+ tables_shared.c \
+ filter.c \
+ regex.c
+
+LDADD = ../lib/libcompat.la
+
+libfl_la_SOURCES = \
+ libmain.c \
+ libyywrap.c
+
+libfl_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
+
+libfl_pic_la_SOURCES = \
+ libmain.c \
+ libyywrap.c
+
+libfl_pic_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
+
+noinst_HEADERS = \
+ flexdef.h \
+ flexint.h \
+ version.h \
+ options.h \
+ scanopt.h \
+ tables.h \
+ tables_shared.h
+
+include_HEADERS = \
+ FlexLexer.h
+
+EXTRA_DIST = \
+ flex.skl \
+ mkskel.sh \
+ gettext.h
+
+BUILT_SOURCES = \
+ skel.c
+
+MAINTAINERCLEANFILES = skel.c
+
+skel.c: flex.skl mkskel.sh flexint.h tables_shared.h
+ sed 's/m4_/m4postproc_/g; s/m4preproc_/m4_/g' $(srcdir)/flex.skl | $(m4) -P -DFLEX_MAJOR_VERSION=`echo $(VERSION)|cut -f 1 -d .` -DFLEX_MINOR_VERSION=`echo $(VERSION)|cut -f 2 -d .` -DFLEX_SUBMINOR_VERSION=`echo $(VERSION)|cut -f 3 -d .` | sed 's/m4postproc_/m4_/g' | $(SHELL) $(srcdir)/mkskel.sh >skel.c
+
+# Explicitly describe dependencies.
+# You can recreate this with `gcc -I. -MM *.c'
+buf.o: buf.c flexdef.h flexint.h
+ccl.o: ccl.c flexdef.h flexint.h
+dfa.o: dfa.c flexdef.h flexint.h tables.h tables_shared.h
+ecs.o: ecs.c flexdef.h flexint.h
+scanflags.o: scanflags.c flexdef.h flexint.h
+gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h
+libmain.o: libmain.c
+libyywrap.o: libyywrap.c
+main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \
+ tables.h tables_shared.h
+misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h
+nfa.o: nfa.c flexdef.h flexint.h
+options.o: options.c options.h scanopt.h flexdef.h flexint.h
+parse.o: parse.c flexdef.h flexint.h tables.h tables_shared.h
+scan.o: scan.c flexdef.h flexint.h parse.h
+scanopt.o: scanopt.c flexdef.h flexint.h scanopt.h
+skel.o: skel.c flexdef.h flexint.h
+sym.o: sym.c flexdef.h flexint.h
+tables.o: tables.c flexdef.h flexint.h tables.h tables_shared.h
+tables_shared.o: tables_shared.c flexdef.h flexint.h tables.h \
+ tables_shared.h
+tblcmp.o: tblcmp.c flexdef.h flexint.h
+yylex.o: yylex.c flexdef.h flexint.h parse.h
+filter.o: filter.c flexdef.h flexint.h
+
+# Run GNU indent on sources. Don't run this unless all the sources compile cleanly.
+#
+# Whole idea:
+# 1. Check for .indent.pro, otherwise indent will use unknown
+# settings, or worse, the GNU defaults.)
+# 2. Check that this is GNU indent.
+# 3. Make sure to process only the NON-generated .c and .h files.
+# 4. Run indent twice per file. The first time is a test.
+# Otherwise, indent overwrites your file even if it fails!
+indentfiles = \
+ buf.c \
+ ccl.c \
+ dfa.c \
+ ecs.c \
+ scanflags.c \
+ filter.c \
+ flexdef.h \
+ gen.c \
+ libmain.c \
+ libyywrap.c \
+ main.c \
+ misc.c \
+ nfa.c \
+ options.c \
+ options.h \
+ regex.c \
+ scanopt.c \
+ scanopt.h \
+ sym.c \
+ tables.c \
+ tables.h \
+ tables_shared.c \
+ tables_shared.h \
+ tblcmp.c
+
+indent:
+ if [ -f .indent.pro ] ; then \
+ for f in $(indentfiles);\
+ do\
+ echo indenting $$f ;\
+ $(indent) < $$f >/dev/null && indent $$f || echo $$f FAILED to indent ;\
+ done \
+ fi
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..a9e0074
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,1010 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = flex$(EXEEXT)
+subdir = src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \
+ $(noinst_HEADERS) $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(includedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libfl_la_LIBADD =
+am_libfl_la_OBJECTS = libmain.lo libyywrap.lo
+libfl_la_OBJECTS = $(am_libfl_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+libfl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libfl_la_LDFLAGS) $(LDFLAGS) -o $@
+libfl_pic_la_LIBADD =
+am_libfl_pic_la_OBJECTS = libmain.lo libyywrap.lo
+libfl_pic_la_OBJECTS = $(am_libfl_pic_la_OBJECTS)
+libfl_pic_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libfl_pic_la_LDFLAGS) $(LDFLAGS) -o $@
+PROGRAMS = $(bin_PROGRAMS)
+am_flex_OBJECTS = ccl.$(OBJEXT) dfa.$(OBJEXT) ecs.$(OBJEXT) \
+ scanflags.$(OBJEXT) gen.$(OBJEXT) main.$(OBJEXT) \
+ misc.$(OBJEXT) nfa.$(OBJEXT) parse.$(OBJEXT) scan.$(OBJEXT) \
+ skel.$(OBJEXT) sym.$(OBJEXT) tblcmp.$(OBJEXT) yylex.$(OBJEXT) \
+ options.$(OBJEXT) scanopt.$(OBJEXT) buf.$(OBJEXT) \
+ tables.$(OBJEXT) tables_shared.$(OBJEXT) filter.$(OBJEXT) \
+ regex.$(OBJEXT)
+flex_OBJECTS = $(am_flex_OBJECTS)
+flex_LDADD = $(LDADD)
+flex_DEPENDENCIES = ../lib/libcompat.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
+LTLEXCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS)
+AM_V_LEX = $(am__v_LEX_@AM_V@)
+am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@)
+am__v_LEX_0 = @echo " LEX " $@;
+am__v_LEX_1 =
+YLWRAP = $(top_srcdir)/build-aux/ylwrap
+am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \
+ -e s/c++$$/h++/ -e s/c$$/h/
+YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS)
+LTYACCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS)
+AM_V_YACC = $(am__v_YACC_@AM_V@)
+am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@)
+am__v_YACC_0 = @echo " YACC " $@;
+am__v_YACC_1 =
+SOURCES = $(libfl_la_SOURCES) $(libfl_pic_la_SOURCES) $(flex_SOURCES)
+DIST_SOURCES = $(libfl_la_SOURCES) $(libfl_pic_la_SOURCES) \
+ $(flex_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+HEADERS = $(include_HEADERS) $(noinst_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
+ $(LISP)config.h.in
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ $(top_srcdir)/build-aux/depcomp $(top_srcdir)/build-aux/ylwrap \
+ parse.c parse.h scan.c
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BISON = @BISON@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+HELP2MAN = @HELP2MAN@
+INDENT = @INDENT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBINTL@ @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+M4 = @M4@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = $(datadir)/locale
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_YFLAGS = -d
+AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/intl
+m4 = @M4@
+lib_LTLIBRARIES = \
+ libfl.la \
+ libfl_pic.la
+
+flex_SOURCES = \
+ ccl.c \
+ dfa.c \
+ ecs.c \
+ scanflags.c \
+ gen.c \
+ main.c \
+ misc.c \
+ nfa.c \
+ parse.y \
+ scan.l \
+ skel.c \
+ sym.c \
+ tblcmp.c \
+ yylex.c \
+ options.c \
+ scanopt.c \
+ buf.c \
+ tables.c \
+ tables_shared.c \
+ filter.c \
+ regex.c
+
+LDADD = ../lib/libcompat.la
+libfl_la_SOURCES = \
+ libmain.c \
+ libyywrap.c
+
+libfl_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
+libfl_pic_la_SOURCES = \
+ libmain.c \
+ libyywrap.c
+
+libfl_pic_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
+noinst_HEADERS = \
+ flexdef.h \
+ flexint.h \
+ version.h \
+ options.h \
+ scanopt.h \
+ tables.h \
+ tables_shared.h
+
+include_HEADERS = \
+ FlexLexer.h
+
+EXTRA_DIST = \
+ flex.skl \
+ mkskel.sh \
+ gettext.h
+
+BUILT_SOURCES = \
+ skel.c
+
+MAINTAINERCLEANFILES = skel.c
+
+# Run GNU indent on sources. Don't run this unless all the sources compile cleanly.
+#
+# Whole idea:
+# 1. Check for .indent.pro, otherwise indent will use unknown
+# settings, or worse, the GNU defaults.)
+# 2. Check that this is GNU indent.
+# 3. Make sure to process only the NON-generated .c and .h files.
+# 4. Run indent twice per file. The first time is a test.
+# Otherwise, indent overwrites your file even if it fails!
+indentfiles = \
+ buf.c \
+ ccl.c \
+ dfa.c \
+ ecs.c \
+ scanflags.c \
+ filter.c \
+ flexdef.h \
+ gen.c \
+ libmain.c \
+ libyywrap.c \
+ main.c \
+ misc.c \
+ nfa.c \
+ options.c \
+ options.h \
+ regex.c \
+ scanopt.c \
+ scanopt.h \
+ sym.c \
+ tables.c \
+ tables.h \
+ tables_shared.c \
+ tables_shared.h \
+ tblcmp.c
+
+all: $(BUILT_SOURCES) config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .l .lo .o .obj .y
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+ @test -f $@ || rm -f stamp-h1
+ @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status src/config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+libfl.la: $(libfl_la_OBJECTS) $(libfl_la_DEPENDENCIES) $(EXTRA_libfl_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libfl_la_LINK) -rpath $(libdir) $(libfl_la_OBJECTS) $(libfl_la_LIBADD) $(LIBS)
+
+libfl_pic.la: $(libfl_pic_la_OBJECTS) $(libfl_pic_la_DEPENDENCIES) $(EXTRA_libfl_pic_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libfl_pic_la_LINK) -rpath $(libdir) $(libfl_pic_la_OBJECTS) $(libfl_pic_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ || test -f $$p1 \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+installcheck-binPROGRAMS: $(bin_PROGRAMS)
+ bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \
+ case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
+ *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
+ esac; \
+ f=`echo "$$p" | \
+ sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ for opt in --help --version; do \
+ if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \
+ 2>c$${pid}_.err </dev/null \
+ && test -n "`cat c$${pid}_.out`" \
+ && test -z "`cat c$${pid}_.err`"; then :; \
+ else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
+ done; \
+ done; rm -f c$${pid}_.???; exit $$bad
+parse.h: parse.c
+ @if test ! -f $@; then rm -f parse.c; else :; fi
+ @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) parse.c; else :; fi
+
+flex$(EXEEXT): $(flex_OBJECTS) $(flex_DEPENDENCIES) $(EXTRA_flex_DEPENDENCIES)
+ @rm -f flex$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(flex_OBJECTS) $(flex_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfa.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmain.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libyywrap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nfa.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanflags.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sym.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tables.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tables_shared.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tblcmp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yylex.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+.l.c:
+ $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE)
+
+.y.c:
+ $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE)
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) config.h
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -rm -f parse.c
+ -rm -f parse.h
+ -rm -f scan.c
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am: installcheck-binPROGRAMS
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
+ uninstall-libLTLIBRARIES
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+ clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+ clean-libtool cscopelist-am ctags ctags-am distclean \
+ distclean-compile distclean-generic distclean-hdr \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-includeHEADERS install-info install-info-am \
+ install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installcheck-binPROGRAMS installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-includeHEADERS \
+ uninstall-libLTLIBRARIES
+
+.PRECIOUS: Makefile
+
+
+skel.c: flex.skl mkskel.sh flexint.h tables_shared.h
+ sed 's/m4_/m4postproc_/g; s/m4preproc_/m4_/g' $(srcdir)/flex.skl | $(m4) -P -DFLEX_MAJOR_VERSION=`echo $(VERSION)|cut -f 1 -d .` -DFLEX_MINOR_VERSION=`echo $(VERSION)|cut -f 2 -d .` -DFLEX_SUBMINOR_VERSION=`echo $(VERSION)|cut -f 3 -d .` | sed 's/m4postproc_/m4_/g' | $(SHELL) $(srcdir)/mkskel.sh >skel.c
+
+# Explicitly describe dependencies.
+# You can recreate this with `gcc -I. -MM *.c'
+buf.o: buf.c flexdef.h flexint.h
+ccl.o: ccl.c flexdef.h flexint.h
+dfa.o: dfa.c flexdef.h flexint.h tables.h tables_shared.h
+ecs.o: ecs.c flexdef.h flexint.h
+scanflags.o: scanflags.c flexdef.h flexint.h
+gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h
+libmain.o: libmain.c
+libyywrap.o: libyywrap.c
+main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \
+ tables.h tables_shared.h
+misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h
+nfa.o: nfa.c flexdef.h flexint.h
+options.o: options.c options.h scanopt.h flexdef.h flexint.h
+parse.o: parse.c flexdef.h flexint.h tables.h tables_shared.h
+scan.o: scan.c flexdef.h flexint.h parse.h
+scanopt.o: scanopt.c flexdef.h flexint.h scanopt.h
+skel.o: skel.c flexdef.h flexint.h
+sym.o: sym.c flexdef.h flexint.h
+tables.o: tables.c flexdef.h flexint.h tables.h tables_shared.h
+tables_shared.o: tables_shared.c flexdef.h flexint.h tables.h \
+ tables_shared.h
+tblcmp.o: tblcmp.c flexdef.h flexint.h
+yylex.o: yylex.c flexdef.h flexint.h parse.h
+filter.o: filter.c flexdef.h flexint.h
+
+indent:
+ if [ -f .indent.pro ] ; then \
+ for f in $(indentfiles);\
+ do\
+ echo indenting $$f ;\
+ $(indent) < $$f >/dev/null && indent $$f || echo $$f FAILED to indent ;\
+ done \
+ fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/buf.c b/src/buf.c
new file mode 100644
index 0000000..fa713a6
--- /dev/null
+++ b/src/buf.c
@@ -0,0 +1,274 @@
+/* flex - tool to generate fast lexical analyzers */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+
+/* Take note: The buffer object is sometimes used as a String buffer (one
+ * continuous string), and sometimes used as a list of strings, usually line by
+ * line.
+ *
+ * The type is specified in buf_init by the elt_size. If the elt_size is
+ * sizeof(char), then the buffer should be treated as string buffer. If the
+ * elt_size is sizeof(char*), then the buffer should be treated as a list of
+ * strings.
+ *
+ * Certain functions are only appropriate for one type or the other.
+ */
+
+/* global buffers. */
+struct Buf userdef_buf; /**< for user #definitions triggered by cmd-line. */
+struct Buf defs_buf; /**< for #define's autogenerated. List of strings. */
+struct Buf yydmap_buf; /**< string buffer to hold yydmap elements */
+struct Buf m4defs_buf; /**< m4 definitions. List of strings. */
+struct Buf top_buf; /**< contains %top code. String buffer. */
+
+struct Buf *buf_print_strings(struct Buf * buf, FILE* out)
+{
+ int i;
+
+ if(!buf || !out)
+ return buf;
+
+ for (i=0; i < buf->nelts; i++){
+ const char * s = ((char**)buf->elts)[i];
+ if(s)
+ fprintf(out, "%s", s);
+ }
+ return buf;
+}
+
+/* Append a "%s" formatted string to a string buffer */
+struct Buf *buf_prints (struct Buf *buf, const char *fmt, const char *s)
+{
+ char *t;
+ size_t tsz;
+
+ t = flex_alloc (tsz = strlen (fmt) + strlen (s) + 1);
+ if (!t)
+ flexfatal (_("Allocation of buffer to print string failed"));
+ snprintf (t, tsz, fmt, s);
+ buf = buf_strappend (buf, t);
+ flex_free (t);
+ return buf;
+}
+
+/** Append a line directive to the string buffer.
+ * @param buf A string buffer.
+ * @param filename file name
+ * @param lineno line number
+ * @return buf
+ */
+struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno)
+{
+ char *dst, *t;
+ const char *src;
+
+ t = flex_alloc (strlen ("#line \"\"\n") + /* constant parts */
+ 2 * strlen (filename) + /* filename with possibly all backslashes escaped */
+ (int) (1 + log10 (abs (lineno))) + /* line number */
+ 1); /* NUL */
+ if (!t)
+ flexfatal (_("Allocation of buffer for line directive failed"));
+ for (dst = t + sprintf (t, "#line %d \"", lineno), src = filename; *src; *dst++ = *src++)
+ if (*src == '\\') /* escape backslashes */
+ *dst++ = '\\';
+ *dst++ = '"';
+ *dst++ = '\n';
+ *dst = '\0';
+ buf = buf_strappend (buf, t);
+ flex_free (t);
+ return buf;
+}
+
+
+/** Append the contents of @a src to @a dest.
+ * @param @a dest the destination buffer
+ * @param @a dest the source buffer
+ * @return @a dest
+ */
+struct Buf *buf_concat(struct Buf* dest, const struct Buf* src)
+{
+ buf_append(dest, src->elts, src->nelts);
+ return dest;
+}
+
+
+/* Appends n characters in str to buf. */
+struct Buf *buf_strnappend (buf, str, n)
+ struct Buf *buf;
+ const char *str;
+ int n;
+{
+ buf_append (buf, str, n + 1);
+
+ /* "undo" the '\0' character that buf_append() already copied. */
+ buf->nelts--;
+
+ return buf;
+}
+
+/* Appends characters in str to buf. */
+struct Buf *buf_strappend (buf, str)
+ struct Buf *buf;
+ const char *str;
+{
+ return buf_strnappend (buf, str, strlen (str));
+}
+
+/* appends "#define str def\n" */
+struct Buf *buf_strdefine (buf, str, def)
+ struct Buf *buf;
+ const char *str;
+ const char *def;
+{
+ buf_strappend (buf, "#define ");
+ buf_strappend (buf, " ");
+ buf_strappend (buf, str);
+ buf_strappend (buf, " ");
+ buf_strappend (buf, def);
+ buf_strappend (buf, "\n");
+ return buf;
+}
+
+/** Pushes "m4_define( [[def]], [[val]])m4_dnl" to end of buffer.
+ * @param buf A buffer as a list of strings.
+ * @param def The m4 symbol to define.
+ * @param val The definition; may be NULL.
+ * @return buf
+ */
+struct Buf *buf_m4_define (struct Buf *buf, const char* def, const char* val)
+{
+ const char * fmt = "m4_define( [[%s]], [[%s]])m4_dnl\n";
+ char * str;
+ size_t strsz;
+
+ val = val?val:"";
+ str = (char*)flex_alloc(strsz = strlen(fmt) + strlen(def) + strlen(val) + 2);
+ if (!str)
+ flexfatal (_("Allocation of buffer for m4 def failed"));
+
+ snprintf(str, strsz, fmt, def, val);
+ buf_append(buf, &str, 1);
+ return buf;
+}
+
+/** Pushes "m4_undefine([[def]])m4_dnl" to end of buffer.
+ * @param buf A buffer as a list of strings.
+ * @param def The m4 symbol to undefine.
+ * @return buf
+ */
+struct Buf *buf_m4_undefine (struct Buf *buf, const char* def)
+{
+ const char * fmt = "m4_undefine( [[%s]])m4_dnl\n";
+ char * str;
+ size_t strsz;
+
+ str = (char*)flex_alloc(strsz = strlen(fmt) + strlen(def) + 2);
+ if (!str)
+ flexfatal (_("Allocation of buffer for m4 undef failed"));
+
+ snprintf(str, strsz, fmt, def);
+ buf_append(buf, &str, 1);
+ return buf;
+}
+
+/* create buf with 0 elements, each of size elem_size. */
+void buf_init (buf, elem_size)
+ struct Buf *buf;
+ size_t elem_size;
+{
+ buf->elts = (void *) 0;
+ buf->nelts = 0;
+ buf->elt_size = elem_size;
+ buf->nmax = 0;
+}
+
+/* frees memory */
+void buf_destroy (buf)
+ struct Buf *buf;
+{
+ if (buf && buf->elts)
+ flex_free (buf->elts);
+ buf->elts = (void *) 0;
+}
+
+
+/* appends ptr[] to buf, grow if necessary.
+ * n_elem is number of elements in ptr[], NOT bytes.
+ * returns buf.
+ * We grow by mod(512) boundaries.
+ */
+
+struct Buf *buf_append (buf, ptr, n_elem)
+ struct Buf *buf;
+ const void *ptr;
+ int n_elem;
+{
+ int n_alloc = 0;
+
+ if (!ptr || n_elem == 0)
+ return buf;
+
+ /* May need to alloc more. */
+ if (n_elem + buf->nelts > buf->nmax) {
+
+ /* exact amount needed... */
+ n_alloc = (n_elem + buf->nelts) * buf->elt_size;
+
+ /* ...plus some extra */
+ if (((n_alloc * buf->elt_size) % 512) != 0
+ && buf->elt_size < 512)
+ n_alloc +=
+ (512 -
+ ((n_alloc * buf->elt_size) % 512)) /
+ buf->elt_size;
+
+ if (!buf->elts)
+ buf->elts =
+ allocate_array (n_alloc, buf->elt_size);
+ else
+ buf->elts =
+ reallocate_array (buf->elts, n_alloc,
+ buf->elt_size);
+
+ buf->nmax = n_alloc;
+ }
+
+ memcpy ((char *) buf->elts + buf->nelts * buf->elt_size, ptr,
+ n_elem * buf->elt_size);
+ buf->nelts += n_elem;
+
+ return buf;
+}
+
+/* vim:set tabstop=8 softtabstop=4 shiftwidth=4: */
diff --git a/src/ccl.c b/src/ccl.c
new file mode 100644
index 0000000..7b134af
--- /dev/null
+++ b/src/ccl.c
@@ -0,0 +1,310 @@
+/* ccl - routines for character classes */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+ /* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+
+/* return true if the chr is in the ccl. Takes negation into account. */
+static bool
+ccl_contains (const int cclp, const int ch)
+{
+ int ind, len, i;
+
+ len = ccllen[cclp];
+ ind = cclmap[cclp];
+
+ for (i = 0; i < len; ++i)
+ if (ccltbl[ind + i] == ch)
+ return !cclng[cclp];
+
+ return cclng[cclp];
+}
+
+
+/* ccladd - add a single character to a ccl */
+
+void ccladd (cclp, ch)
+ int cclp;
+ int ch;
+{
+ int ind, len, newpos, i;
+
+ check_char (ch);
+
+ len = ccllen[cclp];
+ ind = cclmap[cclp];
+
+ /* check to see if the character is already in the ccl */
+
+ for (i = 0; i < len; ++i)
+ if (ccltbl[ind + i] == ch)
+ return;
+
+ /* mark newlines */
+ if (ch == nlch)
+ ccl_has_nl[cclp] = true;
+
+ newpos = ind + len;
+
+ if (newpos >= current_max_ccl_tbl_size) {
+ current_max_ccl_tbl_size += MAX_CCL_TBL_SIZE_INCREMENT;
+
+ ++num_reallocs;
+
+ ccltbl = reallocate_Character_array (ccltbl,
+ current_max_ccl_tbl_size);
+ }
+
+ ccllen[cclp] = len + 1;
+ ccltbl[newpos] = ch;
+}
+
+/* dump_cclp - same thing as list_character_set, but for cclps. */
+
+static void dump_cclp (FILE* file, int cclp)
+{
+ int i;
+
+ putc ('[', file);
+
+ for (i = 0; i < csize; ++i) {
+ if (ccl_contains(cclp, i)){
+ int start_char = i;
+
+ putc (' ', file);
+
+ fputs (readable_form (i), file);
+
+ while (++i < csize && ccl_contains(cclp,i)) ;
+
+ if (i - 1 > start_char)
+ /* this was a run */
+ fprintf (file, "-%s",
+ readable_form (i - 1));
+
+ putc (' ', file);
+ }
+ }
+
+ putc (']', file);
+}
+
+
+
+/* ccl_set_diff - create a new ccl as the set difference of the two given ccls. */
+int
+ccl_set_diff (int a, int b)
+{
+ int d, ch;
+
+ /* create new class */
+ d = cclinit();
+
+ /* In order to handle negation, we spin through all possible chars,
+ * addding each char in a that is not in b.
+ * (This could be O(n^2), but n is small and bounded.)
+ */
+ for ( ch = 0; ch < csize; ++ch )
+ if (ccl_contains (a, ch) && !ccl_contains(b, ch))
+ ccladd (d, ch);
+
+ /* debug */
+ if (0){
+ fprintf(stderr, "ccl_set_diff (");
+ fprintf(stderr, "\n ");
+ dump_cclp (stderr, a);
+ fprintf(stderr, "\n ");
+ dump_cclp (stderr, b);
+ fprintf(stderr, "\n ");
+ dump_cclp (stderr, d);
+ fprintf(stderr, "\n)\n");
+ }
+ return d;
+}
+
+/* ccl_set_union - create a new ccl as the set union of the two given ccls. */
+int
+ccl_set_union (int a, int b)
+{
+ int d, i;
+
+ /* create new class */
+ d = cclinit();
+
+ /* Add all of a */
+ for (i = 0; i < ccllen[a]; ++i)
+ ccladd (d, ccltbl[cclmap[a] + i]);
+
+ /* Add all of b */
+ for (i = 0; i < ccllen[b]; ++i)
+ ccladd (d, ccltbl[cclmap[b] + i]);
+
+ /* debug */
+ if (0){
+ fprintf(stderr, "ccl_set_union (%d + %d = %d", a, b, d);
+ fprintf(stderr, "\n ");
+ dump_cclp (stderr, a);
+ fprintf(stderr, "\n ");
+ dump_cclp (stderr, b);
+ fprintf(stderr, "\n ");
+ dump_cclp (stderr, d);
+ fprintf(stderr, "\n)\n");
+ }
+ return d;
+}
+
+
+/* cclinit - return an empty ccl */
+
+int cclinit ()
+{
+ if (++lastccl >= current_maxccls) {
+ current_maxccls += MAX_CCLS_INCREMENT;
+
+ ++num_reallocs;
+
+ cclmap =
+ reallocate_integer_array (cclmap, current_maxccls);
+ ccllen =
+ reallocate_integer_array (ccllen, current_maxccls);
+ cclng = reallocate_integer_array (cclng, current_maxccls);
+ ccl_has_nl =
+ reallocate_bool_array (ccl_has_nl,
+ current_maxccls);
+ }
+
+ if (lastccl == 1)
+ /* we're making the first ccl */
+ cclmap[lastccl] = 0;
+
+ else
+ /* The new pointer is just past the end of the last ccl.
+ * Since the cclmap points to the \first/ character of a
+ * ccl, adding the length of the ccl to the cclmap pointer
+ * will produce a cursor to the first free space.
+ */
+ cclmap[lastccl] =
+ cclmap[lastccl - 1] + ccllen[lastccl - 1];
+
+ ccllen[lastccl] = 0;
+ cclng[lastccl] = 0; /* ccl's start out life un-negated */
+ ccl_has_nl[lastccl] = false;
+
+ return lastccl;
+}
+
+
+/* cclnegate - negate the given ccl */
+
+void cclnegate (cclp)
+ int cclp;
+{
+ cclng[cclp] = 1;
+ ccl_has_nl[cclp] = !ccl_has_nl[cclp];
+}
+
+
+/* list_character_set - list the members of a set of characters in CCL form
+ *
+ * Writes to the given file a character-class representation of those
+ * characters present in the given CCL. A character is present if it
+ * has a non-zero value in the cset array.
+ */
+
+void list_character_set (file, cset)
+ FILE *file;
+ int cset[];
+{
+ int i;
+
+ putc ('[', file);
+
+ for (i = 0; i < csize; ++i) {
+ if (cset[i]) {
+ int start_char = i;
+
+ putc (' ', file);
+
+ fputs (readable_form (i), file);
+
+ while (++i < csize && cset[i]) ;
+
+ if (i - 1 > start_char)
+ /* this was a run */
+ fprintf (file, "-%s",
+ readable_form (i - 1));
+
+ putc (' ', file);
+ }
+ }
+
+ putc (']', file);
+}
+
+/** Determines if the range [c1-c2] is unambiguous in a case-insensitive
+ * scanner. Specifically, if a lowercase or uppercase character, x, is in the
+ * range [c1-c2], then we require that UPPERCASE(x) and LOWERCASE(x) must also
+ * be in the range. If not, then this range is ambiguous, and the function
+ * returns false. For example, [@-_] spans [a-z] but not [A-Z]. Beware that
+ * [a-z] will be labeled ambiguous because it does not include [A-Z].
+ *
+ * @param c1 the lower end of the range
+ * @param c2 the upper end of the range
+ * @return true if [c1-c2] is not ambiguous for a caseless scanner.
+ */
+bool range_covers_case (int c1, int c2)
+{
+ int i, o;
+
+ for (i = c1; i <= c2; i++) {
+ if (has_case (i)) {
+ o = reverse_case (i);
+ if (o < c1 || c2 < o)
+ return false;
+ }
+ }
+ return true;
+}
+
+/** Reverse the case of a character, if possible.
+ * @return c if case-reversal does not apply.
+ */
+int reverse_case (int c)
+{
+ return isupper (c) ? tolower (c) : (islower (c) ? toupper (c) : c);
+}
+
+/** Return true if c is uppercase or lowercase. */
+bool has_case (int c)
+{
+ return (isupper (c) || islower (c)) ? true : false;
+}
diff --git a/src/dfa.c b/src/dfa.c
new file mode 100644
index 0000000..0a68e3a
--- /dev/null
+++ b/src/dfa.c
@@ -0,0 +1,1096 @@
+/* dfa - DFA construction routines */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+#include "tables.h"
+
+/* declare functions that have forward references */
+
+void dump_associated_rules PROTO ((FILE *, int));
+void dump_transitions PROTO ((FILE *, int[]));
+void sympartition PROTO ((int[], int, int[], int[]));
+int symfollowset PROTO ((int[], int, int, int[]));
+
+
+/* check_for_backing_up - check a DFA state for backing up
+ *
+ * synopsis
+ * void check_for_backing_up( int ds, int state[numecs] );
+ *
+ * ds is the number of the state to check and state[] is its out-transitions,
+ * indexed by equivalence class.
+ */
+
+void check_for_backing_up (ds, state)
+ int ds;
+ int state[];
+{
+ if ((reject && !dfaacc[ds].dfaacc_set) || (!reject && !dfaacc[ds].dfaacc_state)) { /* state is non-accepting */
+ ++num_backing_up;
+
+ if (backing_up_report) {
+ fprintf (backing_up_file,
+ _("State #%d is non-accepting -\n"), ds);
+
+ /* identify the state */
+ dump_associated_rules (backing_up_file, ds);
+
+ /* Now identify it further using the out- and
+ * jam-transitions.
+ */
+ dump_transitions (backing_up_file, state);
+
+ putc ('\n', backing_up_file);
+ }
+ }
+}
+
+
+/* check_trailing_context - check to see if NFA state set constitutes
+ * "dangerous" trailing context
+ *
+ * synopsis
+ * void check_trailing_context( int nfa_states[num_states+1], int num_states,
+ * int accset[nacc+1], int nacc );
+ *
+ * NOTES
+ * Trailing context is "dangerous" if both the head and the trailing
+ * part are of variable size \and/ there's a DFA state which contains
+ * both an accepting state for the head part of the rule and NFA states
+ * which occur after the beginning of the trailing context.
+ *
+ * When such a rule is matched, it's impossible to tell if having been
+ * in the DFA state indicates the beginning of the trailing context or
+ * further-along scanning of the pattern. In these cases, a warning
+ * message is issued.
+ *
+ * nfa_states[1 .. num_states] is the list of NFA states in the DFA.
+ * accset[1 .. nacc] is the list of accepting numbers for the DFA state.
+ */
+
+void check_trailing_context (nfa_states, num_states, accset, nacc)
+ int *nfa_states, num_states;
+ int *accset;
+ int nacc;
+{
+ int i, j;
+
+ for (i = 1; i <= num_states; ++i) {
+ int ns = nfa_states[i];
+ int type = state_type[ns];
+ int ar = assoc_rule[ns];
+
+ if (type == STATE_NORMAL || rule_type[ar] != RULE_VARIABLE) { /* do nothing */
+ }
+
+ else if (type == STATE_TRAILING_CONTEXT) {
+ /* Potential trouble. Scan set of accepting numbers
+ * for the one marking the end of the "head". We
+ * assume that this looping will be fairly cheap
+ * since it's rare that an accepting number set
+ * is large.
+ */
+ for (j = 1; j <= nacc; ++j)
+ if (accset[j] & YY_TRAILING_HEAD_MASK) {
+ line_warning (_
+ ("dangerous trailing context"),
+ rule_linenum[ar]);
+ return;
+ }
+ }
+ }
+}
+
+
+/* dump_associated_rules - list the rules associated with a DFA state
+ *
+ * Goes through the set of NFA states associated with the DFA and
+ * extracts the first MAX_ASSOC_RULES unique rules, sorts them,
+ * and writes a report to the given file.
+ */
+
+void dump_associated_rules (file, ds)
+ FILE *file;
+ int ds;
+{
+ int i, j;
+ int num_associated_rules = 0;
+ int rule_set[MAX_ASSOC_RULES + 1];
+ int *dset = dss[ds];
+ int size = dfasiz[ds];
+
+ for (i = 1; i <= size; ++i) {
+ int rule_num = rule_linenum[assoc_rule[dset[i]]];
+
+ for (j = 1; j <= num_associated_rules; ++j)
+ if (rule_num == rule_set[j])
+ break;
+
+ if (j > num_associated_rules) { /* new rule */
+ if (num_associated_rules < MAX_ASSOC_RULES)
+ rule_set[++num_associated_rules] =
+ rule_num;
+ }
+ }
+
+ qsort (&rule_set [1], num_associated_rules, sizeof (rule_set [1]), intcmp);
+
+ fprintf (file, _(" associated rule line numbers:"));
+
+ for (i = 1; i <= num_associated_rules; ++i) {
+ if (i % 8 == 1)
+ putc ('\n', file);
+
+ fprintf (file, "\t%d", rule_set[i]);
+ }
+
+ putc ('\n', file);
+}
+
+
+/* dump_transitions - list the transitions associated with a DFA state
+ *
+ * synopsis
+ * dump_transitions( FILE *file, int state[numecs] );
+ *
+ * Goes through the set of out-transitions and lists them in human-readable
+ * form (i.e., not as equivalence classes); also lists jam transitions
+ * (i.e., all those which are not out-transitions, plus EOF). The dump
+ * is done to the given file.
+ */
+
+void dump_transitions (file, state)
+ FILE *file;
+ int state[];
+{
+ int i, ec;
+ int out_char_set[CSIZE];
+
+ for (i = 0; i < csize; ++i) {
+ ec = ABS (ecgroup[i]);
+ out_char_set[i] = state[ec];
+ }
+
+ fprintf (file, _(" out-transitions: "));
+
+ list_character_set (file, out_char_set);
+
+ /* now invert the members of the set to get the jam transitions */
+ for (i = 0; i < csize; ++i)
+ out_char_set[i] = !out_char_set[i];
+
+ fprintf (file, _("\n jam-transitions: EOF "));
+
+ list_character_set (file, out_char_set);
+
+ putc ('\n', file);
+}
+
+
+/* epsclosure - construct the epsilon closure of a set of ndfa states
+ *
+ * synopsis
+ * int *epsclosure( int t[num_states], int *numstates_addr,
+ * int accset[num_rules+1], int *nacc_addr,
+ * int *hashval_addr );
+ *
+ * NOTES
+ * The epsilon closure is the set of all states reachable by an arbitrary
+ * number of epsilon transitions, which themselves do not have epsilon
+ * transitions going out, unioned with the set of states which have non-null
+ * accepting numbers. t is an array of size numstates of nfa state numbers.
+ * Upon return, t holds the epsilon closure and *numstates_addr is updated.
+ * accset holds a list of the accepting numbers, and the size of accset is
+ * given by *nacc_addr. t may be subjected to reallocation if it is not
+ * large enough to hold the epsilon closure.
+ *
+ * hashval is the hash value for the dfa corresponding to the state set.
+ */
+
+int *epsclosure (t, ns_addr, accset, nacc_addr, hv_addr)
+ int *t, *ns_addr, accset[], *nacc_addr, *hv_addr;
+{
+ int stkpos, ns, tsp;
+ int numstates = *ns_addr, nacc, hashval, transsym, nfaccnum;
+ int stkend, nstate;
+ static int did_stk_init = false, *stk;
+
+#define MARK_STATE(state) \
+do{ trans1[state] = trans1[state] - MARKER_DIFFERENCE;} while(0)
+
+#define IS_MARKED(state) (trans1[state] < 0)
+
+#define UNMARK_STATE(state) \
+do{ trans1[state] = trans1[state] + MARKER_DIFFERENCE;} while(0)
+
+#define CHECK_ACCEPT(state) \
+do{ \
+nfaccnum = accptnum[state]; \
+if ( nfaccnum != NIL ) \
+accset[++nacc] = nfaccnum; \
+}while(0)
+
+#define DO_REALLOCATION() \
+do { \
+current_max_dfa_size += MAX_DFA_SIZE_INCREMENT; \
+++num_reallocs; \
+t = reallocate_integer_array( t, current_max_dfa_size ); \
+stk = reallocate_integer_array( stk, current_max_dfa_size ); \
+}while(0) \
+
+#define PUT_ON_STACK(state) \
+do { \
+if ( ++stkend >= current_max_dfa_size ) \
+DO_REALLOCATION(); \
+stk[stkend] = state; \
+MARK_STATE(state); \
+}while(0)
+
+#define ADD_STATE(state) \
+do { \
+if ( ++numstates >= current_max_dfa_size ) \
+DO_REALLOCATION(); \
+t[numstates] = state; \
+hashval += state; \
+}while(0)
+
+#define STACK_STATE(state) \
+do { \
+PUT_ON_STACK(state); \
+CHECK_ACCEPT(state); \
+if ( nfaccnum != NIL || transchar[state] != SYM_EPSILON ) \
+ADD_STATE(state); \
+}while(0)
+
+
+ if (!did_stk_init) {
+ stk = allocate_integer_array (current_max_dfa_size);
+ did_stk_init = true;
+ }
+
+ nacc = stkend = hashval = 0;
+
+ for (nstate = 1; nstate <= numstates; ++nstate) {
+ ns = t[nstate];
+
+ /* The state could be marked if we've already pushed it onto
+ * the stack.
+ */
+ if (!IS_MARKED (ns)) {
+ PUT_ON_STACK (ns);
+ CHECK_ACCEPT (ns);
+ hashval += ns;
+ }
+ }
+
+ for (stkpos = 1; stkpos <= stkend; ++stkpos) {
+ ns = stk[stkpos];
+ transsym = transchar[ns];
+
+ if (transsym == SYM_EPSILON) {
+ tsp = trans1[ns] + MARKER_DIFFERENCE;
+
+ if (tsp != NO_TRANSITION) {
+ if (!IS_MARKED (tsp))
+ STACK_STATE (tsp);
+
+ tsp = trans2[ns];
+
+ if (tsp != NO_TRANSITION
+ && !IS_MARKED (tsp))
+ STACK_STATE (tsp);
+ }
+ }
+ }
+
+ /* Clear out "visit" markers. */
+
+ for (stkpos = 1; stkpos <= stkend; ++stkpos) {
+ if (IS_MARKED (stk[stkpos]))
+ UNMARK_STATE (stk[stkpos]);
+ else
+ flexfatal (_
+ ("consistency check failed in epsclosure()"));
+ }
+
+ *ns_addr = numstates;
+ *hv_addr = hashval;
+ *nacc_addr = nacc;
+
+ return t;
+}
+
+
+/* increase_max_dfas - increase the maximum number of DFAs */
+
+void increase_max_dfas ()
+{
+ current_max_dfas += MAX_DFAS_INCREMENT;
+
+ ++num_reallocs;
+
+ base = reallocate_integer_array (base, current_max_dfas);
+ def = reallocate_integer_array (def, current_max_dfas);
+ dfasiz = reallocate_integer_array (dfasiz, current_max_dfas);
+ accsiz = reallocate_integer_array (accsiz, current_max_dfas);
+ dhash = reallocate_integer_array (dhash, current_max_dfas);
+ dss = reallocate_int_ptr_array (dss, current_max_dfas);
+ dfaacc = reallocate_dfaacc_union (dfaacc, current_max_dfas);
+
+ if (nultrans)
+ nultrans =
+ reallocate_integer_array (nultrans,
+ current_max_dfas);
+}
+
+
+/* ntod - convert an ndfa to a dfa
+ *
+ * Creates the dfa corresponding to the ndfa we've constructed. The
+ * dfa starts out in state #1.
+ */
+
+void ntod ()
+{
+ int *accset, ds, nacc, newds;
+ int sym, hashval, numstates, dsize;
+ int num_full_table_rows=0; /* used only for -f */
+ int *nset, *dset;
+ int targptr, totaltrans, i, comstate, comfreq, targ;
+ int symlist[CSIZE + 1];
+ int num_start_states;
+ int todo_head, todo_next;
+
+ struct yytbl_data *yynxt_tbl = 0;
+ flex_int32_t *yynxt_data = 0, yynxt_curr = 0;
+
+ /* Note that the following are indexed by *equivalence classes*
+ * and not by characters. Since equivalence classes are indexed
+ * beginning with 1, even if the scanner accepts NUL's, this
+ * means that (since every character is potentially in its own
+ * equivalence class) these arrays must have room for indices
+ * from 1 to CSIZE, so their size must be CSIZE + 1.
+ */
+ int duplist[CSIZE + 1], state[CSIZE + 1];
+ int targfreq[CSIZE + 1] = {0}, targstate[CSIZE + 1];
+
+ /* accset needs to be large enough to hold all of the rules present
+ * in the input, *plus* their YY_TRAILING_HEAD_MASK variants.
+ */
+ accset = allocate_integer_array ((num_rules + 1) * 2);
+ nset = allocate_integer_array (current_max_dfa_size);
+
+ /* The "todo" queue is represented by the head, which is the DFA
+ * state currently being processed, and the "next", which is the
+ * next DFA state number available (not in use). We depend on the
+ * fact that snstods() returns DFA's \in increasing order/, and thus
+ * need only know the bounds of the dfas to be processed.
+ */
+ todo_head = todo_next = 0;
+
+ for (i = 0; i <= csize; ++i) {
+ duplist[i] = NIL;
+ symlist[i] = false;
+ }
+
+ for (i = 0; i <= num_rules; ++i)
+ accset[i] = NIL;
+
+ if (trace) {
+ dumpnfa (scset[1]);
+ fputs (_("\n\nDFA Dump:\n\n"), stderr);
+ }
+
+ inittbl ();
+
+ /* Check to see whether we should build a separate table for
+ * transitions on NUL characters. We don't do this for full-speed
+ * (-F) scanners, since for them we don't have a simple state
+ * number lying around with which to index the table. We also
+ * don't bother doing it for scanners unless (1) NUL is in its own
+ * equivalence class (indicated by a positive value of
+ * ecgroup[NUL]), (2) NUL's equivalence class is the last
+ * equivalence class, and (3) the number of equivalence classes is
+ * the same as the number of characters. This latter case comes
+ * about when useecs is false or when it's true but every character
+ * still manages to land in its own class (unlikely, but it's
+ * cheap to check for). If all these things are true then the
+ * character code needed to represent NUL's equivalence class for
+ * indexing the tables is going to take one more bit than the
+ * number of characters, and therefore we won't be assured of
+ * being able to fit it into a YY_CHAR variable. This rules out
+ * storing the transitions in a compressed table, since the code
+ * for interpreting them uses a YY_CHAR variable (perhaps it
+ * should just use an integer, though; this is worth pondering ...
+ * ###).
+ *
+ * Finally, for full tables, we want the number of entries in the
+ * table to be a power of two so the array references go fast (it
+ * will just take a shift to compute the major index). If
+ * encoding NUL's transitions in the table will spoil this, we
+ * give it its own table (note that this will be the case if we're
+ * not using equivalence classes).
+ */
+
+ /* Note that the test for ecgroup[0] == numecs below accomplishes
+ * both (1) and (2) above
+ */
+ if (!fullspd && ecgroup[0] == numecs) {
+ /* NUL is alone in its equivalence class, which is the
+ * last one.
+ */
+ int use_NUL_table = (numecs == csize);
+
+ if (fulltbl && !use_NUL_table) {
+ /* We still may want to use the table if numecs
+ * is a power of 2.
+ */
+ int power_of_two;
+
+ for (power_of_two = 1; power_of_two <= csize;
+ power_of_two *= 2)
+ if (numecs == power_of_two) {
+ use_NUL_table = true;
+ break;
+ }
+ }
+
+ if (use_NUL_table)
+ nultrans =
+ allocate_integer_array (current_max_dfas);
+
+ /* From now on, nultrans != nil indicates that we're
+ * saving null transitions for later, separate encoding.
+ */
+ }
+
+
+ if (fullspd) {
+ for (i = 0; i <= numecs; ++i)
+ state[i] = 0;
+
+ place_state (state, 0, 0);
+ dfaacc[0].dfaacc_state = 0;
+ }
+
+ else if (fulltbl) {
+ if (nultrans)
+ /* We won't be including NUL's transitions in the
+ * table, so build it for entries from 0 .. numecs - 1.
+ */
+ num_full_table_rows = numecs;
+
+ else
+ /* Take into account the fact that we'll be including
+ * the NUL entries in the transition table. Build it
+ * from 0 .. numecs.
+ */
+ num_full_table_rows = numecs + 1;
+
+ /* Begin generating yy_nxt[][]
+ * This spans the entire LONG function.
+ * This table is tricky because we don't know how big it will be.
+ * So we'll have to realloc() on the way...
+ * we'll wait until we can calculate yynxt_tbl->td_hilen.
+ */
+ yynxt_tbl =
+ (struct yytbl_data *) calloc (1,
+ sizeof (struct
+ yytbl_data));
+ yytbl_data_init (yynxt_tbl, YYTD_ID_NXT);
+ yynxt_tbl->td_hilen = 1;
+ yynxt_tbl->td_lolen = num_full_table_rows;
+ yynxt_tbl->td_data = yynxt_data =
+ (flex_int32_t *) calloc (yynxt_tbl->td_lolen *
+ yynxt_tbl->td_hilen,
+ sizeof (flex_int32_t));
+ yynxt_curr = 0;
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
+ long_align ? "flex_int32_t" : "flex_int16_t");
+
+ /* Unless -Ca, declare it "short" because it's a real
+ * long-shot that that won't be large enough.
+ */
+ if (gentables)
+ out_str_dec
+ ("static yyconst %s yy_nxt[][%d] =\n {\n",
+ long_align ? "flex_int32_t" : "flex_int16_t",
+ num_full_table_rows);
+ else {
+ out_dec ("#undef YY_NXT_LOLEN\n#define YY_NXT_LOLEN (%d)\n", num_full_table_rows);
+ out_str ("static yyconst %s *yy_nxt =0;\n",
+ long_align ? "flex_int32_t" : "flex_int16_t");
+ }
+
+
+ if (gentables)
+ outn (" {");
+
+ /* Generate 0 entries for state #0. */
+ for (i = 0; i < num_full_table_rows; ++i) {
+ mk2data (0);
+ yynxt_data[yynxt_curr++] = 0;
+ }
+
+ dataflush ();
+ if (gentables)
+ outn (" },\n");
+ }
+
+ /* Create the first states. */
+
+ num_start_states = lastsc * 2;
+
+ for (i = 1; i <= num_start_states; ++i) {
+ numstates = 1;
+
+ /* For each start condition, make one state for the case when
+ * we're at the beginning of the line (the '^' operator) and
+ * one for the case when we're not.
+ */
+ if (i % 2 == 1)
+ nset[numstates] = scset[(i / 2) + 1];
+ else
+ nset[numstates] =
+ mkbranch (scbol[i / 2], scset[i / 2]);
+
+ nset = epsclosure (nset, &numstates, accset, &nacc,
+ &hashval);
+
+ if (snstods (nset, numstates, accset, nacc, hashval, &ds)) {
+ numas += nacc;
+ totnst += numstates;
+ ++todo_next;
+
+ if (variable_trailing_context_rules && nacc > 0)
+ check_trailing_context (nset, numstates,
+ accset, nacc);
+ }
+ }
+
+ if (!fullspd) {
+ if (!snstods (nset, 0, accset, 0, 0, &end_of_buffer_state))
+ flexfatal (_
+ ("could not create unique end-of-buffer state"));
+
+ ++numas;
+ ++num_start_states;
+ ++todo_next;
+ }
+
+
+ while (todo_head < todo_next) {
+ targptr = 0;
+ totaltrans = 0;
+
+ for (i = 1; i <= numecs; ++i)
+ state[i] = 0;
+
+ ds = ++todo_head;
+
+ dset = dss[ds];
+ dsize = dfasiz[ds];
+
+ if (trace)
+ fprintf (stderr, _("state # %d:\n"), ds);
+
+ sympartition (dset, dsize, symlist, duplist);
+
+ for (sym = 1; sym <= numecs; ++sym) {
+ if (symlist[sym]) {
+ symlist[sym] = 0;
+
+ if (duplist[sym] == NIL) {
+ /* Symbol has unique out-transitions. */
+ numstates =
+ symfollowset (dset, dsize,
+ sym, nset);
+ nset = epsclosure (nset,
+ &numstates,
+ accset, &nacc,
+ &hashval);
+
+ if (snstods
+ (nset, numstates, accset, nacc,
+ hashval, &newds)) {
+ totnst = totnst +
+ numstates;
+ ++todo_next;
+ numas += nacc;
+
+ if (variable_trailing_context_rules && nacc > 0)
+ check_trailing_context
+ (nset,
+ numstates,
+ accset,
+ nacc);
+ }
+
+ state[sym] = newds;
+
+ if (trace)
+ fprintf (stderr,
+ "\t%d\t%d\n", sym,
+ newds);
+
+ targfreq[++targptr] = 1;
+ targstate[targptr] = newds;
+ ++numuniq;
+ }
+
+ else {
+ /* sym's equivalence class has the same
+ * transitions as duplist(sym)'s
+ * equivalence class.
+ */
+ targ = state[duplist[sym]];
+ state[sym] = targ;
+
+ if (trace)
+ fprintf (stderr,
+ "\t%d\t%d\n", sym,
+ targ);
+
+ /* Update frequency count for
+ * destination state.
+ */
+
+ i = 0;
+ while (targstate[++i] != targ) ;
+
+ ++targfreq[i];
+ ++numdup;
+ }
+
+ ++totaltrans;
+ duplist[sym] = NIL;
+ }
+ }
+
+
+ numsnpairs += totaltrans;
+
+ if (ds > num_start_states)
+ check_for_backing_up (ds, state);
+
+ if (nultrans) {
+ nultrans[ds] = state[NUL_ec];
+ state[NUL_ec] = 0; /* remove transition */
+ }
+
+ if (fulltbl) {
+
+ /* Each time we hit here, it's another td_hilen, so we realloc. */
+ yynxt_tbl->td_hilen++;
+ yynxt_tbl->td_data = yynxt_data =
+ (flex_int32_t *) realloc (yynxt_data,
+ yynxt_tbl->td_hilen *
+ yynxt_tbl->td_lolen *
+ sizeof (flex_int32_t));
+
+
+ if (gentables)
+ outn (" {");
+
+ /* Supply array's 0-element. */
+ if (ds == end_of_buffer_state) {
+ mk2data (-end_of_buffer_state);
+ yynxt_data[yynxt_curr++] =
+ -end_of_buffer_state;
+ }
+ else {
+ mk2data (end_of_buffer_state);
+ yynxt_data[yynxt_curr++] =
+ end_of_buffer_state;
+ }
+
+ for (i = 1; i < num_full_table_rows; ++i) {
+ /* Jams are marked by negative of state
+ * number.
+ */
+ mk2data (state[i] ? state[i] : -ds);
+ yynxt_data[yynxt_curr++] =
+ state[i] ? state[i] : -ds;
+ }
+
+ dataflush ();
+ if (gentables)
+ outn (" },\n");
+ }
+
+ else if (fullspd)
+ place_state (state, ds, totaltrans);
+
+ else if (ds == end_of_buffer_state)
+ /* Special case this state to make sure it does what
+ * it's supposed to, i.e., jam on end-of-buffer.
+ */
+ stack1 (ds, 0, 0, JAMSTATE);
+
+ else { /* normal, compressed state */
+
+ /* Determine which destination state is the most
+ * common, and how many transitions to it there are.
+ */
+
+ comfreq = 0;
+ comstate = 0;
+
+ for (i = 1; i <= targptr; ++i)
+ if (targfreq[i] > comfreq) {
+ comfreq = targfreq[i];
+ comstate = targstate[i];
+ }
+
+ bldtbl (state, ds, totaltrans, comstate, comfreq);
+ }
+ }
+
+ if (fulltbl) {
+ dataend ();
+ if (tablesext) {
+ yytbl_data_compress (yynxt_tbl);
+ if (yytbl_data_fwrite (&tableswr, yynxt_tbl) < 0)
+ flexerror (_
+ ("Could not write yynxt_tbl[][]"));
+ }
+ if (yynxt_tbl) {
+ yytbl_data_destroy (yynxt_tbl);
+ yynxt_tbl = 0;
+ }
+ }
+
+ else if (!fullspd) {
+ cmptmps (); /* create compressed template entries */
+
+ /* Create tables for all the states with only one
+ * out-transition.
+ */
+ while (onesp > 0) {
+ mk1tbl (onestate[onesp], onesym[onesp],
+ onenext[onesp], onedef[onesp]);
+ --onesp;
+ }
+
+ mkdeftbl ();
+ }
+
+ flex_free ((void *) accset);
+ flex_free ((void *) nset);
+}
+
+
+/* snstods - converts a set of ndfa states into a dfa state
+ *
+ * synopsis
+ * is_new_state = snstods( int sns[numstates], int numstates,
+ * int accset[num_rules+1], int nacc,
+ * int hashval, int *newds_addr );
+ *
+ * On return, the dfa state number is in newds.
+ */
+
+int snstods (sns, numstates, accset, nacc, hashval, newds_addr)
+ int sns[], numstates, accset[], nacc, hashval, *newds_addr;
+{
+ int didsort = 0;
+ int i, j;
+ int newds, *oldsns;
+
+ for (i = 1; i <= lastdfa; ++i)
+ if (hashval == dhash[i]) {
+ if (numstates == dfasiz[i]) {
+ oldsns = dss[i];
+
+ if (!didsort) {
+ /* We sort the states in sns so we
+ * can compare it to oldsns quickly.
+ */
+ qsort (&sns [1], numstates, sizeof (sns [1]), intcmp);
+ didsort = 1;
+ }
+
+ for (j = 1; j <= numstates; ++j)
+ if (sns[j] != oldsns[j])
+ break;
+
+ if (j > numstates) {
+ ++dfaeql;
+ *newds_addr = i;
+ return 0;
+ }
+
+ ++hshcol;
+ }
+
+ else
+ ++hshsave;
+ }
+
+ /* Make a new dfa. */
+
+ if (++lastdfa >= current_max_dfas)
+ increase_max_dfas ();
+
+ newds = lastdfa;
+
+ dss[newds] = allocate_integer_array (numstates + 1);
+
+ /* If we haven't already sorted the states in sns, we do so now,
+ * so that future comparisons with it can be made quickly.
+ */
+
+ if (!didsort)
+ qsort (&sns [1], numstates, sizeof (sns [1]), intcmp);
+
+ for (i = 1; i <= numstates; ++i)
+ dss[newds][i] = sns[i];
+
+ dfasiz[newds] = numstates;
+ dhash[newds] = hashval;
+
+ if (nacc == 0) {
+ if (reject)
+ dfaacc[newds].dfaacc_set = (int *) 0;
+ else
+ dfaacc[newds].dfaacc_state = 0;
+
+ accsiz[newds] = 0;
+ }
+
+ else if (reject) {
+ /* We sort the accepting set in increasing order so the
+ * disambiguating rule that the first rule listed is considered
+ * match in the event of ties will work.
+ */
+
+ qsort (&accset [1], nacc, sizeof (accset [1]), intcmp);
+
+ dfaacc[newds].dfaacc_set =
+ allocate_integer_array (nacc + 1);
+
+ /* Save the accepting set for later */
+ for (i = 1; i <= nacc; ++i) {
+ dfaacc[newds].dfaacc_set[i] = accset[i];
+
+ if (accset[i] <= num_rules)
+ /* Who knows, perhaps a REJECT can yield
+ * this rule.
+ */
+ rule_useful[accset[i]] = true;
+ }
+
+ accsiz[newds] = nacc;
+ }
+
+ else {
+ /* Find lowest numbered rule so the disambiguating rule
+ * will work.
+ */
+ j = num_rules + 1;
+
+ for (i = 1; i <= nacc; ++i)
+ if (accset[i] < j)
+ j = accset[i];
+
+ dfaacc[newds].dfaacc_state = j;
+
+ if (j <= num_rules)
+ rule_useful[j] = true;
+ }
+
+ *newds_addr = newds;
+
+ return 1;
+}
+
+
+/* symfollowset - follow the symbol transitions one step
+ *
+ * synopsis
+ * numstates = symfollowset( int ds[current_max_dfa_size], int dsize,
+ * int transsym, int nset[current_max_dfa_size] );
+ */
+
+int symfollowset (ds, dsize, transsym, nset)
+ int ds[], dsize, transsym, nset[];
+{
+ int ns, tsp, sym, i, j, lenccl, ch, numstates, ccllist;
+
+ numstates = 0;
+
+ for (i = 1; i <= dsize; ++i) { /* for each nfa state ns in the state set of ds */
+ ns = ds[i];
+ sym = transchar[ns];
+ tsp = trans1[ns];
+
+ if (sym < 0) { /* it's a character class */
+ sym = -sym;
+ ccllist = cclmap[sym];
+ lenccl = ccllen[sym];
+
+ if (cclng[sym]) {
+ for (j = 0; j < lenccl; ++j) {
+ /* Loop through negated character
+ * class.
+ */
+ ch = ccltbl[ccllist + j];
+
+ if (ch == 0)
+ ch = NUL_ec;
+
+ if (ch > transsym)
+ /* Transsym isn't in negated
+ * ccl.
+ */
+ break;
+
+ else if (ch == transsym)
+ /* next 2 */
+ goto bottom;
+ }
+
+ /* Didn't find transsym in ccl. */
+ nset[++numstates] = tsp;
+ }
+
+ else
+ for (j = 0; j < lenccl; ++j) {
+ ch = ccltbl[ccllist + j];
+
+ if (ch == 0)
+ ch = NUL_ec;
+
+ if (ch > transsym)
+ break;
+ else if (ch == transsym) {
+ nset[++numstates] = tsp;
+ break;
+ }
+ }
+ }
+
+ else if (sym == SYM_EPSILON) { /* do nothing */
+ }
+
+ else if (ABS (ecgroup[sym]) == transsym)
+ nset[++numstates] = tsp;
+
+ bottom:;
+ }
+
+ return numstates;
+}
+
+
+/* sympartition - partition characters with same out-transitions
+ *
+ * synopsis
+ * sympartition( int ds[current_max_dfa_size], int numstates,
+ * int symlist[numecs], int duplist[numecs] );
+ */
+
+void sympartition (ds, numstates, symlist, duplist)
+ int ds[], numstates;
+ int symlist[], duplist[];
+{
+ int tch, i, j, k, ns, dupfwd[CSIZE + 1], lenccl, cclp, ich;
+
+ /* Partitioning is done by creating equivalence classes for those
+ * characters which have out-transitions from the given state. Thus
+ * we are really creating equivalence classes of equivalence classes.
+ */
+
+ for (i = 1; i <= numecs; ++i) { /* initialize equivalence class list */
+ duplist[i] = i - 1;
+ dupfwd[i] = i + 1;
+ }
+
+ duplist[1] = NIL;
+ dupfwd[numecs] = NIL;
+
+ for (i = 1; i <= numstates; ++i) {
+ ns = ds[i];
+ tch = transchar[ns];
+
+ if (tch != SYM_EPSILON) {
+ if (tch < -lastccl || tch >= csize) {
+ flexfatal (_
+ ("bad transition character detected in sympartition()"));
+ }
+
+ if (tch >= 0) { /* character transition */
+ int ec = ecgroup[tch];
+
+ mkechar (ec, dupfwd, duplist);
+ symlist[ec] = 1;
+ }
+
+ else { /* character class */
+ tch = -tch;
+
+ lenccl = ccllen[tch];
+ cclp = cclmap[tch];
+ mkeccl (ccltbl + cclp, lenccl, dupfwd,
+ duplist, numecs, NUL_ec);
+
+ if (cclng[tch]) {
+ j = 0;
+
+ for (k = 0; k < lenccl; ++k) {
+ ich = ccltbl[cclp + k];
+
+ if (ich == 0)
+ ich = NUL_ec;
+
+ for (++j; j < ich; ++j)
+ symlist[j] = 1;
+ }
+
+ for (++j; j <= numecs; ++j)
+ symlist[j] = 1;
+ }
+
+ else
+ for (k = 0; k < lenccl; ++k) {
+ ich = ccltbl[cclp + k];
+
+ if (ich == 0)
+ ich = NUL_ec;
+
+ symlist[ich] = 1;
+ }
+ }
+ }
+ }
+}
diff --git a/src/ecs.c b/src/ecs.c
new file mode 100644
index 0000000..b206351
--- /dev/null
+++ b/src/ecs.c
@@ -0,0 +1,219 @@
+/* ecs - equivalence class routines */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+
+#include "flexdef.h"
+
+/* ccl2ecl - convert character classes to set of equivalence classes */
+
+void ccl2ecl ()
+{
+ int i, ich, newlen, cclp, ccls, cclmec;
+
+ for (i = 1; i <= lastccl; ++i) {
+ /* We loop through each character class, and for each character
+ * in the class, add the character's equivalence class to the
+ * new "character" class we are creating. Thus when we are all
+ * done, character classes will really consist of collections
+ * of equivalence classes
+ */
+
+ newlen = 0;
+ cclp = cclmap[i];
+
+ for (ccls = 0; ccls < ccllen[i]; ++ccls) {
+ ich = ccltbl[cclp + ccls];
+ cclmec = ecgroup[ich];
+
+ if (cclmec > 0) {
+ ccltbl[cclp + newlen] = cclmec;
+ ++newlen;
+ }
+ }
+
+ ccllen[i] = newlen;
+ }
+}
+
+
+/* cre8ecs - associate equivalence class numbers with class members
+ *
+ * fwd is the forward linked-list of equivalence class members. bck
+ * is the backward linked-list, and num is the number of class members.
+ *
+ * Returned is the number of classes.
+ */
+
+int cre8ecs (fwd, bck, num)
+ int fwd[], bck[], num;
+{
+ int i, j, numcl;
+
+ numcl = 0;
+
+ /* Create equivalence class numbers. From now on, ABS( bck(x) )
+ * is the equivalence class number for object x. If bck(x)
+ * is positive, then x is the representative of its equivalence
+ * class.
+ */
+ for (i = 1; i <= num; ++i)
+ if (bck[i] == NIL) {
+ bck[i] = ++numcl;
+ for (j = fwd[i]; j != NIL; j = fwd[j])
+ bck[j] = -numcl;
+ }
+
+ return numcl;
+}
+
+
+/* mkeccl - update equivalence classes based on character class xtions
+ *
+ * synopsis
+ * Char ccls[];
+ * int lenccl, fwd[llsiz], bck[llsiz], llsiz, NUL_mapping;
+ * void mkeccl( Char ccls[], int lenccl, int fwd[llsiz], int bck[llsiz],
+ * int llsiz, int NUL_mapping );
+ *
+ * ccls contains the elements of the character class, lenccl is the
+ * number of elements in the ccl, fwd is the forward link-list of equivalent
+ * characters, bck is the backward link-list, and llsiz size of the link-list.
+ *
+ * NUL_mapping is the value which NUL (0) should be mapped to.
+ */
+
+void mkeccl (ccls, lenccl, fwd, bck, llsiz, NUL_mapping)
+ Char ccls[];
+ int lenccl, fwd[], bck[], llsiz, NUL_mapping;
+{
+ int cclp, oldec, newec;
+ int cclm, i, j;
+ static unsigned char cclflags[CSIZE]; /* initialized to all '\0' */
+
+ /* Note that it doesn't matter whether or not the character class is
+ * negated. The same results will be obtained in either case.
+ */
+
+ cclp = 0;
+
+ while (cclp < lenccl) {
+ cclm = ccls[cclp];
+
+ if (NUL_mapping && cclm == 0)
+ cclm = NUL_mapping;
+
+ oldec = bck[cclm];
+ newec = cclm;
+
+ j = cclp + 1;
+
+ for (i = fwd[cclm]; i != NIL && i <= llsiz; i = fwd[i]) { /* look for the symbol in the character class */
+ for (; j < lenccl; ++j) {
+ int ccl_char;
+
+ if (NUL_mapping && ccls[j] == 0)
+ ccl_char = NUL_mapping;
+ else
+ ccl_char = ccls[j];
+
+ if (ccl_char > i)
+ break;
+
+ if (ccl_char == i && !cclflags[j]) {
+ /* We found an old companion of cclm
+ * in the ccl. Link it into the new
+ * equivalence class and flag it as
+ * having been processed.
+ */
+
+ bck[i] = newec;
+ fwd[newec] = i;
+ newec = i;
+ /* Set flag so we don't reprocess. */
+ cclflags[j] = 1;
+
+ /* Get next equivalence class member. */
+ /* continue 2 */
+ goto next_pt;
+ }
+ }
+
+ /* Symbol isn't in character class. Put it in the old
+ * equivalence class.
+ */
+
+ bck[i] = oldec;
+
+ if (oldec != NIL)
+ fwd[oldec] = i;
+
+ oldec = i;
+
+ next_pt:;
+ }
+
+ if (bck[cclm] != NIL || oldec != bck[cclm]) {
+ bck[cclm] = NIL;
+ fwd[oldec] = NIL;
+ }
+
+ fwd[newec] = NIL;
+
+ /* Find next ccl member to process. */
+
+ for (++cclp; cclp < lenccl && cclflags[cclp]; ++cclp) {
+ /* Reset "doesn't need processing" flag. */
+ cclflags[cclp] = 0;
+ }
+ }
+}
+
+
+/* mkechar - create equivalence class for single character */
+
+void mkechar (tch, fwd, bck)
+ int tch, fwd[], bck[];
+{
+ /* If until now the character has been a proper subset of
+ * an equivalence class, break it away to create a new ec
+ */
+
+ if (fwd[tch] != NIL)
+ bck[fwd[tch]] = bck[tch];
+
+ if (bck[tch] != NIL)
+ fwd[bck[tch]] = fwd[tch];
+
+ fwd[tch] = NIL;
+ bck[tch] = NIL;
+}
diff --git a/src/filter.c b/src/filter.c
new file mode 100644
index 0000000..987366a
--- /dev/null
+++ b/src/filter.c
@@ -0,0 +1,439 @@
+/* filter - postprocessing of flex output through filters */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+static const char * check_4_gnu_m4 =
+ "m4_dnl ifdef(`__gnu__', ,"
+ "`errprint(Flex requires GNU M4. Set the PATH or set the M4 environment variable to its path name.)"
+ " m4exit(2)')\n";
+
+
+/** global chain. */
+struct filter *output_chain = NULL;
+
+/* Allocate and initialize an external filter.
+ * @param chain the current chain or NULL for new chain
+ * @param cmd the command to execute.
+ * @param ... a NULL terminated list of (const char*) arguments to command,
+ * not including argv[0].
+ * @return newest filter in chain
+ */
+struct filter *filter_create_ext (struct filter *chain, const char *cmd,
+ ...)
+{
+ struct filter *f;
+ int max_args;
+ const char *s;
+ va_list ap;
+
+ /* allocate and initialize new filter */
+ f = (struct filter *) flex_alloc (sizeof (struct filter));
+ if (!f)
+ flexerror (_("flex_alloc failed (f) in filter_create_ext"));
+ memset (f, 0, sizeof (*f));
+ f->filter_func = NULL;
+ f->extra = NULL;
+ f->next = NULL;
+ f->argc = 0;
+
+ if (chain != NULL) {
+ /* append f to end of chain */
+ while (chain->next)
+ chain = chain->next;
+ chain->next = f;
+ }
+
+
+ /* allocate argv, and populate it with the argument list. */
+ max_args = 8;
+ f->argv =
+ (const char **) flex_alloc (sizeof (char *) *
+ (max_args + 1));
+ if (!f->argv)
+ flexerror (_("flex_alloc failed (f->argv) in filter_create_ext"));
+ f->argv[f->argc++] = cmd;
+
+ va_start (ap, cmd);
+ while ((s = va_arg (ap, const char *)) != NULL) {
+ if (f->argc >= max_args) {
+ max_args += 8;
+ f->argv =
+ (const char **) flex_realloc (f->argv,
+ sizeof (char
+ *) *
+ (max_args +
+ 1));
+ }
+ f->argv[f->argc++] = s;
+ }
+ f->argv[f->argc] = NULL;
+
+ va_end (ap);
+ return f;
+}
+
+/* Allocate and initialize an internal filter.
+ * @param chain the current chain or NULL for new chain
+ * @param filter_func The function that will perform the filtering.
+ * filter_func should return 0 if successful, and -1
+ * if an error occurs -- or it can simply exit().
+ * @param extra optional user-defined data to pass to the filter.
+ * @return newest filter in chain
+ */
+struct filter *filter_create_int (struct filter *chain,
+ int (*filter_func) (struct filter *),
+ void *extra)
+{
+ struct filter *f;
+
+ /* allocate and initialize new filter */
+ f = (struct filter *) flex_alloc (sizeof (struct filter));
+ if (!f)
+ flexerror (_("flex_alloc failed in filter_create_int"));
+ memset (f, 0, sizeof (*f));
+ f->next = NULL;
+ f->argc = 0;
+ f->argv = NULL;
+
+ f->filter_func = filter_func;
+ f->extra = extra;
+
+ if (chain != NULL) {
+ /* append f to end of chain */
+ while (chain->next)
+ chain = chain->next;
+ chain->next = f;
+ }
+
+ return f;
+}
+
+/** Fork and exec entire filter chain.
+ * @param chain The head of the chain.
+ * @return true on success.
+ */
+bool filter_apply_chain (struct filter * chain)
+{
+ int pid, pipes[2];
+
+
+ /* Tricky recursion, since we want to begin the chain
+ * at the END. Why? Because we need all the forked processes
+ * to be children of the main flex process.
+ */
+ if (chain)
+ filter_apply_chain (chain->next);
+ else
+ return true;
+
+ /* Now we are the right-most unprocessed link in the chain.
+ */
+
+ fflush (stdout);
+ fflush (stderr);
+
+
+ if (pipe (pipes) == -1)
+ flexerror (_("pipe failed"));
+
+ if ((pid = fork ()) == -1)
+ flexerror (_("fork failed"));
+
+ if (pid == 0) {
+ /* child */
+
+ /* We need stdin (the FILE* stdin) to connect to this new pipe.
+ * There is no portable way to set stdin to a new file descriptor,
+ * as stdin is not an lvalue on some systems (BSD).
+ * So we dup the new pipe onto the stdin descriptor and use a no-op fseek
+ * to sync the stream. This is a Hail Mary situation. It seems to work.
+ */
+ close (pipes[1]);
+clearerr(stdin);
+ if (dup2 (pipes[0], fileno (stdin)) == -1)
+ flexfatal (_("dup2(pipes[0],0)"));
+ close (pipes[0]);
+ fseek (stdin, 0, SEEK_CUR);
+
+ /* run as a filter, either internally or by exec */
+ if (chain->filter_func) {
+ int r;
+
+ if ((r = chain->filter_func (chain)) == -1)
+ flexfatal (_("filter_func failed"));
+ exit (0);
+ }
+ else {
+ execvp (chain->argv[0],
+ (char **const) (chain->argv));
+ lerr_fatal ( _("exec of %s failed"),
+ chain->argv[0]);
+ }
+
+ exit (1);
+ }
+
+ /* Parent */
+ close (pipes[0]);
+ if (dup2 (pipes[1], fileno (stdout)) == -1)
+ flexfatal (_("dup2(pipes[1],1)"));
+ close (pipes[1]);
+ fseek (stdout, 0, SEEK_CUR);
+
+ return true;
+}
+
+/** Truncate the chain to max_len number of filters.
+ * @param chain the current chain.
+ * @param max_len the maximum length of the chain.
+ * @return the resulting length of the chain.
+ */
+int filter_truncate (struct filter *chain, int max_len)
+{
+ int len = 1;
+
+ if (!chain)
+ return 0;
+
+ while (chain->next && len < max_len) {
+ chain = chain->next;
+ ++len;
+ }
+
+ chain->next = NULL;
+ return len;
+}
+
+/** Splits the chain in order to write to a header file.
+ * Similar in spirit to the 'tee' program.
+ * The header file name is in extra.
+ * @return 0 (zero) on success, and -1 on failure.
+ */
+int filter_tee_header (struct filter *chain)
+{
+ /* This function reads from stdin and writes to both the C file and the
+ * header file at the same time.
+ */
+
+ const int readsz = 512;
+ char *buf;
+ int to_cfd = -1;
+ FILE *to_c = NULL, *to_h = NULL;
+ bool write_header;
+
+ write_header = (chain->extra != NULL);
+
+ /* Store a copy of the stdout pipe, which is already piped to C file
+ * through the running chain. Then create a new pipe to the H file as
+ * stdout, and fork the rest of the chain again.
+ */
+
+ if ((to_cfd = dup (1)) == -1)
+ flexfatal (_("dup(1) failed"));
+ to_c = fdopen (to_cfd, "w");
+
+ if (write_header) {
+ if (freopen ((char *) chain->extra, "w", stdout) == NULL)
+ flexfatal (_("freopen(headerfilename) failed"));
+
+ filter_apply_chain (chain->next);
+ to_h = stdout;
+ }
+
+ /* Now to_c is a pipe to the C branch, and to_h is a pipe to the H branch.
+ */
+
+ if (write_header) {
+ fputs (check_4_gnu_m4, to_h);
+ fputs ("m4_changecom`'m4_dnl\n", to_h);
+ fputs ("m4_changequote`'m4_dnl\n", to_h);
+ fputs ("m4_changequote([[,]])[[]]m4_dnl\n", to_h);
+ fputs ("m4_define([[M4_YY_NOOP]])[[]]m4_dnl\n", to_h);
+ fputs ("m4_define( [[M4_YY_IN_HEADER]],[[]])m4_dnl\n",
+ to_h);
+ fprintf (to_h, "#ifndef %sHEADER_H\n", prefix);
+ fprintf (to_h, "#define %sHEADER_H 1\n", prefix);
+ fprintf (to_h, "#define %sIN_HEADER 1\n\n", prefix);
+ fprintf (to_h,
+ "m4_define( [[M4_YY_OUTFILE_NAME]],[[%s]])m4_dnl\n",
+ headerfilename ? headerfilename : "<stdout>");
+
+ }
+
+ fputs (check_4_gnu_m4, to_c);
+ fputs ("m4_changecom`'m4_dnl\n", to_c);
+ fputs ("m4_changequote`'m4_dnl\n", to_c);
+ fputs ("m4_changequote([[,]])[[]]m4_dnl\n", to_c);
+ fputs ("m4_define([[M4_YY_NOOP]])[[]]m4_dnl\n", to_c);
+ fprintf (to_c, "m4_define( [[M4_YY_OUTFILE_NAME]],[[%s]])m4_dnl\n",
+ outfilename ? outfilename : "<stdout>");
+
+ buf = (char *) flex_alloc (readsz);
+ if (!buf)
+ flexerror (_("flex_alloc failed in filter_tee_header"));
+ while (fgets (buf, readsz, stdin)) {
+ fputs (buf, to_c);
+ if (write_header)
+ fputs (buf, to_h);
+ }
+
+ if (write_header) {
+ fprintf (to_h, "\n");
+
+ /* write a fake line number. It will get fixed by the linedir filter. */
+ fprintf (to_h, "#line 4000 \"M4_YY_OUTFILE_NAME\"\n");
+
+ fprintf (to_h, "#undef %sIN_HEADER\n", prefix);
+ fprintf (to_h, "#endif /* %sHEADER_H */\n", prefix);
+ fputs ("m4_undefine( [[M4_YY_IN_HEADER]])m4_dnl\n", to_h);
+
+ fflush (to_h);
+ if (ferror (to_h))
+ lerr (_("error writing output file %s"),
+ (char *) chain->extra);
+
+ else if (fclose (to_h))
+ lerr (_("error closing output file %s"),
+ (char *) chain->extra);
+ }
+
+ fflush (to_c);
+ if (ferror (to_c))
+ lerr (_("error writing output file %s"),
+ outfilename ? outfilename : "<stdout>");
+
+ else if (fclose (to_c))
+ lerr (_("error closing output file %s"),
+ outfilename ? outfilename : "<stdout>");
+
+ while (wait (0) > 0) ;
+
+ exit (0);
+ return 0;
+}
+
+/** Adjust the line numbers in the #line directives of the generated scanner.
+ * After the m4 expansion, the line numbers are incorrect since the m4 macros
+ * can add or remove lines. This only adjusts line numbers for generated code,
+ * not user code. This also happens to be a good place to squeeze multiple
+ * blank lines into a single blank line.
+ */
+int filter_fix_linedirs (struct filter *chain)
+{
+ char *buf;
+ const int readsz = 512;
+ int lineno = 1;
+ bool in_gen = true; /* in generated code */
+ bool last_was_blank = false;
+
+ if (!chain)
+ return 0;
+
+ buf = (char *) flex_alloc (readsz);
+ if (!buf)
+ flexerror (_("flex_alloc failed in filter_fix_linedirs"));
+
+ while (fgets (buf, readsz, stdin)) {
+
+ regmatch_t m[10];
+
+ /* Check for #line directive. */
+ if (buf[0] == '#'
+ && regexec (&regex_linedir, buf, 3, m, 0) == 0) {
+
+ char *fname;
+
+ /* extract the line number and filename */
+ fname = regmatch_dup (&m[2], buf);
+
+ if (strcmp (fname,
+ outfilename ? outfilename : "<stdout>")
+ == 0
+ || strcmp (fname,
+ headerfilename ? headerfilename : "<stdout>")
+ == 0) {
+
+ char *s1, *s2;
+ char filename[MAXLINE];
+
+ s1 = fname;
+ s2 = filename;
+
+ while ((s2 - filename) < (MAXLINE - 1) && *s1) {
+ /* Escape the backslash */
+ if (*s1 == '\\')
+ *s2++ = '\\';
+ /* Escape the double quote */
+ if (*s1 == '\"')
+ *s2++ = '\\';
+ /* Copy the character as usual */
+ *s2++ = *s1++;
+ }
+
+ *s2 = '\0';
+
+ /* Adjust the line directives. */
+ in_gen = true;
+ snprintf (buf, readsz, "#line %d \"%s\"\n",
+ lineno + 1, filename);
+ }
+ else {
+ /* it's a #line directive for code we didn't write */
+ in_gen = false;
+ }
+
+ free (fname);
+ last_was_blank = false;
+ }
+
+ /* squeeze blank lines from generated code */
+ else if (in_gen
+ && regexec (&regex_blank_line, buf, 0, NULL,
+ 0) == 0) {
+ if (last_was_blank)
+ continue;
+ else
+ last_was_blank = true;
+ }
+
+ else {
+ /* it's a line of normal, non-empty code. */
+ last_was_blank = false;
+ }
+
+ fputs (buf, stdout);
+ lineno++;
+ }
+ fflush (stdout);
+ if (ferror (stdout))
+ lerr (_("error writing output file %s"),
+ outfilename ? outfilename : "<stdout>");
+
+ else if (fclose (stdout))
+ lerr (_("error closing output file %s"),
+ outfilename ? outfilename : "<stdout>");
+
+ return 0;
+}
+
+/* vim:set expandtab cindent tabstop=4 softtabstop=4 shiftwidth=4 textwidth=0: */
diff --git a/src/flex.skl b/src/flex.skl
new file mode 100644
index 0000000..73a0b9e
--- /dev/null
+++ b/src/flex.skl
@@ -0,0 +1,3552 @@
+%# -*-C-*- vi: set ft=c:
+%# This file is processed in several stages.
+%# Here are the stages, as best as I can describe:
+%#
+%# 1. flex.skl is processed through GNU m4 during the
+%# pre-compilation stage of flex. Only macros starting
+%# with `m4preproc_' are processed, and quoting is normal.
+%#
+%# 2. The preprocessed skeleton is translated verbatim into a
+%# C array, saved as "skel.c" and compiled into the flex binary.
+%#
+%# 3. At runtime, the skeleton is generated and filtered (again)
+%# through m4. Macros beginning with `m4_' will be processed.
+%# The quoting is "[[" and "]]" so we don't interfere with
+%# user code.
+%#
+%# All generate macros for the m4 stage contain the text "m4" or "M4"
+%# in them. This is to distinguish them from CPP macros.
+%# The exception to this rule is YY_G, which is an m4 macro,
+%# but it needs to be remain short because it is used everywhere.
+%#
+/* A lexical scanner generated by flex */
+
+%# Macros for preproc stage.
+m4preproc_changecom
+
+%# Macros for runtime processing stage.
+m4_changecom
+m4_changequote
+m4_changequote([[, ]])
+
+%#
+%# Lines in this skeleton starting with a "%" character are "control lines"
+%# and affect the generation of the scanner. The possible control codes are
+%# listed and processed in misc.c.
+%#
+%# %# - A comment. The current line is omitted from the generated scanner.
+%# %if-c++-only - The following lines are printed for C++ scanners ONLY.
+%# %if-c-only - The following lines are NOT printed for C++ scanners.
+%# %if-c-or-c++ - The following lines are printed in BOTH C and C++ scanners.
+%# %if-reentrant - Print for reentrant scanners.(push)
+%# %if-not-reentrant - Print for non-reentrant scanners. (push)
+%# %if-bison-bridge - Print for bison-bridge. (push)
+%# %if-not-bison-bridge - Print for non-bison-bridge. (push)
+%# %endif - pop from the previous if code.
+%# %% - A stop-point, where code is inserted by flex.
+%# Each stop-point is numbered here and also in the code generator.
+%# (See gen.c, etc. for details.)
+%# %not-for-header - Begin code that should NOT appear in a ".h" file.
+%# %ok-for-header - %c and %e are used for building a header file.
+%# %if-tables-serialization
+%#
+%# All control-lines EXCEPT comment lines ("%#") will be inserted into
+%# the generated scanner as a C-style comment. This is to aid those who
+%# edit the skeleton.
+%#
+
+%not-for-header
+%if-c-only
+%if-not-reentrant
+m4_ifelse(M4_YY_PREFIX,yy,,
+#define yy_create_buffer M4_YY_PREFIX[[_create_buffer]]
+#define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]]
+#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]
+#define yy_init_buffer M4_YY_PREFIX[[_init_buffer]]
+#define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]]
+#define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]]
+#define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]]
+#define yyin M4_YY_PREFIX[[in]]
+#define yyleng M4_YY_PREFIX[[leng]]
+#define yylex M4_YY_PREFIX[[lex]]
+#define yylineno M4_YY_PREFIX[[lineno]]
+#define yyout M4_YY_PREFIX[[out]]
+#define yyrestart M4_YY_PREFIX[[restart]]
+#define yytext M4_YY_PREFIX[[text]]
+#define yywrap M4_YY_PREFIX[[wrap]]
+#define yyalloc M4_YY_PREFIX[[alloc]]
+#define yyrealloc M4_YY_PREFIX[[realloc]]
+#define yyfree M4_YY_PREFIX[[free]]
+)
+%endif
+%endif
+%ok-for-header
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION FLEX_MAJOR_VERSION
+#define YY_FLEX_MINOR_VERSION FLEX_MINOR_VERSION
+#define YY_FLEX_SUBMINOR_VERSION FLEX_SUBMINOR_VERSION
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+%# Some negated symbols
+m4_ifdef( [[M4_YY_IN_HEADER]], , [[m4_define([[M4_YY_NOT_IN_HEADER]], [[]])]])
+m4_ifdef( [[M4_YY_REENTRANT]], , [[m4_define([[M4_YY_NOT_REENTRANT]], [[]])]])
+
+%# This is the m4 way to say "(stack_used || is_reentrant)
+m4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
+m4_ifdef( [[M4_YY_REENTRANT]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
+
+%# Prefixes.
+%# The complexity here is necessary so that m4 preserves
+%# the argument lists to each C function.
+
+
+m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
+
+m4preproc_define(`M4_GEN_PREFIX',
+ ``m4_define(yy[[$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
+
+%if-c++-only
+ /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
+ * following macro. This is required in order to pass the c++-multiple-scanners
+ * test in the regression suite. We get reports that it breaks inheritance.
+ * We will address this in a future release of flex, or omit the C++ scanner
+ * altogether.
+ */
+ #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]]
+%endif
+
+%if-c-only
+ M4_GEN_PREFIX(`_create_buffer')
+ M4_GEN_PREFIX(`_delete_buffer')
+ M4_GEN_PREFIX(`_scan_buffer')
+ M4_GEN_PREFIX(`_scan_string')
+ M4_GEN_PREFIX(`_scan_bytes')
+ M4_GEN_PREFIX(`_init_buffer')
+ M4_GEN_PREFIX(`_flush_buffer')
+ M4_GEN_PREFIX(`_load_buffer_state')
+ M4_GEN_PREFIX(`_switch_to_buffer')
+ M4_GEN_PREFIX(`push_buffer_state')
+ M4_GEN_PREFIX(`pop_buffer_state')
+ M4_GEN_PREFIX(`ensure_buffer_stack')
+ M4_GEN_PREFIX(`lex')
+ M4_GEN_PREFIX(`restart')
+ M4_GEN_PREFIX(`lex_init')
+ M4_GEN_PREFIX(`lex_init_extra')
+ M4_GEN_PREFIX(`lex_destroy')
+ M4_GEN_PREFIX(`get_debug')
+ M4_GEN_PREFIX(`set_debug')
+ M4_GEN_PREFIX(`get_extra')
+ M4_GEN_PREFIX(`set_extra')
+ M4_GEN_PREFIX(`get_in')
+ M4_GEN_PREFIX(`set_in')
+ M4_GEN_PREFIX(`get_out')
+ M4_GEN_PREFIX(`set_out')
+ M4_GEN_PREFIX(`get_leng')
+ M4_GEN_PREFIX(`get_text')
+ M4_GEN_PREFIX(`get_lineno')
+ M4_GEN_PREFIX(`set_lineno')
+ m4_ifdef( [[M4_YY_REENTRANT]],
+ [[
+ M4_GEN_PREFIX(`get_column')
+ M4_GEN_PREFIX(`set_column')
+ ]])
+ M4_GEN_PREFIX(`wrap')
+%endif
+
+m4_ifdef( [[M4_YY_BISON_LVAL]],
+[[
+ M4_GEN_PREFIX(`get_lval')
+ M4_GEN_PREFIX(`set_lval')
+]])
+
+m4_ifdef( [[<M4_YY_BISON_LLOC>]],
+[[
+ M4_GEN_PREFIX(`get_lloc')
+ M4_GEN_PREFIX(`set_lloc')
+]])
+
+
+ M4_GEN_PREFIX(`alloc')
+ M4_GEN_PREFIX(`realloc')
+ M4_GEN_PREFIX(`free')
+
+%if-c-only
+m4_ifdef( [[M4_YY_NOT_REENTRANT]],
+[[
+ M4_GEN_PREFIX(`text')
+ M4_GEN_PREFIX(`leng')
+ M4_GEN_PREFIX(`in')
+ M4_GEN_PREFIX(`out')
+ M4_GEN_PREFIX(`_flex_debug')
+ M4_GEN_PREFIX(`lineno')
+]])
+%endif
+
+
+m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
+[[
+ M4_GEN_PREFIX(`tables_fload')
+ M4_GEN_PREFIX(`tables_destroy')
+ M4_GEN_PREFIX(`TABLES_NAME')
+]])
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+%if-c-only
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+%endif
+
+%if-tables-serialization
+#include <sys/types.h>
+#include <netinet/in.h>
+%endif
+/* end standard C headers. */
+
+%if-c-or-c++
+m4preproc_include(`flexint.h')
+%endif
+
+%if-c++-only
+/* begin standard C++ headers. */
+#include <iostream>
+#include <errno.h>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
+/* end standard C++ headers. */
+%endif
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+%# For compilers that can not handle prototypes.
+%# e.g.,
+%# The function prototype
+%# int foo(int x, char* y);
+%#
+%# ...should be written as
+%# int foo M4_YY_PARAMS(int x, char* y);
+%#
+%# ...which could possibly generate
+%# int foo ();
+%#
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
+[[
+ m4_define( [[M4_YY_PARAMS]], [[()]])
+]],
+[[
+ m4_define( [[M4_YY_PARAMS]], [[($*)]])
+]])
+
+%not-for-header
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+%ok-for-header
+
+%not-for-header
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+%ok-for-header
+
+
+
+%if-reentrant
+
+/* An opaque pointer. */
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+#define YY_TYPEDEF_YY_SCANNER_T
+typedef void* yyscan_t;
+#endif
+
+%# Declare yyguts variable
+m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]])
+%# Perform a noop access on yyguts to prevent unused variable complains
+m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[(void)yyg]])
+%# For use wherever a Global is accessed or assigned.
+m4_define( [[YY_G]], [[yyg->$1]])
+
+%# For use in function prototypes to append the additional argument.
+m4_define( [[M4_YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]])
+m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]])
+
+%# For use in function definitions to append the additional argument.
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
+[[
+ m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])
+ m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])
+]],
+[[
+ m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]])
+ m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]])
+]])
+m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]])
+
+%# For use in function calls to pass the additional argument.
+m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]])
+m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]])
+
+%# For use in function documentation to adjust for additional argument.
+m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
+
+/* For convenience, these vars (plus the bison vars far below)
+ are macros in the reentrant scanner. */
+#define yyin YY_G(yyin_r)
+#define yyout YY_G(yyout_r)
+#define yyextra YY_G(yyextra_r)
+#define yyleng YY_G(yyleng_r)
+#define yytext YY_G(yytext_r)
+#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
+#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
+#define yy_flex_debug YY_G(yy_flex_debug_r)
+
+m4_define( [[M4_YY_INCR_LINENO]],
+[[
+ do{ yylineno++;
+ yycolumn=0;
+ }while(0)
+]])
+
+%endif
+
+
+
+%if-not-reentrant
+
+m4_define( [[M4_YY_INCR_LINENO]],
+[[
+ yylineno++;
+]])
+
+%# Define these macros to be no-ops.
+m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]])
+m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[m4_dnl]])
+m4_define( [[YY_G]], [[($1)]])
+m4_define( [[M4_YY_PROTO_LAST_ARG]])
+m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]])
+m4_define( [[M4_YY_DEF_LAST_ARG]])
+
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
+[[
+ m4_define( [[M4_YY_DEF_ONLY_ARG]])
+]],
+[[
+ m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]])
+]])
+m4_define([[M4_YY_DECL_LAST_ARG]])
+m4_define([[M4_YY_CALL_LAST_ARG]])
+m4_define([[M4_YY_CALL_ONLY_ARG]])
+m4_define( [[M4_YY_DOC_PARAM]], [[]])
+
+%endif
+
+
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
+[[
+%# For compilers that need traditional function definitions.
+%# e.g.,
+%# The function prototype taking 2 arguments
+%# int foo (int x, char* y)
+%#
+%# ...should be written as
+%# int foo YYFARGS2(int,x, char*,y)
+%#
+%# ...which could possibly generate
+%# int foo (x,y,yyscanner)
+%# int x;
+%# char * y;
+%# yyscan_t yyscanner;
+%#
+%# Generate traditional function defs
+ m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]]
+ M4_YY_DECL_LAST_ARG]])
+ m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]]
+ $1 $2; [[\]]
+ M4_YY_DECL_LAST_ARG]])
+ m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]]
+ $1 $2; [[\]]
+ $3 $4; [[\]]
+ M4_YY_DECL_LAST_ARG]])
+ m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]]
+ $1 $2; [[\]]
+ $3 $4; [[\]]
+ $5 $6; [[\]]
+ M4_YY_DECL_LAST_ARG]])
+]],
+[[
+%# Generate C99 function defs.
+ m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]])
+ m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]])
+ m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]])
+ m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]])
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN YY_G(yy_start) = 1 + 2 *
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((YY_G(yy_start) - 1) / 2)
+#define YYSTATE YY_START
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+#define YY_END_OF_BUFFER_CHAR 0
+]])
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
+#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
+#endif
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+]])
+
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+%if-not-reentrant
+extern yy_size_t yyleng;
+%endif
+
+%if-c-only
+%if-not-reentrant
+extern FILE *yyin, *yyout;
+%endif
+%endif
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+ m4_ifdef( [[M4_YY_USE_LINENO]],
+ [[
+ /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
+ * access to the local variable yy_act. Since yyless() is a macro, it would break
+ * existing scanners that call yyless() from OUTSIDE yylex.
+ * One obvious solution it to make yy_act a global. I tried that, and saw
+ * a 5% performance hit in a non-yylineno scanner, because yy_act is
+ * normally declared as a register variable-- so it is not worth it.
+ */
+ #define YY_LESS_LINENO(n) \
+ do { \
+ int yyl;\
+ for ( yyl = n; yyl < yyleng; ++yyl )\
+ if ( yytext[yyl] == '\n' )\
+ --yylineno;\
+ }while(0)
+ #define YY_LINENO_REWIND_TO(dst) \
+ do {\
+ const char *p;\
+ for ( p = yy_cp-1; p >= (dst); --p)\
+ if ( *p == '\n' )\
+ --yylineno;\
+ }while(0)
+ ]],
+ [[
+ #define YY_LESS_LINENO(n)
+ #define YY_LINENO_REWIND_TO(ptr)
+ ]])
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ *yy_cp = YY_G(yy_hold_char); \
+ YY_RESTORE_YY_MORE_OFFSET \
+ YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+#define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
+]])
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+ {
+%if-c-only
+ FILE *yy_input_file;
+%endif
+
+%if-c++-only
+ std::streambuf* yy_input_file;
+%endif
+
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ yy_size_t yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+]])
+ };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+%if-c-only Standard (non-C++) definition
+%not-for-header
+%if-not-reentrant
+
+/* Stack of input buffers. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+%endif
+%ok-for-header
+%endif
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \
+ ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \
+ : NULL)
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]
+]])
+
+%if-c-only Standard (non-C++) definition
+
+%if-not-reentrant
+%not-for-header
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
+yy_size_t yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 0; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+%ok-for-header
+%endif
+
+void yyrestart M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG );
+void yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
+YY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG );
+void yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
+void yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
+void yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
+void yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+static void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+static void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+static void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)
+]])
+
+YY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG );
+YY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG );
+YY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, yy_size_t len M4_YY_PROTO_LAST_ARG );
+
+%endif
+
+void *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG );
+void *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG );
+void yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG );
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+#define yy_new_buffer yy_create_buffer
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+]])
+
+%% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+%% [1.5] DFA
+]])
+
+%if-c-only Standard (non-C++) definition
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state M4_YY_PROTO_LAST_ARG);
+static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+#if defined(__GNUC__) && __GNUC__ >= 3
+__attribute__((__noreturn__))
+#endif
+static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG );
+]])
+
+%endif
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ YY_G(yytext_ptr) = yy_bp; \
+%% [2.0] code to fiddle yytext and yyleng for yymore() goes here \
+ YY_G(yy_hold_char) = *yy_cp; \
+ *yy_cp = '\0'; \
+%% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
+ YY_G(yy_c_buf_p) = yy_cp;
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+%% [4.0] data tables for the DFA and the user's section 1 definitions go here
+]])
+
+m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])
+M4_YY_SC_DEFS
+m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])
+
+m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
+[[
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+%if-c-only
+#include <unistd.h>
+%endif
+%if-c++-only
+#include <unistd.h>
+%endif
+#endif
+]])
+
+m4_ifdef( [[M4_EXTRA_TYPE_DEFS]],
+[[
+#define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS
+]],
+[[
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+]]
+)
+
+%if-c-only Reentrant structure and macros (non-C++).
+%if-reentrant
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Holds the entire state of the reentrant scanner. */
+struct yyguts_t
+ {
+
+ /* User-defined. Not touched by flex. */
+ YY_EXTRA_TYPE yyextra_r;
+
+ /* The rest are the same as the globals declared in the non-reentrant scanner. */
+ FILE *yyin_r, *yyout_r;
+ size_t yy_buffer_stack_top; /**< index of top of stack. */
+ size_t yy_buffer_stack_max; /**< capacity of stack. */
+ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
+ char yy_hold_char;
+ yy_size_t yy_n_chars;
+ yy_size_t yyleng_r;
+ char *yy_c_buf_p;
+ int yy_init;
+ int yy_start;
+ int yy_did_buffer_switch_on_eof;
+ int yy_start_stack_ptr;
+ int yy_start_stack_depth;
+ int *yy_start_stack;
+ yy_state_type yy_last_accepting_state;
+ char* yy_last_accepting_cpos;
+
+ int yylineno_r;
+ int yy_flex_debug_r;
+
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
+ yy_state_type *yy_state_buf;
+ yy_state_type *yy_state_ptr;
+ char *yy_full_match;
+ int yy_lp;
+
+ /* These are only needed for trailing context rules,
+ * but there's no conditional variable for that yet. */
+ int yy_looking_for_trail_begin;
+ int yy_full_lp;
+ int *yy_full_state;
+]])
+
+m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
+[[
+ char yytext_r[YYLMAX];
+ char *yytext_ptr;
+ int yy_more_offset;
+ int yy_prev_more_offset;
+]],
+[[
+ char *yytext_r;
+ int yy_more_flag;
+ int yy_more_len;
+]])
+
+m4_ifdef( [[M4_YY_BISON_LVAL]],
+[[
+ YYSTYPE * yylval_r;
+]])
+
+m4_ifdef( [[<M4_YY_BISON_LLOC>]],
+[[
+ YYLTYPE * yylloc_r;
+]])
+
+ }; /* end struct yyguts_t */
+]])
+
+
+%if-c-only
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+%endif
+
+%if-reentrant
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+ m4_ifdef( [[M4_YY_BISON_LVAL]],
+ [[
+ /* This must go here because YYSTYPE and YYLTYPE are included
+ * from bison output in section 1.*/
+ # define yylval YY_G(yylval_r)
+ ]])
+
+ m4_ifdef( [[<M4_YY_BISON_LLOC>]],
+ [[
+ # define yylloc YY_G(yylloc_r)
+ ]])
+]])
+
+int yylex_init M4_YY_PARAMS(yyscan_t* scanner);
+
+int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
+
+%endif
+
+%endif End reentrant structures and macros.
+
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+m4_ifdef( [[M4_YY_NO_DESTROY]],,
+[[
+int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
+[[
+int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
+[[
+void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
+[[
+YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
+[[
+void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_IN]],,
+[[
+FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_IN]],,
+[[
+void yyset_in M4_YY_PARAMS( FILE * _in_str M4_YY_PROTO_LAST_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_OUT]],,
+[[
+FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_OUT]],,
+[[
+void yyset_out M4_YY_PARAMS( FILE * _out_str M4_YY_PROTO_LAST_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_LENG]],,
+[[
+yy_size_t yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
+[[
+char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
+[[
+int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
+[[
+void yyset_lineno M4_YY_PARAMS( int _line_number M4_YY_PROTO_LAST_ARG );
+]])
+
+m4_ifdef( [[M4_YY_REENTRANT]],
+[[
+m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
+[[
+int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+]])
+
+m4_ifdef( [[M4_YY_REENTRANT]],
+[[
+m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
+[[
+void yyset_column M4_YY_PARAMS( int _column_no M4_YY_PROTO_LAST_ARG );
+]])
+]])
+
+%if-bison-bridge
+m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
+[[
+YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
+
+m4_ifdef( [[<M4_YY_BISON_LLOC>]],
+[[
+ m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
+ [[
+ YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+ ]])
+
+ m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
+ [[
+ void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
+ ]])
+]])
+%endif
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+#else
+extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+#endif
+#endif
+
+%not-for-header
+#ifndef YY_NO_UNPUT
+ m4_ifdef( [[M4_YY_NO_UNPUT]],,
+ [[
+ static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG);
+ ]])
+#endif
+%ok-for-header
+%endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);
+#endif
+
+#ifndef YY_NO_INPUT
+%if-c-only Standard (non-C++) definition
+%not-for-header
+#ifdef __cplusplus
+static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+#else
+static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+#endif
+%ok-for-header
+%endif
+#endif
+
+
+%if-c-only
+%# TODO: This is messy.
+m4_ifdef( [[M4_YY_STACK_USED]],
+[[
+
+m4_ifdef( [[M4_YY_NOT_REENTRANT]],
+[[
+ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+ [[
+ static int yy_start_stack_ptr = 0;
+ static int yy_start_stack_depth = 0;
+ static int *yy_start_stack = NULL;
+ ]])
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+ m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
+ [[
+ static void yy_push_state M4_YY_PARAMS( int _new_state M4_YY_PROTO_LAST_ARG);
+ ]])
+ m4_ifdef( [[M4_YY_NO_POP_STATE]],,
+ [[
+ static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+ ]])
+ m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
+ [[
+ static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+ ]])
+]])
+
+]],
+[[
+m4_define( [[M4_YY_NO_PUSH_STATE]])
+m4_define( [[M4_YY_NO_POP_STATE]])
+m4_define( [[M4_YY_NO_TOP_STATE]])
+]])
+%endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
+#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
+#endif
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+%if-c-only Standard (non-C++) definition
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+%endif
+%if-c++-only C++ definition
+#define ECHO LexerOutput( yytext, yyleng )
+%endif
+#endif
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+%% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
+\
+%if-c++-only C++ definition \
+ if ( (int)(result = LexerInput( (char *) buf, max_size )) < 0 ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
+%endif
+
+#endif
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+]])
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+%if-c-only
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)
+%endif
+%if-c++-only
+#define YY_FATAL_ERROR(msg) LexerError( msg )
+%endif
+#endif
+]])
+
+%if-tables-serialization structures and prototypes
+m4preproc_include(`tables_shared.h')
+
+/* Load the DFA tables from the given stream. */
+int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
+
+/* Unload the tables from memory. */
+int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
+%not-for-header
+
+/** Describes a mapping from a serialized table id to its deserialized state in
+ * this scanner. This is the bridge between our "generic" deserialization code
+ * and the specifics of this scanner.
+ */
+struct yytbl_dmap {
+ enum yytbl_id dm_id;/**< table identifier */
+ void **dm_arr; /**< address of pointer to store the deserialized table. */
+ size_t dm_sz; /**< local sizeof() each element in table. */
+};
+
+/** A {0,0,0}-terminated list of structs, forming the map */
+static struct yytbl_dmap yydmap[] =
+{
+%tables-yydmap generated elements
+ {0,0,0}
+};
+
+/** A tables-reader object to maintain some state in the read. */
+struct yytbl_reader {
+ FILE * fp; /**< input stream */
+ flex_uint32_t bread; /**< bytes read since beginning of current tableset */
+};
+
+%endif
+/* end tables serialization structures and prototypes */
+
+%ok-for-header
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+%if-c-only Standard (non-C++) definition
+
+
+m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
+m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
+
+m4_ifdef( [[M4_YY_BISON_LVAL]],
+[[
+ m4_dnl The bison pure parser is used. Redefine yylex to
+ m4_dnl accept the lval parameter.
+
+ m4_define( [[M4_YY_LEX_PROTO]], [[\]]
+ [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
+ m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
+ [[YYFARGS1(YYSTYPE *,yylval_param)]])
+]])
+
+m4_ifdef( [[<M4_YY_BISON_LLOC>]],
+[[
+ m4_dnl Locations are used. yylex should also accept the ylloc parameter.
+
+ m4_define( [[M4_YY_LEX_PROTO]], [[\]]
+ [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
+ m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
+ [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
+]])
+
+extern int yylex M4_YY_LEX_PROTO;
+
+#define YY_DECL int yylex M4_YY_LEX_DECLARATION
+%endif
+%if-c++-only C++ definition
+#define YY_DECL int yyFlexLexer::yylex()
+%endif
+#endif /* !YY_DECL */
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK /*LINTED*/break;
+#endif
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+%% [6.0] YY_RULE_SETUP definition goes here
+]])
+
+%not-for-header
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
+ M4_YY_DECL_GUTS_VAR();
+
+m4_ifdef( [[M4_YY_NOT_REENTRANT]],
+[[
+ m4_ifdef( [[M4_YY_BISON_LVAL]],
+ [[
+ YYSTYPE * yylval;
+ ]])
+ m4_ifdef( [[<M4_YY_BISON_LLOC>]],
+ [[
+ YYLTYPE * yylloc;
+ ]])
+]])
+
+m4_ifdef( [[M4_YY_BISON_LVAL]],
+[[
+ yylval = yylval_param;
+]])
+
+m4_ifdef( [[<M4_YY_BISON_LLOC>]],
+[[
+ yylloc = yylloc_param;
+]])
+
+ if ( !YY_G(yy_init) )
+ {
+ YY_G(yy_init) = 1;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
+ /* Create the reject buffer large enough to save one state per allowed character. */
+ if ( ! YY_G(yy_state_buf) )
+ YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);
+ if ( ! YY_G(yy_state_buf) )
+ YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
+]])
+
+ if ( ! YY_G(yy_start) )
+ YY_G(yy_start) = 1; /* first start state */
+
+ if ( ! yyin )
+%if-c-only
+ yyin = stdin;
+%endif
+%if-c++-only
+ yyin.rdbuf(std::cin.rdbuf());
+%endif
+
+ if ( ! yyout )
+%if-c-only
+ yyout = stdout;
+%endif
+%if-c++-only
+ yyout.rdbuf(std::cout.rdbuf());
+%endif
+
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
+ }
+
+ yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
+ }
+
+ {
+%% [7.0] user's declarations go here
+
+ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
+ {
+%% [8.0] yymore()-related code goes here
+ yy_cp = YY_G(yy_c_buf_p);
+
+ /* Support of yytext. */
+ *yy_cp = YY_G(yy_hold_char);
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+%% [9.0] code to set up and find next match goes here
+
+yy_find_action:
+%% [10.0] code to find the action number goes here
+
+ YY_DO_BEFORE_ACTION;
+
+%% [11.0] code for yylineno update goes here
+
+do_action: /* This label is used only to access EOF actions. */
+
+%% [12.0] debug code goes here
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+%% [13.0] actions go here
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = YY_G(yy_hold_char);
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+%if-c-only
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+%endif
+%if-c++-only
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin.rdbuf();
+%endif
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);
+
+ yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++YY_G(yy_c_buf_p);
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+%% [14.0] code to do back-up for compressed tables and set up yy_cp goes here
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ YY_G(yy_did_buffer_switch_on_eof) = 0;
+
+ if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! YY_G(yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ YY_G(yy_c_buf_p) =
+ YY_G(yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
+
+ yy_cp = YY_G(yy_c_buf_p);
+ yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ YY_G(yy_c_buf_p) =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];
+
+ yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
+
+ yy_cp = YY_G(yy_c_buf_p);
+ yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of user's declarations */
+} /* end of yylex */
+%ok-for-header
+
+%if-c++-only
+%not-for-header
+/* The contents of this function are C++ specific, so the YY_G macro is not used.
+ * This constructor simply maintains backward compatibility.
+ * DEPRECATED
+ */
+yyFlexLexer::yyFlexLexer( FLEX_STD istream* arg_yyin, FLEX_STD ostream* arg_yyout ):
+ yyin(arg_yyin ? arg_yyin->rdbuf() : std::cin.rdbuf()),
+ yyout(arg_yyout ? arg_yyout->rdbuf() : std::cout.rdbuf())
+{
+ ctor_common();
+}
+
+/* The contents of this function are C++ specific, so the YY_G macro is not used.
+ */
+yyFlexLexer::yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout ):
+ yyin(arg_yyin.rdbuf()),
+ yyout(arg_yyout.rdbuf())
+{
+ ctor_common();
+}
+
+/* The contents of this function are C++ specific, so the YY_G macro is not used.
+ */
+void yyFlexLexer::ctor_common()
+{
+ yy_c_buf_p = 0;
+ yy_init = 0;
+ yy_start = 0;
+ yy_flex_debug = 0;
+ yylineno = 1; // this will only get updated if %option yylineno
+
+ yy_did_buffer_switch_on_eof = 0;
+
+ yy_looking_for_trail_begin = 0;
+ yy_more_flag = 0;
+ yy_more_len = 0;
+ yy_more_offset = yy_prev_more_offset = 0;
+
+ yy_start_stack_ptr = yy_start_stack_depth = 0;
+ yy_start_stack = NULL;
+
+ yy_buffer_stack = 0;
+ yy_buffer_stack_top = 0;
+ yy_buffer_stack_max = 0;
+
+
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
+ yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];
+]],
+[[
+ yy_state_buf = 0;
+]])
+}
+
+/* The contents of this function are C++ specific, so the YY_G macro is not used.
+ */
+yyFlexLexer::~yyFlexLexer()
+{
+ delete [] yy_state_buf;
+ yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );
+ yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
+ yyfree( yy_buffer_stack M4_YY_CALL_LAST_ARG );
+}
+
+/* The contents of this function are C++ specific, so the YY_G macro is not used.
+ */
+void yyFlexLexer::switch_streams( std::istream& new_in, std::ostream& new_out )
+{
+ // was if( new_in )
+ yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
+ yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);
+
+ // was if( new_out )
+ yyout.rdbuf(new_out.rdbuf());
+}
+
+/* The contents of this function are C++ specific, so the YY_G macro is not used.
+ */
+void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
+{
+ if( ! new_in ) {
+ new_in = &yyin;
+ }
+
+ if ( ! new_out ) {
+ new_out = &yyout;
+ }
+
+ switch_streams(*new_in, *new_out);
+}
+
+#ifdef YY_INTERACTIVE
+int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
+#else
+int yyFlexLexer::LexerInput( char* buf, int max_size )
+#endif
+{
+ if ( yyin.eof() || yyin.fail() )
+ return 0;
+
+#ifdef YY_INTERACTIVE
+ yyin.get( buf[0] );
+
+ if ( yyin.eof() )
+ return 0;
+
+ if ( yyin.bad() )
+ return -1;
+
+ return 1;
+
+#else
+ (void) yyin.read( buf, max_size );
+
+ if ( yyin.bad() )
+ return -1;
+ else
+ return yyin.gcount();
+#endif
+}
+
+void yyFlexLexer::LexerOutput( const char* buf, int size )
+{
+ (void) yyout.write( buf, size );
+}
+%ok-for-header
+%endif
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+%if-c-only
+static int yy_get_next_buffer YYFARGS0(void)
+%endif
+%if-c++-only
+int yyFlexLexer::yy_get_next_buffer()
+%endif
+{
+ M4_YY_DECL_GUTS_VAR();
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = YY_G(yytext_ptr);
+ yy_size_t number_to_move, i;
+ int ret_val;
+
+ if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (yy_size_t) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;
+
+ else
+ {
+ yy_size_t num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
+ YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+]],
+[[
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
+
+ int yy_c_buf_p_offset =
+ (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ yy_size_t new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yyrealloc( (void *) b->yy_ch_buf,
+ b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ number_to_move - 1;
+]])
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ YY_G(yy_n_chars), num_to_read );
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
+ }
+
+ if ( YY_G(yy_n_chars) == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart( yyin M4_YY_CALL_LAST_ARG);
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if ((yy_size_t) (YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ yy_size_t new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
+ (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size M4_YY_CALL_LAST_ARG );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ }
+
+ YY_G(yy_n_chars) += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+ YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+]])
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+%if-c-only
+%not-for-header
+ static yy_state_type yy_get_previous_state YYFARGS0(void)
+%endif
+%if-c++-only
+ yy_state_type yyFlexLexer::yy_get_previous_state()
+%endif
+{
+ yy_state_type yy_current_state;
+ char *yy_cp;
+ M4_YY_DECL_GUTS_VAR();
+
+%% [15.0] code to get the start state into yy_current_state goes here
+
+ for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )
+ {
+%% [16.0] code to find the next state goes here
+ }
+
+ return yy_current_state;
+}
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+%if-c-only
+ static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state)
+%endif
+%if-c++-only
+ yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
+%endif
+{
+ int yy_is_jam;
+ M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */
+%% [17.0] code to find the next state, and perhaps do backing up, goes here
+
+ M4_YY_NOOP_GUTS_VAR();
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+
+#ifndef YY_NO_UNPUT
+%if-c-only
+m4_ifdef( [[M4_YY_NO_UNPUT]],,
+[[
+ static void yyunput YYFARGS2( int,c, char *,yy_bp)
+%endif
+%if-c++-only
+ void yyFlexLexer::yyunput( int c, char* yy_bp)
+%endif
+{
+ char *yy_cp;
+ M4_YY_DECL_GUTS_VAR();
+
+ yy_cp = YY_G(yy_c_buf_p);
+
+ /* undo effects of setting up yytext */
+ *yy_cp = YY_G(yy_hold_char);
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ yy_size_t number_to_move = YY_G(yy_n_chars) + 2;
+ char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ char *source =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+ YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+%% [18.0] update yylineno here
+m4_ifdef( [[M4_YY_USE_LINENO]],
+[[
+ if ( c == '\n' ){
+ --yylineno;
+ }
+]])
+
+ YY_G(yytext_ptr) = yy_bp;
+ YY_G(yy_hold_char) = *yy_cp;
+ YY_G(yy_c_buf_p) = yy_cp;
+}
+%if-c-only
+]])
+%endif
+#endif
+
+%if-c-only
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+ static int yyinput YYFARGS0(void)
+#else
+ static int input YYFARGS0(void)
+#endif
+
+%endif
+%if-c++-only
+ int yyFlexLexer::yyinput()
+%endif
+{
+ int c;
+ M4_YY_DECL_GUTS_VAR();
+
+ *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
+
+ if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
+ /* This was really a NUL. */
+ *YY_G(yy_c_buf_p) = '\0';
+
+ else
+ { /* need more input */
+ yy_size_t offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);
+ ++YY_G(yy_c_buf_p);
+
+ switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart( yyin M4_YY_CALL_LAST_ARG);
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
+ return EOF;
+
+ if ( ! YY_G(yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput(M4_YY_CALL_ONLY_ARG);
+#else
+ return input(M4_YY_CALL_ONLY_ARG);
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */
+ *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */
+ YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);
+
+%% [19.0] update BOL and yylineno
+
+ return c;
+}
+%if-c-only
+#endif /* ifndef YY_NO_INPUT */
+%endif
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * M4_YY_DOC_PARAM
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+%if-c-only
+ void yyrestart YYFARGS1( FILE *,input_file)
+%endif
+%if-c++-only
+ void yyFlexLexer::yyrestart( std::istream& input_file )
+%endif
+{
+ M4_YY_DECL_GUTS_VAR();
+
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
+ }
+
+ yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);
+ yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
+}
+
+%if-c++-only
+/** Delegate to the new version that takes an istream reference.
+ * @param input_file A readable stream.
+ * M4_YY_DOC_PARAM
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+void yyFlexLexer::yyrestart( std::istream* input_file )
+{
+ yyrestart( *input_file );
+}
+%endif
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * M4_YY_DOC_PARAM
+ */
+%if-c-only
+ void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer)
+%endif
+%if-c++-only
+ void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+%endif
+{
+ M4_YY_DECL_GUTS_VAR();
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ YY_G(yy_did_buffer_switch_on_eof) = 1;
+}
+
+
+%if-c-only
+static void yy_load_buffer_state YYFARGS0(void)
+%endif
+%if-c++-only
+ void yyFlexLexer::yy_load_buffer_state()
+%endif
+{
+ M4_YY_DECL_GUTS_VAR();
+ YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+%if-c-only
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+%endif
+%if-c++-only
+ yyin.rdbuf(YY_CURRENT_BUFFER_LVALUE->yy_input_file);
+%endif
+ YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * M4_YY_DOC_PARAM
+ * @return the allocated buffer state.
+ */
+%if-c-only
+ YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size)
+%endif
+%if-c++-only
+ YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream& file, int size )
+%endif
+{
+ YY_BUFFER_STATE b;
+ m4_dnl M4_YY_DECL_GUTS_VAR();
+
+ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = (yy_size_t)size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);
+
+ return b;
+}
+
+%if-c++-only
+/** Delegate creation of buffers to the new version that takes an istream reference.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * M4_YY_DOC_PARAM
+ * @return the allocated buffer state.
+ */
+ YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
+{
+ return yy_create_buffer( *file, size );
+}
+%endif
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ * M4_YY_DOC_PARAM
+ */
+%if-c-only
+ void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
+%endif
+%if-c++-only
+ void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
+%endif
+{
+ M4_YY_DECL_GUTS_VAR();
+
+ if ( ! b )
+ return;
+
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );
+
+ yyfree( (void *) b M4_YY_CALL_LAST_ARG );
+}
+
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+%if-c-only
+ static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
+%endif
+%if-c++-only
+ void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream& file )
+%endif
+
+{
+ int oerrno = errno;
+ M4_YY_DECL_GUTS_VAR();
+
+ yy_flush_buffer( b M4_YY_CALL_LAST_ARG);
+
+%if-c-only
+ b->yy_input_file = file;
+%endif
+%if-c++-only
+ b->yy_input_file = file.rdbuf();
+%endif
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+%if-c-only
+m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
+[[
+ b->yy_is_interactive = 1;
+]],
+[[
+ m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],
+ [[
+ b->yy_is_interactive = 0;
+ ]],
+ [[
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+ ]])
+]])
+%endif
+%if-c++-only
+ b->yy_is_interactive = 0;
+%endif
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * M4_YY_DOC_PARAM
+ */
+%if-c-only
+ void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
+%endif
+%if-c++-only
+ void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
+%endif
+{
+ M4_YY_DECL_GUTS_VAR();
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == YY_CURRENT_BUFFER )
+ yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
+}
+
+%if-c-or-c++
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ * M4_YY_DOC_PARAM
+ */
+%if-c-only
+void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
+%endif
+%if-c++-only
+void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
+%endif
+{
+ M4_YY_DECL_GUTS_VAR();
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ YY_G(yy_buffer_stack_top)++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
+ YY_G(yy_did_buffer_switch_on_eof) = 1;
+}
+%endif
+
+
+%if-c-or-c++
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ * M4_YY_DOC_PARAM
+ */
+%if-c-only
+void yypop_buffer_state YYFARGS0(void)
+%endif
+%if-c++-only
+void yyFlexLexer::yypop_buffer_state (void)
+%endif
+{
+ M4_YY_DECL_GUTS_VAR();
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if (YY_G(yy_buffer_stack_top) > 0)
+ --YY_G(yy_buffer_stack_top);
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
+ YY_G(yy_did_buffer_switch_on_eof) = 1;
+ }
+}
+%endif
+
+
+%if-c-or-c++
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+%if-c-only
+static void yyensure_buffer_stack YYFARGS0(void)
+%endif
+%if-c++-only
+void yyFlexLexer::yyensure_buffer_stack(void)
+%endif
+{
+ yy_size_t num_to_alloc;
+ M4_YY_DECL_GUTS_VAR();
+
+ if (!YY_G(yy_buffer_stack)) {
+
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
+ */
+ num_to_alloc = 1; // After all that talk, this was set to 1 anyways...
+ YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ M4_YY_CALL_LAST_ARG);
+ if ( ! YY_G(yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+
+ memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+
+ YY_G(yy_buffer_stack_max) = num_to_alloc;
+ YY_G(yy_buffer_stack_top) = 0;
+ return;
+ }
+
+ if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ yy_size_t grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;
+ YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+ (YY_G(yy_buffer_stack),
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ M4_YY_CALL_LAST_ARG);
+ if ( ! YY_G(yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ /* zero only the new slots.*/
+ memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+ YY_G(yy_buffer_stack_max) = num_to_alloc;
+ }
+}
+%endif
+
+
+
+
+m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
+[[
+%if-c-only
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ * M4_YY_DOC_PARAM
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
+{
+ YY_BUFFER_STATE b;
+ m4_dnl M4_YY_DECL_GUTS_VAR();
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );
+
+ return b;
+}
+%endif
+]])
+
+
+m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,
+[[
+%if-c-only
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ * M4_YY_DOC_PARAM
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ * yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)
+{
+ m4_dnl M4_YY_DECL_GUTS_VAR();
+
+ return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);
+}
+%endif
+]])
+
+
+m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
+[[
+%if-c-only
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * M4_YY_DOC_PARAM
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, yy_size_t ,_yybytes_len)
+{
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ yy_size_t i;
+ m4_dnl M4_YY_DECL_GUTS_VAR();
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = _yybytes_len + 2;
+ buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < _yybytes_len; ++i )
+ buf[i] = yybytes[i];
+
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+}
+%endif
+]])
+
+
+m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
+[[
+%if-c-only
+ static void yy_push_state YYFARGS1( int ,_new_state)
+%endif
+%if-c++-only
+ void yyFlexLexer::yy_push_state( int _new_state )
+%endif
+{
+ M4_YY_DECL_GUTS_VAR();
+ if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
+ {
+ yy_size_t new_size;
+
+ YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;
+ new_size = YY_G(yy_start_stack_depth) * sizeof( int );
+
+ if ( ! YY_G(yy_start_stack) )
+ YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );
+
+ else
+ YY_G(yy_start_stack) = (int *) yyrealloc(
+ (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );
+
+ if ( ! YY_G(yy_start_stack) )
+ YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
+ }
+
+ YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
+
+ BEGIN(_new_state);
+}
+]])
+
+
+m4_ifdef( [[M4_YY_NO_POP_STATE]],,
+[[
+%if-c-only
+ static void yy_pop_state YYFARGS0(void)
+%endif
+%if-c++-only
+ void yyFlexLexer::yy_pop_state()
+%endif
+{
+ M4_YY_DECL_GUTS_VAR();
+ if ( --YY_G(yy_start_stack_ptr) < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
+}
+]])
+
+
+m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
+[[
+%if-c-only
+ static int yy_top_state YYFARGS0(void)
+%endif
+%if-c++-only
+ int yyFlexLexer::yy_top_state()
+%endif
+{
+ M4_YY_DECL_GUTS_VAR();
+ return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
+}
+]])
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+%if-c-only
+static void yy_fatal_error YYFARGS1(yyconst char*, msg)
+{
+ M4_YY_DECL_GUTS_VAR();
+ M4_YY_NOOP_GUTS_VAR();
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+}
+%endif
+%if-c++-only
+void yyFlexLexer::LexerError( yyconst char msg[] )
+{
+ M4_YY_DECL_GUTS_VAR();
+ std::cerr << msg << std::endl;
+ exit( YY_EXIT_FAILURE );
+}
+%endif
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ yytext[yyleng] = YY_G(yy_hold_char); \
+ YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \
+ YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \
+ *YY_G(yy_c_buf_p) = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } \
+ while ( 0 )
+
+
+
+/* Accessor methods (get/set functions) to struct members. */
+
+%if-c-only
+%if-reentrant
+m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
+[[
+/** Get the user-defined data for this scanner.
+ * M4_YY_DOC_PARAM
+ */
+YY_EXTRA_TYPE yyget_extra YYFARGS0(void)
+{
+ M4_YY_DECL_GUTS_VAR();
+ return yyextra;
+}
+]])
+%endif
+
+m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
+[[
+/** Get the current line number.
+ * M4_YY_DOC_PARAM
+ */
+int yyget_lineno YYFARGS0(void)
+{
+ M4_YY_DECL_GUTS_VAR();
+
+ m4_ifdef( [[M4_YY_REENTRANT]],
+ [[
+ if (! YY_CURRENT_BUFFER)
+ return 0;
+ ]])
+ return yylineno;
+}
+]])
+
+m4_ifdef( [[M4_YY_REENTRANT]],
+[[
+m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
+[[
+/** Get the current column number.
+ * M4_YY_DOC_PARAM
+ */
+int yyget_column YYFARGS0(void)
+{
+ M4_YY_DECL_GUTS_VAR();
+
+ m4_ifdef( [[M4_YY_REENTRANT]],
+ [[
+ if (! YY_CURRENT_BUFFER)
+ return 0;
+ ]])
+ return yycolumn;
+}
+]])
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_IN]],,
+[[
+/** Get the input stream.
+ * M4_YY_DOC_PARAM
+ */
+FILE *yyget_in YYFARGS0(void)
+{
+ M4_YY_DECL_GUTS_VAR();
+ return yyin;
+}
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_OUT]],,
+[[
+/** Get the output stream.
+ * M4_YY_DOC_PARAM
+ */
+FILE *yyget_out YYFARGS0(void)
+{
+ M4_YY_DECL_GUTS_VAR();
+ return yyout;
+}
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_LENG]],,
+[[
+/** Get the length of the current token.
+ * M4_YY_DOC_PARAM
+ */
+yy_size_t yyget_leng YYFARGS0(void)
+{
+ M4_YY_DECL_GUTS_VAR();
+ return yyleng;
+}
+]])
+
+/** Get the current token.
+ * M4_YY_DOC_PARAM
+ */
+m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
+[[
+char *yyget_text YYFARGS0(void)
+{
+ M4_YY_DECL_GUTS_VAR();
+ return yytext;
+}
+]])
+
+%if-reentrant
+m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
+[[
+/** Set the user-defined data. This data is never touched by the scanner.
+ * @param user_defined The data to be associated with this scanner.
+ * M4_YY_DOC_PARAM
+ */
+void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
+{
+ M4_YY_DECL_GUTS_VAR();
+ yyextra = user_defined ;
+}
+]])
+%endif
+
+m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
+[[
+/** Set the current line number.
+ * @param _line_number line number
+ * M4_YY_DOC_PARAM
+ */
+void yyset_lineno YYFARGS1( int ,_line_number)
+{
+ M4_YY_DECL_GUTS_VAR();
+
+ m4_ifdef( [[M4_YY_REENTRANT]],
+ [[
+ /* lineno is only valid if an input buffer exists. */
+ if (! YY_CURRENT_BUFFER )
+ YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
+ ]])
+ yylineno = _line_number;
+}
+]])
+
+m4_ifdef( [[M4_YY_REENTRANT]],
+[[
+m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
+[[
+/** Set the current column.
+ * @param _column_no column number
+ * M4_YY_DOC_PARAM
+ */
+void yyset_column YYFARGS1( int , _column_no)
+{
+ M4_YY_DECL_GUTS_VAR();
+
+ m4_ifdef( [[M4_YY_REENTRANT]],
+ [[
+ /* column is only valid if an input buffer exists. */
+ if (! YY_CURRENT_BUFFER )
+ YY_FATAL_ERROR( "yyset_column called with no buffer" );
+ ]])
+ yycolumn = _column_no;
+}
+]])
+]])
+
+
+m4_ifdef( [[M4_YY_NO_SET_IN]],,
+[[
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param _in_str A readable stream.
+ * M4_YY_DOC_PARAM
+ * @see yy_switch_to_buffer
+ */
+void yyset_in YYFARGS1( FILE * ,_in_str)
+{
+ M4_YY_DECL_GUTS_VAR();
+ yyin = _in_str ;
+}
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_OUT]],,
+[[
+void yyset_out YYFARGS1( FILE * ,_out_str)
+{
+ M4_YY_DECL_GUTS_VAR();
+ yyout = _out_str ;
+}
+]])
+
+
+m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
+[[
+int yyget_debug YYFARGS0(void)
+{
+ M4_YY_DECL_GUTS_VAR();
+ return yy_flex_debug;
+}
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
+[[
+void yyset_debug YYFARGS1( int ,_bdebug)
+{
+ M4_YY_DECL_GUTS_VAR();
+ yy_flex_debug = _bdebug ;
+}
+]])
+%endif
+
+%if-reentrant
+/* Accessor methods for yylval and yylloc */
+
+%if-bison-bridge
+m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
+[[
+YYSTYPE * yyget_lval YYFARGS0(void)
+{
+ M4_YY_DECL_GUTS_VAR();
+ return yylval;
+}
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_LVAL]],,
+[[
+void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)
+{
+ M4_YY_DECL_GUTS_VAR();
+ yylval = yylval_param;
+}
+]])
+
+m4_ifdef( [[<M4_YY_BISON_LLOC>]],
+[[
+ m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
+ [[
+YYLTYPE *yyget_lloc YYFARGS0(void)
+{
+ M4_YY_DECL_GUTS_VAR();
+ return yylloc;
+}
+ ]])
+
+ m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
+ [[
+void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)
+{
+ M4_YY_DECL_GUTS_VAR();
+ yylloc = yylloc_param;
+}
+ ]])
+]])
+
+%endif
+
+
+/* User-visible API */
+
+/* yylex_init is special because it creates the scanner itself, so it is
+ * the ONLY reentrant function that doesn't take the scanner as the last argument.
+ * That's why we explicitly handle the declaration, instead of using our macros.
+ */
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
+[[
+int yylex_init( ptr_yy_globals )
+ yyscan_t* ptr_yy_globals;
+]],
+[[
+int yylex_init(yyscan_t* ptr_yy_globals)
+]])
+{
+ if (ptr_yy_globals == NULL){
+ errno = EINVAL;
+ return 1;
+ }
+
+ *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
+
+ if (*ptr_yy_globals == NULL){
+ errno = ENOMEM;
+ return 1;
+ }
+
+ /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+ return yy_init_globals ( *ptr_yy_globals );
+}
+
+
+/* yylex_init_extra has the same functionality as yylex_init, but follows the
+ * convention of taking the scanner as the last argument. Note however, that
+ * this is a *pointer* to a scanner, as it will be allocated by this call (and
+ * is the reason, too, why this function also must handle its own declaration).
+ * The user defined value in the first argument will be available to yyalloc in
+ * the yyextra field.
+ */
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
+[[
+int yylex_init_extra( yy_user_defined, ptr_yy_globals )
+ YY_EXTRA_TYPE yy_user_defined;
+ yyscan_t* ptr_yy_globals;
+]],
+[[
+int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
+]])
+{
+ struct yyguts_t dummy_yyguts;
+
+ yyset_extra (yy_user_defined, &dummy_yyguts);
+
+ if (ptr_yy_globals == NULL){
+ errno = EINVAL;
+ return 1;
+ }
+
+ *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
+
+ if (*ptr_yy_globals == NULL){
+ errno = ENOMEM;
+ return 1;
+ }
+
+ /* By setting to 0xAA, we expose bugs in
+ yy_init_globals. Leave at 0x00 for releases. */
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+ yyset_extra (yy_user_defined, *ptr_yy_globals);
+
+ return yy_init_globals ( *ptr_yy_globals );
+}
+
+%endif if-c-only
+%# Actually, that ended an if-rentrant section
+
+%if-c-only
+static int yy_init_globals YYFARGS0(void)
+{
+ M4_YY_DECL_GUTS_VAR();
+ /* Initialization is the same as for the non-reentrant scanner.
+ * This function is called from yylex_destroy(), so don't allocate here.
+ */
+
+m4_ifdef( [[M4_YY_USE_LINENO]],
+[[
+ m4_ifdef( [[M4_YY_NOT_REENTRANT]],
+ [[
+ /* We do not touch yylineno unless the option is enabled. */
+ yylineno = 1;
+ ]])
+]])
+ YY_G(yy_buffer_stack) = 0;
+ YY_G(yy_buffer_stack_top) = 0;
+ YY_G(yy_buffer_stack_max) = 0;
+ YY_G(yy_c_buf_p) = (char *) 0;
+ YY_G(yy_init) = 0;
+ YY_G(yy_start) = 0;
+
+m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
+[[
+ YY_G(yy_start_stack_ptr) = 0;
+ YY_G(yy_start_stack_depth) = 0;
+ YY_G(yy_start_stack) = NULL;
+]])
+
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
+ YY_G(yy_state_buf) = 0;
+ YY_G(yy_state_ptr) = 0;
+ YY_G(yy_full_match) = 0;
+ YY_G(yy_lp) = 0;
+]])
+
+m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
+[[
+ YY_G(yytext_ptr) = 0;
+ YY_G(yy_more_offset) = 0;
+ YY_G(yy_prev_more_offset) = 0;
+]])
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+ yyin = stdin;
+ yyout = stdout;
+#else
+ yyin = (FILE *) 0;
+ yyout = (FILE *) 0;
+#endif
+
+ /* For future reference: Set errno on error, since we are called by
+ * yylex_init()
+ */
+ return 0;
+}
+%endif
+
+
+%if-c-only SNIP! this currently causes conflicts with the c++ scanner
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy YYFARGS0(void)
+{
+ M4_YY_DECL_GUTS_VAR();
+
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
+ yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state(M4_YY_CALL_ONLY_ARG);
+ }
+
+ /* Destroy the stack itself. */
+ yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);
+ YY_G(yy_buffer_stack) = NULL;
+
+m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
+[[
+ /* Destroy the start condition stack. */
+ yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
+ YY_G(yy_start_stack) = NULL;
+]])
+
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
+ yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);
+ YY_G(yy_state_buf) = NULL;
+]])
+
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
+ * yylex() is called, initialization will occur. */
+ yy_init_globals( M4_YY_CALL_ONLY_ARG);
+
+%if-reentrant
+ /* Destroy the main struct (reentrant only). */
+ yyfree ( yyscanner M4_YY_CALL_LAST_ARG );
+ yyscanner = NULL;
+%endif
+ return 0;
+}
+%endif
+
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/*
+ * Internal utility routines.
+ */
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+#ifndef yytext_ptr
+static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
+{
+ M4_YY_DECL_GUTS_VAR();
+ M4_YY_NOOP_GUTS_VAR();
+
+ int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+}
+#endif
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YYFARGS1( yyconst char *,s)
+{
+ int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+}
+#endif
+]])
+
+m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
+[[
+void *yyalloc YYFARGS1( yy_size_t ,size)
+{
+ M4_YY_DECL_GUTS_VAR();
+ M4_YY_NOOP_GUTS_VAR();
+ return (void *) malloc( size );
+}
+]])
+
+m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,
+[[
+void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size)
+{
+ M4_YY_DECL_GUTS_VAR();
+ M4_YY_NOOP_GUTS_VAR();
+
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+}
+]])
+
+m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,
+[[
+void yyfree YYFARGS1( void *,ptr)
+{
+ M4_YY_DECL_GUTS_VAR();
+ M4_YY_NOOP_GUTS_VAR();
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+}
+]])
+
+%if-tables-serialization definitions
+m4preproc_include(`tables_shared.c')
+
+static int yytbl_read8 (void *v, struct yytbl_reader * rd)
+{
+ errno = 0;
+ if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){
+ errno = EIO;
+ return -1;
+ }
+ rd->bread += sizeof(flex_uint8_t);
+ return 0;
+}
+
+static int yytbl_read16 (void *v, struct yytbl_reader * rd)
+{
+ errno = 0;
+ if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){
+ errno = EIO;
+ return -1;
+ }
+ *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));
+ rd->bread += sizeof(flex_uint16_t);
+ return 0;
+}
+
+static int yytbl_read32 (void *v, struct yytbl_reader * rd)
+{
+ errno = 0;
+ if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){
+ errno = EIO;
+ return -1;
+ }
+ *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));
+ rd->bread += sizeof(flex_uint32_t);
+ return 0;
+}
+
+/** Read the header */
+static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)
+{
+ size_t bytes;
+ memset (th, 0, sizeof (struct yytbl_hdr));
+
+ if (yytbl_read32 (&(th->th_magic), rd) != 0)
+ return -1;
+
+ if (th->th_magic != YYTBL_MAGIC){
+ YY_FATAL_ERROR( "bad magic number" ); /* TODO: not fatal. */
+ return -1;
+ }
+
+ if (yytbl_read32 (&(th->th_hsize), rd) != 0
+ || yytbl_read32 (&(th->th_ssize), rd) != 0
+ || yytbl_read16 (&(th->th_flags), rd) != 0)
+ return -1;
+
+ /* Sanity check on header size. Greater than 1k suggests some funny business. */
+ if (th->th_hsize < 16 || th->th_hsize > 1024){
+ YY_FATAL_ERROR( "insane header size detected" ); /* TODO: not fatal. */
+ return -1;
+ }
+
+ /* Allocate enough space for the version and name fields */
+ bytes = th->th_hsize - 14;
+ th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
+ if ( ! th->th_version )
+ YY_FATAL_ERROR( "out of dynamic memory in yytbl_hdr_read()" );
+
+ /* we read it all into th_version, and point th_name into that data */
+ if (fread (th->th_version, 1, bytes, rd->fp) != bytes){
+ errno = EIO;
+ yyfree(th->th_version M4_YY_CALL_LAST_ARG);
+ th->th_version = NULL;
+ return -1;
+ }
+ else
+ rd->bread += bytes;
+
+ th->th_name = th->th_version + strlen (th->th_version) + 1;
+ return 0;
+}
+
+/** lookup id in the dmap list.
+ * @param dmap pointer to first element in list
+ * @return NULL if not found.
+ */
+static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
+ int, id)
+{
+ M4_YY_DECL_GUTS_VAR();
+ M4_YY_NOOP_GUTS_VAR();
+
+ while (dmap->dm_id)
+ if ((int)(dmap->dm_id) == id)
+ return dmap;
+ else
+ dmap++;
+ return NULL;
+}
+
+/** Read a table while mapping its contents to the local array.
+ * @param dmap used to performing mapping
+ * @return 0 on success
+ */
+static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
+{
+ struct yytbl_data td;
+ struct yytbl_dmap *transdmap=0;
+ int len, i, rv, inner_loop_count;
+ void *p=0;
+
+ memset (&td, 0, sizeof (struct yytbl_data));
+
+ if (yytbl_read16 (&td.td_id, rd) != 0
+ || yytbl_read16 (&td.td_flags, rd) != 0
+ || yytbl_read32 (&td.td_hilen, rd) != 0
+ || yytbl_read32 (&td.td_lolen, rd) != 0)
+ return -1;
+
+ /* Lookup the map for the transition table so we have it in case we need it
+ * inside the loop below. This scanner might not even have a transition
+ * table, which is ok.
+ */
+ transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);
+
+ if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){
+ YY_FATAL_ERROR( "table id not found in map." ); /* TODO: not fatal. */
+ return -1;
+ }
+
+ /* Allocate space for table.
+ * The --full yy_transition table is a special case, since we
+ * need the dmap.dm_sz entry to tell us the sizeof the individual
+ * struct members.
+ */
+ {
+ size_t bytes;
+
+ if ((td.td_flags & YYTD_STRUCT))
+ bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);
+ else
+ bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;
+
+ if(M4_YY_TABLES_VERIFY)
+ /* We point to the array itself */
+ p = dmap->dm_arr;
+ else
+ /* We point to the address of a pointer. */
+ *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
+ if ( ! p )
+ YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" );
+ }
+
+ /* If it's a struct, we read 2 integers to get one element */
+ if ((td.td_flags & YYTD_STRUCT) != 0)
+ inner_loop_count = 2;
+ else
+ inner_loop_count = 1;
+
+ /* read and map each element.
+ * This loop iterates once for each element of the td_data array.
+ * Notice that we increment 'i' in the inner loop.
+ */
+ len = yytbl_calc_total_len (&td);
+ for (i = 0; i < len; ){
+ int j;
+
+
+ /* This loop really executes exactly 1 or 2 times.
+ * The second time is to handle the second member of the
+ * YYTD_STRUCT for the yy_transition array.
+ */
+ for (j = 0; j < inner_loop_count; j++, i++) {
+ flex_int32_t t32;
+
+ /* read into t32 no matter what the real size is. */
+ {
+ flex_int16_t t16;
+ flex_int8_t t8;
+
+ switch (YYTDFLAGS2BYTES (td.td_flags)) {
+ case sizeof (flex_int32_t):
+ rv = yytbl_read32 (&t32, rd);
+ break;
+ case sizeof (flex_int16_t):
+ rv = yytbl_read16 (&t16, rd);
+ t32 = t16;
+ break;
+ case sizeof (flex_int8_t):
+ rv = yytbl_read8 (&t8, rd);
+ t32 = t8;
+ break;
+ default:
+ YY_FATAL_ERROR( "invalid td_flags" ); /* TODO: not fatal. */
+ return -1;
+ }
+ }
+ if (rv != 0)
+ return -1;
+
+ /* copy into the deserialized array... */
+
+ if ((td.td_flags & YYTD_STRUCT)) {
+ /* t32 is the j'th member of a two-element struct. */
+ void *v;
+
+ v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)
+ : &(((struct yy_trans_info *) p)->yy_nxt);
+
+ switch (dmap->dm_sz) {
+ case sizeof (flex_int32_t):
+ if (M4_YY_TABLES_VERIFY){
+ if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32)
+ YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int32_t" );
+ }else
+ ((flex_int32_t *) v)[0] = (flex_int32_t) t32;
+ break;
+ case sizeof (flex_int16_t):
+ if (M4_YY_TABLES_VERIFY ){
+ if(((flex_int16_t *) v)[0] != (flex_int16_t) t32)
+ YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int16_t" );
+ }else
+ ((flex_int16_t *) v)[0] = (flex_int16_t) t32;
+ break;
+ case sizeof(flex_int8_t):
+ if (M4_YY_TABLES_VERIFY ){
+ if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32)
+ YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int8_t" );
+ }else
+ ((flex_int8_t *) v)[0] = (flex_int8_t) t32;
+ break;
+ default:
+ YY_FATAL_ERROR( "invalid dmap->dm_sz for struct" ); /* TODO: not fatal. */
+ return -1;
+ }
+
+ /* if we're done with j, increment p */
+ if (j == 1)
+ p = (struct yy_trans_info *) p + 1;
+ }
+ else if ((td.td_flags & YYTD_PTRANS)) {
+ /* t32 is an index into the transition array. */
+ struct yy_trans_info *v;
+
+
+ if (!transdmap){
+ YY_FATAL_ERROR( "transition table not found" ); /* TODO: not fatal. */
+ return -1;
+ }
+
+ if( M4_YY_TABLES_VERIFY)
+ v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
+ else
+ v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);
+
+ if(M4_YY_TABLES_VERIFY ){
+ if( ((struct yy_trans_info **) p)[0] != v)
+ YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" );
+ }else
+ ((struct yy_trans_info **) p)[0] = v;
+
+ /* increment p */
+ p = (struct yy_trans_info **) p + 1;
+ }
+ else {
+ /* t32 is a plain int. copy data, then incrememnt p. */
+ switch (dmap->dm_sz) {
+ case sizeof (flex_int32_t):
+ if(M4_YY_TABLES_VERIFY ){
+ if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32)
+ YY_FATAL_ERROR( "tables verification failed at flex_int32_t" );
+ }else
+ ((flex_int32_t *) p)[0] = (flex_int32_t) t32;
+ p = ((flex_int32_t *) p) + 1;
+ break;
+ case sizeof (flex_int16_t):
+ if(M4_YY_TABLES_VERIFY ){
+ if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32)
+ YY_FATAL_ERROR( "tables verification failed at flex_int16_t" );
+ }else
+ ((flex_int16_t *) p)[0] = (flex_int16_t) t32;
+ p = ((flex_int16_t *) p) + 1;
+ break;
+ case sizeof (flex_int8_t):
+ if(M4_YY_TABLES_VERIFY ){
+ if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32)
+ YY_FATAL_ERROR( "tables verification failed at flex_int8_t" );
+ }else
+ ((flex_int8_t *) p)[0] = (flex_int8_t) t32;
+ p = ((flex_int8_t *) p) + 1;
+ break;
+ default:
+ YY_FATAL_ERROR( "invalid dmap->dm_sz for plain int" ); /* TODO: not fatal. */
+ return -1;
+ }
+ }
+ }
+
+ }
+
+ /* Now eat padding. */
+ {
+ int pad;
+ pad = yypad64(rd->bread);
+ while(--pad >= 0){
+ flex_int8_t t8;
+ if(yytbl_read8(&t8,rd) != 0)
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+%define-yytables The name for this specific scanner's tables.
+
+/* Find the key and load the DFA tables from the given stream. */
+static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)
+{
+ int rv=0;
+ struct yytbl_hdr th;
+ struct yytbl_reader rd;
+
+ rd.fp = fp;
+ th.th_version = NULL;
+
+ /* Keep trying until we find the right set of tables or end of file. */
+ while (!feof(rd.fp)) {
+ rd.bread = 0;
+ if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){
+ rv = -1;
+ goto return_rv;
+ }
+
+ /* A NULL key means choose the first set of tables. */
+ if (key == NULL)
+ break;
+
+ if (strcmp(th.th_name,key) != 0){
+ /* Skip ahead to next set */
+ fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);
+ yyfree(th.th_version M4_YY_CALL_LAST_ARG);
+ th.th_version = NULL;
+ }
+ else
+ break;
+ }
+
+ while (rd.bread < th.th_ssize){
+ /* Load the data tables */
+ if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){
+ rv = -1;
+ goto return_rv;
+ }
+ }
+
+return_rv:
+ if(th.th_version){
+ yyfree(th.th_version M4_YY_CALL_LAST_ARG);
+ th.th_version = NULL;
+ }
+
+ return rv;
+}
+
+/** Load the DFA tables for this scanner from the given stream. */
+int yytables_fload YYFARGS1(FILE *, fp)
+{
+
+ if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)
+ return -1;
+ return 0;
+}
+
+/** Destroy the loaded tables, freeing memory, etc.. */
+int yytables_destroy YYFARGS0(void)
+{
+ struct yytbl_dmap *dmap=0;
+
+ if(!M4_YY_TABLES_VERIFY){
+ /* Walk the dmap, freeing the pointers */
+ for(dmap=yydmap; dmap->dm_id; dmap++) {
+ void * v;
+ v = dmap->dm_arr;
+ if(v && *(char**)v){
+ yyfree(*(char**)v M4_YY_CALL_LAST_ARG);
+ *(char**)v = NULL;
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* end table serialization code definitions */
+%endif
+
+
+m4_ifdef([[M4_YY_MAIN]], [[
+int main M4_YY_PARAMS(void);
+
+int main ()
+{
+
+%if-reentrant
+ yyscan_t lexer;
+ yylex_init(&lexer);
+ yylex( lexer );
+ yylex_destroy( lexer);
+
+%endif
+%if-not-reentrant
+ yylex();
+%endif
+
+ return 0;
+}
+]])
+
+%ok-for-header
+m4_ifdef( [[M4_YY_IN_HEADER]],
+[[
+#undef YY_NEW_FILE
+#undef YY_FLUSH_BUFFER
+#undef yy_set_bol
+#undef yy_new_buffer
+#undef yy_set_interactive
+#undef YY_DO_BEFORE_ACTION
+
+#ifdef YY_DECL_IS_OURS
+#undef YY_DECL_IS_OURS
+#undef YY_DECL
+#endif
+]])
diff --git a/src/flexdef.h b/src/flexdef.h
new file mode 100644
index 0000000..496e34c
--- /dev/null
+++ b/src/flexdef.h
@@ -0,0 +1,1232 @@
+
+/* flexdef - definitions file for flex */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#ifndef FLEXDEF_H
+#define FLEXDEF_H 1
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* AIX requires this to be the first thing in the file. */
+#if !defined(__GNUC__) && !defined(__lint__)
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+#endif
+
+#ifdef STDC_HEADERS
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <setjmp.h>
+#include <ctype.h>
+#include <string.h>
+#include <math.h>
+#endif
+#ifdef HAVE_ASSERT_H
+#include <assert.h>
+#else
+#define assert(Pred)
+#endif
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_SYS_PARAMS_H
+#include <sys/params.h>
+#endif
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#else
+#define bool int
+#define true 1
+#define false 0
+#endif
+#ifdef HAVE_REGEX_H
+#include <regex.h>
+#endif
+#include "flexint.h"
+
+/* We use gettext. So, when we write strings which should be translated, we mark them with _() */
+#ifdef ENABLE_NLS
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif /* HAVE_LOCALE_H */
+#include "gettext.h"
+#define _(String) gettext (String)
+#else
+#define _(STRING) STRING
+#endif /* ENABLE_NLS */
+
+/* Always be prepared to generate an 8-bit scanner. */
+#define CSIZE 256
+#define Char unsigned char
+
+/* Size of input alphabet - should be size of ASCII set. */
+#ifndef DEFAULT_CSIZE
+#define DEFAULT_CSIZE 128
+#endif
+
+#ifndef PROTO
+#if defined(__STDC__)
+#define PROTO(proto) proto
+#else
+#define PROTO(proto) ()
+#endif
+#endif
+
+#ifdef VMS
+#ifndef __VMS_POSIX
+#define unlink remove
+#define SHORT_FILE_NAMES
+#endif
+#endif
+
+#ifdef MS_DOS
+#define SHORT_FILE_NAMES
+#endif
+
+
+/* Maximum line length we'll have to deal with. */
+#define MAXLINE 2048
+
+#ifndef MIN
+#define MIN(x,y) ((x) < (y) ? (x) : (y))
+#endif
+#ifndef MAX
+#define MAX(x,y) ((x) > (y) ? (x) : (y))
+#endif
+#ifndef ABS
+#define ABS(x) ((x) < 0 ? -(x) : (x))
+#endif
+
+
+/* ANSI C does not guarantee that isascii() is defined */
+#ifndef isascii
+#define isascii(c) ((c) <= 0177)
+#endif
+
+#define unspecified -1
+
+/* Special chk[] values marking the slots taking by end-of-buffer and action
+ * numbers.
+ */
+#define EOB_POSITION -1
+#define ACTION_POSITION -2
+
+/* Number of data items per line for -f output. */
+#define NUMDATAITEMS 10
+
+/* Number of lines of data in -f output before inserting a blank line for
+ * readability.
+ */
+#define NUMDATALINES 10
+
+/* transition_struct_out() definitions. */
+#define TRANS_STRUCT_PRINT_LENGTH 14
+
+/* Returns true if an nfa state has an epsilon out-transition slot
+ * that can be used. This definition is currently not used.
+ */
+#define FREE_EPSILON(state) \
+ (transchar[state] == SYM_EPSILON && \
+ trans2[state] == NO_TRANSITION && \
+ finalst[state] != state)
+
+/* Returns true if an nfa state has an epsilon out-transition character
+ * and both slots are free
+ */
+#define SUPER_FREE_EPSILON(state) \
+ (transchar[state] == SYM_EPSILON && \
+ trans1[state] == NO_TRANSITION) \
+
+/* Maximum number of NFA states that can comprise a DFA state. It's real
+ * big because if there's a lot of rules, the initial state will have a
+ * huge epsilon closure.
+ */
+#define INITIAL_MAX_DFA_SIZE 750
+#define MAX_DFA_SIZE_INCREMENT 750
+
+
+/* A note on the following masks. They are used to mark accepting numbers
+ * as being special. As such, they implicitly limit the number of accepting
+ * numbers (i.e., rules) because if there are too many rules the rule numbers
+ * will overload the mask bits. Fortunately, this limit is \large/ (0x2000 ==
+ * 8192) so unlikely to actually cause any problems. A check is made in
+ * new_rule() to ensure that this limit is not reached.
+ */
+
+/* Mask to mark a trailing context accepting number. */
+#define YY_TRAILING_MASK 0x2000
+
+/* Mask to mark the accepting number of the "head" of a trailing context
+ * rule.
+ */
+#define YY_TRAILING_HEAD_MASK 0x4000
+
+/* Maximum number of rules, as outlined in the above note. */
+#define MAX_RULE (YY_TRAILING_MASK - 1)
+
+
+/* NIL must be 0. If not, its special meaning when making equivalence classes
+ * (it marks the representative of a given e.c.) will be unidentifiable.
+ */
+#define NIL 0
+
+#define JAM -1 /* to mark a missing DFA transition */
+#define NO_TRANSITION NIL
+#define UNIQUE -1 /* marks a symbol as an e.c. representative */
+#define INFINITE_REPEAT -1 /* for x{5,} constructions */
+
+#define INITIAL_MAX_CCLS 100 /* max number of unique character classes */
+#define MAX_CCLS_INCREMENT 100
+
+/* Size of table holding members of character classes. */
+#define INITIAL_MAX_CCL_TBL_SIZE 500
+#define MAX_CCL_TBL_SIZE_INCREMENT 250
+
+#define INITIAL_MAX_RULES 100 /* default maximum number of rules */
+#define MAX_RULES_INCREMENT 100
+
+#define INITIAL_MNS 2000 /* default maximum number of nfa states */
+#define MNS_INCREMENT 1000 /* amount to bump above by if it's not enough */
+
+#define INITIAL_MAX_DFAS 1000 /* default maximum number of dfa states */
+#define MAX_DFAS_INCREMENT 1000
+
+#define JAMSTATE -32766 /* marks a reference to the state that always jams */
+
+/* Maximum number of NFA states. */
+#define MAXIMUM_MNS 31999
+#define MAXIMUM_MNS_LONG 1999999999
+
+/* Enough so that if it's subtracted from an NFA state number, the result
+ * is guaranteed to be negative.
+ */
+#define MARKER_DIFFERENCE (maximum_mns+2)
+
+/* Maximum number of nxt/chk pairs for non-templates. */
+#define INITIAL_MAX_XPAIRS 2000
+#define MAX_XPAIRS_INCREMENT 2000
+
+/* Maximum number of nxt/chk pairs needed for templates. */
+#define INITIAL_MAX_TEMPLATE_XPAIRS 2500
+#define MAX_TEMPLATE_XPAIRS_INCREMENT 2500
+
+#define SYM_EPSILON (CSIZE + 1) /* to mark transitions on the symbol epsilon */
+
+#define INITIAL_MAX_SCS 40 /* maximum number of start conditions */
+#define MAX_SCS_INCREMENT 40 /* amount to bump by if it's not enough */
+
+#define ONE_STACK_SIZE 500 /* stack of states with only one out-transition */
+#define SAME_TRANS -1 /* transition is the same as "default" entry for state */
+
+/* The following percentages are used to tune table compression:
+
+ * The percentage the number of out-transitions a state must be of the
+ * number of equivalence classes in order to be considered for table
+ * compaction by using protos.
+ */
+#define PROTO_SIZE_PERCENTAGE 15
+
+/* The percentage the number of homogeneous out-transitions of a state
+ * must be of the number of total out-transitions of the state in order
+ * that the state's transition table is first compared with a potential
+ * template of the most common out-transition instead of with the first
+ * proto in the proto queue.
+ */
+#define CHECK_COM_PERCENTAGE 50
+
+/* The percentage the number of differences between a state's transition
+ * table and the proto it was first compared with must be of the total
+ * number of out-transitions of the state in order to keep the first
+ * proto as a good match and not search any further.
+ */
+#define FIRST_MATCH_DIFF_PERCENTAGE 10
+
+/* The percentage the number of differences between a state's transition
+ * table and the most similar proto must be of the state's total number
+ * of out-transitions to use the proto as an acceptable close match.
+ */
+#define ACCEPTABLE_DIFF_PERCENTAGE 50
+
+/* The percentage the number of homogeneous out-transitions of a state
+ * must be of the number of total out-transitions of the state in order
+ * to consider making a template from the state.
+ */
+#define TEMPLATE_SAME_PERCENTAGE 60
+
+/* The percentage the number of differences between a state's transition
+ * table and the most similar proto must be of the state's total number
+ * of out-transitions to create a new proto from the state.
+ */
+#define NEW_PROTO_DIFF_PERCENTAGE 20
+
+/* The percentage the total number of out-transitions of a state must be
+ * of the number of equivalence classes in order to consider trying to
+ * fit the transition table into "holes" inside the nxt/chk table.
+ */
+#define INTERIOR_FIT_PERCENTAGE 15
+
+/* Size of region set aside to cache the complete transition table of
+ * protos on the proto queue to enable quick comparisons.
+ */
+#define PROT_SAVE_SIZE 2000
+
+#define MSP 50 /* maximum number of saved protos (protos on the proto queue) */
+
+/* Maximum number of out-transitions a state can have that we'll rummage
+ * around through the interior of the internal fast table looking for a
+ * spot for it.
+ */
+#define MAX_XTIONS_FULL_INTERIOR_FIT 4
+
+/* Maximum number of rules which will be reported as being associated
+ * with a DFA state.
+ */
+#define MAX_ASSOC_RULES 100
+
+/* Number that, if used to subscript an array, has a good chance of producing
+ * an error; should be small enough to fit into a short.
+ */
+#define BAD_SUBSCRIPT -32767
+
+/* Absolute value of largest number that can be stored in a short, with a
+ * bit of slop thrown in for general paranoia.
+ */
+#define MAX_SHORT 32700
+
+
+/* Declarations for global variables. */
+
+
+/* Variables for flags:
+ * printstats - if true (-v), dump statistics
+ * syntaxerror - true if a syntax error has been found
+ * eofseen - true if we've seen an eof in the input file
+ * ddebug - if true (-d), make a "debug" scanner
+ * trace - if true (-T), trace processing
+ * nowarn - if true (-w), do not generate warnings
+ * spprdflt - if true (-s), suppress the default rule
+ * interactive - if true (-I), generate an interactive scanner
+ * lex_compat - if true (-l), maximize compatibility with AT&T lex
+ * posix_compat - if true (-X), maximize compatibility with POSIX lex
+ * do_yylineno - if true, generate code to maintain yylineno
+ * useecs - if true (-Ce flag), use equivalence classes
+ * fulltbl - if true (-Cf flag), don't compress the DFA state table
+ * usemecs - if true (-Cm flag), use meta-equivalence classes
+ * fullspd - if true (-F flag), use Jacobson method of table representation
+ * gen_line_dirs - if true (i.e., no -L flag), generate #line directives
+ * performance_report - if > 0 (i.e., -p flag), generate a report relating
+ * to scanner performance; if > 1 (-p -p), report on minor performance
+ * problems, too
+ * backing_up_report - if true (i.e., -b flag), generate "lex.backup" file
+ * listing backing-up states
+ * C_plus_plus - if true (i.e., -+ flag), generate a C++ scanner class;
+ * otherwise, a standard C scanner
+ * reentrant - if true (-R), generate a reentrant C scanner.
+ * bison_bridge_lval - if true (--bison-bridge), bison pure calling convention.
+ * bison_bridge_lloc - if true (--bison-locations), bison yylloc.
+ * long_align - if true (-Ca flag), favor long-word alignment.
+ * use_read - if true (-f, -F, or -Cr) then use read() for scanner input;
+ * otherwise, use fread().
+ * yytext_is_array - if true (i.e., %array directive), then declare
+ * yytext as a array instead of a character pointer. Nice and inefficient.
+ * do_yywrap - do yywrap() processing on EOF. If false, EOF treated as
+ * "no more files".
+ * csize - size of character set for the scanner we're generating;
+ * 128 for 7-bit chars and 256 for 8-bit
+ * yymore_used - if true, yymore() is used in input rules
+ * reject - if true, generate back-up tables for REJECT macro
+ * real_reject - if true, scanner really uses REJECT (as opposed to just
+ * having "reject" set for variable trailing context)
+ * continued_action - true if this rule's action is to "fall through" to
+ * the next rule's action (i.e., the '|' action)
+ * in_rule - true if we're inside an individual rule, false if not.
+ * yymore_really_used - whether to treat yymore() as really used, regardless
+ * of what we think based on references to it in the user's actions.
+ * reject_really_used - same for REJECT
+ * trace_hex - use hexadecimal numbers in trace/debug outputs instead of octals
+ */
+
+extern int printstats, syntaxerror, eofseen, ddebug, trace, nowarn,
+ spprdflt;
+extern int interactive, lex_compat, posix_compat, do_yylineno;
+extern int useecs, fulltbl, usemecs, fullspd;
+extern int gen_line_dirs, performance_report, backing_up_report;
+extern int reentrant, bison_bridge_lval, bison_bridge_lloc;
+extern bool ansi_func_defs, ansi_func_protos;
+extern int C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap;
+extern int csize;
+extern int yymore_used, reject, real_reject, continued_action, in_rule;
+
+extern int yymore_really_used, reject_really_used;
+extern int trace_hex;
+
+/* Variables used in the flex input routines:
+ * datapos - characters on current output line
+ * dataline - number of contiguous lines of data in current data
+ * statement. Used to generate readable -f output
+ * linenum - current input line number
+ * skelfile - the skeleton file
+ * skel - compiled-in skeleton array
+ * skel_ind - index into "skel" array, if skelfile is nil
+ * yyin - input file
+ * backing_up_file - file to summarize backing-up states to
+ * infilename - name of input file
+ * outfilename - name of output file
+ * headerfilename - name of the .h file to generate
+ * did_outfilename - whether outfilename was explicitly set
+ * prefix - the prefix used for externally visible names ("yy" by default)
+ * yyclass - yyFlexLexer subclass to use for YY_DECL
+ * do_stdinit - whether to initialize yyin/yyout to stdin/stdout
+ * use_stdout - the -t flag
+ * input_files - array holding names of input files
+ * num_input_files - size of input_files array
+ * program_name - name with which program was invoked
+ *
+ * action_array - array to hold the rule actions
+ * action_size - size of action_array
+ * defs1_offset - index where the user's section 1 definitions start
+ * in action_array
+ * prolog_offset - index where the prolog starts in action_array
+ * action_offset - index where the non-prolog starts in action_array
+ * action_index - index where the next action should go, with respect
+ * to "action_array"
+ */
+
+extern int datapos, dataline, linenum;
+extern FILE *skelfile, *yyin, *backing_up_file;
+extern const char *skel[];
+extern int skel_ind;
+extern char *infilename, *outfilename, *headerfilename;
+extern int did_outfilename;
+extern char *prefix, *yyclass, *extra_type;
+extern int do_stdinit, use_stdout;
+extern char **input_files;
+extern int num_input_files;
+extern char *program_name;
+
+extern char *action_array;
+extern int action_size;
+extern int defs1_offset, prolog_offset, action_offset, action_index;
+
+
+/* Variables for stack of states having only one out-transition:
+ * onestate - state number
+ * onesym - transition symbol
+ * onenext - target state
+ * onedef - default base entry
+ * onesp - stack pointer
+ */
+
+extern int onestate[ONE_STACK_SIZE], onesym[ONE_STACK_SIZE];
+extern int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp;
+
+
+/* Variables for nfa machine data:
+ * maximum_mns - maximal number of NFA states supported by tables
+ * current_mns - current maximum on number of NFA states
+ * num_rules - number of the last accepting state; also is number of
+ * rules created so far
+ * num_eof_rules - number of <<EOF>> rules
+ * default_rule - number of the default rule
+ * current_max_rules - current maximum number of rules
+ * lastnfa - last nfa state number created
+ * firstst - physically the first state of a fragment
+ * lastst - last physical state of fragment
+ * finalst - last logical state of fragment
+ * transchar - transition character
+ * trans1 - transition state
+ * trans2 - 2nd transition state for epsilons
+ * accptnum - accepting number
+ * assoc_rule - rule associated with this NFA state (or 0 if none)
+ * state_type - a STATE_xxx type identifying whether the state is part
+ * of a normal rule, the leading state in a trailing context
+ * rule (i.e., the state which marks the transition from
+ * recognizing the text-to-be-matched to the beginning of
+ * the trailing context), or a subsequent state in a trailing
+ * context rule
+ * rule_type - a RULE_xxx type identifying whether this a ho-hum
+ * normal rule or one which has variable head & trailing
+ * context
+ * rule_linenum - line number associated with rule
+ * rule_useful - true if we've determined that the rule can be matched
+ * rule_has_nl - true if rule could possibly match a newline
+ * ccl_has_nl - true if current ccl could match a newline
+ * nlch - default eol char
+ */
+
+extern int maximum_mns, current_mns, current_max_rules;
+extern int num_rules, num_eof_rules, default_rule, lastnfa;
+extern int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2;
+extern int *accptnum, *assoc_rule, *state_type;
+extern int *rule_type, *rule_linenum, *rule_useful;
+extern bool *rule_has_nl, *ccl_has_nl;
+extern int nlch;
+
+/* Different types of states; values are useful as masks, as well, for
+ * routines like check_trailing_context().
+ */
+#define STATE_NORMAL 0x1
+#define STATE_TRAILING_CONTEXT 0x2
+
+/* Global holding current type of state we're making. */
+
+extern int current_state_type;
+
+/* Different types of rules. */
+#define RULE_NORMAL 0
+#define RULE_VARIABLE 1
+
+/* True if the input rules include a rule with both variable-length head
+ * and trailing context, false otherwise.
+ */
+extern int variable_trailing_context_rules;
+
+
+/* Variables for protos:
+ * numtemps - number of templates created
+ * numprots - number of protos created
+ * protprev - backlink to a more-recently used proto
+ * protnext - forward link to a less-recently used proto
+ * prottbl - base/def table entry for proto
+ * protcomst - common state of proto
+ * firstprot - number of the most recently used proto
+ * lastprot - number of the least recently used proto
+ * protsave contains the entire state array for protos
+ */
+
+extern int numtemps, numprots, protprev[MSP], protnext[MSP], prottbl[MSP];
+extern int protcomst[MSP], firstprot, lastprot, protsave[PROT_SAVE_SIZE];
+
+
+/* Variables for managing equivalence classes:
+ * numecs - number of equivalence classes
+ * nextecm - forward link of Equivalence Class members
+ * ecgroup - class number or backward link of EC members
+ * nummecs - number of meta-equivalence classes (used to compress
+ * templates)
+ * tecfwd - forward link of meta-equivalence classes members
+ * tecbck - backward link of MEC's
+ */
+
+/* Reserve enough room in the equivalence class arrays so that we
+ * can use the CSIZE'th element to hold equivalence class information
+ * for the NUL character. Later we'll move this information into
+ * the 0th element.
+ */
+extern int numecs, nextecm[CSIZE + 1], ecgroup[CSIZE + 1], nummecs;
+
+/* Meta-equivalence classes are indexed starting at 1, so it's possible
+ * that they will require positions from 1 .. CSIZE, i.e., CSIZE + 1
+ * slots total (since the arrays are 0-based). nextecm[] and ecgroup[]
+ * don't require the extra position since they're indexed from 1 .. CSIZE - 1.
+ */
+extern int tecfwd[CSIZE + 1], tecbck[CSIZE + 1];
+
+
+/* Variables for start conditions:
+ * lastsc - last start condition created
+ * current_max_scs - current limit on number of start conditions
+ * scset - set of rules active in start condition
+ * scbol - set of rules active only at the beginning of line in a s.c.
+ * scxclu - true if start condition is exclusive
+ * sceof - true if start condition has EOF rule
+ * scname - start condition name
+ */
+
+extern int lastsc, *scset, *scbol, *scxclu, *sceof;
+extern int current_max_scs;
+extern char **scname;
+
+
+/* Variables for dfa machine data:
+ * current_max_dfa_size - current maximum number of NFA states in DFA
+ * current_max_xpairs - current maximum number of non-template xtion pairs
+ * current_max_template_xpairs - current maximum number of template pairs
+ * current_max_dfas - current maximum number DFA states
+ * lastdfa - last dfa state number created
+ * nxt - state to enter upon reading character
+ * chk - check value to see if "nxt" applies
+ * tnxt - internal nxt table for templates
+ * base - offset into "nxt" for given state
+ * def - where to go if "chk" disallows "nxt" entry
+ * nultrans - NUL transition for each state
+ * NUL_ec - equivalence class of the NUL character
+ * tblend - last "nxt/chk" table entry being used
+ * firstfree - first empty entry in "nxt/chk" table
+ * dss - nfa state set for each dfa
+ * dfasiz - size of nfa state set for each dfa
+ * dfaacc - accepting set for each dfa state (if using REJECT), or accepting
+ * number, if not
+ * accsiz - size of accepting set for each dfa state
+ * dhash - dfa state hash value
+ * numas - number of DFA accepting states created; note that this
+ * is not necessarily the same value as num_rules, which is the analogous
+ * value for the NFA
+ * numsnpairs - number of state/nextstate transition pairs
+ * jambase - position in base/def where the default jam table starts
+ * jamstate - state number corresponding to "jam" state
+ * end_of_buffer_state - end-of-buffer dfa state number
+ */
+
+extern int current_max_dfa_size, current_max_xpairs;
+extern int current_max_template_xpairs, current_max_dfas;
+extern int lastdfa, *nxt, *chk, *tnxt;
+extern int *base, *def, *nultrans, NUL_ec, tblend, firstfree, **dss,
+ *dfasiz;
+extern union dfaacc_union {
+ int *dfaacc_set;
+ int dfaacc_state;
+} *dfaacc;
+extern int *accsiz, *dhash, numas;
+extern int numsnpairs, jambase, jamstate;
+extern int end_of_buffer_state;
+
+/* Variables for ccl information:
+ * lastccl - ccl index of the last created ccl
+ * current_maxccls - current limit on the maximum number of unique ccl's
+ * cclmap - maps a ccl index to its set pointer
+ * ccllen - gives the length of a ccl
+ * cclng - true for a given ccl if the ccl is negated
+ * cclreuse - counts how many times a ccl is re-used
+ * current_max_ccl_tbl_size - current limit on number of characters needed
+ * to represent the unique ccl's
+ * ccltbl - holds the characters in each ccl - indexed by cclmap
+ */
+
+extern int lastccl, *cclmap, *ccllen, *cclng, cclreuse;
+extern int current_maxccls, current_max_ccl_tbl_size;
+extern Char *ccltbl;
+
+
+/* Variables for miscellaneous information:
+ * nmstr - last NAME scanned by the scanner
+ * sectnum - section number currently being parsed
+ * nummt - number of empty nxt/chk table entries
+ * hshcol - number of hash collisions detected by snstods
+ * dfaeql - number of times a newly created dfa was equal to an old one
+ * numeps - number of epsilon NFA states created
+ * eps2 - number of epsilon states which have 2 out-transitions
+ * num_reallocs - number of times it was necessary to realloc() a group
+ * of arrays
+ * tmpuses - number of DFA states that chain to templates
+ * totnst - total number of NFA states used to make DFA states
+ * peakpairs - peak number of transition pairs we had to store internally
+ * numuniq - number of unique transitions
+ * numdup - number of duplicate transitions
+ * hshsave - number of hash collisions saved by checking number of states
+ * num_backing_up - number of DFA states requiring backing up
+ * bol_needed - whether scanner needs beginning-of-line recognition
+ */
+
+extern char nmstr[MAXLINE];
+extern int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs;
+extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
+extern int num_backing_up, bol_needed;
+
+void *allocate_array PROTO ((int, size_t));
+void *reallocate_array PROTO ((void *, int, size_t));
+
+void *flex_alloc PROTO ((size_t));
+void *flex_realloc PROTO ((void *, size_t));
+void flex_free PROTO ((void *));
+
+#define allocate_integer_array(size) \
+ (int *) allocate_array( size, sizeof( int ) )
+
+#define reallocate_integer_array(array,size) \
+ (int *) reallocate_array( (void *) array, size, sizeof( int ) )
+
+#define allocate_bool_array(size) \
+ (bool *) allocate_array( size, sizeof( bool ) )
+
+#define reallocate_bool_array(array,size) \
+ (bool *) reallocate_array( (void *) array, size, sizeof( bool ) )
+
+#define allocate_int_ptr_array(size) \
+ (int **) allocate_array( size, sizeof( int * ) )
+
+#define allocate_char_ptr_array(size) \
+ (char **) allocate_array( size, sizeof( char * ) )
+
+#define allocate_dfaacc_union(size) \
+ (union dfaacc_union *) \
+ allocate_array( size, sizeof( union dfaacc_union ) )
+
+#define reallocate_int_ptr_array(array,size) \
+ (int **) reallocate_array( (void *) array, size, sizeof( int * ) )
+
+#define reallocate_char_ptr_array(array,size) \
+ (char **) reallocate_array( (void *) array, size, sizeof( char * ) )
+
+#define reallocate_dfaacc_union(array, size) \
+ (union dfaacc_union *) \
+ reallocate_array( (void *) array, size, sizeof( union dfaacc_union ) )
+
+#define allocate_character_array(size) \
+ (char *) allocate_array( size, sizeof( char ) )
+
+#define reallocate_character_array(array,size) \
+ (char *) reallocate_array( (void *) array, size, sizeof( char ) )
+
+#define allocate_Character_array(size) \
+ (Char *) allocate_array( size, sizeof( Char ) )
+
+#define reallocate_Character_array(array,size) \
+ (Char *) reallocate_array( (void *) array, size, sizeof( Char ) )
+
+
+/* Used to communicate between scanner and parser. The type should really
+ * be YYSTYPE, but we can't easily get our hands on it.
+ */
+extern int yylval;
+
+
+/* External functions that are cross-referenced among the flex source files. */
+
+
+/* from file ccl.c */
+
+extern void ccladd PROTO ((int, int)); /* add a single character to a ccl */
+extern int cclinit PROTO ((void)); /* make an empty ccl */
+extern void cclnegate PROTO ((int)); /* negate a ccl */
+extern int ccl_set_diff (int a, int b); /* set difference of two ccls. */
+extern int ccl_set_union (int a, int b); /* set union of two ccls. */
+
+/* List the members of a set of characters in CCL form. */
+extern void list_character_set PROTO ((FILE *, int[]));
+
+
+/* from file dfa.c */
+
+/* Check a DFA state for backing up. */
+extern void check_for_backing_up PROTO ((int, int[]));
+
+/* Check to see if NFA state set constitutes "dangerous" trailing context. */
+extern void check_trailing_context PROTO ((int *, int, int *, int));
+
+/* Construct the epsilon closure of a set of ndfa states. */
+extern int *epsclosure PROTO ((int *, int *, int[], int *, int *));
+
+/* Increase the maximum number of dfas. */
+extern void increase_max_dfas PROTO ((void));
+
+extern void ntod PROTO ((void)); /* convert a ndfa to a dfa */
+
+/* Converts a set of ndfa states into a dfa state. */
+extern int snstods PROTO ((int[], int, int[], int, int, int *));
+
+
+/* from file ecs.c */
+
+/* Convert character classes to set of equivalence classes. */
+extern void ccl2ecl PROTO ((void));
+
+/* Associate equivalence class numbers with class members. */
+extern int cre8ecs PROTO ((int[], int[], int));
+
+/* Update equivalence classes based on character class transitions. */
+extern void mkeccl PROTO ((Char[], int, int[], int[], int, int));
+
+/* Create equivalence class for single character. */
+extern void mkechar PROTO ((int, int[], int[]));
+
+
+/* from file gen.c */
+
+extern void do_indent PROTO ((void)); /* indent to the current level */
+
+/* Generate the code to keep backing-up information. */
+extern void gen_backing_up PROTO ((void));
+
+/* Generate the code to perform the backing up. */
+extern void gen_bu_action PROTO ((void));
+
+/* Generate full speed compressed transition table. */
+extern void genctbl PROTO ((void));
+
+/* Generate the code to find the action number. */
+extern void gen_find_action PROTO ((void));
+
+extern void genftbl PROTO ((void)); /* generate full transition table */
+
+/* Generate the code to find the next compressed-table state. */
+extern void gen_next_compressed_state PROTO ((char *));
+
+/* Generate the code to find the next match. */
+extern void gen_next_match PROTO ((void));
+
+/* Generate the code to find the next state. */
+extern void gen_next_state PROTO ((int));
+
+/* Generate the code to make a NUL transition. */
+extern void gen_NUL_trans PROTO ((void));
+
+/* Generate the code to find the start state. */
+extern void gen_start_state PROTO ((void));
+
+/* Generate data statements for the transition tables. */
+extern void gentabs PROTO ((void));
+
+/* Write out a formatted string at the current indentation level. */
+extern void indent_put2s PROTO ((const char *, const char *));
+
+/* Write out a string + newline at the current indentation level. */
+extern void indent_puts PROTO ((const char *));
+
+extern void make_tables PROTO ((void)); /* generate transition tables */
+
+
+/* from file main.c */
+
+extern void check_options PROTO ((void));
+extern void flexend PROTO ((int));
+extern void usage PROTO ((void));
+
+
+/* from file misc.c */
+
+/* Add a #define to the action file. */
+extern void action_define PROTO ((const char *defname, int value));
+
+/* Add the given text to the stored actions. */
+extern void add_action PROTO ((const char *new_text));
+
+/* True if a string is all lower case. */
+extern int all_lower PROTO ((char *));
+
+/* True if a string is all upper case. */
+extern int all_upper PROTO ((char *));
+
+/* Compare two integers for use by qsort. */
+extern int intcmp PROTO ((const void *, const void *));
+
+/* Check a character to make sure it's in the expected range. */
+extern void check_char PROTO ((int c));
+
+/* Replace upper-case letter to lower-case. */
+extern Char clower PROTO ((int));
+
+/* Returns a dynamically allocated copy of a string. */
+extern char *copy_string PROTO ((const char *));
+
+/* Returns a dynamically allocated copy of a (potentially) unsigned string. */
+extern Char *copy_unsigned_string PROTO ((Char *));
+
+/* Compare two characters for use by qsort with '\0' sorting last. */
+extern int cclcmp PROTO ((const void *, const void *));
+
+/* Finish up a block of data declarations. */
+extern void dataend PROTO ((void));
+
+/* Flush generated data statements. */
+extern void dataflush PROTO ((void));
+
+/* Report an error message and terminate. */
+extern void flexerror PROTO ((const char *));
+
+/* Report a fatal error message and terminate. */
+extern void flexfatal PROTO ((const char *));
+
+/* Report a fatal error with a pinpoint, and terminate */
+#if HAVE_DECL___FUNC__
+#define flex_die(msg) \
+ do{ \
+ fprintf (stderr,\
+ _("%s: fatal internal error at %s:%d (%s): %s\n"),\
+ program_name, __FILE__, (int)__LINE__,\
+ __func__,msg);\
+ FLEX_EXIT(1);\
+ }while(0)
+#else /* ! HAVE_DECL___FUNC__ */
+#define flex_die(msg) \
+ do{ \
+ fprintf (stderr,\
+ _("%s: fatal internal error at %s:%d %s\n"),\
+ program_name, __FILE__, (int)__LINE__,\
+ msg);\
+ FLEX_EXIT(1);\
+ }while(0)
+#endif /* ! HAVE_DECL___func__ */
+
+/* Convert a hexadecimal digit string to an integer value. */
+extern int htoi PROTO ((Char[]));
+
+/* Report an error message formatted */
+extern void lerr PROTO ((const char *, ...))
+#if defined(__GNUC__) && __GNUC__ >= 3
+ __attribute__((__format__(__printf__, 1, 2)))
+#endif
+;
+
+/* Like lerr, but also exit after displaying message. */
+extern void lerr_fatal PROTO ((const char *, ...))
+#if defined(__GNUC__) && __GNUC__ >= 3
+ __attribute__((__format__(__printf__, 1, 2)))
+#endif
+;
+
+/* Spit out a "#line" statement. */
+extern void line_directive_out PROTO ((FILE *, int));
+
+/* Mark the current position in the action array as the end of the section 1
+ * user defs.
+ */
+extern void mark_defs1 PROTO ((void));
+
+/* Mark the current position in the action array as the end of the prolog. */
+extern void mark_prolog PROTO ((void));
+
+/* Generate a data statment for a two-dimensional array. */
+extern void mk2data PROTO ((int));
+
+extern void mkdata PROTO ((int)); /* generate a data statement */
+
+/* Return the integer represented by a string of digits. */
+extern int myctoi PROTO ((const char *));
+
+/* Return character corresponding to escape sequence. */
+extern Char myesc PROTO ((Char[]));
+
+/* Convert an octal digit string to an integer value. */
+extern int otoi PROTO ((Char[]));
+
+/* Output a (possibly-formatted) string to the generated scanner. */
+extern void out PROTO ((const char *));
+extern void out_dec PROTO ((const char *, int));
+extern void out_dec2 PROTO ((const char *, int, int));
+extern void out_hex PROTO ((const char *, unsigned int));
+extern void out_str PROTO ((const char *, const char *));
+extern void out_str3
+PROTO ((const char *, const char *, const char *, const char *));
+extern void out_str_dec PROTO ((const char *, const char *, int));
+extern void outc PROTO ((int));
+extern void outn PROTO ((const char *));
+extern void out_m4_define (const char* def, const char* val);
+
+/* Return a printable version of the given character, which might be
+ * 8-bit.
+ */
+extern char *readable_form PROTO ((int));
+
+/* Write out one section of the skeleton file. */
+extern void skelout PROTO ((void));
+
+/* Output a yy_trans_info structure. */
+extern void transition_struct_out PROTO ((int, int));
+
+/* Only needed when using certain broken versions of bison to build parse.c. */
+extern void *yy_flex_xmalloc PROTO ((int));
+
+/* Set a region of memory to 0. */
+extern void zero_out PROTO ((char *, size_t));
+
+
+/* from file nfa.c */
+
+/* Add an accepting state to a machine. */
+extern void add_accept PROTO ((int, int));
+
+/* Make a given number of copies of a singleton machine. */
+extern int copysingl PROTO ((int, int));
+
+/* Debugging routine to write out an nfa. */
+extern void dumpnfa PROTO ((int));
+
+/* Finish up the processing for a rule. */
+extern void finish_rule PROTO ((int, int, int, int, int));
+
+/* Connect two machines together. */
+extern int link_machines PROTO ((int, int));
+
+/* Mark each "beginning" state in a machine as being a "normal" (i.e.,
+ * not trailing context associated) state.
+ */
+extern void mark_beginning_as_normal PROTO ((int));
+
+/* Make a machine that branches to two machines. */
+extern int mkbranch PROTO ((int, int));
+
+extern int mkclos PROTO ((int)); /* convert a machine into a closure */
+extern int mkopt PROTO ((int)); /* make a machine optional */
+
+/* Make a machine that matches either one of two machines. */
+extern int mkor PROTO ((int, int));
+
+/* Convert a machine into a positive closure. */
+extern int mkposcl PROTO ((int));
+
+extern int mkrep PROTO ((int, int, int)); /* make a replicated machine */
+
+/* Create a state with a transition on a given symbol. */
+extern int mkstate PROTO ((int));
+
+extern void new_rule PROTO ((void)); /* initialize for a new rule */
+
+
+/* from file parse.y */
+
+/* Build the "<<EOF>>" action for the active start conditions. */
+extern void build_eof_action PROTO ((void));
+
+/* Write out a message formatted with one string, pinpointing its location. */
+extern void format_pinpoint_message PROTO ((const char *, const char *));
+
+/* Write out a message, pinpointing its location. */
+extern void pinpoint_message PROTO ((const char *));
+
+/* Write out a warning, pinpointing it at the given line. */
+extern void line_warning PROTO ((const char *, int));
+
+/* Write out a message, pinpointing it at the given line. */
+extern void line_pinpoint PROTO ((const char *, int));
+
+/* Report a formatted syntax error. */
+extern void format_synerr PROTO ((const char *, const char *));
+extern void synerr PROTO ((const char *)); /* report a syntax error */
+extern void format_warn PROTO ((const char *, const char *));
+extern void warn PROTO ((const char *)); /* report a warning */
+extern void yyerror PROTO ((const char *)); /* report a parse error */
+extern int yyparse PROTO ((void)); /* the YACC parser */
+
+
+/* from file scan.l */
+
+/* The Flex-generated scanner for flex. */
+extern int flexscan PROTO ((void));
+
+/* Open the given file (if NULL, stdin) for scanning. */
+extern void set_input_file PROTO ((char *));
+
+/* Wrapup a file in the lexical analyzer. */
+extern int yywrap PROTO ((void));
+
+
+/* from file sym.c */
+
+/* Save the text of a character class. */
+extern void cclinstal PROTO ((Char[], int));
+
+/* Lookup the number associated with character class. */
+extern int ccllookup PROTO ((Char[]));
+
+extern void ndinstal PROTO ((const char *, Char[])); /* install a name definition */
+extern Char *ndlookup PROTO ((const char *)); /* lookup a name definition */
+
+/* Increase maximum number of SC's. */
+extern void scextend PROTO ((void));
+extern void scinstal PROTO ((const char *, int)); /* make a start condition */
+
+/* Lookup the number associated with a start condition. */
+extern int sclookup PROTO ((const char *));
+
+
+/* from file tblcmp.c */
+
+/* Build table entries for dfa state. */
+extern void bldtbl PROTO ((int[], int, int, int, int));
+
+extern void cmptmps PROTO ((void)); /* compress template table entries */
+extern void expand_nxt_chk PROTO ((void)); /* increase nxt/chk arrays */
+
+/* Finds a space in the table for a state to be placed. */
+extern int find_table_space PROTO ((int *, int));
+extern void inittbl PROTO ((void)); /* initialize transition tables */
+
+/* Make the default, "jam" table entries. */
+extern void mkdeftbl PROTO ((void));
+
+/* Create table entries for a state (or state fragment) which has
+ * only one out-transition.
+ */
+extern void mk1tbl PROTO ((int, int, int, int));
+
+/* Place a state into full speed transition table. */
+extern void place_state PROTO ((int *, int, int));
+
+/* Save states with only one out-transition to be processed later. */
+extern void stack1 PROTO ((int, int, int, int));
+
+
+/* from file yylex.c */
+
+extern int yylex PROTO ((void));
+
+/* A growable array. See buf.c. */
+struct Buf {
+ void *elts; /* elements. */
+ int nelts; /* number of elements. */
+ size_t elt_size; /* in bytes. */
+ int nmax; /* max capacity of elements. */
+};
+
+extern void buf_init PROTO ((struct Buf * buf, size_t elem_size));
+extern void buf_destroy PROTO ((struct Buf * buf));
+extern struct Buf *buf_append
+PROTO ((struct Buf * buf, const void *ptr, int n_elem));
+extern struct Buf *buf_concat PROTO((struct Buf* dest, const struct Buf* src));
+extern struct Buf *buf_strappend PROTO ((struct Buf *, const char *str));
+extern struct Buf *buf_strnappend
+PROTO ((struct Buf *, const char *str, int nchars));
+extern struct Buf *buf_strdefine
+PROTO ((struct Buf * buf, const char *str, const char *def));
+extern struct Buf *buf_prints PROTO((struct Buf *buf, const char *fmt, const char* s));
+extern struct Buf *buf_m4_define PROTO((struct Buf *buf, const char* def, const char* val));
+extern struct Buf *buf_m4_undefine PROTO((struct Buf *buf, const char* def));
+extern struct Buf *buf_print_strings PROTO((struct Buf * buf, FILE* out));
+extern struct Buf *buf_linedir PROTO((struct Buf *buf, const char* filename, int lineno));
+
+extern struct Buf userdef_buf; /* a string buffer for #define's generated by user-options on cmd line. */
+extern struct Buf defs_buf; /* a char* buffer to save #define'd some symbols generated by flex. */
+extern struct Buf yydmap_buf; /* a string buffer to hold yydmap elements */
+extern struct Buf m4defs_buf; /* Holds m4 definitions. */
+extern struct Buf top_buf; /* contains %top code. String buffer. */
+
+/* For blocking out code from the header file. */
+#define OUT_BEGIN_CODE() outn("m4_ifdef( [[M4_YY_IN_HEADER]],,[[")
+#define OUT_END_CODE() outn("]])")
+
+/* For setjmp/longjmp (instead of calling exit(2)). Linkage in main.c */
+extern jmp_buf flex_main_jmp_buf;
+
+#define FLEX_EXIT(status) longjmp(flex_main_jmp_buf,(status)+1)
+
+/* Removes all \n and \r chars from tail of str. returns str. */
+extern char *chomp (char *str);
+
+/* ctype functions forced to return boolean */
+#define b_isalnum(c) (isalnum(c)?true:false)
+#define b_isalpha(c) (isalpha(c)?true:false)
+#define b_isascii(c) (isascii(c)?true:false)
+#define b_isblank(c) (isblank(c)?true:false)
+#define b_iscntrl(c) (iscntrl(c)?true:false)
+#define b_isdigit(c) (isdigit(c)?true:false)
+#define b_isgraph(c) (isgraph(c)?true:false)
+#define b_islower(c) (islower(c)?true:false)
+#define b_isprint(c) (isprint(c)?true:false)
+#define b_ispunct(c) (ispunct(c)?true:false)
+#define b_isspace(c) (isspace(c)?true:false)
+#define b_isupper(c) (isupper(c)?true:false)
+#define b_isxdigit(c) (isxdigit(c)?true:false)
+
+/* return true if char is uppercase or lowercase. */
+bool has_case(int c);
+
+/* Change case of character if possible. */
+int reverse_case(int c);
+
+/* return false if [c1-c2] is ambiguous for a caseless scanner. */
+bool range_covers_case (int c1, int c2);
+
+/*
+ * From "filter.c"
+ */
+
+/** A single stdio filter to execute.
+ * The filter may be external, such as "sed", or it
+ * may be internal, as a function call.
+ */
+struct filter {
+ int (*filter_func)(struct filter*); /**< internal filter function */
+ void * extra; /**< extra data passed to filter_func */
+ int argc; /**< arg count */
+ const char ** argv; /**< arg vector, \0-terminated */
+ struct filter * next; /**< next filter or NULL */
+};
+
+/* output filter chain */
+extern struct filter * output_chain;
+extern struct filter *filter_create_ext PROTO((struct filter * chain, const char *cmd, ...));
+struct filter *filter_create_int PROTO((struct filter *chain,
+ int (*filter_func) (struct filter *),
+ void *extra));
+extern bool filter_apply_chain PROTO((struct filter * chain));
+extern int filter_truncate (struct filter * chain, int max_len);
+extern int filter_tee_header PROTO((struct filter *chain));
+extern int filter_fix_linedirs PROTO((struct filter *chain));
+
+
+/*
+ * From "regex.c"
+ */
+
+extern regex_t regex_linedir, regex_blank_line;
+bool flex_init_regex(void);
+void flex_regcomp(regex_t *preg, const char *regex, int cflags);
+char *regmatch_dup (regmatch_t * m, const char *src);
+char *regmatch_cpy (regmatch_t * m, char *dest, const char *src);
+int regmatch_len (regmatch_t * m);
+int regmatch_strtol (regmatch_t * m, const char *src, char **endptr, int base);
+bool regmatch_empty (regmatch_t * m);
+
+/* From "scanflags.h" */
+typedef unsigned int scanflags_t;
+extern scanflags_t* _sf_stk;
+extern size_t _sf_top_ix, _sf_max; /**< stack of scanner flags. */
+#define _SF_CASE_INS 0x0001
+#define _SF_DOT_ALL 0x0002
+#define _SF_SKIP_WS 0x0004
+#define sf_top() (_sf_stk[_sf_top_ix])
+#define sf_case_ins() (sf_top() & _SF_CASE_INS)
+#define sf_dot_all() (sf_top() & _SF_DOT_ALL)
+#define sf_skip_ws() (sf_top() & _SF_SKIP_WS)
+#define sf_set_case_ins(X) ((X) ? (sf_top() |= _SF_CASE_INS) : (sf_top() &= ~_SF_CASE_INS))
+#define sf_set_dot_all(X) ((X) ? (sf_top() |= _SF_DOT_ALL) : (sf_top() &= ~_SF_DOT_ALL))
+#define sf_set_skip_ws(X) ((X) ? (sf_top() |= _SF_SKIP_WS) : (sf_top() &= ~_SF_SKIP_WS))
+extern void sf_init(void);
+extern void sf_push(void);
+extern void sf_pop(void);
+
+
+#endif /* not defined FLEXDEF_H */
diff --git a/src/flexint.h b/src/flexint.h
new file mode 100644
index 0000000..f9fa80c
--- /dev/null
+++ b/src/flexint.h
@@ -0,0 +1,63 @@
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
diff --git a/src/gen.c b/src/gen.c
new file mode 100644
index 0000000..cee8a66
--- /dev/null
+++ b/src/gen.c
@@ -0,0 +1,2195 @@
+/* gen - actual generation (writing) of flex scanners */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+#include "tables.h"
+
+
+/* declare functions that have forward references */
+
+void gen_next_state PROTO ((int));
+void genecs PROTO ((void));
+void indent_put2s PROTO ((const char *, const char *));
+void indent_puts PROTO ((const char *));
+
+
+static int indent_level = 0; /* each level is 8 spaces */
+
+#define indent_up() (++indent_level)
+#define indent_down() (--indent_level)
+#define set_indent(indent_val) indent_level = indent_val
+
+/* Almost everything is done in terms of arrays starting at 1, so provide
+ * a null entry for the zero element of all C arrays. (The exception
+ * to this is that the fast table representation generally uses the
+ * 0 elements of its arrays, too.)
+ */
+
+static const char *get_int16_decl (void)
+{
+ return (gentables)
+ ? "static yyconst flex_int16_t %s[%d] =\n { 0,\n"
+ : "static yyconst flex_int16_t * %s = 0;\n";
+}
+
+
+static const char *get_int32_decl (void)
+{
+ return (gentables)
+ ? "static yyconst flex_int32_t %s[%d] =\n { 0,\n"
+ : "static yyconst flex_int32_t * %s = 0;\n";
+}
+
+static const char *get_state_decl (void)
+{
+ return (gentables)
+ ? "static yyconst yy_state_type %s[%d] =\n { 0,\n"
+ : "static yyconst yy_state_type * %s = 0;\n";
+}
+
+static const char *get_uint16_decl (void)
+{
+ return (gentables)
+ ? "static yyconst flex_uint16_t %s[%d] =\n { 0,\n"
+ : "static yyconst flex_uint16_t * %s = 0;\n";
+}
+
+static const char *get_uint32_decl (void)
+{
+ return (gentables)
+ ? "static yyconst flex_uint32_t %s[%d] =\n { 0,\n"
+ : "static yyconst flex_uint32_t * %s = 0;\n";
+}
+
+static const char *get_yy_char_decl (void)
+{
+ return (gentables)
+ ? "static yyconst YY_CHAR %s[%d] =\n { 0,\n"
+ : "static yyconst YY_CHAR * %s = 0;\n";
+}
+
+/* Indent to the current level. */
+
+void do_indent (void)
+{
+ int i = indent_level * 8;
+
+ while (i >= 8) {
+ outc ('\t');
+ i -= 8;
+ }
+
+ while (i > 0) {
+ outc (' ');
+ --i;
+ }
+}
+
+
+/** Make the table for possible eol matches.
+ * @return the newly allocated rule_can_match_eol table
+ */
+static struct yytbl_data *mkeoltbl (void)
+{
+ int i;
+ flex_int8_t *tdata = 0;
+ struct yytbl_data *tbl;
+
+ tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
+ yytbl_data_init (tbl, YYTD_ID_RULE_CAN_MATCH_EOL);
+ tbl->td_flags = YYTD_DATA8;
+ tbl->td_lolen = num_rules + 1;
+ tbl->td_data = tdata =
+ (flex_int8_t *) calloc (tbl->td_lolen, sizeof (flex_int8_t));
+
+ for (i = 1; i <= num_rules; i++)
+ tdata[i] = rule_has_nl[i] ? 1 : 0;
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_RULE_CAN_MATCH_EOL, (void**)&yy_rule_can_match_eol, sizeof(%s)},\n",
+ "flex_int32_t");
+ return tbl;
+}
+
+/* Generate the table for possible eol matches. */
+static void geneoltbl (void)
+{
+ int i;
+
+ outn ("m4_ifdef( [[M4_YY_USE_LINENO]],[[");
+ outn ("/* Table of booleans, true if rule could match eol. */");
+ out_str_dec (get_int32_decl (), "yy_rule_can_match_eol",
+ num_rules + 1);
+
+ if (gentables) {
+ for (i = 1; i <= num_rules; i++) {
+ out_dec ("%d, ", rule_has_nl[i] ? 1 : 0);
+ /* format nicely, 20 numbers per line. */
+ if ((i % 20) == 19)
+ out ("\n ");
+ }
+ out (" };\n");
+ }
+ outn ("]])");
+}
+
+
+/* Generate the code to keep backing-up information. */
+
+void gen_backing_up (void)
+{
+ if (reject || num_backing_up == 0)
+ return;
+
+ if (fullspd)
+ indent_puts ("if ( yy_current_state[-1].yy_nxt )");
+ else
+ indent_puts ("if ( yy_accept[yy_current_state] )");
+
+ indent_up ();
+ indent_puts ("{");
+ indent_puts ("YY_G(yy_last_accepting_state) = yy_current_state;");
+ indent_puts ("YY_G(yy_last_accepting_cpos) = yy_cp;");
+ indent_puts ("}");
+ indent_down ();
+}
+
+
+/* Generate the code to perform the backing up. */
+
+void gen_bu_action (void)
+{
+ if (reject || num_backing_up == 0)
+ return;
+
+ set_indent (3);
+
+ indent_puts ("case 0: /* must back up */");
+ indent_puts ("/* undo the effects of YY_DO_BEFORE_ACTION */");
+ indent_puts ("*yy_cp = YY_G(yy_hold_char);");
+
+ if (fullspd || fulltbl)
+ indent_puts ("yy_cp = YY_G(yy_last_accepting_cpos) + 1;");
+ else
+ /* Backing-up info for compressed tables is taken \after/
+ * yy_cp has been incremented for the next state.
+ */
+ indent_puts ("yy_cp = YY_G(yy_last_accepting_cpos);");
+
+ indent_puts ("yy_current_state = YY_G(yy_last_accepting_state);");
+ indent_puts ("goto yy_find_action;");
+ outc ('\n');
+
+ set_indent (0);
+}
+
+/** mkctbl - make full speed compressed transition table
+ * This is an array of structs; each struct a pair of integers.
+ * You should call mkssltbl() immediately after this.
+ * Then, I think, mkecstbl(). Arrrg.
+ * @return the newly allocated trans table
+ */
+
+static struct yytbl_data *mkctbl (void)
+{
+ int i;
+ struct yytbl_data *tbl = 0;
+ flex_int32_t *tdata = 0, curr = 0;
+ int end_of_buffer_action = num_rules + 1;
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_TRANSITION, (void**)&yy_transition, sizeof(%s)},\n",
+ ((tblend + numecs + 1) >= INT16_MAX
+ || long_align) ? "flex_int32_t" : "flex_int16_t");
+
+ tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
+ yytbl_data_init (tbl, YYTD_ID_TRANSITION);
+ tbl->td_flags = YYTD_DATA32 | YYTD_STRUCT;
+ tbl->td_hilen = 0;
+ tbl->td_lolen = tblend + numecs + 1; /* number of structs */
+
+ tbl->td_data = tdata =
+ (flex_int32_t *) calloc (tbl->td_lolen * 2, sizeof (flex_int32_t));
+
+ /* We want the transition to be represented as the offset to the
+ * next state, not the actual state number, which is what it currently
+ * is. The offset is base[nxt[i]] - (base of current state)]. That's
+ * just the difference between the starting points of the two involved
+ * states (to - from).
+ *
+ * First, though, we need to find some way to put in our end-of-buffer
+ * flags and states. We do this by making a state with absolutely no
+ * transitions. We put it at the end of the table.
+ */
+
+ /* We need to have room in nxt/chk for two more slots: One for the
+ * action and one for the end-of-buffer transition. We now *assume*
+ * that we're guaranteed the only character we'll try to index this
+ * nxt/chk pair with is EOB, i.e., 0, so we don't have to make sure
+ * there's room for jam entries for other characters.
+ */
+
+ while (tblend + 2 >= current_max_xpairs)
+ expand_nxt_chk ();
+
+ while (lastdfa + 1 >= current_max_dfas)
+ increase_max_dfas ();
+
+ base[lastdfa + 1] = tblend + 2;
+ nxt[tblend + 1] = end_of_buffer_action;
+ chk[tblend + 1] = numecs + 1;
+ chk[tblend + 2] = 1; /* anything but EOB */
+
+ /* So that "make test" won't show arb. differences. */
+ nxt[tblend + 2] = 0;
+
+ /* Make sure every state has an end-of-buffer transition and an
+ * action #.
+ */
+ for (i = 0; i <= lastdfa; ++i) {
+ int anum = dfaacc[i].dfaacc_state;
+ int offset = base[i];
+
+ chk[offset] = EOB_POSITION;
+ chk[offset - 1] = ACTION_POSITION;
+ nxt[offset - 1] = anum; /* action number */
+ }
+
+ for (i = 0; i <= tblend; ++i) {
+ if (chk[i] == EOB_POSITION) {
+ tdata[curr++] = 0;
+ tdata[curr++] = base[lastdfa + 1] - i;
+ }
+
+ else if (chk[i] == ACTION_POSITION) {
+ tdata[curr++] = 0;
+ tdata[curr++] = nxt[i];
+ }
+
+ else if (chk[i] > numecs || chk[i] == 0) {
+ tdata[curr++] = 0;
+ tdata[curr++] = 0;
+ }
+ else { /* verify, transition */
+
+ tdata[curr++] = chk[i];
+ tdata[curr++] = base[nxt[i]] - (i - chk[i]);
+ }
+ }
+
+
+ /* Here's the final, end-of-buffer state. */
+ tdata[curr++] = chk[tblend + 1];
+ tdata[curr++] = nxt[tblend + 1];
+
+ tdata[curr++] = chk[tblend + 2];
+ tdata[curr++] = nxt[tblend + 2];
+
+ return tbl;
+}
+
+
+/** Make start_state_list table.
+ * @return the newly allocated start_state_list table
+ */
+static struct yytbl_data *mkssltbl (void)
+{
+ struct yytbl_data *tbl = 0;
+ flex_int32_t *tdata = 0;
+ flex_int32_t i;
+
+ tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
+ yytbl_data_init (tbl, YYTD_ID_START_STATE_LIST);
+ tbl->td_flags = YYTD_DATA32 | YYTD_PTRANS;
+ tbl->td_hilen = 0;
+ tbl->td_lolen = lastsc * 2 + 1;
+
+ tbl->td_data = tdata =
+ (flex_int32_t *) calloc (tbl->td_lolen, sizeof (flex_int32_t));
+
+ for (i = 0; i <= lastsc * 2; ++i)
+ tdata[i] = base[i];
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_START_STATE_LIST, (void**)&yy_start_state_list, sizeof(%s)},\n",
+ "struct yy_trans_info*");
+
+ return tbl;
+}
+
+
+
+/* genctbl - generates full speed compressed transition table */
+
+void genctbl (void)
+{
+ int i;
+ int end_of_buffer_action = num_rules + 1;
+
+ /* Table of verify for transition and offset to next state. */
+ if (gentables)
+ out_dec ("static yyconst struct yy_trans_info yy_transition[%d] =\n {\n", tblend + numecs + 1);
+ else
+ outn ("static yyconst struct yy_trans_info *yy_transition = 0;");
+
+ /* We want the transition to be represented as the offset to the
+ * next state, not the actual state number, which is what it currently
+ * is. The offset is base[nxt[i]] - (base of current state)]. That's
+ * just the difference between the starting points of the two involved
+ * states (to - from).
+ *
+ * First, though, we need to find some way to put in our end-of-buffer
+ * flags and states. We do this by making a state with absolutely no
+ * transitions. We put it at the end of the table.
+ */
+
+ /* We need to have room in nxt/chk for two more slots: One for the
+ * action and one for the end-of-buffer transition. We now *assume*
+ * that we're guaranteed the only character we'll try to index this
+ * nxt/chk pair with is EOB, i.e., 0, so we don't have to make sure
+ * there's room for jam entries for other characters.
+ */
+
+ while (tblend + 2 >= current_max_xpairs)
+ expand_nxt_chk ();
+
+ while (lastdfa + 1 >= current_max_dfas)
+ increase_max_dfas ();
+
+ base[lastdfa + 1] = tblend + 2;
+ nxt[tblend + 1] = end_of_buffer_action;
+ chk[tblend + 1] = numecs + 1;
+ chk[tblend + 2] = 1; /* anything but EOB */
+
+ /* So that "make test" won't show arb. differences. */
+ nxt[tblend + 2] = 0;
+
+ /* Make sure every state has an end-of-buffer transition and an
+ * action #.
+ */
+ for (i = 0; i <= lastdfa; ++i) {
+ int anum = dfaacc[i].dfaacc_state;
+ int offset = base[i];
+
+ chk[offset] = EOB_POSITION;
+ chk[offset - 1] = ACTION_POSITION;
+ nxt[offset - 1] = anum; /* action number */
+ }
+
+ for (i = 0; i <= tblend; ++i) {
+ if (chk[i] == EOB_POSITION)
+ transition_struct_out (0, base[lastdfa + 1] - i);
+
+ else if (chk[i] == ACTION_POSITION)
+ transition_struct_out (0, nxt[i]);
+
+ else if (chk[i] > numecs || chk[i] == 0)
+ transition_struct_out (0, 0); /* unused slot */
+
+ else /* verify, transition */
+ transition_struct_out (chk[i],
+ base[nxt[i]] - (i -
+ chk[i]));
+ }
+
+
+ /* Here's the final, end-of-buffer state. */
+ transition_struct_out (chk[tblend + 1], nxt[tblend + 1]);
+ transition_struct_out (chk[tblend + 2], nxt[tblend + 2]);
+
+ if (gentables)
+ outn (" };\n");
+
+ /* Table of pointers to start states. */
+ if (gentables)
+ out_dec ("static yyconst struct yy_trans_info *yy_start_state_list[%d] =\n", lastsc * 2 + 1);
+ else
+ outn ("static yyconst struct yy_trans_info **yy_start_state_list =0;");
+
+ if (gentables) {
+ outn (" {");
+
+ for (i = 0; i <= lastsc * 2; ++i)
+ out_dec (" &yy_transition[%d],\n", base[i]);
+
+ dataend ();
+ }
+
+ if (useecs)
+ genecs ();
+}
+
+
+/* mkecstbl - Make equivalence-class tables. */
+
+struct yytbl_data *mkecstbl (void)
+{
+ int i;
+ struct yytbl_data *tbl = 0;
+ flex_int32_t *tdata = 0;
+
+ tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
+ yytbl_data_init (tbl, YYTD_ID_EC);
+ tbl->td_flags |= YYTD_DATA32;
+ tbl->td_hilen = 0;
+ tbl->td_lolen = csize;
+
+ tbl->td_data = tdata =
+ (flex_int32_t *) calloc (tbl->td_lolen, sizeof (flex_int32_t));
+
+ for (i = 1; i < csize; ++i) {
+ ecgroup[i] = ABS (ecgroup[i]);
+ tdata[i] = ecgroup[i];
+ }
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_EC, (void**)&yy_ec, sizeof(%s)},\n",
+ "YY_CHAR");
+
+ return tbl;
+}
+
+/* Generate equivalence-class tables. */
+
+void genecs (void)
+{
+ int i, j;
+ int numrows;
+
+ out_str_dec (get_yy_char_decl (), "yy_ec", csize);
+
+ for (i = 1; i < csize; ++i) {
+ ecgroup[i] = ABS (ecgroup[i]);
+ mkdata (ecgroup[i]);
+ }
+
+ dataend ();
+
+ if (trace) {
+ fputs (_("\n\nEquivalence Classes:\n\n"), stderr);
+
+ numrows = csize / 8;
+
+ for (j = 0; j < numrows; ++j) {
+ for (i = j; i < csize; i = i + numrows) {
+ fprintf (stderr, "%4s = %-2d",
+ readable_form (i), ecgroup[i]);
+
+ putc (' ', stderr);
+ }
+
+ putc ('\n', stderr);
+ }
+ }
+}
+
+
+/* Generate the code to find the action number. */
+
+void gen_find_action (void)
+{
+ if (fullspd)
+ indent_puts ("yy_act = yy_current_state[-1].yy_nxt;");
+
+ else if (fulltbl)
+ indent_puts ("yy_act = yy_accept[yy_current_state];");
+
+ else if (reject) {
+ indent_puts ("yy_current_state = *--YY_G(yy_state_ptr);");
+ indent_puts ("YY_G(yy_lp) = yy_accept[yy_current_state];");
+
+ if(reject_really_used)
+ outn ("find_rule: /* we branch to this label when backing up */");
+
+ indent_puts
+ ("for ( ; ; ) /* until we find what rule we matched */");
+
+ indent_up ();
+
+ indent_puts ("{");
+
+ indent_puts
+ ("if ( YY_G(yy_lp) && YY_G(yy_lp) < yy_accept[yy_current_state + 1] )");
+ indent_up ();
+ indent_puts ("{");
+ indent_puts ("yy_act = yy_acclist[YY_G(yy_lp)];");
+
+ if (variable_trailing_context_rules) {
+ indent_puts
+ ("if ( yy_act & YY_TRAILING_HEAD_MASK ||");
+ indent_puts (" YY_G(yy_looking_for_trail_begin) )");
+ indent_up ();
+ indent_puts ("{");
+
+ indent_puts
+ ("if ( yy_act == YY_G(yy_looking_for_trail_begin) )");
+ indent_up ();
+ indent_puts ("{");
+ indent_puts ("YY_G(yy_looking_for_trail_begin) = 0;");
+ indent_puts ("yy_act &= ~YY_TRAILING_HEAD_MASK;");
+ indent_puts ("break;");
+ indent_puts ("}");
+ indent_down ();
+
+ indent_puts ("}");
+ indent_down ();
+
+ indent_puts
+ ("else if ( yy_act & YY_TRAILING_MASK )");
+ indent_up ();
+ indent_puts ("{");
+ indent_puts
+ ("YY_G(yy_looking_for_trail_begin) = yy_act & ~YY_TRAILING_MASK;");
+ indent_puts
+ ("YY_G(yy_looking_for_trail_begin) |= YY_TRAILING_HEAD_MASK;");
+
+ if (real_reject) {
+ /* Remember matched text in case we back up
+ * due to REJECT.
+ */
+ indent_puts
+ ("YY_G(yy_full_match) = yy_cp;");
+ indent_puts
+ ("YY_G(yy_full_state) = YY_G(yy_state_ptr);");
+ indent_puts ("YY_G(yy_full_lp) = YY_G(yy_lp);");
+ }
+
+ indent_puts ("}");
+ indent_down ();
+
+ indent_puts ("else");
+ indent_up ();
+ indent_puts ("{");
+ indent_puts ("YY_G(yy_full_match) = yy_cp;");
+ indent_puts
+ ("YY_G(yy_full_state) = YY_G(yy_state_ptr);");
+ indent_puts ("YY_G(yy_full_lp) = YY_G(yy_lp);");
+ indent_puts ("break;");
+ indent_puts ("}");
+ indent_down ();
+
+ indent_puts ("++YY_G(yy_lp);");
+ indent_puts ("goto find_rule;");
+ }
+
+ else {
+ /* Remember matched text in case we back up due to
+ * trailing context plus REJECT.
+ */
+ indent_up ();
+ indent_puts ("{");
+ indent_puts ("YY_G(yy_full_match) = yy_cp;");
+ indent_puts ("break;");
+ indent_puts ("}");
+ indent_down ();
+ }
+
+ indent_puts ("}");
+ indent_down ();
+
+ indent_puts ("--yy_cp;");
+
+ /* We could consolidate the following two lines with those at
+ * the beginning, but at the cost of complaints that we're
+ * branching inside a loop.
+ */
+ indent_puts ("yy_current_state = *--YY_G(yy_state_ptr);");
+ indent_puts ("YY_G(yy_lp) = yy_accept[yy_current_state];");
+
+ indent_puts ("}");
+
+ indent_down ();
+ }
+
+ else { /* compressed */
+ indent_puts ("yy_act = yy_accept[yy_current_state];");
+
+ if (interactive && !reject) {
+ /* Do the guaranteed-needed backing up to figure out
+ * the match.
+ */
+ indent_puts ("if ( yy_act == 0 )");
+ indent_up ();
+ indent_puts ("{ /* have to back up */");
+ indent_puts
+ ("yy_cp = YY_G(yy_last_accepting_cpos);");
+ indent_puts
+ ("yy_current_state = YY_G(yy_last_accepting_state);");
+ indent_puts
+ ("yy_act = yy_accept[yy_current_state];");
+ indent_puts ("}");
+ indent_down ();
+ }
+ }
+}
+
+/* mkftbl - make the full table and return the struct .
+ * you should call mkecstbl() after this.
+ */
+
+struct yytbl_data *mkftbl (void)
+{
+ int i;
+ int end_of_buffer_action = num_rules + 1;
+ struct yytbl_data *tbl;
+ flex_int32_t *tdata = 0;
+
+ tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
+ yytbl_data_init (tbl, YYTD_ID_ACCEPT);
+ tbl->td_flags |= YYTD_DATA32;
+ tbl->td_hilen = 0; /* it's a one-dimensional array */
+ tbl->td_lolen = lastdfa + 1;
+
+ tbl->td_data = tdata =
+ (flex_int32_t *) calloc (tbl->td_lolen, sizeof (flex_int32_t));
+
+ dfaacc[end_of_buffer_state].dfaacc_state = end_of_buffer_action;
+
+ for (i = 1; i <= lastdfa; ++i) {
+ int anum = dfaacc[i].dfaacc_state;
+
+ tdata[i] = anum;
+
+ if (trace && anum)
+ fprintf (stderr, _("state # %d accepts: [%d]\n"),
+ i, anum);
+ }
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_ACCEPT, (void**)&yy_accept, sizeof(%s)},\n",
+ long_align ? "flex_int32_t" : "flex_int16_t");
+ return tbl;
+}
+
+
+/* genftbl - generate full transition table */
+
+void genftbl (void)
+{
+ int i;
+ int end_of_buffer_action = num_rules + 1;
+
+ out_str_dec (long_align ? get_int32_decl () : get_int16_decl (),
+ "yy_accept", lastdfa + 1);
+
+ dfaacc[end_of_buffer_state].dfaacc_state = end_of_buffer_action;
+
+ for (i = 1; i <= lastdfa; ++i) {
+ int anum = dfaacc[i].dfaacc_state;
+
+ mkdata (anum);
+
+ if (trace && anum)
+ fprintf (stderr, _("state # %d accepts: [%d]\n"),
+ i, anum);
+ }
+
+ dataend ();
+
+ if (useecs)
+ genecs ();
+
+ /* Don't have to dump the actual full table entries - they were
+ * created on-the-fly.
+ */
+}
+
+
+/* Generate the code to find the next compressed-table state. */
+
+void gen_next_compressed_state (char_map)
+ char *char_map;
+{
+ indent_put2s ("YY_CHAR yy_c = %s;", char_map);
+
+ /* Save the backing-up info \before/ computing the next state
+ * because we always compute one more state than needed - we
+ * always proceed until we reach a jam state
+ */
+ gen_backing_up ();
+
+ indent_puts
+ ("while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )");
+ indent_up ();
+ indent_puts ("{");
+ indent_puts ("yy_current_state = (int) yy_def[yy_current_state];");
+
+ if (usemecs) {
+ /* We've arrange it so that templates are never chained
+ * to one another. This means we can afford to make a
+ * very simple test to see if we need to convert to
+ * yy_c's meta-equivalence class without worrying
+ * about erroneously looking up the meta-equivalence
+ * class twice
+ */
+ do_indent ();
+
+ /* lastdfa + 2 is the beginning of the templates */
+ out_dec ("if ( yy_current_state >= %d )\n", lastdfa + 2);
+
+ indent_up ();
+ indent_puts ("yy_c = yy_meta[(unsigned int) yy_c];");
+ indent_down ();
+ }
+
+ indent_puts ("}");
+ indent_down ();
+
+ indent_puts
+ ("yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];");
+}
+
+
+/* Generate the code to find the next match. */
+
+void gen_next_match (void)
+{
+ /* NOTE - changes in here should be reflected in gen_next_state() and
+ * gen_NUL_trans().
+ */
+ char *char_map = useecs ?
+ "yy_ec[YY_SC_TO_UI(*yy_cp)] " : "YY_SC_TO_UI(*yy_cp)";
+
+ char *char_map_2 = useecs ?
+ "yy_ec[YY_SC_TO_UI(*++yy_cp)] " : "YY_SC_TO_UI(*++yy_cp)";
+
+ if (fulltbl) {
+ if (gentables)
+ indent_put2s
+ ("while ( (yy_current_state = yy_nxt[yy_current_state][ %s ]) > 0 )",
+ char_map);
+ else
+ indent_put2s
+ ("while ( (yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + %s ]) > 0 )",
+ char_map);
+
+ indent_up ();
+
+ if (num_backing_up > 0) {
+ indent_puts ("{");
+ gen_backing_up ();
+ outc ('\n');
+ }
+
+ indent_puts ("++yy_cp;");
+
+ if (num_backing_up > 0)
+
+ indent_puts ("}");
+
+ indent_down ();
+
+ outc ('\n');
+ indent_puts ("yy_current_state = -yy_current_state;");
+ }
+
+ else if (fullspd) {
+ indent_puts ("{");
+ indent_puts
+ ("yyconst struct yy_trans_info *yy_trans_info;\n");
+ indent_puts ("YY_CHAR yy_c;\n");
+ indent_put2s ("for ( yy_c = %s;", char_map);
+ indent_puts
+ (" (yy_trans_info = &yy_current_state[(unsigned int) yy_c])->");
+ indent_puts ("yy_verify == yy_c;");
+ indent_put2s (" yy_c = %s )", char_map_2);
+
+ indent_up ();
+
+ if (num_backing_up > 0)
+ indent_puts ("{");
+
+ indent_puts ("yy_current_state += yy_trans_info->yy_nxt;");
+
+ if (num_backing_up > 0) {
+ outc ('\n');
+ gen_backing_up ();
+ indent_puts ("}");
+ }
+
+ indent_down ();
+ indent_puts ("}");
+ }
+
+ else { /* compressed */
+ indent_puts ("do");
+
+ indent_up ();
+ indent_puts ("{");
+
+ gen_next_state (false);
+
+ indent_puts ("++yy_cp;");
+
+
+ indent_puts ("}");
+ indent_down ();
+
+ do_indent ();
+
+ if (interactive)
+ out_dec ("while ( yy_base[yy_current_state] != %d );\n", jambase);
+ else
+ out_dec ("while ( yy_current_state != %d );\n",
+ jamstate);
+
+ if (!reject && !interactive) {
+ /* Do the guaranteed-needed backing up to figure out
+ * the match.
+ */
+ indent_puts
+ ("yy_cp = YY_G(yy_last_accepting_cpos);");
+ indent_puts
+ ("yy_current_state = YY_G(yy_last_accepting_state);");
+ }
+ }
+}
+
+
+/* Generate the code to find the next state. */
+
+void gen_next_state (worry_about_NULs)
+ int worry_about_NULs;
+{ /* NOTE - changes in here should be reflected in gen_next_match() */
+ char char_map[256];
+
+ if (worry_about_NULs && !nultrans) {
+ if (useecs)
+ snprintf (char_map, sizeof(char_map),
+ "(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : %d)",
+ NUL_ec);
+ else
+ snprintf (char_map, sizeof(char_map),
+ "(*yy_cp ? YY_SC_TO_UI(*yy_cp) : %d)",
+ NUL_ec);
+ }
+
+ else
+ strcpy (char_map, useecs ?
+ "yy_ec[YY_SC_TO_UI(*yy_cp)] " :
+ "YY_SC_TO_UI(*yy_cp)");
+
+ if (worry_about_NULs && nultrans) {
+ if (!fulltbl && !fullspd)
+ /* Compressed tables back up *before* they match. */
+ gen_backing_up ();
+
+ indent_puts ("if ( *yy_cp )");
+ indent_up ();
+ indent_puts ("{");
+ }
+
+ if (fulltbl) {
+ if (gentables)
+ indent_put2s
+ ("yy_current_state = yy_nxt[yy_current_state][%s];",
+ char_map);
+ else
+ indent_put2s
+ ("yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + %s];",
+ char_map);
+ }
+
+ else if (fullspd)
+ indent_put2s
+ ("yy_current_state += yy_current_state[%s].yy_nxt;",
+ char_map);
+
+ else
+ gen_next_compressed_state (char_map);
+
+ if (worry_about_NULs && nultrans) {
+
+ indent_puts ("}");
+ indent_down ();
+ indent_puts ("else");
+ indent_up ();
+ indent_puts
+ ("yy_current_state = yy_NUL_trans[yy_current_state];");
+ indent_down ();
+ }
+
+ if (fullspd || fulltbl)
+ gen_backing_up ();
+
+ if (reject)
+ indent_puts ("*YY_G(yy_state_ptr)++ = yy_current_state;");
+}
+
+
+/* Generate the code to make a NUL transition. */
+
+void gen_NUL_trans (void)
+{ /* NOTE - changes in here should be reflected in gen_next_match() */
+ /* Only generate a definition for "yy_cp" if we'll generate code
+ * that uses it. Otherwise lint and the like complain.
+ */
+ int need_backing_up = (num_backing_up > 0 && !reject);
+
+ if (need_backing_up && (!nultrans || fullspd || fulltbl))
+ /* We're going to need yy_cp lying around for the call
+ * below to gen_backing_up().
+ */
+ indent_puts ("char *yy_cp = YY_G(yy_c_buf_p);");
+
+ outc ('\n');
+
+ if (nultrans) {
+ indent_puts
+ ("yy_current_state = yy_NUL_trans[yy_current_state];");
+ indent_puts ("yy_is_jam = (yy_current_state == 0);");
+ }
+
+ else if (fulltbl) {
+ do_indent ();
+ if (gentables)
+ out_dec ("yy_current_state = yy_nxt[yy_current_state][%d];\n", NUL_ec);
+ else
+ out_dec ("yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + %d];\n", NUL_ec);
+ indent_puts ("yy_is_jam = (yy_current_state <= 0);");
+ }
+
+ else if (fullspd) {
+ do_indent ();
+ out_dec ("int yy_c = %d;\n", NUL_ec);
+
+ indent_puts
+ ("yyconst struct yy_trans_info *yy_trans_info;\n");
+ indent_puts
+ ("yy_trans_info = &yy_current_state[(unsigned int) yy_c];");
+ indent_puts ("yy_current_state += yy_trans_info->yy_nxt;");
+
+ indent_puts
+ ("yy_is_jam = (yy_trans_info->yy_verify != yy_c);");
+ }
+
+ else {
+ char NUL_ec_str[20];
+
+ snprintf (NUL_ec_str, sizeof(NUL_ec_str), "%d", NUL_ec);
+ gen_next_compressed_state (NUL_ec_str);
+
+ do_indent ();
+ out_dec ("yy_is_jam = (yy_current_state == %d);\n",
+ jamstate);
+
+ if (reject) {
+ /* Only stack this state if it's a transition we
+ * actually make. If we stack it on a jam, then
+ * the state stack and yy_c_buf_p get out of sync.
+ */
+ indent_puts ("if ( ! yy_is_jam )");
+ indent_up ();
+ indent_puts
+ ("*YY_G(yy_state_ptr)++ = yy_current_state;");
+ indent_down ();
+ }
+ }
+
+ /* If we've entered an accepting state, back up; note that
+ * compressed tables have *already* done such backing up, so
+ * we needn't bother with it again.
+ */
+ if (need_backing_up && (fullspd || fulltbl)) {
+ outc ('\n');
+ indent_puts ("if ( ! yy_is_jam )");
+ indent_up ();
+ indent_puts ("{");
+ gen_backing_up ();
+ indent_puts ("}");
+ indent_down ();
+ }
+}
+
+
+/* Generate the code to find the start state. */
+
+void gen_start_state (void)
+{
+ if (fullspd) {
+ if (bol_needed) {
+ indent_puts
+ ("yy_current_state = yy_start_state_list[YY_G(yy_start) + YY_AT_BOL()];");
+ }
+ else
+ indent_puts
+ ("yy_current_state = yy_start_state_list[YY_G(yy_start)];");
+ }
+
+ else {
+ indent_puts ("yy_current_state = YY_G(yy_start);");
+
+ if (bol_needed)
+ indent_puts ("yy_current_state += YY_AT_BOL();");
+
+ if (reject) {
+ /* Set up for storing up states. */
+ outn ("m4_ifdef( [[M4_YY_USES_REJECT]],\n[[");
+ indent_puts
+ ("YY_G(yy_state_ptr) = YY_G(yy_state_buf);");
+ indent_puts
+ ("*YY_G(yy_state_ptr)++ = yy_current_state;");
+ outn ("]])");
+ }
+ }
+}
+
+
+/* gentabs - generate data statements for the transition tables */
+
+void gentabs (void)
+{
+ int i, j, k, *accset, nacc, *acc_array, total_states;
+ int end_of_buffer_action = num_rules + 1;
+ struct yytbl_data *yyacc_tbl = 0, *yymeta_tbl = 0, *yybase_tbl = 0,
+ *yydef_tbl = 0, *yynxt_tbl = 0, *yychk_tbl = 0, *yyacclist_tbl=0;
+ flex_int32_t *yyacc_data = 0, *yybase_data = 0, *yydef_data = 0,
+ *yynxt_data = 0, *yychk_data = 0, *yyacclist_data=0;
+ flex_int32_t yybase_curr = 0, yyacclist_curr=0,yyacc_curr=0;
+
+ acc_array = allocate_integer_array (current_max_dfas);
+ nummt = 0;
+
+ /* The compressed table format jams by entering the "jam state",
+ * losing information about the previous state in the process.
+ * In order to recover the previous state, we effectively need
+ * to keep backing-up information.
+ */
+ ++num_backing_up;
+
+ if (reject) {
+ /* Write out accepting list and pointer list.
+
+ * First we generate the "yy_acclist" array. In the process,
+ * we compute the indices that will go into the "yy_accept"
+ * array, and save the indices in the dfaacc array.
+ */
+ int EOB_accepting_list[2];
+
+ /* Set up accepting structures for the End Of Buffer state. */
+ EOB_accepting_list[0] = 0;
+ EOB_accepting_list[1] = end_of_buffer_action;
+ accsiz[end_of_buffer_state] = 1;
+ dfaacc[end_of_buffer_state].dfaacc_set =
+ EOB_accepting_list;
+
+ out_str_dec (long_align ? get_int32_decl () :
+ get_int16_decl (), "yy_acclist", MAX (numas,
+ 1) + 1);
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_ACCLIST, (void**)&yy_acclist, sizeof(%s)},\n",
+ long_align ? "flex_int32_t" : "flex_int16_t");
+
+ yyacclist_tbl = (struct yytbl_data*)calloc(1,sizeof(struct yytbl_data));
+ yytbl_data_init (yyacclist_tbl, YYTD_ID_ACCLIST);
+ yyacclist_tbl->td_lolen = MAX(numas,1) + 1;
+ yyacclist_tbl->td_data = yyacclist_data =
+ (flex_int32_t *) calloc (yyacclist_tbl->td_lolen, sizeof (flex_int32_t));
+ yyacclist_curr = 1;
+
+ j = 1; /* index into "yy_acclist" array */
+
+ for (i = 1; i <= lastdfa; ++i) {
+ acc_array[i] = j;
+
+ if (accsiz[i] != 0) {
+ accset = dfaacc[i].dfaacc_set;
+ nacc = accsiz[i];
+
+ if (trace)
+ fprintf (stderr,
+ _("state # %d accepts: "),
+ i);
+
+ for (k = 1; k <= nacc; ++k) {
+ int accnum = accset[k];
+
+ ++j;
+
+ if (variable_trailing_context_rules
+ && !(accnum &
+ YY_TRAILING_HEAD_MASK)
+ && accnum > 0
+ && accnum <= num_rules
+ && rule_type[accnum] ==
+ RULE_VARIABLE) {
+ /* Special hack to flag
+ * accepting number as part
+ * of trailing context rule.
+ */
+ accnum |= YY_TRAILING_MASK;
+ }
+
+ mkdata (accnum);
+ yyacclist_data[yyacclist_curr++] = accnum;
+
+ if (trace) {
+ fprintf (stderr, "[%d]",
+ accset[k]);
+
+ if (k < nacc)
+ fputs (", ",
+ stderr);
+ else
+ putc ('\n',
+ stderr);
+ }
+ }
+ }
+ }
+
+ /* add accepting number for the "jam" state */
+ acc_array[i] = j;
+
+ dataend ();
+ if (tablesext) {
+ yytbl_data_compress (yyacclist_tbl);
+ if (yytbl_data_fwrite (&tableswr, yyacclist_tbl) < 0)
+ flexerror (_("Could not write yyacclist_tbl"));
+ yytbl_data_destroy (yyacclist_tbl);
+ yyacclist_tbl = NULL;
+ }
+ }
+
+ else {
+ dfaacc[end_of_buffer_state].dfaacc_state =
+ end_of_buffer_action;
+
+ for (i = 1; i <= lastdfa; ++i)
+ acc_array[i] = dfaacc[i].dfaacc_state;
+
+ /* add accepting number for jam state */
+ acc_array[i] = 0;
+ }
+
+ /* Begin generating yy_accept */
+
+ /* Spit out "yy_accept" array. If we're doing "reject", it'll be
+ * pointers into the "yy_acclist" array. Otherwise it's actual
+ * accepting numbers. In either case, we just dump the numbers.
+ */
+
+ /* "lastdfa + 2" is the size of "yy_accept"; includes room for C arrays
+ * beginning at 0 and for "jam" state.
+ */
+ k = lastdfa + 2;
+
+ if (reject)
+ /* We put a "cap" on the table associating lists of accepting
+ * numbers with state numbers. This is needed because we tell
+ * where the end of an accepting list is by looking at where
+ * the list for the next state starts.
+ */
+ ++k;
+
+ out_str_dec (long_align ? get_int32_decl () : get_int16_decl (),
+ "yy_accept", k);
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_ACCEPT, (void**)&yy_accept, sizeof(%s)},\n",
+ long_align ? "flex_int32_t" : "flex_int16_t");
+
+ yyacc_tbl =
+ (struct yytbl_data *) calloc (1,
+ sizeof (struct yytbl_data));
+ yytbl_data_init (yyacc_tbl, YYTD_ID_ACCEPT);
+ yyacc_tbl->td_lolen = k;
+ yyacc_tbl->td_data = yyacc_data =
+ (flex_int32_t *) calloc (yyacc_tbl->td_lolen, sizeof (flex_int32_t));
+ yyacc_curr=1;
+
+ for (i = 1; i <= lastdfa; ++i) {
+ mkdata (acc_array[i]);
+ yyacc_data[yyacc_curr++] = acc_array[i];
+
+ if (!reject && trace && acc_array[i])
+ fprintf (stderr, _("state # %d accepts: [%d]\n"),
+ i, acc_array[i]);
+ }
+
+ /* Add entry for "jam" state. */
+ mkdata (acc_array[i]);
+ yyacc_data[yyacc_curr++] = acc_array[i];
+
+ if (reject) {
+ /* Add "cap" for the list. */
+ mkdata (acc_array[i]);
+ yyacc_data[yyacc_curr++] = acc_array[i];
+ }
+
+ dataend ();
+ if (tablesext) {
+ yytbl_data_compress (yyacc_tbl);
+ if (yytbl_data_fwrite (&tableswr, yyacc_tbl) < 0)
+ flexerror (_("Could not write yyacc_tbl"));
+ yytbl_data_destroy (yyacc_tbl);
+ yyacc_tbl = NULL;
+ }
+ /* End generating yy_accept */
+
+ if (useecs) {
+
+ genecs ();
+ if (tablesext) {
+ struct yytbl_data *tbl;
+
+ tbl = mkecstbl ();
+ yytbl_data_compress (tbl);
+ if (yytbl_data_fwrite (&tableswr, tbl) < 0)
+ flexerror (_("Could not write ecstbl"));
+ yytbl_data_destroy (tbl);
+ tbl = 0;
+ }
+ }
+
+ if (usemecs) {
+ /* Begin generating yy_meta */
+ /* Write out meta-equivalence classes (used to index
+ * templates with).
+ */
+ flex_int32_t *yymecs_data = 0;
+ yymeta_tbl =
+ (struct yytbl_data *) calloc (1,
+ sizeof (struct
+ yytbl_data));
+ yytbl_data_init (yymeta_tbl, YYTD_ID_META);
+ yymeta_tbl->td_lolen = numecs + 1;
+ yymeta_tbl->td_data = yymecs_data =
+ (flex_int32_t *) calloc (yymeta_tbl->td_lolen,
+ sizeof (flex_int32_t));
+
+ if (trace)
+ fputs (_("\n\nMeta-Equivalence Classes:\n"),
+ stderr);
+
+ out_str_dec (get_yy_char_decl (), "yy_meta", numecs + 1);
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_META, (void**)&yy_meta, sizeof(%s)},\n",
+ "YY_CHAR");
+
+ for (i = 1; i <= numecs; ++i) {
+ if (trace)
+ fprintf (stderr, "%d = %d\n",
+ i, ABS (tecbck[i]));
+
+ mkdata (ABS (tecbck[i]));
+ yymecs_data[i] = ABS (tecbck[i]);
+ }
+
+ dataend ();
+ if (tablesext) {
+ yytbl_data_compress (yymeta_tbl);
+ if (yytbl_data_fwrite (&tableswr, yymeta_tbl) < 0)
+ flexerror (_
+ ("Could not write yymeta_tbl"));
+ yytbl_data_destroy (yymeta_tbl);
+ yymeta_tbl = NULL;
+ }
+ /* End generating yy_meta */
+ }
+
+ total_states = lastdfa + numtemps;
+
+ /* Begin generating yy_base */
+ out_str_dec ((tblend >= INT16_MAX || long_align) ?
+ get_uint32_decl () : get_uint16_decl (),
+ "yy_base", total_states + 1);
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_BASE, (void**)&yy_base, sizeof(%s)},\n",
+ (tblend >= INT16_MAX
+ || long_align) ? "flex_uint32_t" : "flex_uint16_t");
+ yybase_tbl =
+ (struct yytbl_data *) calloc (1,
+ sizeof (struct yytbl_data));
+ yytbl_data_init (yybase_tbl, YYTD_ID_BASE);
+ yybase_tbl->td_lolen = total_states + 1;
+ yybase_tbl->td_data = yybase_data =
+ (flex_int32_t *) calloc (yybase_tbl->td_lolen,
+ sizeof (flex_int32_t));
+ yybase_curr = 1;
+
+ for (i = 1; i <= lastdfa; ++i) {
+ int d = def[i];
+
+ if (base[i] == JAMSTATE)
+ base[i] = jambase;
+
+ if (d == JAMSTATE)
+ def[i] = jamstate;
+
+ else if (d < 0) {
+ /* Template reference. */
+ ++tmpuses;
+ def[i] = lastdfa - d + 1;
+ }
+
+ mkdata (base[i]);
+ yybase_data[yybase_curr++] = base[i];
+ }
+
+ /* Generate jam state's base index. */
+ mkdata (base[i]);
+ yybase_data[yybase_curr++] = base[i];
+
+ for (++i /* skip jam state */ ; i <= total_states; ++i) {
+ mkdata (base[i]);
+ yybase_data[yybase_curr++] = base[i];
+ def[i] = jamstate;
+ }
+
+ dataend ();
+ if (tablesext) {
+ yytbl_data_compress (yybase_tbl);
+ if (yytbl_data_fwrite (&tableswr, yybase_tbl) < 0)
+ flexerror (_("Could not write yybase_tbl"));
+ yytbl_data_destroy (yybase_tbl);
+ yybase_tbl = NULL;
+ }
+ /* End generating yy_base */
+
+
+ /* Begin generating yy_def */
+ out_str_dec ((total_states >= INT16_MAX || long_align) ?
+ get_int32_decl () : get_int16_decl (),
+ "yy_def", total_states + 1);
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_DEF, (void**)&yy_def, sizeof(%s)},\n",
+ (total_states >= INT16_MAX
+ || long_align) ? "flex_int32_t" : "flex_int16_t");
+
+ yydef_tbl =
+ (struct yytbl_data *) calloc (1,
+ sizeof (struct yytbl_data));
+ yytbl_data_init (yydef_tbl, YYTD_ID_DEF);
+ yydef_tbl->td_lolen = total_states + 1;
+ yydef_tbl->td_data = yydef_data =
+ (flex_int32_t *) calloc (yydef_tbl->td_lolen, sizeof (flex_int32_t));
+
+ for (i = 1; i <= total_states; ++i) {
+ mkdata (def[i]);
+ yydef_data[i] = def[i];
+ }
+
+ dataend ();
+ if (tablesext) {
+ yytbl_data_compress (yydef_tbl);
+ if (yytbl_data_fwrite (&tableswr, yydef_tbl) < 0)
+ flexerror (_("Could not write yydef_tbl"));
+ yytbl_data_destroy (yydef_tbl);
+ yydef_tbl = NULL;
+ }
+ /* End generating yy_def */
+
+
+ /* Begin generating yy_nxt */
+ out_str_dec ((total_states >= INT16_MAX || long_align) ?
+ get_uint32_decl () : get_uint16_decl (), "yy_nxt",
+ tblend + 1);
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
+ (total_states >= INT16_MAX
+ || long_align) ? "flex_uint32_t" : "flex_uint16_t");
+
+ yynxt_tbl =
+ (struct yytbl_data *) calloc (1,
+ sizeof (struct yytbl_data));
+ yytbl_data_init (yynxt_tbl, YYTD_ID_NXT);
+ yynxt_tbl->td_lolen = tblend + 1;
+ yynxt_tbl->td_data = yynxt_data =
+ (flex_int32_t *) calloc (yynxt_tbl->td_lolen, sizeof (flex_int32_t));
+
+ for (i = 1; i <= tblend; ++i) {
+ /* Note, the order of the following test is important.
+ * If chk[i] is 0, then nxt[i] is undefined.
+ */
+ if (chk[i] == 0 || nxt[i] == 0)
+ nxt[i] = jamstate; /* new state is the JAM state */
+
+ mkdata (nxt[i]);
+ yynxt_data[i] = nxt[i];
+ }
+
+ dataend ();
+ if (tablesext) {
+ yytbl_data_compress (yynxt_tbl);
+ if (yytbl_data_fwrite (&tableswr, yynxt_tbl) < 0)
+ flexerror (_("Could not write yynxt_tbl"));
+ yytbl_data_destroy (yynxt_tbl);
+ yynxt_tbl = NULL;
+ }
+ /* End generating yy_nxt */
+
+ /* Begin generating yy_chk */
+ out_str_dec ((total_states >= INT16_MAX || long_align) ?
+ get_int32_decl () : get_int16_decl (), "yy_chk",
+ tblend + 1);
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_CHK, (void**)&yy_chk, sizeof(%s)},\n",
+ (total_states >= INT16_MAX
+ || long_align) ? "flex_int32_t" : "flex_int16_t");
+
+ yychk_tbl =
+ (struct yytbl_data *) calloc (1,
+ sizeof (struct yytbl_data));
+ yytbl_data_init (yychk_tbl, YYTD_ID_CHK);
+ yychk_tbl->td_lolen = tblend + 1;
+ yychk_tbl->td_data = yychk_data =
+ (flex_int32_t *) calloc (yychk_tbl->td_lolen, sizeof (flex_int32_t));
+
+ for (i = 1; i <= tblend; ++i) {
+ if (chk[i] == 0)
+ ++nummt;
+
+ mkdata (chk[i]);
+ yychk_data[i] = chk[i];
+ }
+
+ dataend ();
+ if (tablesext) {
+ yytbl_data_compress (yychk_tbl);
+ if (yytbl_data_fwrite (&tableswr, yychk_tbl) < 0)
+ flexerror (_("Could not write yychk_tbl"));
+ yytbl_data_destroy (yychk_tbl);
+ yychk_tbl = NULL;
+ }
+ /* End generating yy_chk */
+
+ flex_free ((void *) acc_array);
+}
+
+
+/* Write out a formatted string (with a secondary string argument) at the
+ * current indentation level, adding a final newline.
+ */
+
+void indent_put2s (fmt, arg)
+ const char *fmt, *arg;
+{
+ do_indent ();
+ out_str (fmt, arg);
+ outn ("");
+}
+
+
+/* Write out a string at the current indentation level, adding a final
+ * newline.
+ */
+
+void indent_puts (str)
+ const char *str;
+{
+ do_indent ();
+ outn (str);
+}
+
+
+/* make_tables - generate transition tables and finishes generating output file
+ */
+
+void make_tables (void)
+{
+ int i;
+ int did_eof_rule = false;
+ struct yytbl_data *yynultrans_tbl = NULL;
+
+
+ skelout (); /* %% [2.0] - break point in skel */
+
+ /* First, take care of YY_DO_BEFORE_ACTION depending on yymore
+ * being used.
+ */
+ set_indent (1);
+
+ if (yymore_used && !yytext_is_array) {
+ indent_puts ("YY_G(yytext_ptr) -= YY_G(yy_more_len); \\");
+ indent_puts
+ ("yyleng = (size_t) (yy_cp - YY_G(yytext_ptr)); \\");
+ }
+
+ else
+ indent_puts ("yyleng = (size_t) (yy_cp - yy_bp); \\");
+
+ /* Now also deal with copying yytext_ptr to yytext if needed. */
+ skelout (); /* %% [3.0] - break point in skel */
+ if (yytext_is_array) {
+ if (yymore_used)
+ indent_puts
+ ("if ( yyleng + YY_G(yy_more_offset) >= YYLMAX ) \\");
+ else
+ indent_puts ("if ( yyleng >= YYLMAX ) \\");
+
+ indent_up ();
+ indent_puts
+ ("YY_FATAL_ERROR( \"token too large, exceeds YYLMAX\" ); \\");
+ indent_down ();
+
+ if (yymore_used) {
+ indent_puts
+ ("yy_flex_strncpy( &yytext[YY_G(yy_more_offset)], YY_G(yytext_ptr), yyleng + 1 M4_YY_CALL_LAST_ARG); \\");
+ indent_puts ("yyleng += YY_G(yy_more_offset); \\");
+ indent_puts
+ ("YY_G(yy_prev_more_offset) = YY_G(yy_more_offset); \\");
+ indent_puts ("YY_G(yy_more_offset) = 0; \\");
+ }
+ else {
+ indent_puts
+ ("yy_flex_strncpy( yytext, YY_G(yytext_ptr), yyleng + 1 M4_YY_CALL_LAST_ARG); \\");
+ }
+ }
+
+ set_indent (0);
+
+ skelout (); /* %% [4.0] - break point in skel */
+
+
+ /* This is where we REALLY begin generating the tables. */
+
+ out_dec ("#define YY_NUM_RULES %d\n", num_rules);
+ out_dec ("#define YY_END_OF_BUFFER %d\n", num_rules + 1);
+
+ if (fullspd) {
+ /* Need to define the transet type as a size large
+ * enough to hold the biggest offset.
+ */
+ int total_table_size = tblend + numecs + 1;
+ char *trans_offset_type =
+ (total_table_size >= INT16_MAX || long_align) ?
+ "flex_int32_t" : "flex_int16_t";
+
+ set_indent (0);
+ indent_puts ("struct yy_trans_info");
+ indent_up ();
+ indent_puts ("{");
+
+ /* We require that yy_verify and yy_nxt must be of the same size int. */
+ indent_put2s ("%s yy_verify;", trans_offset_type);
+
+ /* In cases where its sister yy_verify *is* a "yes, there is
+ * a transition", yy_nxt is the offset (in records) to the
+ * next state. In most cases where there is no transition,
+ * the value of yy_nxt is irrelevant. If yy_nxt is the -1th
+ * record of a state, though, then yy_nxt is the action number
+ * for that state.
+ */
+
+ indent_put2s ("%s yy_nxt;", trans_offset_type);
+ indent_puts ("};");
+ indent_down ();
+ }
+ else {
+ /* We generate a bogus 'struct yy_trans_info' data type
+ * so we can guarantee that it is always declared in the skel.
+ * This is so we can compile "sizeof(struct yy_trans_info)"
+ * in any scanner.
+ */
+ indent_puts
+ ("/* This struct is not used in this scanner,");
+ indent_puts (" but its presence is necessary. */");
+ indent_puts ("struct yy_trans_info");
+ indent_up ();
+ indent_puts ("{");
+ indent_puts ("flex_int32_t yy_verify;");
+ indent_puts ("flex_int32_t yy_nxt;");
+ indent_puts ("};");
+ indent_down ();
+ }
+
+ if (fullspd) {
+ genctbl ();
+ if (tablesext) {
+ struct yytbl_data *tbl;
+
+ tbl = mkctbl ();
+ yytbl_data_compress (tbl);
+ if (yytbl_data_fwrite (&tableswr, tbl) < 0)
+ flexerror (_("Could not write ftbl"));
+ yytbl_data_destroy (tbl);
+
+ tbl = mkssltbl ();
+ yytbl_data_compress (tbl);
+ if (yytbl_data_fwrite (&tableswr, tbl) < 0)
+ flexerror (_("Could not write ssltbl"));
+ yytbl_data_destroy (tbl);
+ tbl = 0;
+
+ if (useecs) {
+ tbl = mkecstbl ();
+ yytbl_data_compress (tbl);
+ if (yytbl_data_fwrite (&tableswr, tbl) < 0)
+ flexerror (_
+ ("Could not write ecstbl"));
+ yytbl_data_destroy (tbl);
+ tbl = 0;
+ }
+ }
+ }
+ else if (fulltbl) {
+ genftbl ();
+ if (tablesext) {
+ struct yytbl_data *tbl;
+
+ tbl = mkftbl ();
+ yytbl_data_compress (tbl);
+ if (yytbl_data_fwrite (&tableswr, tbl) < 0)
+ flexerror (_("Could not write ftbl"));
+ yytbl_data_destroy (tbl);
+ tbl = 0;
+
+ if (useecs) {
+ tbl = mkecstbl ();
+ yytbl_data_compress (tbl);
+ if (yytbl_data_fwrite (&tableswr, tbl) < 0)
+ flexerror (_
+ ("Could not write ecstbl"));
+ yytbl_data_destroy (tbl);
+ tbl = 0;
+ }
+ }
+ }
+ else
+ gentabs ();
+
+ if (do_yylineno) {
+
+ geneoltbl ();
+
+ if (tablesext) {
+ struct yytbl_data *tbl;
+
+ tbl = mkeoltbl ();
+ yytbl_data_compress (tbl);
+ if (yytbl_data_fwrite (&tableswr, tbl) < 0)
+ flexerror (_("Could not write eoltbl"));
+ yytbl_data_destroy (tbl);
+ tbl = 0;
+ }
+ }
+
+ /* Definitions for backing up. We don't need them if REJECT
+ * is being used because then we use an alternative backin-up
+ * technique instead.
+ */
+ if (num_backing_up > 0 && !reject) {
+ if (!C_plus_plus && !reentrant) {
+ indent_puts
+ ("static yy_state_type yy_last_accepting_state;");
+ indent_puts
+ ("static char *yy_last_accepting_cpos;\n");
+ }
+ }
+
+ if (nultrans) {
+ flex_int32_t *yynultrans_data = 0;
+
+ /* Begin generating yy_NUL_trans */
+ out_str_dec (get_state_decl (), "yy_NUL_trans",
+ lastdfa + 1);
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_NUL_TRANS, (void**)&yy_NUL_trans, sizeof(%s)},\n",
+ (fullspd) ? "struct yy_trans_info*" :
+ "flex_int32_t");
+
+ yynultrans_tbl =
+ (struct yytbl_data *) calloc (1,
+ sizeof (struct
+ yytbl_data));
+ yytbl_data_init (yynultrans_tbl, YYTD_ID_NUL_TRANS);
+ if (fullspd)
+ yynultrans_tbl->td_flags |= YYTD_PTRANS;
+ yynultrans_tbl->td_lolen = lastdfa + 1;
+ yynultrans_tbl->td_data = yynultrans_data =
+ (flex_int32_t *) calloc (yynultrans_tbl->td_lolen,
+ sizeof (flex_int32_t));
+
+ for (i = 1; i <= lastdfa; ++i) {
+ if (fullspd) {
+ out_dec (" &yy_transition[%d],\n",
+ base[i]);
+ yynultrans_data[i] = base[i];
+ }
+ else {
+ mkdata (nultrans[i]);
+ yynultrans_data[i] = nultrans[i];
+ }
+ }
+
+ dataend ();
+ if (tablesext) {
+ yytbl_data_compress (yynultrans_tbl);
+ if (yytbl_data_fwrite (&tableswr, yynultrans_tbl) <
+ 0)
+ flexerror (_
+ ("Could not write yynultrans_tbl"));
+ }
+
+ if (yynultrans_tbl != NULL) {
+ yytbl_data_destroy (yynultrans_tbl);
+ yynultrans_tbl = NULL;
+ }
+
+ /* End generating yy_NUL_trans */
+ }
+
+ if (!C_plus_plus && !reentrant) {
+ indent_puts ("extern int yy_flex_debug;");
+ indent_put2s ("int yy_flex_debug = %s;\n",
+ ddebug ? "1" : "0");
+ }
+
+ if (ddebug) { /* Spit out table mapping rules to line numbers. */
+ out_str_dec (long_align ? get_int32_decl () :
+ get_int16_decl (), "yy_rule_linenum",
+ num_rules);
+ for (i = 1; i < num_rules; ++i)
+ mkdata (rule_linenum[i]);
+ dataend ();
+ }
+
+ if (reject) {
+ outn ("m4_ifdef( [[M4_YY_USES_REJECT]],\n[[");
+ /* Declare state buffer variables. */
+ if (!C_plus_plus && !reentrant) {
+ outn ("static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;");
+ outn ("static char *yy_full_match;");
+ outn ("static int yy_lp;");
+ }
+
+ if (variable_trailing_context_rules) {
+ if (!C_plus_plus && !reentrant) {
+ outn ("static int yy_looking_for_trail_begin = 0;");
+ outn ("static int yy_full_lp;");
+ outn ("static int *yy_full_state;");
+ }
+
+ out_hex ("#define YY_TRAILING_MASK 0x%x\n",
+ (unsigned int) YY_TRAILING_MASK);
+ out_hex ("#define YY_TRAILING_HEAD_MASK 0x%x\n",
+ (unsigned int) YY_TRAILING_HEAD_MASK);
+ }
+
+ outn ("#define REJECT \\");
+ outn ("{ \\");
+ outn ("*yy_cp = YY_G(yy_hold_char); /* undo effects of setting up yytext */ \\");
+ outn ("yy_cp = YY_G(yy_full_match); /* restore poss. backed-over text */ \\");
+
+ if (variable_trailing_context_rules) {
+ outn ("YY_G(yy_lp) = YY_G(yy_full_lp); /* restore orig. accepting pos. */ \\");
+ outn ("YY_G(yy_state_ptr) = YY_G(yy_full_state); /* restore orig. state */ \\");
+ outn ("yy_current_state = *YY_G(yy_state_ptr); /* restore curr. state */ \\");
+ }
+
+ outn ("++YY_G(yy_lp); \\");
+ outn ("goto find_rule; \\");
+
+ outn ("}");
+ outn ("]])\n");
+ }
+
+ else {
+ outn ("/* The intent behind this definition is that it'll catch");
+ outn (" * any uses of REJECT which flex missed.");
+ outn (" */");
+ outn ("#define REJECT reject_used_but_not_detected");
+ }
+
+ if (yymore_used) {
+ if (!C_plus_plus) {
+ if (yytext_is_array) {
+ if (!reentrant){
+ indent_puts ("static int yy_more_offset = 0;");
+ indent_puts ("static int yy_prev_more_offset = 0;");
+ }
+ }
+ else if (!reentrant) {
+ indent_puts
+ ("static int yy_more_flag = 0;");
+ indent_puts
+ ("static int yy_more_len = 0;");
+ }
+ }
+
+ if (yytext_is_array) {
+ indent_puts
+ ("#define yymore() (YY_G(yy_more_offset) = yy_flex_strlen( yytext M4_YY_CALL_LAST_ARG))");
+ indent_puts ("#define YY_NEED_STRLEN");
+ indent_puts ("#define YY_MORE_ADJ 0");
+ indent_puts
+ ("#define YY_RESTORE_YY_MORE_OFFSET \\");
+ indent_up ();
+ indent_puts ("{ \\");
+ indent_puts
+ ("YY_G(yy_more_offset) = YY_G(yy_prev_more_offset); \\");
+ indent_puts ("yyleng -= YY_G(yy_more_offset); \\");
+ indent_puts ("}");
+ indent_down ();
+ }
+ else {
+ indent_puts
+ ("#define yymore() (YY_G(yy_more_flag) = 1)");
+ indent_puts
+ ("#define YY_MORE_ADJ YY_G(yy_more_len)");
+ indent_puts ("#define YY_RESTORE_YY_MORE_OFFSET");
+ }
+ }
+
+ else {
+ indent_puts
+ ("#define yymore() yymore_used_but_not_detected");
+ indent_puts ("#define YY_MORE_ADJ 0");
+ indent_puts ("#define YY_RESTORE_YY_MORE_OFFSET");
+ }
+
+ if (!C_plus_plus) {
+ if (yytext_is_array) {
+ outn ("#ifndef YYLMAX");
+ outn ("#define YYLMAX 8192");
+ outn ("#endif\n");
+ if (!reentrant){
+ outn ("char yytext[YYLMAX];");
+ outn ("char *yytext_ptr;");
+ }
+ }
+
+ else {
+ if(! reentrant)
+ outn ("char *yytext;");
+ }
+ }
+
+ out (&action_array[defs1_offset]);
+
+ line_directive_out (stdout, 0);
+
+ skelout (); /* %% [5.0] - break point in skel */
+
+ if (!C_plus_plus) {
+ if (use_read) {
+ outn ("\terrno=0; \\");
+ outn ("\twhile ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \\");
+ outn ("\t{ \\");
+ outn ("\t\tif( errno != EINTR) \\");
+ outn ("\t\t{ \\");
+ outn ("\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\");
+ outn ("\t\t\tbreak; \\");
+ outn ("\t\t} \\");
+ outn ("\t\terrno=0; \\");
+ outn ("\t\tclearerr(yyin); \\");
+ outn ("\t}\\");
+ }
+
+ else {
+ outn ("\tif ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \\");
+ outn ("\t\t{ \\");
+ outn ("\t\tint c = '*'; \\");
+ outn ("\t\tsize_t n; \\");
+ outn ("\t\tfor ( n = 0; n < max_size && \\");
+ outn ("\t\t\t (c = getc( yyin )) != EOF && c != '\\n'; ++n ) \\");
+ outn ("\t\t\tbuf[n] = (char) c; \\");
+ outn ("\t\tif ( c == '\\n' ) \\");
+ outn ("\t\t\tbuf[n++] = (char) c; \\");
+ outn ("\t\tif ( c == EOF && ferror( yyin ) ) \\");
+ outn ("\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\");
+ outn ("\t\tresult = n; \\");
+ outn ("\t\t} \\");
+ outn ("\telse \\");
+ outn ("\t\t{ \\");
+ outn ("\t\terrno=0; \\");
+ outn ("\t\twhile ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \\");
+ outn ("\t\t\t{ \\");
+ outn ("\t\t\tif( errno != EINTR) \\");
+ outn ("\t\t\t\t{ \\");
+ outn ("\t\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\");
+ outn ("\t\t\t\tbreak; \\");
+ outn ("\t\t\t\t} \\");
+ outn ("\t\t\terrno=0; \\");
+ outn ("\t\t\tclearerr(yyin); \\");
+ outn ("\t\t\t} \\");
+ outn ("\t\t}\\");
+ }
+ }
+
+ skelout (); /* %% [6.0] - break point in skel */
+
+ indent_puts ("#define YY_RULE_SETUP \\");
+ indent_up ();
+ if (bol_needed) {
+ indent_puts ("if ( yyleng > 0 ) \\");
+ indent_up ();
+ indent_puts ("YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \\");
+ indent_puts ("\t\t(yytext[yyleng - 1] == '\\n'); \\");
+ indent_down ();
+ }
+ indent_puts ("YY_USER_ACTION");
+ indent_down ();
+
+ skelout (); /* %% [7.0] - break point in skel */
+
+ /* Copy prolog to output file. */
+ out (&action_array[prolog_offset]);
+
+ line_directive_out (stdout, 0);
+
+ skelout (); /* %% [8.0] - break point in skel */
+
+ set_indent (2);
+
+ if (yymore_used && !yytext_is_array) {
+ indent_puts ("YY_G(yy_more_len) = 0;");
+ indent_puts ("if ( YY_G(yy_more_flag) )");
+ indent_up ();
+ indent_puts ("{");
+ indent_puts
+ ("YY_G(yy_more_len) = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);");
+ indent_puts ("YY_G(yy_more_flag) = 0;");
+ indent_puts ("}");
+ indent_down ();
+ }
+
+ skelout (); /* %% [9.0] - break point in skel */
+
+ gen_start_state ();
+
+ /* Note, don't use any indentation. */
+ outn ("yy_match:");
+ gen_next_match ();
+
+ skelout (); /* %% [10.0] - break point in skel */
+ set_indent (2);
+ gen_find_action ();
+
+ skelout (); /* %% [11.0] - break point in skel */
+ outn ("m4_ifdef( [[M4_YY_USE_LINENO]],[[");
+ indent_puts
+ ("if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )");
+ indent_up ();
+ indent_puts ("{");
+ indent_puts ("yy_size_t yyl;");
+ do_indent ();
+ out_str ("for ( yyl = %s; yyl < yyleng; ++yyl )\n",
+ yymore_used ? (yytext_is_array ? "YY_G(yy_prev_more_offset)" :
+ "YY_G(yy_more_len)") : "0");
+ indent_up ();
+ indent_puts ("if ( yytext[yyl] == '\\n' )");
+ indent_up ();
+ indent_puts ("M4_YY_INCR_LINENO();");
+ indent_down ();
+ indent_down ();
+ indent_puts ("}");
+ indent_down ();
+ outn ("]])");
+
+ skelout (); /* %% [12.0] - break point in skel */
+ if (ddebug) {
+ indent_puts ("if ( yy_flex_debug )");
+ indent_up ();
+
+ indent_puts ("{");
+ indent_puts ("if ( yy_act == 0 )");
+ indent_up ();
+ indent_puts (C_plus_plus ?
+ "std::cerr << \"--scanner backing up\\n\";" :
+ "fprintf( stderr, \"--scanner backing up\\n\" );");
+ indent_down ();
+
+ do_indent ();
+ out_dec ("else if ( yy_act < %d )\n", num_rules);
+ indent_up ();
+
+ if (C_plus_plus) {
+ indent_puts
+ ("std::cerr << \"--accepting rule at line \" << yy_rule_linenum[yy_act] <<");
+ indent_puts
+ (" \"(\\\"\" << yytext << \"\\\")\\n\";");
+ }
+ else {
+ indent_puts
+ ("fprintf( stderr, \"--accepting rule at line %ld (\\\"%s\\\")\\n\",");
+
+ indent_puts
+ (" (long)yy_rule_linenum[yy_act], yytext );");
+ }
+
+ indent_down ();
+
+ do_indent ();
+ out_dec ("else if ( yy_act == %d )\n", num_rules);
+ indent_up ();
+
+ if (C_plus_plus) {
+ indent_puts
+ ("std::cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\\n\";");
+ }
+ else {
+ indent_puts
+ ("fprintf( stderr, \"--accepting default rule (\\\"%s\\\")\\n\",");
+ indent_puts (" yytext );");
+ }
+
+ indent_down ();
+
+ do_indent ();
+ out_dec ("else if ( yy_act == %d )\n", num_rules + 1);
+ indent_up ();
+
+ indent_puts (C_plus_plus ?
+ "std::cerr << \"--(end of buffer or a NUL)\\n\";" :
+ "fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );");
+
+ indent_down ();
+
+ do_indent ();
+ outn ("else");
+ indent_up ();
+
+ if (C_plus_plus) {
+ indent_puts
+ ("std::cerr << \"--EOF (start condition \" << YY_START << \")\\n\";");
+ }
+ else {
+ indent_puts
+ ("fprintf( stderr, \"--EOF (start condition %d)\\n\", YY_START );");
+ }
+
+ indent_down ();
+
+ indent_puts ("}");
+ indent_down ();
+ }
+
+ /* Copy actions to output file. */
+ skelout (); /* %% [13.0] - break point in skel */
+ indent_up ();
+ gen_bu_action ();
+ out (&action_array[action_offset]);
+
+ line_directive_out (stdout, 0);
+
+ /* generate cases for any missing EOF rules */
+ for (i = 1; i <= lastsc; ++i)
+ if (!sceof[i]) {
+ do_indent ();
+ out_str ("case YY_STATE_EOF(%s):\n", scname[i]);
+ did_eof_rule = true;
+ }
+
+ if (did_eof_rule) {
+ indent_up ();
+ indent_puts ("yyterminate();");
+ indent_down ();
+ }
+
+
+ /* Generate code for handling NUL's, if needed. */
+
+ /* First, deal with backing up and setting up yy_cp if the scanner
+ * finds that it should JAM on the NUL.
+ */
+ skelout (); /* %% [14.0] - break point in skel */
+ set_indent (4);
+
+ if (fullspd || fulltbl)
+ indent_puts ("yy_cp = YY_G(yy_c_buf_p);");
+
+ else { /* compressed table */
+ if (!reject && !interactive) {
+ /* Do the guaranteed-needed backing up to figure
+ * out the match.
+ */
+ indent_puts
+ ("yy_cp = YY_G(yy_last_accepting_cpos);");
+ indent_puts
+ ("yy_current_state = YY_G(yy_last_accepting_state);");
+ }
+
+ else
+ /* Still need to initialize yy_cp, though
+ * yy_current_state was set up by
+ * yy_get_previous_state().
+ */
+ indent_puts ("yy_cp = YY_G(yy_c_buf_p);");
+ }
+
+
+ /* Generate code for yy_get_previous_state(). */
+ set_indent (1);
+ skelout (); /* %% [15.0] - break point in skel */
+
+ gen_start_state ();
+
+ set_indent (2);
+ skelout (); /* %% [16.0] - break point in skel */
+ gen_next_state (true);
+
+ set_indent (1);
+ skelout (); /* %% [17.0] - break point in skel */
+ gen_NUL_trans ();
+
+ skelout (); /* %% [18.0] - break point in skel */
+ skelout (); /* %% [19.0] - break point in skel */
+ /* Update BOL and yylineno inside of input(). */
+ if (bol_needed) {
+ indent_puts
+ ("YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\\n');");
+ if (do_yylineno) {
+ indent_puts
+ ("if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol )");
+ indent_up ();
+ indent_puts ("M4_YY_INCR_LINENO();");
+ indent_down ();
+ }
+ }
+
+ else if (do_yylineno) {
+ indent_puts ("if ( c == '\\n' )");
+ indent_up ();
+ indent_puts ("M4_YY_INCR_LINENO();");
+ indent_down ();
+ }
+
+ skelout ();
+
+ /* Copy remainder of input to output. */
+ linenum--;
+ line_directive_out (stdout, 1);
+
+ if (sectnum == 3) {
+ OUT_BEGIN_CODE ();
+ (void) flexscan (); /* copy remainder of input to output */
+ OUT_END_CODE ();
+ }
+}
diff --git a/src/gettext.h b/src/gettext.h
new file mode 100644
index 0000000..ea67f30
--- /dev/null
+++ b/src/gettext.h
@@ -0,0 +1,59 @@
+/* Convenience header for conditional use of GNU <libintl.h>.
+ Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published
+ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library 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. */
+
+#ifndef _LIBGETTEXT_H
+#define _LIBGETTEXT_H 1
+
+/* NLS can be disabled through the configure --disable-nls option. */
+#if ENABLE_NLS
+
+/* Get declarations of GNU message catalog functions. */
+# include <libintl.h>
+
+#else
+
+/* Disabled NLS.
+ The casts to 'const char *' serve the purpose of producing warnings
+ for invalid uses of the value returned from these functions.
+ On pre-ANSI systems without 'const', the config.h file is supposed to
+ contain "#define const". */
+# define gettext(Msgid) ((const char *) (Msgid))
+# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
+# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
+# define ngettext(Msgid1, Msgid2, N) \
+ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+# define dngettext(Domainname, Msgid1, Msgid2, N) \
+ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
+ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+# define textdomain(Domainname) ((const char *) (Domainname))
+# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
+# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
+
+#endif
+
+/* A pseudo function call that serves as a marker for the automated
+ extraction of messages, but does not call gettext(). The run-time
+ translation is done at a different place in the code.
+ The argument, String, should be a literal string. Concatenated strings
+ and other string expressions won't work.
+ The macro's expansion is not parenthesized, so that it is suitable as
+ initializer for static 'char[]' or 'const char[]' variables. */
+#define gettext_noop(String) String
+
+#endif /* _LIBGETTEXT_H */
diff --git a/src/libmain.c b/src/libmain.c
new file mode 100644
index 0000000..f400fc3
--- /dev/null
+++ b/src/libmain.c
@@ -0,0 +1,34 @@
+/* libmain - flex run-time support library "main" function */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+extern int yylex (void);
+
+int main (int argc, char *argv[])
+{
+ (void)argc;
+ (void)argv;
+
+ while (yylex () != 0) ;
+
+ return 0;
+}
diff --git a/src/libyywrap.c b/src/libyywrap.c
new file mode 100644
index 0000000..b0427c4
--- /dev/null
+++ b/src/libyywrap.c
@@ -0,0 +1,29 @@
+/* libyywrap - flex run-time support library "yywrap" function */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+int yywrap (void);
+
+int yywrap (void)
+{
+ return 1;
+}
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..8710702
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,1866 @@
+/* flex - tool to generate fast lexical analyzers */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+
+#include "flexdef.h"
+#include "version.h"
+#include "options.h"
+#include "tables.h"
+
+static char flex_version[] = FLEX_VERSION;
+
+/* declare functions that have forward references */
+
+void flexinit PROTO ((int, char **));
+void readin PROTO ((void));
+void set_up_initial_allocations PROTO ((void));
+static char *basename2 PROTO ((char *path, int should_strip_ext));
+
+
+/* these globals are all defined and commented in flexdef.h */
+int printstats, syntaxerror, eofseen, ddebug, trace, nowarn, spprdflt;
+int interactive, lex_compat, posix_compat, do_yylineno,
+ useecs, fulltbl, usemecs;
+int fullspd, gen_line_dirs, performance_report, backing_up_report;
+int C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap,
+ csize;
+int reentrant, bison_bridge_lval, bison_bridge_lloc;
+int yymore_used, reject, real_reject, continued_action, in_rule;
+int yymore_really_used, reject_really_used;
+int trace_hex = 0;
+int datapos, dataline, linenum;
+FILE *skelfile = NULL;
+int skel_ind = 0;
+char *action_array;
+int action_size, defs1_offset, prolog_offset, action_offset,
+ action_index;
+char *infilename = NULL, *outfilename = NULL, *headerfilename = NULL;
+int did_outfilename;
+char *prefix, *yyclass, *extra_type = NULL;
+int do_stdinit, use_stdout;
+int onestate[ONE_STACK_SIZE], onesym[ONE_STACK_SIZE];
+int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp;
+int maximum_mns, current_mns, current_max_rules;
+int num_rules, num_eof_rules, default_rule, lastnfa;
+int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2;
+int *accptnum, *assoc_rule, *state_type;
+int *rule_type, *rule_linenum, *rule_useful;
+int current_state_type;
+int variable_trailing_context_rules;
+int numtemps, numprots, protprev[MSP], protnext[MSP], prottbl[MSP];
+int protcomst[MSP], firstprot, lastprot, protsave[PROT_SAVE_SIZE];
+int numecs, nextecm[CSIZE + 1], ecgroup[CSIZE + 1], nummecs,
+ tecfwd[CSIZE + 1];
+int tecbck[CSIZE + 1];
+int lastsc, *scset, *scbol, *scxclu, *sceof;
+int current_max_scs;
+char **scname;
+int current_max_dfa_size, current_max_xpairs;
+int current_max_template_xpairs, current_max_dfas;
+int lastdfa, *nxt, *chk, *tnxt;
+int *base, *def, *nultrans, NUL_ec, tblend, firstfree, **dss, *dfasiz;
+union dfaacc_union *dfaacc;
+int *accsiz, *dhash, numas;
+int numsnpairs, jambase, jamstate;
+int lastccl, *cclmap, *ccllen, *cclng, cclreuse;
+int current_maxccls, current_max_ccl_tbl_size;
+Char *ccltbl;
+char nmstr[MAXLINE];
+int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs;
+int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
+int num_backing_up, bol_needed;
+FILE *backing_up_file;
+int end_of_buffer_state;
+char **input_files;
+int num_input_files;
+jmp_buf flex_main_jmp_buf;
+bool *rule_has_nl, *ccl_has_nl;
+int nlch = '\n';
+bool ansi_func_defs, ansi_func_protos;
+
+bool tablesext, tablesverify, gentables;
+char *tablesfilename=0,*tablesname=0;
+struct yytbl_writer tableswr;
+
+/* Make sure program_name is initialized so we don't crash if writing
+ * out an error message before getting the program name from argv[0].
+ */
+char *program_name = "flex";
+
+#ifndef SHORT_FILE_NAMES
+static const char outfile_template[] = "lex.%s.%s";
+static const char backing_name[] = "lex.backup";
+static const char tablesfile_template[] = "lex.%s.tables";
+#else
+static const char outfile_template[] = "lex%s.%s";
+static const char backing_name[] = "lex.bck";
+static const char tablesfile_template[] = "lex%s.tbl";
+#endif
+
+#ifdef MS_DOS
+extern unsigned _stklen = 16384;
+#endif
+
+/* From scan.l */
+extern FILE* yyout;
+
+static char outfile_path[MAXLINE];
+static int outfile_created = 0;
+static char *skelname = NULL;
+static int _stdout_closed = 0; /* flag to prevent double-fclose() on stdout. */
+const char *escaped_qstart = "[[]]M4_YY_NOOP[M4_YY_NOOP[M4_YY_NOOP[[]]";
+const char *escaped_qend = "[[]]M4_YY_NOOP]M4_YY_NOOP]M4_YY_NOOP[[]]";
+
+/* For debugging. The max number of filters to apply to skeleton. */
+static int preproc_level = 1000;
+
+int flex_main PROTO ((int argc, char *argv[]));
+int main PROTO ((int argc, char *argv[]));
+
+int flex_main (argc, argv)
+ int argc;
+ char *argv[];
+{
+ int i, exit_status, child_status;
+
+ /* Set a longjmp target. Yes, I know it's a hack, but it gets worse: The
+ * return value of setjmp, if non-zero, is the desired exit code PLUS ONE.
+ * For example, if you want 'main' to return with code '2', then call
+ * longjmp() with an argument of 3. This is because it is invalid to
+ * specify a value of 0 to longjmp. FLEX_EXIT(n) should be used instead of
+ * exit(n);
+ */
+ exit_status = setjmp (flex_main_jmp_buf);
+ if (exit_status){
+ if (stdout && !_stdout_closed && !ferror(stdout)){
+ fflush(stdout);
+ fclose(stdout);
+ }
+ while (wait(&child_status) > 0){
+ if (!WIFEXITED (child_status)
+ || WEXITSTATUS (child_status) != 0){
+ /* report an error of a child
+ */
+ if( exit_status <= 1 )
+ exit_status = 2;
+
+ }
+ }
+ return exit_status - 1;
+ }
+
+ flexinit (argc, argv);
+
+ readin ();
+
+ skelout ();
+ /* %% [1.5] DFA */
+ ntod ();
+
+ for (i = 1; i <= num_rules; ++i)
+ if (!rule_useful[i] && i != default_rule)
+ line_warning (_("rule cannot be matched"),
+ rule_linenum[i]);
+
+ if (spprdflt && !reject && rule_useful[default_rule])
+ line_warning (_
+ ("-s option given but default rule can be matched"),
+ rule_linenum[default_rule]);
+
+ /* Generate the C state transition tables from the DFA. */
+ make_tables ();
+
+ /* Note, flexend does not return. It exits with its argument
+ * as status.
+ */
+ flexend (0);
+
+ return 0; /* keep compilers/lint happy */
+}
+
+/* Wrapper around flex_main, so flex_main can be built as a library. */
+int main (argc, argv)
+ int argc;
+ char *argv[];
+{
+#if ENABLE_NLS
+#if HAVE_LOCALE_H
+ setlocale (LC_MESSAGES, "");
+ setlocale (LC_CTYPE, "");
+ textdomain (PACKAGE);
+ bindtextdomain (PACKAGE, LOCALEDIR);
+#endif
+#endif
+
+ return flex_main (argc, argv);
+}
+
+/* check_options - check user-specified options */
+
+void check_options ()
+{
+ int i;
+ const char * m4 = NULL;
+
+ if (lex_compat) {
+ if (C_plus_plus)
+ flexerror (_("Can't use -+ with -l option"));
+
+ if (fulltbl || fullspd)
+ flexerror (_("Can't use -f or -F with -l option"));
+
+ if (reentrant || bison_bridge_lval)
+ flexerror (_
+ ("Can't use --reentrant or --bison-bridge with -l option"));
+
+ yytext_is_array = true;
+ do_yylineno = true;
+ use_read = false;
+ }
+
+
+#if 0
+ /* This makes no sense whatsoever. I'm removing it. */
+ if (do_yylineno)
+ /* This should really be "maintain_backup_tables = true" */
+ reject_really_used = true;
+#endif
+
+ if (csize == unspecified) {
+ if ((fulltbl || fullspd) && !useecs)
+ csize = DEFAULT_CSIZE;
+ else
+ csize = CSIZE;
+ }
+
+ if (interactive == unspecified) {
+ if (fulltbl || fullspd)
+ interactive = false;
+ else
+ interactive = true;
+ }
+
+ if (fulltbl || fullspd) {
+ if (usemecs)
+ flexerror (_
+ ("-Cf/-CF and -Cm don't make sense together"));
+
+ if (interactive)
+ flexerror (_("-Cf/-CF and -I are incompatible"));
+
+ if (lex_compat)
+ flexerror (_
+ ("-Cf/-CF are incompatible with lex-compatibility mode"));
+
+
+ if (fulltbl && fullspd)
+ flexerror (_
+ ("-Cf and -CF are mutually exclusive"));
+ }
+
+ if (C_plus_plus && fullspd)
+ flexerror (_("Can't use -+ with -CF option"));
+
+ if (C_plus_plus && yytext_is_array) {
+ warn (_("%array incompatible with -+ option"));
+ yytext_is_array = false;
+ }
+
+ if (C_plus_plus && (reentrant))
+ flexerror (_("Options -+ and --reentrant are mutually exclusive."));
+
+ if (C_plus_plus && bison_bridge_lval)
+ flexerror (_("bison bridge not supported for the C++ scanner."));
+
+
+ if (useecs) { /* Set up doubly-linked equivalence classes. */
+
+ /* We loop all the way up to csize, since ecgroup[csize] is
+ * the position used for NUL characters.
+ */
+ ecgroup[1] = NIL;
+
+ for (i = 2; i <= csize; ++i) {
+ ecgroup[i] = i - 1;
+ nextecm[i - 1] = i;
+ }
+
+ nextecm[csize] = NIL;
+ }
+
+ else {
+ /* Put everything in its own equivalence class. */
+ for (i = 1; i <= csize; ++i) {
+ ecgroup[i] = i;
+ nextecm[i] = BAD_SUBSCRIPT; /* to catch errors */
+ }
+ }
+
+ if (!ansi_func_defs)
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_ANSI_FUNC_DEFS", NULL);
+
+ if (!ansi_func_protos)
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_ANSI_FUNC_PROTOS", NULL);
+
+ if (extra_type)
+ buf_m4_define( &m4defs_buf, "M4_EXTRA_TYPE_DEFS", extra_type);
+
+ if (!use_stdout) {
+ FILE *prev_stdout;
+
+ if (!did_outfilename) {
+ char *suffix;
+
+ if (C_plus_plus)
+ suffix = "cc";
+ else
+ suffix = "c";
+
+ snprintf (outfile_path, sizeof(outfile_path), outfile_template,
+ prefix, suffix);
+
+ outfilename = outfile_path;
+ }
+
+ prev_stdout = freopen (outfilename, "w+", stdout);
+
+ if (prev_stdout == NULL)
+ lerr (_("could not create %s"), outfilename);
+
+ outfile_created = 1;
+ }
+
+
+ /* Setup the filter chain. */
+ output_chain = filter_create_int(NULL, filter_tee_header, headerfilename);
+ if ( !(m4 = getenv("M4")))
+ m4 = M4;
+ filter_create_ext(output_chain, m4, "-P", 0);
+ filter_create_int(output_chain, filter_fix_linedirs, NULL);
+
+ /* For debugging, only run the requested number of filters. */
+ if (preproc_level > 0) {
+ filter_truncate(output_chain, preproc_level);
+ filter_apply_chain(output_chain);
+ }
+ yyout = stdout;
+
+
+ /* always generate the tablesverify flag. */
+ buf_m4_define (&m4defs_buf, "M4_YY_TABLES_VERIFY", tablesverify ? "1" : "0");
+ if (tablesext)
+ gentables = false;
+
+ if (tablesverify)
+ /* force generation of C tables. */
+ gentables = true;
+
+
+ if (tablesext) {
+ FILE *tablesout;
+ struct yytbl_hdr hdr;
+ char *pname = 0;
+ int nbytes = 0;
+
+ buf_m4_define (&m4defs_buf, "M4_YY_TABLES_EXTERNAL", NULL);
+
+ if (!tablesfilename) {
+ nbytes = strlen (prefix) + strlen (tablesfile_template) + 2;
+ tablesfilename = pname = (char *) calloc (nbytes, 1);
+ snprintf (pname, nbytes, tablesfile_template, prefix);
+ }
+
+ if ((tablesout = fopen (tablesfilename, "w")) == NULL)
+ lerr (_("could not create %s"), tablesfilename);
+ if (pname)
+ free (pname);
+ tablesfilename = 0;
+
+ yytbl_writer_init (&tableswr, tablesout);
+
+ nbytes = strlen (prefix) + strlen ("tables") + 2;
+ tablesname = (char *) calloc (nbytes, 1);
+ snprintf (tablesname, nbytes, "%stables", prefix);
+ yytbl_hdr_init (&hdr, flex_version, tablesname);
+
+ if (yytbl_hdr_fwrite (&tableswr, &hdr) <= 0)
+ flexerror (_("could not write tables header"));
+ }
+
+ if (skelname && (skelfile = fopen (skelname, "r")) == NULL)
+ lerr (_("can't open skeleton file %s"), skelname);
+
+ if (reentrant) {
+ buf_m4_define (&m4defs_buf, "M4_YY_REENTRANT", NULL);
+ if (yytext_is_array)
+ buf_m4_define (&m4defs_buf, "M4_YY_TEXT_IS_ARRAY", NULL);
+ }
+
+ if ( bison_bridge_lval)
+ buf_m4_define (&m4defs_buf, "M4_YY_BISON_LVAL", NULL);
+
+ if ( bison_bridge_lloc)
+ buf_m4_define (&m4defs_buf, "<M4_YY_BISON_LLOC>", NULL);
+
+ buf_m4_define(&m4defs_buf, "M4_YY_PREFIX", prefix);
+
+ if (did_outfilename)
+ line_directive_out (stdout, 0);
+
+ if (do_yylineno)
+ buf_m4_define (&m4defs_buf, "M4_YY_USE_LINENO", NULL);
+
+ /* Create the alignment type. */
+ buf_strdefine (&userdef_buf, "YY_INT_ALIGNED",
+ long_align ? "long int" : "short int");
+
+ /* Define the start condition macros. */
+ {
+ struct Buf tmpbuf;
+ buf_init(&tmpbuf, sizeof(char));
+ for (i = 1; i <= lastsc; i++) {
+ char *str, *fmt = "#define %s %d\n";
+ size_t strsz;
+
+ str = (char*)flex_alloc(strsz = strlen(fmt) + strlen(scname[i]) + (int)(1 + log10(i)) + 2);
+ if (!str)
+ flexfatal(_("allocation of macro definition failed"));
+ snprintf(str, strsz, fmt, scname[i], i - 1);
+ buf_strappend(&tmpbuf, str);
+ free(str);
+ }
+ buf_m4_define(&m4defs_buf, "M4_YY_SC_DEFS", tmpbuf.elts);
+ buf_destroy(&tmpbuf);
+ }
+
+ /* This is where we begin writing to the file. */
+
+ /* Dump the %top code. */
+ if( top_buf.elts)
+ outn((char*) top_buf.elts);
+
+ /* Dump the m4 definitions. */
+ buf_print_strings(&m4defs_buf, stdout);
+ m4defs_buf.nelts = 0; /* memory leak here. */
+
+ /* Place a bogus line directive, it will be fixed in the filter. */
+ outn("#line 0 \"M4_YY_OUTFILE_NAME\"\n");
+
+ /* Dump the user defined preproc directives. */
+ if (userdef_buf.elts)
+ outn ((char *) (userdef_buf.elts));
+
+ skelout ();
+ /* %% [1.0] */
+}
+
+/* flexend - terminate flex
+ *
+ * note
+ * This routine does not return.
+ */
+
+void flexend (exit_status)
+ int exit_status;
+
+{
+ static int called_before = -1; /* prevent infinite recursion. */
+ int tblsiz;
+
+ if (++called_before)
+ FLEX_EXIT (exit_status);
+
+ if (skelfile != NULL) {
+ if (ferror (skelfile))
+ lerr (_("input error reading skeleton file %s"),
+ skelname);
+
+ else if (fclose (skelfile))
+ lerr (_("error closing skeleton file %s"),
+ skelname);
+ }
+
+#if 0
+ fprintf (header_out,
+ "#ifdef YY_HEADER_EXPORT_START_CONDITIONS\n");
+ fprintf (header_out,
+ "/* Beware! Start conditions are not prefixed. */\n");
+
+ /* Special case for "INITIAL" */
+ fprintf (header_out,
+ "#undef INITIAL\n#define INITIAL 0\n");
+ for (i = 2; i <= lastsc; i++)
+ fprintf (header_out, "#define %s %d\n", scname[i], i - 1);
+ fprintf (header_out,
+ "#endif /* YY_HEADER_EXPORT_START_CONDITIONS */\n\n");
+
+ /* Kill ALL flex-related macros. This is so the user
+ * can #include more than one generated header file. */
+ fprintf (header_out, "#ifndef YY_HEADER_NO_UNDEFS\n");
+ fprintf (header_out,
+ "/* Undefine all internal macros, etc., that do no belong in the header. */\n\n");
+
+ {
+ const char * undef_list[] = {
+
+ "BEGIN",
+ "ECHO",
+ "EOB_ACT_CONTINUE_SCAN",
+ "EOB_ACT_END_OF_FILE",
+ "EOB_ACT_LAST_MATCH",
+ "FLEX_SCANNER",
+ "FLEX_STD",
+ "REJECT",
+ "YYFARGS0",
+ "YYFARGS1",
+ "YYFARGS2",
+ "YYFARGS3",
+ "YYLMAX",
+ "YYSTATE",
+ "YY_AT_BOL",
+ "YY_BREAK",
+ "YY_BUFFER_EOF_PENDING",
+ "YY_BUFFER_NEW",
+ "YY_BUFFER_NORMAL",
+ "YY_BUF_SIZE",
+ "M4_YY_CALL_LAST_ARG",
+ "M4_YY_CALL_ONLY_ARG",
+ "YY_CURRENT_BUFFER",
+ "YY_DECL",
+ "M4_YY_DECL_LAST_ARG",
+ "M4_YY_DEF_LAST_ARG",
+ "M4_YY_DEF_ONLY_ARG",
+ "YY_DO_BEFORE_ACTION",
+ "YY_END_OF_BUFFER",
+ "YY_END_OF_BUFFER_CHAR",
+ "YY_EXIT_FAILURE",
+ "YY_EXTRA_TYPE",
+ "YY_FATAL_ERROR",
+ "YY_FLEX_DEFINED_ECHO",
+ "YY_FLEX_LEX_COMPAT",
+ "YY_FLEX_MAJOR_VERSION",
+ "YY_FLEX_MINOR_VERSION",
+ "YY_FLEX_SUBMINOR_VERSION",
+ "YY_FLUSH_BUFFER",
+ "YY_G",
+ "YY_INPUT",
+ "YY_INTERACTIVE",
+ "YY_INT_ALIGNED",
+ "YY_LAST_ARG",
+ "YY_LESS_LINENO",
+ "YY_LEX_ARGS",
+ "YY_LEX_DECLARATION",
+ "YY_LEX_PROTO",
+ "YY_MAIN",
+ "YY_MORE_ADJ",
+ "YY_NEED_STRLEN",
+ "YY_NEW_FILE",
+ "YY_NULL",
+ "YY_NUM_RULES",
+ "YY_ONLY_ARG",
+ "YY_PARAMS",
+ "YY_PROTO",
+ "M4_YY_PROTO_LAST_ARG",
+ "M4_YY_PROTO_ONLY_ARG void",
+ "YY_READ_BUF_SIZE",
+ "YY_REENTRANT",
+ "YY_RESTORE_YY_MORE_OFFSET",
+ "YY_RULE_SETUP",
+ "YY_SC_TO_UI",
+ "YY_SKIP_YYWRAP",
+ "YY_START",
+ "YY_START_STACK_INCR",
+ "YY_STATE_EOF",
+ "YY_STDINIT",
+ "YY_TRAILING_HEAD_MASK",
+ "YY_TRAILING_MASK",
+ "YY_USER_ACTION",
+ "YY_USE_CONST",
+ "YY_USE_PROTOS",
+ "unput",
+ "yyTABLES_NAME",
+ "yy_create_buffer",
+ "yy_delete_buffer",
+ "yy_flex_debug",
+ "yy_flush_buffer",
+ "yy_init_buffer",
+ "yy_load_buffer_state",
+ "yy_new_buffer",
+ "yy_scan_buffer",
+ "yy_scan_bytes",
+ "yy_scan_string",
+ "yy_set_bol",
+ "yy_set_interactive",
+ "yy_switch_to_buffer",
+ "yypush_buffer_state",
+ "yypop_buffer_state",
+ "yyensure_buffer_stack",
+ "yyalloc",
+ "yyconst",
+ "yyextra",
+ "yyfree",
+ "yyget_debug",
+ "yyget_extra",
+ "yyget_in",
+ "yyget_leng",
+ "yyget_lineno",
+ "yyget_lloc",
+ "yyget_lval",
+ "yyget_out",
+ "yyget_text",
+ "yyin",
+ "yyleng",
+ "yyless",
+ "yylex",
+ "yylex_destroy",
+ "yylex_init",
+ "yylex_init_extra",
+ "yylineno",
+ "yylloc",
+ "yylval",
+ "yymore",
+ "yyout",
+ "yyrealloc",
+ "yyrestart",
+ "yyset_debug",
+ "yyset_extra",
+ "yyset_in",
+ "yyset_lineno",
+ "yyset_lloc",
+ "yyset_lval",
+ "yyset_out",
+ "yytables_destroy",
+ "yytables_fload",
+ "yyterminate",
+ "yytext",
+ "yytext_ptr",
+ "yywrap",
+
+ /* must be null-terminated */
+ NULL};
+
+
+ for (i=0; undef_list[i] != NULL; i++)
+ fprintf (header_out, "#undef %s\n", undef_list[i]);
+ }
+
+ /* undef any of the auto-generated symbols. */
+ for (i = 0; i < defs_buf.nelts; i++) {
+
+ /* don't undef start conditions */
+ if (sclookup (((char **) defs_buf.elts)[i]) > 0)
+ continue;
+ fprintf (header_out, "#undef %s\n",
+ ((char **) defs_buf.elts)[i]);
+ }
+
+ fprintf (header_out,
+ "#endif /* !YY_HEADER_NO_UNDEFS */\n");
+ fprintf (header_out, "\n");
+ fprintf (header_out, "#undef %sIN_HEADER\n", prefix);
+ fprintf (header_out, "#endif /* %sHEADER_H */\n", prefix);
+
+ if (ferror (header_out))
+ lerr (_("error creating header file %s"),
+ headerfilename);
+ fflush (header_out);
+ fclose (header_out);
+#endif
+
+ if (exit_status != 0 && outfile_created) {
+ if (ferror (stdout))
+ lerr (_("error writing output file %s"),
+ outfilename);
+
+ else if ((_stdout_closed = 1) && fclose (stdout))
+ lerr (_("error closing output file %s"),
+ outfilename);
+
+ else if (unlink (outfilename))
+ lerr (_("error deleting output file %s"),
+ outfilename);
+ }
+
+
+ if (backing_up_report && backing_up_file) {
+ if (num_backing_up == 0)
+ fprintf (backing_up_file, _("No backing up.\n"));
+ else if (fullspd || fulltbl)
+ fprintf (backing_up_file,
+ _
+ ("%d backing up (non-accepting) states.\n"),
+ num_backing_up);
+ else
+ fprintf (backing_up_file,
+ _("Compressed tables always back up.\n"));
+
+ if (ferror (backing_up_file))
+ lerr (_("error writing backup file %s"),
+ backing_name);
+
+ else if (fclose (backing_up_file))
+ lerr (_("error closing backup file %s"),
+ backing_name);
+ }
+
+ if (printstats) {
+ fprintf (stderr, _("%s version %s usage statistics:\n"),
+ program_name, flex_version);
+
+ fprintf (stderr, _(" scanner options: -"));
+
+ if (C_plus_plus)
+ putc ('+', stderr);
+ if (backing_up_report)
+ putc ('b', stderr);
+ if (ddebug)
+ putc ('d', stderr);
+ if (sf_case_ins())
+ putc ('i', stderr);
+ if (lex_compat)
+ putc ('l', stderr);
+ if (posix_compat)
+ putc ('X', stderr);
+ if (performance_report > 0)
+ putc ('p', stderr);
+ if (performance_report > 1)
+ putc ('p', stderr);
+ if (spprdflt)
+ putc ('s', stderr);
+ if (reentrant)
+ fputs ("--reentrant", stderr);
+ if (bison_bridge_lval)
+ fputs ("--bison-bridge", stderr);
+ if (bison_bridge_lloc)
+ fputs ("--bison-locations", stderr);
+ if (use_stdout)
+ putc ('t', stderr);
+ if (printstats)
+ putc ('v', stderr); /* always true! */
+ if (nowarn)
+ putc ('w', stderr);
+ if (interactive == false)
+ putc ('B', stderr);
+ if (interactive == true)
+ putc ('I', stderr);
+ if (!gen_line_dirs)
+ putc ('L', stderr);
+ if (trace)
+ putc ('T', stderr);
+
+ if (csize == unspecified)
+ /* We encountered an error fairly early on, so csize
+ * never got specified. Define it now, to prevent
+ * bogus table sizes being written out below.
+ */
+ csize = 256;
+
+ if (csize == 128)
+ putc ('7', stderr);
+ else
+ putc ('8', stderr);
+
+ fprintf (stderr, " -C");
+
+ if (long_align)
+ putc ('a', stderr);
+ if (fulltbl)
+ putc ('f', stderr);
+ if (fullspd)
+ putc ('F', stderr);
+ if (useecs)
+ putc ('e', stderr);
+ if (usemecs)
+ putc ('m', stderr);
+ if (use_read)
+ putc ('r', stderr);
+
+ if (did_outfilename)
+ fprintf (stderr, " -o%s", outfilename);
+
+ if (skelname)
+ fprintf (stderr, " -S%s", skelname);
+
+ if (strcmp (prefix, "yy"))
+ fprintf (stderr, " -P%s", prefix);
+
+ putc ('\n', stderr);
+
+ fprintf (stderr, _(" %d/%d NFA states\n"),
+ lastnfa, current_mns);
+ fprintf (stderr, _(" %d/%d DFA states (%d words)\n"),
+ lastdfa, current_max_dfas, totnst);
+ fprintf (stderr, _(" %d rules\n"),
+ num_rules + num_eof_rules -
+ 1 /* - 1 for def. rule */ );
+
+ if (num_backing_up == 0)
+ fprintf (stderr, _(" No backing up\n"));
+ else if (fullspd || fulltbl)
+ fprintf (stderr,
+ _
+ (" %d backing-up (non-accepting) states\n"),
+ num_backing_up);
+ else
+ fprintf (stderr,
+ _
+ (" Compressed tables always back-up\n"));
+
+ if (bol_needed)
+ fprintf (stderr,
+ _(" Beginning-of-line patterns used\n"));
+
+ fprintf (stderr, _(" %d/%d start conditions\n"), lastsc,
+ current_max_scs);
+ fprintf (stderr,
+ _
+ (" %d epsilon states, %d double epsilon states\n"),
+ numeps, eps2);
+
+ if (lastccl == 0)
+ fprintf (stderr, _(" no character classes\n"));
+ else
+ fprintf (stderr,
+ _
+ (" %d/%d character classes needed %d/%d words of storage, %d reused\n"),
+ lastccl, current_maxccls,
+ cclmap[lastccl] + ccllen[lastccl],
+ current_max_ccl_tbl_size, cclreuse);
+
+ fprintf (stderr, _(" %d state/nextstate pairs created\n"),
+ numsnpairs);
+ fprintf (stderr,
+ _(" %d/%d unique/duplicate transitions\n"),
+ numuniq, numdup);
+
+ if (fulltbl) {
+ tblsiz = lastdfa * numecs;
+ fprintf (stderr, _(" %d table entries\n"),
+ tblsiz);
+ }
+
+ else {
+ tblsiz = 2 * (lastdfa + numtemps) + 2 * tblend;
+
+ fprintf (stderr,
+ _(" %d/%d base-def entries created\n"),
+ lastdfa + numtemps, current_max_dfas);
+ fprintf (stderr,
+ _
+ (" %d/%d (peak %d) nxt-chk entries created\n"),
+ tblend, current_max_xpairs, peakpairs);
+ fprintf (stderr,
+ _
+ (" %d/%d (peak %d) template nxt-chk entries created\n"),
+ numtemps * nummecs,
+ current_max_template_xpairs,
+ numtemps * numecs);
+ fprintf (stderr, _(" %d empty table entries\n"),
+ nummt);
+ fprintf (stderr, _(" %d protos created\n"),
+ numprots);
+ fprintf (stderr,
+ _(" %d templates created, %d uses\n"),
+ numtemps, tmpuses);
+ }
+
+ if (useecs) {
+ tblsiz = tblsiz + csize;
+ fprintf (stderr,
+ _
+ (" %d/%d equivalence classes created\n"),
+ numecs, csize);
+ }
+
+ if (usemecs) {
+ tblsiz = tblsiz + numecs;
+ fprintf (stderr,
+ _
+ (" %d/%d meta-equivalence classes created\n"),
+ nummecs, csize);
+ }
+
+ fprintf (stderr,
+ _
+ (" %d (%d saved) hash collisions, %d DFAs equal\n"),
+ hshcol, hshsave, dfaeql);
+ fprintf (stderr, _(" %d sets of reallocations needed\n"),
+ num_reallocs);
+ fprintf (stderr, _(" %d total table entries needed\n"),
+ tblsiz);
+ }
+
+ FLEX_EXIT (exit_status);
+}
+
+
+/* flexinit - initialize flex */
+
+void flexinit (argc, argv)
+ int argc;
+ char **argv;
+{
+ int i, sawcmpflag, rv, optind;
+ char *arg;
+ scanopt_t sopt;
+
+ printstats = syntaxerror = trace = spprdflt = false;
+ lex_compat = posix_compat = C_plus_plus = backing_up_report =
+ ddebug = fulltbl = false;
+ fullspd = long_align = nowarn = yymore_used = continued_action =
+ false;
+ do_yylineno = yytext_is_array = in_rule = reject = do_stdinit =
+ false;
+ yymore_really_used = reject_really_used = unspecified;
+ interactive = csize = unspecified;
+ do_yywrap = gen_line_dirs = usemecs = useecs = true;
+ reentrant = bison_bridge_lval = bison_bridge_lloc = false;
+ performance_report = 0;
+ did_outfilename = 0;
+ prefix = "yy";
+ yyclass = 0;
+ use_read = use_stdout = false;
+ tablesext = tablesverify = false;
+ gentables = true;
+ tablesfilename = tablesname = NULL;
+ ansi_func_defs = ansi_func_protos = true;
+
+ sawcmpflag = false;
+
+ /* Initialize dynamic array for holding the rule actions. */
+ action_size = 2048; /* default size of action array in bytes */
+ action_array = allocate_character_array (action_size);
+ defs1_offset = prolog_offset = action_offset = action_index = 0;
+ action_array[0] = '\0';
+
+ /* Initialize any buffers. */
+ buf_init (&userdef_buf, sizeof (char)); /* one long string */
+ buf_init (&defs_buf, sizeof (char *)); /* list of strings */
+ buf_init (&yydmap_buf, sizeof (char)); /* one long string */
+ buf_init (&top_buf, sizeof (char)); /* one long string */
+
+ {
+ const char * m4defs_init_str[] = {"m4_changequote\n",
+ "m4_changequote([[, ]])\n"};
+ buf_init (&m4defs_buf, sizeof (char *));
+ buf_append (&m4defs_buf, &m4defs_init_str, 2);
+ }
+
+ sf_init ();
+
+ /* initialize regex lib */
+ flex_init_regex();
+
+ /* Enable C++ if program name ends with '+'. */
+ program_name = basename2 (argv[0], 0);
+
+ if (program_name[0] != '\0' &&
+ program_name[strlen (program_name) - 1] == '+')
+ C_plus_plus = true;
+
+ /* read flags */
+ sopt = scanopt_init (flexopts, argc, argv, 0);
+ if (!sopt) {
+ /* This will only happen when flexopts array is altered. */
+ fprintf (stderr,
+ _("Internal error. flexopts are malformed.\n"));
+ FLEX_EXIT (1);
+ }
+
+ while ((rv = scanopt (sopt, &arg, &optind)) != 0) {
+
+ if (rv < 0) {
+ /* Scanopt has already printed an option-specific error message. */
+ fprintf (stderr,
+ _
+ ("Try `%s --help' for more information.\n"),
+ program_name);
+ FLEX_EXIT (1);
+ }
+
+ switch ((enum flexopt_flag_t) rv) {
+ case OPT_CPLUSPLUS:
+ C_plus_plus = true;
+ break;
+
+ case OPT_BATCH:
+ interactive = false;
+ break;
+
+ case OPT_BACKUP:
+ backing_up_report = true;
+ break;
+
+ case OPT_DONOTHING:
+ break;
+
+ case OPT_COMPRESSION:
+ if (!sawcmpflag) {
+ useecs = false;
+ usemecs = false;
+ fulltbl = false;
+ sawcmpflag = true;
+ }
+
+ for (i = 0; arg && arg[i] != '\0'; i++)
+ switch (arg[i]) {
+ case 'a':
+ long_align = true;
+ break;
+
+ case 'e':
+ useecs = true;
+ break;
+
+ case 'F':
+ fullspd = true;
+ break;
+
+ case 'f':
+ fulltbl = true;
+ break;
+
+ case 'm':
+ usemecs = true;
+ break;
+
+ case 'r':
+ use_read = true;
+ break;
+
+ default:
+ lerr (_
+ ("unknown -C option '%c'"),
+ arg[i]);
+ break;
+ }
+ break;
+
+ case OPT_DEBUG:
+ ddebug = true;
+ break;
+
+ case OPT_NO_DEBUG:
+ ddebug = false;
+ break;
+
+ case OPT_FULL:
+ useecs = usemecs = false;
+ use_read = fulltbl = true;
+ break;
+
+ case OPT_FAST:
+ useecs = usemecs = false;
+ use_read = fullspd = true;
+ break;
+
+ case OPT_HELP:
+ usage ();
+ FLEX_EXIT (0);
+
+ case OPT_INTERACTIVE:
+ interactive = true;
+ break;
+
+ case OPT_CASE_INSENSITIVE:
+ sf_set_case_ins(true);
+ break;
+
+ case OPT_LEX_COMPAT:
+ lex_compat = true;
+ break;
+
+ case OPT_POSIX_COMPAT:
+ posix_compat = true;
+ break;
+
+ case OPT_PREPROC_LEVEL:
+ preproc_level = strtol(arg,NULL,0);
+ break;
+
+ case OPT_MAIN:
+ buf_strdefine (&userdef_buf, "YY_MAIN", "1");
+ do_yywrap = false;
+ break;
+
+ case OPT_NO_MAIN:
+ buf_strdefine (&userdef_buf, "YY_MAIN", "0");
+ break;
+
+ case OPT_NO_LINE:
+ gen_line_dirs = false;
+ break;
+
+ case OPT_OUTFILE:
+ outfilename = arg;
+ did_outfilename = 1;
+ break;
+
+ case OPT_PREFIX:
+ prefix = arg;
+ break;
+
+ case OPT_PERF_REPORT:
+ ++performance_report;
+ break;
+
+ case OPT_BISON_BRIDGE:
+ bison_bridge_lval = true;
+ break;
+
+ case OPT_BISON_BRIDGE_LOCATIONS:
+ bison_bridge_lval = bison_bridge_lloc = true;
+ break;
+
+ case OPT_REENTRANT:
+ reentrant = true;
+ break;
+
+ case OPT_NO_REENTRANT:
+ reentrant = false;
+ break;
+
+ case OPT_SKEL:
+ skelname = arg;
+ break;
+
+ case OPT_DEFAULT:
+ spprdflt = false;
+ break;
+
+ case OPT_NO_DEFAULT:
+ spprdflt = true;
+ break;
+
+ case OPT_STDOUT:
+ use_stdout = true;
+ break;
+
+ case OPT_NO_UNISTD_H:
+ //buf_strdefine (&userdef_buf, "YY_NO_UNISTD_H", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_UNISTD_H",0);
+ break;
+
+ case OPT_TABLES_FILE:
+ tablesext = true;
+ tablesfilename = arg;
+ break;
+
+ case OPT_TABLES_VERIFY:
+ tablesverify = true;
+ break;
+
+ case OPT_TRACE:
+ trace = true;
+ break;
+
+ case OPT_VERBOSE:
+ printstats = true;
+ break;
+
+ case OPT_VERSION:
+ printf (_("%s %s\n"), program_name, flex_version);
+ FLEX_EXIT (0);
+
+ case OPT_WARN:
+ nowarn = false;
+ break;
+
+ case OPT_NO_WARN:
+ nowarn = true;
+ break;
+
+ case OPT_7BIT:
+ csize = 128;
+ break;
+
+ case OPT_8BIT:
+ csize = CSIZE;
+ break;
+
+ case OPT_ALIGN:
+ long_align = true;
+ break;
+
+ case OPT_NO_ALIGN:
+ long_align = false;
+ break;
+
+ case OPT_ALWAYS_INTERACTIVE:
+ buf_m4_define (&m4defs_buf, "M4_YY_ALWAYS_INTERACTIVE", 0);
+ break;
+
+ case OPT_NEVER_INTERACTIVE:
+ buf_m4_define( &m4defs_buf, "M4_YY_NEVER_INTERACTIVE", 0);
+ break;
+
+ case OPT_ARRAY:
+ yytext_is_array = true;
+ break;
+
+ case OPT_POINTER:
+ yytext_is_array = false;
+ break;
+
+ case OPT_ECS:
+ useecs = true;
+ break;
+
+ case OPT_NO_ECS:
+ useecs = false;
+ break;
+
+ case OPT_HEADER_FILE:
+ headerfilename = arg;
+ break;
+
+ case OPT_META_ECS:
+ usemecs = true;
+ break;
+
+ case OPT_NO_META_ECS:
+ usemecs = false;
+ break;
+
+ case OPT_PREPROCDEFINE:
+ {
+ /* arg is "symbol" or "symbol=definition". */
+ char *def;
+
+ for (def = arg;
+ *def != '\0' && *def != '='; ++def) ;
+
+ buf_strappend (&userdef_buf, "#define ");
+ if (*def == '\0') {
+ buf_strappend (&userdef_buf, arg);
+ buf_strappend (&userdef_buf,
+ " 1\n");
+ }
+ else {
+ buf_strnappend (&userdef_buf, arg,
+ def - arg);
+ buf_strappend (&userdef_buf, " ");
+ buf_strappend (&userdef_buf,
+ def + 1);
+ buf_strappend (&userdef_buf, "\n");
+ }
+ }
+ break;
+
+ case OPT_READ:
+ use_read = true;
+ break;
+
+ case OPT_STACK:
+ //buf_strdefine (&userdef_buf, "YY_STACK_USED", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_STACK_USED",0);
+ break;
+
+ case OPT_STDINIT:
+ do_stdinit = true;
+ break;
+
+ case OPT_NO_STDINIT:
+ do_stdinit = false;
+ break;
+
+ case OPT_YYCLASS:
+ yyclass = arg;
+ break;
+
+ case OPT_YYLINENO:
+ do_yylineno = true;
+ break;
+
+ case OPT_NO_YYLINENO:
+ do_yylineno = false;
+ break;
+
+ case OPT_YYWRAP:
+ do_yywrap = true;
+ break;
+
+ case OPT_NO_YYWRAP:
+ do_yywrap = false;
+ break;
+
+ case OPT_YYMORE:
+ yymore_really_used = true;
+ break;
+
+ case OPT_NO_YYMORE:
+ yymore_really_used = false;
+ break;
+
+ case OPT_REJECT:
+ reject_really_used = true;
+ break;
+
+ case OPT_NO_REJECT:
+ reject_really_used = false;
+ break;
+
+ case OPT_NO_ANSI_FUNC_DEFS:
+ ansi_func_defs = false;
+ break;
+
+ case OPT_NO_ANSI_FUNC_PROTOS:
+ ansi_func_protos = false;
+ break;
+
+ case OPT_NO_YY_PUSH_STATE:
+ //buf_strdefine (&userdef_buf, "YY_NO_PUSH_STATE", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_PUSH_STATE",0);
+ break;
+ case OPT_NO_YY_POP_STATE:
+ //buf_strdefine (&userdef_buf, "YY_NO_POP_STATE", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_POP_STATE",0);
+ break;
+ case OPT_NO_YY_TOP_STATE:
+ //buf_strdefine (&userdef_buf, "YY_NO_TOP_STATE", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_TOP_STATE",0);
+ break;
+ case OPT_NO_UNPUT:
+ //buf_strdefine (&userdef_buf, "YY_NO_UNPUT", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_UNPUT",0);
+ break;
+ case OPT_NO_YY_SCAN_BUFFER:
+ //buf_strdefine (&userdef_buf, "YY_NO_SCAN_BUFFER", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_BUFFER",0);
+ break;
+ case OPT_NO_YY_SCAN_BYTES:
+ //buf_strdefine (&userdef_buf, "YY_NO_SCAN_BYTES", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_BYTES",0);
+ break;
+ case OPT_NO_YY_SCAN_STRING:
+ //buf_strdefine (&userdef_buf, "YY_NO_SCAN_STRING", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_STRING",0);
+ break;
+ case OPT_NO_YYGET_EXTRA:
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_EXTRA", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_EXTRA",0);
+ break;
+ case OPT_NO_YYSET_EXTRA:
+ //buf_strdefine (&userdef_buf, "YY_NO_SET_EXTRA", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_EXTRA",0);
+ break;
+ case OPT_NO_YYGET_LENG:
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_LENG", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LENG",0);
+ break;
+ case OPT_NO_YYGET_TEXT:
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_TEXT", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_TEXT",0);
+ break;
+ case OPT_NO_YYGET_LINENO:
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_LINENO", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LINENO",0);
+ break;
+ case OPT_NO_YYSET_LINENO:
+ //buf_strdefine (&userdef_buf, "YY_NO_SET_LINENO", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LINENO",0);
+ break;
+ case OPT_NO_YYGET_IN:
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_IN", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_IN",0);
+ break;
+ case OPT_NO_YYSET_IN:
+ //buf_strdefine (&userdef_buf, "YY_NO_SET_IN", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_IN",0);
+ break;
+ case OPT_NO_YYGET_OUT:
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_OUT", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_OUT",0);
+ break;
+ case OPT_NO_YYSET_OUT:
+ //buf_strdefine (&userdef_buf, "YY_NO_SET_OUT", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_OUT",0);
+ break;
+ case OPT_NO_YYGET_LVAL:
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_LVAL", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LVAL",0);
+ break;
+ case OPT_NO_YYSET_LVAL:
+ //buf_strdefine (&userdef_buf, "YY_NO_SET_LVAL", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LVAL",0);
+ break;
+ case OPT_NO_YYGET_LLOC:
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_LLOC", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LLOC",0);
+ break;
+ case OPT_NO_YYSET_LLOC:
+ //buf_strdefine (&userdef_buf, "YY_NO_SET_LLOC", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LLOC",0);
+ break;
+ case OPT_HEX:
+ trace_hex = 1;
+ } /* switch */
+ } /* while scanopt() */
+
+ scanopt_destroy (sopt);
+
+ num_input_files = argc - optind;
+ input_files = argv + optind;
+ set_input_file (num_input_files > 0 ? input_files[0] : NULL);
+
+ lastccl = lastsc = lastdfa = lastnfa = 0;
+ num_rules = num_eof_rules = default_rule = 0;
+ numas = numsnpairs = tmpuses = 0;
+ numecs = numeps = eps2 = num_reallocs = hshcol = dfaeql = totnst =
+ 0;
+ numuniq = numdup = hshsave = eofseen = datapos = dataline = 0;
+ num_backing_up = onesp = numprots = 0;
+ variable_trailing_context_rules = bol_needed = false;
+
+ linenum = sectnum = 1;
+ firstprot = NIL;
+
+ /* Used in mkprot() so that the first proto goes in slot 1
+ * of the proto queue.
+ */
+ lastprot = 1;
+
+ set_up_initial_allocations ();
+}
+
+
+/* readin - read in the rules section of the input file(s) */
+
+void readin ()
+{
+ static char yy_stdinit[] = "FILE *yyin = stdin, *yyout = stdout;";
+ static char yy_nostdinit[] =
+ "FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;";
+
+ line_directive_out ((FILE *) 0, 1);
+
+ if (yyparse ()) {
+ pinpoint_message (_("fatal parse error"));
+ flexend (1);
+ }
+
+ if (syntaxerror)
+ flexend (1);
+
+ /* If the user explicitly requested posix compatibility by specifing the
+ * posix-compat option, then we check for conflicting options. However, if
+ * the POSIXLY_CORRECT variable is set, then we quietly make flex as
+ * posix-compatible as possible. This is the recommended behavior
+ * according to the GNU Coding Standards.
+ *
+ * Note: The posix option was added to flex to provide the posix behavior
+ * of the repeat operator in regular expressions, e.g., `ab{3}'
+ */
+ if (posix_compat) {
+ /* TODO: This is where we try to make flex behave according to
+ * posiz, AND check for conflicting options. How far should we go
+ * with this? Should we disable all the neat-o flex features?
+ */
+ /* Update: Estes says no, since other flex features don't violate posix. */
+ }
+
+ if (getenv ("POSIXLY_CORRECT")) {
+ posix_compat = true;
+ }
+
+ if (backing_up_report) {
+ backing_up_file = fopen (backing_name, "w");
+ if (backing_up_file == NULL)
+ lerr (_
+ ("could not create backing-up info file %s"),
+ backing_name);
+ }
+
+ else
+ backing_up_file = NULL;
+
+ if (yymore_really_used == true)
+ yymore_used = true;
+ else if (yymore_really_used == false)
+ yymore_used = false;
+
+ if (reject_really_used == true)
+ reject = true;
+ else if (reject_really_used == false)
+ reject = false;
+
+ if (performance_report > 0) {
+ if (lex_compat) {
+ fprintf (stderr,
+ _
+ ("-l AT&T lex compatibility option entails a large performance penalty\n"));
+ fprintf (stderr,
+ _
+ (" and may be the actual source of other reported performance penalties\n"));
+ }
+
+ else if (do_yylineno) {
+ fprintf (stderr,
+ _
+ ("%%option yylineno entails a performance penalty ONLY on rules that can match newline characters\n"));
+ }
+
+ if (performance_report > 1) {
+ if (interactive)
+ fprintf (stderr,
+ _
+ ("-I (interactive) entails a minor performance penalty\n"));
+
+ if (yymore_used)
+ fprintf (stderr,
+ _
+ ("yymore() entails a minor performance penalty\n"));
+ }
+
+ if (reject)
+ fprintf (stderr,
+ _
+ ("REJECT entails a large performance penalty\n"));
+
+ if (variable_trailing_context_rules)
+ fprintf (stderr,
+ _
+ ("Variable trailing context rules entail a large performance penalty\n"));
+ }
+
+ if (reject)
+ real_reject = true;
+
+ if (variable_trailing_context_rules)
+ reject = true;
+
+ if ((fulltbl || fullspd) && reject) {
+ if (real_reject)
+ flexerror (_
+ ("REJECT cannot be used with -f or -F"));
+ else if (do_yylineno)
+ flexerror (_
+ ("%option yylineno cannot be used with REJECT"));
+ else
+ flexerror (_
+ ("variable trailing context rules cannot be used with -f or -F"));
+ }
+
+ if (reject){
+ out_m4_define( "M4_YY_USES_REJECT", NULL);
+ //outn ("\n#define YY_USES_REJECT");
+ }
+
+ if (!do_yywrap) {
+ if (!C_plus_plus) {
+ if (reentrant)
+ outn ("\n#define yywrap(yyscanner) (/*CONSTCOND*/1)");
+ else
+ outn ("\n#define yywrap() (/*CONSTCOND*/1)");
+ }
+ outn ("#define YY_SKIP_YYWRAP");
+ }
+
+ if (ddebug)
+ outn ("\n#define FLEX_DEBUG");
+
+ OUT_BEGIN_CODE ();
+ if (csize == 256)
+ outn ("typedef unsigned char YY_CHAR;");
+ else
+ outn ("typedef char YY_CHAR;");
+ OUT_END_CODE ();
+
+ if (C_plus_plus) {
+ outn ("#define yytext_ptr yytext");
+
+ if (interactive)
+ outn ("#define YY_INTERACTIVE");
+ }
+
+ else {
+ OUT_BEGIN_CODE ();
+ /* In reentrant scanner, stdinit is handled in flex.skl. */
+ if (do_stdinit) {
+ if (reentrant){
+ outn ("#ifdef VMS");
+ outn ("#ifdef __VMS_POSIX");
+ outn ("#define YY_STDINIT");
+ outn ("#endif");
+ outn ("#else");
+ outn ("#define YY_STDINIT");
+ outn ("#endif");
+ }
+
+ outn ("#ifdef VMS");
+ outn ("#ifndef __VMS_POSIX");
+ outn (yy_nostdinit);
+ outn ("#else");
+ outn (yy_stdinit);
+ outn ("#endif");
+ outn ("#else");
+ outn (yy_stdinit);
+ outn ("#endif");
+ }
+
+ else {
+ if(!reentrant)
+ outn (yy_nostdinit);
+ }
+ OUT_END_CODE ();
+ }
+
+ OUT_BEGIN_CODE ();
+ if (fullspd)
+ outn ("typedef yyconst struct yy_trans_info *yy_state_type;");
+ else if (!C_plus_plus)
+ outn ("typedef int yy_state_type;");
+ OUT_END_CODE ();
+
+ if (lex_compat)
+ outn ("#define YY_FLEX_LEX_COMPAT");
+
+ if (!C_plus_plus && !reentrant) {
+ outn ("extern int yylineno;");
+ OUT_BEGIN_CODE ();
+ outn ("int yylineno = 1;");
+ OUT_END_CODE ();
+ }
+
+ if (C_plus_plus) {
+ outn ("\n#include <FlexLexer.h>");
+
+ if (!do_yywrap) {
+ outn("\nint yyFlexLexer::yywrap() { return 1; }");
+ }
+
+ if (yyclass) {
+ outn ("int yyFlexLexer::yylex()");
+ outn ("\t{");
+ outn ("\tLexerError( \"yyFlexLexer::yylex invoked but %option yyclass used\" );");
+ outn ("\treturn 0;");
+ outn ("\t}");
+
+ out_str ("\n#define YY_DECL int %s::yylex()\n",
+ yyclass);
+ }
+ }
+
+ else {
+
+ /* Watch out: yytext_ptr is a variable when yytext is an array,
+ * but it's a macro when yytext is a pointer.
+ */
+ if (yytext_is_array) {
+ if (!reentrant)
+ outn ("extern char yytext[];\n");
+ }
+ else {
+ if (reentrant) {
+ outn ("#define yytext_ptr yytext_r");
+ }
+ else {
+ outn ("extern char *yytext;");
+
+ outn("#ifdef yytext_ptr");
+ outn("#undef yytext_ptr");
+ outn("#endif");
+ outn ("#define yytext_ptr yytext");
+ }
+ }
+
+ if (yyclass)
+ flexerror (_
+ ("%option yyclass only meaningful for C++ scanners"));
+ }
+
+ if (useecs)
+ numecs = cre8ecs (nextecm, ecgroup, csize);
+ else
+ numecs = csize;
+
+ /* Now map the equivalence class for NUL to its expected place. */
+ ecgroup[0] = ecgroup[csize];
+ NUL_ec = ABS (ecgroup[0]);
+
+ if (useecs)
+ ccl2ecl ();
+}
+
+
+/* set_up_initial_allocations - allocate memory for internal tables */
+
+void set_up_initial_allocations ()
+{
+ maximum_mns = (long_align ? MAXIMUM_MNS_LONG : MAXIMUM_MNS);
+ current_mns = INITIAL_MNS;
+ firstst = allocate_integer_array (current_mns);
+ lastst = allocate_integer_array (current_mns);
+ finalst = allocate_integer_array (current_mns);
+ transchar = allocate_integer_array (current_mns);
+ trans1 = allocate_integer_array (current_mns);
+ trans2 = allocate_integer_array (current_mns);
+ accptnum = allocate_integer_array (current_mns);
+ assoc_rule = allocate_integer_array (current_mns);
+ state_type = allocate_integer_array (current_mns);
+
+ current_max_rules = INITIAL_MAX_RULES;
+ rule_type = allocate_integer_array (current_max_rules);
+ rule_linenum = allocate_integer_array (current_max_rules);
+ rule_useful = allocate_integer_array (current_max_rules);
+ rule_has_nl = allocate_bool_array (current_max_rules);
+
+ current_max_scs = INITIAL_MAX_SCS;
+ scset = allocate_integer_array (current_max_scs);
+ scbol = allocate_integer_array (current_max_scs);
+ scxclu = allocate_integer_array (current_max_scs);
+ sceof = allocate_integer_array (current_max_scs);
+ scname = allocate_char_ptr_array (current_max_scs);
+
+ current_maxccls = INITIAL_MAX_CCLS;
+ cclmap = allocate_integer_array (current_maxccls);
+ ccllen = allocate_integer_array (current_maxccls);
+ cclng = allocate_integer_array (current_maxccls);
+ ccl_has_nl = allocate_bool_array (current_maxccls);
+
+ current_max_ccl_tbl_size = INITIAL_MAX_CCL_TBL_SIZE;
+ ccltbl = allocate_Character_array (current_max_ccl_tbl_size);
+
+ current_max_dfa_size = INITIAL_MAX_DFA_SIZE;
+
+ current_max_xpairs = INITIAL_MAX_XPAIRS;
+ nxt = allocate_integer_array (current_max_xpairs);
+ chk = allocate_integer_array (current_max_xpairs);
+
+ current_max_template_xpairs = INITIAL_MAX_TEMPLATE_XPAIRS;
+ tnxt = allocate_integer_array (current_max_template_xpairs);
+
+ current_max_dfas = INITIAL_MAX_DFAS;
+ base = allocate_integer_array (current_max_dfas);
+ def = allocate_integer_array (current_max_dfas);
+ dfasiz = allocate_integer_array (current_max_dfas);
+ accsiz = allocate_integer_array (current_max_dfas);
+ dhash = allocate_integer_array (current_max_dfas);
+ dss = allocate_int_ptr_array (current_max_dfas);
+ dfaacc = allocate_dfaacc_union (current_max_dfas);
+
+ nultrans = (int *) 0;
+}
+
+
+/* extracts basename from path, optionally stripping the extension "\.*"
+ * (same concept as /bin/sh `basename`, but different handling of extension). */
+static char *basename2 (path, strip_ext)
+ char *path;
+ int strip_ext; /* boolean */
+{
+ char *b, *e = 0;
+
+ b = path;
+ for (b = path; *path; path++)
+ if (*path == '/')
+ b = path + 1;
+ else if (*path == '.')
+ e = path;
+
+ if (strip_ext && e && e > b)
+ *e = '\0';
+ return b;
+}
+
+void usage ()
+{
+ FILE *f = stdout;
+
+ if (!did_outfilename) {
+ snprintf (outfile_path, sizeof(outfile_path), outfile_template,
+ prefix, C_plus_plus ? "cc" : "c");
+ outfilename = outfile_path;
+ }
+
+ fprintf (f, _("Usage: %s [OPTIONS] [FILE]...\n"), program_name);
+ fprintf (f,
+ _
+ ("Generates programs that perform pattern-matching on text.\n"
+ "\n" "Table Compression:\n"
+ " -Ca, --align trade off larger tables for better memory alignment\n"
+ " -Ce, --ecs construct equivalence classes\n"
+ " -Cf do not compress tables; use -f representation\n"
+ " -CF do not compress tables; use -F representation\n"
+ " -Cm, --meta-ecs construct meta-equivalence classes\n"
+ " -Cr, --read use read() instead of stdio for scanner input\n"
+ " -f, --full generate fast, large scanner. Same as -Cfr\n"
+ " -F, --fast use alternate table representation. Same as -CFr\n"
+ " -Cem default compression (same as --ecs --meta-ecs)\n"
+ "\n" "Debugging:\n"
+ " -d, --debug enable debug mode in scanner\n"
+ " -b, --backup write backing-up information to %s\n"
+ " -p, --perf-report write performance report to stderr\n"
+ " -s, --nodefault suppress default rule to ECHO unmatched text\n"
+ " -T, --trace %s should run in trace mode\n"
+ " -w, --nowarn do not generate warnings\n"
+ " -v, --verbose write summary of scanner statistics to stdout\n"
+ " --hex use hexadecimal numbers instead of octal in debug outputs\n"
+ "\n" "Files:\n"
+ " -o, --outfile=FILE specify output filename\n"
+ " -S, --skel=FILE specify skeleton file\n"
+ " -t, --stdout write scanner on stdout instead of %s\n"
+ " --yyclass=NAME name of C++ class\n"
+ " --header-file=FILE create a C header file in addition to the scanner\n"
+ " --tables-file[=FILE] write tables to FILE\n" "\n"
+ "Scanner behavior:\n"
+ " -7, --7bit generate 7-bit scanner\n"
+ " -8, --8bit generate 8-bit scanner\n"
+ " -B, --batch generate batch scanner (opposite of -I)\n"
+ " -i, --case-insensitive ignore case in patterns\n"
+ " -l, --lex-compat maximal compatibility with original lex\n"
+ " -X, --posix-compat maximal compatibility with POSIX lex\n"
+ " -I, --interactive generate interactive scanner (opposite of -B)\n"
+ " --yylineno track line count in yylineno\n"
+ "\n" "Generated code:\n"
+ " -+, --c++ generate C++ scanner class\n"
+ " -Dmacro[=defn] #define macro defn (default defn is '1')\n"
+ " -L, --noline suppress #line directives in scanner\n"
+ " -P, --prefix=STRING use STRING as prefix instead of \"yy\"\n"
+ " -R, --reentrant generate a reentrant C scanner\n"
+ " --bison-bridge scanner for bison pure parser.\n"
+ " --bison-locations include yylloc support.\n"
+ " --stdinit initialize yyin/yyout to stdin/stdout\n"
+ " --noansi-definitions old-style function definitions\n"
+ " --noansi-prototypes empty parameter list in prototypes\n"
+ " --nounistd do not include <unistd.h>\n"
+ " --noFUNCTION do not generate a particular FUNCTION\n"
+ "\n" "Miscellaneous:\n"
+ " -c do-nothing POSIX option\n"
+ " -n do-nothing POSIX option\n"
+ " -?\n"
+ " -h, --help produce this help message\n"
+ " -V, --version report %s version\n"),
+ backing_name, program_name, outfile_path, program_name);
+
+}
diff --git a/src/misc.c b/src/misc.c
new file mode 100644
index 0000000..8e0edca
--- /dev/null
+++ b/src/misc.c
@@ -0,0 +1,1015 @@
+/* misc - miscellaneous flex routines */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+#include "tables.h"
+
+#define CMD_IF_TABLES_SER "%if-tables-serialization"
+#define CMD_TABLES_YYDMAP "%tables-yydmap"
+#define CMD_DEFINE_YYTABLES "%define-yytables"
+#define CMD_IF_CPP_ONLY "%if-c++-only"
+#define CMD_IF_C_ONLY "%if-c-only"
+#define CMD_IF_C_OR_CPP "%if-c-or-c++"
+#define CMD_NOT_FOR_HEADER "%not-for-header"
+#define CMD_OK_FOR_HEADER "%ok-for-header"
+#define CMD_PUSH "%push"
+#define CMD_POP "%pop"
+#define CMD_IF_REENTRANT "%if-reentrant"
+#define CMD_IF_NOT_REENTRANT "%if-not-reentrant"
+#define CMD_IF_BISON_BRIDGE "%if-bison-bridge"
+#define CMD_IF_NOT_BISON_BRIDGE "%if-not-bison-bridge"
+#define CMD_ENDIF "%endif"
+
+/* we allow the skeleton to push and pop. */
+struct sko_state {
+ bool dc; /**< do_copy */
+};
+static struct sko_state *sko_stack=0;
+static int sko_len=0,sko_sz=0;
+static void sko_push(bool dc)
+{
+ if(!sko_stack){
+ sko_sz = 1;
+ sko_stack = (struct sko_state*)flex_alloc(sizeof(struct sko_state)*sko_sz);
+ if (!sko_stack)
+ flexfatal(_("allocation of sko_stack failed"));
+ sko_len = 0;
+ }
+ if(sko_len >= sko_sz){
+ sko_sz *= 2;
+ sko_stack = (struct sko_state*)flex_realloc(sko_stack,sizeof(struct sko_state)*sko_sz);
+ }
+
+ /* initialize to zero and push */
+ sko_stack[sko_len].dc = dc;
+ sko_len++;
+}
+static void sko_peek(bool *dc)
+{
+ if(sko_len <= 0)
+ flex_die("peek attempt when sko stack is empty");
+ if(dc)
+ *dc = sko_stack[sko_len-1].dc;
+}
+static void sko_pop(bool* dc)
+{
+ sko_peek(dc);
+ sko_len--;
+ if(sko_len < 0)
+ flex_die("popped too many times in skeleton.");
+}
+
+/* Append "#define defname value\n" to the running buffer. */
+void action_define (defname, value)
+ const char *defname;
+ int value;
+{
+ char buf[MAXLINE];
+ char *cpy;
+
+ if ((int) strlen (defname) > MAXLINE / 2) {
+ format_pinpoint_message (_
+ ("name \"%s\" ridiculously long"),
+ defname);
+ return;
+ }
+
+ snprintf (buf, sizeof(buf), "#define %s %d\n", defname, value);
+ add_action (buf);
+
+ /* track #defines so we can undef them when we're done. */
+ cpy = copy_string (defname);
+ buf_append (&defs_buf, &cpy, 1);
+}
+
+
+#ifdef notdef
+/** Append "m4_define([[defname]],[[value]])m4_dnl\n" to the running buffer.
+ * @param defname The macro name.
+ * @param value The macro value, can be NULL, which is the same as the empty string.
+ */
+static void action_m4_define (const char *defname, const char * value)
+{
+ char buf[MAXLINE];
+
+ flexfatal ("DO NOT USE THIS FUNCTION!");
+
+ if ((int) strlen (defname) > MAXLINE / 2) {
+ format_pinpoint_message (_
+ ("name \"%s\" ridiculously long"),
+ defname);
+ return;
+ }
+
+ snprintf (buf, sizeof(buf), "m4_define([[%s]],[[%s]])m4_dnl\n", defname, value?value:"");
+ add_action (buf);
+}
+#endif
+
+/* Append "new_text" to the running buffer. */
+void add_action (new_text)
+ const char *new_text;
+{
+ int len = strlen (new_text);
+
+ while (len + action_index >= action_size - 10 /* slop */ ) {
+ int new_size = action_size * 2;
+
+ if (new_size <= 0)
+ /* Increase just a little, to try to avoid overflow
+ * on 16-bit machines.
+ */
+ action_size += action_size / 8;
+ else
+ action_size = new_size;
+
+ action_array =
+ reallocate_character_array (action_array,
+ action_size);
+ }
+
+ strcpy (&action_array[action_index], new_text);
+
+ action_index += len;
+}
+
+
+/* allocate_array - allocate memory for an integer array of the given size */
+
+void *allocate_array (size, element_size)
+ int size;
+ size_t element_size;
+{
+ void *mem;
+ size_t num_bytes = element_size * size;
+
+ mem = flex_alloc (num_bytes);
+ if (!mem)
+ flexfatal (_
+ ("memory allocation failed in allocate_array()"));
+
+ return mem;
+}
+
+
+/* all_lower - true if a string is all lower-case */
+
+int all_lower (str)
+ char *str;
+{
+ while (*str) {
+ if (!isascii ((Char) * str) || !islower ((Char) * str))
+ return 0;
+ ++str;
+ }
+
+ return 1;
+}
+
+
+/* all_upper - true if a string is all upper-case */
+
+int all_upper (str)
+ char *str;
+{
+ while (*str) {
+ if (!isascii ((Char) * str) || !isupper ((Char) * str))
+ return 0;
+ ++str;
+ }
+
+ return 1;
+}
+
+
+/* intcmp - compares two integers for use by qsort. */
+
+int intcmp (const void *a, const void *b)
+{
+ return *(const int *) a - *(const int *) b;
+}
+
+
+/* check_char - checks a character to make sure it's within the range
+ * we're expecting. If not, generates fatal error message
+ * and exits.
+ */
+
+void check_char (c)
+ int c;
+{
+ if (c >= CSIZE)
+ lerr (_("bad character '%s' detected in check_char()"),
+ readable_form (c));
+
+ if (c >= csize)
+ lerr (_
+ ("scanner requires -8 flag to use the character %s"),
+ readable_form (c));
+}
+
+
+
+/* clower - replace upper-case letter to lower-case */
+
+Char clower (c)
+ int c;
+{
+ return (Char) ((isascii (c) && isupper (c)) ? tolower (c) : c);
+}
+
+
+/* copy_string - returns a dynamically allocated copy of a string */
+
+char *copy_string (str)
+ const char *str;
+{
+ const char *c1;
+ char *c2;
+ char *copy;
+ unsigned int size;
+
+ /* find length */
+ for (c1 = str; *c1; ++c1) ;
+
+ size = (c1 - str + 1) * sizeof (char);
+
+ copy = (char *) flex_alloc (size);
+
+ if (copy == NULL)
+ flexfatal (_("dynamic memory failure in copy_string()"));
+
+ for (c2 = copy; (*c2++ = *str++) != 0;) ;
+
+ return copy;
+}
+
+
+/* copy_unsigned_string -
+ * returns a dynamically allocated copy of a (potentially) unsigned string
+ */
+
+Char *copy_unsigned_string (str)
+ Char *str;
+{
+ Char *c;
+ Char *copy;
+
+ /* find length */
+ for (c = str; *c; ++c) ;
+
+ copy = allocate_Character_array (c - str + 1);
+
+ for (c = copy; (*c++ = *str++) != 0;) ;
+
+ return copy;
+}
+
+
+/* cclcmp - compares two characters for use by qsort with '\0' sorting last. */
+
+int cclcmp (const void *a, const void *b)
+{
+ if (!*(const Char *) a)
+ return 1;
+ else
+ if (!*(const Char *) b)
+ return - 1;
+ else
+ return *(const Char *) a - *(const Char *) b;
+}
+
+
+/* dataend - finish up a block of data declarations */
+
+void dataend ()
+{
+ /* short circuit any output */
+ if (gentables) {
+
+ if (datapos > 0)
+ dataflush ();
+
+ /* add terminator for initialization; { for vi */
+ outn (" } ;\n");
+ }
+ dataline = 0;
+ datapos = 0;
+}
+
+
+/* dataflush - flush generated data statements */
+
+void dataflush ()
+{
+ /* short circuit any output */
+ if (!gentables)
+ return;
+
+ outc ('\n');
+
+ if (++dataline >= NUMDATALINES) {
+ /* Put out a blank line so that the table is grouped into
+ * large blocks that enable the user to find elements easily.
+ */
+ outc ('\n');
+ dataline = 0;
+ }
+
+ /* Reset the number of characters written on the current line. */
+ datapos = 0;
+}
+
+
+/* flexerror - report an error message and terminate */
+
+void flexerror (msg)
+ const char *msg;
+{
+ fprintf (stderr, "%s: %s\n", program_name, msg);
+ flexend (1);
+}
+
+
+/* flexfatal - report a fatal error message and terminate */
+
+void flexfatal (msg)
+ const char *msg;
+{
+ fprintf (stderr, _("%s: fatal internal error, %s\n"),
+ program_name, msg);
+ FLEX_EXIT (1);
+}
+
+
+/* htoi - convert a hexadecimal digit string to an integer value */
+
+int htoi (str)
+ Char str[];
+{
+ unsigned int result;
+
+ (void) sscanf ((char *) str, "%x", &result);
+
+ return result;
+}
+
+
+/* lerr - report an error message */
+
+void lerr (const char *msg, ...) {
+ char errmsg[MAXLINE];
+ va_list args;
+
+ va_start(args, msg);
+ vsnprintf (errmsg, sizeof(errmsg), msg, args);
+ va_end(args);
+ flexerror (errmsg);
+}
+
+
+/* lerr_fatal - as lerr, but call flexfatal */
+
+void lerr_fatal (const char *msg, ...)
+{
+ char errmsg[MAXLINE];
+ va_list args;
+ va_start(args, msg);
+
+ vsnprintf (errmsg, sizeof(errmsg), msg, args);
+ va_end(args);
+ flexfatal (errmsg);
+}
+
+
+/* line_directive_out - spit out a "#line" statement */
+
+void line_directive_out (output_file, do_infile)
+ FILE *output_file;
+ int do_infile;
+{
+ char directive[MAXLINE], filename[MAXLINE];
+ char *s1, *s2, *s3;
+ static const char *line_fmt = "#line %d \"%s\"\n";
+
+ if (!gen_line_dirs)
+ return;
+
+ s1 = do_infile ? infilename : "M4_YY_OUTFILE_NAME";
+
+ if (do_infile && !s1)
+ s1 = "<stdin>";
+
+ s2 = filename;
+ s3 = &filename[sizeof (filename) - 2];
+
+ while (s2 < s3 && *s1) {
+ if (*s1 == '\\')
+ /* Escape the '\' */
+ *s2++ = '\\';
+
+ *s2++ = *s1++;
+ }
+
+ *s2 = '\0';
+
+ if (do_infile)
+ snprintf (directive, sizeof(directive), line_fmt, linenum, filename);
+ else {
+ snprintf (directive, sizeof(directive), line_fmt, 0, filename);
+ }
+
+ /* If output_file is nil then we should put the directive in
+ * the accumulated actions.
+ */
+ if (output_file) {
+ fputs (directive, output_file);
+ }
+ else
+ add_action (directive);
+}
+
+
+/* mark_defs1 - mark the current position in the action array as
+ * representing where the user's section 1 definitions end
+ * and the prolog begins
+ */
+void mark_defs1 ()
+{
+ defs1_offset = 0;
+ action_array[action_index++] = '\0';
+ action_offset = prolog_offset = action_index;
+ action_array[action_index] = '\0';
+}
+
+
+/* mark_prolog - mark the current position in the action array as
+ * representing the end of the action prolog
+ */
+void mark_prolog ()
+{
+ action_array[action_index++] = '\0';
+ action_offset = action_index;
+ action_array[action_index] = '\0';
+}
+
+
+/* mk2data - generate a data statement for a two-dimensional array
+ *
+ * Generates a data statement initializing the current 2-D array to "value".
+ */
+void mk2data (value)
+ int value;
+{
+ /* short circuit any output */
+ if (!gentables)
+ return;
+
+ if (datapos >= NUMDATAITEMS) {
+ outc (',');
+ dataflush ();
+ }
+
+ if (datapos == 0)
+ /* Indent. */
+ out (" ");
+
+ else
+ outc (',');
+
+ ++datapos;
+
+ out_dec ("%5d", value);
+}
+
+
+/* mkdata - generate a data statement
+ *
+ * Generates a data statement initializing the current array element to
+ * "value".
+ */
+void mkdata (value)
+ int value;
+{
+ /* short circuit any output */
+ if (!gentables)
+ return;
+
+ if (datapos >= NUMDATAITEMS) {
+ outc (',');
+ dataflush ();
+ }
+
+ if (datapos == 0)
+ /* Indent. */
+ out (" ");
+ else
+ outc (',');
+
+ ++datapos;
+
+ out_dec ("%5d", value);
+}
+
+
+/* myctoi - return the integer represented by a string of digits */
+
+int myctoi (array)
+ const char *array;
+{
+ int val = 0;
+
+ (void) sscanf (array, "%d", &val);
+
+ return val;
+}
+
+
+/* myesc - return character corresponding to escape sequence */
+
+Char myesc (array)
+ Char array[];
+{
+ Char c, esc_char;
+
+ switch (array[1]) {
+ case 'b':
+ return '\b';
+ case 'f':
+ return '\f';
+ case 'n':
+ return '\n';
+ case 'r':
+ return '\r';
+ case 't':
+ return '\t';
+
+#if defined (__STDC__)
+ case 'a':
+ return '\a';
+ case 'v':
+ return '\v';
+#else
+ case 'a':
+ return '\007';
+ case 'v':
+ return '\013';
+#endif
+
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ { /* \<octal> */
+ int sptr = 1;
+
+ while (isascii (array[sptr]) &&
+ isdigit (array[sptr]))
+ /* Don't increment inside loop control
+ * because if isdigit() is a macro it might
+ * expand into multiple increments ...
+ */
+ ++sptr;
+
+ c = array[sptr];
+ array[sptr] = '\0';
+
+ esc_char = otoi (array + 1);
+
+ array[sptr] = c;
+
+ return esc_char;
+ }
+
+ case 'x':
+ { /* \x<hex> */
+ int sptr = 2;
+
+ while (isascii (array[sptr]) &&
+ isxdigit (array[sptr]))
+ /* Don't increment inside loop control
+ * because if isdigit() is a macro it might
+ * expand into multiple increments ...
+ */
+ ++sptr;
+
+ c = array[sptr];
+ array[sptr] = '\0';
+
+ esc_char = htoi (array + 2);
+
+ array[sptr] = c;
+
+ return esc_char;
+ }
+
+ default:
+ return array[1];
+ }
+}
+
+
+/* otoi - convert an octal digit string to an integer value */
+
+int otoi (str)
+ Char str[];
+{
+ unsigned int result;
+
+ (void) sscanf ((char *) str, "%o", &result);
+ return result;
+}
+
+
+/* out - various flavors of outputing a (possibly formatted) string for the
+ * generated scanner, keeping track of the line count.
+ */
+
+void out (str)
+ const char *str;
+{
+ fputs (str, stdout);
+}
+
+void out_dec (fmt, n)
+ const char *fmt;
+ int n;
+{
+ fprintf (stdout, fmt, n);
+}
+
+void out_dec2 (fmt, n1, n2)
+ const char *fmt;
+ int n1, n2;
+{
+ fprintf (stdout, fmt, n1, n2);
+}
+
+void out_hex (fmt, x)
+ const char *fmt;
+ unsigned int x;
+{
+ fprintf (stdout, fmt, x);
+}
+
+void out_str (fmt, str)
+ const char *fmt, str[];
+{
+ fprintf (stdout,fmt, str);
+}
+
+void out_str3 (fmt, s1, s2, s3)
+ const char *fmt, s1[], s2[], s3[];
+{
+ fprintf (stdout,fmt, s1, s2, s3);
+}
+
+void out_str_dec (fmt, str, n)
+ const char *fmt, str[];
+ int n;
+{
+ fprintf (stdout,fmt, str, n);
+}
+
+void outc (c)
+ int c;
+{
+ fputc (c, stdout);
+}
+
+void outn (str)
+ const char *str;
+{
+ fputs (str,stdout);
+ fputc('\n',stdout);
+}
+
+/** Print "m4_define( [[def]], [[val]])m4_dnl\n".
+ * @param def The m4 symbol to define.
+ * @param val The definition; may be NULL.
+ */
+void out_m4_define (const char* def, const char* val)
+{
+ const char * fmt = "m4_define( [[%s]], [[%s]])m4_dnl\n";
+ fprintf(stdout, fmt, def, val?val:"");
+}
+
+
+/* readable_form - return the the human-readable form of a character
+ *
+ * The returned string is in static storage.
+ */
+
+char *readable_form (c)
+ int c;
+{
+ static char rform[20];
+
+ if ((c >= 0 && c < 32) || c >= 127) {
+ switch (c) {
+ case '\b':
+ return "\\b";
+ case '\f':
+ return "\\f";
+ case '\n':
+ return "\\n";
+ case '\r':
+ return "\\r";
+ case '\t':
+ return "\\t";
+
+#if defined (__STDC__)
+ case '\a':
+ return "\\a";
+ case '\v':
+ return "\\v";
+#endif
+
+ default:
+ if(trace_hex)
+ snprintf (rform, sizeof(rform), "\\x%.2x", (unsigned int) c);
+ else
+ snprintf (rform, sizeof(rform), "\\%.3o", (unsigned int) c);
+ return rform;
+ }
+ }
+
+ else if (c == ' ')
+ return "' '";
+
+ else {
+ rform[0] = c;
+ rform[1] = '\0';
+
+ return rform;
+ }
+}
+
+
+/* reallocate_array - increase the size of a dynamic array */
+
+void *reallocate_array (array, size, element_size)
+ void *array;
+ int size;
+ size_t element_size;
+{
+ void *new_array;
+ size_t num_bytes = element_size * size;
+
+ new_array = flex_realloc (array, num_bytes);
+ if (!new_array)
+ flexfatal (_("attempt to increase array size failed"));
+
+ return new_array;
+}
+
+
+/* skelout - write out one section of the skeleton file
+ *
+ * Description
+ * Copies skelfile or skel array to stdout until a line beginning with
+ * "%%" or EOF is found.
+ */
+void skelout ()
+{
+ char buf_storage[MAXLINE];
+ char *buf = buf_storage;
+ bool do_copy = true;
+
+ /* "reset" the state by clearing the buffer and pushing a '1' */
+ if(sko_len > 0)
+ sko_peek(&do_copy);
+ sko_len = 0;
+ sko_push(do_copy=true);
+
+
+ /* Loop pulling lines either from the skelfile, if we're using
+ * one, or from the skel[] array.
+ */
+ while (skelfile ?
+ (fgets (buf, MAXLINE, skelfile) != NULL) :
+ ((buf = (char *) skel[skel_ind++]) != 0)) {
+
+ if (skelfile)
+ chomp (buf);
+
+ /* copy from skel array */
+ if (buf[0] == '%') { /* control line */
+ /* print the control line as a comment. */
+ if (ddebug && buf[1] != '#') {
+ if (buf[strlen (buf) - 1] == '\\')
+ out_str ("/* %s */\\\n", buf);
+ else
+ out_str ("/* %s */\n", buf);
+ }
+
+ /* We've been accused of using cryptic markers in the skel.
+ * So we'll use emacs-style-hyphenated-commands.
+ * We might consider a hash if this if-else-if-else
+ * chain gets too large.
+ */
+#define cmd_match(s) (strncmp(buf,(s),strlen(s))==0)
+
+ if (buf[1] == '%') {
+ /* %% is a break point for skelout() */
+ return;
+ }
+ else if (cmd_match (CMD_PUSH)){
+ sko_push(do_copy);
+ if(ddebug){
+ out_str("/*(state = (%s) */",do_copy?"true":"false");
+ }
+ out_str("%s\n", buf[strlen (buf) - 1] =='\\' ? "\\" : "");
+ }
+ else if (cmd_match (CMD_POP)){
+ sko_pop(&do_copy);
+ if(ddebug){
+ out_str("/*(state = (%s) */",do_copy?"true":"false");
+ }
+ out_str("%s\n", buf[strlen (buf) - 1] =='\\' ? "\\" : "");
+ }
+ else if (cmd_match (CMD_IF_REENTRANT)){
+ sko_push(do_copy);
+ do_copy = reentrant && do_copy;
+ }
+ else if (cmd_match (CMD_IF_NOT_REENTRANT)){
+ sko_push(do_copy);
+ do_copy = !reentrant && do_copy;
+ }
+ else if (cmd_match(CMD_IF_BISON_BRIDGE)){
+ sko_push(do_copy);
+ do_copy = bison_bridge_lval && do_copy;
+ }
+ else if (cmd_match(CMD_IF_NOT_BISON_BRIDGE)){
+ sko_push(do_copy);
+ do_copy = !bison_bridge_lval && do_copy;
+ }
+ else if (cmd_match (CMD_ENDIF)){
+ sko_pop(&do_copy);
+ }
+ else if (cmd_match (CMD_IF_TABLES_SER)) {
+ do_copy = do_copy && tablesext;
+ }
+ else if (cmd_match (CMD_TABLES_YYDMAP)) {
+ if (tablesext && yydmap_buf.elts)
+ outn ((char *) (yydmap_buf.elts));
+ }
+ else if (cmd_match (CMD_DEFINE_YYTABLES)) {
+ out_str("#define YYTABLES_NAME \"%s\"\n",
+ tablesname?tablesname:"yytables");
+ }
+ else if (cmd_match (CMD_IF_CPP_ONLY)) {
+ /* only for C++ */
+ sko_push(do_copy);
+ do_copy = C_plus_plus;
+ }
+ else if (cmd_match (CMD_IF_C_ONLY)) {
+ /* %- only for C */
+ sko_push(do_copy);
+ do_copy = !C_plus_plus;
+ }
+ else if (cmd_match (CMD_IF_C_OR_CPP)) {
+ /* %* for C and C++ */
+ sko_push(do_copy);
+ do_copy = true;
+ }
+ else if (cmd_match (CMD_NOT_FOR_HEADER)) {
+ /* %c begin linkage-only (non-header) code. */
+ OUT_BEGIN_CODE ();
+ }
+ else if (cmd_match (CMD_OK_FOR_HEADER)) {
+ /* %e end linkage-only code. */
+ OUT_END_CODE ();
+ }
+ else if (buf[1] == '#') {
+ /* %# a comment in the skel. ignore. */
+ }
+ else {
+ flexfatal (_("bad line in skeleton file"));
+ }
+ }
+
+ else if (do_copy)
+ outn (buf);
+ } /* end while */
+}
+
+
+/* transition_struct_out - output a yy_trans_info structure
+ *
+ * outputs the yy_trans_info structure with the two elements, element_v and
+ * element_n. Formats the output with spaces and carriage returns.
+ */
+
+void transition_struct_out (element_v, element_n)
+ int element_v, element_n;
+{
+
+ /* short circuit any output */
+ if (!gentables)
+ return;
+
+ out_dec2 (" {%4d,%4d },", element_v, element_n);
+
+ datapos += TRANS_STRUCT_PRINT_LENGTH;
+
+ if (datapos >= 79 - TRANS_STRUCT_PRINT_LENGTH) {
+ outc ('\n');
+
+ if (++dataline % 10 == 0)
+ outc ('\n');
+
+ datapos = 0;
+ }
+}
+
+
+/* The following is only needed when building flex's parser using certain
+ * broken versions of bison.
+ */
+void *yy_flex_xmalloc (size)
+ int size;
+{
+ void *result = flex_alloc ((size_t) size);
+
+ if (!result)
+ flexfatal (_
+ ("memory allocation failed in yy_flex_xmalloc()"));
+
+ return result;
+}
+
+
+/* zero_out - set a region of memory to 0
+ *
+ * Sets region_ptr[0] through region_ptr[size_in_bytes - 1] to zero.
+ */
+
+void zero_out (region_ptr, size_in_bytes)
+ char *region_ptr;
+ size_t size_in_bytes;
+{
+ char *rp, *rp_end;
+
+ rp = region_ptr;
+ rp_end = region_ptr + size_in_bytes;
+
+ while (rp < rp_end)
+ *rp++ = 0;
+}
+
+/* Remove all '\n' and '\r' characters, if any, from the end of str.
+ * str can be any null-terminated string, or NULL.
+ * returns str. */
+char *chomp (str)
+ char *str;
+{
+ char *p = str;
+
+ if (!str || !*str) /* s is null or empty string */
+ return str;
+
+ /* find end of string minus one */
+ while (*p)
+ ++p;
+ --p;
+
+ /* eat newlines */
+ while (p >= str && (*p == '\r' || *p == '\n'))
+ *p-- = 0;
+ return str;
+}
diff --git a/src/mkskel.sh b/src/mkskel.sh
new file mode 100755
index 0000000..02c397a
--- /dev/null
+++ b/src/mkskel.sh
@@ -0,0 +1,37 @@
+#! /bin/sh
+
+# This file is part of flex.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+
+# Neither the name of the University nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE.
+
+cat <<!
+/* File created from flex.skl via mkskel.sh */
+
+#include "flexdef.h"
+
+const char *skel[] = {
+!
+
+sed 's/\\/&&/g' | sed 's/"/\\"/g' | sed 's/.*/ "&",/'
+
+cat <<!
+ 0
+};
+!
diff --git a/src/nfa.c b/src/nfa.c
new file mode 100644
index 0000000..ee06578
--- /dev/null
+++ b/src/nfa.c
@@ -0,0 +1,719 @@
+/* nfa - NFA construction routines */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+
+
+/* declare functions that have forward references */
+
+int dupmachine PROTO ((int));
+void mkxtion PROTO ((int, int));
+
+
+/* add_accept - add an accepting state to a machine
+ *
+ * accepting_number becomes mach's accepting number.
+ */
+
+void add_accept (mach, accepting_number)
+ int mach, accepting_number;
+{
+ /* Hang the accepting number off an epsilon state. if it is associated
+ * with a state that has a non-epsilon out-transition, then the state
+ * will accept BEFORE it makes that transition, i.e., one character
+ * too soon.
+ */
+
+ if (transchar[finalst[mach]] == SYM_EPSILON)
+ accptnum[finalst[mach]] = accepting_number;
+
+ else {
+ int astate = mkstate (SYM_EPSILON);
+
+ accptnum[astate] = accepting_number;
+ (void) link_machines (mach, astate);
+ }
+}
+
+
+/* copysingl - make a given number of copies of a singleton machine
+ *
+ * synopsis
+ *
+ * newsng = copysingl( singl, num );
+ *
+ * newsng - a new singleton composed of num copies of singl
+ * singl - a singleton machine
+ * num - the number of copies of singl to be present in newsng
+ */
+
+int copysingl (singl, num)
+ int singl, num;
+{
+ int copy, i;
+
+ copy = mkstate (SYM_EPSILON);
+
+ for (i = 1; i <= num; ++i)
+ copy = link_machines (copy, dupmachine (singl));
+
+ return copy;
+}
+
+
+/* dumpnfa - debugging routine to write out an nfa */
+
+void dumpnfa (state1)
+ int state1;
+
+{
+ int sym, tsp1, tsp2, anum, ns;
+
+ fprintf (stderr,
+ _
+ ("\n\n********** beginning dump of nfa with start state %d\n"),
+ state1);
+
+ /* We probably should loop starting at firstst[state1] and going to
+ * lastst[state1], but they're not maintained properly when we "or"
+ * all of the rules together. So we use our knowledge that the machine
+ * starts at state 1 and ends at lastnfa.
+ */
+
+ /* for ( ns = firstst[state1]; ns <= lastst[state1]; ++ns ) */
+ for (ns = 1; ns <= lastnfa; ++ns) {
+ fprintf (stderr, _("state # %4d\t"), ns);
+
+ sym = transchar[ns];
+ tsp1 = trans1[ns];
+ tsp2 = trans2[ns];
+ anum = accptnum[ns];
+
+ fprintf (stderr, "%3d: %4d, %4d", sym, tsp1, tsp2);
+
+ if (anum != NIL)
+ fprintf (stderr, " [%d]", anum);
+
+ fprintf (stderr, "\n");
+ }
+
+ fprintf (stderr, _("********** end of dump\n"));
+}
+
+
+/* dupmachine - make a duplicate of a given machine
+ *
+ * synopsis
+ *
+ * copy = dupmachine( mach );
+ *
+ * copy - holds duplicate of mach
+ * mach - machine to be duplicated
+ *
+ * note that the copy of mach is NOT an exact duplicate; rather, all the
+ * transition states values are adjusted so that the copy is self-contained,
+ * as the original should have been.
+ *
+ * also note that the original MUST be contiguous, with its low and high
+ * states accessible by the arrays firstst and lastst
+ */
+
+int dupmachine (mach)
+ int mach;
+{
+ int i, init, state_offset;
+ int state = 0;
+ int last = lastst[mach];
+
+ for (i = firstst[mach]; i <= last; ++i) {
+ state = mkstate (transchar[i]);
+
+ if (trans1[i] != NO_TRANSITION) {
+ mkxtion (finalst[state], trans1[i] + state - i);
+
+ if (transchar[i] == SYM_EPSILON &&
+ trans2[i] != NO_TRANSITION)
+ mkxtion (finalst[state],
+ trans2[i] + state - i);
+ }
+
+ accptnum[state] = accptnum[i];
+ }
+
+ if (state == 0)
+ flexfatal (_("empty machine in dupmachine()"));
+
+ state_offset = state - i + 1;
+
+ init = mach + state_offset;
+ firstst[init] = firstst[mach] + state_offset;
+ finalst[init] = finalst[mach] + state_offset;
+ lastst[init] = lastst[mach] + state_offset;
+
+ return init;
+}
+
+
+/* finish_rule - finish up the processing for a rule
+ *
+ * An accepting number is added to the given machine. If variable_trail_rule
+ * is true then the rule has trailing context and both the head and trail
+ * are variable size. Otherwise if headcnt or trailcnt is non-zero then
+ * the machine recognizes a pattern with trailing context and headcnt is
+ * the number of characters in the matched part of the pattern, or zero
+ * if the matched part has variable length. trailcnt is the number of
+ * trailing context characters in the pattern, or zero if the trailing
+ * context has variable length.
+ */
+
+void finish_rule (mach, variable_trail_rule, headcnt, trailcnt,
+ pcont_act)
+ int mach, variable_trail_rule, headcnt, trailcnt, pcont_act;
+{
+ char action_text[MAXLINE];
+
+ add_accept (mach, num_rules);
+
+ /* We did this in new_rule(), but it often gets the wrong
+ * number because we do it before we start parsing the current rule.
+ */
+ rule_linenum[num_rules] = linenum;
+
+ /* If this is a continued action, then the line-number has already
+ * been updated, giving us the wrong number.
+ */
+ if (continued_action)
+ --rule_linenum[num_rules];
+
+
+ /* If the previous rule was continued action, then we inherit the
+ * previous newline flag, possibly overriding the current one.
+ */
+ if (pcont_act && rule_has_nl[num_rules - 1])
+ rule_has_nl[num_rules] = true;
+
+ snprintf (action_text, sizeof(action_text), "case %d:\n", num_rules);
+ add_action (action_text);
+ if (rule_has_nl[num_rules]) {
+ snprintf (action_text, sizeof(action_text), "/* rule %d can match eol */\n",
+ num_rules);
+ add_action (action_text);
+ }
+
+
+ if (variable_trail_rule) {
+ rule_type[num_rules] = RULE_VARIABLE;
+
+ if (performance_report > 0)
+ fprintf (stderr,
+ _
+ ("Variable trailing context rule at line %d\n"),
+ rule_linenum[num_rules]);
+
+ variable_trailing_context_rules = true;
+ }
+
+ else {
+ rule_type[num_rules] = RULE_NORMAL;
+
+ if (headcnt > 0 || trailcnt > 0) {
+ /* Do trailing context magic to not match the trailing
+ * characters.
+ */
+ char *scanner_cp = "YY_G(yy_c_buf_p) = yy_cp";
+ char *scanner_bp = "yy_bp";
+
+ add_action
+ ("*yy_cp = YY_G(yy_hold_char); /* undo effects of setting up yytext */\n");
+
+ if (headcnt > 0) {
+ if (rule_has_nl[num_rules]) {
+ snprintf (action_text, sizeof(action_text),
+ "YY_LINENO_REWIND_TO(%s + %d);\n", scanner_bp, headcnt);
+ add_action (action_text);
+ }
+ snprintf (action_text, sizeof(action_text), "%s = %s + %d;\n",
+ scanner_cp, scanner_bp, headcnt);
+ add_action (action_text);
+ }
+
+ else {
+ if (rule_has_nl[num_rules]) {
+ snprintf (action_text, sizeof(action_text),
+ "YY_LINENO_REWIND_TO(yy_cp - %d);\n", trailcnt);
+ add_action (action_text);
+ }
+
+ snprintf (action_text, sizeof(action_text), "%s -= %d;\n",
+ scanner_cp, trailcnt);
+ add_action (action_text);
+ }
+
+ add_action
+ ("YY_DO_BEFORE_ACTION; /* set up yytext again */\n");
+ }
+ }
+
+ /* Okay, in the action code at this point yytext and yyleng have
+ * their proper final values for this rule, so here's the point
+ * to do any user action. But don't do it for continued actions,
+ * as that'll result in multiple YY_RULE_SETUP's.
+ */
+ if (!continued_action)
+ add_action ("YY_RULE_SETUP\n");
+
+ line_directive_out ((FILE *) 0, 1);
+}
+
+
+/* link_machines - connect two machines together
+ *
+ * synopsis
+ *
+ * new = link_machines( first, last );
+ *
+ * new - a machine constructed by connecting first to last
+ * first - the machine whose successor is to be last
+ * last - the machine whose predecessor is to be first
+ *
+ * note: this routine concatenates the machine first with the machine
+ * last to produce a machine new which will pattern-match first first
+ * and then last, and will fail if either of the sub-patterns fails.
+ * FIRST is set to new by the operation. last is unmolested.
+ */
+
+int link_machines (first, last)
+ int first, last;
+{
+ if (first == NIL)
+ return last;
+
+ else if (last == NIL)
+ return first;
+
+ else {
+ mkxtion (finalst[first], last);
+ finalst[first] = finalst[last];
+ lastst[first] = MAX (lastst[first], lastst[last]);
+ firstst[first] = MIN (firstst[first], firstst[last]);
+
+ return first;
+ }
+}
+
+
+/* mark_beginning_as_normal - mark each "beginning" state in a machine
+ * as being a "normal" (i.e., not trailing context-
+ * associated) states
+ *
+ * The "beginning" states are the epsilon closure of the first state
+ */
+
+void mark_beginning_as_normal (mach)
+ int mach;
+{
+ switch (state_type[mach]) {
+ case STATE_NORMAL:
+ /* Oh, we've already visited here. */
+ return;
+
+ case STATE_TRAILING_CONTEXT:
+ state_type[mach] = STATE_NORMAL;
+
+ if (transchar[mach] == SYM_EPSILON) {
+ if (trans1[mach] != NO_TRANSITION)
+ mark_beginning_as_normal (trans1[mach]);
+
+ if (trans2[mach] != NO_TRANSITION)
+ mark_beginning_as_normal (trans2[mach]);
+ }
+ break;
+
+ default:
+ flexerror (_
+ ("bad state type in mark_beginning_as_normal()"));
+ break;
+ }
+}
+
+
+/* mkbranch - make a machine that branches to two machines
+ *
+ * synopsis
+ *
+ * branch = mkbranch( first, second );
+ *
+ * branch - a machine which matches either first's pattern or second's
+ * first, second - machines whose patterns are to be or'ed (the | operator)
+ *
+ * Note that first and second are NEITHER destroyed by the operation. Also,
+ * the resulting machine CANNOT be used with any other "mk" operation except
+ * more mkbranch's. Compare with mkor()
+ */
+
+int mkbranch (first, second)
+ int first, second;
+{
+ int eps;
+
+ if (first == NO_TRANSITION)
+ return second;
+
+ else if (second == NO_TRANSITION)
+ return first;
+
+ eps = mkstate (SYM_EPSILON);
+
+ mkxtion (eps, first);
+ mkxtion (eps, second);
+
+ return eps;
+}
+
+
+/* mkclos - convert a machine into a closure
+ *
+ * synopsis
+ * new = mkclos( state );
+ *
+ * new - a new state which matches the closure of "state"
+ */
+
+int mkclos (state)
+ int state;
+{
+ return mkopt (mkposcl (state));
+}
+
+
+/* mkopt - make a machine optional
+ *
+ * synopsis
+ *
+ * new = mkopt( mach );
+ *
+ * new - a machine which optionally matches whatever mach matched
+ * mach - the machine to make optional
+ *
+ * notes:
+ * 1. mach must be the last machine created
+ * 2. mach is destroyed by the call
+ */
+
+int mkopt (mach)
+ int mach;
+{
+ int eps;
+
+ if (!SUPER_FREE_EPSILON (finalst[mach])) {
+ eps = mkstate (SYM_EPSILON);
+ mach = link_machines (mach, eps);
+ }
+
+ /* Can't skimp on the following if FREE_EPSILON(mach) is true because
+ * some state interior to "mach" might point back to the beginning
+ * for a closure.
+ */
+ eps = mkstate (SYM_EPSILON);
+ mach = link_machines (eps, mach);
+
+ mkxtion (mach, finalst[mach]);
+
+ return mach;
+}
+
+
+/* mkor - make a machine that matches either one of two machines
+ *
+ * synopsis
+ *
+ * new = mkor( first, second );
+ *
+ * new - a machine which matches either first's pattern or second's
+ * first, second - machines whose patterns are to be or'ed (the | operator)
+ *
+ * note that first and second are both destroyed by the operation
+ * the code is rather convoluted because an attempt is made to minimize
+ * the number of epsilon states needed
+ */
+
+int mkor (first, second)
+ int first, second;
+{
+ int eps, orend;
+
+ if (first == NIL)
+ return second;
+
+ else if (second == NIL)
+ return first;
+
+ else {
+ /* See comment in mkopt() about why we can't use the first
+ * state of "first" or "second" if they satisfy "FREE_EPSILON".
+ */
+ eps = mkstate (SYM_EPSILON);
+
+ first = link_machines (eps, first);
+
+ mkxtion (first, second);
+
+ if (SUPER_FREE_EPSILON (finalst[first]) &&
+ accptnum[finalst[first]] == NIL) {
+ orend = finalst[first];
+ mkxtion (finalst[second], orend);
+ }
+
+ else if (SUPER_FREE_EPSILON (finalst[second]) &&
+ accptnum[finalst[second]] == NIL) {
+ orend = finalst[second];
+ mkxtion (finalst[first], orend);
+ }
+
+ else {
+ eps = mkstate (SYM_EPSILON);
+
+ first = link_machines (first, eps);
+ orend = finalst[first];
+
+ mkxtion (finalst[second], orend);
+ }
+ }
+
+ finalst[first] = orend;
+ return first;
+}
+
+
+/* mkposcl - convert a machine into a positive closure
+ *
+ * synopsis
+ * new = mkposcl( state );
+ *
+ * new - a machine matching the positive closure of "state"
+ */
+
+int mkposcl (state)
+ int state;
+{
+ int eps;
+
+ if (SUPER_FREE_EPSILON (finalst[state])) {
+ mkxtion (finalst[state], state);
+ return state;
+ }
+
+ else {
+ eps = mkstate (SYM_EPSILON);
+ mkxtion (eps, state);
+ return link_machines (state, eps);
+ }
+}
+
+
+/* mkrep - make a replicated machine
+ *
+ * synopsis
+ * new = mkrep( mach, lb, ub );
+ *
+ * new - a machine that matches whatever "mach" matched from "lb"
+ * number of times to "ub" number of times
+ *
+ * note
+ * if "ub" is INFINITE_REPEAT then "new" matches "lb" or more occurrences of "mach"
+ */
+
+int mkrep (mach, lb, ub)
+ int mach, lb, ub;
+{
+ int base_mach, tail, copy, i;
+
+ base_mach = copysingl (mach, lb - 1);
+
+ if (ub == INFINITE_REPEAT) {
+ copy = dupmachine (mach);
+ mach = link_machines (mach,
+ link_machines (base_mach,
+ mkclos (copy)));
+ }
+
+ else {
+ tail = mkstate (SYM_EPSILON);
+
+ for (i = lb; i < ub; ++i) {
+ copy = dupmachine (mach);
+ tail = mkopt (link_machines (copy, tail));
+ }
+
+ mach =
+ link_machines (mach,
+ link_machines (base_mach, tail));
+ }
+
+ return mach;
+}
+
+
+/* mkstate - create a state with a transition on a given symbol
+ *
+ * synopsis
+ *
+ * state = mkstate( sym );
+ *
+ * state - a new state matching sym
+ * sym - the symbol the new state is to have an out-transition on
+ *
+ * note that this routine makes new states in ascending order through the
+ * state array (and increments LASTNFA accordingly). The routine DUPMACHINE
+ * relies on machines being made in ascending order and that they are
+ * CONTIGUOUS. Change it and you will have to rewrite DUPMACHINE (kludge
+ * that it admittedly is)
+ */
+
+int mkstate (sym)
+ int sym;
+{
+ if (++lastnfa >= current_mns) {
+ if ((current_mns += MNS_INCREMENT) >= maximum_mns)
+ lerr(_
+ ("input rules are too complicated (>= %d NFA states)"),
+current_mns);
+
+ ++num_reallocs;
+
+ firstst = reallocate_integer_array (firstst, current_mns);
+ lastst = reallocate_integer_array (lastst, current_mns);
+ finalst = reallocate_integer_array (finalst, current_mns);
+ transchar =
+ reallocate_integer_array (transchar, current_mns);
+ trans1 = reallocate_integer_array (trans1, current_mns);
+ trans2 = reallocate_integer_array (trans2, current_mns);
+ accptnum =
+ reallocate_integer_array (accptnum, current_mns);
+ assoc_rule =
+ reallocate_integer_array (assoc_rule, current_mns);
+ state_type =
+ reallocate_integer_array (state_type, current_mns);
+ }
+
+ firstst[lastnfa] = lastnfa;
+ finalst[lastnfa] = lastnfa;
+ lastst[lastnfa] = lastnfa;
+ transchar[lastnfa] = sym;
+ trans1[lastnfa] = NO_TRANSITION;
+ trans2[lastnfa] = NO_TRANSITION;
+ accptnum[lastnfa] = NIL;
+ assoc_rule[lastnfa] = num_rules;
+ state_type[lastnfa] = current_state_type;
+
+ /* Fix up equivalence classes base on this transition. Note that any
+ * character which has its own transition gets its own equivalence
+ * class. Thus only characters which are only in character classes
+ * have a chance at being in the same equivalence class. E.g. "a|b"
+ * puts 'a' and 'b' into two different equivalence classes. "[ab]"
+ * puts them in the same equivalence class (barring other differences
+ * elsewhere in the input).
+ */
+
+ if (sym < 0) {
+ /* We don't have to update the equivalence classes since
+ * that was already done when the ccl was created for the
+ * first time.
+ */
+ }
+
+ else if (sym == SYM_EPSILON)
+ ++numeps;
+
+ else {
+ check_char (sym);
+
+ if (useecs)
+ /* Map NUL's to csize. */
+ mkechar (sym ? sym : csize, nextecm, ecgroup);
+ }
+
+ return lastnfa;
+}
+
+
+/* mkxtion - make a transition from one state to another
+ *
+ * synopsis
+ *
+ * mkxtion( statefrom, stateto );
+ *
+ * statefrom - the state from which the transition is to be made
+ * stateto - the state to which the transition is to be made
+ */
+
+void mkxtion (statefrom, stateto)
+ int statefrom, stateto;
+{
+ if (trans1[statefrom] == NO_TRANSITION)
+ trans1[statefrom] = stateto;
+
+ else if ((transchar[statefrom] != SYM_EPSILON) ||
+ (trans2[statefrom] != NO_TRANSITION))
+ flexfatal (_("found too many transitions in mkxtion()"));
+
+ else { /* second out-transition for an epsilon state */
+ ++eps2;
+ trans2[statefrom] = stateto;
+ }
+}
+
+/* new_rule - initialize for a new rule */
+
+void new_rule ()
+{
+ if (++num_rules >= current_max_rules) {
+ ++num_reallocs;
+ current_max_rules += MAX_RULES_INCREMENT;
+ rule_type = reallocate_integer_array (rule_type,
+ current_max_rules);
+ rule_linenum = reallocate_integer_array (rule_linenum,
+ current_max_rules);
+ rule_useful = reallocate_integer_array (rule_useful,
+ current_max_rules);
+ rule_has_nl = reallocate_bool_array (rule_has_nl,
+ current_max_rules);
+ }
+
+ if (num_rules > MAX_RULE)
+ lerr (_("too many rules (> %d)!"), MAX_RULE);
+
+ rule_linenum[num_rules] = linenum;
+ rule_useful[num_rules] = false;
+ rule_has_nl[num_rules] = false;
+}
diff --git a/src/options.c b/src/options.c
new file mode 100644
index 0000000..39d020e
--- /dev/null
+++ b/src/options.c
@@ -0,0 +1,282 @@
+/* flex - tool to generate fast lexical analyzers */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "options.h"
+
+/* Be sure to synchronize these options with those defined in "options.h",
+ * the giant switch() statement in "main.c", and the %option processing in
+ * "scan.l".
+ */
+
+
+/* The command-line options, passed to scanopt_init() */
+optspec_t flexopts[] = {
+
+ {"-7", OPT_7BIT, 0}
+ ,
+ {"--7bit", OPT_7BIT, 0}
+ , /* Generate 7-bit scanner. */
+ {"-8", OPT_8BIT, 0}
+ ,
+ {"--8bit", OPT_8BIT, 0}
+ , /* Generate 8-bit scanner. */
+ {"--align", OPT_ALIGN, 0}
+ , /* Trade off larger tables for better memory alignment. */
+ {"--noalign", OPT_NO_ALIGN, 0}
+ ,
+ {"--always-interactive", OPT_ALWAYS_INTERACTIVE, 0}
+ ,
+ {"--array", OPT_ARRAY, 0}
+ ,
+ {"-b", OPT_BACKUP, 0}
+ ,
+ {"--backup", OPT_BACKUP, 0}
+ , /* Generate backing-up information to lex.backup. */
+ {"-B", OPT_BATCH, 0}
+ ,
+ {"--batch", OPT_BATCH, 0}
+ , /* Generate batch scanner (opposite of -I). */
+ {"--bison-bridge", OPT_BISON_BRIDGE, 0}
+ , /* Scanner to be called by a bison pure parser. */
+ {"--bison-locations", OPT_BISON_BRIDGE_LOCATIONS, 0}
+ , /* Scanner to be called by a bison pure parser. */
+ {"-i", OPT_CASE_INSENSITIVE, 0}
+ ,
+ {"--case-insensitive", OPT_CASE_INSENSITIVE, 0}
+ , /* Generate case-insensitive scanner. */
+
+ {"-C[aefFmr]", OPT_COMPRESSION,
+ "Specify degree of table compression (default is -Cem)"},
+ {"-+", OPT_CPLUSPLUS, 0}
+ ,
+ {"--c++", OPT_CPLUSPLUS, 0}
+ , /* Generate C++ scanner class. */
+ {"-d", OPT_DEBUG, 0}
+ ,
+ {"--debug", OPT_DEBUG, 0}
+ , /* Turn on debug mode in generated scanner. */
+ {"--nodebug", OPT_NO_DEBUG, 0}
+ ,
+ {"-s", OPT_NO_DEFAULT, 0}
+ ,
+ {"--nodefault", OPT_NO_DEFAULT, 0}
+ , /* Suppress default rule to ECHO unmatched text. */
+ {"--default", OPT_DEFAULT, 0}
+ ,
+ {"-c", OPT_DONOTHING, 0}
+ , /* For POSIX lex compatibility. */
+ {"-n", OPT_DONOTHING, 0}
+ , /* For POSIX lex compatibility. */
+ {"--ecs", OPT_ECS, 0}
+ , /* Construct equivalence classes. */
+ {"--noecs", OPT_NO_ECS, 0}
+ ,
+ {"-F", OPT_FAST, 0}
+ ,
+ {"--fast", OPT_FAST, 0}
+ , /* Same as -CFr. */
+ {"-f", OPT_FULL, 0}
+ ,
+ {"--full", OPT_FULL, 0}
+ , /* Same as -Cfr. */
+ {"--header-file[=FILE]", OPT_HEADER_FILE, 0}
+ ,
+ {"-?", OPT_HELP, 0}
+ ,
+ {"-h", OPT_HELP, 0}
+ ,
+ {"--help", OPT_HELP, 0}
+ , /* Produce this help message. */
+ {"--hex", OPT_HEX, 0}
+ , /* Use hexadecimals in debug/trace outputs */
+ {"-I", OPT_INTERACTIVE, 0}
+ ,
+ {"--interactive", OPT_INTERACTIVE, 0}
+ , /* Generate interactive scanner (opposite of -B). */
+ {"-l", OPT_LEX_COMPAT, 0}
+ ,
+ {"--lex-compat", OPT_LEX_COMPAT, 0}
+ , /* Maximal compatibility with original lex. */
+ {"-X", OPT_POSIX_COMPAT, 0}
+ ,
+ {"--posix-compat", OPT_POSIX_COMPAT, 0}
+ , /* Maximal compatibility with POSIX lex. */
+ {"--preproc=NUM", OPT_PREPROC_LEVEL, 0}
+ ,
+ {"-L", OPT_NO_LINE, 0}
+ , /* Suppress #line directives in scanner. */
+ {"--noline", OPT_NO_LINE, 0}
+ , /* Suppress #line directives in scanner. */
+ {"--main", OPT_MAIN, 0}
+ , /* use built-in main() function. */
+ {"--nomain", OPT_NO_MAIN, 0}
+ ,
+ {"--meta-ecs", OPT_META_ECS, 0}
+ , /* Construct meta-equivalence classes. */
+ {"--nometa-ecs", OPT_NO_META_ECS, 0}
+ ,
+ {"--never-interactive", OPT_NEVER_INTERACTIVE, 0}
+ ,
+ {"-o FILE", OPT_OUTFILE, 0}
+ ,
+ {"--outfile=FILE", OPT_OUTFILE, 0}
+ , /* Write to FILE (default is lex.yy.c) */
+ {"-p", OPT_PERF_REPORT, 0}
+ ,
+ {"--perf-report", OPT_PERF_REPORT, 0}
+ , /* Generate performance report to stderr. */
+ {"--pointer", OPT_POINTER, 0}
+ ,
+ {"-P PREFIX", OPT_PREFIX, 0}
+ ,
+ {"--prefix=PREFIX", OPT_PREFIX, 0}
+ , /* Use PREFIX (default is yy) */
+ {"-Dmacro", OPT_PREPROCDEFINE, 0}
+ , /* Define a preprocessor symbol. */
+ {"--read", OPT_READ, 0}
+ , /* Use read(2) instead of stdio. */
+ {"-R", OPT_REENTRANT, 0}
+ ,
+ {"--reentrant", OPT_REENTRANT, 0}
+ , /* Generate a reentrant C scanner. */
+ {"--noreentrant", OPT_NO_REENTRANT, 0}
+ ,
+ {"--reject", OPT_REJECT, 0}
+ ,
+ {"--noreject", OPT_NO_REJECT, 0}
+ ,
+ {"-S FILE", OPT_SKEL, 0}
+ ,
+ {"--skel=FILE", OPT_SKEL, 0}
+ , /* Use skeleton from FILE */
+ {"--stack", OPT_STACK, 0}
+ ,
+ {"--stdinit", OPT_STDINIT, 0}
+ ,
+ {"--nostdinit", OPT_NO_STDINIT, 0}
+ ,
+ {"-t", OPT_STDOUT, 0}
+ ,
+ {"--stdout", OPT_STDOUT, 0}
+ , /* Write generated scanner to stdout. */
+ {"-T", OPT_TRACE, 0}
+ ,
+ {"--trace", OPT_TRACE, 0}
+ , /* Flex should run in trace mode. */
+ {"--tables-file[=FILE]", OPT_TABLES_FILE, 0}
+ , /* Save tables to FILE */
+ {"--tables-verify", OPT_TABLES_VERIFY, 0}
+ , /* Tables integrity check */
+ {"--nounistd", OPT_NO_UNISTD_H, 0}
+ , /* Do not include unistd.h */
+ {"-v", OPT_VERBOSE, 0}
+ ,
+ {"--verbose", OPT_VERBOSE, 0}
+ , /* Write summary of scanner statistics to stdout. */
+ {"-V", OPT_VERSION, 0}
+ ,
+ {"--version", OPT_VERSION, 0}
+ , /* Report flex version. */
+ {"--warn", OPT_WARN, 0}
+ ,
+ {"-w", OPT_NO_WARN, 0}
+ ,
+ {"--nowarn", OPT_NO_WARN, 0}
+ , /* Suppress warning messages. */
+ {"--noansi-definitions", OPT_NO_ANSI_FUNC_DEFS, 0}
+ ,
+ {"--noansi-prototypes", OPT_NO_ANSI_FUNC_PROTOS, 0}
+ ,
+ {"--yyclass=NAME", OPT_YYCLASS, 0}
+ ,
+ {"--yylineno", OPT_YYLINENO, 0}
+ ,
+ {"--noyylineno", OPT_NO_YYLINENO, 0}
+ ,
+
+ {"--yymore", OPT_YYMORE, 0}
+ ,
+ {"--noyymore", OPT_NO_YYMORE, 0}
+ ,
+ {"--noyywrap", OPT_NO_YYWRAP, 0}
+ ,
+ {"--yywrap", OPT_YYWRAP, 0}
+ ,
+
+ {"--nounput", OPT_NO_UNPUT, 0}
+ ,
+ {"--noyy_push_state", OPT_NO_YY_PUSH_STATE, 0}
+ ,
+ {"--noyy_pop_state", OPT_NO_YY_POP_STATE, 0}
+ ,
+ {"--noyy_top_state", OPT_NO_YY_TOP_STATE, 0}
+ ,
+ {"--noyy_scan_buffer", OPT_NO_YY_SCAN_BUFFER, 0}
+ ,
+ {"--noyy_scan_bytes", OPT_NO_YY_SCAN_BYTES, 0}
+ ,
+ {"--noyy_scan_string", OPT_NO_YY_SCAN_STRING, 0}
+ ,
+ {"--noyyget_extra", OPT_NO_YYGET_EXTRA, 0}
+ ,
+ {"--noyyset_extra", OPT_NO_YYSET_EXTRA, 0}
+ ,
+ {"--noyyget_leng", OPT_NO_YYGET_LENG, 0}
+ ,
+ {"--noyyget_text", OPT_NO_YYGET_TEXT, 0}
+ ,
+ {"--noyyget_lineno", OPT_NO_YYGET_LINENO, 0}
+ ,
+ {"--noyyset_lineno", OPT_NO_YYSET_LINENO, 0}
+ ,
+ {"--noyyget_in", OPT_NO_YYGET_IN, 0}
+ ,
+ {"--noyyset_in", OPT_NO_YYSET_IN, 0}
+ ,
+ {"--noyyget_out", OPT_NO_YYGET_OUT, 0}
+ ,
+ {"--noyyset_out", OPT_NO_YYSET_OUT, 0}
+ ,
+ {"--noyyget_lval", OPT_NO_YYGET_LVAL, 0}
+ ,
+ {"--noyyset_lval", OPT_NO_YYSET_LVAL, 0}
+ ,
+ {"--noyyget_lloc", OPT_NO_YYGET_LLOC, 0}
+ ,
+ {"--noyyset_lloc", OPT_NO_YYSET_LLOC, 0}
+ ,
+
+ {0, 0, 0} /* required final NULL entry. */
+};
+
+/* vim:set tabstop=8 softtabstop=4 shiftwidth=4: */
diff --git a/src/options.h b/src/options.h
new file mode 100644
index 0000000..ac3391c
--- /dev/null
+++ b/src/options.h
@@ -0,0 +1,135 @@
+/* flex - tool to generate fast lexical analyzers */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#ifndef OPTIONS_H
+#define OPTIONS_H
+#include "scanopt.h"
+
+extern optspec_t flexopts[];
+
+enum flexopt_flag_t {
+ /* Use positive integers only, since they are return codes for scanopt.
+ * Order is not important. */
+ OPT_7BIT = 1,
+ OPT_8BIT,
+ OPT_ALIGN,
+ OPT_ALWAYS_INTERACTIVE,
+ OPT_ARRAY,
+ OPT_BACKUP,
+ OPT_BATCH,
+ OPT_BISON_BRIDGE,
+ OPT_BISON_BRIDGE_LOCATIONS,
+ OPT_CASE_INSENSITIVE,
+ OPT_COMPRESSION,
+ OPT_CPLUSPLUS,
+ OPT_DEBUG,
+ OPT_DEFAULT,
+ OPT_DONOTHING,
+ OPT_ECS,
+ OPT_FAST,
+ OPT_FULL,
+ OPT_HEADER_FILE,
+ OPT_HELP,
+ OPT_HEX,
+ OPT_INTERACTIVE,
+ OPT_LEX_COMPAT,
+ OPT_POSIX_COMPAT,
+ OPT_MAIN,
+ OPT_META_ECS,
+ OPT_NEVER_INTERACTIVE,
+ OPT_NO_ALIGN,
+ OPT_NO_ANSI_FUNC_DEFS,
+ OPT_NO_ANSI_FUNC_PROTOS,
+ OPT_NO_DEBUG,
+ OPT_NO_DEFAULT,
+ OPT_NO_ECS,
+ OPT_NO_LINE,
+ OPT_NO_MAIN,
+ OPT_NO_META_ECS,
+ OPT_NO_REENTRANT,
+ OPT_NO_REJECT,
+ OPT_NO_STDINIT,
+ OPT_NO_UNPUT,
+ OPT_NO_WARN,
+ OPT_NO_YYGET_EXTRA,
+ OPT_NO_YYGET_IN,
+ OPT_NO_YYGET_LENG,
+ OPT_NO_YYGET_LINENO,
+ OPT_NO_YYGET_LLOC,
+ OPT_NO_YYGET_LVAL,
+ OPT_NO_YYGET_OUT,
+ OPT_NO_YYGET_TEXT,
+ OPT_NO_YYLINENO,
+ OPT_NO_YYMORE,
+ OPT_NO_YYSET_EXTRA,
+ OPT_NO_YYSET_IN,
+ OPT_NO_YYSET_LINENO,
+ OPT_NO_YYSET_LLOC,
+ OPT_NO_YYSET_LVAL,
+ OPT_NO_YYSET_OUT,
+ OPT_NO_YYWRAP,
+ OPT_NO_YY_POP_STATE,
+ OPT_NO_YY_PUSH_STATE,
+ OPT_NO_YY_SCAN_BUFFER,
+ OPT_NO_YY_SCAN_BYTES,
+ OPT_NO_YY_SCAN_STRING,
+ OPT_NO_YY_TOP_STATE,
+ OPT_OUTFILE,
+ OPT_PERF_REPORT,
+ OPT_POINTER,
+ OPT_PREFIX,
+ OPT_PREPROCDEFINE,
+ OPT_PREPROC_LEVEL,
+ OPT_READ,
+ OPT_REENTRANT,
+ OPT_REJECT,
+ OPT_SKEL,
+ OPT_STACK,
+ OPT_STDINIT,
+ OPT_STDOUT,
+ OPT_TABLES_FILE,
+ OPT_TABLES_VERIFY,
+ OPT_TRACE,
+ OPT_NO_UNISTD_H,
+ OPT_VERBOSE,
+ OPT_VERSION,
+ OPT_WARN,
+ OPT_YYCLASS,
+ OPT_YYLINENO,
+ OPT_YYMORE,
+ OPT_YYWRAP
+};
+
+#endif
+
+/* vim:set tabstop=8 softtabstop=4 shiftwidth=4 textwidth=0: */
diff --git a/src/parse.c b/src/parse.c
new file mode 100644
index 0000000..a7e3af0
--- /dev/null
+++ b/src/parse.c
@@ -0,0 +1,2953 @@
+/* A Bison parser, made by GNU Bison 3.0.4. */
+
+/* Bison implementation for Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+ simplifying the original so-called "semantic" parser. */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+/* Identify Bison output. */
+#define YYBISON 1
+
+/* Bison version. */
+#define YYBISON_VERSION "3.0.4"
+
+/* Skeleton name. */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers. */
+#define YYPURE 0
+
+/* Push parsers. */
+#define YYPUSH 0
+
+/* Pull parsers. */
+#define YYPULL 1
+
+
+
+
+/* Copy the first part of user declarations. */
+#line 34 "parse.y" /* yacc.c:339 */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+#include "tables.h"
+
+int pat, scnum, eps, headcnt, trailcnt, lastchar, i, rulelen;
+int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule;
+
+int *scon_stk;
+int scon_stk_ptr;
+
+static int madeany = false; /* whether we've made the '.' character class */
+static int ccldot, cclany;
+int previous_continued_action; /* whether the previous rule's action was '|' */
+
+#define format_warn3(fmt, a1, a2) \
+ do{ \
+ char fw3_msg[MAXLINE];\
+ snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\
+ warn( fw3_msg );\
+ }while(0)
+
+/* Expand a POSIX character class expression. */
+#define CCL_EXPR(func) \
+ do{ \
+ int c; \
+ for ( c = 0; c < csize; ++c ) \
+ if ( isascii(c) && func(c) ) \
+ ccladd( currccl, c ); \
+ }while(0)
+
+/* negated class */
+#define CCL_NEG_EXPR(func) \
+ do{ \
+ int c; \
+ for ( c = 0; c < csize; ++c ) \
+ if ( !func(c) ) \
+ ccladd( currccl, c ); \
+ }while(0)
+
+/* While POSIX defines isblank(), it's not ANSI C. */
+#define IS_BLANK(c) ((c) == ' ' || (c) == '\t')
+
+/* On some over-ambitious machines, such as DEC Alpha's, the default
+ * token type is "long" instead of "int"; this leads to problems with
+ * declaring yylval in flexdef.h. But so far, all the yacc's I've seen
+ * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the
+ * following should ensure that the default token type is "int".
+ */
+#define YYSTYPE int
+
+
+#line 149 "parse.c" /* yacc.c:339 */
+
+# ifndef YY_NULLPTR
+# if defined __cplusplus && 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+# endif
+
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* In a future release of Bison, this section will be replaced
+ by #include "y.tab.h". */
+#ifndef YY_YY_PARSE_H_INCLUDED
+# define YY_YY_PARSE_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
+#endif
+
+/* Token type. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ enum yytokentype
+ {
+ CHAR = 258,
+ NUMBER = 259,
+ SECTEND = 260,
+ SCDECL = 261,
+ XSCDECL = 262,
+ NAME = 263,
+ PREVCCL = 264,
+ EOF_OP = 265,
+ OPTION_OP = 266,
+ OPT_OUTFILE = 267,
+ OPT_PREFIX = 268,
+ OPT_YYCLASS = 269,
+ OPT_HEADER = 270,
+ OPT_EXTRA_TYPE = 271,
+ OPT_TABLES = 272,
+ CCE_ALNUM = 273,
+ CCE_ALPHA = 274,
+ CCE_BLANK = 275,
+ CCE_CNTRL = 276,
+ CCE_DIGIT = 277,
+ CCE_GRAPH = 278,
+ CCE_LOWER = 279,
+ CCE_PRINT = 280,
+ CCE_PUNCT = 281,
+ CCE_SPACE = 282,
+ CCE_UPPER = 283,
+ CCE_XDIGIT = 284,
+ CCE_NEG_ALNUM = 285,
+ CCE_NEG_ALPHA = 286,
+ CCE_NEG_BLANK = 287,
+ CCE_NEG_CNTRL = 288,
+ CCE_NEG_DIGIT = 289,
+ CCE_NEG_GRAPH = 290,
+ CCE_NEG_LOWER = 291,
+ CCE_NEG_PRINT = 292,
+ CCE_NEG_PUNCT = 293,
+ CCE_NEG_SPACE = 294,
+ CCE_NEG_UPPER = 295,
+ CCE_NEG_XDIGIT = 296,
+ CCL_OP_DIFF = 297,
+ CCL_OP_UNION = 298,
+ BEGIN_REPEAT_POSIX = 299,
+ END_REPEAT_POSIX = 300,
+ BEGIN_REPEAT_FLEX = 301,
+ END_REPEAT_FLEX = 302
+ };
+#endif
+/* Tokens. */
+#define CHAR 258
+#define NUMBER 259
+#define SECTEND 260
+#define SCDECL 261
+#define XSCDECL 262
+#define NAME 263
+#define PREVCCL 264
+#define EOF_OP 265
+#define OPTION_OP 266
+#define OPT_OUTFILE 267
+#define OPT_PREFIX 268
+#define OPT_YYCLASS 269
+#define OPT_HEADER 270
+#define OPT_EXTRA_TYPE 271
+#define OPT_TABLES 272
+#define CCE_ALNUM 273
+#define CCE_ALPHA 274
+#define CCE_BLANK 275
+#define CCE_CNTRL 276
+#define CCE_DIGIT 277
+#define CCE_GRAPH 278
+#define CCE_LOWER 279
+#define CCE_PRINT 280
+#define CCE_PUNCT 281
+#define CCE_SPACE 282
+#define CCE_UPPER 283
+#define CCE_XDIGIT 284
+#define CCE_NEG_ALNUM 285
+#define CCE_NEG_ALPHA 286
+#define CCE_NEG_BLANK 287
+#define CCE_NEG_CNTRL 288
+#define CCE_NEG_DIGIT 289
+#define CCE_NEG_GRAPH 290
+#define CCE_NEG_LOWER 291
+#define CCE_NEG_PRINT 292
+#define CCE_NEG_PUNCT 293
+#define CCE_NEG_SPACE 294
+#define CCE_NEG_UPPER 295
+#define CCE_NEG_XDIGIT 296
+#define CCL_OP_DIFF 297
+#define CCL_OP_UNION 298
+#define BEGIN_REPEAT_POSIX 299
+#define END_REPEAT_POSIX 300
+#define BEGIN_REPEAT_FLEX 301
+#define END_REPEAT_FLEX 302
+
+/* Value type. */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+
+extern YYSTYPE yylval;
+
+int yyparse (void);
+
+#endif /* !YY_YY_PARSE_H_INCLUDED */
+
+/* Copy the second part of user declarations. */
+
+#line 294 "parse.c" /* yacc.c:358 */
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#else
+typedef signed char yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+# define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+# define YYSIZE_T size_t
+# elif ! defined YYSIZE_T
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# else
+# define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(Msgid) Msgid
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__ \
+ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
+ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+# define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(E) ((void) (E))
+#else
+# define YYUSE(E) /* empty */
+#endif
+
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# ifdef YYSTACK_USE_ALLOCA
+# if YYSTACK_USE_ALLOCA
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# elif defined __BUILTIN_VA_ARG_INCR
+# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+# elif defined _AIX
+# define YYSTACK_ALLOC __alloca
+# elif defined _MSC_VER
+# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+# define alloca _alloca
+# else
+# define YYSTACK_ALLOC alloca
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# endif
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+# ifndef YYSTACK_ALLOC_MAXIMUM
+ /* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
+# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+# endif
+# else
+# define YYSTACK_ALLOC YYMALLOC
+# define YYSTACK_FREE YYFREE
+# ifndef YYSTACK_ALLOC_MAXIMUM
+# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+# endif
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# endif
+# endif
+# ifndef YYMALLOC
+# define YYMALLOC malloc
+# if ! defined malloc && ! defined EXIT_SUCCESS
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# ifndef YYFREE
+# define YYFREE free
+# if ! defined free && ! defined EXIT_SUCCESS
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+ && (! defined __cplusplus \
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+};
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ + YYSTACK_GAP_MAXIMUM)
+
+# define YYCOPY_NEEDED 1
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
+
+#endif
+
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(Dst, Src, Count) \
+ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+# else
+# define YYCOPY(Dst, Src, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } \
+ while (0)
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 3
+/* YYLAST -- Last index in YYTABLE. */
+#define YYLAST 161
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS 69
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 27
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 97
+/* YYNSTATES -- Number of states. */
+#define YYNSTATES 140
+
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+ by yylex, with out-of-bounds checking. */
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 302
+
+#define YYTRANSLATE(YYX) \
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, without out-of-bounds checking. */
+static const yytype_uint8 yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 49, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 63, 2, 57, 2, 2, 2,
+ 64, 65, 55, 60, 56, 68, 62, 59, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 53, 48, 54, 61, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 66, 2, 67, 52, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 50, 58, 51, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47
+};
+
+#if YYDEBUG
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+static const yytype_uint16 yyrline[] =
+{
+ 0, 118, 118, 148, 155, 156, 157, 158, 162, 170,
+ 173, 177, 180, 183, 187, 190, 191, 194, 199, 201,
+ 203, 205, 207, 211, 213, 215, 219, 231, 267, 291,
+ 314, 319, 322, 325, 343, 346, 348, 350, 354, 377,
+ 433, 436, 479, 497, 503, 508, 535, 543, 546, 574,
+ 588, 610, 617, 623, 629, 657, 671, 690, 724, 742,
+ 752, 755, 758, 773, 774, 775, 780, 782, 789, 849,
+ 867, 875, 883, 884, 885, 886, 887, 888, 889, 894,
+ 895, 896, 897, 898, 904, 905, 906, 907, 908, 909,
+ 910, 911, 912, 913, 914, 920, 928, 944
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || 0
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+ "$end", "error", "$undefined", "CHAR", "NUMBER", "SECTEND", "SCDECL",
+ "XSCDECL", "NAME", "PREVCCL", "EOF_OP", "OPTION_OP", "OPT_OUTFILE",
+ "OPT_PREFIX", "OPT_YYCLASS", "OPT_HEADER", "OPT_EXTRA_TYPE",
+ "OPT_TABLES", "CCE_ALNUM", "CCE_ALPHA", "CCE_BLANK", "CCE_CNTRL",
+ "CCE_DIGIT", "CCE_GRAPH", "CCE_LOWER", "CCE_PRINT", "CCE_PUNCT",
+ "CCE_SPACE", "CCE_UPPER", "CCE_XDIGIT", "CCE_NEG_ALNUM", "CCE_NEG_ALPHA",
+ "CCE_NEG_BLANK", "CCE_NEG_CNTRL", "CCE_NEG_DIGIT", "CCE_NEG_GRAPH",
+ "CCE_NEG_LOWER", "CCE_NEG_PRINT", "CCE_NEG_PUNCT", "CCE_NEG_SPACE",
+ "CCE_NEG_UPPER", "CCE_NEG_XDIGIT", "CCL_OP_DIFF", "CCL_OP_UNION",
+ "BEGIN_REPEAT_POSIX", "END_REPEAT_POSIX", "BEGIN_REPEAT_FLEX",
+ "END_REPEAT_FLEX", "'='", "'\\n'", "'{'", "'}'", "'^'", "'<'", "'>'",
+ "'*'", "','", "'$'", "'|'", "'/'", "'+'", "'?'", "'.'", "'\"'", "'('",
+ "')'", "'['", "']'", "'-'", "$accept", "goal", "initlex", "sect1",
+ "sect1end", "startconddecl", "namelist1", "options", "optionlist",
+ "option", "sect2", "initforrule", "flexrule", "scon_stk_ptr", "scon",
+ "namelist2", "sconname", "rule", "re", "re2", "series", "singleton",
+ "fullccl", "braceccl", "ccl", "ccl_expr", "string", YY_NULLPTR
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
+static const yytype_uint16 yytoknum[] =
+{
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
+ 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
+ 295, 296, 297, 298, 299, 300, 301, 302, 61, 10,
+ 123, 125, 94, 60, 62, 42, 44, 36, 124, 47,
+ 43, 63, 46, 34, 40, 41, 91, 93, 45
+};
+# endif
+
+#define YYPACT_NINF -52
+
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-52)))
+
+#define YYTABLE_NINF -27
+
+#define yytable_value_is_error(Yytable_value) \
+ 0
+
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+static const yytype_int16 yypact[] =
+{
+ -52, 17, 103, -52, -52, 113, -52, -52, -52, -52,
+ -52, 48, -52, 114, 6, -52, -52, 42, 7, 12,
+ 58, 77, 88, 89, -52, 43, -52, 73, -52, 130,
+ 131, 132, 133, 134, 135, 90, 91, -52, -1, -52,
+ -52, -52, -52, -52, -52, -52, -52, -52, 40, -52,
+ 44, -52, -52, -52, -52, 39, -52, -52, 39, 93,
+ 97, -52, -12, 39, 49, 61, -31, -52, -52, 139,
+ -52, -52, 1, -51, -52, 0, -52, -52, 39, -52,
+ 75, 144, 61, 145, -52, -52, -52, 84, 84, -52,
+ -52, -52, -52, 50, 83, -52, -52, -52, -52, -52,
+ -52, -52, -52, -52, -52, -52, -52, -52, -52, -52,
+ -52, -52, -52, -52, -52, -52, -52, -52, -52, -52,
+ -52, 49, -52, -40, 10, -52, -52, -52, 149, -52,
+ 9, -52, -3, -52, 108, -52, 107, -52, -52, -52
+};
+
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] =
+{
+ 3, 0, 0, 1, 7, 0, 8, 9, 10, 16,
+ 25, 0, 5, 14, 34, 13, 12, 4, 0, 0,
+ 0, 0, 0, 0, 15, 31, 2, 26, 11, 0,
+ 0, 0, 0, 0, 0, 0, 0, 25, 0, 17,
+ 19, 20, 21, 18, 22, 33, 37, 38, 0, 36,
+ 34, 30, 62, 59, 29, 0, 57, 97, 0, 71,
+ 0, 28, 42, 0, 44, 47, 58, 65, 32, 0,
+ 24, 27, 0, 0, 71, 0, 23, 41, 0, 45,
+ 39, 0, 46, 0, 51, 52, 53, 0, 0, 35,
+ 96, 60, 61, 0, 69, 72, 73, 74, 75, 76,
+ 77, 78, 79, 80, 81, 83, 82, 84, 85, 86,
+ 87, 88, 89, 94, 90, 91, 92, 95, 93, 66,
+ 70, 43, 40, 0, 0, 63, 64, 67, 0, 50,
+ 0, 56, 0, 68, 0, 49, 0, 55, 48, 54
+};
+
+ /* YYPGOTO[NTERM-NUM]. */
+static const yytype_int16 yypgoto[] =
+{
+ -52, -52, -52, -52, -52, -52, -52, -52, -52, -52,
+ 118, 129, -52, -52, -52, -52, 92, 102, -48, -52,
+ 80, -21, -52, 47, 85, -52, -52
+};
+
+ /* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int8 yydefgoto[] =
+{
+ -1, 1, 2, 5, 10, 11, 17, 12, 13, 24,
+ 14, 26, 60, 36, 27, 48, 49, 61, 62, 63,
+ 64, 65, 66, 67, 75, 120, 72
+};
+
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
+static const yytype_int16 yytable[] =
+{
+ 51, 136, 52, 94, 90, 129, -26, 78, 53, 54,
+ 73, 87, 88, 134, 92, 80, 130, 3, 95, 96,
+ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
+ 117, 118, 52, 82, 137, 77, 78, 79, 53, 15,
+ 28, 55, 52, 94, 135, 29, 16, 131, 53, 25,
+ 30, 56, 57, 58, 91, 59, 132, 119, 95, 96,
+ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
+ 117, 118, 46, 81, 68, 70, 69, 25, 35, 47,
+ 82, 56, 57, 58, 4, 59, 31, 83, -6, -6,
+ -6, 56, 57, 58, -6, 59, 84, 127, 6, 7,
+ 8, 85, 86, 37, 9, 32, 18, 19, 20, 21,
+ 22, 23, 122, 78, 125, 126, 33, 34, 39, 40,
+ 41, 42, 43, 44, 45, 74, 76, 47, 123, 124,
+ 59, 128, 133, 138, 139, 50, 38, 71, 121, 93,
+ 0, 89
+};
+
+static const yytype_int8 yycheck[] =
+{
+ 1, 4, 3, 3, 3, 45, 0, 58, 9, 10,
+ 58, 42, 43, 4, 65, 63, 56, 0, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 3, 64, 47, 57, 58, 59, 9, 1,
+ 8, 52, 3, 3, 45, 48, 8, 47, 9, 53,
+ 48, 62, 63, 64, 63, 66, 56, 67, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 1, 44, 54, 51, 56, 53, 55, 8,
+ 121, 62, 63, 64, 1, 66, 48, 46, 5, 6,
+ 7, 62, 63, 64, 11, 66, 55, 67, 5, 6,
+ 7, 60, 61, 50, 11, 48, 12, 13, 14, 15,
+ 16, 17, 57, 58, 87, 88, 48, 48, 8, 8,
+ 8, 8, 8, 8, 54, 52, 49, 8, 4, 4,
+ 66, 68, 3, 45, 47, 37, 27, 55, 78, 74,
+ -1, 69
+};
+
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const yytype_uint8 yystos[] =
+{
+ 0, 70, 71, 0, 1, 72, 5, 6, 7, 11,
+ 73, 74, 76, 77, 79, 1, 8, 75, 12, 13,
+ 14, 15, 16, 17, 78, 53, 80, 83, 8, 48,
+ 48, 48, 48, 48, 48, 55, 82, 50, 80, 8,
+ 8, 8, 8, 8, 8, 54, 1, 8, 84, 85,
+ 79, 1, 3, 9, 10, 52, 62, 63, 64, 66,
+ 81, 86, 87, 88, 89, 90, 91, 92, 54, 56,
+ 51, 86, 95, 87, 52, 93, 49, 57, 58, 59,
+ 87, 44, 90, 46, 55, 60, 61, 42, 43, 85,
+ 3, 63, 65, 93, 3, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 67,
+ 94, 89, 57, 4, 4, 92, 92, 67, 68, 45,
+ 56, 47, 56, 3, 4, 45, 4, 47, 45, 47
+};
+
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 69, 70, 71, 72, 72, 72, 72, 73, 74,
+ 74, 75, 75, 75, 76, 77, 77, 78, 78, 78,
+ 78, 78, 78, 79, 79, 79, 80, 81, 81, 81,
+ 81, 82, 83, 83, 83, 84, 84, 84, 85, 86,
+ 86, 86, 86, 87, 87, 88, 89, 89, 89, 89,
+ 89, 90, 90, 90, 90, 90, 90, 90, 90, 90,
+ 90, 90, 90, 91, 91, 91, 92, 92, 93, 93,
+ 93, 93, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 95, 95
+};
+
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 5, 0, 3, 2, 0, 1, 1, 1,
+ 1, 2, 1, 1, 2, 2, 0, 3, 3, 3,
+ 3, 3, 3, 5, 5, 0, 0, 2, 1, 1,
+ 1, 0, 4, 3, 0, 3, 1, 1, 1, 2,
+ 3, 2, 1, 3, 1, 2, 2, 1, 6, 5,
+ 4, 2, 2, 2, 6, 5, 4, 1, 1, 1,
+ 3, 3, 1, 3, 3, 1, 3, 4, 4, 2,
+ 2, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 0
+};
+
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+while (0)
+
+/* Error token number */
+#define YYTERROR 1
+#define YYERRCODE 256
+
+
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
+
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
+
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT. |
+`----------------------------------------*/
+
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+{
+ FILE *yyo = yyoutput;
+ YYUSE (yyo);
+ if (!yyvaluep)
+ return;
+# ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# endif
+ YYUSE (yytype);
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+{
+ YYFPRINTF (yyoutput, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep);
+ YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included). |
+`------------------------------------------------------------------*/
+
+static void
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+{
+ YYFPRINTF (stderr, "Stack now");
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
+ YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+static void
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
+{
+ unsigned long int yylno = yyrline[yyrule];
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+ yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr,
+ yystos[yyssp[yyi + 1 - yynrhs]],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ );
+ YYFPRINTF (stderr, "\n");
+ }
+}
+
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, Rule); \
+} while (0)
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined __GLIBC__ && defined _STRING_H
+# define yystrlen strlen
+# else
+/* Return the length of YYSTR. */
+static YYSIZE_T
+yystrlen (const char *yystr)
+{
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+ continue;
+ return yylen;
+}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+{
+ char *yyd = yydest;
+ const char *yys = yysrc;
+
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ YYSIZE_T yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ if (! yyres)
+ return yystrlen (yystr);
+
+ return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
+
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
+{
+ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = YY_NULLPTR;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
+
+ /* There are many possibilities here to consider:
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
+ {
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ {
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
+ }
+ }
+
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+ }
+
+ {
+ YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
+ }
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
+}
+#endif /* YYERROR_VERBOSE */
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol. |
+`-----------------------------------------------*/
+
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+{
+ YYUSE (yyvaluep);
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YYUSE (yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
+
+
+
+
+/* The lookahead symbol. */
+int yychar;
+
+/* The semantic value of the lookahead symbol. */
+YYSTYPE yylval;
+/* Number of syntax errors so far. */
+int yynerrs;
+
+
+/*----------.
+| yyparse. |
+`----------*/
+
+int
+yyparse (void)
+{
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+
+ /* The stacks and their tools:
+ 'yyss': related to states.
+ 'yyvs': related to semantic values.
+
+ Refer to the stacks through separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
+
+ YYSIZE_T yystacksize;
+
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken = 0;
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
+
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
+ yystacksize = YYINITDEPTH;
+
+ YYDPRINTF ((stderr, "Starting parse\n"));
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+ goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate. |
+`------------------------------------------------------------*/
+ yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. So pushing a state here evens the stacks. */
+ yyssp++;
+
+ yysetstate:
+ *yyssp = yystate;
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+# else
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
+# endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
+
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
+ }
+
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
+ goto yybackup;
+
+/*-----------.
+| yybackup. |
+`-----------*/
+yybackup:
+
+ /* Do appropriate processing given the current state. Read a
+ lookahead token if we need one and don't already have one. */
+
+ /* First try to decide what to do without reference to lookahead token. */
+ yyn = yypact[yystate];
+ if (yypact_value_is_default (yyn))
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+ yychar = yylex ();
+ }
+
+ if (yychar <= YYEOF)
+ {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yytoken = YYTRANSLATE (yychar);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ /* Shift the lookahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
+
+ yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+ goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+yydefault:
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction. |
+`-----------------------------*/
+yyreduce:
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+ '$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
+
+
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 2:
+#line 119 "parse.y" /* yacc.c:1646 */
+ { /* add default rule */
+ int def_rule;
+
+ pat = cclinit();
+ cclnegate( pat );
+
+ def_rule = mkstate( -pat );
+
+ /* Remember the number of the default rule so we
+ * don't generate "can't match" warnings for it.
+ */
+ default_rule = num_rules;
+
+ finish_rule( def_rule, false, 0, 0, 0);
+
+ for ( i = 1; i <= lastsc; ++i )
+ scset[i] = mkbranch( scset[i], def_rule );
+
+ if ( spprdflt )
+ add_action(
+ "YY_FATAL_ERROR( \"flex scanner jammed\" )" );
+ else
+ add_action( "ECHO" );
+
+ add_action( ";\n\tYY_BREAK\n" );
+ }
+#line 1512 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 3:
+#line 148 "parse.y" /* yacc.c:1646 */
+ { /* initialize for processing rules */
+
+ /* Create default DFA start condition. */
+ scinstal( "INITIAL", false );
+ }
+#line 1522 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 7:
+#line 159 "parse.y" /* yacc.c:1646 */
+ { synerr( _("unknown error processing section 1") ); }
+#line 1528 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 8:
+#line 163 "parse.y" /* yacc.c:1646 */
+ {
+ check_options();
+ scon_stk = allocate_integer_array( lastsc + 1 );
+ scon_stk_ptr = 0;
+ }
+#line 1538 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 9:
+#line 171 "parse.y" /* yacc.c:1646 */
+ { xcluflg = false; }
+#line 1544 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 10:
+#line 174 "parse.y" /* yacc.c:1646 */
+ { xcluflg = true; }
+#line 1550 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 11:
+#line 178 "parse.y" /* yacc.c:1646 */
+ { scinstal( nmstr, xcluflg ); }
+#line 1556 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 12:
+#line 181 "parse.y" /* yacc.c:1646 */
+ { scinstal( nmstr, xcluflg ); }
+#line 1562 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 13:
+#line 184 "parse.y" /* yacc.c:1646 */
+ { synerr( _("bad start condition list") ); }
+#line 1568 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 17:
+#line 195 "parse.y" /* yacc.c:1646 */
+ {
+ outfilename = copy_string( nmstr );
+ did_outfilename = 1;
+ }
+#line 1577 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 18:
+#line 200 "parse.y" /* yacc.c:1646 */
+ { extra_type = copy_string( nmstr ); }
+#line 1583 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 19:
+#line 202 "parse.y" /* yacc.c:1646 */
+ { prefix = copy_string( nmstr ); }
+#line 1589 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 20:
+#line 204 "parse.y" /* yacc.c:1646 */
+ { yyclass = copy_string( nmstr ); }
+#line 1595 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 21:
+#line 206 "parse.y" /* yacc.c:1646 */
+ { headerfilename = copy_string( nmstr ); }
+#line 1601 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 22:
+#line 208 "parse.y" /* yacc.c:1646 */
+ { tablesext = true; tablesfilename = copy_string( nmstr ); }
+#line 1607 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 23:
+#line 212 "parse.y" /* yacc.c:1646 */
+ { scon_stk_ptr = (yyvsp[-3]); }
+#line 1613 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 24:
+#line 214 "parse.y" /* yacc.c:1646 */
+ { scon_stk_ptr = (yyvsp[-3]); }
+#line 1619 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 26:
+#line 219 "parse.y" /* yacc.c:1646 */
+ {
+ /* Initialize for a parse of one rule. */
+ trlcontxt = variable_trail_rule = varlength = false;
+ trailcnt = headcnt = rulelen = 0;
+ current_state_type = STATE_NORMAL;
+ previous_continued_action = continued_action;
+ in_rule = true;
+
+ new_rule();
+ }
+#line 1634 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 27:
+#line 232 "parse.y" /* yacc.c:1646 */
+ {
+ pat = (yyvsp[0]);
+ finish_rule( pat, variable_trail_rule,
+ headcnt, trailcnt , previous_continued_action);
+
+ if ( scon_stk_ptr > 0 )
+ {
+ for ( i = 1; i <= scon_stk_ptr; ++i )
+ scbol[scon_stk[i]] =
+ mkbranch( scbol[scon_stk[i]],
+ pat );
+ }
+
+ else
+ {
+ /* Add to all non-exclusive start conditions,
+ * including the default (0) start condition.
+ */
+
+ for ( i = 1; i <= lastsc; ++i )
+ if ( ! scxclu[i] )
+ scbol[i] = mkbranch( scbol[i],
+ pat );
+ }
+
+ if ( ! bol_needed )
+ {
+ bol_needed = true;
+
+ if ( performance_report > 1 )
+ pinpoint_message(
+ "'^' operator results in sub-optimal performance" );
+ }
+ }
+#line 1673 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 28:
+#line 268 "parse.y" /* yacc.c:1646 */
+ {
+ pat = (yyvsp[0]);
+ finish_rule( pat, variable_trail_rule,
+ headcnt, trailcnt , previous_continued_action);
+
+ if ( scon_stk_ptr > 0 )
+ {
+ for ( i = 1; i <= scon_stk_ptr; ++i )
+ scset[scon_stk[i]] =
+ mkbranch( scset[scon_stk[i]],
+ pat );
+ }
+
+ else
+ {
+ for ( i = 1; i <= lastsc; ++i )
+ if ( ! scxclu[i] )
+ scset[i] =
+ mkbranch( scset[i],
+ pat );
+ }
+ }
+#line 1700 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 29:
+#line 292 "parse.y" /* yacc.c:1646 */
+ {
+ if ( scon_stk_ptr > 0 )
+ build_eof_action();
+
+ else
+ {
+ /* This EOF applies to all start conditions
+ * which don't already have EOF actions.
+ */
+ for ( i = 1; i <= lastsc; ++i )
+ if ( ! sceof[i] )
+ scon_stk[++scon_stk_ptr] = i;
+
+ if ( scon_stk_ptr == 0 )
+ warn(
+ "all start conditions already have <<EOF>> rules" );
+
+ else
+ build_eof_action();
+ }
+ }
+#line 1726 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 30:
+#line 315 "parse.y" /* yacc.c:1646 */
+ { synerr( _("unrecognized rule") ); }
+#line 1732 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 31:
+#line 319 "parse.y" /* yacc.c:1646 */
+ { (yyval) = scon_stk_ptr; }
+#line 1738 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 32:
+#line 323 "parse.y" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[-2]); }
+#line 1744 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 33:
+#line 326 "parse.y" /* yacc.c:1646 */
+ {
+ (yyval) = scon_stk_ptr;
+
+ for ( i = 1; i <= lastsc; ++i )
+ {
+ int j;
+
+ for ( j = 1; j <= scon_stk_ptr; ++j )
+ if ( scon_stk[j] == i )
+ break;
+
+ if ( j > scon_stk_ptr )
+ scon_stk[++scon_stk_ptr] = i;
+ }
+ }
+#line 1764 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 34:
+#line 343 "parse.y" /* yacc.c:1646 */
+ { (yyval) = scon_stk_ptr; }
+#line 1770 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 37:
+#line 351 "parse.y" /* yacc.c:1646 */
+ { synerr( _("bad start condition list") ); }
+#line 1776 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 38:
+#line 355 "parse.y" /* yacc.c:1646 */
+ {
+ if ( (scnum = sclookup( nmstr )) == 0 )
+ format_pinpoint_message(
+ "undeclared start condition %s",
+ nmstr );
+ else
+ {
+ for ( i = 1; i <= scon_stk_ptr; ++i )
+ if ( scon_stk[i] == scnum )
+ {
+ format_warn(
+ "<%s> specified twice",
+ scname[scnum] );
+ break;
+ }
+
+ if ( i > scon_stk_ptr )
+ scon_stk[++scon_stk_ptr] = scnum;
+ }
+ }
+#line 1801 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 39:
+#line 378 "parse.y" /* yacc.c:1646 */
+ {
+ if ( transchar[lastst[(yyvsp[0])]] != SYM_EPSILON )
+ /* Provide final transition \now/ so it
+ * will be marked as a trailing context
+ * state.
+ */
+ (yyvsp[0]) = link_machines( (yyvsp[0]),
+ mkstate( SYM_EPSILON ) );
+
+ mark_beginning_as_normal( (yyvsp[0]) );
+ current_state_type = STATE_NORMAL;
+
+ if ( previous_continued_action )
+ {
+ /* We need to treat this as variable trailing
+ * context so that the backup does not happen
+ * in the action but before the action switch
+ * statement. If the backup happens in the
+ * action, then the rules "falling into" this
+ * one's action will *also* do the backup,
+ * erroneously.
+ */
+ if ( ! varlength || headcnt != 0 )
+ warn(
+ "trailing context made variable due to preceding '|' action" );
+
+ /* Mark as variable. */
+ varlength = true;
+ headcnt = 0;
+
+ }
+
+ if ( lex_compat || (varlength && headcnt == 0) )
+ { /* variable trailing context rule */
+ /* Mark the first part of the rule as the
+ * accepting "head" part of a trailing
+ * context rule.
+ *
+ * By the way, we didn't do this at the
+ * beginning of this production because back
+ * then current_state_type was set up for a
+ * trail rule, and add_accept() can create
+ * a new state ...
+ */
+ add_accept( (yyvsp[-1]),
+ num_rules | YY_TRAILING_HEAD_MASK );
+ variable_trail_rule = true;
+ }
+
+ else
+ trailcnt = rulelen;
+
+ (yyval) = link_machines( (yyvsp[-1]), (yyvsp[0]) );
+ }
+#line 1860 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 40:
+#line 434 "parse.y" /* yacc.c:1646 */
+ { synerr( _("trailing context used twice") ); }
+#line 1866 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 41:
+#line 437 "parse.y" /* yacc.c:1646 */
+ {
+ headcnt = 0;
+ trailcnt = 1;
+ rulelen = 1;
+ varlength = false;
+
+ current_state_type = STATE_TRAILING_CONTEXT;
+
+ if ( trlcontxt )
+ {
+ synerr( _("trailing context used twice") );
+ (yyval) = mkstate( SYM_EPSILON );
+ }
+
+ else if ( previous_continued_action )
+ {
+ /* See the comment in the rule for "re2 re"
+ * above.
+ */
+ warn(
+ "trailing context made variable due to preceding '|' action" );
+
+ varlength = true;
+ }
+
+ if ( lex_compat || varlength )
+ {
+ /* Again, see the comment in the rule for
+ * "re2 re" above.
+ */
+ add_accept( (yyvsp[-1]),
+ num_rules | YY_TRAILING_HEAD_MASK );
+ variable_trail_rule = true;
+ }
+
+ trlcontxt = true;
+
+ eps = mkstate( SYM_EPSILON );
+ (yyval) = link_machines( (yyvsp[-1]),
+ link_machines( eps, mkstate( '\n' ) ) );
+ }
+#line 1912 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 42:
+#line 480 "parse.y" /* yacc.c:1646 */
+ {
+ (yyval) = (yyvsp[0]);
+
+ if ( trlcontxt )
+ {
+ if ( lex_compat || (varlength && headcnt == 0) )
+ /* Both head and trail are
+ * variable-length.
+ */
+ variable_trail_rule = true;
+ else
+ trailcnt = rulelen;
+ }
+ }
+#line 1931 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 43:
+#line 498 "parse.y" /* yacc.c:1646 */
+ {
+ varlength = true;
+ (yyval) = mkor( (yyvsp[-2]), (yyvsp[0]) );
+ }
+#line 1940 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 44:
+#line 504 "parse.y" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[0]); }
+#line 1946 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 45:
+#line 509 "parse.y" /* yacc.c:1646 */
+ {
+ /* This rule is written separately so the
+ * reduction will occur before the trailing
+ * series is parsed.
+ */
+
+ if ( trlcontxt )
+ synerr( _("trailing context used twice") );
+ else
+ trlcontxt = true;
+
+ if ( varlength )
+ /* We hope the trailing context is
+ * fixed-length.
+ */
+ varlength = false;
+ else
+ headcnt = rulelen;
+
+ rulelen = 0;
+
+ current_state_type = STATE_TRAILING_CONTEXT;
+ (yyval) = (yyvsp[-1]);
+ }
+#line 1975 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 46:
+#line 536 "parse.y" /* yacc.c:1646 */
+ {
+ /* This is where concatenation of adjacent patterns
+ * gets done.
+ */
+ (yyval) = link_machines( (yyvsp[-1]), (yyvsp[0]) );
+ }
+#line 1986 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 47:
+#line 544 "parse.y" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[0]); }
+#line 1992 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 48:
+#line 547 "parse.y" /* yacc.c:1646 */
+ {
+ varlength = true;
+
+ if ( (yyvsp[-3]) > (yyvsp[-1]) || (yyvsp[-3]) < 0 )
+ {
+ synerr( _("bad iteration values") );
+ (yyval) = (yyvsp[-5]);
+ }
+ else
+ {
+ if ( (yyvsp[-3]) == 0 )
+ {
+ if ( (yyvsp[-1]) <= 0 )
+ {
+ synerr(
+ _("bad iteration values") );
+ (yyval) = (yyvsp[-5]);
+ }
+ else
+ (yyval) = mkopt(
+ mkrep( (yyvsp[-5]), 1, (yyvsp[-1]) ) );
+ }
+ else
+ (yyval) = mkrep( (yyvsp[-5]), (yyvsp[-3]), (yyvsp[-1]) );
+ }
+ }
+#line 2023 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 49:
+#line 575 "parse.y" /* yacc.c:1646 */
+ {
+ varlength = true;
+
+ if ( (yyvsp[-2]) <= 0 )
+ {
+ synerr( _("iteration value must be positive") );
+ (yyval) = (yyvsp[-4]);
+ }
+
+ else
+ (yyval) = mkrep( (yyvsp[-4]), (yyvsp[-2]), INFINITE_REPEAT );
+ }
+#line 2040 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 50:
+#line 589 "parse.y" /* yacc.c:1646 */
+ {
+ /* The series could be something like "(foo)",
+ * in which case we have no idea what its length
+ * is, so we punt here.
+ */
+ varlength = true;
+
+ if ( (yyvsp[-1]) <= 0 )
+ {
+ synerr( _("iteration value must be positive")
+ );
+ (yyval) = (yyvsp[-3]);
+ }
+
+ else
+ (yyval) = link_machines( (yyvsp[-3]),
+ copysingl( (yyvsp[-3]), (yyvsp[-1]) - 1 ) );
+ }
+#line 2063 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 51:
+#line 611 "parse.y" /* yacc.c:1646 */
+ {
+ varlength = true;
+
+ (yyval) = mkclos( (yyvsp[-1]) );
+ }
+#line 2073 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 52:
+#line 618 "parse.y" /* yacc.c:1646 */
+ {
+ varlength = true;
+ (yyval) = mkposcl( (yyvsp[-1]) );
+ }
+#line 2082 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 53:
+#line 624 "parse.y" /* yacc.c:1646 */
+ {
+ varlength = true;
+ (yyval) = mkopt( (yyvsp[-1]) );
+ }
+#line 2091 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 54:
+#line 630 "parse.y" /* yacc.c:1646 */
+ {
+ varlength = true;
+
+ if ( (yyvsp[-3]) > (yyvsp[-1]) || (yyvsp[-3]) < 0 )
+ {
+ synerr( _("bad iteration values") );
+ (yyval) = (yyvsp[-5]);
+ }
+ else
+ {
+ if ( (yyvsp[-3]) == 0 )
+ {
+ if ( (yyvsp[-1]) <= 0 )
+ {
+ synerr(
+ _("bad iteration values") );
+ (yyval) = (yyvsp[-5]);
+ }
+ else
+ (yyval) = mkopt(
+ mkrep( (yyvsp[-5]), 1, (yyvsp[-1]) ) );
+ }
+ else
+ (yyval) = mkrep( (yyvsp[-5]), (yyvsp[-3]), (yyvsp[-1]) );
+ }
+ }
+#line 2122 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 55:
+#line 658 "parse.y" /* yacc.c:1646 */
+ {
+ varlength = true;
+
+ if ( (yyvsp[-2]) <= 0 )
+ {
+ synerr( _("iteration value must be positive") );
+ (yyval) = (yyvsp[-4]);
+ }
+
+ else
+ (yyval) = mkrep( (yyvsp[-4]), (yyvsp[-2]), INFINITE_REPEAT );
+ }
+#line 2139 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 56:
+#line 672 "parse.y" /* yacc.c:1646 */
+ {
+ /* The singleton could be something like "(foo)",
+ * in which case we have no idea what its length
+ * is, so we punt here.
+ */
+ varlength = true;
+
+ if ( (yyvsp[-1]) <= 0 )
+ {
+ synerr( _("iteration value must be positive") );
+ (yyval) = (yyvsp[-3]);
+ }
+
+ else
+ (yyval) = link_machines( (yyvsp[-3]),
+ copysingl( (yyvsp[-3]), (yyvsp[-1]) - 1 ) );
+ }
+#line 2161 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 57:
+#line 691 "parse.y" /* yacc.c:1646 */
+ {
+ if ( ! madeany )
+ {
+ /* Create the '.' character class. */
+ ccldot = cclinit();
+ ccladd( ccldot, '\n' );
+ cclnegate( ccldot );
+
+ if ( useecs )
+ mkeccl( ccltbl + cclmap[ccldot],
+ ccllen[ccldot], nextecm,
+ ecgroup, csize, csize );
+
+ /* Create the (?s:'.') character class. */
+ cclany = cclinit();
+ cclnegate( cclany );
+
+ if ( useecs )
+ mkeccl( ccltbl + cclmap[cclany],
+ ccllen[cclany], nextecm,
+ ecgroup, csize, csize );
+
+ madeany = true;
+ }
+
+ ++rulelen;
+
+ if (sf_dot_all())
+ (yyval) = mkstate( -cclany );
+ else
+ (yyval) = mkstate( -ccldot );
+ }
+#line 2198 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 58:
+#line 725 "parse.y" /* yacc.c:1646 */
+ {
+ /* Sort characters for fast searching.
+ */
+ qsort( ccltbl + cclmap[(yyvsp[0])], ccllen[(yyvsp[0])], sizeof (*ccltbl), cclcmp );
+
+ if ( useecs )
+ mkeccl( ccltbl + cclmap[(yyvsp[0])], ccllen[(yyvsp[0])],
+ nextecm, ecgroup, csize, csize );
+
+ ++rulelen;
+
+ if (ccl_has_nl[(yyvsp[0])])
+ rule_has_nl[num_rules] = true;
+
+ (yyval) = mkstate( -(yyvsp[0]) );
+ }
+#line 2219 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 59:
+#line 743 "parse.y" /* yacc.c:1646 */
+ {
+ ++rulelen;
+
+ if (ccl_has_nl[(yyvsp[0])])
+ rule_has_nl[num_rules] = true;
+
+ (yyval) = mkstate( -(yyvsp[0]) );
+ }
+#line 2232 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 60:
+#line 753 "parse.y" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[-1]); }
+#line 2238 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 61:
+#line 756 "parse.y" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[-1]); }
+#line 2244 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 62:
+#line 759 "parse.y" /* yacc.c:1646 */
+ {
+ ++rulelen;
+
+ if ((yyvsp[0]) == nlch)
+ rule_has_nl[num_rules] = true;
+
+ if (sf_case_ins() && has_case((yyvsp[0])))
+ /* create an alternation, as in (a|A) */
+ (yyval) = mkor (mkstate((yyvsp[0])), mkstate(reverse_case((yyvsp[0]))));
+ else
+ (yyval) = mkstate( (yyvsp[0]) );
+ }
+#line 2261 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 63:
+#line 773 "parse.y" /* yacc.c:1646 */
+ { (yyval) = ccl_set_diff ((yyvsp[-2]), (yyvsp[0])); }
+#line 2267 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 64:
+#line 774 "parse.y" /* yacc.c:1646 */
+ { (yyval) = ccl_set_union ((yyvsp[-2]), (yyvsp[0])); }
+#line 2273 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 66:
+#line 780 "parse.y" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[-1]); }
+#line 2279 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 67:
+#line 783 "parse.y" /* yacc.c:1646 */
+ {
+ cclnegate( (yyvsp[-1]) );
+ (yyval) = (yyvsp[-1]);
+ }
+#line 2288 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 68:
+#line 790 "parse.y" /* yacc.c:1646 */
+ {
+
+ if (sf_case_ins())
+ {
+
+ /* If one end of the range has case and the other
+ * does not, or the cases are different, then we're not
+ * sure what range the user is trying to express.
+ * Examples: [@-z] or [S-t]
+ */
+ if (has_case ((yyvsp[-2])) != has_case ((yyvsp[0]))
+ || (has_case ((yyvsp[-2])) && (b_islower ((yyvsp[-2])) != b_islower ((yyvsp[0]))))
+ || (has_case ((yyvsp[-2])) && (b_isupper ((yyvsp[-2])) != b_isupper ((yyvsp[0])))))
+ format_warn3 (
+ _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
+ (yyvsp[-2]), (yyvsp[0]));
+
+ /* If the range spans uppercase characters but not
+ * lowercase (or vice-versa), then should we automatically
+ * include lowercase characters in the range?
+ * Example: [@-_] spans [a-z] but not [A-Z]
+ */
+ else if (!has_case ((yyvsp[-2])) && !has_case ((yyvsp[0])) && !range_covers_case ((yyvsp[-2]), (yyvsp[0])))
+ format_warn3 (
+ _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
+ (yyvsp[-2]), (yyvsp[0]));
+ }
+
+ if ( (yyvsp[-2]) > (yyvsp[0]) )
+ synerr( _("negative range in character class") );
+
+ else
+ {
+ for ( i = (yyvsp[-2]); i <= (yyvsp[0]); ++i )
+ ccladd( (yyvsp[-3]), i );
+
+ /* Keep track if this ccl is staying in
+ * alphabetical order.
+ */
+ cclsorted = cclsorted && ((yyvsp[-2]) > lastchar);
+ lastchar = (yyvsp[0]);
+
+ /* Do it again for upper/lowercase */
+ if (sf_case_ins() && has_case((yyvsp[-2])) && has_case((yyvsp[0]))){
+ (yyvsp[-2]) = reverse_case ((yyvsp[-2]));
+ (yyvsp[0]) = reverse_case ((yyvsp[0]));
+
+ for ( i = (yyvsp[-2]); i <= (yyvsp[0]); ++i )
+ ccladd( (yyvsp[-3]), i );
+
+ cclsorted = cclsorted && ((yyvsp[-2]) > lastchar);
+ lastchar = (yyvsp[0]);
+ }
+
+ }
+
+ (yyval) = (yyvsp[-3]);
+ }
+#line 2351 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 69:
+#line 850 "parse.y" /* yacc.c:1646 */
+ {
+ ccladd( (yyvsp[-1]), (yyvsp[0]) );
+ cclsorted = cclsorted && ((yyvsp[0]) > lastchar);
+ lastchar = (yyvsp[0]);
+
+ /* Do it again for upper/lowercase */
+ if (sf_case_ins() && has_case((yyvsp[0]))){
+ (yyvsp[0]) = reverse_case ((yyvsp[0]));
+ ccladd ((yyvsp[-1]), (yyvsp[0]));
+
+ cclsorted = cclsorted && ((yyvsp[0]) > lastchar);
+ lastchar = (yyvsp[0]);
+ }
+
+ (yyval) = (yyvsp[-1]);
+ }
+#line 2372 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 70:
+#line 868 "parse.y" /* yacc.c:1646 */
+ {
+ /* Too hard to properly maintain cclsorted. */
+ cclsorted = false;
+ (yyval) = (yyvsp[-1]);
+ }
+#line 2382 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 71:
+#line 875 "parse.y" /* yacc.c:1646 */
+ {
+ cclsorted = true;
+ lastchar = 0;
+ currccl = (yyval) = cclinit();
+ }
+#line 2392 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 72:
+#line 883 "parse.y" /* yacc.c:1646 */
+ { CCL_EXPR(isalnum); }
+#line 2398 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 73:
+#line 884 "parse.y" /* yacc.c:1646 */
+ { CCL_EXPR(isalpha); }
+#line 2404 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 74:
+#line 885 "parse.y" /* yacc.c:1646 */
+ { CCL_EXPR(IS_BLANK); }
+#line 2410 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 75:
+#line 886 "parse.y" /* yacc.c:1646 */
+ { CCL_EXPR(iscntrl); }
+#line 2416 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 76:
+#line 887 "parse.y" /* yacc.c:1646 */
+ { CCL_EXPR(isdigit); }
+#line 2422 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 77:
+#line 888 "parse.y" /* yacc.c:1646 */
+ { CCL_EXPR(isgraph); }
+#line 2428 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 78:
+#line 889 "parse.y" /* yacc.c:1646 */
+ {
+ CCL_EXPR(islower);
+ if (sf_case_ins())
+ CCL_EXPR(isupper);
+ }
+#line 2438 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 79:
+#line 894 "parse.y" /* yacc.c:1646 */
+ { CCL_EXPR(isprint); }
+#line 2444 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 80:
+#line 895 "parse.y" /* yacc.c:1646 */
+ { CCL_EXPR(ispunct); }
+#line 2450 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 81:
+#line 896 "parse.y" /* yacc.c:1646 */
+ { CCL_EXPR(isspace); }
+#line 2456 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 82:
+#line 897 "parse.y" /* yacc.c:1646 */
+ { CCL_EXPR(isxdigit); }
+#line 2462 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 83:
+#line 898 "parse.y" /* yacc.c:1646 */
+ {
+ CCL_EXPR(isupper);
+ if (sf_case_ins())
+ CCL_EXPR(islower);
+ }
+#line 2472 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 84:
+#line 904 "parse.y" /* yacc.c:1646 */
+ { CCL_NEG_EXPR(isalnum); }
+#line 2478 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 85:
+#line 905 "parse.y" /* yacc.c:1646 */
+ { CCL_NEG_EXPR(isalpha); }
+#line 2484 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 86:
+#line 906 "parse.y" /* yacc.c:1646 */
+ { CCL_NEG_EXPR(IS_BLANK); }
+#line 2490 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 87:
+#line 907 "parse.y" /* yacc.c:1646 */
+ { CCL_NEG_EXPR(iscntrl); }
+#line 2496 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 88:
+#line 908 "parse.y" /* yacc.c:1646 */
+ { CCL_NEG_EXPR(isdigit); }
+#line 2502 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 89:
+#line 909 "parse.y" /* yacc.c:1646 */
+ { CCL_NEG_EXPR(isgraph); }
+#line 2508 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 90:
+#line 910 "parse.y" /* yacc.c:1646 */
+ { CCL_NEG_EXPR(isprint); }
+#line 2514 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 91:
+#line 911 "parse.y" /* yacc.c:1646 */
+ { CCL_NEG_EXPR(ispunct); }
+#line 2520 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 92:
+#line 912 "parse.y" /* yacc.c:1646 */
+ { CCL_NEG_EXPR(isspace); }
+#line 2526 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 93:
+#line 913 "parse.y" /* yacc.c:1646 */
+ { CCL_NEG_EXPR(isxdigit); }
+#line 2532 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 94:
+#line 914 "parse.y" /* yacc.c:1646 */
+ {
+ if ( sf_case_ins() )
+ warn(_("[:^lower:] is ambiguous in case insensitive scanner"));
+ else
+ CCL_NEG_EXPR(islower);
+ }
+#line 2543 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 95:
+#line 920 "parse.y" /* yacc.c:1646 */
+ {
+ if ( sf_case_ins() )
+ warn(_("[:^upper:] ambiguous in case insensitive scanner"));
+ else
+ CCL_NEG_EXPR(isupper);
+ }
+#line 2554 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 96:
+#line 929 "parse.y" /* yacc.c:1646 */
+ {
+ if ( (yyvsp[0]) == nlch )
+ rule_has_nl[num_rules] = true;
+
+ ++rulelen;
+
+ if (sf_case_ins() && has_case((yyvsp[0])))
+ (yyval) = mkor (mkstate((yyvsp[0])), mkstate(reverse_case((yyvsp[0]))));
+ else
+ (yyval) = mkstate ((yyvsp[0]));
+
+ (yyval) = link_machines( (yyvsp[-1]), (yyval));
+ }
+#line 2572 "parse.c" /* yacc.c:1646 */
+ break;
+
+ case 97:
+#line 944 "parse.y" /* yacc.c:1646 */
+ { (yyval) = mkstate( SYM_EPSILON ); }
+#line 2578 "parse.c" /* yacc.c:1646 */
+ break;
+
+
+#line 2582 "parse.c" /* yacc.c:1646 */
+ default: break;
+ }
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+
+ *++yyvsp = yyval;
+
+ /* Now 'shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTOKENS];
+
+ goto yynewstate;
+
+
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
+yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
+#if ! YYERROR_VERBOSE
+ yyerror (YY_("syntax error"));
+#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
+ {
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror (yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
+ }
+# undef YYSYNTAX_ERROR
+#endif
+ }
+
+
+
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
+
+ if (yychar <= YYEOF)
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
+ else
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval);
+ yychar = YYEMPTY;
+ }
+ }
+
+ /* Else will try to reuse lookahead token after shifting the error
+ token. */
+ goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR. |
+`---------------------------------------------------*/
+yyerrorlab:
+
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
+
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+ yystate = *yyssp;
+ goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR. |
+`-------------------------------------------------------------*/
+yyerrlab1:
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (!yypact_value_is_default (yyn))
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
+
+
+ yydestruct ("Error: popping",
+ yystos[yystate], yyvsp);
+ YYPOPSTACK (1);
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+ }
+
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
+yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
+yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+#if !defined yyoverflow || YYERROR_VERBOSE
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here. |
+`-------------------------------------------------*/
+yyexhaustedlab:
+ yyerror (YY_("memory exhausted"));
+ yyresult = 2;
+ /* Fall through. */
+#endif
+
+yyreturn:
+ if (yychar != YYEMPTY)
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval);
+ }
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+ YY_STACK_PRINT (yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+ yystos[*yyssp], yyvsp);
+ YYPOPSTACK (1);
+ }
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+#endif
+ return yyresult;
+}
+#line 947 "parse.y" /* yacc.c:1906 */
+
+
+
+/* build_eof_action - build the "<<EOF>>" action for the active start
+ * conditions
+ */
+
+void build_eof_action()
+ {
+ int i;
+ char action_text[MAXLINE];
+
+ for ( i = 1; i <= scon_stk_ptr; ++i )
+ {
+ if ( sceof[scon_stk[i]] )
+ format_pinpoint_message(
+ "multiple <<EOF>> rules for start condition %s",
+ scname[scon_stk[i]] );
+
+ else
+ {
+ sceof[scon_stk[i]] = true;
+
+ if (previous_continued_action /* && previous action was regular */)
+ add_action("YY_RULE_SETUP\n");
+
+ snprintf( action_text, sizeof(action_text), "case YY_STATE_EOF(%s):\n",
+ scname[scon_stk[i]] );
+ add_action( action_text );
+ }
+ }
+
+ line_directive_out( (FILE *) 0, 1 );
+
+ /* This isn't a normal rule after all - don't count it as
+ * such, so we don't have any holes in the rule numbering
+ * (which make generating "rule can never match" warnings
+ * more difficult.
+ */
+ --num_rules;
+ ++num_eof_rules;
+ }
+
+
+/* format_synerr - write out formatted syntax error */
+
+void format_synerr( msg, arg )
+const char *msg, arg[];
+ {
+ char errmsg[MAXLINE];
+
+ (void) snprintf( errmsg, sizeof(errmsg), msg, arg );
+ synerr( errmsg );
+ }
+
+
+/* synerr - report a syntax error */
+
+void synerr( str )
+const char *str;
+ {
+ syntaxerror = true;
+ pinpoint_message( str );
+ }
+
+
+/* format_warn - write out formatted warning */
+
+void format_warn( msg, arg )
+const char *msg, arg[];
+ {
+ char warn_msg[MAXLINE];
+
+ snprintf( warn_msg, sizeof(warn_msg), msg, arg );
+ warn( warn_msg );
+ }
+
+
+/* warn - report a warning, unless -w was given */
+
+void warn( str )
+const char *str;
+ {
+ line_warning( str, linenum );
+ }
+
+/* format_pinpoint_message - write out a message formatted with one string,
+ * pinpointing its location
+ */
+
+void format_pinpoint_message( msg, arg )
+const char *msg, arg[];
+ {
+ char errmsg[MAXLINE];
+
+ snprintf( errmsg, sizeof(errmsg), msg, arg );
+ pinpoint_message( errmsg );
+ }
+
+
+/* pinpoint_message - write out a message, pinpointing its location */
+
+void pinpoint_message( str )
+const char *str;
+ {
+ line_pinpoint( str, linenum );
+ }
+
+
+/* line_warning - report a warning at a given line, unless -w was given */
+
+void line_warning( str, line )
+const char *str;
+int line;
+ {
+ char warning[MAXLINE];
+
+ if ( ! nowarn )
+ {
+ snprintf( warning, sizeof(warning), "warning, %s", str );
+ line_pinpoint( warning, line );
+ }
+ }
+
+
+/* line_pinpoint - write out a message, pinpointing it at the given line */
+
+void line_pinpoint( str, line )
+const char *str;
+int line;
+ {
+ fprintf( stderr, "%s:%d: %s\n", infilename, line, str );
+ }
+
+
+/* yyerror - eat up an error message from the parser;
+ * currently, messages are ignore
+ */
+
+void yyerror( msg )
+const char *msg;
+ {
+ (void)msg;
+ }
diff --git a/src/parse.h b/src/parse.h
new file mode 100644
index 0000000..033f919
--- /dev/null
+++ b/src/parse.h
@@ -0,0 +1,154 @@
+/* A Bison parser, made by GNU Bison 3.0.4. */
+
+/* Bison interface for Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+#ifndef YY_YY_PARSE_H_INCLUDED
+# define YY_YY_PARSE_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
+#endif
+
+/* Token type. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ enum yytokentype
+ {
+ CHAR = 258,
+ NUMBER = 259,
+ SECTEND = 260,
+ SCDECL = 261,
+ XSCDECL = 262,
+ NAME = 263,
+ PREVCCL = 264,
+ EOF_OP = 265,
+ OPTION_OP = 266,
+ OPT_OUTFILE = 267,
+ OPT_PREFIX = 268,
+ OPT_YYCLASS = 269,
+ OPT_HEADER = 270,
+ OPT_EXTRA_TYPE = 271,
+ OPT_TABLES = 272,
+ CCE_ALNUM = 273,
+ CCE_ALPHA = 274,
+ CCE_BLANK = 275,
+ CCE_CNTRL = 276,
+ CCE_DIGIT = 277,
+ CCE_GRAPH = 278,
+ CCE_LOWER = 279,
+ CCE_PRINT = 280,
+ CCE_PUNCT = 281,
+ CCE_SPACE = 282,
+ CCE_UPPER = 283,
+ CCE_XDIGIT = 284,
+ CCE_NEG_ALNUM = 285,
+ CCE_NEG_ALPHA = 286,
+ CCE_NEG_BLANK = 287,
+ CCE_NEG_CNTRL = 288,
+ CCE_NEG_DIGIT = 289,
+ CCE_NEG_GRAPH = 290,
+ CCE_NEG_LOWER = 291,
+ CCE_NEG_PRINT = 292,
+ CCE_NEG_PUNCT = 293,
+ CCE_NEG_SPACE = 294,
+ CCE_NEG_UPPER = 295,
+ CCE_NEG_XDIGIT = 296,
+ CCL_OP_DIFF = 297,
+ CCL_OP_UNION = 298,
+ BEGIN_REPEAT_POSIX = 299,
+ END_REPEAT_POSIX = 300,
+ BEGIN_REPEAT_FLEX = 301,
+ END_REPEAT_FLEX = 302
+ };
+#endif
+/* Tokens. */
+#define CHAR 258
+#define NUMBER 259
+#define SECTEND 260
+#define SCDECL 261
+#define XSCDECL 262
+#define NAME 263
+#define PREVCCL 264
+#define EOF_OP 265
+#define OPTION_OP 266
+#define OPT_OUTFILE 267
+#define OPT_PREFIX 268
+#define OPT_YYCLASS 269
+#define OPT_HEADER 270
+#define OPT_EXTRA_TYPE 271
+#define OPT_TABLES 272
+#define CCE_ALNUM 273
+#define CCE_ALPHA 274
+#define CCE_BLANK 275
+#define CCE_CNTRL 276
+#define CCE_DIGIT 277
+#define CCE_GRAPH 278
+#define CCE_LOWER 279
+#define CCE_PRINT 280
+#define CCE_PUNCT 281
+#define CCE_SPACE 282
+#define CCE_UPPER 283
+#define CCE_XDIGIT 284
+#define CCE_NEG_ALNUM 285
+#define CCE_NEG_ALPHA 286
+#define CCE_NEG_BLANK 287
+#define CCE_NEG_CNTRL 288
+#define CCE_NEG_DIGIT 289
+#define CCE_NEG_GRAPH 290
+#define CCE_NEG_LOWER 291
+#define CCE_NEG_PRINT 292
+#define CCE_NEG_PUNCT 293
+#define CCE_NEG_SPACE 294
+#define CCE_NEG_UPPER 295
+#define CCE_NEG_XDIGIT 296
+#define CCL_OP_DIFF 297
+#define CCL_OP_UNION 298
+#define BEGIN_REPEAT_POSIX 299
+#define END_REPEAT_POSIX 300
+#define BEGIN_REPEAT_FLEX 301
+#define END_REPEAT_FLEX 302
+
+/* Value type. */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+
+extern YYSTYPE yylval;
+
+int yyparse (void);
+
+#endif /* !YY_YY_PARSE_H_INCLUDED */
diff --git a/src/parse.y b/src/parse.y
new file mode 100644
index 0000000..939cc05
--- /dev/null
+++ b/src/parse.y
@@ -0,0 +1,1090 @@
+/* parse.y - parser for flex input */
+
+%token CHAR NUMBER SECTEND SCDECL XSCDECL NAME PREVCCL EOF_OP
+%token OPTION_OP OPT_OUTFILE OPT_PREFIX OPT_YYCLASS OPT_HEADER OPT_EXTRA_TYPE
+%token OPT_TABLES
+
+%token CCE_ALNUM CCE_ALPHA CCE_BLANK CCE_CNTRL CCE_DIGIT CCE_GRAPH
+%token CCE_LOWER CCE_PRINT CCE_PUNCT CCE_SPACE CCE_UPPER CCE_XDIGIT
+
+%token CCE_NEG_ALNUM CCE_NEG_ALPHA CCE_NEG_BLANK CCE_NEG_CNTRL CCE_NEG_DIGIT CCE_NEG_GRAPH
+%token CCE_NEG_LOWER CCE_NEG_PRINT CCE_NEG_PUNCT CCE_NEG_SPACE CCE_NEG_UPPER CCE_NEG_XDIGIT
+
+%left CCL_OP_DIFF CCL_OP_UNION
+
+/*
+ *POSIX and AT&T lex place the
+ * precedence of the repeat operator, {}, below that of concatenation.
+ * Thus, ab{3} is ababab. Most other POSIX utilities use an Extended
+ * Regular Expression (ERE) precedence that has the repeat operator
+ * higher than concatenation. This causes ab{3} to yield abbb.
+ *
+ * In order to support the POSIX and AT&T precedence and the flex
+ * precedence we define two token sets for the begin and end tokens of
+ * the repeat operator, '{' and '}'. The lexical scanner chooses
+ * which tokens to return based on whether posix_compat or lex_compat
+ * are specified. Specifying either posix_compat or lex_compat will
+ * cause flex to parse scanner files as per the AT&T and
+ * POSIX-mandated behavior.
+ */
+
+%token BEGIN_REPEAT_POSIX END_REPEAT_POSIX BEGIN_REPEAT_FLEX END_REPEAT_FLEX
+
+
+%{
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+#include "tables.h"
+
+int pat, scnum, eps, headcnt, trailcnt, lastchar, i, rulelen;
+int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule;
+
+int *scon_stk;
+int scon_stk_ptr;
+
+static int madeany = false; /* whether we've made the '.' character class */
+static int ccldot, cclany;
+int previous_continued_action; /* whether the previous rule's action was '|' */
+
+#define format_warn3(fmt, a1, a2) \
+ do{ \
+ char fw3_msg[MAXLINE];\
+ snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\
+ warn( fw3_msg );\
+ }while(0)
+
+/* Expand a POSIX character class expression. */
+#define CCL_EXPR(func) \
+ do{ \
+ int c; \
+ for ( c = 0; c < csize; ++c ) \
+ if ( isascii(c) && func(c) ) \
+ ccladd( currccl, c ); \
+ }while(0)
+
+/* negated class */
+#define CCL_NEG_EXPR(func) \
+ do{ \
+ int c; \
+ for ( c = 0; c < csize; ++c ) \
+ if ( !func(c) ) \
+ ccladd( currccl, c ); \
+ }while(0)
+
+/* While POSIX defines isblank(), it's not ANSI C. */
+#define IS_BLANK(c) ((c) == ' ' || (c) == '\t')
+
+/* On some over-ambitious machines, such as DEC Alpha's, the default
+ * token type is "long" instead of "int"; this leads to problems with
+ * declaring yylval in flexdef.h. But so far, all the yacc's I've seen
+ * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the
+ * following should ensure that the default token type is "int".
+ */
+#define YYSTYPE int
+
+%}
+
+%%
+goal : initlex sect1 sect1end sect2 initforrule
+ { /* add default rule */
+ int def_rule;
+
+ pat = cclinit();
+ cclnegate( pat );
+
+ def_rule = mkstate( -pat );
+
+ /* Remember the number of the default rule so we
+ * don't generate "can't match" warnings for it.
+ */
+ default_rule = num_rules;
+
+ finish_rule( def_rule, false, 0, 0, 0);
+
+ for ( i = 1; i <= lastsc; ++i )
+ scset[i] = mkbranch( scset[i], def_rule );
+
+ if ( spprdflt )
+ add_action(
+ "YY_FATAL_ERROR( \"flex scanner jammed\" )" );
+ else
+ add_action( "ECHO" );
+
+ add_action( ";\n\tYY_BREAK\n" );
+ }
+ ;
+
+initlex :
+ { /* initialize for processing rules */
+
+ /* Create default DFA start condition. */
+ scinstal( "INITIAL", false );
+ }
+ ;
+
+sect1 : sect1 startconddecl namelist1
+ | sect1 options
+ |
+ | error
+ { synerr( _("unknown error processing section 1") ); }
+ ;
+
+sect1end : SECTEND
+ {
+ check_options();
+ scon_stk = allocate_integer_array( lastsc + 1 );
+ scon_stk_ptr = 0;
+ }
+ ;
+
+startconddecl : SCDECL
+ { xcluflg = false; }
+
+ | XSCDECL
+ { xcluflg = true; }
+ ;
+
+namelist1 : namelist1 NAME
+ { scinstal( nmstr, xcluflg ); }
+
+ | NAME
+ { scinstal( nmstr, xcluflg ); }
+
+ | error
+ { synerr( _("bad start condition list") ); }
+ ;
+
+options : OPTION_OP optionlist
+ ;
+
+optionlist : optionlist option
+ |
+ ;
+
+option : OPT_OUTFILE '=' NAME
+ {
+ outfilename = copy_string( nmstr );
+ did_outfilename = 1;
+ }
+ | OPT_EXTRA_TYPE '=' NAME
+ { extra_type = copy_string( nmstr ); }
+ | OPT_PREFIX '=' NAME
+ { prefix = copy_string( nmstr ); }
+ | OPT_YYCLASS '=' NAME
+ { yyclass = copy_string( nmstr ); }
+ | OPT_HEADER '=' NAME
+ { headerfilename = copy_string( nmstr ); }
+ | OPT_TABLES '=' NAME
+ { tablesext = true; tablesfilename = copy_string( nmstr ); }
+ ;
+
+sect2 : sect2 scon initforrule flexrule '\n'
+ { scon_stk_ptr = $2; }
+ | sect2 scon '{' sect2 '}'
+ { scon_stk_ptr = $2; }
+ |
+ ;
+
+initforrule :
+ {
+ /* Initialize for a parse of one rule. */
+ trlcontxt = variable_trail_rule = varlength = false;
+ trailcnt = headcnt = rulelen = 0;
+ current_state_type = STATE_NORMAL;
+ previous_continued_action = continued_action;
+ in_rule = true;
+
+ new_rule();
+ }
+ ;
+
+flexrule : '^' rule
+ {
+ pat = $2;
+ finish_rule( pat, variable_trail_rule,
+ headcnt, trailcnt , previous_continued_action);
+
+ if ( scon_stk_ptr > 0 )
+ {
+ for ( i = 1; i <= scon_stk_ptr; ++i )
+ scbol[scon_stk[i]] =
+ mkbranch( scbol[scon_stk[i]],
+ pat );
+ }
+
+ else
+ {
+ /* Add to all non-exclusive start conditions,
+ * including the default (0) start condition.
+ */
+
+ for ( i = 1; i <= lastsc; ++i )
+ if ( ! scxclu[i] )
+ scbol[i] = mkbranch( scbol[i],
+ pat );
+ }
+
+ if ( ! bol_needed )
+ {
+ bol_needed = true;
+
+ if ( performance_report > 1 )
+ pinpoint_message(
+ "'^' operator results in sub-optimal performance" );
+ }
+ }
+
+ | rule
+ {
+ pat = $1;
+ finish_rule( pat, variable_trail_rule,
+ headcnt, trailcnt , previous_continued_action);
+
+ if ( scon_stk_ptr > 0 )
+ {
+ for ( i = 1; i <= scon_stk_ptr; ++i )
+ scset[scon_stk[i]] =
+ mkbranch( scset[scon_stk[i]],
+ pat );
+ }
+
+ else
+ {
+ for ( i = 1; i <= lastsc; ++i )
+ if ( ! scxclu[i] )
+ scset[i] =
+ mkbranch( scset[i],
+ pat );
+ }
+ }
+
+ | EOF_OP
+ {
+ if ( scon_stk_ptr > 0 )
+ build_eof_action();
+
+ else
+ {
+ /* This EOF applies to all start conditions
+ * which don't already have EOF actions.
+ */
+ for ( i = 1; i <= lastsc; ++i )
+ if ( ! sceof[i] )
+ scon_stk[++scon_stk_ptr] = i;
+
+ if ( scon_stk_ptr == 0 )
+ warn(
+ "all start conditions already have <<EOF>> rules" );
+
+ else
+ build_eof_action();
+ }
+ }
+
+ | error
+ { synerr( _("unrecognized rule") ); }
+ ;
+
+scon_stk_ptr :
+ { $$ = scon_stk_ptr; }
+ ;
+
+scon : '<' scon_stk_ptr namelist2 '>'
+ { $$ = $2; }
+
+ | '<' '*' '>'
+ {
+ $$ = scon_stk_ptr;
+
+ for ( i = 1; i <= lastsc; ++i )
+ {
+ int j;
+
+ for ( j = 1; j <= scon_stk_ptr; ++j )
+ if ( scon_stk[j] == i )
+ break;
+
+ if ( j > scon_stk_ptr )
+ scon_stk[++scon_stk_ptr] = i;
+ }
+ }
+
+ |
+ { $$ = scon_stk_ptr; }
+ ;
+
+namelist2 : namelist2 ',' sconname
+
+ | sconname
+
+ | error
+ { synerr( _("bad start condition list") ); }
+ ;
+
+sconname : NAME
+ {
+ if ( (scnum = sclookup( nmstr )) == 0 )
+ format_pinpoint_message(
+ "undeclared start condition %s",
+ nmstr );
+ else
+ {
+ for ( i = 1; i <= scon_stk_ptr; ++i )
+ if ( scon_stk[i] == scnum )
+ {
+ format_warn(
+ "<%s> specified twice",
+ scname[scnum] );
+ break;
+ }
+
+ if ( i > scon_stk_ptr )
+ scon_stk[++scon_stk_ptr] = scnum;
+ }
+ }
+ ;
+
+rule : re2 re
+ {
+ if ( transchar[lastst[$2]] != SYM_EPSILON )
+ /* Provide final transition \now/ so it
+ * will be marked as a trailing context
+ * state.
+ */
+ $2 = link_machines( $2,
+ mkstate( SYM_EPSILON ) );
+
+ mark_beginning_as_normal( $2 );
+ current_state_type = STATE_NORMAL;
+
+ if ( previous_continued_action )
+ {
+ /* We need to treat this as variable trailing
+ * context so that the backup does not happen
+ * in the action but before the action switch
+ * statement. If the backup happens in the
+ * action, then the rules "falling into" this
+ * one's action will *also* do the backup,
+ * erroneously.
+ */
+ if ( ! varlength || headcnt != 0 )
+ warn(
+ "trailing context made variable due to preceding '|' action" );
+
+ /* Mark as variable. */
+ varlength = true;
+ headcnt = 0;
+
+ }
+
+ if ( lex_compat || (varlength && headcnt == 0) )
+ { /* variable trailing context rule */
+ /* Mark the first part of the rule as the
+ * accepting "head" part of a trailing
+ * context rule.
+ *
+ * By the way, we didn't do this at the
+ * beginning of this production because back
+ * then current_state_type was set up for a
+ * trail rule, and add_accept() can create
+ * a new state ...
+ */
+ add_accept( $1,
+ num_rules | YY_TRAILING_HEAD_MASK );
+ variable_trail_rule = true;
+ }
+
+ else
+ trailcnt = rulelen;
+
+ $$ = link_machines( $1, $2 );
+ }
+
+ | re2 re '$'
+ { synerr( _("trailing context used twice") ); }
+
+ | re '$'
+ {
+ headcnt = 0;
+ trailcnt = 1;
+ rulelen = 1;
+ varlength = false;
+
+ current_state_type = STATE_TRAILING_CONTEXT;
+
+ if ( trlcontxt )
+ {
+ synerr( _("trailing context used twice") );
+ $$ = mkstate( SYM_EPSILON );
+ }
+
+ else if ( previous_continued_action )
+ {
+ /* See the comment in the rule for "re2 re"
+ * above.
+ */
+ warn(
+ "trailing context made variable due to preceding '|' action" );
+
+ varlength = true;
+ }
+
+ if ( lex_compat || varlength )
+ {
+ /* Again, see the comment in the rule for
+ * "re2 re" above.
+ */
+ add_accept( $1,
+ num_rules | YY_TRAILING_HEAD_MASK );
+ variable_trail_rule = true;
+ }
+
+ trlcontxt = true;
+
+ eps = mkstate( SYM_EPSILON );
+ $$ = link_machines( $1,
+ link_machines( eps, mkstate( '\n' ) ) );
+ }
+
+ | re
+ {
+ $$ = $1;
+
+ if ( trlcontxt )
+ {
+ if ( lex_compat || (varlength && headcnt == 0) )
+ /* Both head and trail are
+ * variable-length.
+ */
+ variable_trail_rule = true;
+ else
+ trailcnt = rulelen;
+ }
+ }
+ ;
+
+
+re : re '|' series
+ {
+ varlength = true;
+ $$ = mkor( $1, $3 );
+ }
+
+ | series
+ { $$ = $1; }
+ ;
+
+
+re2 : re '/'
+ {
+ /* This rule is written separately so the
+ * reduction will occur before the trailing
+ * series is parsed.
+ */
+
+ if ( trlcontxt )
+ synerr( _("trailing context used twice") );
+ else
+ trlcontxt = true;
+
+ if ( varlength )
+ /* We hope the trailing context is
+ * fixed-length.
+ */
+ varlength = false;
+ else
+ headcnt = rulelen;
+
+ rulelen = 0;
+
+ current_state_type = STATE_TRAILING_CONTEXT;
+ $$ = $1;
+ }
+ ;
+
+series : series singleton
+ {
+ /* This is where concatenation of adjacent patterns
+ * gets done.
+ */
+ $$ = link_machines( $1, $2 );
+ }
+
+ | singleton
+ { $$ = $1; }
+
+ | series BEGIN_REPEAT_POSIX NUMBER ',' NUMBER END_REPEAT_POSIX
+ {
+ varlength = true;
+
+ if ( $3 > $5 || $3 < 0 )
+ {
+ synerr( _("bad iteration values") );
+ $$ = $1;
+ }
+ else
+ {
+ if ( $3 == 0 )
+ {
+ if ( $5 <= 0 )
+ {
+ synerr(
+ _("bad iteration values") );
+ $$ = $1;
+ }
+ else
+ $$ = mkopt(
+ mkrep( $1, 1, $5 ) );
+ }
+ else
+ $$ = mkrep( $1, $3, $5 );
+ }
+ }
+
+ | series BEGIN_REPEAT_POSIX NUMBER ',' END_REPEAT_POSIX
+ {
+ varlength = true;
+
+ if ( $3 <= 0 )
+ {
+ synerr( _("iteration value must be positive") );
+ $$ = $1;
+ }
+
+ else
+ $$ = mkrep( $1, $3, INFINITE_REPEAT );
+ }
+
+ | series BEGIN_REPEAT_POSIX NUMBER END_REPEAT_POSIX
+ {
+ /* The series could be something like "(foo)",
+ * in which case we have no idea what its length
+ * is, so we punt here.
+ */
+ varlength = true;
+
+ if ( $3 <= 0 )
+ {
+ synerr( _("iteration value must be positive")
+ );
+ $$ = $1;
+ }
+
+ else
+ $$ = link_machines( $1,
+ copysingl( $1, $3 - 1 ) );
+ }
+
+ ;
+
+singleton : singleton '*'
+ {
+ varlength = true;
+
+ $$ = mkclos( $1 );
+ }
+
+ | singleton '+'
+ {
+ varlength = true;
+ $$ = mkposcl( $1 );
+ }
+
+ | singleton '?'
+ {
+ varlength = true;
+ $$ = mkopt( $1 );
+ }
+
+ | singleton BEGIN_REPEAT_FLEX NUMBER ',' NUMBER END_REPEAT_FLEX
+ {
+ varlength = true;
+
+ if ( $3 > $5 || $3 < 0 )
+ {
+ synerr( _("bad iteration values") );
+ $$ = $1;
+ }
+ else
+ {
+ if ( $3 == 0 )
+ {
+ if ( $5 <= 0 )
+ {
+ synerr(
+ _("bad iteration values") );
+ $$ = $1;
+ }
+ else
+ $$ = mkopt(
+ mkrep( $1, 1, $5 ) );
+ }
+ else
+ $$ = mkrep( $1, $3, $5 );
+ }
+ }
+
+ | singleton BEGIN_REPEAT_FLEX NUMBER ',' END_REPEAT_FLEX
+ {
+ varlength = true;
+
+ if ( $3 <= 0 )
+ {
+ synerr( _("iteration value must be positive") );
+ $$ = $1;
+ }
+
+ else
+ $$ = mkrep( $1, $3, INFINITE_REPEAT );
+ }
+
+ | singleton BEGIN_REPEAT_FLEX NUMBER END_REPEAT_FLEX
+ {
+ /* The singleton could be something like "(foo)",
+ * in which case we have no idea what its length
+ * is, so we punt here.
+ */
+ varlength = true;
+
+ if ( $3 <= 0 )
+ {
+ synerr( _("iteration value must be positive") );
+ $$ = $1;
+ }
+
+ else
+ $$ = link_machines( $1,
+ copysingl( $1, $3 - 1 ) );
+ }
+
+ | '.'
+ {
+ if ( ! madeany )
+ {
+ /* Create the '.' character class. */
+ ccldot = cclinit();
+ ccladd( ccldot, '\n' );
+ cclnegate( ccldot );
+
+ if ( useecs )
+ mkeccl( ccltbl + cclmap[ccldot],
+ ccllen[ccldot], nextecm,
+ ecgroup, csize, csize );
+
+ /* Create the (?s:'.') character class. */
+ cclany = cclinit();
+ cclnegate( cclany );
+
+ if ( useecs )
+ mkeccl( ccltbl + cclmap[cclany],
+ ccllen[cclany], nextecm,
+ ecgroup, csize, csize );
+
+ madeany = true;
+ }
+
+ ++rulelen;
+
+ if (sf_dot_all())
+ $$ = mkstate( -cclany );
+ else
+ $$ = mkstate( -ccldot );
+ }
+
+ | fullccl
+ {
+ /* Sort characters for fast searching.
+ */
+ qsort( ccltbl + cclmap[$1], ccllen[$1], sizeof (*ccltbl), cclcmp );
+
+ if ( useecs )
+ mkeccl( ccltbl + cclmap[$1], ccllen[$1],
+ nextecm, ecgroup, csize, csize );
+
+ ++rulelen;
+
+ if (ccl_has_nl[$1])
+ rule_has_nl[num_rules] = true;
+
+ $$ = mkstate( -$1 );
+ }
+
+ | PREVCCL
+ {
+ ++rulelen;
+
+ if (ccl_has_nl[$1])
+ rule_has_nl[num_rules] = true;
+
+ $$ = mkstate( -$1 );
+ }
+
+ | '"' string '"'
+ { $$ = $2; }
+
+ | '(' re ')'
+ { $$ = $2; }
+
+ | CHAR
+ {
+ ++rulelen;
+
+ if ($1 == nlch)
+ rule_has_nl[num_rules] = true;
+
+ if (sf_case_ins() && has_case($1))
+ /* create an alternation, as in (a|A) */
+ $$ = mkor (mkstate($1), mkstate(reverse_case($1)));
+ else
+ $$ = mkstate( $1 );
+ }
+ ;
+fullccl:
+ fullccl CCL_OP_DIFF braceccl { $$ = ccl_set_diff ($1, $3); }
+ | fullccl CCL_OP_UNION braceccl { $$ = ccl_set_union ($1, $3); }
+ | braceccl
+ ;
+
+braceccl:
+
+ '[' ccl ']' { $$ = $2; }
+
+ | '[' '^' ccl ']'
+ {
+ cclnegate( $3 );
+ $$ = $3;
+ }
+ ;
+
+ccl : ccl CHAR '-' CHAR
+ {
+
+ if (sf_case_ins())
+ {
+
+ /* If one end of the range has case and the other
+ * does not, or the cases are different, then we're not
+ * sure what range the user is trying to express.
+ * Examples: [@-z] or [S-t]
+ */
+ if (has_case ($2) != has_case ($4)
+ || (has_case ($2) && (b_islower ($2) != b_islower ($4)))
+ || (has_case ($2) && (b_isupper ($2) != b_isupper ($4))))
+ format_warn3 (
+ _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
+ $2, $4);
+
+ /* If the range spans uppercase characters but not
+ * lowercase (or vice-versa), then should we automatically
+ * include lowercase characters in the range?
+ * Example: [@-_] spans [a-z] but not [A-Z]
+ */
+ else if (!has_case ($2) && !has_case ($4) && !range_covers_case ($2, $4))
+ format_warn3 (
+ _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
+ $2, $4);
+ }
+
+ if ( $2 > $4 )
+ synerr( _("negative range in character class") );
+
+ else
+ {
+ for ( i = $2; i <= $4; ++i )
+ ccladd( $1, i );
+
+ /* Keep track if this ccl is staying in
+ * alphabetical order.
+ */
+ cclsorted = cclsorted && ($2 > lastchar);
+ lastchar = $4;
+
+ /* Do it again for upper/lowercase */
+ if (sf_case_ins() && has_case($2) && has_case($4)){
+ $2 = reverse_case ($2);
+ $4 = reverse_case ($4);
+
+ for ( i = $2; i <= $4; ++i )
+ ccladd( $1, i );
+
+ cclsorted = cclsorted && ($2 > lastchar);
+ lastchar = $4;
+ }
+
+ }
+
+ $$ = $1;
+ }
+
+ | ccl CHAR
+ {
+ ccladd( $1, $2 );
+ cclsorted = cclsorted && ($2 > lastchar);
+ lastchar = $2;
+
+ /* Do it again for upper/lowercase */
+ if (sf_case_ins() && has_case($2)){
+ $2 = reverse_case ($2);
+ ccladd ($1, $2);
+
+ cclsorted = cclsorted && ($2 > lastchar);
+ lastchar = $2;
+ }
+
+ $$ = $1;
+ }
+
+ | ccl ccl_expr
+ {
+ /* Too hard to properly maintain cclsorted. */
+ cclsorted = false;
+ $$ = $1;
+ }
+
+ |
+ {
+ cclsorted = true;
+ lastchar = 0;
+ currccl = $$ = cclinit();
+ }
+ ;
+
+ccl_expr:
+ CCE_ALNUM { CCL_EXPR(isalnum); }
+ | CCE_ALPHA { CCL_EXPR(isalpha); }
+ | CCE_BLANK { CCL_EXPR(IS_BLANK); }
+ | CCE_CNTRL { CCL_EXPR(iscntrl); }
+ | CCE_DIGIT { CCL_EXPR(isdigit); }
+ | CCE_GRAPH { CCL_EXPR(isgraph); }
+ | CCE_LOWER {
+ CCL_EXPR(islower);
+ if (sf_case_ins())
+ CCL_EXPR(isupper);
+ }
+ | CCE_PRINT { CCL_EXPR(isprint); }
+ | CCE_PUNCT { CCL_EXPR(ispunct); }
+ | CCE_SPACE { CCL_EXPR(isspace); }
+ | CCE_XDIGIT { CCL_EXPR(isxdigit); }
+ | CCE_UPPER {
+ CCL_EXPR(isupper);
+ if (sf_case_ins())
+ CCL_EXPR(islower);
+ }
+
+ | CCE_NEG_ALNUM { CCL_NEG_EXPR(isalnum); }
+ | CCE_NEG_ALPHA { CCL_NEG_EXPR(isalpha); }
+ | CCE_NEG_BLANK { CCL_NEG_EXPR(IS_BLANK); }
+ | CCE_NEG_CNTRL { CCL_NEG_EXPR(iscntrl); }
+ | CCE_NEG_DIGIT { CCL_NEG_EXPR(isdigit); }
+ | CCE_NEG_GRAPH { CCL_NEG_EXPR(isgraph); }
+ | CCE_NEG_PRINT { CCL_NEG_EXPR(isprint); }
+ | CCE_NEG_PUNCT { CCL_NEG_EXPR(ispunct); }
+ | CCE_NEG_SPACE { CCL_NEG_EXPR(isspace); }
+ | CCE_NEG_XDIGIT { CCL_NEG_EXPR(isxdigit); }
+ | CCE_NEG_LOWER {
+ if ( sf_case_ins() )
+ warn(_("[:^lower:] is ambiguous in case insensitive scanner"));
+ else
+ CCL_NEG_EXPR(islower);
+ }
+ | CCE_NEG_UPPER {
+ if ( sf_case_ins() )
+ warn(_("[:^upper:] ambiguous in case insensitive scanner"));
+ else
+ CCL_NEG_EXPR(isupper);
+ }
+ ;
+
+string : string CHAR
+ {
+ if ( $2 == nlch )
+ rule_has_nl[num_rules] = true;
+
+ ++rulelen;
+
+ if (sf_case_ins() && has_case($2))
+ $$ = mkor (mkstate($2), mkstate(reverse_case($2)));
+ else
+ $$ = mkstate ($2);
+
+ $$ = link_machines( $1, $$);
+ }
+
+ |
+ { $$ = mkstate( SYM_EPSILON ); }
+ ;
+
+%%
+
+
+/* build_eof_action - build the "<<EOF>>" action for the active start
+ * conditions
+ */
+
+void build_eof_action()
+ {
+ int i;
+ char action_text[MAXLINE];
+
+ for ( i = 1; i <= scon_stk_ptr; ++i )
+ {
+ if ( sceof[scon_stk[i]] )
+ format_pinpoint_message(
+ "multiple <<EOF>> rules for start condition %s",
+ scname[scon_stk[i]] );
+
+ else
+ {
+ sceof[scon_stk[i]] = true;
+
+ if (previous_continued_action /* && previous action was regular */)
+ add_action("YY_RULE_SETUP\n");
+
+ snprintf( action_text, sizeof(action_text), "case YY_STATE_EOF(%s):\n",
+ scname[scon_stk[i]] );
+ add_action( action_text );
+ }
+ }
+
+ line_directive_out( (FILE *) 0, 1 );
+
+ /* This isn't a normal rule after all - don't count it as
+ * such, so we don't have any holes in the rule numbering
+ * (which make generating "rule can never match" warnings
+ * more difficult.
+ */
+ --num_rules;
+ ++num_eof_rules;
+ }
+
+
+/* format_synerr - write out formatted syntax error */
+
+void format_synerr( msg, arg )
+const char *msg, arg[];
+ {
+ char errmsg[MAXLINE];
+
+ (void) snprintf( errmsg, sizeof(errmsg), msg, arg );
+ synerr( errmsg );
+ }
+
+
+/* synerr - report a syntax error */
+
+void synerr( str )
+const char *str;
+ {
+ syntaxerror = true;
+ pinpoint_message( str );
+ }
+
+
+/* format_warn - write out formatted warning */
+
+void format_warn( msg, arg )
+const char *msg, arg[];
+ {
+ char warn_msg[MAXLINE];
+
+ snprintf( warn_msg, sizeof(warn_msg), msg, arg );
+ warn( warn_msg );
+ }
+
+
+/* warn - report a warning, unless -w was given */
+
+void warn( str )
+const char *str;
+ {
+ line_warning( str, linenum );
+ }
+
+/* format_pinpoint_message - write out a message formatted with one string,
+ * pinpointing its location
+ */
+
+void format_pinpoint_message( msg, arg )
+const char *msg, arg[];
+ {
+ char errmsg[MAXLINE];
+
+ snprintf( errmsg, sizeof(errmsg), msg, arg );
+ pinpoint_message( errmsg );
+ }
+
+
+/* pinpoint_message - write out a message, pinpointing its location */
+
+void pinpoint_message( str )
+const char *str;
+ {
+ line_pinpoint( str, linenum );
+ }
+
+
+/* line_warning - report a warning at a given line, unless -w was given */
+
+void line_warning( str, line )
+const char *str;
+int line;
+ {
+ char warning[MAXLINE];
+
+ if ( ! nowarn )
+ {
+ snprintf( warning, sizeof(warning), "warning, %s", str );
+ line_pinpoint( warning, line );
+ }
+ }
+
+
+/* line_pinpoint - write out a message, pinpointing it at the given line */
+
+void line_pinpoint( str, line )
+const char *str;
+int line;
+ {
+ fprintf( stderr, "%s:%d: %s\n", infilename, line, str );
+ }
+
+
+/* yyerror - eat up an error message from the parser;
+ * currently, messages are ignore
+ */
+
+void yyerror( msg )
+const char *msg;
+ {
+ (void)msg;
+ }
diff --git a/src/regex.c b/src/regex.c
new file mode 100644
index 0000000..2bb580e
--- /dev/null
+++ b/src/regex.c
@@ -0,0 +1,171 @@
+/** regex - regular expression functions related to POSIX regex lib. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+
+
+static const char* REGEXP_LINEDIR = "^#line ([[:digit:]]+) \"(.*)\"";
+static const char* REGEXP_BLANK_LINE = "^[[:space:]]*$";
+
+regex_t regex_linedir; /**< matches line directives */
+regex_t regex_blank_line; /**< matches blank lines */
+
+
+/** Initialize the regular expressions.
+ * @return true upon success.
+ */
+bool flex_init_regex(void)
+{
+ flex_regcomp(&regex_linedir, REGEXP_LINEDIR, REG_EXTENDED);
+ flex_regcomp(&regex_blank_line, REGEXP_BLANK_LINE, REG_EXTENDED);
+
+ return true;
+}
+
+/** Compiles a regular expression or dies trying.
+ * @param preg Same as for regcomp().
+ * @param regex Same as for regcomp().
+ * @param cflags Same as for regcomp().
+ */
+void flex_regcomp(regex_t *preg, const char *regex, int cflags)
+{
+ int err;
+
+ memset (preg, 0, sizeof (regex_t));
+
+ if ((err = regcomp (preg, regex, cflags)) != 0) {
+ const int errbuf_sz = 200;
+ char *errbuf, *rxerr;
+
+ errbuf = (char*)flex_alloc(errbuf_sz *sizeof(char));
+ if (!errbuf)
+ flexfatal(_("Unable to allocate buffer to report regcomp"));
+ rxerr = (char*)flex_alloc(errbuf_sz *sizeof(char));
+ if (!rxerr)
+ flexfatal(_("Unable to allocate buffer for regerror"));
+ regerror (err, preg, rxerr, errbuf_sz);
+ snprintf (errbuf, errbuf_sz, "regcomp for \"%s\" failed: %s", regex, rxerr);
+
+ flexfatal (errbuf);
+ free(errbuf);
+ free(rxerr);
+ }
+}
+
+/** Extract a copy of the match, or NULL if no match.
+ * @param m A match as returned by regexec().
+ * @param src The source string that was passed to regexec().
+ * @return The allocated string.
+ */
+char *regmatch_dup (regmatch_t * m, const char *src)
+{
+ char *str;
+ int len;
+
+ if (m == NULL || m->rm_so < 0)
+ return NULL;
+ len = m->rm_eo - m->rm_so;
+ str = (char *) flex_alloc ((len + 1) * sizeof (char));
+ if (!str)
+ flexfatal(_("Unable to allocate a copy of the match"));
+ strncpy (str, src + m->rm_so, len);
+ str[len] = 0;
+ return str;
+}
+
+/** Copy the match.
+ * @param m A match as returned by regexec().
+ * @param dest The destination buffer.
+ * @param src The source string that was passed to regexec().
+ * @return dest
+ */
+char *regmatch_cpy (regmatch_t * m, char *dest, const char *src)
+{
+ if (m == NULL || m->rm_so < 0) {
+ if (dest)
+ dest[0] = '\0';
+ return dest;
+ }
+
+ snprintf (dest, regmatch_len(m), "%s", src + m->rm_so);
+ return dest;
+}
+
+/** Get the length in characters of the match.
+ * @param m A match as returned by regexec().
+ * @return The length of the match.
+ */
+int regmatch_len (regmatch_t * m)
+{
+ if (m == NULL || m->rm_so < 0) {
+ return 0;
+ }
+
+ return m->rm_eo - m->rm_so;
+}
+
+
+
+/** Convert a regmatch_t object to an integer using the strtol() function.
+ * @param m A match as returned by regexec().
+ * @param src The source string that was passed to regexec().
+ * @param endptr Same as the second argument to strtol().
+ * @param base Same as the third argument to strtol().
+ * @return The converted integer or error (Return value is the same as for strtol()).
+ */
+int regmatch_strtol (regmatch_t * m, const char *src, char **endptr,
+ int base)
+{
+ int n = 0;
+
+#define bufsz 20
+ char buf[bufsz];
+ char *s;
+
+ if (m == NULL || m->rm_so < 0)
+ return 0;
+
+ if (regmatch_len (m) < bufsz)
+ s = regmatch_cpy (m, buf, src);
+ else
+ s = regmatch_dup (m, src);
+
+ n = strtol (s, endptr, base);
+
+ if (s != buf)
+ free (s);
+
+ return n;
+}
+
+/** Check for empty or non-existent match.
+ * @param m A match as returned by regexec().
+ * @return false if match length is non-zero.
+ * Note that reg_empty returns true even if match did not occur at all.
+ */
+bool regmatch_empty (regmatch_t * m)
+{
+ return (m == NULL || m->rm_so < 0 || m->rm_so == m->rm_eo);
+}
+
+/* vim:set expandtab cindent tabstop=4 softtabstop=4 shiftwidth=4 textwidth=0: */
diff --git a/src/scan.c b/src/scan.c
new file mode 100644
index 0000000..4bcfcb8
--- /dev/null
+++ b/src/scan.c
@@ -0,0 +1,5105 @@
+#line 2 "scan.c"
+
+#line 4 "scan.c"
+
+#define YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 6
+#define YY_FLEX_SUBMINOR_VERSION 0-pre
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart(yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
+#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+extern yy_size_t yyleng;
+
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+ #define YY_LESS_LINENO(n)
+ #define YY_LINENO_REWIND_TO(ptr)
+
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ *yy_cp = (yy_hold_char); \
+ YY_RESTORE_YY_MORE_OFFSET \
+ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr) )
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ yy_size_t yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+
+ };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* Stack of input buffers. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+ : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
+yy_size_t yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 0; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart (FILE *input_file );
+void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
+YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
+void yy_delete_buffer (YY_BUFFER_STATE b );
+void yy_flush_buffer (YY_BUFFER_STATE b );
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
+void yypop_buffer_state (void );
+
+static void yyensure_buffer_stack (void );
+static void yy_load_buffer_state (void );
+static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
+
+#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
+
+YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
+YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
+
+void *yyalloc (yy_size_t );
+void *yyrealloc (void *,yy_size_t );
+void yyfree (void * );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+typedef unsigned char YY_CHAR;
+
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+
+typedef int yy_state_type;
+
+extern int yylineno;
+
+int yylineno = 1;
+
+extern char *yytext;
+#ifdef yytext_ptr
+#undef yytext_ptr
+#endif
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state (void );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
+static int yy_get_next_buffer (void );
+#if defined(__GNUC__) && __GNUC__ >= 3
+__attribute__((__noreturn__))
+#endif
+static void yy_fatal_error (yyconst char msg[] );
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ (yytext_ptr) = yy_bp; \
+ (yytext_ptr) -= (yy_more_len); \
+ yyleng = (size_t) (yy_cp - (yytext_ptr)); \
+ (yy_hold_char) = *yy_cp; \
+ *yy_cp = '\0'; \
+ (yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 251
+#define YY_END_OF_BUFFER 252
+/* This struct is not used in this scanner,
+ but its presence is necessary. */
+struct yy_trans_info
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
+static yyconst flex_int16_t yy_accept[1107] =
+ { 0,
+ 0, 0, 0, 0, 0, 0, 248, 248, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 252, 250,
+ 9, 20, 250, 18, 1, 19, 250, 250, 250, 250,
+ 17, 164, 149, 150, 164, 142, 164, 161, 162, 163,
+ 163, 164, 164, 164, 163, 148, 138, 164, 164, 140,
+ 141, 136, 137, 136, 135, 134, 135, 248, 248, 249,
+ 249, 41, 42, 41, 41, 41, 41, 41, 41, 50,
+
+ 49, 51, 250, 170, 170, 165, 170, 166, 167, 169,
+ 171, 219, 220, 219, 217, 216, 218, 172, 174, 172,
+ 173, 172, 186, 186, 186, 186, 188, 190, 188, 188,
+ 188, 188, 189, 233, 238, 233, 237, 239, 239, 235,
+ 235, 235, 234, 234, 229, 230, 250, 131, 250, 25,
+ 26, 25, 22, 25, 25, 240, 242, 240, 243, 244,
+ 227, 227, 228, 227, 227, 227, 227, 227, 227, 227,
+ 130, 53, 52, 130, 130, 130, 130, 54, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 37,
+
+ 34, 37, 35, 48, 45, 250, 48, 48, 44, 43,
+ 176, 175, 177, 178, 179, 180, 181, 182, 183, 32,
+ 33, 32, 31, 29, 30, 29, 28, 9, 20, 0,
+ 18, 1, 19, 0, 0, 0, 16, 10, 0, 0,
+ 0, 0, 4, 16, 5, 0, 2, 17, 149, 150,
+ 0, 0, 0, 144, 0, 160, 158, 0, 154, 154,
+ 0, 245, 245, 245, 0, 0, 143, 0, 148, 138,
+ 0, 0, 0, 140, 141, 153, 139, 0, 137, 135,
+ 134, 134, 132, 133, 248, 248, 246, 247, 42, 0,
+ 0, 39, 40, 0, 50, 49, 51, 0, 165, 0,
+
+ 165, 168, 169, 220, 216, 174, 0, 184, 185, 190,
+ 187, 233, 238, 0, 236, 0, 222, 235, 235, 235,
+ 231, 232, 0, 131, 0, 26, 21, 23, 24, 240,
+ 242, 241, 0, 0, 228, 221, 225, 226, 53, 52,
+ 0, 129, 0, 0, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 55, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 0, 36, 35, 45,
+ 46, 47, 32, 33, 30, 27, 0, 16, 10, 0,
+ 14, 0, 0, 0, 0, 0, 4, 16, 5, 0,
+
+ 6, 0, 145, 0, 146, 0, 159, 0, 154, 154,
+ 0, 154, 154, 154, 245, 245, 156, 155, 0, 157,
+ 139, 147, 0, 153, 0, 132, 133, 0, 0, 0,
+ 38, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 235, 235, 221, 0, 0, 130,
+ 130, 130, 130, 130, 130, 130, 67, 130, 130, 130,
+ 72, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 0, 0, 0, 0, 14,
+
+ 0, 0, 0, 0, 0, 0, 4, 8, 5, 0,
+ 154, 154, 154, 154, 154, 154, 154, 245, 157, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 235, 235, 56, 57, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 73, 74, 130, 130, 130, 130, 79, 130, 130, 130,
+ 130, 130, 130, 130, 84, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 93, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 0, 0, 0, 0, 15, 0,
+
+ 0, 0, 0, 0, 8, 8, 8, 0, 154, 154,
+ 154, 154, 154, 154, 154, 0, 0, 0, 0, 215,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 235, 235, 58, 130, 130, 60, 130,
+ 64, 130, 130, 130, 130, 70, 130, 130, 130, 75,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 87, 130, 130, 130, 130, 91, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 0, 0, 0,
+ 0, 3, 0, 0, 0, 8, 7, 8, 0, 154,
+
+ 154, 154, 0, 0, 223, 224, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 223, 224, 130, 130, 130, 63, 130, 130, 130, 130,
+ 130, 130, 130, 126, 130, 130, 130, 130, 130, 130,
+ 130, 130, 124, 130, 86, 130, 89, 130, 90, 130,
+ 130, 130, 105, 0, 130, 95, 130, 0, 96, 0,
+ 0, 0, 0, 0, 12, 0, 13, 0, 152, 0,
+ 151, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+ 0, 0, 0, 0, 0, 130, 130, 130, 130, 130,
+ 130, 130, 68, 130, 71, 130, 130, 130, 130, 130,
+ 130, 123, 130, 83, 130, 130, 88, 130, 92, 103,
+ 125, 0, 0, 0, 0, 0, 0, 130, 130, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 151,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 130, 130, 130, 130, 130, 130,
+ 130, 69, 130, 130, 130, 130, 80, 130, 130, 130,
+ 130, 130, 130, 0, 0, 114, 0, 0, 0, 0,
+
+ 0, 0, 94, 130, 0, 0, 115, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 11, 0, 191, 192,
+ 193, 194, 195, 196, 197, 198, 199, 200, 201, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 85, 130, 130, 0,
+ 0, 0, 0, 0, 0, 116, 0, 104, 0, 0,
+ 0, 0, 0, 117, 0, 0, 0, 0, 0, 202,
+ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
+ 213, 0, 130, 130, 130, 130, 130, 130, 130, 122,
+
+ 130, 130, 77, 130, 130, 130, 130, 130, 0, 0,
+ 110, 0, 120, 118, 111, 0, 0, 0, 121, 119,
+ 0, 0, 0, 0, 0, 0, 214, 130, 130, 130,
+ 130, 130, 130, 130, 126, 76, 130, 82, 130, 127,
+ 130, 106, 108, 0, 107, 109, 0, 0, 0, 0,
+ 0, 0, 0, 130, 130, 130, 65, 130, 130, 130,
+ 130, 78, 130, 112, 113, 98, 0, 0, 0, 0,
+ 99, 130, 130, 130, 130, 130, 130, 130, 128, 97,
+ 0, 101, 0, 130, 130, 130, 130, 130, 68, 130,
+ 100, 102, 130, 130, 62, 66, 130, 130, 130, 61,
+
+ 69, 130, 130, 81, 59, 0
+ } ;
+
+static yyconst YY_CHAR yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 4, 4, 5, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 1, 6, 7, 8, 9, 1, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 19, 19,
+ 19, 19, 19, 19, 20, 21, 22, 23, 1, 24,
+ 25, 26, 27, 1, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 44,
+ 53, 54, 55, 56, 57, 1, 58, 59, 60, 61,
+
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 44, 74, 75, 76, 77, 78, 79, 80,
+ 81, 44, 82, 83, 84, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst YY_CHAR yy_meta[85] =
+ { 0,
+ 1, 1, 2, 1, 3, 4, 1, 1, 1, 5,
+ 1, 6, 1, 7, 1, 8, 1, 5, 9, 9,
+ 9, 9, 10, 1, 1, 1, 1, 11, 11, 11,
+ 11, 11, 11, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 13, 14, 15, 1, 16, 11, 11, 11,
+ 11, 11, 11, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 5, 1, 17
+ } ;
+
+static yyconst flex_uint16_t yy_base[1201] =
+ { 0,
+ 0, 84, 167, 250, 171, 184, 174, 179, 192, 233,
+ 196, 200, 334, 0, 3343, 3340, 203, 416, 206, 211,
+ 187, 216, 276, 417, 500, 0, 210, 223, 421, 427,
+ 436, 440, 583, 588, 669, 0, 277, 299, 584, 751,
+ 579, 580, 576, 732, 279, 305, 310, 444, 3378, 3975,
+ 228, 3975, 3371, 0, 322, 3975, 3358, 423, 827, 3328,
+ 0, 3975, 755, 3975, 3337, 3975, 448, 3312, 3975, 3975,
+ 3323, 3291, 222, 408, 444, 764, 3975, 3311, 230, 3289,
+ 3975, 3975, 3975, 3306, 0, 3306, 164, 3304, 3975, 3236,
+ 3217, 3975, 3975, 3266, 239, 119, 3215, 3212, 3180, 0,
+
+ 3248, 3975, 3243, 3975, 476, 3227, 3222, 3975, 3168, 0,
+ 3975, 3975, 3975, 3203, 3975, 464, 3975, 3975, 3975, 3186,
+ 3975, 742, 3975, 3161, 751, 180, 3975, 3975, 3171, 0,
+ 3149, 757, 3975, 0, 3975, 3149, 3975, 200, 3138, 0,
+ 429, 241, 3097, 3092, 3975, 3975, 306, 3975, 323, 3975,
+ 3975, 3126, 3108, 3072, 3069, 0, 3975, 3115, 3975, 0,
+ 3975, 446, 3975, 3114, 3031, 3098, 435, 371, 3045, 3026,
+ 3975, 3076, 3975, 3074, 3070, 439, 440, 3975, 578, 751,
+ 586, 562, 735, 752, 0, 572, 577, 588, 786, 749,
+ 396, 809, 727, 582, 747, 753, 764, 769, 580, 3975,
+
+ 3975, 3067, 588, 3975, 3975, 3053, 3002, 2996, 3975, 3975,
+ 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975, 0,
+ 3975, 3046, 3975, 3975, 3975, 3018, 2986, 837, 3975, 2998,
+ 0, 847, 3975, 2997, 817, 777, 0, 0, 891, 903,
+ 912, 924, 0, 774, 0, 451, 3975, 0, 858, 3975,
+ 2996, 2914, 472, 3975, 2974, 2953, 3975, 791, 236, 822,
+ 899, 3975, 275, 0, 2873, 2872, 3975, 2871, 949, 3975,
+ 2949, 2850, 2918, 2906, 3975, 0, 3975, 796, 3975, 0,
+ 0, 2925, 0, 0, 2597, 3975, 3975, 3975, 3975, 795,
+ 794, 3975, 3975, 484, 0, 2597, 3975, 877, 2596, 2594,
+
+ 2594, 3975, 0, 3975, 918, 3975, 1005, 3975, 3975, 3975,
+ 3975, 0, 3975, 611, 3975, 0, 3975, 0, 853, 851,
+ 3975, 3975, 490, 3975, 608, 3975, 3975, 3975, 3975, 0,
+ 3975, 3975, 596, 2510, 3975, 0, 3975, 3975, 2588, 3975,
+ 2581, 3975, 894, 906, 0, 911, 717, 727, 923, 728,
+ 2571, 882, 930, 889, 902, 916, 917, 940, 928, 923,
+ 940, 933, 0, 932, 3975, 935, 939, 951, 956, 1059,
+ 964, 965, 1052, 955, 957, 1099, 2578, 3975, 1078, 3975,
+ 3975, 3975, 0, 3975, 3975, 3975, 987, 0, 0, 1087,
+ 3975, 2576, 1132, 985, 1046, 1058, 0, 1058, 0, 1009,
+
+ 3975, 1016, 3975, 1057, 3975, 1099, 3975, 1068, 731, 1088,
+ 1095, 1178, 1244, 1280, 988, 0, 3975, 3975, 2492, 1162,
+ 3975, 3975, 1081, 0, 1086, 0, 0, 1098, 1105, 1100,
+ 3975, 1167, 1245, 1246, 1247, 1250, 2539, 1248, 1249, 1258,
+ 1244, 1251, 1259, 1321, 1233, 1224, 0, 1072, 1228, 1243,
+ 1261, 1287, 1298, 1289, 1298, 1287, 0, 1299, 1228, 1308,
+ 0, 1280, 1298, 1307, 1316, 1314, 1316, 2532, 1322, 1337,
+ 1338, 1340, 1342, 1342, 1348, 1353, 1356, 1347, 1357, 1362,
+ 1366, 1358, 1353, 1356, 1377, 1366, 1370, 1371, 1367, 1383,
+ 1384, 1379, 1391, 1392, 1381, 1388, 1397, 1275, 1455, 3975,
+
+ 1439, 1463, 1444, 1415, 1412, 1415, 0, 1409, 0, 1429,
+ 1492, 1558, 1594, 1524, 2449, 1564, 1639, 3975, 3975, 1537,
+ 1556, 1560, 1407, 2427, 1558, 1563, 1559, 1564, 1572, 1584,
+ 1574, 1562, 1615, 1619, 1609, 1625, 1626, 1643, 1614, 1651,
+ 1662, 1658, 1664, 1665, 1616, 1616, 1637, 3975, 3975, 1638,
+ 1631, 2352, 1634, 1641, 1655, 1650, 1677, 1679, 1671, 1689,
+ 0, 0, 1690, 1677, 1681, 1697, 0, 2348, 1684, 1694,
+ 2274, 1686, 1685, 1695, 0, 1692, 1711, 1704, 1703, 1701,
+ 1713, 1703, 1704, 1712, 0, 1717, 1731, 1731, 1719, 1723,
+ 1722, 1741, 1726, 1742, 1734, 1747, 1741, 2241, 3975, 1464,
+
+ 1485, 1729, 1743, 1740, 0, 1721, 1591, 2173, 1585, 2139,
+ 1771, 1807, 1417, 962, 1426, 1755, 2049, 1745, 1769, 3975,
+ 1774, 1782, 1789, 1775, 1796, 1791, 1810, 1800, 1820, 1822,
+ 1821, 1823, 1832, 1831, 1838, 1840, 1853, 1856, 1854, 1855,
+ 1863, 1865, 1861, 1846, 1862, 0, 1853, 1864, 0, 1857,
+ 0, 2008, 1866, 1862, 1869, 0, 1874, 1893, 1870, 0,
+ 1888, 1875, 1886, 1882, 1880, 1878, 1897, 1876, 1882, 1889,
+ 1889, 0, 1904, 1895, 1899, 1919, 0, 1907, 1909, 1908,
+ 1923, 1791, 1924, 1925, 1919, 1747, 1917, 1918, 1918, 1938,
+ 1924, 1726, 1599, 1927, 1937, 1970, 3975, 1702, 1652, 1923,
+
+ 1755, 1941, 1625, 1618, 3975, 3975, 1961, 1977, 1966, 1969,
+ 1956, 1979, 1983, 1986, 1989, 1984, 1992, 1987, 1994, 1990,
+ 1988, 1995, 2007, 2004, 2016, 2022, 1996, 2028, 2018, 2026,
+ 0, 0, 1620, 1990, 2009, 0, 2035, 2020, 2035, 2029,
+ 2024, 2025, 2029, 1589, 2049, 2041, 2052, 2048, 2053, 2054,
+ 2044, 2057, 0, 2064, 0, 2048, 0, 1576, 0, 2064,
+ 2070, 2056, 0, 2096, 2062, 0, 2067, 2108, 0, 1531,
+ 2072, 2078, 1438, 1853, 3975, 2105, 3975, 2068, 3975, 1463,
+ 3975, 1407, 1402, 1348, 1345, 1314, 1307, 1269, 1260, 1256,
+ 1210, 1158, 2106, 2111, 2097, 2118, 2122, 2129, 2125, 2140,
+
+ 2131, 2136, 2141, 2143, 2156, 2131, 2138, 2147, 2101, 2151,
+ 2138, 2153, 0, 2141, 0, 2144, 2165, 2153, 2159, 2158,
+ 2165, 0, 2165, 0, 2167, 2169, 0, 2178, 0, 0,
+ 0, 2183, 2167, 2179, 2210, 2178, 2189, 2188, 2189, 2202,
+ 2186, 2194, 2218, 2196, 2202, 1119, 1114, 2206, 2118, 3975,
+ 1106, 1100, 1081, 1068, 1065, 1061, 1057, 972, 968, 965,
+ 914, 925, 893, 881, 874, 869, 865, 861, 854, 843,
+ 807, 802, 776, 2235, 2212, 2226, 2221, 2227, 2239, 2238,
+ 2228, 0, 2228, 2239, 2242, 2252, 0, 2238, 2244, 2249,
+ 2244, 2258, 2263, 2269, 2255, 3975, 2263, 2265, 2265, 2281,
+
+ 2265, 2262, 0, 2285, 2288, 2274, 3975, 2277, 2280, 2295,
+ 2279, 2280, 2283, 2303, 2283, 2330, 3975, 2335, 3975, 3975,
+ 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975, 735,
+ 612, 608, 598, 441, 374, 261, 245, 202, 152, 149,
+ 137, 165, 2296, 2303, 2304, 2320, 2326, 2316, 2324, 2329,
+ 2324, 2316, 2319, 2335, 2324, 2327, 0, 2332, 2328, 2327,
+ 2332, 2345, 2348, 2352, 2344, 3975, 2338, 0, 2338, 2343,
+ 2357, 2362, 2357, 3975, 2371, 2356, 2359, 2358, 2380, 3975,
+ 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975, 3975,
+ 3975, 128, 2384, 2382, 2373, 2387, 2376, 2378, 2378, 0,
+
+ 2395, 2396, 0, 2385, 2384, 2405, 2403, 2401, 2405, 2413,
+ 3975, 2401, 3975, 3975, 3975, 2409, 2416, 2404, 3975, 3975,
+ 2400, 2422, 2422, 2414, 2417, 2417, 3975, 2421, 2421, 2418,
+ 2424, 2441, 2442, 2443, 0, 0, 2453, 0, 2436, 0,
+ 2451, 3975, 3975, 2445, 3975, 3975, 2446, 2457, 2445, 2461,
+ 2464, 2462, 2468, 2473, 2466, 2460, 0, 2462, 2459, 2461,
+ 2483, 0, 2463, 3975, 3975, 3975, 2484, 2488, 2476, 2482,
+ 3975, 2495, 2485, 2497, 2495, 2501, 2506, 2493, 0, 3975,
+ 2496, 3975, 2508, 2498, 2506, 2503, 2506, 2505, 0, 2520,
+ 3975, 3975, 2522, 2514, 0, 0, 2529, 2514, 2515, 0,
+
+ 0, 2533, 2539, 0, 0, 3975, 2601, 2618, 2635, 2652,
+ 2669, 2686, 2703, 2720, 2737, 2754, 2771, 2788, 2805, 2822,
+ 2839, 2856, 2873, 2890, 2907, 2917, 2933, 2942, 2958, 2975,
+ 2986, 3002, 3019, 3036, 3053, 3063, 3079, 3096, 3113, 3127,
+ 3137, 3153, 3170, 3187, 3204, 3215, 2009, 3227, 3244, 3254,
+ 3270, 3287, 3294, 3300, 3316, 3326, 3342, 3359, 3376, 2564,
+ 3386, 3403, 3420, 3437, 3454, 3471, 3488, 3505, 3522, 3532,
+ 3548, 3562, 3572, 3588, 3605, 3622, 3639, 3650, 3662, 3679,
+ 3696, 3713, 3730, 3740, 3749, 3765, 3782, 3799, 2571, 3809,
+ 3826, 3843, 3860, 3877, 3885, 3890, 3906, 3923, 3940, 3957
+
+ } ;
+
+static yyconst flex_int16_t yy_def[1201] =
+ { 0,
+ 1106, 1106, 1107, 1107, 1108, 1109, 1110, 1110, 1111, 1111,
+ 1112, 1112, 1106, 13, 1113, 1113, 1114, 1114, 1115, 1115,
+ 1116, 1116, 1117, 1117, 1106, 25, 1118, 1118, 1119, 1119,
+ 1120, 1120, 1121, 1121, 1106, 35, 1122, 1122, 1123, 1123,
+ 1113, 1113, 1113, 1113, 1124, 1124, 1125, 1125, 1106, 1106,
+ 1106, 1106, 1106, 1126, 1106, 1106, 1106, 1106, 1127, 1106,
+ 1128, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1129, 1130, 1131, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1132, 1133, 1132, 1134, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1135,
+
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1136,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1130, 1106, 1106, 1130, 1137, 1106, 1106, 1106, 1138,
+ 1106, 1130, 1106, 1139, 1106, 1139, 1106, 1140, 1106, 1141,
+ 1141, 1141, 1106, 1106, 1106, 1106, 1142, 1106, 1142, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1143, 1106, 1143, 1106, 1144,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1145, 1106, 1106, 1106, 1146, 1146,
+ 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1147,
+ 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1106,
+
+ 1106, 1148, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1149,
+ 1106, 1149, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1150, 1106, 1106, 1106, 1106, 1106, 1151, 1152, 1106, 1106,
+ 1106, 1106, 1153, 1151, 1154, 1155, 1106, 1156, 1106, 1106,
+ 1106, 1106, 1157, 1106, 1106, 1106, 1106, 1106, 1158, 1158,
+ 1159, 1106, 1106, 1160, 1106, 1106, 1106, 1161, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1162, 1106, 1106, 1106, 1163,
+ 1164, 1164, 1165, 1166, 1167, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1168, 1169, 1106, 1106, 1106, 1106, 1106,
+
+ 1106, 1106, 1170, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1171, 1106, 1172, 1106, 1172, 1106, 1173, 1173, 1173,
+ 1106, 1106, 1174, 1106, 1174, 1106, 1106, 1106, 1106, 1175,
+ 1106, 1106, 1106, 1106, 1106, 1176, 1106, 1106, 1106, 1106,
+ 1177, 1106, 1106, 1106, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1106, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1179, 1106, 1106, 1106,
+ 1106, 1106, 1180, 1106, 1106, 1106, 1106, 1181, 1182, 1183,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1184, 1181, 1185, 1186,
+
+ 1106, 1186, 1106, 1187, 1106, 1187, 1106, 1106, 1188, 1188,
+ 1188, 1106, 1188, 1188, 1106, 1189, 1106, 1106, 1190, 1106,
+ 1106, 1106, 1106, 1191, 1106, 1192, 1193, 1106, 1106, 1194,
+ 1106, 1194, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1196, 1196, 1197, 1106, 1106, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1106, 1106, 1183, 1183, 1106,
+
+ 1183, 1183, 1106, 1106, 1106, 1106, 1184, 1198, 1185, 1106,
+ 1106, 1188, 414, 412, 412, 1188, 414, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1195, 1196, 1196, 1106, 1106, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1106, 1106, 1106, 1106, 1106, 1183,
+
+ 1183, 1106, 1106, 1106, 1198, 1198, 1198, 1106, 511, 511,
+ 1188, 414, 1188, 1188, 1188, 1106, 1106, 1106, 1106, 1106,
+ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1196, 1196, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1106, 1106, 1106,
+ 1106, 1106, 1199, 1106, 1106, 1198, 1106, 1198, 1106, 1188,
+
+ 1188, 1188, 1106, 1106, 1106, 1106, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1196, 1196, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1106, 1178, 1178, 1178, 1106, 1178, 1106,
+ 1106, 1106, 1106, 1199, 1106, 1199, 1106, 1106, 1106, 1106,
+ 1106, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+
+ 1195, 1195, 1195, 1195, 1195, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1106, 1106, 1106, 1106, 1106, 1106, 1178, 1178, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1200, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
+ 1195, 1195, 1195, 1195, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+
+ 1106, 1106, 1178, 1178, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1200, 1106, 1200, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1195, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1178, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1178, 1178, 1178, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1106,
+ 1106, 1106, 1106, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+ 1106, 1106, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
+
+ 1178, 1178, 1178, 1178, 1178, 0, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106
+
+ } ;
+
+static yyconst flex_uint16_t yy_nxt[4060] =
+ { 0,
+ 50, 51, 52, 50, 53, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 50, 50, 50, 50, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 50, 50, 50, 50, 55, 56, 50, 57, 50,
+ 58, 50, 59, 50, 50, 50, 50, 50, 50, 50,
+
+ 50, 60, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 50, 50, 50, 50,
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 50, 50, 50, 63, 64,
+ 291, 65, 66, 83, 67, 84, 89, 68, 69, 70,
+ 70, 89, 1027, 70, 71, 86, 83, 992, 84, 50,
+ 72, 991, 87, 70, 93, 309, 94, 101, 102, 291,
+
+ 103, 101, 102, 990, 103, 113, 989, 114, 119, 315,
+ 120, 121, 148, 119, 149, 120, 121, 115, 50, 73,
+ 74, 116, 116, 116, 116, 148, 90, 149, 91, 228,
+ 229, 90, 230, 91, 309, 93, 95, 94, 276, 124,
+ 125, 99, 126, 96, 97, 283, 98, 284, 75, 70,
+ 70, 76, 77, 316, 78, 66, 988, 67, 79, 122,
+ 68, 69, 70, 70, 122, 95, 70, 71, 124, 125,
+ 290, 126, 96, 80, 260, 261, 70, 95, 128, 201,
+ 129, 221, 202, 222, 96, 97, 117, 98, 410, 411,
+ 223, 130, 320, 415, 415, 203, 203, 203, 203, 987,
+
+ 290, 201, 73, 74, 202, 81, 95, 221, 324, 222,
+ 325, 277, 225, 96, 226, 986, 223, 203, 203, 203,
+ 203, 320, 227, 232, 233, 324, 234, 325, 131, 132,
+ 133, 75, 70, 70, 104, 105, 106, 104, 107, 104,
+ 104, 104, 104, 104, 104, 104, 108, 104, 108, 104,
+ 104, 104, 104, 104, 104, 104, 104, 104, 104, 109,
+ 104, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 110, 104, 104, 104, 104,
+ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+
+ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 104, 104, 104, 113, 128,
+ 114, 129, 291, 151, 235, 152, 263, 263, 985, 151,
+ 115, 152, 130, 153, 116, 116, 116, 116, 157, 153,
+ 158, 159, 157, 366, 158, 159, 225, 333, 226, 254,
+ 254, 291, 255, 401, 334, 402, 227, 265, 264, 266,
+ 319, 236, 267, 267, 267, 267, 290, 343, 344, 131,
+ 132, 133, 366, 154, 405, 155, 406, 298, 299, 154,
+ 300, 155, 305, 305, 305, 305, 431, 264, 432, 160,
+ 319, 236, 324, 160, 325, 984, 290, 343, 344, 117,
+
+ 134, 134, 135, 134, 136, 137, 134, 134, 134, 138,
+ 134, 134, 134, 134, 134, 134, 134, 139, 134, 134,
+ 134, 134, 134, 134, 134, 134, 134, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+ 140, 140, 140, 140, 141, 140, 140, 140, 140, 140,
+ 140, 142, 143, 134, 144, 134, 140, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+ 140, 140, 140, 141, 140, 140, 140, 140, 140, 140,
+ 142, 145, 134, 146, 162, 163, 205, 164, 206, 162,
+ 163, 165, 164, 353, 211, 211, 165, 333, 216, 351,
+
+ 166, 212, 212, 358, 334, 166, 379, 379, 379, 379,
+ 324, 217, 325, 352, 213, 213, 346, 359, 347, 360,
+ 315, 218, 348, 353, 214, 214, 219, 167, 371, 215,
+ 215, 376, 167, 358, 168, 169, 207, 170, 208, 168,
+ 169, 217, 170, 352, 213, 213, 346, 359, 347, 360,
+ 218, 348, 983, 214, 214, 219, 167, 371, 215, 215,
+ 376, 167, 982, 168, 316, 209, 981, 210, 168, 171,
+ 172, 173, 171, 174, 175, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 176, 177,
+ 171, 171, 171, 178, 171, 171, 179, 180, 181, 182,
+
+ 183, 184, 185, 186, 187, 185, 185, 188, 189, 190,
+ 191, 192, 185, 193, 194, 195, 196, 197, 198, 185,
+ 199, 171, 171, 171, 171, 171, 179, 180, 181, 182,
+ 183, 184, 185, 186, 187, 185, 185, 188, 189, 190,
+ 191, 192, 193, 194, 195, 196, 197, 198, 185, 199,
+ 171, 171, 171, 205, 216, 206, 249, 250, 370, 251,
+ 263, 263, 452, 252, 354, 269, 270, 217, 271, 263,
+ 263, 453, 272, 456, 372, 263, 263, 218, 349, 356,
+ 364, 273, 219, 410, 411, 355, 350, 274, 370, 980,
+ 365, 452, 264, 373, 354, 374, 375, 217, 941, 357,
+
+ 453, 264, 456, 207, 372, 208, 218, 264, 349, 356,
+ 364, 219, 387, 361, 355, 398, 350, 362, 235, 275,
+ 365, 264, 408, 373, 940, 374, 375, 425, 357, 939,
+ 264, 428, 209, 429, 210, 238, 264, 253, 228, 229,
+ 367, 230, 387, 361, 412, 398, 253, 362, 232, 233,
+ 368, 234, 408, 369, 239, 236, 240, 425, 240, 249,
+ 250, 428, 251, 429, 240, 938, 252, 240, 241, 242,
+ 367, 240, 243, 244, 410, 411, 937, 245, 298, 299,
+ 368, 300, 369, 936, 239, 236, 240, 935, 240, 445,
+ 446, 934, 390, 391, 240, 392, 933, 240, 241, 242,
+
+ 240, 243, 244, 932, 390, 391, 245, 392, 246, 393,
+ 393, 393, 393, 390, 391, 931, 392, 413, 413, 445,
+ 446, 393, 393, 393, 393, 390, 391, 458, 392, 448,
+ 393, 393, 393, 393, 461, 394, 305, 305, 305, 305,
+ 253, 449, 393, 393, 393, 393, 450, 930, 462, 414,
+ 269, 270, 454, 271, 395, 464, 458, 272, 459, 448,
+ 451, 463, 460, 461, 394, 396, 273, 465, 929, 455,
+ 466, 449, 274, 468, 467, 469, 450, 462, 414, 470,
+ 471, 472, 454, 473, 395, 464, 474, 476, 459, 451,
+ 463, 480, 460, 482, 481, 396, 475, 465, 455, 485,
+
+ 466, 486, 468, 467, 275, 469, 262, 262, 470, 471,
+ 472, 401, 473, 402, 410, 411, 474, 476, 401, 928,
+ 402, 480, 927, 482, 481, 475, 926, 497, 485, 504,
+ 486, 253, 433, 434, 435, 436, 437, 437, 438, 437,
+ 437, 437, 437, 439, 437, 437, 437, 440, 437, 437,
+ 441, 437, 442, 437, 437, 443, 437, 497, 504, 405,
+ 444, 406, 433, 434, 435, 436, 437, 437, 438, 437,
+ 437, 437, 437, 439, 437, 437, 437, 440, 437, 441,
+ 437, 442, 437, 437, 443, 437, 477, 483, 499, 500,
+ 478, 501, 505, 506, 484, 479, 379, 379, 379, 379,
+
+ 508, 405, 431, 406, 432, 502, 502, 502, 502, 510,
+ 511, 925, 520, 512, 512, 924, 477, 483, 548, 923,
+ 478, 505, 922, 506, 484, 479, 487, 521, 488, 522,
+ 508, 489, 490, 503, 391, 921, 392, 491, 492, 510,
+ 410, 411, 520, 493, 494, 513, 523, 548, 495, 409,
+ 393, 393, 393, 393, 920, 496, 487, 521, 488, 522,
+ 919, 489, 490, 519, 519, 519, 519, 491, 492, 431,
+ 914, 432, 493, 494, 513, 913, 523, 495, 409, 409,
+ 861, 409, 409, 409, 409, 409, 409, 409, 409, 409,
+ 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
+
+ 409, 409, 409, 409, 409, 514, 514, 514, 514, 514,
+ 514, 514, 514, 514, 514, 514, 514, 514, 514, 514,
+ 514, 514, 514, 514, 514, 514, 514, 514, 514, 514,
+ 410, 411, 860, 515, 409, 514, 514, 514, 514, 514,
+ 514, 514, 514, 514, 514, 514, 514, 514, 514, 514,
+ 514, 514, 514, 514, 514, 514, 514, 514, 514, 409,
+ 409, 409, 516, 516, 546, 547, 524, 524, 524, 524,
+ 524, 524, 524, 524, 549, 558, 550, 599, 859, 600,
+ 524, 524, 858, 525, 526, 528, 533, 527, 551, 535,
+ 530, 857, 529, 534, 546, 547, 410, 411, 517, 517,
+
+ 517, 517, 531, 549, 558, 532, 550, 517, 517, 517,
+ 517, 517, 517, 525, 526, 528, 533, 527, 551, 535,
+ 530, 529, 552, 534, 560, 553, 554, 555, 556, 856,
+ 557, 531, 410, 411, 532, 559, 855, 517, 517, 517,
+ 517, 517, 517, 1106, 561, 562, 563, 565, 536, 537,
+ 538, 539, 552, 560, 540, 553, 554, 555, 556, 541,
+ 557, 564, 567, 542, 568, 559, 543, 854, 544, 569,
+ 853, 545, 570, 561, 571, 562, 563, 565, 536, 537,
+ 538, 539, 572, 573, 540, 574, 575, 576, 577, 541,
+ 564, 578, 567, 542, 568, 543, 581, 544, 582, 569,
+
+ 545, 579, 570, 583, 571, 584, 585, 580, 586, 587,
+ 606, 588, 572, 573, 589, 574, 575, 576, 577, 590,
+ 591, 578, 592, 593, 852, 594, 581, 582, 598, 851,
+ 595, 579, 583, 596, 597, 584, 585, 580, 586, 587,
+ 588, 500, 602, 600, 589, 503, 391, 603, 392, 590,
+ 591, 619, 592, 593, 594, 604, 499, 500, 598, 501,
+ 595, 608, 596, 597, 601, 500, 599, 501, 600, 410,
+ 411, 259, 602, 502, 502, 502, 502, 603, 410, 411,
+ 619, 502, 502, 502, 502, 604, 601, 500, 850, 501,
+ 607, 608, 409, 409, 848, 409, 409, 409, 409, 409,
+
+ 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
+ 409, 409, 409, 409, 409, 409, 409, 409, 409, 609,
+ 609, 609, 609, 609, 609, 609, 609, 609, 609, 609,
+ 609, 609, 609, 609, 609, 609, 609, 609, 609, 609,
+ 609, 609, 609, 609, 410, 411, 613, 610, 409, 609,
+ 609, 609, 609, 609, 609, 609, 609, 609, 609, 609,
+ 609, 609, 609, 609, 609, 609, 609, 609, 609, 609,
+ 609, 609, 609, 409, 409, 409, 611, 611, 616, 409,
+ 524, 524, 614, 614, 524, 524, 524, 845, 617, 618,
+ 623, 828, 696, 697, 524, 698, 524, 625, 621, 626,
+
+ 622, 775, 629, 776, 817, 624, 524, 700, 616, 628,
+ 410, 411, 612, 612, 612, 612, 410, 411, 617, 618,
+ 623, 612, 612, 612, 612, 612, 612, 625, 621, 626,
+ 622, 524, 629, 627, 624, 806, 524, 524, 524, 628,
+ 409, 524, 630, 781, 632, 644, 643, 524, 524, 636,
+ 780, 612, 612, 612, 612, 612, 612, 615, 615, 615,
+ 615, 631, 627, 633, 634, 524, 615, 615, 615, 615,
+ 615, 615, 630, 524, 632, 644, 643, 779, 646, 636,
+ 524, 645, 647, 635, 524, 649, 524, 524, 650, 651,
+ 652, 631, 653, 633, 634, 637, 615, 615, 615, 615,
+
+ 615, 615, 639, 638, 697, 640, 641, 642, 646, 654,
+ 645, 647, 656, 635, 649, 655, 658, 650, 657, 651,
+ 652, 659, 606, 660, 637, 661, 662, 692, 664, 665,
+ 669, 639, 667, 638, 640, 668, 641, 642, 670, 654,
+ 671, 672, 656, 673, 675, 655, 658, 657, 674, 676,
+ 677, 659, 660, 678, 661, 679, 662, 664, 680, 665,
+ 669, 667, 681, 683, 668, 682, 684, 670, 685, 687,
+ 671, 672, 686, 673, 675, 688, 690, 674, 676, 677,
+ 693, 689, 691, 678, 694, 679, 695, 703, 680, 701,
+ 701, 705, 681, 683, 682, 684, 524, 524, 685, 687,
+
+ 706, 686, 607, 768, 524, 688, 690, 410, 411, 693,
+ 689, 524, 691, 524, 694, 695, 708, 703, 524, 710,
+ 705, 707, 524, 410, 411, 702, 702, 702, 702, 709,
+ 706, 711, 524, 712, 702, 702, 702, 702, 702, 702,
+ 714, 713, 524, 524, 524, 524, 708, 764, 710, 715,
+ 707, 716, 717, 524, 524, 775, 718, 776, 721, 709,
+ 524, 711, 524, 712, 702, 702, 702, 702, 702, 702,
+ 714, 713, 719, 723, 720, 524, 524, 524, 524, 715,
+ 724, 716, 717, 524, 722, 524, 718, 524, 721, 726,
+ 728, 752, 731, 732, 734, 727, 730, 748, 733, 736,
+
+ 741, 738, 719, 723, 720, 725, 735, 729, 743, 740,
+ 724, 739, 742, 722, 744, 745, 746, 747, 749, 726,
+ 728, 731, 750, 732, 734, 727, 730, 733, 751, 736,
+ 741, 738, 753, 754, 725, 755, 735, 729, 740, 756,
+ 739, 757, 742, 744, 758, 745, 746, 747, 749, 759,
+ 761, 750, 760, 762, 763, 765, 766, 767, 751, 769,
+ 770, 753, 754, 771, 755, 772, 773, 777, 778, 756,
+ 757, 696, 697, 758, 698, 410, 411, 409, 524, 759,
+ 761, 760, 762, 524, 763, 765, 766, 767, 524, 769,
+ 770, 524, 771, 410, 411, 772, 773, 777, 778, 524,
+
+ 782, 524, 786, 784, 783, 524, 524, 785, 524, 524,
+ 524, 524, 524, 787, 524, 791, 524, 524, 524, 363,
+ 363, 807, 793, 737, 795, 802, 524, 788, 796, 524,
+ 782, 786, 789, 784, 783, 790, 792, 785, 524, 797,
+ 524, 794, 798, 787, 524, 791, 799, 800, 524, 804,
+ 524, 807, 793, 808, 795, 802, 788, 803, 796, 805,
+ 811, 789, 801, 809, 790, 792, 812, 813, 797, 814,
+ 794, 815, 798, 810, 704, 816, 799, 800, 818, 804,
+ 819, 820, 808, 821, 822, 823, 825, 803, 824, 805,
+ 811, 826, 801, 809, 827, 829, 812, 813, 814, 830,
+
+ 815, 831, 838, 810, 816, 839, 846, 775, 818, 776,
+ 819, 820, 849, 821, 822, 823, 825, 824, 847, 524,
+ 917, 826, 918, 827, 864, 829, 832, 833, 524, 830,
+ 831, 834, 838, 524, 835, 839, 846, 836, 840, 841,
+ 524, 849, 837, 842, 524, 878, 843, 524, 847, 844,
+ 863, 524, 862, 524, 864, 865, 832, 833, 524, 868,
+ 866, 834, 524, 524, 835, 524, 875, 836, 840, 841,
+ 876, 837, 872, 842, 878, 867, 843, 870, 524, 844,
+ 863, 862, 871, 880, 869, 865, 882, 873, 877, 868,
+ 866, 874, 879, 881, 409, 883, 875, 884, 699, 885,
+
+ 876, 886, 872, 887, 867, 888, 870, 889, 890, 891,
+ 892, 871, 880, 869, 894, 882, 873, 895, 877, 896,
+ 902, 874, 879, 881, 883, 901, 893, 884, 885, 903,
+ 904, 886, 887, 905, 907, 888, 906, 889, 890, 891,
+ 892, 897, 692, 911, 894, 898, 895, 912, 899, 896,
+ 902, 915, 943, 908, 901, 893, 909, 524, 900, 903,
+ 904, 944, 946, 905, 907, 906, 910, 945, 947, 948,
+ 950, 897, 911, 949, 951, 898, 912, 952, 899, 953,
+ 915, 942, 943, 908, 954, 955, 909, 900, 956, 666,
+ 957, 944, 946, 958, 959, 910, 945, 960, 947, 948,
+
+ 950, 961, 949, 962, 951, 963, 964, 952, 965, 953,
+ 942, 966, 967, 954, 968, 955, 969, 971, 956, 957,
+ 970, 972, 973, 958, 959, 974, 975, 960, 976, 979,
+ 961, 977, 917, 962, 918, 963, 964, 917, 965, 918,
+ 966, 967, 993, 994, 968, 995, 969, 971, 978, 970,
+ 996, 972, 973, 997, 974, 975, 998, 976, 979, 999,
+ 1000, 977, 1001, 663, 1002, 1003, 1004, 648, 1005, 1006,
+ 1007, 993, 1008, 994, 1009, 995, 1010, 978, 1011, 1012,
+ 996, 1013, 1014, 997, 1015, 1016, 998, 1017, 1018, 999,
+ 1000, 1019, 1001, 1002, 1003, 1020, 1004, 1005, 1021, 1006,
+
+ 1007, 1008, 1022, 1009, 1025, 1010, 1023, 1026, 1011, 1012,
+ 1024, 1013, 1014, 1015, 1016, 1028, 1017, 1029, 1018, 1030,
+ 1031, 1019, 1032, 1033, 1034, 1020, 1035, 1036, 1021, 1037,
+ 1038, 1022, 1039, 1025, 1040, 1023, 1041, 1026, 1042, 1024,
+ 1043, 1044, 1045, 1046, 1047, 1028, 1048, 1029, 1030, 1049,
+ 1031, 1032, 1033, 1034, 1050, 1057, 1035, 1036, 1037, 1038,
+ 1051, 1052, 1039, 1053, 1040, 1054, 1041, 1055, 1042, 1056,
+ 1043, 1044, 1045, 1046, 1047, 1048, 1058, 1059, 1060, 1049,
+ 1061, 620, 1062, 1063, 1050, 1057, 1064, 1065, 1066, 1051,
+ 1052, 1067, 1053, 1068, 1054, 1069, 1055, 1070, 1056, 1071,
+
+ 1072, 1073, 1074, 1075, 409, 1076, 1058, 1059, 1060, 1077,
+ 1061, 1062, 1078, 1063, 1079, 1080, 1064, 1065, 1066, 1081,
+ 1067, 1082, 1083, 1068, 1084, 1069, 1085, 1070, 1086, 1071,
+ 1072, 1073, 1074, 1075, 1076, 1087, 1088, 1089, 1077, 1090,
+ 1091, 1092, 1078, 1079, 1093, 1080, 1094, 566, 1095, 1081,
+ 1082, 1096, 1083, 1097, 1084, 1098, 1085, 1099, 1086, 1100,
+ 1101, 524, 1102, 1103, 1104, 1087, 1088, 1089, 1090, 1091,
+ 1105, 1092, 416, 1093, 416, 420, 1094, 1095, 391, 518,
+ 1096, 518, 1097, 378, 457, 1098, 342, 1099, 1100, 339,
+ 1101, 1102, 1103, 336, 1104, 301, 299, 301, 296, 286,
+
+ 1105, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 62, 62, 62, 62, 62, 62, 62, 62, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 85, 85, 85, 85, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+ 85, 85, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 88, 88, 92,
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
+ 92, 92, 92, 92, 92, 92, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+
+ 100, 100, 100, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
+ 112, 112, 112, 112, 112, 112, 112, 118, 118, 118,
+ 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
+ 118, 118, 118, 118, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 127, 127, 127, 127, 127, 127, 127, 127, 127,
+ 127, 127, 127, 127, 127, 127, 127, 127, 147, 147,
+ 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
+
+ 147, 147, 147, 147, 147, 150, 150, 150, 150, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+ 150, 150, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 200, 200, 200, 200,
+ 200, 200, 200, 200, 200, 200, 200, 200, 200, 200,
+ 200, 200, 200, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204, 204, 204,
+ 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
+
+ 220, 220, 220, 220, 220, 220, 220, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 231, 231, 282, 231, 231, 423,
+ 422, 421, 231, 237, 237, 237, 237, 237, 237, 237,
+ 237, 237, 237, 237, 237, 237, 237, 237, 237, 248,
+ 248, 270, 248, 248, 420, 418, 417, 248, 259, 407,
+ 259, 259, 259, 259, 259, 259, 259, 259, 259, 259,
+ 259, 259, 259, 259, 259, 262, 254, 262, 262, 262,
+ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
+ 262, 262, 268, 268, 268, 403, 268, 268, 250, 233,
+
+ 229, 268, 280, 386, 280, 280, 280, 280, 280, 280,
+ 280, 280, 280, 280, 280, 280, 280, 280, 280, 281,
+ 385, 281, 281, 281, 281, 281, 281, 281, 281, 281,
+ 281, 281, 281, 281, 281, 281, 285, 285, 285, 285,
+ 285, 285, 285, 285, 285, 285, 285, 285, 384, 285,
+ 382, 285, 285, 295, 381, 380, 295, 295, 295, 295,
+ 295, 295, 295, 295, 295, 295, 295, 295, 295, 295,
+ 303, 303, 378, 303, 303, 342, 340, 339, 303, 308,
+ 338, 308, 308, 308, 308, 308, 308, 308, 308, 308,
+ 308, 308, 308, 308, 308, 308, 311, 337, 311, 311,
+
+ 311, 311, 311, 311, 311, 311, 311, 311, 311, 311,
+ 317, 311, 311, 312, 336, 312, 335, 331, 312, 312,
+ 312, 312, 312, 329, 328, 327, 312, 314, 326, 314,
+ 314, 314, 314, 314, 314, 314, 314, 314, 314, 314,
+ 314, 314, 314, 314, 318, 318, 322, 318, 318, 321,
+ 317, 313, 318, 323, 323, 323, 323, 323, 323, 323,
+ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ 330, 307, 330, 310, 330, 330, 330, 330, 330, 330,
+ 330, 330, 330, 307, 330, 330, 330, 332, 306, 332,
+ 332, 332, 332, 332, 332, 332, 332, 332, 332, 332,
+
+ 332, 332, 332, 332, 341, 304, 341, 341, 341, 341,
+ 341, 341, 341, 341, 341, 341, 341, 341, 341, 341,
+ 341, 345, 345, 302, 299, 345, 345, 377, 301, 377,
+ 377, 377, 377, 377, 377, 377, 377, 377, 377, 377,
+ 377, 377, 377, 377, 383, 297, 383, 383, 383, 296,
+ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ 383, 231, 231, 294, 231, 231, 293, 292, 289, 231,
+ 388, 288, 388, 388, 388, 388, 388, 388, 388, 388,
+ 388, 388, 388, 388, 388, 388, 388, 389, 287, 389,
+ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+
+ 389, 389, 389, 389, 397, 397, 286, 282, 279, 397,
+ 399, 399, 278, 270, 258, 399, 400, 400, 400, 400,
+ 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
+ 400, 400, 400, 248, 248, 257, 248, 248, 256, 250,
+ 247, 248, 404, 404, 404, 404, 404, 404, 404, 404,
+ 404, 404, 404, 404, 404, 404, 404, 404, 404, 409,
+ 233, 409, 409, 409, 409, 409, 409, 409, 409, 409,
+ 409, 409, 409, 229, 409, 409, 259, 1106, 259, 259,
+ 259, 259, 259, 259, 259, 259, 259, 259, 259, 259,
+ 259, 259, 259, 419, 419, 111, 419, 419, 111, 1106,
+
+ 1106, 419, 419, 424, 1106, 424, 424, 424, 424, 424,
+ 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
+ 280, 1106, 280, 280, 280, 280, 280, 280, 280, 280,
+ 280, 280, 280, 280, 280, 280, 280, 281, 1106, 281,
+ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281,
+ 281, 281, 281, 281, 426, 1106, 426, 426, 426, 426,
+ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ 426, 427, 1106, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 285, 285,
+ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
+
+ 1106, 285, 1106, 285, 285, 430, 430, 430, 430, 430,
+ 430, 430, 430, 430, 430, 430, 430, 430, 430, 430,
+ 430, 430, 295, 1106, 1106, 295, 295, 295, 295, 295,
+ 295, 295, 295, 295, 295, 295, 295, 295, 295, 303,
+ 303, 1106, 303, 303, 1106, 1106, 1106, 303, 312, 1106,
+ 312, 1106, 1106, 312, 312, 312, 312, 312, 1106, 1106,
+ 1106, 312, 314, 1106, 314, 314, 314, 314, 314, 314,
+ 314, 314, 314, 314, 314, 314, 314, 314, 314, 318,
+ 318, 1106, 318, 318, 1106, 1106, 1106, 318, 323, 323,
+ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+
+ 323, 323, 323, 323, 323, 330, 1106, 330, 1106, 330,
+ 330, 330, 330, 330, 330, 330, 330, 330, 1106, 330,
+ 330, 330, 447, 1106, 447, 447, 447, 447, 447, 447,
+ 447, 447, 447, 447, 447, 447, 447, 447, 447, 341,
+ 1106, 341, 341, 341, 341, 341, 341, 341, 341, 341,
+ 341, 341, 341, 341, 341, 341, 345, 345, 1106, 1106,
+ 345, 345, 377, 1106, 377, 377, 377, 377, 377, 377,
+ 377, 377, 377, 377, 377, 377, 377, 377, 377, 383,
+ 1106, 383, 383, 383, 1106, 383, 383, 383, 383, 383,
+ 383, 383, 383, 383, 383, 383, 388, 1106, 388, 388,
+
+ 388, 388, 388, 388, 388, 388, 388, 388, 388, 388,
+ 388, 388, 388, 389, 1106, 389, 389, 389, 389, 389,
+ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ 498, 498, 498, 498, 498, 498, 498, 498, 498, 498,
+ 498, 498, 498, 498, 498, 498, 498, 507, 507, 1106,
+ 507, 507, 1106, 1106, 1106, 507, 509, 509, 1106, 509,
+ 509, 1106, 1106, 1106, 509, 400, 400, 400, 400, 400,
+ 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
+ 400, 400, 404, 404, 404, 404, 404, 404, 404, 404,
+ 404, 404, 404, 404, 404, 404, 404, 404, 404, 409,
+
+ 1106, 409, 409, 409, 409, 409, 409, 409, 409, 409,
+ 409, 409, 409, 1106, 409, 409, 419, 419, 1106, 419,
+ 419, 1106, 1106, 1106, 419, 419, 424, 1106, 424, 424,
+ 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
+ 424, 424, 424, 426, 1106, 426, 426, 426, 426, 426,
+ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ 427, 1106, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 430, 430, 430,
+ 430, 430, 430, 430, 430, 430, 430, 430, 430, 430,
+ 430, 430, 430, 430, 437, 437, 437, 318, 318, 1106,
+
+ 318, 318, 1106, 1106, 1106, 318, 447, 1106, 447, 447,
+ 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
+ 447, 447, 447, 605, 1106, 605, 605, 605, 605, 605,
+ 605, 605, 605, 605, 605, 605, 605, 605, 605, 605,
+ 774, 774, 774, 774, 774, 774, 774, 774, 774, 774,
+ 774, 774, 774, 774, 774, 774, 774, 916, 916, 916,
+ 916, 916, 916, 916, 916, 916, 916, 916, 916, 916,
+ 916, 916, 916, 916, 49, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106
+ } ;
+
+static yyconst flex_int16_t yy_chk[4060] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3,
+ 96, 3, 3, 5, 3, 5, 7, 3, 3, 3,
+ 3, 8, 992, 3, 3, 6, 6, 942, 6, 21,
+ 3, 941, 6, 3, 9, 126, 9, 11, 11, 96,
+
+ 11, 12, 12, 940, 12, 17, 939, 17, 19, 138,
+ 19, 19, 27, 20, 27, 20, 20, 17, 22, 3,
+ 3, 17, 17, 17, 17, 28, 7, 28, 7, 51,
+ 51, 8, 51, 8, 126, 10, 9, 10, 79, 21,
+ 21, 10, 21, 9, 9, 87, 9, 87, 3, 3,
+ 3, 4, 4, 138, 4, 4, 938, 4, 4, 19,
+ 4, 4, 4, 4, 20, 9, 4, 4, 22, 22,
+ 95, 22, 9, 4, 73, 73, 4, 10, 23, 37,
+ 23, 45, 37, 45, 10, 10, 17, 10, 259, 259,
+ 45, 23, 142, 263, 263, 37, 37, 37, 37, 937,
+
+ 95, 38, 4, 4, 38, 4, 10, 46, 147, 46,
+ 147, 79, 47, 10, 47, 936, 46, 38, 38, 38,
+ 38, 142, 47, 55, 55, 149, 55, 149, 23, 23,
+ 23, 4, 4, 4, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 18, 24,
+ 18, 24, 168, 29, 58, 29, 74, 74, 935, 30,
+ 18, 30, 24, 29, 18, 18, 18, 18, 31, 30,
+ 31, 31, 32, 191, 32, 32, 48, 162, 48, 67,
+ 67, 168, 67, 246, 162, 246, 48, 75, 74, 75,
+ 141, 58, 75, 75, 75, 75, 167, 176, 177, 24,
+ 24, 24, 191, 29, 253, 29, 253, 105, 105, 30,
+ 105, 30, 116, 116, 116, 116, 294, 74, 294, 31,
+ 141, 58, 323, 32, 323, 934, 167, 176, 177, 18,
+
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 33, 33, 39, 33, 39, 34,
+ 34, 33, 34, 182, 41, 42, 34, 333, 43, 181,
+
+ 33, 41, 42, 186, 333, 34, 203, 203, 203, 203,
+ 325, 43, 325, 181, 41, 42, 179, 187, 179, 188,
+ 314, 43, 179, 182, 41, 42, 43, 33, 194, 41,
+ 42, 199, 34, 186, 33, 33, 39, 33, 39, 34,
+ 34, 43, 34, 181, 41, 42, 179, 187, 179, 188,
+ 43, 179, 933, 41, 42, 43, 33, 194, 41, 42,
+ 199, 34, 932, 33, 314, 39, 931, 39, 34, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 40, 44, 40, 63, 63, 193, 63,
+ 122, 122, 347, 63, 183, 76, 76, 44, 76, 125,
+ 125, 348, 76, 350, 195, 132, 132, 44, 180, 184,
+ 190, 76, 44, 409, 409, 183, 180, 76, 193, 930,
+ 190, 347, 122, 196, 183, 197, 198, 44, 873, 184,
+
+ 348, 125, 350, 40, 195, 40, 44, 132, 180, 184,
+ 190, 44, 236, 189, 183, 244, 180, 189, 235, 76,
+ 190, 122, 258, 196, 872, 197, 198, 278, 184, 871,
+ 125, 290, 40, 291, 40, 59, 132, 63, 228, 228,
+ 192, 228, 236, 189, 260, 244, 76, 189, 232, 232,
+ 192, 232, 258, 192, 59, 235, 59, 278, 59, 249,
+ 249, 290, 249, 291, 59, 870, 249, 59, 59, 59,
+ 192, 59, 59, 59, 260, 260, 869, 59, 298, 298,
+ 192, 298, 192, 868, 59, 235, 59, 867, 59, 319,
+ 320, 866, 239, 239, 59, 239, 865, 59, 59, 59,
+
+ 59, 59, 59, 864, 240, 240, 59, 240, 59, 239,
+ 239, 239, 239, 241, 241, 863, 241, 261, 261, 319,
+ 320, 240, 240, 240, 240, 242, 242, 352, 242, 343,
+ 241, 241, 241, 241, 354, 239, 305, 305, 305, 305,
+ 249, 344, 242, 242, 242, 242, 346, 862, 355, 261,
+ 269, 269, 349, 269, 241, 357, 352, 269, 353, 343,
+ 346, 356, 353, 354, 239, 242, 269, 358, 861, 349,
+ 359, 344, 269, 360, 359, 361, 346, 355, 261, 362,
+ 364, 366, 349, 367, 241, 357, 368, 369, 353, 346,
+ 356, 371, 353, 372, 371, 242, 368, 358, 349, 374,
+
+ 359, 375, 360, 359, 269, 361, 415, 415, 362, 364,
+ 366, 400, 367, 400, 614, 614, 368, 369, 402, 860,
+ 402, 371, 859, 372, 371, 368, 858, 387, 374, 394,
+ 375, 269, 307, 307, 307, 307, 307, 307, 307, 307,
+ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307,
+ 307, 307, 307, 307, 307, 307, 307, 387, 394, 404,
+ 307, 404, 307, 307, 307, 307, 307, 307, 307, 307,
+ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307,
+ 307, 307, 307, 307, 307, 307, 370, 373, 390, 390,
+ 370, 390, 395, 396, 373, 370, 379, 379, 379, 379,
+
+ 398, 406, 430, 406, 430, 390, 390, 390, 390, 408,
+ 410, 857, 423, 411, 411, 856, 370, 373, 448, 855,
+ 370, 395, 854, 396, 373, 370, 376, 425, 376, 428,
+ 398, 376, 376, 393, 393, 853, 393, 376, 376, 408,
+ 410, 410, 423, 376, 376, 411, 429, 448, 376, 411,
+ 393, 393, 393, 393, 852, 376, 376, 425, 376, 428,
+ 851, 376, 376, 420, 420, 420, 420, 376, 376, 432,
+ 847, 432, 376, 376, 411, 846, 429, 376, 412, 412,
+ 792, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 791, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
+ 412, 412, 413, 413, 445, 446, 441, 433, 434, 435,
+ 438, 439, 436, 442, 449, 459, 450, 498, 790, 498,
+ 440, 443, 789, 433, 434, 436, 441, 435, 451, 443,
+ 439, 788, 438, 442, 445, 446, 413, 413, 414, 414,
+
+ 414, 414, 440, 449, 459, 440, 450, 414, 414, 414,
+ 414, 414, 414, 433, 434, 436, 441, 435, 451, 443,
+ 439, 438, 452, 442, 462, 453, 454, 455, 456, 787,
+ 458, 440, 414, 414, 440, 460, 786, 414, 414, 414,
+ 414, 414, 414, 444, 463, 464, 465, 467, 444, 444,
+ 444, 444, 452, 462, 444, 453, 454, 455, 456, 444,
+ 458, 466, 469, 444, 470, 460, 444, 785, 444, 471,
+ 784, 444, 472, 463, 473, 464, 465, 467, 444, 444,
+ 444, 444, 474, 475, 444, 476, 477, 478, 479, 444,
+ 466, 480, 469, 444, 470, 444, 482, 444, 483, 471,
+
+ 444, 481, 472, 484, 473, 485, 486, 481, 487, 488,
+ 508, 489, 474, 475, 490, 476, 477, 478, 479, 491,
+ 492, 480, 493, 494, 783, 495, 482, 483, 497, 782,
+ 496, 481, 484, 496, 496, 485, 486, 481, 487, 488,
+ 489, 501, 504, 501, 490, 503, 503, 505, 503, 491,
+ 492, 523, 493, 494, 495, 506, 499, 499, 497, 499,
+ 496, 510, 496, 496, 502, 502, 600, 502, 600, 613,
+ 613, 613, 504, 499, 499, 499, 499, 505, 615, 615,
+ 523, 502, 502, 502, 502, 506, 601, 601, 780, 601,
+ 508, 510, 511, 511, 773, 511, 511, 511, 511, 511,
+
+ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 514, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
+ 511, 511, 511, 511, 511, 511, 512, 512, 520, 514,
+ 525, 527, 516, 516, 532, 526, 528, 770, 521, 522,
+ 526, 758, 607, 607, 529, 607, 531, 528, 525, 529,
+
+ 525, 693, 532, 693, 744, 527, 530, 609, 520, 531,
+ 512, 512, 513, 513, 513, 513, 516, 516, 521, 522,
+ 526, 513, 513, 513, 513, 513, 513, 528, 525, 529,
+ 525, 535, 532, 530, 527, 733, 539, 533, 545, 531,
+ 609, 534, 533, 704, 535, 546, 545, 536, 537, 539,
+ 703, 513, 513, 513, 513, 513, 513, 517, 517, 517,
+ 517, 534, 530, 536, 537, 538, 517, 517, 517, 517,
+ 517, 517, 533, 540, 535, 546, 545, 699, 550, 539,
+ 542, 547, 551, 538, 541, 553, 543, 544, 554, 555,
+ 556, 534, 557, 536, 537, 540, 517, 517, 517, 517,
+
+ 517, 517, 542, 541, 698, 542, 543, 544, 550, 557,
+ 547, 551, 558, 538, 553, 557, 560, 554, 559, 555,
+ 556, 563, 606, 564, 540, 565, 566, 692, 569, 570,
+ 574, 542, 572, 541, 542, 573, 543, 544, 576, 557,
+ 577, 578, 558, 579, 581, 557, 560, 559, 580, 582,
+ 583, 563, 564, 584, 565, 586, 566, 569, 587, 570,
+ 574, 572, 588, 590, 573, 589, 591, 576, 592, 594,
+ 577, 578, 593, 579, 581, 595, 596, 580, 582, 583,
+ 602, 595, 597, 584, 603, 586, 604, 616, 587, 611,
+ 611, 618, 588, 590, 589, 591, 621, 624, 592, 594,
+
+ 619, 593, 606, 686, 622, 595, 596, 701, 701, 602,
+ 595, 623, 597, 626, 603, 604, 622, 616, 625, 624,
+ 618, 621, 628, 611, 611, 612, 612, 612, 612, 623,
+ 619, 625, 627, 626, 612, 612, 612, 612, 612, 612,
+ 628, 627, 629, 631, 630, 632, 622, 682, 624, 629,
+ 621, 630, 631, 634, 633, 774, 632, 774, 634, 623,
+ 635, 625, 636, 626, 612, 612, 612, 612, 612, 612,
+ 628, 627, 633, 636, 633, 637, 639, 640, 638, 629,
+ 637, 630, 631, 643, 635, 641, 632, 642, 634, 639,
+ 641, 668, 644, 645, 648, 640, 643, 664, 647, 650,
+
+ 655, 653, 633, 636, 633, 638, 648, 642, 658, 654,
+ 637, 653, 657, 635, 659, 661, 662, 663, 665, 639,
+ 641, 644, 666, 645, 648, 640, 643, 647, 667, 650,
+ 655, 653, 669, 670, 638, 671, 648, 642, 654, 673,
+ 653, 674, 657, 659, 675, 661, 662, 663, 665, 676,
+ 679, 666, 678, 680, 681, 683, 684, 685, 667, 687,
+ 688, 669, 670, 689, 671, 690, 691, 694, 695, 673,
+ 674, 696, 696, 675, 696, 700, 700, 700, 711, 676,
+ 679, 678, 680, 707, 681, 683, 684, 685, 709, 687,
+ 688, 710, 689, 702, 702, 690, 691, 694, 695, 708,
+
+ 707, 712, 711, 709, 708, 713, 716, 710, 714, 718,
+ 721, 715, 720, 712, 717, 716, 719, 722, 727, 1147,
+ 1147, 734, 718, 652, 720, 727, 724, 713, 721, 723,
+ 707, 711, 714, 709, 708, 715, 717, 710, 725, 722,
+ 729, 719, 723, 712, 726, 716, 724, 725, 730, 729,
+ 728, 734, 718, 735, 720, 727, 713, 728, 721, 730,
+ 738, 714, 726, 737, 715, 717, 739, 740, 722, 741,
+ 719, 742, 723, 737, 617, 743, 724, 725, 745, 729,
+ 746, 747, 735, 748, 749, 750, 752, 728, 751, 730,
+ 738, 754, 726, 737, 756, 760, 739, 740, 741, 761,
+
+ 742, 762, 765, 737, 743, 767, 771, 776, 745, 776,
+ 746, 747, 778, 748, 749, 750, 752, 751, 772, 795,
+ 849, 754, 849, 756, 795, 760, 764, 764, 793, 761,
+ 762, 764, 765, 794, 764, 767, 771, 764, 768, 768,
+ 796, 778, 764, 768, 797, 809, 768, 799, 772, 768,
+ 794, 798, 793, 801, 795, 796, 764, 764, 802, 799,
+ 797, 764, 800, 803, 764, 804, 806, 764, 768, 768,
+ 807, 764, 803, 768, 809, 798, 768, 801, 805, 768,
+ 794, 793, 802, 811, 800, 796, 814, 804, 808, 799,
+ 797, 805, 810, 812, 610, 816, 806, 817, 608, 818,
+
+ 807, 819, 803, 820, 798, 821, 801, 823, 825, 826,
+ 828, 802, 811, 800, 832, 814, 804, 833, 808, 834,
+ 837, 805, 810, 812, 816, 836, 828, 817, 818, 838,
+ 839, 819, 820, 840, 842, 821, 841, 823, 825, 826,
+ 828, 835, 598, 844, 832, 835, 833, 845, 835, 834,
+ 837, 848, 875, 843, 836, 828, 843, 874, 835, 838,
+ 839, 876, 878, 840, 842, 841, 843, 877, 879, 880,
+ 883, 835, 844, 881, 884, 835, 845, 885, 835, 886,
+ 848, 874, 875, 843, 888, 889, 843, 835, 890, 571,
+ 891, 876, 878, 892, 893, 843, 877, 894, 879, 880,
+
+ 883, 895, 881, 897, 884, 898, 899, 885, 900, 886,
+ 874, 901, 902, 888, 904, 889, 905, 908, 890, 891,
+ 906, 909, 910, 892, 893, 911, 912, 894, 913, 915,
+ 895, 914, 916, 897, 916, 898, 899, 918, 900, 918,
+ 901, 902, 943, 944, 904, 945, 905, 908, 914, 906,
+ 946, 909, 910, 947, 911, 912, 948, 913, 915, 949,
+ 950, 914, 951, 568, 952, 953, 954, 552, 955, 956,
+ 958, 943, 959, 944, 960, 945, 961, 914, 962, 963,
+ 946, 964, 965, 947, 967, 969, 948, 970, 971, 949,
+ 950, 972, 951, 952, 953, 973, 954, 955, 975, 956,
+
+ 958, 959, 976, 960, 978, 961, 977, 979, 962, 963,
+ 977, 964, 965, 967, 969, 993, 970, 994, 971, 995,
+ 996, 972, 997, 998, 999, 973, 1001, 1002, 975, 1004,
+ 1005, 976, 1006, 978, 1007, 977, 1008, 979, 1009, 977,
+ 1010, 1012, 1016, 1017, 1018, 993, 1021, 994, 995, 1022,
+ 996, 997, 998, 999, 1023, 1031, 1001, 1002, 1004, 1005,
+ 1024, 1025, 1006, 1026, 1007, 1028, 1008, 1029, 1009, 1030,
+ 1010, 1012, 1016, 1017, 1018, 1021, 1032, 1033, 1034, 1022,
+ 1037, 524, 1039, 1041, 1023, 1031, 1044, 1047, 1048, 1024,
+ 1025, 1049, 1026, 1050, 1028, 1051, 1029, 1052, 1030, 1053,
+
+ 1054, 1055, 1056, 1058, 515, 1059, 1032, 1033, 1034, 1060,
+ 1037, 1039, 1061, 1041, 1063, 1067, 1044, 1047, 1048, 1068,
+ 1049, 1069, 1070, 1050, 1072, 1051, 1073, 1052, 1074, 1053,
+ 1054, 1055, 1056, 1058, 1059, 1075, 1076, 1077, 1060, 1078,
+ 1081, 1083, 1061, 1063, 1084, 1067, 1085, 468, 1086, 1068,
+ 1069, 1087, 1070, 1088, 1072, 1090, 1073, 1093, 1074, 1094,
+ 1097, 437, 1098, 1099, 1102, 1075, 1076, 1077, 1078, 1081,
+ 1103, 1083, 1160, 1084, 1160, 419, 1085, 1086, 392, 1189,
+ 1087, 1189, 1088, 377, 351, 1090, 341, 1093, 1094, 339,
+ 1097, 1098, 1099, 334, 1102, 301, 300, 299, 296, 285,
+
+ 1103, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107,
+ 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1108, 1108,
+ 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108,
+ 1108, 1108, 1108, 1108, 1108, 1109, 1109, 1109, 1109, 1109,
+ 1109, 1109, 1109, 1109, 1109, 1109, 1109, 1109, 1109, 1109,
+ 1109, 1109, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
+ 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1111,
+ 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111,
+ 1111, 1111, 1111, 1111, 1111, 1111, 1112, 1112, 1112, 1112,
+ 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112,
+
+ 1112, 1112, 1112, 1113, 1113, 1113, 1113, 1113, 1113, 1113,
+ 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113,
+ 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114,
+ 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1115, 1115, 1115,
+ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
+ 1115, 1115, 1115, 1115, 1116, 1116, 1116, 1116, 1116, 1116,
+ 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
+ 1116, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
+ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1118, 1118,
+ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
+
+ 1118, 1118, 1118, 1118, 1118, 1119, 1119, 1119, 1119, 1119,
+ 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119,
+ 1119, 1119, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
+ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1121,
+ 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121,
+ 1121, 1121, 1121, 1121, 1121, 1121, 1122, 1122, 1122, 1122,
+ 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122,
+ 1122, 1122, 1122, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
+ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123,
+ 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124,
+
+ 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1125, 1125, 1125,
+ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125,
+ 1125, 1125, 1125, 1125, 1126, 1126, 282, 1126, 1126, 274,
+ 273, 272, 1126, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
+ 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1128,
+ 1128, 271, 1128, 1128, 268, 266, 265, 1128, 1129, 256,
+ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129,
+ 1129, 1129, 1129, 1129, 1129, 1130, 255, 1130, 1130, 1130,
+ 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130,
+ 1130, 1130, 1131, 1131, 1131, 252, 1131, 1131, 251, 234,
+
+ 230, 1131, 1132, 227, 1132, 1132, 1132, 1132, 1132, 1132,
+ 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1133,
+ 226, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133,
+ 1133, 1133, 1133, 1133, 1133, 1133, 1134, 1134, 1134, 1134,
+ 1134, 1134, 1134, 1134, 1134, 1134, 1134, 1134, 222, 1134,
+ 208, 1134, 1134, 1135, 207, 206, 1135, 1135, 1135, 1135,
+ 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135,
+ 1136, 1136, 202, 1136, 1136, 175, 174, 172, 1136, 1137,
+ 170, 1137, 1137, 1137, 1137, 1137, 1137, 1137, 1137, 1137,
+ 1137, 1137, 1137, 1137, 1137, 1137, 1138, 169, 1138, 1138,
+
+ 1138, 1138, 1138, 1138, 1138, 1138, 1138, 1138, 1138, 1138,
+ 166, 1138, 1138, 1139, 165, 1139, 164, 158, 1139, 1139,
+ 1139, 1139, 1139, 155, 154, 153, 1139, 1140, 152, 1140,
+ 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140,
+ 1140, 1140, 1140, 1140, 1141, 1141, 144, 1141, 1141, 143,
+ 139, 136, 1141, 1142, 1142, 1142, 1142, 1142, 1142, 1142,
+ 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142,
+ 1143, 131, 1143, 129, 1143, 1143, 1143, 1143, 1143, 1143,
+ 1143, 1143, 1143, 124, 1143, 1143, 1143, 1144, 120, 1144,
+ 1144, 1144, 1144, 1144, 1144, 1144, 1144, 1144, 1144, 1144,
+
+ 1144, 1144, 1144, 1144, 1145, 114, 1145, 1145, 1145, 1145,
+ 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145,
+ 1145, 1146, 1146, 109, 107, 1146, 1146, 1148, 106, 1148,
+ 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1148,
+ 1148, 1148, 1148, 1148, 1149, 103, 1149, 1149, 1149, 101,
+ 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1149,
+ 1149, 1150, 1150, 99, 1150, 1150, 98, 97, 94, 1150,
+ 1151, 91, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151,
+ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1152, 90, 1152,
+ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
+
+ 1152, 1152, 1152, 1152, 1153, 1153, 88, 86, 84, 1153,
+ 1154, 1154, 80, 78, 72, 1154, 1155, 1155, 1155, 1155,
+ 1155, 1155, 1155, 1155, 1155, 1155, 1155, 1155, 1155, 1155,
+ 1155, 1155, 1155, 1156, 1156, 71, 1156, 1156, 68, 65,
+ 60, 1156, 1157, 1157, 1157, 1157, 1157, 1157, 1157, 1157,
+ 1157, 1157, 1157, 1157, 1157, 1157, 1157, 1157, 1157, 1158,
+ 57, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158,
+ 1158, 1158, 1158, 53, 1158, 1158, 1159, 49, 1159, 1159,
+ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
+ 1159, 1159, 1159, 1161, 1161, 16, 1161, 1161, 15, 0,
+
+ 0, 1161, 1161, 1162, 0, 1162, 1162, 1162, 1162, 1162,
+ 1162, 1162, 1162, 1162, 1162, 1162, 1162, 1162, 1162, 1162,
+ 1163, 0, 1163, 1163, 1163, 1163, 1163, 1163, 1163, 1163,
+ 1163, 1163, 1163, 1163, 1163, 1163, 1163, 1164, 0, 1164,
+ 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164,
+ 1164, 1164, 1164, 1164, 1165, 0, 1165, 1165, 1165, 1165,
+ 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165,
+ 1165, 1166, 0, 1166, 1166, 1166, 1166, 1166, 1166, 1166,
+ 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1167, 1167,
+ 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1167,
+
+ 0, 1167, 0, 1167, 1167, 1168, 1168, 1168, 1168, 1168,
+ 1168, 1168, 1168, 1168, 1168, 1168, 1168, 1168, 1168, 1168,
+ 1168, 1168, 1169, 0, 0, 1169, 1169, 1169, 1169, 1169,
+ 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1169, 1170,
+ 1170, 0, 1170, 1170, 0, 0, 0, 1170, 1171, 0,
+ 1171, 0, 0, 1171, 1171, 1171, 1171, 1171, 0, 0,
+ 0, 1171, 1172, 0, 1172, 1172, 1172, 1172, 1172, 1172,
+ 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1173,
+ 1173, 0, 1173, 1173, 0, 0, 0, 1173, 1174, 1174,
+ 1174, 1174, 1174, 1174, 1174, 1174, 1174, 1174, 1174, 1174,
+
+ 1174, 1174, 1174, 1174, 1174, 1175, 0, 1175, 0, 1175,
+ 1175, 1175, 1175, 1175, 1175, 1175, 1175, 1175, 0, 1175,
+ 1175, 1175, 1176, 0, 1176, 1176, 1176, 1176, 1176, 1176,
+ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1177,
+ 0, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 1177,
+ 1177, 1177, 1177, 1177, 1177, 1177, 1178, 1178, 0, 0,
+ 1178, 1178, 1179, 0, 1179, 1179, 1179, 1179, 1179, 1179,
+ 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1180,
+ 0, 1180, 1180, 1180, 0, 1180, 1180, 1180, 1180, 1180,
+ 1180, 1180, 1180, 1180, 1180, 1180, 1181, 0, 1181, 1181,
+
+ 1181, 1181, 1181, 1181, 1181, 1181, 1181, 1181, 1181, 1181,
+ 1181, 1181, 1181, 1182, 0, 1182, 1182, 1182, 1182, 1182,
+ 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182, 1182,
+ 1183, 1183, 1183, 1183, 1183, 1183, 1183, 1183, 1183, 1183,
+ 1183, 1183, 1183, 1183, 1183, 1183, 1183, 1184, 1184, 0,
+ 1184, 1184, 0, 0, 0, 1184, 1185, 1185, 0, 1185,
+ 1185, 0, 0, 0, 1185, 1186, 1186, 1186, 1186, 1186,
+ 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186,
+ 1186, 1186, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187,
+ 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1188,
+
+ 0, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
+ 1188, 1188, 1188, 0, 1188, 1188, 1190, 1190, 0, 1190,
+ 1190, 0, 0, 0, 1190, 1190, 1191, 0, 1191, 1191,
+ 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1191,
+ 1191, 1191, 1191, 1192, 0, 1192, 1192, 1192, 1192, 1192,
+ 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192, 1192,
+ 1193, 0, 1193, 1193, 1193, 1193, 1193, 1193, 1193, 1193,
+ 1193, 1193, 1193, 1193, 1193, 1193, 1193, 1194, 1194, 1194,
+ 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1194,
+ 1194, 1194, 1194, 1194, 1195, 1195, 1195, 1196, 1196, 0,
+
+ 1196, 1196, 0, 0, 0, 1196, 1197, 0, 1197, 1197,
+ 1197, 1197, 1197, 1197, 1197, 1197, 1197, 1197, 1197, 1197,
+ 1197, 1197, 1197, 1198, 0, 1198, 1198, 1198, 1198, 1198,
+ 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198,
+ 1199, 1199, 1199, 1199, 1199, 1199, 1199, 1199, 1199, 1199,
+ 1199, 1199, 1199, 1199, 1199, 1199, 1199, 1200, 1200, 1200,
+ 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200,
+ 1200, 1200, 1200, 1200, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
+ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106
+ } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+extern int yy_flex_debug;
+int yy_flex_debug = 0;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+static int yy_more_flag = 0;
+static int yy_more_len = 0;
+#define yymore() ((yy_more_flag) = 1)
+#define YY_MORE_ADJ (yy_more_len)
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "scan.l"
+/* scan.l - scanner for flex input -*-C-*- */
+#line 4 "scan.l"
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+#include "parse.h"
+extern bool tablesverify, tablesext;
+extern int trlcontxt; /* Set in parse.y for each rule. */
+extern const char *escaped_qstart, *escaped_qend;
+
+#define ACTION_ECHO add_action( yytext )
+#define ACTION_IFDEF(def, should_define) \
+ { \
+ if ( should_define ) \
+ action_define( def, 1 ); \
+ }
+
+#define ACTION_ECHO_QSTART add_action (escaped_qstart)
+#define ACTION_ECHO_QEND add_action (escaped_qend)
+
+#define ACTION_M4_IFDEF(def, should_define) \
+ do{ \
+ if ( should_define ) \
+ buf_m4_define( &m4defs_buf, def, NULL);\
+ else \
+ buf_m4_undefine( &m4defs_buf, def);\
+ } while(0)
+
+#define MARK_END_OF_PROLOG mark_prolog();
+
+#define YY_DECL \
+ int flexscan()
+
+#define RETURNCHAR \
+ yylval = (unsigned char) yytext[0]; \
+ return CHAR;
+
+#define RETURNNAME \
+ if(yyleng < MAXLINE) \
+ { \
+ strcpy( nmstr, yytext ); \
+ } \
+ else \
+ { \
+ synerr(_("Input line too long\n")); \
+ FLEX_EXIT(EXIT_FAILURE); \
+ } \
+ return NAME;
+
+#define PUT_BACK_STRING(str, start) \
+ for ( i = strlen( str ) - 1; i >= start; --i ) \
+ unput((str)[i])
+
+#define CHECK_REJECT(str) \
+ if ( all_upper( str ) ) \
+ reject = true;
+
+#define CHECK_YYMORE(str) \
+ if ( all_lower( str ) ) \
+ yymore_used = true;
+
+#define YY_USER_INIT \
+ if ( getenv("POSIXLY_CORRECT") ) \
+ posix_compat = true;
+
+
+
+
+
+
+
+
+#line 1850 "scan.c"
+
+#define INITIAL 0
+#define SECT2 1
+#define SECT2PROLOG 2
+#define SECT3 3
+#define CODEBLOCK 4
+#define PICKUPDEF 5
+#define SC 6
+#define CARETISBOL 7
+#define NUM 8
+#define QUOTE 9
+#define FIRSTCCL 10
+#define CCL 11
+#define ACTION 12
+#define RECOVER 13
+#define COMMENT 14
+#define ACTION_STRING 15
+#define PERCENT_BRACE_ACTION 16
+#define OPTION 17
+#define LINEDIR 18
+#define CODEBLOCK_MATCH_BRACE 19
+#define GROUP_WITH_PARAMS 20
+#define GROUP_MINUS_PARAMS 21
+#define EXTENDED_COMMENT 22
+#define COMMENT_DISCARD 23
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+static int yy_init_globals (void );
+
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (void );
+
+int yyget_debug (void );
+
+void yyset_debug (int debug_flag );
+
+YY_EXTRA_TYPE yyget_extra (void );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined );
+
+FILE *yyget_in (void );
+
+void yyset_in (FILE * _in_str );
+
+FILE *yyget_out (void );
+
+void yyset_out (FILE * _out_str );
+
+yy_size_t yyget_leng (void );
+
+char *yyget_text (void );
+
+int yyget_lineno (void );
+
+void yyset_lineno (int _line_number );
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap (void );
+#else
+extern int yywrap (void );
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+
+ static void yyunput (int c,char *buf_ptr );
+
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (void );
+#else
+static int input (void );
+#endif
+
+#endif
+
+ static int yy_start_stack_ptr = 0;
+ static int yy_start_stack_depth = 0;
+ static int *yy_start_stack = NULL;
+
+ static void yy_push_state (int _new_state );
+
+ static void yy_pop_state (void );
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
+#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ { \
+ int c = '*'; \
+ size_t n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else \
+ { \
+ errno=0; \
+ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+ { \
+ if( errno != EINTR) \
+ { \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ break; \
+ } \
+ errno=0; \
+ clearerr(yyin); \
+ } \
+ }\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int yylex (void);
+
+#define YY_DECL int yylex (void)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK /*LINTED*/break;
+#endif
+
+#define YY_RULE_SETUP \
+ if ( yyleng > 0 ) \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
+ (yytext[yyleng - 1] == '\n'); \
+ YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
+
+ if ( !(yy_init) )
+ {
+ (yy_init) = 1;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! (yy_start) )
+ (yy_start) = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_load_buffer_state( );
+ }
+
+ {
+#line 131 "scan.l"
+
+ static int bracelevel, didadef, indented_code;
+ static int doing_rule_action = false;
+ static int option_sense;
+
+ int doing_codeblock = false;
+ int i, brace_depth=0, brace_start_line=0;
+ Char nmdef[MAXLINE];
+
+
+#line 2113 "scan.c"
+
+ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
+ {
+ (yy_more_len) = 0;
+ if ( (yy_more_flag) )
+ {
+ (yy_more_len) = (yy_c_buf_p) - (yytext_ptr);
+ (yy_more_flag) = 0;
+ }
+ yy_cp = (yy_c_buf_p);
+
+ /* Support of yytext. */
+ *yy_cp = (yy_hold_char);
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = (yy_start);
+ yy_current_state += YY_AT_BOL();
+yy_match:
+ do
+ {
+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 1107 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 3975 );
+
+yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ yy_act = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+do_action: /* This label is used only to access EOF actions. */
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = (yy_hold_char);
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 142 "scan.l"
+indented_code = true; BEGIN(CODEBLOCK);
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 143 "scan.l"
+ACTION_ECHO; yy_push_state( COMMENT );
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 144 "scan.l"
+yy_push_state( LINEDIR );
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 145 "scan.l"
+return SCDECL;
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 146 "scan.l"
+return XSCDECL;
+ YY_BREAK
+case 6:
+/* rule 6 can match eol */
+YY_RULE_SETUP
+#line 147 "scan.l"
+{
+ ++linenum;
+ line_directive_out( (FILE *) 0, 1 );
+ indented_code = false;
+ BEGIN(CODEBLOCK);
+ }
+ YY_BREAK
+case 7:
+/* rule 7 can match eol */
+YY_RULE_SETUP
+#line 153 "scan.l"
+{
+ brace_start_line = linenum;
+ ++linenum;
+ buf_linedir( &top_buf, infilename?infilename:"<stdin>", linenum);
+ brace_depth = 1;
+ yy_push_state(CODEBLOCK_MATCH_BRACE);
+ }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 161 "scan.l"
+synerr( _("malformed '%top' directive") );
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 163 "scan.l"
+/* discard */
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 165 "scan.l"
+{
+ sectnum = 2;
+ bracelevel = 0;
+ mark_defs1();
+ line_directive_out( (FILE *) 0, 1 );
+ BEGIN(SECT2PROLOG);
+ return SECTEND;
+ }
+ YY_BREAK
+case 11:
+/* rule 11 can match eol */
+YY_RULE_SETUP
+#line 174 "scan.l"
+yytext_is_array = false; ++linenum;
+ YY_BREAK
+case 12:
+/* rule 12 can match eol */
+YY_RULE_SETUP
+#line 175 "scan.l"
+yytext_is_array = true; ++linenum;
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 177 "scan.l"
+BEGIN(OPTION); return OPTION_OP;
+ YY_BREAK
+case 14:
+/* rule 14 can match eol */
+YY_RULE_SETUP
+#line 179 "scan.l"
+++linenum; /* ignore */
+ YY_BREAK
+case 15:
+/* rule 15 can match eol */
+YY_RULE_SETUP
+#line 180 "scan.l"
+++linenum; /* ignore */
+ YY_BREAK
+/* xgettext: no-c-format */
+case 16:
+/* rule 16 can match eol */
+YY_RULE_SETUP
+#line 183 "scan.l"
+synerr( _( "unrecognized '%' directive" ) );
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 185 "scan.l"
+{
+ if(yyleng < MAXLINE)
+ {
+ strcpy( nmstr, yytext );
+ }
+ else
+ {
+ synerr( _("Definition name too long\n"));
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+
+ didadef = false;
+ BEGIN(PICKUPDEF);
+ }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 200 "scan.l"
+RETURNNAME;
+ YY_BREAK
+case 19:
+/* rule 19 can match eol */
+YY_RULE_SETUP
+#line 201 "scan.l"
+++linenum; /* allows blank lines in section 1 */
+ YY_BREAK
+case 20:
+/* rule 20 can match eol */
+YY_RULE_SETUP
+#line 202 "scan.l"
+ACTION_ECHO; ++linenum; /* maybe end of comment line */
+ YY_BREAK
+
+
+case 21:
+YY_RULE_SETUP
+#line 207 "scan.l"
+ACTION_ECHO; yy_pop_state();
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 208 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 209 "scan.l"
+ACTION_ECHO_QSTART;
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 210 "scan.l"
+ACTION_ECHO_QEND;
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 211 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 26:
+/* rule 26 can match eol */
+YY_RULE_SETUP
+#line 212 "scan.l"
+++linenum; ACTION_ECHO;
+ YY_BREAK
+
+
+/* This is the same as COMMENT, but is discarded rather than output. */
+case 27:
+YY_RULE_SETUP
+#line 217 "scan.l"
+yy_pop_state();
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 218 "scan.l"
+;
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 219 "scan.l"
+;
+ YY_BREAK
+case 30:
+/* rule 30 can match eol */
+YY_RULE_SETUP
+#line 220 "scan.l"
+++linenum;
+ YY_BREAK
+
+
+case 31:
+YY_RULE_SETUP
+#line 224 "scan.l"
+yy_pop_state();
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 225 "scan.l"
+;
+ YY_BREAK
+case 33:
+/* rule 33 can match eol */
+YY_RULE_SETUP
+#line 226 "scan.l"
+++linenum;
+ YY_BREAK
+
+
+case 34:
+/* rule 34 can match eol */
+YY_RULE_SETUP
+#line 230 "scan.l"
+yy_pop_state();
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 231 "scan.l"
+linenum = myctoi( yytext );
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 233 "scan.l"
+{
+ flex_free( (void *) infilename );
+ infilename = copy_string( yytext + 1 );
+ infilename[strlen( infilename ) - 1] = '\0';
+ }
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 238 "scan.l"
+/* ignore spurious characters */
+ YY_BREAK
+
+
+case 38:
+/* rule 38 can match eol */
+YY_RULE_SETUP
+#line 242 "scan.l"
+++linenum; BEGIN(INITIAL);
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 244 "scan.l"
+ACTION_ECHO_QSTART;
+ YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 245 "scan.l"
+ACTION_ECHO_QEND;
+ YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 246 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 42:
+/* rule 42 can match eol */
+YY_RULE_SETUP
+#line 248 "scan.l"
+{
+ ++linenum;
+ ACTION_ECHO;
+ if ( indented_code )
+ BEGIN(INITIAL);
+ }
+ YY_BREAK
+
+
+case 43:
+YY_RULE_SETUP
+#line 257 "scan.l"
+{
+ if( --brace_depth == 0){
+ /* TODO: Matched. */
+ yy_pop_state();
+ }else
+ buf_strnappend(&top_buf, yytext, yyleng);
+ }
+ YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 265 "scan.l"
+{
+ brace_depth++;
+ buf_strnappend(&top_buf, yytext, yyleng);
+ }
+ YY_BREAK
+case 45:
+/* rule 45 can match eol */
+YY_RULE_SETUP
+#line 270 "scan.l"
+{
+ ++linenum;
+ buf_strnappend(&top_buf, yytext, yyleng);
+ }
+ YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 275 "scan.l"
+buf_strnappend(&top_buf, escaped_qstart, strlen(escaped_qstart));
+ YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 276 "scan.l"
+buf_strnappend(&top_buf, escaped_qend, strlen(escaped_qend));
+ YY_BREAK
+case 48:
+YY_RULE_SETUP
+#line 278 "scan.l"
+{
+ buf_strnappend(&top_buf, yytext, yyleng);
+ }
+ YY_BREAK
+case YY_STATE_EOF(CODEBLOCK_MATCH_BRACE):
+#line 282 "scan.l"
+{
+ linenum = brace_start_line;
+ synerr(_("Unmatched '{'"));
+ yyterminate();
+ }
+ YY_BREAK
+
+
+case 49:
+YY_RULE_SETUP
+#line 291 "scan.l"
+/* separates name and definition */
+ YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 293 "scan.l"
+{
+ if(yyleng < MAXLINE)
+ {
+ strcpy( (char *) nmdef, yytext );
+ }
+ else
+ {
+ format_synerr( _("Definition value for {%s} too long\n"), nmstr);
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+ /* Skip trailing whitespace. */
+ for ( i = strlen( (char *) nmdef ) - 1;
+ i >= 0 && (nmdef[i] == ' ' || nmdef[i] == '\t');
+ --i )
+ ;
+
+ nmdef[i + 1] = '\0';
+
+ ndinstal( nmstr, nmdef );
+ didadef = true;
+ }
+ YY_BREAK
+case 51:
+/* rule 51 can match eol */
+YY_RULE_SETUP
+#line 315 "scan.l"
+{
+ if ( ! didadef )
+ synerr( _( "incomplete name definition" ) );
+ BEGIN(INITIAL);
+ ++linenum;
+ }
+ YY_BREAK
+
+
+case 52:
+/* rule 52 can match eol */
+YY_RULE_SETUP
+#line 325 "scan.l"
+++linenum; BEGIN(INITIAL);
+ YY_BREAK
+case 53:
+YY_RULE_SETUP
+#line 326 "scan.l"
+option_sense = true;
+ YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 328 "scan.l"
+return '=';
+ YY_BREAK
+case 55:
+YY_RULE_SETUP
+#line 330 "scan.l"
+option_sense = ! option_sense;
+ YY_BREAK
+case 56:
+YY_RULE_SETUP
+#line 332 "scan.l"
+csize = option_sense ? 128 : 256;
+ YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 333 "scan.l"
+csize = option_sense ? 256 : 128;
+ YY_BREAK
+case 58:
+YY_RULE_SETUP
+#line 335 "scan.l"
+long_align = option_sense;
+ YY_BREAK
+case 59:
+YY_RULE_SETUP
+#line 336 "scan.l"
+{
+ ACTION_M4_IFDEF( "M4""_YY_ALWAYS_INTERACTIVE", option_sense );
+ interactive = option_sense;
+ }
+ YY_BREAK
+case 60:
+YY_RULE_SETUP
+#line 340 "scan.l"
+yytext_is_array = option_sense;
+ YY_BREAK
+case 61:
+YY_RULE_SETUP
+#line 341 "scan.l"
+ansi_func_defs = option_sense;
+ YY_BREAK
+case 62:
+YY_RULE_SETUP
+#line 342 "scan.l"
+ansi_func_protos = option_sense;
+ YY_BREAK
+case 63:
+YY_RULE_SETUP
+#line 343 "scan.l"
+backing_up_report = option_sense;
+ YY_BREAK
+case 64:
+YY_RULE_SETUP
+#line 344 "scan.l"
+interactive = ! option_sense;
+ YY_BREAK
+case 65:
+YY_RULE_SETUP
+#line 345 "scan.l"
+bison_bridge_lval = option_sense;
+ YY_BREAK
+case 66:
+YY_RULE_SETUP
+#line 346 "scan.l"
+{ if((bison_bridge_lloc = option_sense))
+ bison_bridge_lval = true;
+ }
+ YY_BREAK
+case 67:
+YY_RULE_SETUP
+#line 349 "scan.l"
+C_plus_plus = option_sense;
+ YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 350 "scan.l"
+sf_set_case_ins(!option_sense);
+ YY_BREAK
+case 69:
+YY_RULE_SETUP
+#line 351 "scan.l"
+sf_set_case_ins(option_sense);
+ YY_BREAK
+case 70:
+YY_RULE_SETUP
+#line 352 "scan.l"
+ddebug = option_sense;
+ YY_BREAK
+case 71:
+YY_RULE_SETUP
+#line 353 "scan.l"
+spprdflt = ! option_sense;
+ YY_BREAK
+case 72:
+YY_RULE_SETUP
+#line 354 "scan.l"
+useecs = option_sense;
+ YY_BREAK
+case 73:
+YY_RULE_SETUP
+#line 355 "scan.l"
+{
+ useecs = usemecs = false;
+ use_read = fullspd = true;
+ }
+ YY_BREAK
+case 74:
+YY_RULE_SETUP
+#line 359 "scan.l"
+{
+ useecs = usemecs = false;
+ use_read = fulltbl = true;
+ }
+ YY_BREAK
+case 75:
+YY_RULE_SETUP
+#line 363 "scan.l"
+ACTION_IFDEF("YY_NO_INPUT", ! option_sense);
+ YY_BREAK
+case 76:
+YY_RULE_SETUP
+#line 364 "scan.l"
+interactive = option_sense;
+ YY_BREAK
+case 77:
+YY_RULE_SETUP
+#line 365 "scan.l"
+lex_compat = option_sense;
+ YY_BREAK
+case 78:
+YY_RULE_SETUP
+#line 366 "scan.l"
+posix_compat = option_sense;
+ YY_BREAK
+case 79:
+YY_RULE_SETUP
+#line 367 "scan.l"
+{
+ ACTION_M4_IFDEF( "M4""_YY_MAIN", option_sense);
+ /* Override yywrap */
+ if( option_sense == true )
+ do_yywrap = false;
+ }
+ YY_BREAK
+case 80:
+YY_RULE_SETUP
+#line 373 "scan.l"
+usemecs = option_sense;
+ YY_BREAK
+case 81:
+YY_RULE_SETUP
+#line 374 "scan.l"
+{
+ ACTION_M4_IFDEF( "M4""_YY_NEVER_INTERACTIVE", option_sense );
+ interactive = !option_sense;
+ }
+ YY_BREAK
+case 82:
+YY_RULE_SETUP
+#line 378 "scan.l"
+performance_report += option_sense ? 1 : -1;
+ YY_BREAK
+case 83:
+YY_RULE_SETUP
+#line 379 "scan.l"
+yytext_is_array = ! option_sense;
+ YY_BREAK
+case 84:
+YY_RULE_SETUP
+#line 380 "scan.l"
+use_read = option_sense;
+ YY_BREAK
+case 85:
+YY_RULE_SETUP
+#line 381 "scan.l"
+reentrant = option_sense;
+ YY_BREAK
+case 86:
+YY_RULE_SETUP
+#line 382 "scan.l"
+reject_really_used = option_sense;
+ YY_BREAK
+case 87:
+YY_RULE_SETUP
+#line 383 "scan.l"
+ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense );
+ YY_BREAK
+case 88:
+YY_RULE_SETUP
+#line 384 "scan.l"
+do_stdinit = option_sense;
+ YY_BREAK
+case 89:
+YY_RULE_SETUP
+#line 385 "scan.l"
+use_stdout = option_sense;
+ YY_BREAK
+case 90:
+YY_RULE_SETUP
+#line 386 "scan.l"
+ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
+ YY_BREAK
+case 91:
+YY_RULE_SETUP
+#line 387 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense);
+ YY_BREAK
+case 92:
+YY_RULE_SETUP
+#line 388 "scan.l"
+printstats = option_sense;
+ YY_BREAK
+case 93:
+YY_RULE_SETUP
+#line 389 "scan.l"
+nowarn = ! option_sense;
+ YY_BREAK
+case 94:
+YY_RULE_SETUP
+#line 390 "scan.l"
+do_yylineno = option_sense; ACTION_M4_IFDEF("M4""_YY_USE_LINENO", option_sense);
+ YY_BREAK
+case 95:
+YY_RULE_SETUP
+#line 391 "scan.l"
+yymore_really_used = option_sense;
+ YY_BREAK
+case 96:
+YY_RULE_SETUP
+#line 392 "scan.l"
+do_yywrap = option_sense;
+ YY_BREAK
+case 97:
+YY_RULE_SETUP
+#line 394 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_PUSH_STATE", ! option_sense);
+ YY_BREAK
+case 98:
+YY_RULE_SETUP
+#line 395 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_POP_STATE", ! option_sense);
+ YY_BREAK
+case 99:
+YY_RULE_SETUP
+#line 396 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_TOP_STATE", ! option_sense);
+ YY_BREAK
+case 100:
+YY_RULE_SETUP
+#line 398 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BUFFER", ! option_sense);
+ YY_BREAK
+case 101:
+YY_RULE_SETUP
+#line 399 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BYTES", ! option_sense);
+ YY_BREAK
+case 102:
+YY_RULE_SETUP
+#line 400 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SCAN_STRING", ! option_sense);
+ YY_BREAK
+case 103:
+YY_RULE_SETUP
+#line 402 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_FLEX_ALLOC", ! option_sense);
+ YY_BREAK
+case 104:
+YY_RULE_SETUP
+#line 403 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_FLEX_REALLOC", ! option_sense);
+ YY_BREAK
+case 105:
+YY_RULE_SETUP
+#line 404 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_FLEX_FREE", ! option_sense);
+ YY_BREAK
+case 106:
+YY_RULE_SETUP
+#line 406 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_DEBUG", ! option_sense);
+ YY_BREAK
+case 107:
+YY_RULE_SETUP
+#line 407 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_DEBUG", ! option_sense);
+ YY_BREAK
+case 108:
+YY_RULE_SETUP
+#line 408 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_EXTRA", ! option_sense);
+ YY_BREAK
+case 109:
+YY_RULE_SETUP
+#line 409 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_EXTRA", ! option_sense);
+ YY_BREAK
+case 110:
+YY_RULE_SETUP
+#line 410 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_LENG", ! option_sense);
+ YY_BREAK
+case 111:
+YY_RULE_SETUP
+#line 411 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_TEXT", ! option_sense);
+ YY_BREAK
+case 112:
+YY_RULE_SETUP
+#line 412 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_LINENO", ! option_sense);
+ YY_BREAK
+case 113:
+YY_RULE_SETUP
+#line 413 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_LINENO", ! option_sense);
+ YY_BREAK
+case 114:
+YY_RULE_SETUP
+#line 414 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_IN", ! option_sense);
+ YY_BREAK
+case 115:
+YY_RULE_SETUP
+#line 415 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_IN", ! option_sense);
+ YY_BREAK
+case 116:
+YY_RULE_SETUP
+#line 416 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_OUT", ! option_sense);
+ YY_BREAK
+case 117:
+YY_RULE_SETUP
+#line 417 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_OUT", ! option_sense);
+ YY_BREAK
+case 118:
+YY_RULE_SETUP
+#line 418 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_LVAL", ! option_sense);
+ YY_BREAK
+case 119:
+YY_RULE_SETUP
+#line 419 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_LVAL", ! option_sense);
+ YY_BREAK
+case 120:
+YY_RULE_SETUP
+#line 420 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_LLOC", ! option_sense);
+ YY_BREAK
+case 121:
+YY_RULE_SETUP
+#line 421 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_LLOC", ! option_sense);
+ YY_BREAK
+case 122:
+YY_RULE_SETUP
+#line 423 "scan.l"
+return OPT_EXTRA_TYPE;
+ YY_BREAK
+case 123:
+YY_RULE_SETUP
+#line 424 "scan.l"
+return OPT_OUTFILE;
+ YY_BREAK
+case 124:
+YY_RULE_SETUP
+#line 425 "scan.l"
+return OPT_PREFIX;
+ YY_BREAK
+case 125:
+YY_RULE_SETUP
+#line 426 "scan.l"
+return OPT_YYCLASS;
+ YY_BREAK
+case 126:
+YY_RULE_SETUP
+#line 427 "scan.l"
+return OPT_HEADER;
+ YY_BREAK
+case 127:
+YY_RULE_SETUP
+#line 428 "scan.l"
+return OPT_TABLES;
+ YY_BREAK
+case 128:
+YY_RULE_SETUP
+#line 429 "scan.l"
+{
+ tablesverify = option_sense;
+ if(!tablesext && option_sense)
+ tablesext = true;
+ }
+ YY_BREAK
+case 129:
+YY_RULE_SETUP
+#line 436 "scan.l"
+{
+ if(yyleng-1 < MAXLINE)
+ {
+ strcpy( nmstr, yytext + 1 );
+ }
+ else
+ {
+ synerr( _("Option line too long\n"));
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+ nmstr[strlen( nmstr ) - 1] = '\0';
+ return NAME;
+ }
+ YY_BREAK
+case 130:
+YY_RULE_SETUP
+#line 450 "scan.l"
+{
+ format_synerr( _( "unrecognized %%option: %s" ),
+ yytext );
+ BEGIN(RECOVER);
+ }
+ YY_BREAK
+
+case 131:
+/* rule 131 can match eol */
+YY_RULE_SETUP
+#line 457 "scan.l"
+++linenum; BEGIN(INITIAL);
+ YY_BREAK
+
+case 132:
+YY_RULE_SETUP
+#line 461 "scan.l"
+++bracelevel; yyless( 2 ); /* eat only %{ */
+ YY_BREAK
+case 133:
+YY_RULE_SETUP
+#line 462 "scan.l"
+--bracelevel; yyless( 2 ); /* eat only %} */
+ YY_BREAK
+case 134:
+YY_RULE_SETUP
+#line 464 "scan.l"
+ACTION_ECHO; /* indented code in prolog */
+ YY_BREAK
+case 135:
+YY_RULE_SETUP
+#line 466 "scan.l"
+{ /* non-indented code */
+ if ( bracelevel <= 0 )
+ { /* not in %{ ... %} */
+ yyless( 0 ); /* put it all back */
+ yy_set_bol( 1 );
+ mark_prolog();
+ BEGIN(SECT2);
+ }
+ else
+ ACTION_ECHO;
+ }
+ YY_BREAK
+case 136:
+YY_RULE_SETUP
+#line 478 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 137:
+/* rule 137 can match eol */
+YY_RULE_SETUP
+#line 479 "scan.l"
+++linenum; ACTION_ECHO;
+ YY_BREAK
+case YY_STATE_EOF(SECT2PROLOG):
+#line 481 "scan.l"
+{
+ mark_prolog();
+ sectnum = 0;
+ yyterminate(); /* to stop the parser */
+ }
+ YY_BREAK
+
+
+case 138:
+/* rule 138 can match eol */
+YY_RULE_SETUP
+#line 489 "scan.l"
+++linenum; /* allow blank lines in section 2 */
+ YY_BREAK
+case 139:
+YY_RULE_SETUP
+#line 491 "scan.l"
+{
+ indented_code = false;
+ doing_codeblock = true;
+ bracelevel = 1;
+ BEGIN(PERCENT_BRACE_ACTION);
+ }
+ YY_BREAK
+case 140:
+YY_RULE_SETUP
+#line 498 "scan.l"
+{
+ /* Allow "<" to appear in (?x) patterns. */
+ if (!sf_skip_ws())
+ BEGIN(SC);
+ return '<';
+ }
+ YY_BREAK
+case 141:
+YY_RULE_SETUP
+#line 504 "scan.l"
+return '^';
+ YY_BREAK
+case 142:
+YY_RULE_SETUP
+#line 505 "scan.l"
+BEGIN(QUOTE); return '"';
+ YY_BREAK
+case 143:
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 506 "scan.l"
+{
+ BEGIN(NUM);
+ if ( lex_compat || posix_compat )
+ return BEGIN_REPEAT_POSIX;
+ else
+ return BEGIN_REPEAT_FLEX;
+ }
+ YY_BREAK
+case 144:
+/* rule 144 can match eol */
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+YY_LINENO_REWIND_TO(yy_bp + 1);
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 513 "scan.l"
+return '$';
+ YY_BREAK
+case 145:
+YY_RULE_SETUP
+#line 515 "scan.l"
+{
+ bracelevel = 1;
+ BEGIN(PERCENT_BRACE_ACTION);
+
+ if ( in_rule )
+ {
+ doing_rule_action = true;
+ in_rule = false;
+ return '\n';
+ }
+ }
+ YY_BREAK
+case 146:
+/* rule 146 can match eol */
+YY_RULE_SETUP
+#line 526 "scan.l"
+{
+ if (sf_skip_ws()){
+ /* We're in the middle of a (?x: ) pattern. */
+ /* Push back everything starting at the "|" */
+ size_t amt;
+ amt = strchr (yytext, '|') - yytext;
+ yyless(amt);
+ }
+ else {
+ continued_action = true;
+ ++linenum;
+ return '\n';
+ }
+ }
+ YY_BREAK
+case 147:
+YY_RULE_SETUP
+#line 541 "scan.l"
+{
+
+ if (sf_skip_ws()){
+ /* We're in the middle of a (?x: ) pattern. */
+ yy_push_state(COMMENT_DISCARD);
+ }
+ else{
+ yyless( yyleng - 2 ); /* put back '/', '*' */
+ bracelevel = 0;
+ continued_action = false;
+ BEGIN(ACTION);
+ }
+ }
+ YY_BREAK
+case 148:
+YY_RULE_SETUP
+#line 555 "scan.l"
+/* allow indented rules */ ;
+ YY_BREAK
+case 149:
+YY_RULE_SETUP
+#line 557 "scan.l"
+{
+ if (sf_skip_ws()){
+ /* We're in the middle of a (?x: ) pattern. */
+ }
+ else{
+ /* This rule is separate from the one below because
+ * otherwise we get variable trailing context, so
+ * we can't build the scanner using -{f,F}.
+ */
+ bracelevel = 0;
+ continued_action = false;
+ BEGIN(ACTION);
+
+ if ( in_rule )
+ {
+ doing_rule_action = true;
+ in_rule = false;
+ return '\n';
+ }
+ }
+ }
+ YY_BREAK
+case 150:
+/* rule 150 can match eol */
+YY_RULE_SETUP
+#line 579 "scan.l"
+{
+ if (sf_skip_ws()){
+ /* We're in the middle of a (?x: ) pattern. */
+ ++linenum;
+ }
+ else{
+ bracelevel = 0;
+ continued_action = false;
+ BEGIN(ACTION);
+ unput( '\n' ); /* so <ACTION> sees it */
+
+ if ( in_rule )
+ {
+ doing_rule_action = true;
+ in_rule = false;
+ return '\n';
+ }
+ }
+ }
+ YY_BREAK
+case 151:
+#line 600 "scan.l"
+case 152:
+YY_RULE_SETUP
+#line 600 "scan.l"
+return EOF_OP;
+ YY_BREAK
+case 153:
+YY_RULE_SETUP
+#line 602 "scan.l"
+{
+ sectnum = 3;
+ BEGIN(SECT3);
+ outn("/* Begin user sect3 */");
+ yyterminate(); /* to stop the parser */
+ }
+ YY_BREAK
+case 154:
+YY_RULE_SETUP
+#line 609 "scan.l"
+{
+ int cclval;
+
+ if(yyleng < MAXLINE)
+ {
+ strcpy( nmstr, yytext );
+ }
+ else
+ {
+ synerr( _("Input line too long\n"));
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+
+ /* Check to see if we've already encountered this
+ * ccl.
+ */
+ if (0 /* <--- This "0" effectively disables the reuse of a
+ * character class (purely based on its source text).
+ * The reason it was disabled is so yacc/bison can parse
+ * ccl operations, such as ccl difference and union.
+ */
+ && (cclval = ccllookup( (Char *) nmstr )) != 0 )
+ {
+ if ( input() != ']' )
+ synerr( _( "bad character class" ) );
+
+ yylval = cclval;
+ ++cclreuse;
+ return PREVCCL;
+ }
+ else
+ {
+ /* We fudge a bit. We know that this ccl will
+ * soon be numbered as lastccl + 1 by cclinit.
+ */
+ cclinstal( (Char *) nmstr, lastccl + 1 );
+
+ /* Push back everything but the leading bracket
+ * so the ccl can be rescanned.
+ */
+ yyless( 1 );
+
+ BEGIN(FIRSTCCL);
+ return '[';
+ }
+ }
+ YY_BREAK
+case 155:
+YY_RULE_SETUP
+#line 655 "scan.l"
+return CCL_OP_DIFF;
+ YY_BREAK
+case 156:
+YY_RULE_SETUP
+#line 656 "scan.l"
+return CCL_OP_UNION;
+ YY_BREAK
+/* Check for :space: at the end of the rule so we don't
+ * wrap the expanded regex in '(' ')' -- breaking trailing
+ * context.
+ */
+case 157:
+/* rule 157 can match eol */
+YY_RULE_SETUP
+#line 663 "scan.l"
+{
+ Char *nmdefptr;
+ int end_is_ws, end_ch;
+
+ end_ch = yytext[yyleng-1];
+ end_is_ws = end_ch != '}' ? 1 : 0;
+
+ if(yyleng-1 < MAXLINE)
+ {
+ strcpy( nmstr, yytext + 1 );
+ }
+ else
+ {
+ synerr( _("Input line too long\n"));
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
+
+ if ( (nmdefptr = ndlookup( nmstr )) == 0 )
+ format_synerr(
+ _( "undefined definition {%s}" ),
+ nmstr );
+
+ else
+ { /* push back name surrounded by ()'s */
+ int len = strlen( (char *) nmdefptr );
+ if (end_is_ws)
+ unput(end_ch);
+
+ if ( lex_compat || nmdefptr[0] == '^' ||
+ (len > 0 && nmdefptr[len - 1] == '$')
+ || (end_is_ws && trlcontxt && !sf_skip_ws()))
+ { /* don't use ()'s after all */
+ PUT_BACK_STRING((char *) nmdefptr, 0);
+
+ if ( nmdefptr[0] == '^' )
+ BEGIN(CARETISBOL);
+ }
+
+ else
+ {
+ unput(')');
+ PUT_BACK_STRING((char *) nmdefptr, 0);
+ unput('(');
+ }
+ }
+ }
+ YY_BREAK
+case 158:
+YY_RULE_SETUP
+#line 711 "scan.l"
+{
+ if (sf_skip_ws())
+ yy_push_state(COMMENT_DISCARD);
+ else{
+ /* Push back the "*" and return "/" as usual. */
+ yyless(1);
+ return '/';
+ }
+ }
+ YY_BREAK
+case 159:
+YY_RULE_SETUP
+#line 721 "scan.l"
+{
+ if (lex_compat || posix_compat){
+ /* Push back the "?#" and treat it like a normal parens. */
+ yyless(1);
+ sf_push();
+ return '(';
+ }
+ else
+ yy_push_state(EXTENDED_COMMENT);
+ }
+ YY_BREAK
+case 160:
+YY_RULE_SETUP
+#line 731 "scan.l"
+{
+ sf_push();
+ if (lex_compat || posix_compat)
+ /* Push back the "?" and treat it like a normal parens. */
+ yyless(1);
+ else
+ BEGIN(GROUP_WITH_PARAMS);
+ return '(';
+ }
+ YY_BREAK
+case 161:
+YY_RULE_SETUP
+#line 740 "scan.l"
+sf_push(); return '(';
+ YY_BREAK
+case 162:
+YY_RULE_SETUP
+#line 741 "scan.l"
+sf_pop(); return ')';
+ YY_BREAK
+case 163:
+YY_RULE_SETUP
+#line 743 "scan.l"
+return (unsigned char) yytext[0];
+ YY_BREAK
+case 164:
+YY_RULE_SETUP
+#line 744 "scan.l"
+RETURNCHAR;
+ YY_BREAK
+
+
+case 165:
+/* rule 165 can match eol */
+YY_RULE_SETUP
+#line 749 "scan.l"
+++linenum; /* Allow blank lines & continuations */
+ YY_BREAK
+case 166:
+YY_RULE_SETUP
+#line 750 "scan.l"
+return (unsigned char) yytext[0];
+ YY_BREAK
+case 167:
+YY_RULE_SETUP
+#line 751 "scan.l"
+BEGIN(SECT2); return '>';
+ YY_BREAK
+case 168:
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 752 "scan.l"
+BEGIN(CARETISBOL); return '>';
+ YY_BREAK
+case 169:
+YY_RULE_SETUP
+#line 753 "scan.l"
+RETURNNAME;
+ YY_BREAK
+case 170:
+YY_RULE_SETUP
+#line 754 "scan.l"
+{
+ format_synerr( _( "bad <start condition>: %s" ),
+ yytext );
+ }
+ YY_BREAK
+
+case 171:
+YY_RULE_SETUP
+#line 760 "scan.l"
+BEGIN(SECT2); return '^';
+ YY_BREAK
+
+case 172:
+YY_RULE_SETUP
+#line 764 "scan.l"
+RETURNCHAR;
+ YY_BREAK
+case 173:
+YY_RULE_SETUP
+#line 765 "scan.l"
+BEGIN(SECT2); return '"';
+ YY_BREAK
+case 174:
+/* rule 174 can match eol */
+YY_RULE_SETUP
+#line 767 "scan.l"
+{
+ synerr( _( "missing quote" ) );
+ BEGIN(SECT2);
+ ++linenum;
+ return '"';
+ }
+ YY_BREAK
+
+
+case 175:
+YY_RULE_SETUP
+#line 776 "scan.l"
+BEGIN(SECT2);
+ YY_BREAK
+case 176:
+YY_RULE_SETUP
+#line 777 "scan.l"
+BEGIN(GROUP_MINUS_PARAMS);
+ YY_BREAK
+case 177:
+YY_RULE_SETUP
+#line 778 "scan.l"
+sf_set_case_ins(1);
+ YY_BREAK
+case 178:
+YY_RULE_SETUP
+#line 779 "scan.l"
+sf_set_dot_all(1);
+ YY_BREAK
+case 179:
+YY_RULE_SETUP
+#line 780 "scan.l"
+sf_set_skip_ws(1);
+ YY_BREAK
+
+
+case 180:
+YY_RULE_SETUP
+#line 783 "scan.l"
+BEGIN(SECT2);
+ YY_BREAK
+case 181:
+YY_RULE_SETUP
+#line 784 "scan.l"
+sf_set_case_ins(0);
+ YY_BREAK
+case 182:
+YY_RULE_SETUP
+#line 785 "scan.l"
+sf_set_dot_all(0);
+ YY_BREAK
+case 183:
+YY_RULE_SETUP
+#line 786 "scan.l"
+sf_set_skip_ws(0);
+ YY_BREAK
+
+
+case 184:
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 790 "scan.l"
+BEGIN(CCL); return '^';
+ YY_BREAK
+case 185:
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 791 "scan.l"
+return '^';
+ YY_BREAK
+case 186:
+YY_RULE_SETUP
+#line 792 "scan.l"
+BEGIN(CCL); RETURNCHAR;
+ YY_BREAK
+
+
+case 187:
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
+(yy_c_buf_p) = yy_cp = yy_bp + 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 796 "scan.l"
+return '-';
+ YY_BREAK
+case 188:
+YY_RULE_SETUP
+#line 797 "scan.l"
+RETURNCHAR;
+ YY_BREAK
+case 189:
+YY_RULE_SETUP
+#line 798 "scan.l"
+BEGIN(SECT2); return ']';
+ YY_BREAK
+case 190:
+/* rule 190 can match eol */
+YY_RULE_SETUP
+#line 799 "scan.l"
+{
+ synerr( _( "bad character class" ) );
+ BEGIN(SECT2);
+ return ']';
+ }
+ YY_BREAK
+
+
+case 191:
+YY_RULE_SETUP
+#line 807 "scan.l"
+BEGIN(CCL); return CCE_ALNUM;
+ YY_BREAK
+case 192:
+YY_RULE_SETUP
+#line 808 "scan.l"
+BEGIN(CCL); return CCE_ALPHA;
+ YY_BREAK
+case 193:
+YY_RULE_SETUP
+#line 809 "scan.l"
+BEGIN(CCL); return CCE_BLANK;
+ YY_BREAK
+case 194:
+YY_RULE_SETUP
+#line 810 "scan.l"
+BEGIN(CCL); return CCE_CNTRL;
+ YY_BREAK
+case 195:
+YY_RULE_SETUP
+#line 811 "scan.l"
+BEGIN(CCL); return CCE_DIGIT;
+ YY_BREAK
+case 196:
+YY_RULE_SETUP
+#line 812 "scan.l"
+BEGIN(CCL); return CCE_GRAPH;
+ YY_BREAK
+case 197:
+YY_RULE_SETUP
+#line 813 "scan.l"
+BEGIN(CCL); return CCE_LOWER;
+ YY_BREAK
+case 198:
+YY_RULE_SETUP
+#line 814 "scan.l"
+BEGIN(CCL); return CCE_PRINT;
+ YY_BREAK
+case 199:
+YY_RULE_SETUP
+#line 815 "scan.l"
+BEGIN(CCL); return CCE_PUNCT;
+ YY_BREAK
+case 200:
+YY_RULE_SETUP
+#line 816 "scan.l"
+BEGIN(CCL); return CCE_SPACE;
+ YY_BREAK
+case 201:
+YY_RULE_SETUP
+#line 817 "scan.l"
+BEGIN(CCL); return CCE_UPPER;
+ YY_BREAK
+case 202:
+YY_RULE_SETUP
+#line 818 "scan.l"
+BEGIN(CCL); return CCE_XDIGIT;
+ YY_BREAK
+case 203:
+YY_RULE_SETUP
+#line 820 "scan.l"
+BEGIN(CCL); return CCE_NEG_ALNUM;
+ YY_BREAK
+case 204:
+YY_RULE_SETUP
+#line 821 "scan.l"
+BEGIN(CCL); return CCE_NEG_ALPHA;
+ YY_BREAK
+case 205:
+YY_RULE_SETUP
+#line 822 "scan.l"
+BEGIN(CCL); return CCE_NEG_BLANK;
+ YY_BREAK
+case 206:
+YY_RULE_SETUP
+#line 823 "scan.l"
+BEGIN(CCL); return CCE_NEG_CNTRL;
+ YY_BREAK
+case 207:
+YY_RULE_SETUP
+#line 824 "scan.l"
+BEGIN(CCL); return CCE_NEG_DIGIT;
+ YY_BREAK
+case 208:
+YY_RULE_SETUP
+#line 825 "scan.l"
+BEGIN(CCL); return CCE_NEG_GRAPH;
+ YY_BREAK
+case 209:
+YY_RULE_SETUP
+#line 826 "scan.l"
+BEGIN(CCL); return CCE_NEG_LOWER;
+ YY_BREAK
+case 210:
+YY_RULE_SETUP
+#line 827 "scan.l"
+BEGIN(CCL); return CCE_NEG_PRINT;
+ YY_BREAK
+case 211:
+YY_RULE_SETUP
+#line 828 "scan.l"
+BEGIN(CCL); return CCE_NEG_PUNCT;
+ YY_BREAK
+case 212:
+YY_RULE_SETUP
+#line 829 "scan.l"
+BEGIN(CCL); return CCE_NEG_SPACE;
+ YY_BREAK
+case 213:
+YY_RULE_SETUP
+#line 830 "scan.l"
+BEGIN(CCL); return CCE_NEG_UPPER;
+ YY_BREAK
+case 214:
+YY_RULE_SETUP
+#line 831 "scan.l"
+BEGIN(CCL); return CCE_NEG_XDIGIT;
+ YY_BREAK
+case 215:
+YY_RULE_SETUP
+#line 832 "scan.l"
+{
+ format_synerr(
+ _( "bad character class expression: %s" ),
+ yytext );
+ BEGIN(CCL); return CCE_ALNUM;
+ }
+ YY_BREAK
+
+
+case 216:
+YY_RULE_SETUP
+#line 841 "scan.l"
+{
+ yylval = myctoi( yytext );
+ return NUMBER;
+ }
+ YY_BREAK
+case 217:
+YY_RULE_SETUP
+#line 846 "scan.l"
+return ',';
+ YY_BREAK
+case 218:
+YY_RULE_SETUP
+#line 847 "scan.l"
+{
+ BEGIN(SECT2);
+ if ( lex_compat || posix_compat )
+ return END_REPEAT_POSIX;
+ else
+ return END_REPEAT_FLEX;
+ }
+ YY_BREAK
+case 219:
+YY_RULE_SETUP
+#line 855 "scan.l"
+{
+ synerr( _( "bad character inside {}'s" ) );
+ BEGIN(SECT2);
+ return '}';
+ }
+ YY_BREAK
+case 220:
+/* rule 220 can match eol */
+YY_RULE_SETUP
+#line 861 "scan.l"
+{
+ synerr( _( "missing }" ) );
+ BEGIN(SECT2);
+ ++linenum;
+ return '}';
+ }
+ YY_BREAK
+
+
+case 221:
+YY_RULE_SETUP
+#line 871 "scan.l"
+bracelevel = 0;
+ YY_BREAK
+case 222:
+YY_RULE_SETUP
+#line 873 "scan.l"
+ACTION_ECHO; yy_push_state( COMMENT );
+ YY_BREAK
+
+case 223:
+YY_RULE_SETUP
+#line 876 "scan.l"
+{
+ ACTION_ECHO;
+ CHECK_REJECT(yytext);
+ }
+ YY_BREAK
+case 224:
+YY_RULE_SETUP
+#line 880 "scan.l"
+{
+ ACTION_ECHO;
+ CHECK_YYMORE(yytext);
+ }
+ YY_BREAK
+
+case 225:
+YY_RULE_SETUP
+#line 886 "scan.l"
+ACTION_ECHO_QSTART;
+ YY_BREAK
+case 226:
+YY_RULE_SETUP
+#line 887 "scan.l"
+ACTION_ECHO_QEND;
+ YY_BREAK
+case 227:
+YY_RULE_SETUP
+#line 888 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 228:
+/* rule 228 can match eol */
+YY_RULE_SETUP
+#line 889 "scan.l"
+{
+ ++linenum;
+ ACTION_ECHO;
+ if ( bracelevel == 0 ||
+ (doing_codeblock && indented_code) )
+ {
+ if ( doing_rule_action )
+ add_action( "\tYY_BREAK\n" );
+
+ doing_rule_action = doing_codeblock = false;
+ BEGIN(SECT2);
+ }
+ }
+ YY_BREAK
+
+/* Reject and YYmore() are checked for above, in PERCENT_BRACE_ACTION */
+
+case 229:
+YY_RULE_SETUP
+#line 907 "scan.l"
+ACTION_ECHO; ++bracelevel;
+ YY_BREAK
+case 230:
+YY_RULE_SETUP
+#line 908 "scan.l"
+ACTION_ECHO; --bracelevel;
+ YY_BREAK
+case 231:
+YY_RULE_SETUP
+#line 909 "scan.l"
+ACTION_ECHO_QSTART;
+ YY_BREAK
+case 232:
+YY_RULE_SETUP
+#line 910 "scan.l"
+ACTION_ECHO_QEND;
+ YY_BREAK
+case 233:
+YY_RULE_SETUP
+#line 911 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 234:
+YY_RULE_SETUP
+#line 912 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 235:
+YY_RULE_SETUP
+#line 913 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 236:
+YY_RULE_SETUP
+#line 914 "scan.l"
+ACTION_ECHO; /* character constant */
+ YY_BREAK
+case 237:
+YY_RULE_SETUP
+#line 915 "scan.l"
+ACTION_ECHO; BEGIN(ACTION_STRING);
+ YY_BREAK
+case 238:
+/* rule 238 can match eol */
+YY_RULE_SETUP
+#line 916 "scan.l"
+{
+ ++linenum;
+ ACTION_ECHO;
+ if ( bracelevel == 0 )
+ {
+ if ( doing_rule_action )
+ add_action( "\tYY_BREAK\n" );
+
+ doing_rule_action = false;
+ BEGIN(SECT2);
+ }
+ }
+ YY_BREAK
+case 239:
+YY_RULE_SETUP
+#line 928 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+
+
+case 240:
+YY_RULE_SETUP
+#line 932 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 241:
+YY_RULE_SETUP
+#line 933 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+case 242:
+/* rule 242 can match eol */
+YY_RULE_SETUP
+#line 934 "scan.l"
+++linenum; ACTION_ECHO; BEGIN(ACTION);
+ YY_BREAK
+case 243:
+YY_RULE_SETUP
+#line 935 "scan.l"
+ACTION_ECHO; BEGIN(ACTION);
+ YY_BREAK
+case 244:
+YY_RULE_SETUP
+#line 936 "scan.l"
+ACTION_ECHO;
+ YY_BREAK
+
+case YY_STATE_EOF(COMMENT):
+case YY_STATE_EOF(COMMENT_DISCARD):
+case YY_STATE_EOF(ACTION):
+case YY_STATE_EOF(ACTION_STRING):
+#line 939 "scan.l"
+{
+ synerr( _( "EOF encountered inside an action" ) );
+ yyterminate();
+ }
+ YY_BREAK
+case YY_STATE_EOF(EXTENDED_COMMENT):
+case YY_STATE_EOF(GROUP_WITH_PARAMS):
+case YY_STATE_EOF(GROUP_MINUS_PARAMS):
+#line 944 "scan.l"
+{
+ synerr( _( "EOF encountered inside pattern" ) );
+ yyterminate();
+ }
+ YY_BREAK
+case 245:
+YY_RULE_SETUP
+#line 949 "scan.l"
+{
+ yylval = myesc( (Char *) yytext );
+
+ if ( YY_START == FIRSTCCL )
+ BEGIN(CCL);
+
+ return CHAR;
+ }
+ YY_BREAK
+
+case 246:
+YY_RULE_SETUP
+#line 960 "scan.l"
+fwrite (escaped_qstart, 1, strlen(escaped_qstart), yyout);
+ YY_BREAK
+case 247:
+YY_RULE_SETUP
+#line 961 "scan.l"
+fwrite (escaped_qend, 1, strlen(escaped_qend), yyout);
+ YY_BREAK
+case 248:
+/* rule 248 can match eol */
+YY_RULE_SETUP
+#line 962 "scan.l"
+ECHO;
+ YY_BREAK
+case 249:
+/* rule 249 can match eol */
+YY_RULE_SETUP
+#line 963 "scan.l"
+ECHO;
+ YY_BREAK
+case YY_STATE_EOF(SECT3):
+#line 964 "scan.l"
+sectnum = 0; yyterminate();
+ YY_BREAK
+
+case 250:
+/* rule 250 can match eol */
+YY_RULE_SETUP
+#line 967 "scan.l"
+format_synerr( _( "bad character: %s" ), yytext );
+ YY_BREAK
+case 251:
+YY_RULE_SETUP
+#line 969 "scan.l"
+YY_FATAL_ERROR( "flex scanner jammed" );
+ YY_BREAK
+#line 3985 "scan.c"
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(SECT2):
+case YY_STATE_EOF(CODEBLOCK):
+case YY_STATE_EOF(PICKUPDEF):
+case YY_STATE_EOF(SC):
+case YY_STATE_EOF(CARETISBOL):
+case YY_STATE_EOF(NUM):
+case YY_STATE_EOF(QUOTE):
+case YY_STATE_EOF(FIRSTCCL):
+case YY_STATE_EOF(CCL):
+case YY_STATE_EOF(RECOVER):
+case YY_STATE_EOF(PERCENT_BRACE_ACTION):
+case YY_STATE_EOF(OPTION):
+case YY_STATE_EOF(LINEDIR):
+ yyterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = (yy_hold_char);
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++(yy_c_buf_p);
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = (yy_c_buf_p);
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ (yy_did_buffer_switch_on_eof) = 0;
+
+ if ( yywrap( ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) =
+ (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ (yy_c_buf_p) =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of user's declarations */
+} /* end of yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (void)
+{
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = (yytext_ptr);
+ yy_size_t number_to_move, i;
+ int ret_val;
+
+ if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+ else
+ {
+ yy_size_t num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
+
+ int yy_c_buf_p_offset =
+ (int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ yy_size_t new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ number_to_move - 1;
+
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ (yy_n_chars), num_to_read );
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ if ( (yy_n_chars) == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart(yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ }
+
+ (yy_n_chars) += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+ static yy_state_type yy_get_previous_state (void)
+{
+ yy_state_type yy_current_state;
+ char *yy_cp;
+
+ yy_current_state = (yy_start);
+ yy_current_state += YY_AT_BOL();
+
+ for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+ {
+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 1107 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
+
+ return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
+{
+ int yy_is_jam;
+ char *yy_cp = (yy_c_buf_p);
+
+ YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 1107 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 1106);
+
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+#ifndef YY_NO_UNPUT
+
+ static void yyunput (int c, char * yy_bp )
+{
+ char *yy_cp;
+
+ yy_cp = (yy_c_buf_p);
+
+ /* undo effects of setting up yytext */
+ *yy_cp = (yy_hold_char);
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ yy_size_t number_to_move = (yy_n_chars) + 2;
+ char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ char *source =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+ (yytext_ptr) = yy_bp;
+ (yy_hold_char) = *yy_cp;
+ (yy_c_buf_p) = yy_cp;
+}
+
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+ static int yyinput (void)
+#else
+ static int input (void)
+#endif
+
+{
+ int c;
+
+ *(yy_c_buf_p) = (yy_hold_char);
+
+ if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ /* This was really a NUL. */
+ *(yy_c_buf_p) = '\0';
+
+ else
+ { /* need more input */
+ yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
+ ++(yy_c_buf_p);
+
+ switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart(yyin );
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap( ) )
+ return EOF;
+
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) = (yytext_ptr) + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
+ *(yy_c_buf_p) = '\0'; /* preserve yytext */
+ (yy_hold_char) = *++(yy_c_buf_p);
+
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
+
+ return c;
+}
+#endif /* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ *
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+ void yyrestart (FILE * input_file )
+{
+
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_init_buffer(YY_CURRENT_BUFFER,input_file );
+ yy_load_buffer_state( );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ *
+ */
+ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
+{
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack ();
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state( );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+static void yy_load_buffer_state (void)
+{
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+ (yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ *
+ * @return the allocated buffer state.
+ */
+ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
+{
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = (yy_size_t)size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer(b,file );
+
+ return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ *
+ */
+ void yy_delete_buffer (YY_BUFFER_STATE b )
+{
+
+ if ( ! b )
+ return;
+
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yyfree((void *) b->yy_ch_buf );
+
+ yyfree((void *) b );
+}
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
+
+{
+ int oerrno = errno;
+
+ yy_flush_buffer(b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ *
+ */
+ void yy_flush_buffer (YY_BUFFER_STATE b )
+{
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == YY_CURRENT_BUFFER )
+ yy_load_buffer_state( );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ *
+ */
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
+{
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack();
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ (yy_buffer_stack_top)++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ *
+ */
+void yypop_buffer_state (void)
+{
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if ((yy_buffer_stack_top) > 0)
+ --(yy_buffer_stack_top);
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+ }
+}
+
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+static void yyensure_buffer_stack (void)
+{
+ yy_size_t num_to_alloc;
+
+ if (!(yy_buffer_stack)) {
+
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
+ */
+ num_to_alloc = 1; // After all that talk, this was set to 1 anyways...
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+
+ (yy_buffer_stack_max) = num_to_alloc;
+ (yy_buffer_stack_top) = 0;
+ return;
+ }
+
+ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ yy_size_t grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = (yy_buffer_stack_max) + grow_size;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+ ((yy_buffer_stack),
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ /* zero only the new slots.*/
+ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+ (yy_buffer_stack_max) = num_to_alloc;
+ }
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
+{
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer(b );
+
+ return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ *
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ * yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
+{
+
+ return yy_scan_bytes(yystr,strlen(yystr) );
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
+{
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ yy_size_t i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = _yybytes_len + 2;
+ buf = (char *) yyalloc(n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < _yybytes_len; ++i )
+ buf[i] = yybytes[i];
+
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer(buf,n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+}
+
+ static void yy_push_state (int _new_state )
+{
+ if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
+ {
+ yy_size_t new_size;
+
+ (yy_start_stack_depth) += YY_START_STACK_INCR;
+ new_size = (yy_start_stack_depth) * sizeof( int );
+
+ if ( ! (yy_start_stack) )
+ (yy_start_stack) = (int *) yyalloc(new_size );
+
+ else
+ (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size );
+
+ if ( ! (yy_start_stack) )
+ YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
+ }
+
+ (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
+
+ BEGIN(_new_state);
+}
+
+ static void yy_pop_state (void)
+{
+ if ( --(yy_start_stack_ptr) < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg )
+{
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ yytext[yyleng] = (yy_hold_char); \
+ (yy_c_buf_p) = yytext + yyless_macro_arg; \
+ (yy_hold_char) = *(yy_c_buf_p); \
+ *(yy_c_buf_p) = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } \
+ while ( 0 )
+
+/* Accessor methods (get/set functions) to struct members. */
+
+/** Get the current line number.
+ *
+ */
+int yyget_lineno (void)
+{
+
+ return yylineno;
+}
+
+/** Get the input stream.
+ *
+ */
+FILE *yyget_in (void)
+{
+ return yyin;
+}
+
+/** Get the output stream.
+ *
+ */
+FILE *yyget_out (void)
+{
+ return yyout;
+}
+
+/** Get the length of the current token.
+ *
+ */
+yy_size_t yyget_leng (void)
+{
+ return yyleng;
+}
+
+/** Get the current token.
+ *
+ */
+
+char *yyget_text (void)
+{
+ return yytext;
+}
+
+/** Set the current line number.
+ * @param _line_number line number
+ *
+ */
+void yyset_lineno (int _line_number )
+{
+
+ yylineno = _line_number;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param _in_str A readable stream.
+ *
+ * @see yy_switch_to_buffer
+ */
+void yyset_in (FILE * _in_str )
+{
+ yyin = _in_str ;
+}
+
+void yyset_out (FILE * _out_str )
+{
+ yyout = _out_str ;
+}
+
+int yyget_debug (void)
+{
+ return yy_flex_debug;
+}
+
+void yyset_debug (int _bdebug )
+{
+ yy_flex_debug = _bdebug ;
+}
+
+static int yy_init_globals (void)
+{
+ /* Initialization is the same as for the non-reentrant scanner.
+ * This function is called from yylex_destroy(), so don't allocate here.
+ */
+
+ (yy_buffer_stack) = 0;
+ (yy_buffer_stack_top) = 0;
+ (yy_buffer_stack_max) = 0;
+ (yy_c_buf_p) = (char *) 0;
+ (yy_init) = 0;
+ (yy_start) = 0;
+
+ (yy_start_stack_ptr) = 0;
+ (yy_start_stack_depth) = 0;
+ (yy_start_stack) = NULL;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+ yyin = stdin;
+ yyout = stdout;
+#else
+ yyin = (FILE *) 0;
+ yyout = (FILE *) 0;
+#endif
+
+ /* For future reference: Set errno on error, since we are called by
+ * yylex_init()
+ */
+ return 0;
+}
+
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy (void)
+{
+
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state();
+ }
+
+ /* Destroy the stack itself. */
+ yyfree((yy_buffer_stack) );
+ (yy_buffer_stack) = NULL;
+
+ /* Destroy the start condition stack. */
+ yyfree((yy_start_stack) );
+ (yy_start_stack) = NULL;
+
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
+ * yylex() is called, initialization will occur. */
+ yy_init_globals( );
+
+ return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+
+ int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+ int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+}
+#endif
+
+void *yyalloc (yy_size_t size )
+{
+ return (void *) malloc( size );
+}
+
+void *yyrealloc (void * ptr, yy_size_t size )
+{
+
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 969 "scan.l"
+
+
+
+
+int yywrap()
+ {
+ if ( --num_input_files > 0 )
+ {
+ set_input_file( *++input_files );
+ return 0;
+ }
+
+ else
+ return 1;
+ }
+
+
+/* set_input_file - open the given file (if NULL, stdin) for scanning */
+
+void set_input_file( file )
+char *file;
+ {
+ if ( file && strcmp( file, "-" ) )
+ {
+ infilename = copy_string( file );
+ yyin = fopen( infilename, "r" );
+
+ if ( yyin == NULL )
+ lerr( _( "can't open %s" ), file );
+ }
+
+ else
+ {
+ yyin = stdin;
+ infilename = copy_string( "<stdin>" );
+ }
+
+ linenum = 1;
+ }
+
+
+/* Wrapper routines for accessing the scanner's malloc routines. */
+
+void *flex_alloc( size )
+size_t size;
+ {
+ return (void *) malloc( size );
+ }
+
+void *flex_realloc( ptr, size )
+void *ptr;
+size_t size;
+ {
+ return (void *) realloc( ptr, size );
+ }
+
+void flex_free( ptr )
+void *ptr;
+ {
+ if ( ptr )
+ free( ptr );
+ }
+
diff --git a/src/scan.l b/src/scan.l
new file mode 100644
index 0000000..9eb857a
--- /dev/null
+++ b/src/scan.l
@@ -0,0 +1,1029 @@
+/* scan.l - scanner for flex input -*-C-*- */
+
+%{
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+#include "parse.h"
+extern bool tablesverify, tablesext;
+extern int trlcontxt; /* Set in parse.y for each rule. */
+extern const char *escaped_qstart, *escaped_qend;
+
+#define ACTION_ECHO add_action( yytext )
+#define ACTION_IFDEF(def, should_define) \
+ { \
+ if ( should_define ) \
+ action_define( def, 1 ); \
+ }
+
+#define ACTION_ECHO_QSTART add_action (escaped_qstart)
+#define ACTION_ECHO_QEND add_action (escaped_qend)
+
+#define ACTION_M4_IFDEF(def, should_define) \
+ do{ \
+ if ( should_define ) \
+ buf_m4_define( &m4defs_buf, def, NULL);\
+ else \
+ buf_m4_undefine( &m4defs_buf, def);\
+ } while(0)
+
+#define MARK_END_OF_PROLOG mark_prolog();
+
+#define YY_DECL \
+ int flexscan()
+
+#define RETURNCHAR \
+ yylval = (unsigned char) yytext[0]; \
+ return CHAR;
+
+#define RETURNNAME \
+ if(yyleng < MAXLINE) \
+ { \
+ strcpy( nmstr, yytext ); \
+ } \
+ else \
+ { \
+ synerr(_("Input line too long\n")); \
+ FLEX_EXIT(EXIT_FAILURE); \
+ } \
+ return NAME;
+
+#define PUT_BACK_STRING(str, start) \
+ for ( i = strlen( str ) - 1; i >= start; --i ) \
+ unput((str)[i])
+
+#define CHECK_REJECT(str) \
+ if ( all_upper( str ) ) \
+ reject = true;
+
+#define CHECK_YYMORE(str) \
+ if ( all_lower( str ) ) \
+ yymore_used = true;
+
+#define YY_USER_INIT \
+ if ( getenv("POSIXLY_CORRECT") ) \
+ posix_compat = true;
+
+%}
+
+%option caseless nodefault noreject stack noyy_top_state
+%option nostdinit
+
+%x SECT2 SECT2PROLOG SECT3 CODEBLOCK PICKUPDEF SC CARETISBOL NUM QUOTE
+%x FIRSTCCL CCL ACTION RECOVER COMMENT ACTION_STRING PERCENT_BRACE_ACTION
+%x OPTION LINEDIR CODEBLOCK_MATCH_BRACE
+%x GROUP_WITH_PARAMS
+%x GROUP_MINUS_PARAMS
+%x EXTENDED_COMMENT
+%x COMMENT_DISCARD
+
+WS [[:blank:]]+
+OPTWS [[:blank:]]*
+NOT_WS [^[:blank:]\r\n]
+
+NL \r?\n
+
+NAME ([[:alpha:]_][[:alnum:]_-]*)
+NOT_NAME [^[:alpha:]_*\n]+
+
+SCNAME {NAME}
+
+ESCSEQ (\\([^\n]|[0-7]{1,3}|x[[:xdigit:]]{1,2}))
+
+FIRST_CCL_CHAR ([^\\\n]|{ESCSEQ})
+CCL_CHAR ([^\\\n\]]|{ESCSEQ})
+CCL_EXPR ("[:"^?[[:alpha:]]+":]")
+
+LEXOPT [aceknopr]
+
+M4QSTART "[["
+M4QEND "]]"
+
+%%
+ static int bracelevel, didadef, indented_code;
+ static int doing_rule_action = false;
+ static int option_sense;
+
+ int doing_codeblock = false;
+ int i, brace_depth=0, brace_start_line=0;
+ Char nmdef[MAXLINE];
+
+
+<INITIAL>{
+ ^{WS} indented_code = true; BEGIN(CODEBLOCK);
+ ^"/*" ACTION_ECHO; yy_push_state( COMMENT );
+ ^#{OPTWS}line{WS} yy_push_state( LINEDIR );
+ ^"%s"{NAME}? return SCDECL;
+ ^"%x"{NAME}? return XSCDECL;
+ ^"%{".*{NL} {
+ ++linenum;
+ line_directive_out( (FILE *) 0, 1 );
+ indented_code = false;
+ BEGIN(CODEBLOCK);
+ }
+ ^"%top"[[:blank:]]*"{"[[:blank:]]*{NL} {
+ brace_start_line = linenum;
+ ++linenum;
+ buf_linedir( &top_buf, infilename?infilename:"<stdin>", linenum);
+ brace_depth = 1;
+ yy_push_state(CODEBLOCK_MATCH_BRACE);
+ }
+
+ ^"%top".* synerr( _("malformed '%top' directive") );
+
+ {WS} /* discard */
+
+ ^"%%".* {
+ sectnum = 2;
+ bracelevel = 0;
+ mark_defs1();
+ line_directive_out( (FILE *) 0, 1 );
+ BEGIN(SECT2PROLOG);
+ return SECTEND;
+ }
+
+ ^"%pointer".*{NL} yytext_is_array = false; ++linenum;
+ ^"%array".*{NL} yytext_is_array = true; ++linenum;
+
+ ^"%option" BEGIN(OPTION); return OPTION_OP;
+
+ ^"%"{LEXOPT}{OPTWS}[[:digit:]]*{OPTWS}{NL} ++linenum; /* ignore */
+ ^"%"{LEXOPT}{WS}.*{NL} ++linenum; /* ignore */
+
+ /* xgettext: no-c-format */
+ ^"%"[^sxaceknopr{}].* synerr( _( "unrecognized '%' directive" ) );
+
+ ^{NAME} {
+ if(yyleng < MAXLINE)
+ {
+ strcpy( nmstr, yytext );
+ }
+ else
+ {
+ synerr( _("Definition name too long\n"));
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+
+ didadef = false;
+ BEGIN(PICKUPDEF);
+ }
+
+ {SCNAME} RETURNNAME;
+ ^{OPTWS}{NL} ++linenum; /* allows blank lines in section 1 */
+ {OPTWS}{NL} ACTION_ECHO; ++linenum; /* maybe end of comment line */
+}
+
+
+<COMMENT>{
+ "*/" ACTION_ECHO; yy_pop_state();
+ "*" ACTION_ECHO;
+ {M4QSTART} ACTION_ECHO_QSTART;
+ {M4QEND} ACTION_ECHO_QEND;
+ [^*\n] ACTION_ECHO;
+ {NL} ++linenum; ACTION_ECHO;
+}
+
+<COMMENT_DISCARD>{
+ /* This is the same as COMMENT, but is discarded rather than output. */
+ "*/" yy_pop_state();
+ "*" ;
+ [^*\n] ;
+ {NL} ++linenum;
+}
+
+<EXTENDED_COMMENT>{
+ ")" yy_pop_state();
+ [^\n\)]+ ;
+ {NL} ++linenum;
+}
+
+<LINEDIR>{
+ \n yy_pop_state();
+ [[:digit:]]+ linenum = myctoi( yytext );
+
+ \"[^"\n]*\" {
+ flex_free( (void *) infilename );
+ infilename = copy_string( yytext + 1 );
+ infilename[strlen( infilename ) - 1] = '\0';
+ }
+ . /* ignore spurious characters */
+}
+
+<CODEBLOCK>{
+ ^"%}".*{NL} ++linenum; BEGIN(INITIAL);
+
+ {M4QSTART} ACTION_ECHO_QSTART;
+ {M4QEND} ACTION_ECHO_QEND;
+ . ACTION_ECHO;
+
+ {NL} {
+ ++linenum;
+ ACTION_ECHO;
+ if ( indented_code )
+ BEGIN(INITIAL);
+ }
+}
+
+<CODEBLOCK_MATCH_BRACE>{
+ "}" {
+ if( --brace_depth == 0){
+ /* TODO: Matched. */
+ yy_pop_state();
+ }else
+ buf_strnappend(&top_buf, yytext, yyleng);
+ }
+
+ "{" {
+ brace_depth++;
+ buf_strnappend(&top_buf, yytext, yyleng);
+ }
+
+ {NL} {
+ ++linenum;
+ buf_strnappend(&top_buf, yytext, yyleng);
+ }
+
+ {M4QSTART} buf_strnappend(&top_buf, escaped_qstart, strlen(escaped_qstart));
+ {M4QEND} buf_strnappend(&top_buf, escaped_qend, strlen(escaped_qend));
+
+ [^{}\r\n] {
+ buf_strnappend(&top_buf, yytext, yyleng);
+ }
+
+ <<EOF>> {
+ linenum = brace_start_line;
+ synerr(_("Unmatched '{'"));
+ yyterminate();
+ }
+}
+
+
+<PICKUPDEF>{
+ {WS} /* separates name and definition */
+
+ {NOT_WS}[^\r\n]* {
+ if(yyleng < MAXLINE)
+ {
+ strcpy( (char *) nmdef, yytext );
+ }
+ else
+ {
+ format_synerr( _("Definition value for {%s} too long\n"), nmstr);
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+ /* Skip trailing whitespace. */
+ for ( i = strlen( (char *) nmdef ) - 1;
+ i >= 0 && (nmdef[i] == ' ' || nmdef[i] == '\t');
+ --i )
+ ;
+
+ nmdef[i + 1] = '\0';
+
+ ndinstal( nmstr, nmdef );
+ didadef = true;
+ }
+
+ {NL} {
+ if ( ! didadef )
+ synerr( _( "incomplete name definition" ) );
+ BEGIN(INITIAL);
+ ++linenum;
+ }
+}
+
+
+<OPTION>{
+ {NL} ++linenum; BEGIN(INITIAL);
+ {WS} option_sense = true;
+
+ "=" return '=';
+
+ no option_sense = ! option_sense;
+
+ 7bit csize = option_sense ? 128 : 256;
+ 8bit csize = option_sense ? 256 : 128;
+
+ align long_align = option_sense;
+ always-interactive {
+ ACTION_M4_IFDEF( "M4""_YY_ALWAYS_INTERACTIVE", option_sense );
+ interactive = option_sense;
+ }
+ array yytext_is_array = option_sense;
+ ansi-definitions ansi_func_defs = option_sense;
+ ansi-prototypes ansi_func_protos = option_sense;
+ backup backing_up_report = option_sense;
+ batch interactive = ! option_sense;
+ bison-bridge bison_bridge_lval = option_sense;
+ bison-locations { if((bison_bridge_lloc = option_sense))
+ bison_bridge_lval = true;
+ }
+ "c++" C_plus_plus = option_sense;
+ caseful|case-sensitive sf_set_case_ins(!option_sense);
+ caseless|case-insensitive sf_set_case_ins(option_sense);
+ debug ddebug = option_sense;
+ default spprdflt = ! option_sense;
+ ecs useecs = option_sense;
+ fast {
+ useecs = usemecs = false;
+ use_read = fullspd = true;
+ }
+ full {
+ useecs = usemecs = false;
+ use_read = fulltbl = true;
+ }
+ input ACTION_IFDEF("YY_NO_INPUT", ! option_sense);
+ interactive interactive = option_sense;
+ lex-compat lex_compat = option_sense;
+ posix-compat posix_compat = option_sense;
+ main {
+ ACTION_M4_IFDEF( "M4""_YY_MAIN", option_sense);
+ /* Override yywrap */
+ if( option_sense == true )
+ do_yywrap = false;
+ }
+ meta-ecs usemecs = option_sense;
+ never-interactive {
+ ACTION_M4_IFDEF( "M4""_YY_NEVER_INTERACTIVE", option_sense );
+ interactive = !option_sense;
+ }
+ perf-report performance_report += option_sense ? 1 : -1;
+ pointer yytext_is_array = ! option_sense;
+ read use_read = option_sense;
+ reentrant reentrant = option_sense;
+ reject reject_really_used = option_sense;
+ stack ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense );
+ stdinit do_stdinit = option_sense;
+ stdout use_stdout = option_sense;
+ unistd ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
+ unput ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense);
+ verbose printstats = option_sense;
+ warn nowarn = ! option_sense;
+ yylineno do_yylineno = option_sense; ACTION_M4_IFDEF("M4""_YY_USE_LINENO", option_sense);
+ yymore yymore_really_used = option_sense;
+ yywrap do_yywrap = option_sense;
+
+ yy_push_state ACTION_M4_IFDEF("M4""_YY_NO_PUSH_STATE", ! option_sense);
+ yy_pop_state ACTION_M4_IFDEF("M4""_YY_NO_POP_STATE", ! option_sense);
+ yy_top_state ACTION_M4_IFDEF("M4""_YY_NO_TOP_STATE", ! option_sense);
+
+ yy_scan_buffer ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BUFFER", ! option_sense);
+ yy_scan_bytes ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BYTES", ! option_sense);
+ yy_scan_string ACTION_M4_IFDEF("M4""_YY_NO_SCAN_STRING", ! option_sense);
+
+ yyalloc ACTION_M4_IFDEF("M4""_YY_NO_FLEX_ALLOC", ! option_sense);
+ yyrealloc ACTION_M4_IFDEF("M4""_YY_NO_FLEX_REALLOC", ! option_sense);
+ yyfree ACTION_M4_IFDEF("M4""_YY_NO_FLEX_FREE", ! option_sense);
+
+ yyget_debug ACTION_M4_IFDEF("M4""_YY_NO_GET_DEBUG", ! option_sense);
+ yyset_debug ACTION_M4_IFDEF("M4""_YY_NO_SET_DEBUG", ! option_sense);
+ yyget_extra ACTION_M4_IFDEF("M4""_YY_NO_GET_EXTRA", ! option_sense);
+ yyset_extra ACTION_M4_IFDEF("M4""_YY_NO_SET_EXTRA", ! option_sense);
+ yyget_leng ACTION_M4_IFDEF("M4""_YY_NO_GET_LENG", ! option_sense);
+ yyget_text ACTION_M4_IFDEF("M4""_YY_NO_GET_TEXT", ! option_sense);
+ yyget_lineno ACTION_M4_IFDEF("M4""_YY_NO_GET_LINENO", ! option_sense);
+ yyset_lineno ACTION_M4_IFDEF("M4""_YY_NO_SET_LINENO", ! option_sense);
+ yyget_in ACTION_M4_IFDEF("M4""_YY_NO_GET_IN", ! option_sense);
+ yyset_in ACTION_M4_IFDEF("M4""_YY_NO_SET_IN", ! option_sense);
+ yyget_out ACTION_M4_IFDEF("M4""_YY_NO_GET_OUT", ! option_sense);
+ yyset_out ACTION_M4_IFDEF("M4""_YY_NO_SET_OUT", ! option_sense);
+ yyget_lval ACTION_M4_IFDEF("M4""_YY_NO_GET_LVAL", ! option_sense);
+ yyset_lval ACTION_M4_IFDEF("M4""_YY_NO_SET_LVAL", ! option_sense);
+ yyget_lloc ACTION_M4_IFDEF("M4""_YY_NO_GET_LLOC", ! option_sense);
+ yyset_lloc ACTION_M4_IFDEF("M4""_YY_NO_SET_LLOC", ! option_sense);
+
+ extra-type return OPT_EXTRA_TYPE;
+ outfile return OPT_OUTFILE;
+ prefix return OPT_PREFIX;
+ yyclass return OPT_YYCLASS;
+ header(-file)? return OPT_HEADER;
+ tables-file return OPT_TABLES;
+ tables-verify {
+ tablesverify = option_sense;
+ if(!tablesext && option_sense)
+ tablesext = true;
+ }
+
+
+ \"[^"\n]*\" {
+ if(yyleng-1 < MAXLINE)
+ {
+ strcpy( nmstr, yytext + 1 );
+ }
+ else
+ {
+ synerr( _("Option line too long\n"));
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+ nmstr[strlen( nmstr ) - 1] = '\0';
+ return NAME;
+ }
+
+ (([a-mo-z]|n[a-np-z])[[:alpha:]\-+]*)|. {
+ format_synerr( _( "unrecognized %%option: %s" ),
+ yytext );
+ BEGIN(RECOVER);
+ }
+}
+
+<RECOVER>.*{NL} ++linenum; BEGIN(INITIAL);
+
+
+<SECT2PROLOG>{
+ ^"%{".* ++bracelevel; yyless( 2 ); /* eat only %{ */
+ ^"%}".* --bracelevel; yyless( 2 ); /* eat only %} */
+
+ ^{WS}.* ACTION_ECHO; /* indented code in prolog */
+
+ ^{NOT_WS}.* { /* non-indented code */
+ if ( bracelevel <= 0 )
+ { /* not in %{ ... %} */
+ yyless( 0 ); /* put it all back */
+ yy_set_bol( 1 );
+ mark_prolog();
+ BEGIN(SECT2);
+ }
+ else
+ ACTION_ECHO;
+ }
+
+ . ACTION_ECHO;
+ {NL} ++linenum; ACTION_ECHO;
+
+ <<EOF>> {
+ mark_prolog();
+ sectnum = 0;
+ yyterminate(); /* to stop the parser */
+ }
+}
+
+<SECT2>{
+ ^{OPTWS}{NL} ++linenum; /* allow blank lines in section 2 */
+
+ ^{OPTWS}"%{" {
+ indented_code = false;
+ doing_codeblock = true;
+ bracelevel = 1;
+ BEGIN(PERCENT_BRACE_ACTION);
+ }
+
+ ^{OPTWS}"<" {
+ /* Allow "<" to appear in (?x) patterns. */
+ if (!sf_skip_ws())
+ BEGIN(SC);
+ return '<';
+ }
+ ^{OPTWS}"^" return '^';
+ \" BEGIN(QUOTE); return '"';
+ "{"/[[:digit:]] {
+ BEGIN(NUM);
+ if ( lex_compat || posix_compat )
+ return BEGIN_REPEAT_POSIX;
+ else
+ return BEGIN_REPEAT_FLEX;
+ }
+ "$"/([[:blank:]]|{NL}) return '$';
+
+ {WS}"%{" {
+ bracelevel = 1;
+ BEGIN(PERCENT_BRACE_ACTION);
+
+ if ( in_rule )
+ {
+ doing_rule_action = true;
+ in_rule = false;
+ return '\n';
+ }
+ }
+ {WS}"|".*{NL} {
+ if (sf_skip_ws()){
+ /* We're in the middle of a (?x: ) pattern. */
+ /* Push back everything starting at the "|" */
+ size_t amt;
+ amt = strchr (yytext, '|') - yytext;
+ yyless(amt);
+ }
+ else {
+ continued_action = true;
+ ++linenum;
+ return '\n';
+ }
+ }
+
+ ^{WS}"/*" {
+
+ if (sf_skip_ws()){
+ /* We're in the middle of a (?x: ) pattern. */
+ yy_push_state(COMMENT_DISCARD);
+ }
+ else{
+ yyless( yyleng - 2 ); /* put back '/', '*' */
+ bracelevel = 0;
+ continued_action = false;
+ BEGIN(ACTION);
+ }
+ }
+
+ ^{WS} /* allow indented rules */ ;
+
+ {WS} {
+ if (sf_skip_ws()){
+ /* We're in the middle of a (?x: ) pattern. */
+ }
+ else{
+ /* This rule is separate from the one below because
+ * otherwise we get variable trailing context, so
+ * we can't build the scanner using -{f,F}.
+ */
+ bracelevel = 0;
+ continued_action = false;
+ BEGIN(ACTION);
+
+ if ( in_rule )
+ {
+ doing_rule_action = true;
+ in_rule = false;
+ return '\n';
+ }
+ }
+ }
+
+ {OPTWS}{NL} {
+ if (sf_skip_ws()){
+ /* We're in the middle of a (?x: ) pattern. */
+ ++linenum;
+ }
+ else{
+ bracelevel = 0;
+ continued_action = false;
+ BEGIN(ACTION);
+ unput( '\n' ); /* so <ACTION> sees it */
+
+ if ( in_rule )
+ {
+ doing_rule_action = true;
+ in_rule = false;
+ return '\n';
+ }
+ }
+ }
+
+ ^{OPTWS}"<<EOF>>" |
+ "<<EOF>>" return EOF_OP;
+
+ ^"%%".* {
+ sectnum = 3;
+ BEGIN(SECT3);
+ outn("/* Begin user sect3 */");
+ yyterminate(); /* to stop the parser */
+ }
+
+ "["({FIRST_CCL_CHAR}|{CCL_EXPR})({CCL_CHAR}|{CCL_EXPR})* {
+ int cclval;
+
+ if(yyleng < MAXLINE)
+ {
+ strcpy( nmstr, yytext );
+ }
+ else
+ {
+ synerr( _("Input line too long\n"));
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+
+ /* Check to see if we've already encountered this
+ * ccl.
+ */
+ if (0 /* <--- This "0" effectively disables the reuse of a
+ * character class (purely based on its source text).
+ * The reason it was disabled is so yacc/bison can parse
+ * ccl operations, such as ccl difference and union.
+ */
+ && (cclval = ccllookup( (Char *) nmstr )) != 0 )
+ {
+ if ( input() != ']' )
+ synerr( _( "bad character class" ) );
+
+ yylval = cclval;
+ ++cclreuse;
+ return PREVCCL;
+ }
+ else
+ {
+ /* We fudge a bit. We know that this ccl will
+ * soon be numbered as lastccl + 1 by cclinit.
+ */
+ cclinstal( (Char *) nmstr, lastccl + 1 );
+
+ /* Push back everything but the leading bracket
+ * so the ccl can be rescanned.
+ */
+ yyless( 1 );
+
+ BEGIN(FIRSTCCL);
+ return '[';
+ }
+ }
+ "{-}" return CCL_OP_DIFF;
+ "{+}" return CCL_OP_UNION;
+
+
+ /* Check for :space: at the end of the rule so we don't
+ * wrap the expanded regex in '(' ')' -- breaking trailing
+ * context.
+ */
+ "{"{NAME}"}"[[:space:]]? {
+ Char *nmdefptr;
+ int end_is_ws, end_ch;
+
+ end_ch = yytext[yyleng-1];
+ end_is_ws = end_ch != '}' ? 1 : 0;
+
+ if(yyleng-1 < MAXLINE)
+ {
+ strcpy( nmstr, yytext + 1 );
+ }
+ else
+ {
+ synerr( _("Input line too long\n"));
+ FLEX_EXIT(EXIT_FAILURE);
+ }
+nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
+
+ if ( (nmdefptr = ndlookup( nmstr )) == 0 )
+ format_synerr(
+ _( "undefined definition {%s}" ),
+ nmstr );
+
+ else
+ { /* push back name surrounded by ()'s */
+ int len = strlen( (char *) nmdefptr );
+ if (end_is_ws)
+ unput(end_ch);
+
+ if ( lex_compat || nmdefptr[0] == '^' ||
+ (len > 0 && nmdefptr[len - 1] == '$')
+ || (end_is_ws && trlcontxt && !sf_skip_ws()))
+ { /* don't use ()'s after all */
+ PUT_BACK_STRING((char *) nmdefptr, 0);
+
+ if ( nmdefptr[0] == '^' )
+ BEGIN(CARETISBOL);
+ }
+
+ else
+ {
+ unput(')');
+ PUT_BACK_STRING((char *) nmdefptr, 0);
+ unput('(');
+ }
+ }
+ }
+
+ "/*" {
+ if (sf_skip_ws())
+ yy_push_state(COMMENT_DISCARD);
+ else{
+ /* Push back the "*" and return "/" as usual. */
+ yyless(1);
+ return '/';
+ }
+ }
+
+ "(?#" {
+ if (lex_compat || posix_compat){
+ /* Push back the "?#" and treat it like a normal parens. */
+ yyless(1);
+ sf_push();
+ return '(';
+ }
+ else
+ yy_push_state(EXTENDED_COMMENT);
+ }
+ "(?" {
+ sf_push();
+ if (lex_compat || posix_compat)
+ /* Push back the "?" and treat it like a normal parens. */
+ yyless(1);
+ else
+ BEGIN(GROUP_WITH_PARAMS);
+ return '(';
+ }
+ "(" sf_push(); return '(';
+ ")" sf_pop(); return ')';
+
+ [/|*+?.(){}] return (unsigned char) yytext[0];
+ . RETURNCHAR;
+}
+
+
+<SC>{
+ {OPTWS}{NL}{OPTWS} ++linenum; /* Allow blank lines & continuations */
+ [,*] return (unsigned char) yytext[0];
+ ">" BEGIN(SECT2); return '>';
+ ">"/^ BEGIN(CARETISBOL); return '>';
+ {SCNAME} RETURNNAME;
+ . {
+ format_synerr( _( "bad <start condition>: %s" ),
+ yytext );
+ }
+}
+
+<CARETISBOL>"^" BEGIN(SECT2); return '^';
+
+
+<QUOTE>{
+ [^"\n] RETURNCHAR;
+ \" BEGIN(SECT2); return '"';
+
+ {NL} {
+ synerr( _( "missing quote" ) );
+ BEGIN(SECT2);
+ ++linenum;
+ return '"';
+ }
+}
+
+<GROUP_WITH_PARAMS>{
+ ":" BEGIN(SECT2);
+ "-" BEGIN(GROUP_MINUS_PARAMS);
+ i sf_set_case_ins(1);
+ s sf_set_dot_all(1);
+ x sf_set_skip_ws(1);
+}
+<GROUP_MINUS_PARAMS>{
+ ":" BEGIN(SECT2);
+ i sf_set_case_ins(0);
+ s sf_set_dot_all(0);
+ x sf_set_skip_ws(0);
+}
+
+<FIRSTCCL>{
+ "^"/[^-\]\n] BEGIN(CCL); return '^';
+ "^"/("-"|"]") return '^';
+ . BEGIN(CCL); RETURNCHAR;
+}
+
+<CCL>{
+ -/[^\]\n] return '-';
+ [^\]\n] RETURNCHAR;
+ "]" BEGIN(SECT2); return ']';
+ .|{NL} {
+ synerr( _( "bad character class" ) );
+ BEGIN(SECT2);
+ return ']';
+ }
+}
+
+<FIRSTCCL,CCL>{
+ "[:alnum:]" BEGIN(CCL); return CCE_ALNUM;
+ "[:alpha:]" BEGIN(CCL); return CCE_ALPHA;
+ "[:blank:]" BEGIN(CCL); return CCE_BLANK;
+ "[:cntrl:]" BEGIN(CCL); return CCE_CNTRL;
+ "[:digit:]" BEGIN(CCL); return CCE_DIGIT;
+ "[:graph:]" BEGIN(CCL); return CCE_GRAPH;
+ "[:lower:]" BEGIN(CCL); return CCE_LOWER;
+ "[:print:]" BEGIN(CCL); return CCE_PRINT;
+ "[:punct:]" BEGIN(CCL); return CCE_PUNCT;
+ "[:space:]" BEGIN(CCL); return CCE_SPACE;
+ "[:upper:]" BEGIN(CCL); return CCE_UPPER;
+ "[:xdigit:]" BEGIN(CCL); return CCE_XDIGIT;
+
+ "[:^alnum:]" BEGIN(CCL); return CCE_NEG_ALNUM;
+ "[:^alpha:]" BEGIN(CCL); return CCE_NEG_ALPHA;
+ "[:^blank:]" BEGIN(CCL); return CCE_NEG_BLANK;
+ "[:^cntrl:]" BEGIN(CCL); return CCE_NEG_CNTRL;
+ "[:^digit:]" BEGIN(CCL); return CCE_NEG_DIGIT;
+ "[:^graph:]" BEGIN(CCL); return CCE_NEG_GRAPH;
+ "[:^lower:]" BEGIN(CCL); return CCE_NEG_LOWER;
+ "[:^print:]" BEGIN(CCL); return CCE_NEG_PRINT;
+ "[:^punct:]" BEGIN(CCL); return CCE_NEG_PUNCT;
+ "[:^space:]" BEGIN(CCL); return CCE_NEG_SPACE;
+ "[:^upper:]" BEGIN(CCL); return CCE_NEG_UPPER;
+ "[:^xdigit:]" BEGIN(CCL); return CCE_NEG_XDIGIT;
+ {CCL_EXPR} {
+ format_synerr(
+ _( "bad character class expression: %s" ),
+ yytext );
+ BEGIN(CCL); return CCE_ALNUM;
+ }
+}
+
+<NUM>{
+ [[:digit:]]+ {
+ yylval = myctoi( yytext );
+ return NUMBER;
+ }
+
+ "," return ',';
+ "}" {
+ BEGIN(SECT2);
+ if ( lex_compat || posix_compat )
+ return END_REPEAT_POSIX;
+ else
+ return END_REPEAT_FLEX;
+ }
+
+ . {
+ synerr( _( "bad character inside {}'s" ) );
+ BEGIN(SECT2);
+ return '}';
+ }
+
+ {NL} {
+ synerr( _( "missing }" ) );
+ BEGIN(SECT2);
+ ++linenum;
+ return '}';
+ }
+}
+
+
+<PERCENT_BRACE_ACTION>{
+ {OPTWS}"%}".* bracelevel = 0;
+
+ <ACTION>"/*" ACTION_ECHO; yy_push_state( COMMENT );
+
+ <CODEBLOCK,ACTION>{
+ "reject" {
+ ACTION_ECHO;
+ CHECK_REJECT(yytext);
+ }
+ "yymore" {
+ ACTION_ECHO;
+ CHECK_YYMORE(yytext);
+ }
+ }
+
+ {M4QSTART} ACTION_ECHO_QSTART;
+ {M4QEND} ACTION_ECHO_QEND;
+ . ACTION_ECHO;
+ {NL} {
+ ++linenum;
+ ACTION_ECHO;
+ if ( bracelevel == 0 ||
+ (doing_codeblock && indented_code) )
+ {
+ if ( doing_rule_action )
+ add_action( "\tYY_BREAK\n" );
+
+ doing_rule_action = doing_codeblock = false;
+ BEGIN(SECT2);
+ }
+ }
+}
+
+
+ /* Reject and YYmore() are checked for above, in PERCENT_BRACE_ACTION */
+<ACTION>{
+ "{" ACTION_ECHO; ++bracelevel;
+ "}" ACTION_ECHO; --bracelevel;
+ {M4QSTART} ACTION_ECHO_QSTART;
+ {M4QEND} ACTION_ECHO_QEND;
+ [^[:alpha:]_{}"'/\n\[\]]+ ACTION_ECHO;
+ [\[\]] ACTION_ECHO;
+ {NAME} ACTION_ECHO;
+ "'"([^'\\\n]|\\.)*"'" ACTION_ECHO; /* character constant */
+ \" ACTION_ECHO; BEGIN(ACTION_STRING);
+ {NL} {
+ ++linenum;
+ ACTION_ECHO;
+ if ( bracelevel == 0 )
+ {
+ if ( doing_rule_action )
+ add_action( "\tYY_BREAK\n" );
+
+ doing_rule_action = false;
+ BEGIN(SECT2);
+ }
+ }
+ . ACTION_ECHO;
+}
+
+<ACTION_STRING>{
+ [^"\\\n]+ ACTION_ECHO;
+ \\. ACTION_ECHO;
+ {NL} ++linenum; ACTION_ECHO; BEGIN(ACTION);
+ \" ACTION_ECHO; BEGIN(ACTION);
+ . ACTION_ECHO;
+}
+
+<COMMENT,COMMENT_DISCARD,ACTION,ACTION_STRING><<EOF>> {
+ synerr( _( "EOF encountered inside an action" ) );
+ yyterminate();
+ }
+
+<EXTENDED_COMMENT,GROUP_WITH_PARAMS,GROUP_MINUS_PARAMS><<EOF>> {
+ synerr( _( "EOF encountered inside pattern" ) );
+ yyterminate();
+ }
+
+<SECT2,QUOTE,FIRSTCCL,CCL>{ESCSEQ} {
+ yylval = myesc( (Char *) yytext );
+
+ if ( YY_START == FIRSTCCL )
+ BEGIN(CCL);
+
+ return CHAR;
+ }
+
+
+<SECT3>{
+ {M4QSTART} fwrite (escaped_qstart, 1, strlen(escaped_qstart), yyout);
+ {M4QEND} fwrite (escaped_qend, 1, strlen(escaped_qend), yyout);
+ [^\[\]\n]*(\n?) ECHO;
+ (.|\n) ECHO;
+ <<EOF>> sectnum = 0; yyterminate();
+}
+
+<*>.|\n format_synerr( _( "bad character: %s" ), yytext );
+
+%%
+
+
+int yywrap()
+ {
+ if ( --num_input_files > 0 )
+ {
+ set_input_file( *++input_files );
+ return 0;
+ }
+
+ else
+ return 1;
+ }
+
+
+/* set_input_file - open the given file (if NULL, stdin) for scanning */
+
+void set_input_file( file )
+char *file;
+ {
+ if ( file && strcmp( file, "-" ) )
+ {
+ infilename = copy_string( file );
+ yyin = fopen( infilename, "r" );
+
+ if ( yyin == NULL )
+ lerr( _( "can't open %s" ), file );
+ }
+
+ else
+ {
+ yyin = stdin;
+ infilename = copy_string( "<stdin>" );
+ }
+
+ linenum = 1;
+ }
+
+
+/* Wrapper routines for accessing the scanner's malloc routines. */
+
+void *flex_alloc( size )
+size_t size;
+ {
+ return (void *) malloc( size );
+ }
+
+void *flex_realloc( ptr, size )
+void *ptr;
+size_t size;
+ {
+ return (void *) realloc( ptr, size );
+ }
+
+void flex_free( ptr )
+void *ptr;
+ {
+ if ( ptr )
+ free( ptr );
+ }
diff --git a/src/scanflags.c b/src/scanflags.c
new file mode 100644
index 0000000..5beb24a
--- /dev/null
+++ b/src/scanflags.c
@@ -0,0 +1,68 @@
+/* scanflags - flags used by scanning. */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+
+scanflags_t* _sf_stk = NULL;
+size_t _sf_top_ix=0, _sf_max=0;
+
+void
+sf_push (void)
+{
+ if (_sf_top_ix + 1 >= _sf_max)
+ _sf_stk = (scanflags_t*) flex_realloc ( (void*) _sf_stk, sizeof(scanflags_t) * (_sf_max += 32));
+
+ // copy the top element
+ _sf_stk[_sf_top_ix + 1] = _sf_stk[_sf_top_ix];
+ ++_sf_top_ix;
+}
+
+void
+sf_pop (void)
+{
+ assert(_sf_top_ix > 0);
+ --_sf_top_ix;
+}
+
+/* one-time initialization. Should be called before any sf_ functions. */
+void
+sf_init (void)
+{
+ assert(_sf_stk == NULL);
+ _sf_stk = (scanflags_t*) flex_alloc ( sizeof(scanflags_t) * (_sf_max = 32));
+ if (!_sf_stk)
+ lerr_fatal(_("Unable to allocate %zu of stack"), sizeof(scanflags_t));
+ _sf_stk[_sf_top_ix] = 0;
+}
+
+/* vim:set expandtab cindent tabstop=4 softtabstop=4 shiftwidth=4 textwidth=0: */
diff --git a/src/scanopt.c b/src/scanopt.c
new file mode 100644
index 0000000..10c372a
--- /dev/null
+++ b/src/scanopt.c
@@ -0,0 +1,866 @@
+/* flex - tool to generate fast lexical analyzers */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+#include "scanopt.h"
+
+
+/* Internal structures */
+
+#ifdef HAVE_STRCASECMP
+#define STRCASECMP(a,b) strcasecmp(a,b)
+#else
+static int STRCASECMP PROTO ((const char *, const char *));
+
+static int STRCASECMP (a, b)
+ const char *a;
+ const char *b;
+{
+ while (tolower ((unsigned char)*a++) == tolower ((unsigned char)*b++)) ;
+ return b - a;
+}
+#endif
+
+#define ARG_NONE 0x01
+#define ARG_REQ 0x02
+#define ARG_OPT 0x04
+#define IS_LONG 0x08
+
+struct _aux {
+ int flags; /* The above hex flags. */
+ int namelen; /* Length of the actual option word, e.g., "--file[=foo]" is 4 */
+ int printlen; /* Length of entire string, e.g., "--file[=foo]" is 12 */
+};
+
+
+struct _scanopt_t {
+ const optspec_t *options; /* List of options. */
+ struct _aux *aux; /* Auxiliary data about options. */
+ int optc; /* Number of options. */
+ int argc; /* Number of args. */
+ char **argv; /* Array of strings. */
+ int index; /* Used as: argv[index][subscript]. */
+ int subscript;
+ char no_err_msg; /* If true, do not print errors. */
+ char has_long;
+ char has_short;
+};
+
+/* Accessor functions. These WOULD be one-liners, but portability calls. */
+static const char *NAME PROTO ((struct _scanopt_t *, int));
+static int PRINTLEN PROTO ((struct _scanopt_t *, int));
+static int RVAL PROTO ((struct _scanopt_t *, int));
+static int FLAGS PROTO ((struct _scanopt_t *, int));
+static const char *DESC PROTO ((struct _scanopt_t *, int));
+static int scanopt_err PROTO ((struct _scanopt_t *, int, int));
+static int matchlongopt PROTO ((char *, char **, int *, char **, int *));
+static int find_opt
+PROTO ((struct _scanopt_t *, int, char *, int, int *, int *opt_offset));
+
+static const char *NAME (s, i)
+ struct _scanopt_t *s;
+ int i;
+{
+ return s->options[i].opt_fmt +
+ ((s->aux[i].flags & IS_LONG) ? 2 : 1);
+}
+
+static int PRINTLEN (s, i)
+ struct _scanopt_t *s;
+ int i;
+{
+ return s->aux[i].printlen;
+}
+
+static int RVAL (s, i)
+ struct _scanopt_t *s;
+ int i;
+{
+ return s->options[i].r_val;
+}
+
+static int FLAGS (s, i)
+ struct _scanopt_t *s;
+ int i;
+{
+ return s->aux[i].flags;
+}
+
+static const char *DESC (s, i)
+ struct _scanopt_t *s;
+ int i;
+{
+ return s->options[i].desc ? s->options[i].desc : "";
+}
+
+#ifndef NO_SCANOPT_USAGE
+static int get_cols PROTO ((void));
+
+static int get_cols ()
+{
+ char *env;
+ int cols = 80; /* default */
+
+#ifdef HAVE_NCURSES_H
+ initscr ();
+ endwin ();
+ if (COLS > 0)
+ return COLS;
+#endif
+
+ if ((env = getenv ("COLUMNS")) != NULL)
+ cols = atoi (env);
+
+ return cols;
+}
+#endif
+
+/* Macro to check for NULL before assigning a value. */
+#define SAFE_ASSIGN(ptr,val) \
+ do{ \
+ if((ptr)!=NULL) \
+ *(ptr) = val; \
+ }while(0)
+
+/* Macro to assure we reset subscript whenever we adjust s->index.*/
+#define INC_INDEX(s,n) \
+ do{ \
+ (s)->index += (n); \
+ (s)->subscript= 0; \
+ }while(0)
+
+scanopt_t *scanopt_init (options, argc, argv, flags)
+ const optspec_t *options;
+ int argc;
+ char **argv;
+ int flags;
+{
+ int i;
+ struct _scanopt_t *s;
+ s = (struct _scanopt_t *) malloc (sizeof (struct _scanopt_t));
+
+ s->options = options;
+ s->optc = 0;
+ s->argc = argc;
+ s->argv = (char **) argv;
+ s->index = 1;
+ s->subscript = 0;
+ s->no_err_msg = (flags & SCANOPT_NO_ERR_MSG);
+ s->has_long = 0;
+ s->has_short = 0;
+
+ /* Determine option count. (Find entry with all zeros). */
+ s->optc = 0;
+ while (options[s->optc].opt_fmt
+ || options[s->optc].r_val || options[s->optc].desc)
+ s->optc++;
+
+ /* Build auxiliary data */
+ s->aux = (struct _aux *) malloc (s->optc * sizeof (struct _aux));
+
+ for (i = 0; i < s->optc; i++) {
+ const Char *p, *pname;
+ const struct optspec_t *opt;
+ struct _aux *aux;
+
+ opt = s->options + i;
+ aux = s->aux + i;
+
+ aux->flags = ARG_NONE;
+
+ if (opt->opt_fmt[0] == '-' && opt->opt_fmt[1] == '-') {
+ aux->flags |= IS_LONG;
+ pname = (const Char *)(opt->opt_fmt + 2);
+ s->has_long = 1;
+ }
+ else {
+ pname = (const Char *)(opt->opt_fmt + 1);
+ s->has_short = 1;
+ }
+ aux->printlen = strlen (opt->opt_fmt);
+
+ aux->namelen = 0;
+ for (p = pname + 1; *p; p++) {
+ /* detect required arg */
+ if (*p == '=' || isspace ((unsigned char)*p)
+ || !(aux->flags & IS_LONG)) {
+ if (aux->namelen == 0)
+ aux->namelen = p - pname;
+ aux->flags |= ARG_REQ;
+ aux->flags &= ~ARG_NONE;
+ }
+ /* detect optional arg. This overrides required arg. */
+ if (*p == '[') {
+ if (aux->namelen == 0)
+ aux->namelen = p - pname;
+ aux->flags &= ~(ARG_REQ | ARG_NONE);
+ aux->flags |= ARG_OPT;
+ break;
+ }
+ }
+ if (aux->namelen == 0)
+ aux->namelen = p - pname;
+ }
+ return (scanopt_t *) s;
+}
+
+#ifndef NO_SCANOPT_USAGE
+/* these structs are for scanopt_usage(). */
+struct usg_elem {
+ int idx;
+ struct usg_elem *next;
+ struct usg_elem *alias;
+};
+typedef struct usg_elem usg_elem;
+
+
+/* Prints a usage message based on contents of optlist.
+ * Parameters:
+ * scanner - The scanner, already initialized with scanopt_init().
+ * fp - The file stream to write to.
+ * usage - Text to be prepended to option list.
+ * Return: Always returns 0 (zero).
+ * The output looks something like this:
+
+[indent][option, alias1, alias2...][indent][description line1
+ description line2...]
+ */
+int scanopt_usage (scanner, fp, usage)
+ scanopt_t *scanner;
+ FILE *fp;
+ const char *usage;
+{
+ struct _scanopt_t *s;
+ int i, columns, indent = 2;
+ usg_elem *byr_val = NULL; /* option indices sorted by r_val */
+ usg_elem *store; /* array of preallocated elements. */
+ int store_idx = 0;
+ usg_elem *ue;
+ int maxlen[2];
+ int desccol = 0;
+ int print_run = 0;
+
+ maxlen[0] = 0;
+ maxlen[1] = 0;
+
+ s = (struct _scanopt_t *) scanner;
+
+ if (usage) {
+ fprintf (fp, "%s\n", usage);
+ }
+ else {
+ /* Find the basename of argv[0] */
+ const char *p;
+
+ p = s->argv[0] + strlen (s->argv[0]);
+ while (p != s->argv[0] && *p != '/')
+ --p;
+ if (*p == '/')
+ p++;
+
+ fprintf (fp, _("Usage: %s [OPTIONS]...\n"), p);
+ }
+ fprintf (fp, "\n");
+
+ /* Sort by r_val and string. Yes, this is O(n*n), but n is small. */
+ store = (usg_elem *) malloc (s->optc * sizeof (usg_elem));
+ for (i = 0; i < s->optc; i++) {
+
+ /* grab the next preallocate node. */
+ ue = store + store_idx++;
+ ue->idx = i;
+ ue->next = ue->alias = NULL;
+
+ /* insert into list. */
+ if (!byr_val)
+ byr_val = ue;
+ else {
+ int found_alias = 0;
+ usg_elem **ue_curr, **ptr_if_no_alias = NULL;
+
+ ue_curr = &byr_val;
+ while (*ue_curr) {
+ if (RVAL (s, (*ue_curr)->idx) ==
+ RVAL (s, ue->idx)) {
+ /* push onto the alias list. */
+ ue_curr = &((*ue_curr)->alias);
+ found_alias = 1;
+ break;
+ }
+ if (!ptr_if_no_alias
+ &&
+ STRCASECMP (NAME (s, (*ue_curr)->idx),
+ NAME (s, ue->idx)) > 0) {
+ ptr_if_no_alias = ue_curr;
+ }
+ ue_curr = &((*ue_curr)->next);
+ }
+ if (!found_alias && ptr_if_no_alias)
+ ue_curr = ptr_if_no_alias;
+ ue->next = *ue_curr;
+ *ue_curr = ue;
+ }
+ }
+
+#if 0
+ if (1) {
+ printf ("ORIGINAL:\n");
+ for (i = 0; i < s->optc; i++)
+ printf ("%2d: %s\n", i, NAME (s, i));
+ printf ("SORTED:\n");
+ ue = byr_val;
+ while (ue) {
+ usg_elem *ue2;
+
+ printf ("%2d: %s\n", ue->idx, NAME (s, ue->idx));
+ for (ue2 = ue->alias; ue2; ue2 = ue2->next)
+ printf (" +---> %2d: %s\n", ue2->idx,
+ NAME (s, ue2->idx));
+ ue = ue->next;
+ }
+ }
+#endif
+
+ /* Now build each row of output. */
+
+ /* first pass calculate how much room we need. */
+ for (ue = byr_val; ue; ue = ue->next) {
+ usg_elem *ap;
+ int len = 0;
+ int nshort = 0, nlong = 0;
+
+
+#define CALC_LEN(i) do {\
+ if(FLAGS(s,i) & IS_LONG) \
+ len += (nlong++||nshort) ? 2+PRINTLEN(s,i) : PRINTLEN(s,i);\
+ else\
+ len += (nshort++||nlong)? 2+PRINTLEN(s,i) : PRINTLEN(s,i);\
+ }while(0)
+
+ if (!(FLAGS (s, ue->idx) & IS_LONG))
+ CALC_LEN (ue->idx);
+
+ /* do short aliases first. */
+ for (ap = ue->alias; ap; ap = ap->next) {
+ if (FLAGS (s, ap->idx) & IS_LONG)
+ continue;
+ CALC_LEN (ap->idx);
+ }
+
+ if (FLAGS (s, ue->idx) & IS_LONG)
+ CALC_LEN (ue->idx);
+
+ /* repeat the above loop, this time for long aliases. */
+ for (ap = ue->alias; ap; ap = ap->next) {
+ if (!(FLAGS (s, ap->idx) & IS_LONG))
+ continue;
+ CALC_LEN (ap->idx);
+ }
+
+ if (len > maxlen[0])
+ maxlen[0] = len;
+
+ /* It's much easier to calculate length for description column! */
+ len = strlen (DESC (s, ue->idx));
+ if (len > maxlen[1])
+ maxlen[1] = len;
+ }
+
+ /* Determine how much room we have, and how much we will allocate to each col.
+ * Do not address pathological cases. Output will just be ugly. */
+ columns = get_cols () - 1;
+ if (maxlen[0] + maxlen[1] + indent * 2 > columns) {
+ /* col 0 gets whatever it wants. we'll wrap the desc col. */
+ maxlen[1] = columns - (maxlen[0] + indent * 2);
+ if (maxlen[1] < 14) /* 14 is arbitrary lower limit on desc width. */
+ maxlen[1] = INT_MAX;
+ }
+ desccol = maxlen[0] + indent * 2;
+
+#define PRINT_SPACES(fp,n)\
+ do{\
+ int _n;\
+ _n=(n);\
+ while(_n-- > 0)\
+ fputc(' ',(fp));\
+ }while(0)
+
+
+ /* Second pass (same as above loop), this time we print. */
+ /* Sloppy hack: We iterate twice. The first time we print short and long options.
+ The second time we print those lines that have ONLY long options. */
+ while (print_run++ < 2) {
+ for (ue = byr_val; ue; ue = ue->next) {
+ usg_elem *ap;
+ int nwords = 0, nchars = 0, has_short = 0;
+
+/* TODO: get has_short schtick to work */
+ has_short = !(FLAGS (s, ue->idx) & IS_LONG);
+ for (ap = ue->alias; ap; ap = ap->next) {
+ if (!(FLAGS (s, ap->idx) & IS_LONG)) {
+ has_short = 1;
+ break;
+ }
+ }
+ if ((print_run == 1 && !has_short) ||
+ (print_run == 2 && has_short))
+ continue;
+
+ PRINT_SPACES (fp, indent);
+ nchars += indent;
+
+/* Print, adding a ", " between aliases. */
+#define PRINT_IT(i) do{\
+ if(nwords++)\
+ nchars+=fprintf(fp,", ");\
+ nchars+=fprintf(fp,"%s",s->options[i].opt_fmt);\
+ }while(0)
+
+ if (!(FLAGS (s, ue->idx) & IS_LONG))
+ PRINT_IT (ue->idx);
+
+ /* print short aliases first. */
+ for (ap = ue->alias; ap; ap = ap->next) {
+ if (!(FLAGS (s, ap->idx) & IS_LONG))
+ PRINT_IT (ap->idx);
+ }
+
+
+ if (FLAGS (s, ue->idx) & IS_LONG)
+ PRINT_IT (ue->idx);
+
+ /* repeat the above loop, this time for long aliases. */
+ for (ap = ue->alias; ap; ap = ap->next) {
+ if (FLAGS (s, ap->idx) & IS_LONG)
+ PRINT_IT (ap->idx);
+ }
+
+ /* pad to desccol */
+ PRINT_SPACES (fp, desccol - nchars);
+
+ /* Print description, wrapped to maxlen[1] columns. */
+ if (1) {
+ const char *pstart;
+
+ pstart = DESC (s, ue->idx);
+ while (1) {
+ int n = 0;
+ const char *lastws = NULL, *p;
+
+ p = pstart;
+
+ while (*p && n < maxlen[1]
+ && *p != '\n') {
+ if (isspace ((unsigned char)(*p))
+ || *p == '-') lastws =
+ p;
+ n++;
+ p++;
+ }
+
+ if (!*p) { /* hit end of desc. done. */
+ fprintf (fp, "%s\n",
+ pstart);
+ break;
+ }
+ else if (*p == '\n') { /* print everything up to here then wrap. */
+ fprintf (fp, "%.*s\n", n,
+ pstart);
+ PRINT_SPACES (fp, desccol);
+ pstart = p + 1;
+ continue;
+ }
+ else { /* we hit the edge of the screen. wrap at space if possible. */
+ if (lastws) {
+ fprintf (fp,
+ "%.*s\n",
+ (int)(lastws - pstart),
+ pstart);
+ pstart =
+ lastws + 1;
+ }
+ else {
+ fprintf (fp,
+ "%.*s\n",
+ n,
+ pstart);
+ pstart = p + 1;
+ }
+ PRINT_SPACES (fp, desccol);
+ continue;
+ }
+ }
+ }
+ }
+ } /* end while */
+ free (store);
+ return 0;
+}
+#endif /* no scanopt_usage */
+
+
+static int scanopt_err (s, is_short, err)
+ struct _scanopt_t *s;
+ int is_short;
+ int err;
+{
+ const char *optname = "";
+ char optchar[2];
+
+ if (!s->no_err_msg) {
+
+ if (s->index > 0 && s->index < s->argc) {
+ if (is_short) {
+ optchar[0] =
+ s->argv[s->index][s->subscript];
+ optchar[1] = '\0';
+ optname = optchar;
+ }
+ else {
+ optname = s->argv[s->index];
+ }
+ }
+
+ fprintf (stderr, "%s: ", s->argv[0]);
+ switch (err) {
+ case SCANOPT_ERR_ARG_NOT_ALLOWED:
+ fprintf (stderr,
+ _
+ ("option `%s' doesn't allow an argument\n"),
+ optname);
+ break;
+ case SCANOPT_ERR_ARG_NOT_FOUND:
+ fprintf (stderr,
+ _("option `%s' requires an argument\n"),
+ optname);
+ break;
+ case SCANOPT_ERR_OPT_AMBIGUOUS:
+ fprintf (stderr, _("option `%s' is ambiguous\n"),
+ optname);
+ break;
+ case SCANOPT_ERR_OPT_UNRECOGNIZED:
+ fprintf (stderr, _("Unrecognized option `%s'\n"),
+ optname);
+ break;
+ default:
+ fprintf (stderr, _("Unknown error=(%d)\n"), err);
+ break;
+ }
+ }
+ return err;
+}
+
+
+/* Internal. Match str against the regex ^--([^=]+)(=(.*))?
+ * return 1 if *looks* like a long option.
+ * 'str' is the only input argument, the rest of the arguments are output only.
+ * optname will point to str + 2
+ *
+ */
+static int matchlongopt (str, optname, optlen, arg, arglen)
+ char *str;
+ char **optname;
+ int *optlen;
+ char **arg;
+ int *arglen;
+{
+ char *p;
+
+ *optname = *arg = (char *) 0;
+ *optlen = *arglen = 0;
+
+ /* Match regex /--./ */
+ p = str;
+ if (p[0] != '-' || p[1] != '-' || !p[2])
+ return 0;
+
+ p += 2;
+ *optname = (char *) p;
+
+ /* find the end of optname */
+ while (*p && *p != '=')
+ ++p;
+
+ *optlen = p - *optname;
+
+ if (!*p)
+ /* an option with no '=...' part. */
+ return 1;
+
+
+ /* We saw an '=' char. The rest of p is the arg. */
+ p++;
+ *arg = p;
+ while (*p)
+ ++p;
+ *arglen = p - *arg;
+
+ return 1;
+}
+
+
+/* Internal. Look up long or short option by name.
+ * Long options must match a non-ambiguous prefix, or exact match.
+ * Short options must be exact.
+ * Return boolean true if found and no error.
+ * Error stored in err_code or zero if no error. */
+static int find_opt (s, lookup_long, optstart, len, err_code, opt_offset)
+ struct _scanopt_t *s;
+ int lookup_long;
+ char *optstart;
+ int len;
+ int *err_code;
+ int *opt_offset;
+{
+ int nmatch = 0, lastr_val = 0, i;
+
+ *err_code = 0;
+ *opt_offset = -1;
+
+ if (!optstart)
+ return 0;
+
+ for (i = 0; i < s->optc; i++) {
+ char *optname;
+
+ optname =
+ (char *) (s->options[i].opt_fmt +
+ (lookup_long ? 2 : 1));
+
+ if (lookup_long && (s->aux[i].flags & IS_LONG)) {
+ if (len > s->aux[i].namelen)
+ continue;
+
+ if (strncmp (optname, optstart, len) == 0) {
+ nmatch++;
+ *opt_offset = i;
+
+ /* exact match overrides all. */
+ if (len == s->aux[i].namelen) {
+ nmatch = 1;
+ break;
+ }
+
+ /* ambiguity is ok between aliases. */
+ if (lastr_val
+ && lastr_val ==
+ s->options[i].r_val) nmatch--;
+ lastr_val = s->options[i].r_val;
+ }
+ }
+ else if (!lookup_long && !(s->aux[i].flags & IS_LONG)) {
+ if (optname[0] == optstart[0]) {
+ nmatch++;
+ *opt_offset = i;
+ }
+ }
+ }
+
+ if (nmatch == 0) {
+ *err_code = SCANOPT_ERR_OPT_UNRECOGNIZED;
+ *opt_offset = -1;
+ }
+ else if (nmatch > 1) {
+ *err_code = SCANOPT_ERR_OPT_AMBIGUOUS;
+ *opt_offset = -1;
+ }
+
+ return *err_code ? 0 : 1;
+}
+
+
+int scanopt (svoid, arg, optindex)
+ scanopt_t *svoid;
+ char **arg;
+ int *optindex;
+{
+ char *optname = NULL, *optarg = NULL, *pstart;
+ int namelen = 0, arglen = 0;
+ int errcode = 0, has_next;
+ const optspec_t *optp;
+ struct _scanopt_t *s;
+ struct _aux *auxp;
+ int is_short;
+ int opt_offset = -1;
+
+ s = (struct _scanopt_t *) svoid;
+
+ /* Normalize return-parameters. */
+ SAFE_ASSIGN (arg, NULL);
+ SAFE_ASSIGN (optindex, s->index);
+
+ if (s->index >= s->argc)
+ return 0;
+
+ /* pstart always points to the start of our current scan. */
+ pstart = s->argv[s->index] + s->subscript;
+ if (!pstart)
+ return 0;
+
+ if (s->subscript == 0) {
+
+ /* test for exact match of "--" */
+ if (pstart[0] == '-' && pstart[1] == '-' && !pstart[2]) {
+ SAFE_ASSIGN (optindex, s->index + 1);
+ INC_INDEX (s, 1);
+ return 0;
+ }
+
+ /* Match an opt. */
+ if (matchlongopt
+ (pstart, &optname, &namelen, &optarg, &arglen)) {
+
+ /* it LOOKS like an opt, but is it one?! */
+ if (!find_opt
+ (s, 1, optname, namelen, &errcode,
+ &opt_offset)) {
+ scanopt_err (s, 0, errcode);
+ return errcode;
+ }
+ /* We handle this below. */
+ is_short = 0;
+
+ /* Check for short opt. */
+ }
+ else if (pstart[0] == '-' && pstart[1]) {
+ /* Pass through to below. */
+ is_short = 1;
+ s->subscript++;
+ pstart++;
+ }
+
+ else {
+ /* It's not an option. We're done. */
+ return 0;
+ }
+ }
+
+ /* We have to re-check the subscript status because it
+ * may have changed above. */
+
+ if (s->subscript != 0) {
+
+ /* we are somewhere in a run of short opts,
+ * e.g., at the 'z' in `tar -xzf` */
+
+ optname = pstart;
+ namelen = 1;
+ is_short = 1;
+
+ if (!find_opt
+ (s, 0, pstart, namelen, &errcode, &opt_offset)) {
+ return scanopt_err (s, 1, errcode);
+ }
+
+ optarg = pstart + 1;
+ if (!*optarg) {
+ optarg = NULL;
+ arglen = 0;
+ }
+ else
+ arglen = strlen (optarg);
+ }
+
+ /* At this point, we have a long or short option matched at opt_offset into
+ * the s->options array (and corresponding aux array).
+ * A trailing argument is in {optarg,arglen}, if any.
+ */
+
+ /* Look ahead in argv[] to see if there is something
+ * that we can use as an argument (if needed). */
+ has_next = s->index + 1 < s->argc
+ && strcmp ("--", s->argv[s->index + 1]) != 0;
+
+ optp = s->options + opt_offset;
+ auxp = s->aux + opt_offset;
+
+ /* case: no args allowed */
+ if (auxp->flags & ARG_NONE) {
+ if (optarg && !is_short) {
+ scanopt_err (s, is_short, errcode = SCANOPT_ERR_ARG_NOT_ALLOWED);
+ INC_INDEX (s, 1);
+ return errcode;
+ }
+ else if (!optarg)
+ INC_INDEX (s, 1);
+ else
+ s->subscript++;
+ return optp->r_val;
+ }
+
+ /* case: required */
+ if (auxp->flags & ARG_REQ) {
+ if (!optarg && !has_next)
+ return scanopt_err (s, is_short, SCANOPT_ERR_ARG_NOT_FOUND);
+
+ if (!optarg) {
+ /* Let the next argv element become the argument. */
+ SAFE_ASSIGN (arg, s->argv[s->index + 1]);
+ INC_INDEX (s, 2);
+ }
+ else {
+ SAFE_ASSIGN (arg, (char *) optarg);
+ INC_INDEX (s, 1);
+ }
+ return optp->r_val;
+ }
+
+ /* case: optional */
+ if (auxp->flags & ARG_OPT) {
+ SAFE_ASSIGN (arg, optarg);
+ INC_INDEX (s, 1);
+ return optp->r_val;
+ }
+
+
+ /* Should not reach here. */
+ return 0;
+}
+
+
+int scanopt_destroy (svoid)
+ scanopt_t *svoid;
+{
+ struct _scanopt_t *s;
+
+ s = (struct _scanopt_t *) svoid;
+ if (s) {
+ if (s->aux)
+ free (s->aux);
+ free (s);
+ }
+ return 0;
+}
+
+
+/* vim:set tabstop=8 softtabstop=4 shiftwidth=4: */
diff --git a/src/scanopt.h b/src/scanopt.h
new file mode 100644
index 0000000..359a18a
--- /dev/null
+++ b/src/scanopt.h
@@ -0,0 +1,132 @@
+/* flex - tool to generate fast lexical analyzers */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#ifndef SCANOPT_H
+#define SCANOPT_H
+
+#include "flexdef.h"
+
+
+#ifndef NO_SCANOPT_USAGE
+/* Used by scanopt_usage for pretty-printing. */
+#ifdef HAVE_NCURSES_H
+#include <ncurses.h>
+#endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifndef PROTO
+#define PROTO(args) args
+#endif
+/* Error codes. */ enum scanopt_err_t {
+ SCANOPT_ERR_OPT_UNRECOGNIZED = -1, /* Unrecognized option. */
+ SCANOPT_ERR_OPT_AMBIGUOUS = -2, /* It matched more than one option name. */
+ SCANOPT_ERR_ARG_NOT_FOUND = -3, /* The required arg was not found. */
+ SCANOPT_ERR_ARG_NOT_ALLOWED = -4 /* Option does not take an argument. */
+ };
+
+
+/* flags passed to scanopt_init */
+ enum scanopt_flag_t {
+ SCANOPT_NO_ERR_MSG = 0x01 /* Suppress printing to stderr. */
+ };
+
+/* Specification for a single option. */
+ struct optspec_t {
+ const char *opt_fmt; /* e.g., "--foo=FILE", "-f FILE", "-n [NUM]" */
+ int r_val; /* Value to be returned by scanopt_ex(). */
+ const char *desc; /* Brief description of this option, or NULL. */
+ };
+ typedef struct optspec_t optspec_t;
+
+
+/* Used internally by scanopt() to maintain state. */
+/* Never modify these value directly. */
+ typedef void *scanopt_t;
+
+
+/* Initializes scanner and checks option list for errors.
+ * Parameters:
+ * options - Array of options.
+ * argc - Same as passed to main().
+ * argv - Same as passed to main(). First element is skipped.
+ * flags - Control behavior.
+ * Return: A malloc'd pointer .
+ */
+ scanopt_t *scanopt_init PROTO ((const optspec_t * options,
+ int argc, char **argv, int flags));
+
+/* Frees memory used by scanner.
+ * Always returns 0. */
+ int scanopt_destroy PROTO ((scanopt_t * scanner));
+
+#ifndef NO_SCANOPT_USAGE
+/* Prints a usage message based on contents of optlist.
+ * Parameters:
+ * scanner - The scanner, already initialized with scanopt_init().
+ * fp - The file stream to write to.
+ * usage - Text to be prepended to option list. May be NULL.
+ * Return: Always returns 0 (zero).
+ */
+ int scanopt_usage
+ PROTO (
+ (scanopt_t * scanner, FILE * fp,
+ const char *usage));
+#endif
+
+/* Scans command-line options in argv[].
+ * Parameters:
+ * scanner - The scanner, already initialized with scanopt_init().
+ * optarg - Return argument, may be NULL.
+ * On success, it points to start of an argument.
+ * optindex - Return argument, may be NULL.
+ * On success or failure, it is the index of this option.
+ * If return is zero, then optindex is the NEXT valid option index.
+ *
+ * Return: > 0 on success. Return value is from optspec_t->rval.
+ * == 0 if at end of options.
+ * < 0 on error (return value is an error code).
+ *
+ */
+ int scanopt
+ PROTO (
+ (scanopt_t * scanner, char **optarg,
+ int *optindex));
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+/* vim:set tabstop=8 softtabstop=4 shiftwidth=4: */
diff --git a/src/skel.c b/src/skel.c
new file mode 100644
index 0000000..ef657d3
--- /dev/null
+++ b/src/skel.c
@@ -0,0 +1,3835 @@
+/* File created from flex.skl via mkskel.sh */
+
+#include "flexdef.h"
+
+const char *skel[] = {
+ "%# -*-C-*- vi: set ft=c:",
+ "%# This file is processed in several stages.",
+ "%# Here are the stages, as best as I can describe:",
+ "%#",
+ "%# 1. flex.skl is processed through GNU m4 during the",
+ "%# pre-compilation stage of flex. Only macros starting",
+ "%# with `m4_' are processed, and quoting is normal.",
+ "%#",
+ "%# 2. The preprocessed skeleton is translated verbatim into a",
+ "%# C array, saved as \"skel.c\" and compiled into the flex binary.",
+ "%#",
+ "%# 3. At runtime, the skeleton is generated and filtered (again)",
+ "%# through m4. Macros beginning with `m4_' will be processed.",
+ "%# The quoting is \"[[\" and \"]]\" so we don't interfere with",
+ "%# user code.",
+ "%# ",
+ "%# All generate macros for the m4 stage contain the text \"m4\" or \"M4\"",
+ "%# in them. This is to distinguish them from CPP macros.",
+ "%# The exception to this rule is YY_G, which is an m4 macro, ",
+ "%# but it needs to be remain short because it is used everywhere.",
+ "%#",
+ "/* A lexical scanner generated by flex */",
+ "",
+ "%# Macros for preproc stage.",
+ "",
+ "",
+ "%# Macros for runtime processing stage.",
+ "m4_changecom",
+ "m4_changequote",
+ "m4_changequote([[, ]])",
+ "",
+ "%# ",
+ "%# Lines in this skeleton starting with a \"%\" character are \"control lines\"",
+ "%# and affect the generation of the scanner. The possible control codes are",
+ "%# listed and processed in misc.c.",
+ "%#",
+ "%# %# - A comment. The current line is omitted from the generated scanner.",
+ "%# %if-c++-only - The following lines are printed for C++ scanners ONLY.",
+ "%# %if-c-only - The following lines are NOT printed for C++ scanners.",
+ "%# %if-c-or-c++ - The following lines are printed in BOTH C and C++ scanners.",
+ "%# %if-reentrant - Print for reentrant scanners.(push)",
+ "%# %if-not-reentrant - Print for non-reentrant scanners. (push)",
+ "%# %if-bison-bridge - Print for bison-bridge. (push)",
+ "%# %if-not-bison-bridge - Print for non-bison-bridge. (push)",
+ "%# %endif - pop from the previous if code.",
+ "%# %% - A stop-point, where code is inserted by flex.",
+ "%# Each stop-point is numbered here and also in the code generator.",
+ "%# (See gen.c, etc. for details.)",
+ "%# %not-for-header - Begin code that should NOT appear in a \".h\" file.",
+ "%# %ok-for-header - %c and %e are used for building a header file.",
+ "%# %if-tables-serialization",
+ "%#",
+ "%# All control-lines EXCEPT comment lines (\"%#\") will be inserted into",
+ "%# the generated scanner as a C-style comment. This is to aid those who",
+ "%# edit the skeleton.",
+ "%#",
+ "",
+ "%not-for-header",
+ "%if-c-only",
+ "%if-not-reentrant",
+ "m4_ifelse(M4_YY_PREFIX,yy,,",
+ "#define yy_create_buffer M4_YY_PREFIX[[_create_buffer]]",
+ "#define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]]",
+ "#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]",
+ "#define yy_init_buffer M4_YY_PREFIX[[_init_buffer]]",
+ "#define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]]",
+ "#define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]]",
+ "#define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]]",
+ "#define yyin M4_YY_PREFIX[[in]]",
+ "#define yyleng M4_YY_PREFIX[[leng]]",
+ "#define yylex M4_YY_PREFIX[[lex]]",
+ "#define yylineno M4_YY_PREFIX[[lineno]]",
+ "#define yyout M4_YY_PREFIX[[out]]",
+ "#define yyrestart M4_YY_PREFIX[[restart]]",
+ "#define yytext M4_YY_PREFIX[[text]]",
+ "#define yywrap M4_YY_PREFIX[[wrap]]",
+ "#define yyalloc M4_YY_PREFIX[[alloc]]",
+ "#define yyrealloc M4_YY_PREFIX[[realloc]]",
+ "#define yyfree M4_YY_PREFIX[[free]]",
+ ")",
+ "%endif",
+ "%endif",
+ "%ok-for-header",
+ "",
+ "#define FLEX_SCANNER",
+ "#define YY_FLEX_MAJOR_VERSION 2",
+ "#define YY_FLEX_MINOR_VERSION 6",
+ "#define YY_FLEX_SUBMINOR_VERSION 0",
+ "#if YY_FLEX_SUBMINOR_VERSION > 0",
+ "#define FLEX_BETA",
+ "#endif",
+ "",
+ "%# Some negated symbols",
+ "m4_ifdef( [[M4_YY_IN_HEADER]], , [[m4_define([[M4_YY_NOT_IN_HEADER]], [[]])]])",
+ "m4_ifdef( [[M4_YY_REENTRANT]], , [[m4_define([[M4_YY_NOT_REENTRANT]], [[]])]])",
+ "",
+ "%# This is the m4 way to say \"(stack_used || is_reentrant)",
+ "m4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])",
+ "m4_ifdef( [[M4_YY_REENTRANT]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])",
+ "",
+ "%# Prefixes.",
+ "%# The complexity here is necessary so that m4 preserves",
+ "%# the argument lists to each C function.",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])",
+ "",
+ "",
+ "",
+ "%if-c++-only",
+ " /* The c++ scanner is a mess. The FlexLexer.h header file relies on the",
+ " * following macro. This is required in order to pass the c++-multiple-scanners",
+ " * test in the regression suite. We get reports that it breaks inheritance.",
+ " * We will address this in a future release of flex, or omit the C++ scanner",
+ " * altogether.",
+ " */",
+ " #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]]",
+ "%endif",
+ "",
+ "%if-c-only",
+ " m4_define(yy[[_create_buffer]], [[M4_YY_PREFIX[[_create_buffer]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_delete_buffer]], [[M4_YY_PREFIX[[_delete_buffer]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_scan_buffer]], [[M4_YY_PREFIX[[_scan_buffer]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_scan_string]], [[M4_YY_PREFIX[[_scan_string]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_scan_bytes]], [[M4_YY_PREFIX[[_scan_bytes]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_init_buffer]], [[M4_YY_PREFIX[[_init_buffer]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_flush_buffer]], [[M4_YY_PREFIX[[_flush_buffer]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_load_buffer_state]], [[M4_YY_PREFIX[[_load_buffer_state]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_switch_to_buffer]], [[M4_YY_PREFIX[[_switch_to_buffer]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[push_buffer_state]], [[M4_YY_PREFIX[[push_buffer_state]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[pop_buffer_state]], [[M4_YY_PREFIX[[pop_buffer_state]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[ensure_buffer_stack]], [[M4_YY_PREFIX[[ensure_buffer_stack]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[lex]], [[M4_YY_PREFIX[[lex]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[restart]], [[M4_YY_PREFIX[[restart]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[lex_init]], [[M4_YY_PREFIX[[lex_init]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[lex_init_extra]], [[M4_YY_PREFIX[[lex_init_extra]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[lex_destroy]], [[M4_YY_PREFIX[[lex_destroy]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_debug]], [[M4_YY_PREFIX[[get_debug]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_debug]], [[M4_YY_PREFIX[[set_debug]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_extra]], [[M4_YY_PREFIX[[get_extra]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_extra]], [[M4_YY_PREFIX[[set_extra]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_in]], [[M4_YY_PREFIX[[get_in]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_in]], [[M4_YY_PREFIX[[set_in]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_out]], [[M4_YY_PREFIX[[get_out]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_out]], [[M4_YY_PREFIX[[set_out]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_leng]], [[M4_YY_PREFIX[[get_leng]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_text]], [[M4_YY_PREFIX[[get_text]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[get_lineno]], [[M4_YY_PREFIX[[get_lineno]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_lineno]], [[M4_YY_PREFIX[[set_lineno]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_ifdef( [[M4_YY_REENTRANT]],",
+ " [[",
+ " m4_define(yy[[get_column]], [[M4_YY_PREFIX[[get_column]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_column]], [[M4_YY_PREFIX[[set_column]]m4_ifelse($#,0,,[[($@)]])]])",
+ " ]])",
+ " m4_define(yy[[wrap]], [[M4_YY_PREFIX[[wrap]]m4_ifelse($#,0,,[[($@)]])]])",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_BISON_LVAL]],",
+ "[[",
+ " m4_define(yy[[get_lval]], [[M4_YY_PREFIX[[get_lval]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_lval]], [[M4_YY_PREFIX[[set_lval]]m4_ifelse($#,0,,[[($@)]])]])",
+ "]])",
+ "",
+ "m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ "[[",
+ " m4_define(yy[[get_lloc]], [[M4_YY_PREFIX[[get_lloc]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[set_lloc]], [[M4_YY_PREFIX[[set_lloc]]m4_ifelse($#,0,,[[($@)]])]])",
+ "]])",
+ "",
+ "",
+ " m4_define(yy[[alloc]], [[M4_YY_PREFIX[[alloc]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[realloc]], [[M4_YY_PREFIX[[realloc]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[free]], [[M4_YY_PREFIX[[free]]m4_ifelse($#,0,,[[($@)]])]])",
+ "",
+ "%if-c-only",
+ "m4_ifdef( [[M4_YY_NOT_REENTRANT]],",
+ "[[",
+ " m4_define(yy[[text]], [[M4_YY_PREFIX[[text]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[leng]], [[M4_YY_PREFIX[[leng]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[in]], [[M4_YY_PREFIX[[in]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[out]], [[M4_YY_PREFIX[[out]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[_flex_debug]], [[M4_YY_PREFIX[[_flex_debug]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[lineno]], [[M4_YY_PREFIX[[lineno]]m4_ifelse($#,0,,[[($@)]])]])",
+ "]])",
+ "%endif",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],",
+ "[[",
+ " m4_define(yy[[tables_fload]], [[M4_YY_PREFIX[[tables_fload]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[tables_destroy]], [[M4_YY_PREFIX[[tables_destroy]]m4_ifelse($#,0,,[[($@)]])]])",
+ " m4_define(yy[[TABLES_NAME]], [[M4_YY_PREFIX[[TABLES_NAME]]m4_ifelse($#,0,,[[($@)]])]])",
+ "]])",
+ "",
+ "/* First, we deal with platform-specific or compiler-specific issues. */",
+ "",
+ "/* begin standard C headers. */",
+ "%if-c-only",
+ "#include <stdio.h>",
+ "#include <string.h>",
+ "#include <errno.h>",
+ "#include <stdlib.h>",
+ "%endif",
+ "",
+ "%if-tables-serialization",
+ "#include <sys/types.h>",
+ "#include <netinet/in.h>",
+ "%endif",
+ "/* end standard C headers. */",
+ "",
+ "%if-c-or-c++",
+ "/* flex integer type definitions */",
+ "",
+ "#ifndef FLEXINT_H",
+ "#define FLEXINT_H",
+ "",
+ "/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */",
+ "",
+ "#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L",
+ "",
+ "/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,",
+ " * if you want the limit (max/min) macros for int types. ",
+ " */",
+ "#ifndef __STDC_LIMIT_MACROS",
+ "#define __STDC_LIMIT_MACROS 1",
+ "#endif",
+ "",
+ "#include <inttypes.h>",
+ "typedef int8_t flex_int8_t;",
+ "typedef uint8_t flex_uint8_t;",
+ "typedef int16_t flex_int16_t;",
+ "typedef uint16_t flex_uint16_t;",
+ "typedef int32_t flex_int32_t;",
+ "typedef uint32_t flex_uint32_t;",
+ "#else",
+ "typedef signed char flex_int8_t;",
+ "typedef short int flex_int16_t;",
+ "typedef int flex_int32_t;",
+ "typedef unsigned char flex_uint8_t; ",
+ "typedef unsigned short int flex_uint16_t;",
+ "typedef unsigned int flex_uint32_t;",
+ "",
+ "/* Limits of integral types. */",
+ "#ifndef INT8_MIN",
+ "#define INT8_MIN (-128)",
+ "#endif",
+ "#ifndef INT16_MIN",
+ "#define INT16_MIN (-32767-1)",
+ "#endif",
+ "#ifndef INT32_MIN",
+ "#define INT32_MIN (-2147483647-1)",
+ "#endif",
+ "#ifndef INT8_MAX",
+ "#define INT8_MAX (127)",
+ "#endif",
+ "#ifndef INT16_MAX",
+ "#define INT16_MAX (32767)",
+ "#endif",
+ "#ifndef INT32_MAX",
+ "#define INT32_MAX (2147483647)",
+ "#endif",
+ "#ifndef UINT8_MAX",
+ "#define UINT8_MAX (255U)",
+ "#endif",
+ "#ifndef UINT16_MAX",
+ "#define UINT16_MAX (65535U)",
+ "#endif",
+ "#ifndef UINT32_MAX",
+ "#define UINT32_MAX (4294967295U)",
+ "#endif",
+ "",
+ "#endif /* ! C99 */",
+ "",
+ "#endif /* ! FLEXINT_H */",
+ "",
+ "%endif",
+ "",
+ "%if-c++-only",
+ "/* begin standard C++ headers. */",
+ "#include <iostream> ",
+ "#include <errno.h>",
+ "#include <cstdlib>",
+ "#include <cstdio>",
+ "#include <cstring>",
+ "/* end standard C++ headers. */",
+ "%endif",
+ "",
+ "#ifdef __cplusplus",
+ "",
+ "/* The \"const\" storage-class-modifier is valid. */",
+ "#define YY_USE_CONST",
+ "",
+ "#else /* ! __cplusplus */",
+ "",
+ "/* C99 requires __STDC__ to be defined as 1. */",
+ "#if defined (__STDC__)",
+ "",
+ "#define YY_USE_CONST",
+ "",
+ "#endif /* defined (__STDC__) */",
+ "#endif /* ! __cplusplus */",
+ "",
+ "#ifdef YY_USE_CONST",
+ "#define yyconst const",
+ "#else",
+ "#define yyconst",
+ "#endif",
+ "",
+ "%# For compilers that can not handle prototypes.",
+ "%# e.g.,",
+ "%# The function prototype",
+ "%# int foo(int x, char* y);",
+ "%# ",
+ "%# ...should be written as",
+ "%# int foo M4_YY_PARAMS(int x, char* y);",
+ "%# ",
+ "%# ...which could possibly generate",
+ "%# int foo ();",
+ "%# ",
+ "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],",
+ "[[",
+ " m4_define( [[M4_YY_PARAMS]], [[()]])",
+ "]],",
+ "[[",
+ " m4_define( [[M4_YY_PARAMS]], [[($*)]])",
+ "]])",
+ "",
+ "%not-for-header",
+ "/* Returned upon end-of-file. */",
+ "#define YY_NULL 0",
+ "%ok-for-header",
+ "",
+ "%not-for-header",
+ "/* Promotes a possibly negative, possibly signed char to an unsigned",
+ " * integer for use as an array index. If the signed char is negative,",
+ " * we want to instead treat it as an 8-bit unsigned char, hence the",
+ " * double cast.",
+ " */",
+ "#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)",
+ "%ok-for-header",
+ "",
+ "",
+ "",
+ "%if-reentrant",
+ "",
+ "/* An opaque pointer. */",
+ "#ifndef YY_TYPEDEF_YY_SCANNER_T",
+ "#define YY_TYPEDEF_YY_SCANNER_T",
+ "typedef void* yyscan_t;",
+ "#endif",
+ "",
+ "%# Declare yyguts variable",
+ "m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]])",
+ "%# Perform a noop access on yyguts to prevent unused variable complains",
+ "m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[(void)yyg]])",
+ "%# For use wherever a Global is accessed or assigned.",
+ "m4_define( [[YY_G]], [[yyg->$1]])",
+ "",
+ "%# For use in function prototypes to append the additional argument.",
+ "m4_define( [[M4_YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]])",
+ "m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]])",
+ "",
+ "%# For use in function definitions to append the additional argument.",
+ "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],",
+ "[[",
+ " m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])",
+ " m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])",
+ "]],",
+ "[[",
+ " m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]])",
+ " m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]])",
+ "]])",
+ "m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]])",
+ "",
+ "%# For use in function calls to pass the additional argument.",
+ "m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]])",
+ "m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]])",
+ "",
+ "%# For use in function documentation to adjust for additional argument.",
+ "m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])",
+ "",
+ "/* For convenience, these vars (plus the bison vars far below)",
+ " are macros in the reentrant scanner. */",
+ "#define yyin YY_G(yyin_r)",
+ "#define yyout YY_G(yyout_r)",
+ "#define yyextra YY_G(yyextra_r)",
+ "#define yyleng YY_G(yyleng_r)",
+ "#define yytext YY_G(yytext_r)",
+ "#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)",
+ "#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)",
+ "#define yy_flex_debug YY_G(yy_flex_debug_r)",
+ "",
+ "m4_define( [[M4_YY_INCR_LINENO]],",
+ "[[ ",
+ " do{ yylineno++;",
+ " yycolumn=0;",
+ " }while(0)",
+ "]])",
+ "",
+ "%endif",
+ "",
+ "",
+ "",
+ "%if-not-reentrant",
+ "",
+ "m4_define( [[M4_YY_INCR_LINENO]],",
+ "[[ ",
+ " yylineno++;",
+ "]])",
+ "",
+ "%# Define these macros to be no-ops.",
+ "m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]])",
+ "m4_define( [[M4_YY_NOOP_GUTS_VAR]], [[m4_dnl]])",
+ "m4_define( [[YY_G]], [[($1)]])",
+ "m4_define( [[M4_YY_PROTO_LAST_ARG]])",
+ "m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]])",
+ "m4_define( [[M4_YY_DEF_LAST_ARG]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],",
+ "[[",
+ " m4_define( [[M4_YY_DEF_ONLY_ARG]])",
+ "]],",
+ "[[",
+ " m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]])",
+ "]])",
+ "m4_define([[M4_YY_DECL_LAST_ARG]])",
+ "m4_define([[M4_YY_CALL_LAST_ARG]])",
+ "m4_define([[M4_YY_CALL_ONLY_ARG]])",
+ "m4_define( [[M4_YY_DOC_PARAM]], [[]])",
+ "",
+ "%endif",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],",
+ "[[",
+ "%# For compilers that need traditional function definitions.",
+ "%# e.g.,",
+ "%# The function prototype taking 2 arguments",
+ "%# int foo (int x, char* y)",
+ "%#",
+ "%# ...should be written as",
+ "%# int foo YYFARGS2(int,x, char*,y)",
+ "%#",
+ "%# ...which could possibly generate",
+ "%# int foo (x,y,yyscanner)",
+ "%# int x;",
+ "%# char * y;",
+ "%# yyscan_t yyscanner;",
+ "%#",
+ "%# Generate traditional function defs",
+ " m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\\]]",
+ " M4_YY_DECL_LAST_ARG]])",
+ " m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\\]]",
+ " $1 $2; [[\\]]",
+ " M4_YY_DECL_LAST_ARG]])",
+ " m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\\]]",
+ " $1 $2; [[\\]]",
+ " $3 $4; [[\\]]",
+ " M4_YY_DECL_LAST_ARG]])",
+ " m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\\]]",
+ " $1 $2; [[\\]]",
+ " $3 $4; [[\\]]",
+ " $5 $6; [[\\]]",
+ " M4_YY_DECL_LAST_ARG]])",
+ "]],",
+ "[[",
+ "%# Generate C99 function defs.",
+ " m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]])",
+ " m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]])",
+ " m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]])",
+ " m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]])",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Enter a start condition. This macro really ought to take a parameter,",
+ " * but we do it the disgusting crufty way forced on us by the ()-less",
+ " * definition of BEGIN.",
+ " */",
+ "#define BEGIN YY_G(yy_start) = 1 + 2 *",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Translate the current start state into a value that can be later handed",
+ " * to BEGIN to return to the state. The YYSTATE alias is for lex",
+ " * compatibility.",
+ " */",
+ "#define YY_START ((YY_G(yy_start) - 1) / 2)",
+ "#define YYSTATE YY_START",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Action number for EOF rule of a given start state. */",
+ "#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Special action meaning \"start processing a new file\". */",
+ "#define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define YY_END_OF_BUFFER_CHAR 0",
+ "]])",
+ "",
+ "/* Size of default input buffer. */",
+ "#ifndef YY_BUF_SIZE",
+ "#ifdef __ia64__",
+ "/* On IA-64, the buffer size is 16k, not 8k.",
+ " * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.",
+ " * Ditto for the __ia64__ case accordingly.",
+ " */",
+ "#define YY_BUF_SIZE 32768",
+ "#else",
+ "#define YY_BUF_SIZE 16384",
+ "#endif /* __ia64__ */",
+ "#endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* The state buf must be large enough to hold one state per character in the main buffer.",
+ " */",
+ "#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))",
+ "]])",
+ "",
+ "",
+ "#ifndef YY_TYPEDEF_YY_BUFFER_STATE",
+ "#define YY_TYPEDEF_YY_BUFFER_STATE",
+ "typedef struct yy_buffer_state *YY_BUFFER_STATE;",
+ "#endif",
+ "",
+ "#ifndef YY_TYPEDEF_YY_SIZE_T",
+ "#define YY_TYPEDEF_YY_SIZE_T",
+ "typedef size_t yy_size_t;",
+ "#endif",
+ "",
+ "%if-not-reentrant",
+ "extern yy_size_t yyleng;",
+ "%endif",
+ "",
+ "%if-c-only",
+ "%if-not-reentrant",
+ "extern FILE *yyin, *yyout;",
+ "%endif",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define EOB_ACT_CONTINUE_SCAN 0",
+ "#define EOB_ACT_END_OF_FILE 1",
+ "#define EOB_ACT_LAST_MATCH 2",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_USE_LINENO]],",
+ " [[",
+ " /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires",
+ " * access to the local variable yy_act. Since yyless() is a macro, it would break",
+ " * existing scanners that call yyless() from OUTSIDE yylex. ",
+ " * One obvious solution it to make yy_act a global. I tried that, and saw",
+ " * a 5% performance hit in a non-yylineno scanner, because yy_act is",
+ " * normally declared as a register variable-- so it is not worth it.",
+ " */",
+ " #define YY_LESS_LINENO(n) \\",
+ " do { \\",
+ " int yyl;\\",
+ " for ( yyl = n; yyl < yyleng; ++yyl )\\",
+ " if ( yytext[yyl] == '\\n' )\\",
+ " --yylineno;\\",
+ " }while(0)",
+ " #define YY_LINENO_REWIND_TO(dst) \\",
+ " do {\\",
+ " const char *p;\\",
+ " for ( p = yy_cp-1; p >= (dst); --p)\\",
+ " if ( *p == '\\n' )\\",
+ " --yylineno;\\",
+ " }while(0)",
+ " ]],",
+ " [[",
+ " #define YY_LESS_LINENO(n)",
+ " #define YY_LINENO_REWIND_TO(ptr)",
+ " ]])",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Return all but the first \"n\" matched characters back to the input stream. */",
+ "#define yyless(n) \\",
+ " do \\",
+ " { \\",
+ " /* Undo effects of setting up yytext. */ \\",
+ " int yyless_macro_arg = (n); \\",
+ " YY_LESS_LINENO(yyless_macro_arg);\\",
+ " *yy_cp = YY_G(yy_hold_char); \\",
+ " YY_RESTORE_YY_MORE_OFFSET \\",
+ " YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\",
+ " YY_DO_BEFORE_ACTION; /* set up yytext again */ \\",
+ " } \\",
+ " while ( 0 )",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )",
+ "]])",
+ "",
+ "#ifndef YY_STRUCT_YY_BUFFER_STATE",
+ "#define YY_STRUCT_YY_BUFFER_STATE",
+ "struct yy_buffer_state",
+ " {",
+ "%if-c-only",
+ " FILE *yy_input_file;",
+ "%endif",
+ "",
+ "%if-c++-only",
+ " std::streambuf* yy_input_file; ",
+ "%endif",
+ "",
+ "",
+ " char *yy_ch_buf; /* input buffer */",
+ " char *yy_buf_pos; /* current position in input buffer */",
+ "",
+ " /* Size of input buffer in bytes, not including room for EOB",
+ " * characters.",
+ " */",
+ " yy_size_t yy_buf_size;",
+ "",
+ " /* Number of characters read into yy_ch_buf, not including EOB",
+ " * characters.",
+ " */",
+ " yy_size_t yy_n_chars;",
+ "",
+ " /* Whether we \"own\" the buffer - i.e., we know we created it,",
+ " * and can realloc() it to grow it, and should free() it to",
+ " * delete it.",
+ " */",
+ " int yy_is_our_buffer;",
+ "",
+ " /* Whether this is an \"interactive\" input source; if so, and",
+ " * if we're using stdio for input, then we want to use getc()",
+ " * instead of fread(), to make sure we stop fetching input after",
+ " * each newline.",
+ " */",
+ " int yy_is_interactive;",
+ "",
+ " /* Whether we're considered to be at the beginning of a line.",
+ " * If so, '^' rules will be active on the next match, otherwise",
+ " * not.",
+ " */",
+ " int yy_at_bol;",
+ "",
+ " int yy_bs_lineno; /**< The line count. */",
+ " int yy_bs_column; /**< The column count. */",
+ " ",
+ "",
+ " /* Whether to try to fill the input buffer when we reach the",
+ " * end of it.",
+ " */",
+ " int yy_fill_buffer;",
+ "",
+ " int yy_buffer_status;",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define YY_BUFFER_NEW 0",
+ "#define YY_BUFFER_NORMAL 1",
+ " /* When an EOF's been seen but there's still some text to process",
+ " * then we mark the buffer as YY_EOF_PENDING, to indicate that we",
+ " * shouldn't try reading from the input source any more. We might",
+ " * still have a bunch of tokens to match, though, because of",
+ " * possible backing-up.",
+ " *",
+ " * When we actually see the EOF, we change the status to \"new\"",
+ " * (via yyrestart()), so that the user can continue scanning by",
+ " * just pointing yyin at a new input file.",
+ " */",
+ "#define YY_BUFFER_EOF_PENDING 2",
+ "]])",
+ " };",
+ "#endif /* !YY_STRUCT_YY_BUFFER_STATE */",
+ "",
+ "%if-c-only Standard (non-C++) definition",
+ "%not-for-header",
+ "%if-not-reentrant",
+ "",
+ "/* Stack of input buffers. */",
+ "static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */",
+ "static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */",
+ "static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */",
+ "%endif",
+ "%ok-for-header",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* We provide macros for accessing buffer states in case in the",
+ " * future we want to put the buffer states in a more general",
+ " * \"scanner state\".",
+ " *",
+ " * Returns the top of the stack, or NULL.",
+ " */",
+ "#define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \\",
+ " ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \\",
+ " : NULL)",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Same as previous macro, but useful when we know that the buffer stack is not",
+ " * NULL or when we need an lvalue. For internal use only.",
+ " */",
+ "#define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]",
+ "]])",
+ "",
+ "%if-c-only Standard (non-C++) definition",
+ "",
+ "%if-not-reentrant",
+ "%not-for-header",
+ "/* yy_hold_char holds the character lost when yytext is formed. */",
+ "static char yy_hold_char;",
+ "static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */",
+ "yy_size_t yyleng;",
+ "",
+ "/* Points to current character in buffer. */",
+ "static char *yy_c_buf_p = (char *) 0;",
+ "static int yy_init = 0; /* whether we need to initialize */",
+ "static int yy_start = 0; /* start state number */",
+ "",
+ "/* Flag which is used to allow yywrap()'s to do buffer switches",
+ " * instead of setting up a fresh yyin. A bit of a hack ...",
+ " */",
+ "static int yy_did_buffer_switch_on_eof;",
+ "%ok-for-header",
+ "%endif",
+ "",
+ "void yyrestart M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG );",
+ "void yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );",
+ "YY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG );",
+ "void yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );",
+ "void yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );",
+ "void yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );",
+ "void yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "static void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "static void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "static void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)",
+ "]])",
+ "",
+ "YY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG );",
+ "YY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG );",
+ "YY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, yy_size_t len M4_YY_PROTO_LAST_ARG );",
+ "",
+ "%endif",
+ "",
+ "void *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG );",
+ "void *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG );",
+ "void yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG );",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define yy_new_buffer yy_create_buffer",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define yy_set_interactive(is_interactive) \\",
+ " { \\",
+ " if ( ! YY_CURRENT_BUFFER ){ \\",
+ " yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \\",
+ " YY_CURRENT_BUFFER_LVALUE = \\",
+ " yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \\",
+ " } \\",
+ " YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\",
+ " }",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define yy_set_bol(at_bol) \\",
+ " { \\",
+ " if ( ! YY_CURRENT_BUFFER ){\\",
+ " yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \\",
+ " YY_CURRENT_BUFFER_LVALUE = \\",
+ " yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \\",
+ " } \\",
+ " YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\",
+ " }",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)",
+ "]])",
+ "",
+ "%% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "%% [1.5] DFA",
+ "]])",
+ "",
+ "%if-c-only Standard (non-C++) definition",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state M4_YY_PROTO_LAST_ARG);",
+ "static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "#if defined(__GNUC__) && __GNUC__ >= 3",
+ "__attribute__((__noreturn__))",
+ "#endif",
+ "static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Done after the current pattern has been matched and before the",
+ " * corresponding action - sets up yytext.",
+ " */",
+ "#define YY_DO_BEFORE_ACTION \\",
+ " YY_G(yytext_ptr) = yy_bp; \\",
+ "%% [2.0] code to fiddle yytext and yyleng for yymore() goes here \\",
+ " YY_G(yy_hold_char) = *yy_cp; \\",
+ " *yy_cp = '\\0'; \\",
+ "%% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \\",
+ " YY_G(yy_c_buf_p) = yy_cp;",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "%% [4.0] data tables for the DFA and the user's section 1 definitions go here",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])",
+ "M4_YY_SC_DEFS",
+ "m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_UNISTD_H]],,",
+ "[[",
+ "#ifndef YY_NO_UNISTD_H",
+ "/* Special case for \"unistd.h\", since it is non-ANSI. We include it way",
+ " * down here because we want the user's section 1 to have been scanned first.",
+ " * The user has a chance to override it with an option.",
+ " */",
+ "%if-c-only",
+ "#include <unistd.h>",
+ "%endif",
+ "%if-c++-only",
+ "#include <unistd.h>",
+ "%endif",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_EXTRA_TYPE_DEFS]],",
+ "[[",
+ "#define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS",
+ "]],",
+ "[[",
+ "#ifndef YY_EXTRA_TYPE",
+ "#define YY_EXTRA_TYPE void *",
+ "#endif",
+ "]]",
+ ")",
+ "",
+ "%if-c-only Reentrant structure and macros (non-C++).",
+ "%if-reentrant",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Holds the entire state of the reentrant scanner. */",
+ "struct yyguts_t",
+ " {",
+ "",
+ " /* User-defined. Not touched by flex. */",
+ " YY_EXTRA_TYPE yyextra_r;",
+ "",
+ " /* The rest are the same as the globals declared in the non-reentrant scanner. */",
+ " FILE *yyin_r, *yyout_r;",
+ " size_t yy_buffer_stack_top; /**< index of top of stack. */",
+ " size_t yy_buffer_stack_max; /**< capacity of stack. */",
+ " YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */",
+ " char yy_hold_char;",
+ " yy_size_t yy_n_chars;",
+ " yy_size_t yyleng_r;",
+ " char *yy_c_buf_p;",
+ " int yy_init;",
+ " int yy_start;",
+ " int yy_did_buffer_switch_on_eof;",
+ " int yy_start_stack_ptr;",
+ " int yy_start_stack_depth;",
+ " int *yy_start_stack;",
+ " yy_state_type yy_last_accepting_state;",
+ " char* yy_last_accepting_cpos;",
+ "",
+ " int yylineno_r;",
+ " int yy_flex_debug_r;",
+ "",
+ "m4_ifdef( [[M4_YY_USES_REJECT]],",
+ "[[",
+ " yy_state_type *yy_state_buf;",
+ " yy_state_type *yy_state_ptr;",
+ " char *yy_full_match;",
+ " int yy_lp;",
+ "",
+ " /* These are only needed for trailing context rules,",
+ " * but there's no conditional variable for that yet. */",
+ " int yy_looking_for_trail_begin;",
+ " int yy_full_lp;",
+ " int *yy_full_state;",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],",
+ "[[",
+ " char yytext_r[YYLMAX];",
+ " char *yytext_ptr;",
+ " int yy_more_offset;",
+ " int yy_prev_more_offset;",
+ "]],",
+ "[[",
+ " char *yytext_r;",
+ " int yy_more_flag;",
+ " int yy_more_len;",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_BISON_LVAL]],",
+ "[[",
+ " YYSTYPE * yylval_r;",
+ "]])",
+ "",
+ "m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ "[[",
+ " YYLTYPE * yylloc_r;",
+ "]])",
+ "",
+ " }; /* end struct yyguts_t */",
+ "]])",
+ "",
+ "",
+ "%if-c-only",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "%endif",
+ "",
+ "%if-reentrant",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_BISON_LVAL]],",
+ " [[",
+ " /* This must go here because YYSTYPE and YYLTYPE are included",
+ " * from bison output in section 1.*/",
+ " # define yylval YY_G(yylval_r)",
+ " ]])",
+ "",
+ " m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ " [[",
+ " # define yylloc YY_G(yylloc_r)",
+ " ]])",
+ "]])",
+ "",
+ "int yylex_init M4_YY_PARAMS(yyscan_t* scanner);",
+ "",
+ "int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);",
+ "",
+ "%endif",
+ "",
+ "%endif End reentrant structures and macros.",
+ "",
+ "/* Accessor methods to globals.",
+ " These are made visible to non-reentrant scanners for convenience. */",
+ "",
+ "m4_ifdef( [[M4_YY_NO_DESTROY]],,",
+ "[[",
+ "int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,",
+ "[[",
+ "int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,",
+ "[[",
+ "void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,",
+ "[[",
+ "YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,",
+ "[[",
+ "void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_IN]],,",
+ "[[",
+ "FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_IN]],,",
+ "[[",
+ "void yyset_in M4_YY_PARAMS( FILE * _in_str M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_OUT]],,",
+ "[[",
+ "FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_OUT]],,",
+ "[[",
+ "void yyset_out M4_YY_PARAMS( FILE * _out_str M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_LENG]],,",
+ "[[",
+ "yy_size_t yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_TEXT]],,",
+ "[[",
+ "char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_LINENO]],,",
+ "[[",
+ "int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_LINENO]],,",
+ "[[",
+ "void yyset_lineno M4_YY_PARAMS( int _line_number M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_REENTRANT]],",
+ "[[",
+ "m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,",
+ "[[",
+ "int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_REENTRANT]],",
+ "[[",
+ "m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,",
+ "[[",
+ "void yyset_column M4_YY_PARAMS( int _column_no M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "]])",
+ "",
+ "%if-bison-bridge",
+ "m4_ifdef( [[M4_YY_NO_GET_LVAL]],,",
+ "[[",
+ "YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "",
+ "void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );",
+ "",
+ "m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_NO_GET_LLOC]],,",
+ " [[",
+ " YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ " ]])",
+ "",
+ " m4_ifdef( [[M4_YY_NO_SET_LLOC]],,",
+ " [[",
+ " void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );",
+ " ]])",
+ "]])",
+ "%endif",
+ "",
+ "/* Macros after this point can all be overridden by user definitions in",
+ " * section 1.",
+ " */",
+ "",
+ "#ifndef YY_SKIP_YYWRAP",
+ "#ifdef __cplusplus",
+ "extern \"C\" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "#else",
+ "extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "#endif",
+ "#endif",
+ "",
+ "%not-for-header",
+ "#ifndef YY_NO_UNPUT",
+ " m4_ifdef( [[M4_YY_NO_UNPUT]],,",
+ " [[",
+ " static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG);",
+ " ]])",
+ "#endif",
+ "%ok-for-header",
+ "%endif",
+ "",
+ "#ifndef yytext_ptr",
+ "static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);",
+ "#endif",
+ "",
+ "#ifdef YY_NEED_STRLEN",
+ "static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);",
+ "#endif",
+ "",
+ "#ifndef YY_NO_INPUT",
+ "%if-c-only Standard (non-C++) definition",
+ "%not-for-header",
+ "#ifdef __cplusplus",
+ "static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "#else",
+ "static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "#endif",
+ "%ok-for-header",
+ "%endif",
+ "#endif",
+ "",
+ "",
+ "%if-c-only",
+ "%# TODO: This is messy.",
+ "m4_ifdef( [[M4_YY_STACK_USED]],",
+ "[[",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_REENTRANT]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ " [[",
+ " static int yy_start_stack_ptr = 0;",
+ " static int yy_start_stack_depth = 0;",
+ " static int *yy_start_stack = NULL;",
+ " ]])",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,",
+ " [[",
+ " static void yy_push_state M4_YY_PARAMS( int _new_state M4_YY_PROTO_LAST_ARG);",
+ " ]])",
+ " m4_ifdef( [[M4_YY_NO_POP_STATE]],,",
+ " [[",
+ " static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ " ]])",
+ " m4_ifdef( [[M4_YY_NO_TOP_STATE]],,",
+ " [[",
+ " static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ " ]])",
+ "]])",
+ "",
+ "]],",
+ "[[",
+ "m4_define( [[M4_YY_NO_PUSH_STATE]])",
+ "m4_define( [[M4_YY_NO_POP_STATE]])",
+ "m4_define( [[M4_YY_NO_TOP_STATE]])",
+ "]])",
+ "%endif",
+ "",
+ "/* Amount of stuff to slurp up with each read. */",
+ "#ifndef YY_READ_BUF_SIZE",
+ "#ifdef __ia64__",
+ "/* On IA-64, the buffer size is 16k, not 8k */",
+ "#define YY_READ_BUF_SIZE 16384",
+ "#else",
+ "#define YY_READ_BUF_SIZE 8192",
+ "#endif /* __ia64__ */",
+ "#endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Copy whatever the last rule matched to the standard output. */",
+ "#ifndef ECHO",
+ "%if-c-only Standard (non-C++) definition",
+ "/* This used to be an fputs(), but since the string might contain NUL's,",
+ " * we now use fwrite().",
+ " */",
+ "#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)",
+ "%endif",
+ "%if-c++-only C++ definition",
+ "#define ECHO LexerOutput( yytext, yyleng )",
+ "%endif",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Gets input and stuffs it into \"buf\". number of characters read, or YY_NULL,",
+ " * is returned in \"result\".",
+ " */",
+ "#ifndef YY_INPUT",
+ "#define YY_INPUT(buf,result,max_size) \\",
+ "%% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \\",
+ "\\",
+ "%if-c++-only C++ definition \\",
+ " if ( (int)(result = LexerInput( (char *) buf, max_size )) < 0 ) \\",
+ " YY_FATAL_ERROR( \"input in flex scanner failed\" );",
+ "%endif",
+ "",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* No semi-colon after return; correct usage is to write \"yyterminate();\" -",
+ " * we don't want an extra ';' after the \"return\" because that will cause",
+ " * some compilers to complain about unreachable statements.",
+ " */",
+ "#ifndef yyterminate",
+ "#define yyterminate() return YY_NULL",
+ "#endif",
+ "]])",
+ "",
+ "/* Number of entries by which start-condition stack grows. */",
+ "#ifndef YY_START_STACK_INCR",
+ "#define YY_START_STACK_INCR 25",
+ "#endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Report a fatal error. */",
+ "#ifndef YY_FATAL_ERROR",
+ "%if-c-only",
+ "#define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)",
+ "%endif",
+ "%if-c++-only",
+ "#define YY_FATAL_ERROR(msg) LexerError( msg )",
+ "%endif",
+ "#endif",
+ "]])",
+ "",
+ "%if-tables-serialization structures and prototypes",
+ "#ifdef FLEX_SCANNER",
+ "/*",
+ "dnl tables_shared.h - tables serialization header",
+ "dnl",
+ "dnl Copyright (c) 1990 The Regents of the University of California.",
+ "dnl All rights reserved.",
+ "dnl",
+ "dnl This code is derived from software contributed to Berkeley by",
+ "dnl Vern Paxson.",
+ "dnl",
+ "dnl The United States Government has rights in this work pursuant",
+ "dnl to contract no. DE-AC03-76SF00098 between the United States",
+ "dnl Department of Energy and the University of California.",
+ "dnl",
+ "dnl This file is part of flex.",
+ "dnl",
+ "dnl Redistribution and use in source and binary forms, with or without",
+ "dnl modification, are permitted provided that the following conditions",
+ "dnl are met:",
+ "dnl",
+ "dnl 1. Redistributions of source code must retain the above copyright",
+ "dnl notice, this list of conditions and the following disclaimer.",
+ "dnl 2. Redistributions in binary form must reproduce the above copyright",
+ "dnl notice, this list of conditions and the following disclaimer in the",
+ "dnl documentation and/or other materials provided with the distribution.",
+ "dnl",
+ "dnl Neither the name of the University nor the names of its contributors",
+ "dnl may be used to endorse or promote products derived from this software",
+ "dnl without specific prior written permission.",
+ "dnl",
+ "dnl THIS SOFTWARE IS PROVIDED `AS IS' AND WITHOUT ANY EXPRESS OR",
+ "dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED",
+ "dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR",
+ "dnl PURPOSE.",
+ " ",
+ "dnl",
+ "dnl This file is meant to be included in both the skeleton and the actual",
+ "dnl flex code (hence the name \"_shared\").",
+ "*/",
+ "#ifndef yyskel_static",
+ "#define yyskel_static static",
+ "#endif",
+ "#else",
+ "#ifndef yyskel_static",
+ "#define yyskel_static",
+ "#endif",
+ "#endif",
+ "",
+ "/* Structures and prototypes for serializing flex tables. The",
+ " * binary format is documented in the manual.",
+ " *",
+ " * Design considerations:",
+ " *",
+ " * - The format allows many tables per file.",
+ " * - The tables can be streamed.",
+ " * - All data is stored in network byte order.",
+ " * - We do not hinder future unicode support.",
+ " * - We can lookup tables by name.",
+ " */",
+ "",
+ "/** Magic number for serialized format. */",
+ "#ifndef YYTBL_MAGIC",
+ "#define YYTBL_MAGIC 0xF13C57B1",
+ "#endif",
+ "",
+ "/** Calculate (0-7) = number bytes needed to pad n to next 64-bit boundary. */",
+ "#ifndef yypad64",
+ "#define yypad64(n) ((8-((n)%8))%8)",
+ "#endif",
+ "",
+ "",
+ "#ifndef YYTABLES_TYPES",
+ "#define YYTABLES_TYPES",
+ "/** Possible values for td_id field. Each one corresponds to a",
+ " * scanner table of the same name.",
+ " */",
+ "enum yytbl_id {",
+ " YYTD_ID_ACCEPT = 0x01, /**< 1-dim ints */",
+ " YYTD_ID_BASE = 0x02, /**< 1-dim ints */",
+ " YYTD_ID_CHK = 0x03, /**< 1-dim ints */",
+ " YYTD_ID_DEF = 0x04, /**< 1-dim ints */",
+ " YYTD_ID_EC = 0x05, /**< 1-dim ints */",
+ " YYTD_ID_META = 0x06, /**< 1-dim ints */",
+ " YYTD_ID_NUL_TRANS = 0x07, /**< 1-dim ints, maybe indices */",
+ " YYTD_ID_NXT = 0x08, /**< may be 2 dimensional ints */",
+ " YYTD_ID_RULE_CAN_MATCH_EOL = 0x09, /**< 1-dim ints */",
+ " YYTD_ID_START_STATE_LIST = 0x0A, /**< 1-dim indices into trans tbl */",
+ " YYTD_ID_TRANSITION = 0x0B, /**< structs */",
+ " YYTD_ID_ACCLIST = 0x0C /**< 1-dim ints */",
+ "};",
+ "",
+ "/** bit flags for t_flags field of struct yytbl_data */",
+ "enum yytbl_flags {",
+ " /* These first three are mutually exclusive */",
+ " YYTD_DATA8 = 0x01, /**< data is an array of type flex_int8_t */",
+ " YYTD_DATA16 = 0x02, /**< data is an array of type flex_int16_t */",
+ " YYTD_DATA32 = 0x04, /**< data is an array of type flex_int32_t */",
+ "",
+ " /* These two are mutually exclusive. */",
+ " YYTD_PTRANS = 0x08, /**< data is a list of indexes of entries",
+ " into the expanded yy_transition",
+ " array. See notes in manual. */",
+ " YYTD_STRUCT = 0x10 /**< data consists of yy_trans_info structs */",
+ "};",
+ "",
+ "/* The serialized tables header. */",
+ "struct yytbl_hdr {",
+ " flex_uint32_t th_magic; /**< Must be 0xF13C57B1 (comes from \"Flex Table\") */",
+ " flex_uint32_t th_hsize; /**< Size of this header in bytes. */",
+ " flex_uint32_t th_ssize; /**< Size of this dataset, in bytes, including header. */",
+ " flex_uint16_t th_flags; /**< Currently unused, must be 0 */",
+ " char *th_version; /**< Flex version string. NUL terminated. */",
+ " char *th_name; /**< The name of this table set. NUL terminated. */",
+ "};",
+ "",
+ "/** A single serialized table */",
+ "struct yytbl_data {",
+ " flex_uint16_t td_id; /**< enum yytbl_id table identifier */",
+ " flex_uint16_t td_flags; /**< how to interpret this data */",
+ " flex_uint32_t td_hilen; /**< num elements in highest dimension array */",
+ " flex_uint32_t td_lolen; /**< num elements in lowest dimension array */",
+ " void *td_data; /**< table data */",
+ "};",
+ "#endif",
+ "",
+ "/** Extract corresponding data size_t from td_flags */",
+ "#ifndef YYTDFLAGS2BYTES",
+ "#define YYTDFLAGS2BYTES(td_flags)\\",
+ " (((td_flags) & YYTD_DATA8)\\",
+ " ? sizeof(flex_int8_t)\\",
+ " :(((td_flags) & YYTD_DATA16)\\",
+ " ? sizeof(flex_int16_t)\\",
+ " :sizeof(flex_int32_t)))",
+ "#endif",
+ "",
+ "#ifdef FLEX_SCANNER",
+ "%not-for-header",
+ "#endif",
+ "yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl);",
+ "#ifdef FLEX_SCANNER",
+ "%ok-for-header",
+ "#endif",
+ "",
+ "/* vim:set noexpandtab cindent tabstop=8 softtabstop=0 shiftwidth=8 textwidth=0: */",
+ "",
+ "",
+ "/* Load the DFA tables from the given stream. */",
+ "int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);",
+ "",
+ "/* Unload the tables from memory. */",
+ "int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);",
+ "%not-for-header",
+ "",
+ "/** Describes a mapping from a serialized table id to its deserialized state in",
+ " * this scanner. This is the bridge between our \"generic\" deserialization code",
+ " * and the specifics of this scanner. ",
+ " */",
+ "struct yytbl_dmap {",
+ " enum yytbl_id dm_id;/**< table identifier */",
+ " void **dm_arr; /**< address of pointer to store the deserialized table. */",
+ " size_t dm_sz; /**< local sizeof() each element in table. */",
+ "};",
+ "",
+ "/** A {0,0,0}-terminated list of structs, forming the map */",
+ "static struct yytbl_dmap yydmap[] =",
+ "{",
+ "%tables-yydmap generated elements",
+ " {0,0,0}",
+ "};",
+ "",
+ "/** A tables-reader object to maintain some state in the read. */",
+ "struct yytbl_reader {",
+ " FILE * fp; /**< input stream */",
+ " flex_uint32_t bread; /**< bytes read since beginning of current tableset */",
+ "};",
+ "",
+ "%endif",
+ "/* end tables serialization structures and prototypes */",
+ "",
+ "%ok-for-header",
+ "",
+ "/* Default declaration of generated scanner - a define so the user can",
+ " * easily add parameters.",
+ " */",
+ "#ifndef YY_DECL",
+ "#define YY_DECL_IS_OURS 1",
+ "%if-c-only Standard (non-C++) definition",
+ "",
+ "",
+ "m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])",
+ "m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])",
+ "",
+ "m4_ifdef( [[M4_YY_BISON_LVAL]],",
+ "[[",
+ " m4_dnl The bison pure parser is used. Redefine yylex to",
+ " m4_dnl accept the lval parameter.",
+ "",
+ " m4_define( [[M4_YY_LEX_PROTO]], [[\\]]",
+ " [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])",
+ " m4_define( [[M4_YY_LEX_DECLARATION]], [[\\]]",
+ " [[YYFARGS1(YYSTYPE *,yylval_param)]])",
+ "]])",
+ "",
+ "m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ "[[",
+ " m4_dnl Locations are used. yylex should also accept the ylloc parameter.",
+ "",
+ " m4_define( [[M4_YY_LEX_PROTO]], [[\\]]",
+ " [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])",
+ " m4_define( [[M4_YY_LEX_DECLARATION]], [[\\]]",
+ " [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])",
+ "]])",
+ "",
+ "extern int yylex M4_YY_LEX_PROTO;",
+ "",
+ "#define YY_DECL int yylex M4_YY_LEX_DECLARATION",
+ "%endif",
+ "%if-c++-only C++ definition",
+ "#define YY_DECL int yyFlexLexer::yylex()",
+ "%endif",
+ "#endif /* !YY_DECL */",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Code executed at the beginning of each rule, after yytext and yyleng",
+ " * have been set up.",
+ " */",
+ "#ifndef YY_USER_ACTION",
+ "#define YY_USER_ACTION",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* Code executed at the end of each rule. */",
+ "#ifndef YY_BREAK",
+ "#define YY_BREAK /*LINTED*/break;",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "%% [6.0] YY_RULE_SETUP definition goes here",
+ "]])",
+ "",
+ "%not-for-header",
+ "/** The main scanner function which does all the work.",
+ " */",
+ "YY_DECL",
+ "{",
+ " yy_state_type yy_current_state;",
+ " char *yy_cp, *yy_bp;",
+ " int yy_act;",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_REENTRANT]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_BISON_LVAL]],",
+ " [[",
+ " YYSTYPE * yylval;",
+ " ]])",
+ " m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ " [[",
+ " YYLTYPE * yylloc;",
+ " ]])",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_BISON_LVAL]],",
+ "[[",
+ " yylval = yylval_param;",
+ "]])",
+ "",
+ "m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ "[[",
+ " yylloc = yylloc_param;",
+ "]])",
+ "",
+ " if ( !YY_G(yy_init) )",
+ " {",
+ " YY_G(yy_init) = 1;",
+ "",
+ "#ifdef YY_USER_INIT",
+ " YY_USER_INIT;",
+ "#endif",
+ "",
+ "m4_ifdef( [[M4_YY_USES_REJECT]],",
+ "[[",
+ " /* Create the reject buffer large enough to save one state per allowed character. */",
+ " if ( ! YY_G(yy_state_buf) )",
+ " YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);",
+ " if ( ! YY_G(yy_state_buf) )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yylex()\" );",
+ "]])",
+ "",
+ " if ( ! YY_G(yy_start) )",
+ " YY_G(yy_start) = 1; /* first start state */",
+ "",
+ " if ( ! yyin )",
+ "%if-c-only",
+ " yyin = stdin;",
+ "%endif",
+ "%if-c++-only",
+ " yyin.rdbuf(std::cin.rdbuf());",
+ "%endif",
+ "",
+ " if ( ! yyout )",
+ "%if-c-only",
+ " yyout = stdout;",
+ "%endif",
+ "%if-c++-only",
+ " yyout.rdbuf(std::cout.rdbuf());",
+ "%endif",
+ "",
+ " if ( ! YY_CURRENT_BUFFER ) {",
+ " yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);",
+ " YY_CURRENT_BUFFER_LVALUE =",
+ " yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);",
+ " }",
+ "",
+ " yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );",
+ " }",
+ "",
+ " {",
+ "%% [7.0] user's declarations go here",
+ "",
+ " while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */",
+ " {",
+ "%% [8.0] yymore()-related code goes here",
+ " yy_cp = YY_G(yy_c_buf_p);",
+ "",
+ " /* Support of yytext. */",
+ " *yy_cp = YY_G(yy_hold_char);",
+ "",
+ " /* yy_bp points to the position in yy_ch_buf of the start of",
+ " * the current run.",
+ " */",
+ " yy_bp = yy_cp;",
+ "",
+ "%% [9.0] code to set up and find next match goes here",
+ "",
+ "yy_find_action:",
+ "%% [10.0] code to find the action number goes here",
+ "",
+ " YY_DO_BEFORE_ACTION;",
+ "",
+ "%% [11.0] code for yylineno update goes here",
+ "",
+ "do_action: /* This label is used only to access EOF actions. */",
+ "",
+ "%% [12.0] debug code goes here",
+ "",
+ " switch ( yy_act )",
+ " { /* beginning of action switch */",
+ "%% [13.0] actions go here",
+ "",
+ " case YY_END_OF_BUFFER:",
+ " {",
+ " /* Amount of text matched not including the EOB char. */",
+ " int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;",
+ "",
+ " /* Undo the effects of YY_DO_BEFORE_ACTION. */",
+ " *yy_cp = YY_G(yy_hold_char);",
+ " YY_RESTORE_YY_MORE_OFFSET",
+ "",
+ " if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )",
+ " {",
+ " /* We're scanning a new file or input source. It's",
+ " * possible that this happened because the user",
+ " * just pointed yyin at a new source and called",
+ " * yylex(). If so, then we have to assure",
+ " * consistency between YY_CURRENT_BUFFER and our",
+ " * globals. Here is the right place to do so, because",
+ " * this is the first action (other than possibly a",
+ " * back-up) that will match for the new input source.",
+ " */",
+ " YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;",
+ "%if-c-only",
+ " YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;",
+ "%endif",
+ "%if-c++-only",
+ " YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin.rdbuf();",
+ "%endif",
+ " YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;",
+ " }",
+ "",
+ " /* Note that here we test for yy_c_buf_p \"<=\" to the position",
+ " * of the first EOB in the buffer, since yy_c_buf_p will",
+ " * already have been incremented past the NUL character",
+ " * (since all states make transitions on EOB to the",
+ " * end-of-buffer state). Contrast this with the test",
+ " * in input().",
+ " */",
+ " if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )",
+ " { /* This was really a NUL. */",
+ " yy_state_type yy_next_state;",
+ "",
+ " YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;",
+ "",
+ " yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );",
+ "",
+ " /* Okay, we're now positioned to make the NUL",
+ " * transition. We couldn't have",
+ " * yy_get_previous_state() go ahead and do it",
+ " * for us because it doesn't know how to deal",
+ " * with the possibility of jamming (and we don't",
+ " * want to build jamming into it because then it",
+ " * will run more slowly).",
+ " */",
+ "",
+ " yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);",
+ "",
+ " yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;",
+ "",
+ " if ( yy_next_state )",
+ " {",
+ " /* Consume the NUL. */",
+ " yy_cp = ++YY_G(yy_c_buf_p);",
+ " yy_current_state = yy_next_state;",
+ " goto yy_match;",
+ " }",
+ "",
+ " else",
+ " {",
+ "%% [14.0] code to do back-up for compressed tables and set up yy_cp goes here",
+ " goto yy_find_action;",
+ " }",
+ " }",
+ "",
+ " else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )",
+ " {",
+ " case EOB_ACT_END_OF_FILE:",
+ " {",
+ " YY_G(yy_did_buffer_switch_on_eof) = 0;",
+ "",
+ " if ( yywrap( M4_YY_CALL_ONLY_ARG ) )",
+ " {",
+ " /* Note: because we've taken care in",
+ " * yy_get_next_buffer() to have set up",
+ " * yytext, we can now set up",
+ " * yy_c_buf_p so that if some total",
+ " * hoser (like flex itself) wants to",
+ " * call the scanner after we return the",
+ " * YY_NULL, it'll still work - another",
+ " * YY_NULL will get returned.",
+ " */",
+ " YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;",
+ "",
+ " yy_act = YY_STATE_EOF(YY_START);",
+ " goto do_action;",
+ " }",
+ "",
+ " else",
+ " {",
+ " if ( ! YY_G(yy_did_buffer_switch_on_eof) )",
+ " YY_NEW_FILE;",
+ " }",
+ " break;",
+ " }",
+ "",
+ " case EOB_ACT_CONTINUE_SCAN:",
+ " YY_G(yy_c_buf_p) =",
+ " YY_G(yytext_ptr) + yy_amount_of_matched_text;",
+ "",
+ " yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );",
+ "",
+ " yy_cp = YY_G(yy_c_buf_p);",
+ " yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;",
+ " goto yy_match;",
+ "",
+ " case EOB_ACT_LAST_MATCH:",
+ " YY_G(yy_c_buf_p) =",
+ " &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];",
+ "",
+ " yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );",
+ "",
+ " yy_cp = YY_G(yy_c_buf_p);",
+ " yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;",
+ " goto yy_find_action;",
+ " }",
+ " break;",
+ " }",
+ "",
+ " default:",
+ " YY_FATAL_ERROR(",
+ " \"fatal flex scanner internal error--no action found\" );",
+ " } /* end of action switch */",
+ " } /* end of scanning one token */",
+ " } /* end of user's declarations */",
+ "} /* end of yylex */",
+ "%ok-for-header",
+ "",
+ "%if-c++-only",
+ "%not-for-header",
+ "/* The contents of this function are C++ specific, so the YY_G macro is not used.",
+ " * This constructor simply maintains backward compatibility.",
+ " * DEPRECATED",
+ " */",
+ "yyFlexLexer::yyFlexLexer( FLEX_STD istream* arg_yyin, FLEX_STD ostream* arg_yyout ):",
+ " yyin(arg_yyin ? arg_yyin->rdbuf() : std::cin.rdbuf()),",
+ " yyout(arg_yyout ? arg_yyout->rdbuf() : std::cout.rdbuf())",
+ "{",
+ " ctor_common();",
+ "}",
+ "",
+ "/* The contents of this function are C++ specific, so the YY_G macro is not used.",
+ " */",
+ "yyFlexLexer::yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout ):",
+ " yyin(arg_yyin.rdbuf()),",
+ " yyout(arg_yyout.rdbuf())",
+ "{",
+ " ctor_common();",
+ "}",
+ "",
+ "/* The contents of this function are C++ specific, so the YY_G macro is not used.",
+ " */",
+ "void yyFlexLexer::ctor_common()",
+ "{",
+ " yy_c_buf_p = 0;",
+ " yy_init = 0;",
+ " yy_start = 0;",
+ " yy_flex_debug = 0;",
+ " yylineno = 1; // this will only get updated if %option yylineno",
+ "",
+ " yy_did_buffer_switch_on_eof = 0;",
+ "",
+ " yy_looking_for_trail_begin = 0;",
+ " yy_more_flag = 0;",
+ " yy_more_len = 0;",
+ " yy_more_offset = yy_prev_more_offset = 0;",
+ "",
+ " yy_start_stack_ptr = yy_start_stack_depth = 0;",
+ " yy_start_stack = NULL;",
+ "",
+ " yy_buffer_stack = 0;",
+ " yy_buffer_stack_top = 0;",
+ " yy_buffer_stack_max = 0;",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_USES_REJECT]],",
+ "[[",
+ " yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];",
+ "]],",
+ "[[",
+ " yy_state_buf = 0;",
+ "]])",
+ "}",
+ "",
+ "/* The contents of this function are C++ specific, so the YY_G macro is not used.",
+ " */",
+ "yyFlexLexer::~yyFlexLexer()",
+ "{",
+ " delete [] yy_state_buf;",
+ " yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );",
+ " yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);",
+ " yyfree( yy_buffer_stack M4_YY_CALL_LAST_ARG );",
+ "}",
+ "",
+ "/* The contents of this function are C++ specific, so the YY_G macro is not used.",
+ " */",
+ "void yyFlexLexer::switch_streams( std::istream& new_in, std::ostream& new_out )",
+ "{",
+ " // was if( new_in )",
+ " yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);",
+ " yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);",
+ "",
+ " // was if( new_out )",
+ " yyout.rdbuf(new_out.rdbuf());",
+ "}",
+ "",
+ "/* The contents of this function are C++ specific, so the YY_G macro is not used.",
+ " */",
+ "void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )",
+ "{",
+ " if( ! new_in ) {",
+ " new_in = &yyin;",
+ " }",
+ "",
+ " if ( ! new_out ) {",
+ " new_out = &yyout;",
+ " }",
+ "",
+ " switch_streams(*new_in, *new_out);",
+ "}",
+ "",
+ "#ifdef YY_INTERACTIVE",
+ "int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )",
+ "#else",
+ "int yyFlexLexer::LexerInput( char* buf, int max_size )",
+ "#endif",
+ "{",
+ " if ( yyin.eof() || yyin.fail() )",
+ " return 0;",
+ "",
+ "#ifdef YY_INTERACTIVE",
+ " yyin.get( buf[0] );",
+ "",
+ " if ( yyin.eof() )",
+ " return 0;",
+ "",
+ " if ( yyin.bad() )",
+ " return -1;",
+ "",
+ " return 1;",
+ "",
+ "#else",
+ " (void) yyin.read( buf, max_size );",
+ "",
+ " if ( yyin.bad() )",
+ " return -1;",
+ " else",
+ " return yyin.gcount();",
+ "#endif",
+ "}",
+ "",
+ "void yyFlexLexer::LexerOutput( const char* buf, int size )",
+ "{",
+ " (void) yyout.write( buf, size );",
+ "}",
+ "%ok-for-header",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/* yy_get_next_buffer - try to read in a new buffer",
+ " *",
+ " * Returns a code representing an action:",
+ " * EOB_ACT_LAST_MATCH -",
+ " * EOB_ACT_CONTINUE_SCAN - continue scanning from current position",
+ " * EOB_ACT_END_OF_FILE - end of file",
+ " */",
+ "%if-c-only",
+ "static int yy_get_next_buffer YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ "int yyFlexLexer::yy_get_next_buffer()",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;",
+ " char *source = YY_G(yytext_ptr);",
+ " yy_size_t number_to_move, i;",
+ " int ret_val;",
+ "",
+ " if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )",
+ " YY_FATAL_ERROR(",
+ " \"fatal flex scanner internal error--end of buffer missed\" );",
+ "",
+ " if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )",
+ " { /* Don't try to fill the buffer, so this is an EOF. */",
+ " if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )",
+ " {",
+ " /* We matched a single character, the EOB, so",
+ " * treat this as a final EOF.",
+ " */",
+ " return EOB_ACT_END_OF_FILE;",
+ " }",
+ "",
+ " else",
+ " {",
+ " /* We matched some text prior to the EOB, first",
+ " * process it.",
+ " */",
+ " return EOB_ACT_LAST_MATCH;",
+ " }",
+ " }",
+ "",
+ " /* Try to read more data. */",
+ "",
+ " /* First move last chars to start of buffer. */",
+ " number_to_move = (yy_size_t) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1;",
+ "",
+ " for ( i = 0; i < number_to_move; ++i )",
+ " *(dest++) = *(source++);",
+ "",
+ " if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )",
+ " /* don't do the read, it's not guaranteed to return an EOF,",
+ " * just force an EOF",
+ " */",
+ " YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;",
+ "",
+ " else",
+ " {",
+ " yy_size_t num_to_read =",
+ " YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;",
+ "",
+ " while ( num_to_read <= 0 )",
+ " { /* Not enough room in the buffer - grow it. */",
+ "m4_ifdef( [[M4_YY_USES_REJECT]],",
+ "[[",
+ " YY_FATAL_ERROR(",
+ "\"input buffer overflow, can't enlarge buffer because scanner uses REJECT\" );",
+ "]],",
+ "[[",
+ " /* just a shorter name for the current buffer */",
+ " YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;",
+ "",
+ " int yy_c_buf_p_offset =",
+ " (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);",
+ "",
+ " if ( b->yy_is_our_buffer )",
+ " {",
+ " yy_size_t new_size = b->yy_buf_size * 2;",
+ "",
+ " if ( new_size <= 0 )",
+ " b->yy_buf_size += b->yy_buf_size / 8;",
+ " else",
+ " b->yy_buf_size *= 2;",
+ "",
+ " b->yy_ch_buf = (char *)",
+ " /* Include room in for 2 EOB chars. */",
+ " yyrealloc( (void *) b->yy_ch_buf,",
+ " b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );",
+ " }",
+ " else",
+ " /* Can't grow it, we don't own it. */",
+ " b->yy_ch_buf = 0;",
+ "",
+ " if ( ! b->yy_ch_buf )",
+ " YY_FATAL_ERROR(",
+ " \"fatal error - scanner input buffer overflow\" );",
+ "",
+ " YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];",
+ "",
+ " num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -",
+ " number_to_move - 1;",
+ "]])",
+ " }",
+ "",
+ " if ( num_to_read > YY_READ_BUF_SIZE )",
+ " num_to_read = YY_READ_BUF_SIZE;",
+ "",
+ " /* Read in more data. */",
+ " YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),",
+ " YY_G(yy_n_chars), num_to_read );",
+ "",
+ " YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);",
+ " }",
+ "",
+ " if ( YY_G(yy_n_chars) == 0 )",
+ " {",
+ " if ( number_to_move == YY_MORE_ADJ )",
+ " {",
+ " ret_val = EOB_ACT_END_OF_FILE;",
+ " yyrestart( yyin M4_YY_CALL_LAST_ARG);",
+ " }",
+ "",
+ " else",
+ " {",
+ " ret_val = EOB_ACT_LAST_MATCH;",
+ " YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =",
+ " YY_BUFFER_EOF_PENDING;",
+ " }",
+ " }",
+ "",
+ " else",
+ " ret_val = EOB_ACT_CONTINUE_SCAN;",
+ "",
+ " if ((yy_size_t) (YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {",
+ " /* Extend the array by 50%, plus the number we really need. */",
+ " yy_size_t new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);",
+ " YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(",
+ " (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size M4_YY_CALL_LAST_ARG );",
+ " if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yy_get_next_buffer()\" );",
+ " }",
+ "",
+ " YY_G(yy_n_chars) += number_to_move;",
+ " YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;",
+ " YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;",
+ "",
+ " YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];",
+ "",
+ " return ret_val;",
+ "}",
+ "]])",
+ "",
+ "/* yy_get_previous_state - get the state just before the EOB char was reached */",
+ "",
+ "%if-c-only",
+ "%not-for-header",
+ " static yy_state_type yy_get_previous_state YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ " yy_state_type yyFlexLexer::yy_get_previous_state()",
+ "%endif",
+ "{",
+ " yy_state_type yy_current_state;",
+ " char *yy_cp;",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ "%% [15.0] code to get the start state into yy_current_state goes here",
+ "",
+ " for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )",
+ " {",
+ "%% [16.0] code to find the next state goes here",
+ " }",
+ "",
+ " return yy_current_state;",
+ "}",
+ "",
+ "",
+ "/* yy_try_NUL_trans - try to make a transition on the NUL character",
+ " *",
+ " * synopsis",
+ " * next_state = yy_try_NUL_trans( current_state );",
+ " */",
+ "%if-c-only",
+ " static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state)",
+ "%endif",
+ "%if-c++-only",
+ " yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )",
+ "%endif",
+ "{",
+ " int yy_is_jam;",
+ " M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */",
+ "%% [17.0] code to find the next state, and perhaps do backing up, goes here",
+ "",
+ " M4_YY_NOOP_GUTS_VAR();",
+ " return yy_is_jam ? 0 : yy_current_state;",
+ "}",
+ "",
+ "",
+ "#ifndef YY_NO_UNPUT",
+ "%if-c-only",
+ "m4_ifdef( [[M4_YY_NO_UNPUT]],,",
+ "[[",
+ " static void yyunput YYFARGS2( int,c, char *,yy_bp)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yyunput( int c, char* yy_bp)",
+ "%endif",
+ "{",
+ " char *yy_cp;",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " yy_cp = YY_G(yy_c_buf_p);",
+ "",
+ " /* undo effects of setting up yytext */",
+ " *yy_cp = YY_G(yy_hold_char);",
+ "",
+ " if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )",
+ " { /* need to shift things up to make room */",
+ " /* +2 for EOB chars. */",
+ " yy_size_t number_to_move = YY_G(yy_n_chars) + 2;",
+ " char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[",
+ " YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];",
+ " char *source =",
+ " &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];",
+ "",
+ " while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )",
+ " *--dest = *--source;",
+ "",
+ " yy_cp += (int) (dest - source);",
+ " yy_bp += (int) (dest - source);",
+ " YY_CURRENT_BUFFER_LVALUE->yy_n_chars =",
+ " YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;",
+ "",
+ " if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )",
+ " YY_FATAL_ERROR( \"flex scanner push-back overflow\" );",
+ " }",
+ "",
+ " *--yy_cp = (char) c;",
+ "",
+ "%% [18.0] update yylineno here",
+ "m4_ifdef( [[M4_YY_USE_LINENO]],",
+ "[[",
+ " if ( c == '\\n' ){",
+ " --yylineno;",
+ " }",
+ "]])",
+ "",
+ " YY_G(yytext_ptr) = yy_bp;",
+ " YY_G(yy_hold_char) = *yy_cp;",
+ " YY_G(yy_c_buf_p) = yy_cp;",
+ "}",
+ "%if-c-only",
+ "]])",
+ "%endif",
+ "#endif",
+ "",
+ "%if-c-only",
+ "#ifndef YY_NO_INPUT",
+ "#ifdef __cplusplus",
+ " static int yyinput YYFARGS0(void)",
+ "#else",
+ " static int input YYFARGS0(void)",
+ "#endif",
+ "",
+ "%endif",
+ "%if-c++-only",
+ " int yyFlexLexer::yyinput()",
+ "%endif",
+ "{",
+ " int c;",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);",
+ "",
+ " if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )",
+ " {",
+ " /* yy_c_buf_p now points to the character we want to return.",
+ " * If this occurs *before* the EOB characters, then it's a",
+ " * valid NUL; if not, then we've hit the end of the buffer.",
+ " */",
+ " if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )",
+ " /* This was really a NUL. */",
+ " *YY_G(yy_c_buf_p) = '\\0';",
+ "",
+ " else",
+ " { /* need more input */",
+ " yy_size_t offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);",
+ " ++YY_G(yy_c_buf_p);",
+ "",
+ " switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )",
+ " {",
+ " case EOB_ACT_LAST_MATCH:",
+ " /* This happens because yy_g_n_b()",
+ " * sees that we've accumulated a",
+ " * token and flags that we need to",
+ " * try matching the token before",
+ " * proceeding. But for input(),",
+ " * there's no matching to consider.",
+ " * So convert the EOB_ACT_LAST_MATCH",
+ " * to EOB_ACT_END_OF_FILE.",
+ " */",
+ "",
+ " /* Reset buffer status. */",
+ " yyrestart( yyin M4_YY_CALL_LAST_ARG);",
+ "",
+ " /*FALLTHROUGH*/",
+ "",
+ " case EOB_ACT_END_OF_FILE:",
+ " {",
+ " if ( yywrap( M4_YY_CALL_ONLY_ARG ) )",
+ " return EOF;",
+ "",
+ " if ( ! YY_G(yy_did_buffer_switch_on_eof) )",
+ " YY_NEW_FILE;",
+ "#ifdef __cplusplus",
+ " return yyinput(M4_YY_CALL_ONLY_ARG);",
+ "#else",
+ " return input(M4_YY_CALL_ONLY_ARG);",
+ "#endif",
+ " }",
+ "",
+ " case EOB_ACT_CONTINUE_SCAN:",
+ " YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;",
+ " break;",
+ " }",
+ " }",
+ " }",
+ "",
+ " c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */",
+ " *YY_G(yy_c_buf_p) = '\\0'; /* preserve yytext */",
+ " YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);",
+ "",
+ "%% [19.0] update BOL and yylineno",
+ "",
+ " return c;",
+ "}",
+ "%if-c-only",
+ "#endif /* ifndef YY_NO_INPUT */",
+ "%endif",
+ "",
+ "/** Immediately switch to a different input stream.",
+ " * @param input_file A readable stream.",
+ " * M4_YY_DOC_PARAM",
+ " * @note This function does not reset the start condition to @c INITIAL .",
+ " */",
+ "%if-c-only",
+ " void yyrestart YYFARGS1( FILE *,input_file)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yyrestart( std::istream& input_file )",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " if ( ! YY_CURRENT_BUFFER ){",
+ " yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);",
+ " YY_CURRENT_BUFFER_LVALUE =",
+ " yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);",
+ " }",
+ "",
+ " yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);",
+ " yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );",
+ "}",
+ "",
+ "%if-c++-only",
+ "/** Delegate to the new version that takes an istream reference.",
+ " * @param input_file A readable stream.",
+ " * M4_YY_DOC_PARAM",
+ " * @note This function does not reset the start condition to @c INITIAL .",
+ " */",
+ "void yyFlexLexer::yyrestart( std::istream* input_file )",
+ "{",
+ " yyrestart( *input_file );",
+ "}",
+ "%endif",
+ "",
+ "/** Switch to a different input buffer.",
+ " * @param new_buffer The new input buffer.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "%if-c-only",
+ " void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " /* TODO. We should be able to replace this entire function body",
+ " * with",
+ " * yypop_buffer_state();",
+ " * yypush_buffer_state(new_buffer);",
+ " */",
+ " yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);",
+ " if ( YY_CURRENT_BUFFER == new_buffer )",
+ " return;",
+ "",
+ " if ( YY_CURRENT_BUFFER )",
+ " {",
+ " /* Flush out information for old buffer. */",
+ " *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);",
+ " YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);",
+ " YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);",
+ " }",
+ "",
+ " YY_CURRENT_BUFFER_LVALUE = new_buffer;",
+ " yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );",
+ "",
+ " /* We don't actually know whether we did this switch during",
+ " * EOF (yywrap()) processing, but the only time this flag",
+ " * is looked at is after yywrap() is called, so it's safe",
+ " * to go ahead and always set it.",
+ " */",
+ " YY_G(yy_did_buffer_switch_on_eof) = 1;",
+ "}",
+ "",
+ "",
+ "%if-c-only",
+ "static void yy_load_buffer_state YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_load_buffer_state()",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;",
+ " YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;",
+ "%if-c-only",
+ " yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;",
+ "%endif",
+ "%if-c++-only",
+ " yyin.rdbuf(YY_CURRENT_BUFFER_LVALUE->yy_input_file);",
+ "%endif",
+ " YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);",
+ "}",
+ "",
+ "/** Allocate and initialize an input buffer state.",
+ " * @param file A readable stream.",
+ " * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.",
+ " * M4_YY_DOC_PARAM",
+ " * @return the allocated buffer state.",
+ " */",
+ "%if-c-only",
+ " YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size)",
+ "%endif",
+ "%if-c++-only",
+ " YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream& file, int size )",
+ "%endif",
+ "{",
+ " YY_BUFFER_STATE b;",
+ " m4_dnl M4_YY_DECL_GUTS_VAR();",
+ "",
+ " b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );",
+ " if ( ! b )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );",
+ "",
+ " b->yy_buf_size = (yy_size_t)size;",
+ "",
+ " /* yy_ch_buf has to be 2 characters longer than the size given because",
+ " * we need to put in 2 end-of-buffer characters.",
+ " */",
+ " b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );",
+ " if ( ! b->yy_ch_buf )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );",
+ "",
+ " b->yy_is_our_buffer = 1;",
+ "",
+ " yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);",
+ "",
+ " return b;",
+ "}",
+ "",
+ "%if-c++-only",
+ "/** Delegate creation of buffers to the new version that takes an istream reference.",
+ " * @param file A readable stream.",
+ " * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.",
+ " * M4_YY_DOC_PARAM",
+ " * @return the allocated buffer state.",
+ " */",
+ " YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )",
+ "{",
+ " return yy_create_buffer( *file, size );",
+ "}",
+ "%endif",
+ "",
+ "/** Destroy the buffer.",
+ " * @param b a buffer created with yy_create_buffer()",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "%if-c-only",
+ " void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " if ( ! b )",
+ " return;",
+ "",
+ " if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */",
+ " YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;",
+ "",
+ " if ( b->yy_is_our_buffer )",
+ " yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );",
+ "",
+ " yyfree( (void *) b M4_YY_CALL_LAST_ARG );",
+ "}",
+ "",
+ "",
+ "/* Initializes or reinitializes a buffer.",
+ " * This function is sometimes called more than once on the same buffer,",
+ " * such as during a yyrestart() or at EOF.",
+ " */",
+ "%if-c-only",
+ " static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream& file )",
+ "%endif",
+ "",
+ "{",
+ " int oerrno = errno;",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " yy_flush_buffer( b M4_YY_CALL_LAST_ARG);",
+ "",
+ "%if-c-only",
+ " b->yy_input_file = file;",
+ "%endif",
+ "%if-c++-only",
+ " b->yy_input_file = file.rdbuf();",
+ "%endif",
+ " b->yy_fill_buffer = 1;",
+ "",
+ " /* If b is the current buffer, then yy_init_buffer was _probably_",
+ " * called from yyrestart() or through yy_get_next_buffer.",
+ " * In that case, we don't want to reset the lineno or column.",
+ " */",
+ " if (b != YY_CURRENT_BUFFER){",
+ " b->yy_bs_lineno = 1;",
+ " b->yy_bs_column = 0;",
+ " }",
+ "",
+ "%if-c-only",
+ "m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],",
+ "[[",
+ " b->yy_is_interactive = 1;",
+ "]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],",
+ " [[",
+ " b->yy_is_interactive = 0;",
+ " ]],",
+ " [[",
+ " b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;",
+ " ]])",
+ "]])",
+ "%endif",
+ "%if-c++-only",
+ " b->yy_is_interactive = 0;",
+ "%endif",
+ " errno = oerrno;",
+ "}",
+ "",
+ "/** Discard all buffered characters. On the next scan, YY_INPUT will be called.",
+ " * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "%if-c-only",
+ " void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " if ( ! b )",
+ " return;",
+ "",
+ " b->yy_n_chars = 0;",
+ "",
+ " /* We always need two end-of-buffer characters. The first causes",
+ " * a transition to the end-of-buffer state. The second causes",
+ " * a jam in that state.",
+ " */",
+ " b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;",
+ " b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;",
+ "",
+ " b->yy_buf_pos = &b->yy_ch_buf[0];",
+ "",
+ " b->yy_at_bol = 1;",
+ " b->yy_buffer_status = YY_BUFFER_NEW;",
+ "",
+ " if ( b == YY_CURRENT_BUFFER )",
+ " yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );",
+ "}",
+ "",
+ "%if-c-or-c++",
+ "/** Pushes the new state onto the stack. The new state becomes",
+ " * the current state. This function will allocate the stack",
+ " * if necessary.",
+ " * @param new_buffer The new state.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "%if-c-only",
+ "void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)",
+ "%endif",
+ "%if-c++-only",
+ "void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " if (new_buffer == NULL)",
+ " return;",
+ "",
+ " yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);",
+ "",
+ " /* This block is copied from yy_switch_to_buffer. */",
+ " if ( YY_CURRENT_BUFFER )",
+ " {",
+ " /* Flush out information for old buffer. */",
+ " *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);",
+ " YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);",
+ " YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);",
+ " }",
+ "",
+ " /* Only push if top exists. Otherwise, replace top. */",
+ " if (YY_CURRENT_BUFFER)",
+ " YY_G(yy_buffer_stack_top)++;",
+ " YY_CURRENT_BUFFER_LVALUE = new_buffer;",
+ "",
+ " /* copied from yy_switch_to_buffer. */",
+ " yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );",
+ " YY_G(yy_did_buffer_switch_on_eof) = 1;",
+ "}",
+ "%endif",
+ "",
+ "",
+ "%if-c-or-c++",
+ "/** Removes and deletes the top of the stack, if present.",
+ " * The next element becomes the new top.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "%if-c-only",
+ "void yypop_buffer_state YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ "void yyFlexLexer::yypop_buffer_state (void)",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " if (!YY_CURRENT_BUFFER)",
+ " return;",
+ "",
+ " yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);",
+ " YY_CURRENT_BUFFER_LVALUE = NULL;",
+ " if (YY_G(yy_buffer_stack_top) > 0)",
+ " --YY_G(yy_buffer_stack_top);",
+ "",
+ " if (YY_CURRENT_BUFFER) {",
+ " yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );",
+ " YY_G(yy_did_buffer_switch_on_eof) = 1;",
+ " }",
+ "}",
+ "%endif",
+ "",
+ "",
+ "%if-c-or-c++",
+ "/* Allocates the stack if it does not exist.",
+ " * Guarantees space for at least one push.",
+ " */",
+ "%if-c-only",
+ "static void yyensure_buffer_stack YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ "void yyFlexLexer::yyensure_buffer_stack(void)",
+ "%endif",
+ "{",
+ " yy_size_t num_to_alloc;",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " if (!YY_G(yy_buffer_stack)) {",
+ "",
+ " /* First allocation is just for 2 elements, since we don't know if this",
+ " * scanner will even need a stack. We use 2 instead of 1 to avoid an",
+ " * immediate realloc on the next call.",
+ " */",
+ " num_to_alloc = 1; // After all that talk, this was set to 1 anyways...",
+ " YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc",
+ " (num_to_alloc * sizeof(struct yy_buffer_state*)",
+ " M4_YY_CALL_LAST_ARG);",
+ " if ( ! YY_G(yy_buffer_stack) )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );",
+ " ",
+ " ",
+ " memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));",
+ " ",
+ " YY_G(yy_buffer_stack_max) = num_to_alloc;",
+ " YY_G(yy_buffer_stack_top) = 0;",
+ " return;",
+ " }",
+ "",
+ " if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){",
+ "",
+ " /* Increase the buffer to prepare for a possible push. */",
+ " yy_size_t grow_size = 8 /* arbitrary grow size */;",
+ "",
+ " num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;",
+ " YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc",
+ " (YY_G(yy_buffer_stack),",
+ " num_to_alloc * sizeof(struct yy_buffer_state*)",
+ " M4_YY_CALL_LAST_ARG);",
+ " if ( ! YY_G(yy_buffer_stack) )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );",
+ "",
+ " /* zero only the new slots.*/",
+ " memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));",
+ " YY_G(yy_buffer_stack_max) = num_to_alloc;",
+ " }",
+ "}",
+ "%endif",
+ "",
+ "",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,",
+ "[[",
+ "%if-c-only",
+ "/** Setup the input buffer state to scan directly from a user-specified character buffer.",
+ " * @param base the character buffer",
+ " * @param size the size in bytes of the character buffer",
+ " * M4_YY_DOC_PARAM",
+ " * @return the newly allocated buffer state object. ",
+ " */",
+ "YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)",
+ "{",
+ " YY_BUFFER_STATE b;",
+ " m4_dnl M4_YY_DECL_GUTS_VAR();",
+ "",
+ " if ( size < 2 ||",
+ " base[size-2] != YY_END_OF_BUFFER_CHAR ||",
+ " base[size-1] != YY_END_OF_BUFFER_CHAR )",
+ " /* They forgot to leave room for the EOB's. */",
+ " return 0;",
+ "",
+ " b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );",
+ " if ( ! b )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yy_scan_buffer()\" );",
+ "",
+ " b->yy_buf_size = size - 2; /* \"- 2\" to take care of EOB's */",
+ " b->yy_buf_pos = b->yy_ch_buf = base;",
+ " b->yy_is_our_buffer = 0;",
+ " b->yy_input_file = 0;",
+ " b->yy_n_chars = b->yy_buf_size;",
+ " b->yy_is_interactive = 0;",
+ " b->yy_at_bol = 1;",
+ " b->yy_fill_buffer = 0;",
+ " b->yy_buffer_status = YY_BUFFER_NEW;",
+ "",
+ " yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );",
+ "",
+ " return b;",
+ "}",
+ "%endif",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,",
+ "[[",
+ "%if-c-only",
+ "/** Setup the input buffer state to scan a string. The next call to yylex() will",
+ " * scan from a @e copy of @a str.",
+ " * @param yystr a NUL-terminated string to scan",
+ " * M4_YY_DOC_PARAM",
+ " * @return the newly allocated buffer state object.",
+ " * @note If you want to scan bytes that may contain NUL values, then use",
+ " * yy_scan_bytes() instead.",
+ " */",
+ "YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)",
+ "{",
+ " m4_dnl M4_YY_DECL_GUTS_VAR();",
+ "",
+ " return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);",
+ "}",
+ "%endif",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,",
+ "[[",
+ "%if-c-only",
+ "/** Setup the input buffer state to scan the given bytes. The next call to yylex() will",
+ " * scan from a @e copy of @a bytes.",
+ " * @param yybytes the byte buffer to scan",
+ " * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.",
+ " * M4_YY_DOC_PARAM",
+ " * @return the newly allocated buffer state object.",
+ " */",
+ "YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, yy_size_t ,_yybytes_len)",
+ "{",
+ " YY_BUFFER_STATE b;",
+ " char *buf;",
+ " yy_size_t n;",
+ " yy_size_t i;",
+ " m4_dnl M4_YY_DECL_GUTS_VAR();",
+ "",
+ " /* Get memory for full buffer, including space for trailing EOB's. */",
+ " n = _yybytes_len + 2;",
+ " buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );",
+ " if ( ! buf )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yy_scan_bytes()\" );",
+ "",
+ " for ( i = 0; i < _yybytes_len; ++i )",
+ " buf[i] = yybytes[i];",
+ "",
+ " buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;",
+ "",
+ " b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);",
+ " if ( ! b )",
+ " YY_FATAL_ERROR( \"bad buffer in yy_scan_bytes()\" );",
+ "",
+ " /* It's okay to grow etc. this buffer, and we should throw it",
+ " * away when we're done.",
+ " */",
+ " b->yy_is_our_buffer = 1;",
+ "",
+ " return b;",
+ "}",
+ "%endif",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,",
+ "[[",
+ "%if-c-only",
+ " static void yy_push_state YYFARGS1( int ,_new_state)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_push_state( int _new_state )",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )",
+ " {",
+ " yy_size_t new_size;",
+ "",
+ " YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;",
+ " new_size = YY_G(yy_start_stack_depth) * sizeof( int );",
+ "",
+ " if ( ! YY_G(yy_start_stack) )",
+ " YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );",
+ "",
+ " else",
+ " YY_G(yy_start_stack) = (int *) yyrealloc(",
+ " (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );",
+ "",
+ " if ( ! YY_G(yy_start_stack) )",
+ " YY_FATAL_ERROR( \"out of memory expanding start-condition stack\" );",
+ " }",
+ "",
+ " YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;",
+ "",
+ " BEGIN(_new_state);",
+ "}",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_POP_STATE]],,",
+ "[[",
+ "%if-c-only",
+ " static void yy_pop_state YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ " void yyFlexLexer::yy_pop_state()",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " if ( --YY_G(yy_start_stack_ptr) < 0 )",
+ " YY_FATAL_ERROR( \"start-condition stack underflow\" );",
+ "",
+ " BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);",
+ "}",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_TOP_STATE]],,",
+ "[[",
+ "%if-c-only",
+ " static int yy_top_state YYFARGS0(void)",
+ "%endif",
+ "%if-c++-only",
+ " int yyFlexLexer::yy_top_state()",
+ "%endif",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];",
+ "}",
+ "]])",
+ "",
+ "#ifndef YY_EXIT_FAILURE",
+ "#define YY_EXIT_FAILURE 2",
+ "#endif",
+ "",
+ "%if-c-only",
+ "static void yy_fatal_error YYFARGS1(yyconst char*, msg)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " M4_YY_NOOP_GUTS_VAR();",
+ " (void) fprintf( stderr, \"%s\\n\", msg );",
+ " exit( YY_EXIT_FAILURE );",
+ "}",
+ "%endif",
+ "%if-c++-only",
+ "void yyFlexLexer::LexerError( yyconst char msg[] )",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " std::cerr << msg << std::endl;",
+ " exit( YY_EXIT_FAILURE );",
+ "}",
+ "%endif",
+ "",
+ "/* Redefine yyless() so it works in section 3 code. */",
+ "",
+ "#undef yyless",
+ "#define yyless(n) \\",
+ " do \\",
+ " { \\",
+ " /* Undo effects of setting up yytext. */ \\",
+ " int yyless_macro_arg = (n); \\",
+ " YY_LESS_LINENO(yyless_macro_arg);\\",
+ " yytext[yyleng] = YY_G(yy_hold_char); \\",
+ " YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \\",
+ " YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \\",
+ " *YY_G(yy_c_buf_p) = '\\0'; \\",
+ " yyleng = yyless_macro_arg; \\",
+ " } \\",
+ " while ( 0 )",
+ "",
+ "",
+ "",
+ "/* Accessor methods (get/set functions) to struct members. */",
+ "",
+ "%if-c-only",
+ "%if-reentrant",
+ "m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,",
+ "[[",
+ "/** Get the user-defined data for this scanner.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "YY_EXTRA_TYPE yyget_extra YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yyextra;",
+ "}",
+ "]])",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_LINENO]],,",
+ "[[",
+ "/** Get the current line number.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "int yyget_lineno YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " ",
+ " m4_ifdef( [[M4_YY_REENTRANT]],",
+ " [[",
+ " if (! YY_CURRENT_BUFFER)",
+ " return 0;",
+ " ]])",
+ " return yylineno;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_REENTRANT]],",
+ "[[",
+ "m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,",
+ "[[",
+ "/** Get the current column number.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "int yyget_column YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " ",
+ " m4_ifdef( [[M4_YY_REENTRANT]],",
+ " [[",
+ " if (! YY_CURRENT_BUFFER)",
+ " return 0;",
+ " ]])",
+ " return yycolumn;",
+ "}",
+ "]])",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_IN]],,",
+ "[[",
+ "/** Get the input stream.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "FILE *yyget_in YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yyin;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_OUT]],,",
+ "[[",
+ "/** Get the output stream.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "FILE *yyget_out YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yyout;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_LENG]],,",
+ "[[",
+ "/** Get the length of the current token.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "yy_size_t yyget_leng YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yyleng;",
+ "}",
+ "]])",
+ "",
+ "/** Get the current token.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "m4_ifdef( [[M4_YY_NO_GET_TEXT]],,",
+ "[[",
+ "char *yyget_text YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yytext;",
+ "}",
+ "]])",
+ "",
+ "%if-reentrant",
+ "m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,",
+ "[[",
+ "/** Set the user-defined data. This data is never touched by the scanner.",
+ " * @param user_defined The data to be associated with this scanner.",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " yyextra = user_defined ;",
+ "}",
+ "]])",
+ "%endif",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_LINENO]],,",
+ "[[",
+ "/** Set the current line number.",
+ " * @param _line_number line number",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "void yyset_lineno YYFARGS1( int ,_line_number)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " m4_ifdef( [[M4_YY_REENTRANT]],",
+ " [[",
+ " /* lineno is only valid if an input buffer exists. */",
+ " if (! YY_CURRENT_BUFFER )",
+ " YY_FATAL_ERROR( \"yyset_lineno called with no buffer\" );",
+ " ]])",
+ " yylineno = _line_number;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_REENTRANT]],",
+ "[[",
+ "m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,",
+ "[[",
+ "/** Set the current column.",
+ " * @param _column_no column number",
+ " * M4_YY_DOC_PARAM",
+ " */",
+ "void yyset_column YYFARGS1( int , _column_no)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " m4_ifdef( [[M4_YY_REENTRANT]],",
+ " [[",
+ " /* column is only valid if an input buffer exists. */",
+ " if (! YY_CURRENT_BUFFER )",
+ " YY_FATAL_ERROR( \"yyset_column called with no buffer\" );",
+ " ]])",
+ " yycolumn = _column_no;",
+ "}",
+ "]])",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_IN]],,",
+ "[[",
+ "/** Set the input stream. This does not discard the current",
+ " * input buffer.",
+ " * @param _in_str A readable stream.",
+ " * M4_YY_DOC_PARAM",
+ " * @see yy_switch_to_buffer",
+ " */",
+ "void yyset_in YYFARGS1( FILE * ,_in_str)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " yyin = _in_str ;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_OUT]],,",
+ "[[",
+ "void yyset_out YYFARGS1( FILE * ,_out_str)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " yyout = _out_str ;",
+ "}",
+ "]])",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,",
+ "[[",
+ "int yyget_debug YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yy_flex_debug;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,",
+ "[[",
+ "void yyset_debug YYFARGS1( int ,_bdebug)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " yy_flex_debug = _bdebug ;",
+ "}",
+ "]])",
+ "%endif",
+ "",
+ "%if-reentrant",
+ "/* Accessor methods for yylval and yylloc */",
+ "",
+ "%if-bison-bridge",
+ "m4_ifdef( [[M4_YY_NO_GET_LVAL]],,",
+ "[[",
+ "YYSTYPE * yyget_lval YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yylval;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_SET_LVAL]],,",
+ "[[",
+ "void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " yylval = yylval_param;",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[<M4_YY_BISON_LLOC>]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_NO_GET_LLOC]],,",
+ " [[",
+ "YYLTYPE *yyget_lloc YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " return yylloc;",
+ "}",
+ " ]])",
+ "",
+ " m4_ifdef( [[M4_YY_NO_SET_LLOC]],,",
+ " [[",
+ "void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " yylloc = yylloc_param;",
+ "}",
+ " ]])",
+ "]])",
+ "",
+ "%endif",
+ "",
+ "",
+ "/* User-visible API */",
+ "",
+ "/* yylex_init is special because it creates the scanner itself, so it is",
+ " * the ONLY reentrant function that doesn't take the scanner as the last argument.",
+ " * That's why we explicitly handle the declaration, instead of using our macros.",
+ " */",
+ "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],",
+ "[[",
+ "int yylex_init( ptr_yy_globals )",
+ " yyscan_t* ptr_yy_globals;",
+ "]],",
+ "[[",
+ "int yylex_init(yyscan_t* ptr_yy_globals)",
+ "]])",
+ "{",
+ " if (ptr_yy_globals == NULL){",
+ " errno = EINVAL;",
+ " return 1;",
+ " }",
+ "",
+ " *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );",
+ "",
+ " if (*ptr_yy_globals == NULL){",
+ " errno = ENOMEM;",
+ " return 1;",
+ " }",
+ "",
+ " /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */",
+ " memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));",
+ "",
+ " return yy_init_globals ( *ptr_yy_globals );",
+ "}",
+ "",
+ "",
+ "/* yylex_init_extra has the same functionality as yylex_init, but follows the",
+ " * convention of taking the scanner as the last argument. Note however, that",
+ " * this is a *pointer* to a scanner, as it will be allocated by this call (and",
+ " * is the reason, too, why this function also must handle its own declaration).",
+ " * The user defined value in the first argument will be available to yyalloc in",
+ " * the yyextra field.",
+ " */",
+ "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],",
+ "[[",
+ "int yylex_init_extra( yy_user_defined, ptr_yy_globals )",
+ " YY_EXTRA_TYPE yy_user_defined;",
+ " yyscan_t* ptr_yy_globals;",
+ "]],",
+ "[[",
+ "int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )",
+ "]])",
+ "{",
+ " struct yyguts_t dummy_yyguts;",
+ "",
+ " yyset_extra (yy_user_defined, &dummy_yyguts);",
+ "",
+ " if (ptr_yy_globals == NULL){",
+ " errno = EINVAL;",
+ " return 1;",
+ " }",
+ " ",
+ " *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );",
+ " ",
+ " if (*ptr_yy_globals == NULL){",
+ " errno = ENOMEM;",
+ " return 1;",
+ " }",
+ " ",
+ " /* By setting to 0xAA, we expose bugs in",
+ " yy_init_globals. Leave at 0x00 for releases. */",
+ " memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));",
+ " ",
+ " yyset_extra (yy_user_defined, *ptr_yy_globals);",
+ " ",
+ " return yy_init_globals ( *ptr_yy_globals );",
+ "}",
+ "",
+ "%endif if-c-only",
+ "%# Actually, that ended an if-rentrant section",
+ "",
+ "%if-c-only",
+ "static int yy_init_globals YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " /* Initialization is the same as for the non-reentrant scanner.",
+ " * This function is called from yylex_destroy(), so don't allocate here.",
+ " */",
+ "",
+ "m4_ifdef( [[M4_YY_USE_LINENO]],",
+ "[[",
+ " m4_ifdef( [[M4_YY_NOT_REENTRANT]],",
+ " [[",
+ " /* We do not touch yylineno unless the option is enabled. */",
+ " yylineno = 1;",
+ " ]])",
+ "]])",
+ " YY_G(yy_buffer_stack) = 0;",
+ " YY_G(yy_buffer_stack_top) = 0;",
+ " YY_G(yy_buffer_stack_max) = 0;",
+ " YY_G(yy_c_buf_p) = (char *) 0;",
+ " YY_G(yy_init) = 0;",
+ " YY_G(yy_start) = 0;",
+ "",
+ "m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],",
+ "[[",
+ " YY_G(yy_start_stack_ptr) = 0;",
+ " YY_G(yy_start_stack_depth) = 0;",
+ " YY_G(yy_start_stack) = NULL;",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_USES_REJECT]],",
+ "[[",
+ " YY_G(yy_state_buf) = 0;",
+ " YY_G(yy_state_ptr) = 0;",
+ " YY_G(yy_full_match) = 0;",
+ " YY_G(yy_lp) = 0;",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],",
+ "[[",
+ " YY_G(yytext_ptr) = 0;",
+ " YY_G(yy_more_offset) = 0;",
+ " YY_G(yy_prev_more_offset) = 0;",
+ "]])",
+ "",
+ "/* Defined in main.c */",
+ "#ifdef YY_STDINIT",
+ " yyin = stdin;",
+ " yyout = stdout;",
+ "#else",
+ " yyin = (FILE *) 0;",
+ " yyout = (FILE *) 0;",
+ "#endif",
+ "",
+ " /* For future reference: Set errno on error, since we are called by",
+ " * yylex_init()",
+ " */",
+ " return 0;",
+ "}",
+ "%endif",
+ "",
+ "",
+ "%if-c-only SNIP! this currently causes conflicts with the c++ scanner",
+ "/* yylex_destroy is for both reentrant and non-reentrant scanners. */",
+ "int yylex_destroy YYFARGS0(void)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ "",
+ " /* Pop the buffer stack, destroying each element. */",
+ " while(YY_CURRENT_BUFFER){",
+ " yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );",
+ " YY_CURRENT_BUFFER_LVALUE = NULL;",
+ " yypop_buffer_state(M4_YY_CALL_ONLY_ARG);",
+ " }",
+ "",
+ " /* Destroy the stack itself. */",
+ " yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);",
+ " YY_G(yy_buffer_stack) = NULL;",
+ "",
+ "m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],",
+ "[[",
+ " /* Destroy the start condition stack. */",
+ " yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );",
+ " YY_G(yy_start_stack) = NULL;",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_USES_REJECT]],",
+ "[[",
+ " yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);",
+ " YY_G(yy_state_buf) = NULL;",
+ "]])",
+ "",
+ " /* Reset the globals. This is important in a non-reentrant scanner so the next time",
+ " * yylex() is called, initialization will occur. */",
+ " yy_init_globals( M4_YY_CALL_ONLY_ARG);",
+ "",
+ "%if-reentrant",
+ " /* Destroy the main struct (reentrant only). */",
+ " yyfree ( yyscanner M4_YY_CALL_LAST_ARG );",
+ " yyscanner = NULL;",
+ "%endif",
+ " return 0;",
+ "}",
+ "%endif",
+ "",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "/*",
+ " * Internal utility routines.",
+ " */",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#ifndef yytext_ptr",
+ "static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " M4_YY_NOOP_GUTS_VAR();",
+ "",
+ " int i;",
+ " for ( i = 0; i < n; ++i )",
+ " s1[i] = s2[i];",
+ "}",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+ "[[",
+ "#ifdef YY_NEED_STRLEN",
+ "static int yy_flex_strlen YYFARGS1( yyconst char *,s)",
+ "{",
+ " int n;",
+ " for ( n = 0; s[n]; ++n )",
+ " ;",
+ "",
+ " return n;",
+ "}",
+ "#endif",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,",
+ "[[",
+ "void *yyalloc YYFARGS1( yy_size_t ,size)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " M4_YY_NOOP_GUTS_VAR();",
+ " return (void *) malloc( size );",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,",
+ "[[",
+ "void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " M4_YY_NOOP_GUTS_VAR();",
+ "",
+ " /* The cast to (char *) in the following accommodates both",
+ " * implementations that use char* generic pointers, and those",
+ " * that use void* generic pointers. It works with the latter",
+ " * because both ANSI C and C++ allow castless assignment from",
+ " * any pointer type to void*, and deal with argument conversions",
+ " * as though doing an assignment.",
+ " */",
+ " return (void *) realloc( (char *) ptr, size );",
+ "}",
+ "]])",
+ "",
+ "m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,",
+ "[[",
+ "void yyfree YYFARGS1( void *,ptr)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " M4_YY_NOOP_GUTS_VAR();",
+ " free( (char *) ptr ); /* see yyrealloc() for (char *) cast */",
+ "}",
+ "]])",
+ "",
+ "%if-tables-serialization definitions",
+ "#ifdef FLEX_SCANNER",
+ "/*",
+ "dnl tables_shared.c - tables serialization code",
+ "dnl ",
+ "dnl Copyright (c) 1990 The Regents of the University of California.",
+ "dnl All rights reserved.",
+ "dnl ",
+ "dnl This code is derived from software contributed to Berkeley by",
+ "dnl Vern Paxson.",
+ "dnl ",
+ "dnl The United States Government has rights in this work pursuant",
+ "dnl to contract no. DE-AC03-76SF00098 between the United States",
+ "dnl Department of Energy and the University of California.",
+ "dnl ",
+ "dnl This file is part of flex.",
+ "dnl ",
+ "dnl Redistribution and use in source and binary forms, with or without",
+ "dnl modification, are permitted provided that the following conditions",
+ "dnl are met:",
+ "dnl ",
+ "dnl 1. Redistributions of source code must retain the above copyright",
+ "dnl notice, this list of conditions and the following disclaimer.",
+ "dnl 2. Redistributions in binary form must reproduce the above copyright",
+ "dnl notice, this list of conditions and the following disclaimer in the",
+ "dnl documentation and/or other materials provided with the distribution.",
+ "dnl ",
+ "dnl Neither the name of the University nor the names of its contributors",
+ "dnl may be used to endorse or promote products derived from this software",
+ "dnl without specific prior written permission.",
+ "dnl ",
+ "dnl THIS SOFTWARE IS PROVIDED `AS IS' AND WITHOUT ANY EXPRESS OR",
+ "dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED",
+ "dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR",
+ "dnl PURPOSE.",
+ "dnl ",
+ "*/",
+ " ",
+ "/* This file is meant to be included in both the skeleton and the actual",
+ " * flex code (hence the name \"_shared\"). ",
+ " */",
+ "#ifndef yyskel_static",
+ "#define yyskel_static static",
+ "#endif",
+ "#else",
+ "#include \"flexdef.h\"",
+ "#include \"tables.h\"",
+ "#ifndef yyskel_static",
+ "#define yyskel_static",
+ "#endif",
+ "#endif",
+ "",
+ "",
+ "/** Get the number of integers in this table. This is NOT the",
+ " * same thing as the number of elements.",
+ " * @param tbl the table",
+ " * @return the number of integers in the table",
+ " */",
+ "yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)",
+ "{",
+ " flex_int32_t n;",
+ "",
+ " /* total number of ints */",
+ " n = tbl->td_lolen;",
+ " if (tbl->td_hilen > 0)",
+ " n *= tbl->td_hilen;",
+ "",
+ " if (tbl->td_id == YYTD_ID_TRANSITION)",
+ " n *= 2;",
+ " return n;",
+ "}",
+ "",
+ "",
+ "static int yytbl_read8 (void *v, struct yytbl_reader * rd)",
+ "{",
+ " errno = 0;",
+ " if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){",
+ " errno = EIO;",
+ " return -1;",
+ " }",
+ " rd->bread += sizeof(flex_uint8_t);",
+ " return 0;",
+ "}",
+ "",
+ "static int yytbl_read16 (void *v, struct yytbl_reader * rd)",
+ "{",
+ " errno = 0;",
+ " if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){",
+ " errno = EIO;",
+ " return -1;",
+ " }",
+ " *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));",
+ " rd->bread += sizeof(flex_uint16_t);",
+ " return 0;",
+ "}",
+ "",
+ "static int yytbl_read32 (void *v, struct yytbl_reader * rd)",
+ "{",
+ " errno = 0;",
+ " if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){",
+ " errno = EIO;",
+ " return -1;",
+ " }",
+ " *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));",
+ " rd->bread += sizeof(flex_uint32_t);",
+ " return 0;",
+ "}",
+ "",
+ "/** Read the header */",
+ "static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)",
+ "{",
+ " size_t bytes;",
+ " memset (th, 0, sizeof (struct yytbl_hdr));",
+ "",
+ " if (yytbl_read32 (&(th->th_magic), rd) != 0)",
+ " return -1;",
+ "",
+ " if (th->th_magic != YYTBL_MAGIC){",
+ " YY_FATAL_ERROR( \"bad magic number\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ "",
+ " if (yytbl_read32 (&(th->th_hsize), rd) != 0",
+ " || yytbl_read32 (&(th->th_ssize), rd) != 0",
+ " || yytbl_read16 (&(th->th_flags), rd) != 0)",
+ " return -1;",
+ "",
+ " /* Sanity check on header size. Greater than 1k suggests some funny business. */",
+ " if (th->th_hsize < 16 || th->th_hsize > 1024){",
+ " YY_FATAL_ERROR( \"insane header size detected\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ "",
+ " /* Allocate enough space for the version and name fields */",
+ " bytes = th->th_hsize - 14;",
+ " th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);",
+ " if ( ! th->th_version )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yytbl_hdr_read()\" );",
+ "",
+ " /* we read it all into th_version, and point th_name into that data */",
+ " if (fread (th->th_version, 1, bytes, rd->fp) != bytes){",
+ " errno = EIO;",
+ " yyfree(th->th_version M4_YY_CALL_LAST_ARG);",
+ " th->th_version = NULL;",
+ " return -1;",
+ " }",
+ " else",
+ " rd->bread += bytes;",
+ "",
+ " th->th_name = th->th_version + strlen (th->th_version) + 1;",
+ " return 0;",
+ "}",
+ "",
+ "/** lookup id in the dmap list.",
+ " * @param dmap pointer to first element in list",
+ " * @return NULL if not found.",
+ " */",
+ "static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,",
+ " int, id)",
+ "{",
+ " M4_YY_DECL_GUTS_VAR();",
+ " M4_YY_NOOP_GUTS_VAR();",
+ "",
+ " while (dmap->dm_id)",
+ " if ((int)(dmap->dm_id) == id)",
+ " return dmap;",
+ " else",
+ " dmap++;",
+ " return NULL;",
+ "}",
+ "",
+ "/** Read a table while mapping its contents to the local array. ",
+ " * @param dmap used to performing mapping",
+ " * @return 0 on success",
+ " */",
+ "static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)",
+ "{",
+ " struct yytbl_data td;",
+ " struct yytbl_dmap *transdmap=0;",
+ " int len, i, rv, inner_loop_count;",
+ " void *p=0;",
+ "",
+ " memset (&td, 0, sizeof (struct yytbl_data));",
+ "",
+ " if (yytbl_read16 (&td.td_id, rd) != 0",
+ " || yytbl_read16 (&td.td_flags, rd) != 0",
+ " || yytbl_read32 (&td.td_hilen, rd) != 0",
+ " || yytbl_read32 (&td.td_lolen, rd) != 0)",
+ " return -1;",
+ "",
+ " /* Lookup the map for the transition table so we have it in case we need it",
+ " * inside the loop below. This scanner might not even have a transition",
+ " * table, which is ok.",
+ " */",
+ " transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);",
+ "",
+ " if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){",
+ " YY_FATAL_ERROR( \"table id not found in map.\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ "",
+ " /* Allocate space for table.",
+ " * The --full yy_transition table is a special case, since we",
+ " * need the dmap.dm_sz entry to tell us the sizeof the individual",
+ " * struct members.",
+ " */",
+ " {",
+ " size_t bytes;",
+ "",
+ " if ((td.td_flags & YYTD_STRUCT))",
+ " bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);",
+ " else",
+ " bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;",
+ "",
+ " if(M4_YY_TABLES_VERIFY)",
+ " /* We point to the array itself */",
+ " p = dmap->dm_arr; ",
+ " else",
+ " /* We point to the address of a pointer. */",
+ " *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);",
+ " if ( ! p )",
+ " YY_FATAL_ERROR( \"out of dynamic memory in yytbl_data_load()\" );",
+ " }",
+ "",
+ " /* If it's a struct, we read 2 integers to get one element */",
+ " if ((td.td_flags & YYTD_STRUCT) != 0)",
+ " inner_loop_count = 2;",
+ " else",
+ " inner_loop_count = 1;",
+ "",
+ " /* read and map each element.",
+ " * This loop iterates once for each element of the td_data array.",
+ " * Notice that we increment 'i' in the inner loop.",
+ " */",
+ " len = yytbl_calc_total_len (&td);",
+ " for (i = 0; i < len; ){",
+ " int j;",
+ "",
+ "",
+ " /* This loop really executes exactly 1 or 2 times.",
+ " * The second time is to handle the second member of the",
+ " * YYTD_STRUCT for the yy_transition array.",
+ " */",
+ " for (j = 0; j < inner_loop_count; j++, i++) {",
+ " flex_int32_t t32;",
+ "",
+ " /* read into t32 no matter what the real size is. */",
+ " {",
+ " flex_int16_t t16;",
+ " flex_int8_t t8;",
+ "",
+ " switch (YYTDFLAGS2BYTES (td.td_flags)) {",
+ " case sizeof (flex_int32_t):",
+ " rv = yytbl_read32 (&t32, rd);",
+ " break;",
+ " case sizeof (flex_int16_t):",
+ " rv = yytbl_read16 (&t16, rd);",
+ " t32 = t16;",
+ " break;",
+ " case sizeof (flex_int8_t):",
+ " rv = yytbl_read8 (&t8, rd);",
+ " t32 = t8;",
+ " break;",
+ " default: ",
+ " YY_FATAL_ERROR( \"invalid td_flags\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ " }",
+ " if (rv != 0)",
+ " return -1;",
+ "",
+ " /* copy into the deserialized array... */",
+ "",
+ " if ((td.td_flags & YYTD_STRUCT)) {",
+ " /* t32 is the j'th member of a two-element struct. */",
+ " void *v;",
+ "",
+ " v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)",
+ " : &(((struct yy_trans_info *) p)->yy_nxt);",
+ "",
+ " switch (dmap->dm_sz) {",
+ " case sizeof (flex_int32_t):",
+ " if (M4_YY_TABLES_VERIFY){",
+ " if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32)",
+ " YY_FATAL_ERROR( \"tables verification failed at YYTD_STRUCT flex_int32_t\" );",
+ " }else",
+ " ((flex_int32_t *) v)[0] = (flex_int32_t) t32;",
+ " break;",
+ " case sizeof (flex_int16_t):",
+ " if (M4_YY_TABLES_VERIFY ){",
+ " if(((flex_int16_t *) v)[0] != (flex_int16_t) t32)",
+ " YY_FATAL_ERROR( \"tables verification failed at YYTD_STRUCT flex_int16_t\" );",
+ " }else",
+ " ((flex_int16_t *) v)[0] = (flex_int16_t) t32;",
+ " break;",
+ " case sizeof(flex_int8_t):",
+ " if (M4_YY_TABLES_VERIFY ){",
+ " if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32)",
+ " YY_FATAL_ERROR( \"tables verification failed at YYTD_STRUCT flex_int8_t\" );",
+ " }else",
+ " ((flex_int8_t *) v)[0] = (flex_int8_t) t32;",
+ " break;",
+ " default:",
+ " YY_FATAL_ERROR( \"invalid dmap->dm_sz for struct\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ "",
+ " /* if we're done with j, increment p */",
+ " if (j == 1)",
+ " p = (struct yy_trans_info *) p + 1;",
+ " }",
+ " else if ((td.td_flags & YYTD_PTRANS)) {",
+ " /* t32 is an index into the transition array. */",
+ " struct yy_trans_info *v;",
+ "",
+ "",
+ " if (!transdmap){",
+ " YY_FATAL_ERROR( \"transition table not found\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ " ",
+ " if( M4_YY_TABLES_VERIFY)",
+ " v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);",
+ " else",
+ " v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);",
+ "",
+ " if(M4_YY_TABLES_VERIFY ){",
+ " if( ((struct yy_trans_info **) p)[0] != v)",
+ " YY_FATAL_ERROR( \"tables verification failed at YYTD_PTRANS\" );",
+ " }else",
+ " ((struct yy_trans_info **) p)[0] = v;",
+ " ",
+ " /* increment p */",
+ " p = (struct yy_trans_info **) p + 1;",
+ " }",
+ " else {",
+ " /* t32 is a plain int. copy data, then incrememnt p. */",
+ " switch (dmap->dm_sz) {",
+ " case sizeof (flex_int32_t):",
+ " if(M4_YY_TABLES_VERIFY ){",
+ " if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32)",
+ " YY_FATAL_ERROR( \"tables verification failed at flex_int32_t\" );",
+ " }else",
+ " ((flex_int32_t *) p)[0] = (flex_int32_t) t32;",
+ " p = ((flex_int32_t *) p) + 1;",
+ " break;",
+ " case sizeof (flex_int16_t):",
+ " if(M4_YY_TABLES_VERIFY ){",
+ " if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32)",
+ " YY_FATAL_ERROR( \"tables verification failed at flex_int16_t\" );",
+ " }else",
+ " ((flex_int16_t *) p)[0] = (flex_int16_t) t32;",
+ " p = ((flex_int16_t *) p) + 1;",
+ " break;",
+ " case sizeof (flex_int8_t):",
+ " if(M4_YY_TABLES_VERIFY ){",
+ " if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32)",
+ " YY_FATAL_ERROR( \"tables verification failed at flex_int8_t\" );",
+ " }else",
+ " ((flex_int8_t *) p)[0] = (flex_int8_t) t32;",
+ " p = ((flex_int8_t *) p) + 1;",
+ " break;",
+ " default:",
+ " YY_FATAL_ERROR( \"invalid dmap->dm_sz for plain int\" ); /* TODO: not fatal. */",
+ " return -1;",
+ " }",
+ " }",
+ " }",
+ "",
+ " }",
+ "",
+ " /* Now eat padding. */",
+ " {",
+ " int pad;",
+ " pad = yypad64(rd->bread);",
+ " while(--pad >= 0){",
+ " flex_int8_t t8;",
+ " if(yytbl_read8(&t8,rd) != 0)",
+ " return -1;",
+ " }",
+ " }",
+ "",
+ " return 0;",
+ "}",
+ "",
+ "%define-yytables The name for this specific scanner's tables.",
+ "",
+ "/* Find the key and load the DFA tables from the given stream. */",
+ "static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)",
+ "{",
+ " int rv=0;",
+ " struct yytbl_hdr th;",
+ " struct yytbl_reader rd;",
+ "",
+ " rd.fp = fp;",
+ " th.th_version = NULL;",
+ "",
+ " /* Keep trying until we find the right set of tables or end of file. */",
+ " while (!feof(rd.fp)) {",
+ " rd.bread = 0;",
+ " if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){",
+ " rv = -1;",
+ " goto return_rv;",
+ " }",
+ "",
+ " /* A NULL key means choose the first set of tables. */",
+ " if (key == NULL)",
+ " break;",
+ "",
+ " if (strcmp(th.th_name,key) != 0){",
+ " /* Skip ahead to next set */",
+ " fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);",
+ " yyfree(th.th_version M4_YY_CALL_LAST_ARG);",
+ " th.th_version = NULL;",
+ " }",
+ " else",
+ " break;",
+ " }",
+ "",
+ " while (rd.bread < th.th_ssize){",
+ " /* Load the data tables */",
+ " if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){",
+ " rv = -1;",
+ " goto return_rv;",
+ " }",
+ " }",
+ "",
+ "return_rv:",
+ " if(th.th_version){",
+ " yyfree(th.th_version M4_YY_CALL_LAST_ARG);",
+ " th.th_version = NULL;",
+ " }",
+ "",
+ " return rv;",
+ "}",
+ "",
+ "/** Load the DFA tables for this scanner from the given stream. */",
+ "int yytables_fload YYFARGS1(FILE *, fp)",
+ "{",
+ "",
+ " if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)",
+ " return -1;",
+ " return 0;",
+ "}",
+ "",
+ "/** Destroy the loaded tables, freeing memory, etc.. */",
+ "int yytables_destroy YYFARGS0(void)",
+ "{ ",
+ " struct yytbl_dmap *dmap=0;",
+ "",
+ " if(!M4_YY_TABLES_VERIFY){",
+ " /* Walk the dmap, freeing the pointers */",
+ " for(dmap=yydmap; dmap->dm_id; dmap++) {",
+ " void * v;",
+ " v = dmap->dm_arr;",
+ " if(v && *(char**)v){",
+ " yyfree(*(char**)v M4_YY_CALL_LAST_ARG);",
+ " *(char**)v = NULL;",
+ " }",
+ " }",
+ " }",
+ "",
+ " return 0;",
+ "}",
+ "",
+ "/* end table serialization code definitions */",
+ "%endif",
+ "",
+ "",
+ "m4_ifdef([[M4_YY_MAIN]], [[",
+ "int main M4_YY_PARAMS(void);",
+ "",
+ "int main ()",
+ "{",
+ "",
+ "%if-reentrant",
+ " yyscan_t lexer;",
+ " yylex_init(&lexer);",
+ " yylex( lexer );",
+ " yylex_destroy( lexer);",
+ "",
+ "%endif",
+ "%if-not-reentrant",
+ " yylex();",
+ "%endif",
+ "",
+ " return 0;",
+ "}",
+ "]])",
+ "",
+ "%ok-for-header",
+ "m4_ifdef( [[M4_YY_IN_HEADER]],",
+ "[[",
+ "#undef YY_NEW_FILE",
+ "#undef YY_FLUSH_BUFFER",
+ "#undef yy_set_bol",
+ "#undef yy_new_buffer",
+ "#undef yy_set_interactive",
+ "#undef YY_DO_BEFORE_ACTION",
+ "",
+ "#ifdef YY_DECL_IS_OURS",
+ "#undef YY_DECL_IS_OURS",
+ "#undef YY_DECL",
+ "#endif",
+ "]])",
+ 0
+};
diff --git a/src/sym.c b/src/sym.c
new file mode 100644
index 0000000..232cd0a
--- /dev/null
+++ b/src/sym.c
@@ -0,0 +1,272 @@
+/* sym - symbol table routines */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+
+/* Variables for symbol tables:
+ * sctbl - start-condition symbol table
+ * ndtbl - name-definition symbol table
+ * ccltab - character class text symbol table
+ */
+
+struct hash_entry {
+ struct hash_entry *prev, *next;
+ char *name;
+ char *str_val;
+ int int_val;
+};
+
+typedef struct hash_entry **hash_table;
+
+#define NAME_TABLE_HASH_SIZE 101
+#define START_COND_HASH_SIZE 101
+#define CCL_HASH_SIZE 101
+
+static struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE];
+static struct hash_entry *sctbl[START_COND_HASH_SIZE];
+static struct hash_entry *ccltab[CCL_HASH_SIZE];
+
+
+/* declare functions that have forward references */
+
+static int addsym PROTO ((char[], char *, int, hash_table, int));
+static struct hash_entry *findsym PROTO ((const char *sym,
+ hash_table table,
+
+ int table_size));
+static int hashfunct PROTO ((const char *, int));
+
+
+/* addsym - add symbol and definitions to symbol table
+ *
+ * -1 is returned if the symbol already exists, and the change not made.
+ */
+
+static int addsym (sym, str_def, int_def, table, table_size)
+ char sym[];
+ char *str_def;
+ int int_def;
+ hash_table table;
+ int table_size;
+{
+ int hash_val = hashfunct (sym, table_size);
+ struct hash_entry *sym_entry = table[hash_val];
+ struct hash_entry *new_entry;
+ struct hash_entry *successor;
+
+ while (sym_entry) {
+ if (!strcmp (sym, sym_entry->name)) { /* entry already exists */
+ return -1;
+ }
+
+ sym_entry = sym_entry->next;
+ }
+
+ /* create new entry */
+ new_entry = (struct hash_entry *)
+ flex_alloc (sizeof (struct hash_entry));
+
+ if (new_entry == NULL)
+ flexfatal (_("symbol table memory allocation failed"));
+
+ if ((successor = table[hash_val]) != 0) {
+ new_entry->next = successor;
+ successor->prev = new_entry;
+ }
+ else
+ new_entry->next = NULL;
+
+ new_entry->prev = NULL;
+ new_entry->name = sym;
+ new_entry->str_val = str_def;
+ new_entry->int_val = int_def;
+
+ table[hash_val] = new_entry;
+
+ return 0;
+}
+
+
+/* cclinstal - save the text of a character class */
+
+void cclinstal (ccltxt, cclnum)
+ Char ccltxt[];
+ int cclnum;
+{
+ /* We don't bother checking the return status because we are not
+ * called unless the symbol is new.
+ */
+
+ (void) addsym ((char *) copy_unsigned_string (ccltxt),
+ (char *) 0, cclnum, ccltab, CCL_HASH_SIZE);
+}
+
+
+/* ccllookup - lookup the number associated with character class text
+ *
+ * Returns 0 if there's no CCL associated with the text.
+ */
+
+int ccllookup (ccltxt)
+ Char ccltxt[];
+{
+ return findsym ((char *) ccltxt, ccltab, CCL_HASH_SIZE)->int_val;
+}
+
+
+/* findsym - find symbol in symbol table */
+
+static struct hash_entry *findsym (sym, table, table_size)
+ const char *sym;
+ hash_table table;
+ int table_size;
+{
+ static struct hash_entry empty_entry = {
+ (struct hash_entry *) 0, (struct hash_entry *) 0,
+ (char *) 0, (char *) 0, 0,
+ };
+ struct hash_entry *sym_entry =
+
+ table[hashfunct (sym, table_size)];
+
+ while (sym_entry) {
+ if (!strcmp (sym, sym_entry->name))
+ return sym_entry;
+ sym_entry = sym_entry->next;
+ }
+
+ return &empty_entry;
+}
+
+/* hashfunct - compute the hash value for "str" and hash size "hash_size" */
+
+static int hashfunct (str, hash_size)
+ const char *str;
+ int hash_size;
+{
+ int hashval;
+ int locstr;
+
+ hashval = 0;
+ locstr = 0;
+
+ while (str[locstr]) {
+ hashval = (hashval << 1) + (unsigned char) str[locstr++];
+ hashval %= hash_size;
+ }
+
+ return hashval;
+}
+
+
+/* ndinstal - install a name definition */
+
+void ndinstal (name, definition)
+ const char *name;
+ Char definition[];
+{
+
+ if (addsym (copy_string (name),
+ (char *) copy_unsigned_string (definition), 0,
+ ndtbl, NAME_TABLE_HASH_SIZE))
+ synerr (_("name defined twice"));
+}
+
+
+/* ndlookup - lookup a name definition
+ *
+ * Returns a nil pointer if the name definition does not exist.
+ */
+
+Char *ndlookup (nd)
+ const char *nd;
+{
+ return (Char *) findsym (nd, ndtbl, NAME_TABLE_HASH_SIZE)->str_val;
+}
+
+
+/* scextend - increase the maximum number of start conditions */
+
+void scextend ()
+{
+ current_max_scs += MAX_SCS_INCREMENT;
+
+ ++num_reallocs;
+
+ scset = reallocate_integer_array (scset, current_max_scs);
+ scbol = reallocate_integer_array (scbol, current_max_scs);
+ scxclu = reallocate_integer_array (scxclu, current_max_scs);
+ sceof = reallocate_integer_array (sceof, current_max_scs);
+ scname = reallocate_char_ptr_array (scname, current_max_scs);
+}
+
+
+/* scinstal - make a start condition
+ *
+ * NOTE
+ * The start condition is "exclusive" if xcluflg is true.
+ */
+
+void scinstal (str, xcluflg)
+ const char *str;
+ int xcluflg;
+{
+
+ if (++lastsc >= current_max_scs)
+ scextend ();
+
+ scname[lastsc] = copy_string (str);
+
+ if (addsym (scname[lastsc], (char *) 0, lastsc,
+ sctbl, START_COND_HASH_SIZE))
+ format_pinpoint_message (_
+ ("start condition %s declared twice"),
+str);
+
+ scset[lastsc] = mkstate (SYM_EPSILON);
+ scbol[lastsc] = mkstate (SYM_EPSILON);
+ scxclu[lastsc] = xcluflg;
+ sceof[lastsc] = false;
+}
+
+
+/* sclookup - lookup the number associated with a start condition
+ *
+ * Returns 0 if no such start condition.
+ */
+
+int sclookup (str)
+ const char *str;
+{
+ return findsym (str, sctbl, START_COND_HASH_SIZE)->int_val;
+}
diff --git a/src/tables.c b/src/tables.c
new file mode 100644
index 0000000..ef49ad0
--- /dev/null
+++ b/src/tables.c
@@ -0,0 +1,502 @@
+/* tables.c - tables serialization code
+ *
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Vern Paxson.
+ *
+ * The United States Government has rights in this work pursuant
+ * to contract no. DE-AC03-76SF00098 between the United States
+ * Department of Energy and the University of California.
+ *
+ * This file is part of flex.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+
+#include "flexdef.h"
+#include "tables.h"
+
+/** Convert size_t to t_flag.
+ * @param n in {1,2,4}
+ * @return YYTD_DATA*.
+ */
+#define BYTES2TFLAG(n)\
+ (((n) == sizeof(flex_int8_t))\
+ ? YYTD_DATA8\
+ :(((n)== sizeof(flex_int16_t))\
+ ? YYTD_DATA16\
+ : YYTD_DATA32))
+
+/** Clear YYTD_DATA* bit flags
+ * @return the flag with the YYTD_DATA* bits cleared
+ */
+#define TFLAGS_CLRDATA(flg) ((flg) & ~(YYTD_DATA8 | YYTD_DATA16 | YYTD_DATA32))
+
+int yytbl_write32 (struct yytbl_writer *wr, flex_uint32_t v);
+int yytbl_write16 (struct yytbl_writer *wr, flex_uint16_t v);
+int yytbl_write8 (struct yytbl_writer *wr, flex_uint8_t v);
+int yytbl_writen (struct yytbl_writer *wr, void *v, flex_int32_t len);
+static flex_int32_t yytbl_data_geti (const struct yytbl_data *tbl, int i);
+/* XXX Not used
+static flex_int32_t yytbl_data_getijk (const struct yytbl_data *tbl, int i,
+ int j, int k);
+ */
+
+
+/** Initialize the table writer.
+ * @param wr an uninitialized writer
+ * @param out the output file
+ * @return 0 on success
+ */
+int yytbl_writer_init (struct yytbl_writer *wr, FILE * out)
+{
+ wr->out = out;
+ wr->total_written = 0;
+ return 0;
+}
+
+/** Initialize a table header.
+ * @param th The uninitialized structure
+ * @param version_str the version string
+ * @param name the name of this table set
+ */
+int yytbl_hdr_init (struct yytbl_hdr *th, const char *version_str,
+ const char *name)
+{
+ memset (th, 0, sizeof (struct yytbl_hdr));
+
+ th->th_magic = YYTBL_MAGIC;
+ th->th_hsize = 14 + strlen (version_str) + 1 + strlen (name) + 1;
+ th->th_hsize += yypad64 (th->th_hsize);
+ th->th_ssize = 0; // Not known at this point.
+ th->th_flags = 0;
+ th->th_version = copy_string (version_str);
+ th->th_name = copy_string (name);
+ return 0;
+}
+
+/** Allocate and initialize a table data structure.
+ * @param td a pointer to an uninitialized table
+ * @param id the table identifier
+ * @return 0 on success
+ */
+int yytbl_data_init (struct yytbl_data *td, enum yytbl_id id)
+{
+
+ memset (td, 0, sizeof (struct yytbl_data));
+ td->td_id = id;
+ td->td_flags = YYTD_DATA32;
+ return 0;
+}
+
+/** Clean up table and data array.
+ * @param td will be destroyed
+ * @return 0 on success
+ */
+int yytbl_data_destroy (struct yytbl_data *td)
+{
+ if (td->td_data)
+ free (td->td_data);
+ td->td_data = 0;
+ free (td);
+ return 0;
+}
+
+/** Write enough padding to bring the file pointer to a 64-bit boundary. */
+static int yytbl_write_pad64 (struct yytbl_writer *wr)
+{
+ int pad, bwritten = 0;
+
+ pad = yypad64 (wr->total_written);
+ while (pad-- > 0)
+ if (yytbl_write8 (wr, 0) < 0)
+ return -1;
+ else
+ bwritten++;
+ return bwritten;
+}
+
+/** write the header.
+ * @param wr the output stream
+ * @param th table header to be written
+ * @return -1 on error, or bytes written on success.
+ */
+int yytbl_hdr_fwrite (struct yytbl_writer *wr, const struct yytbl_hdr *th)
+{
+ int sz, rv;
+ int bwritten = 0;
+
+ if (yytbl_write32 (wr, th->th_magic) < 0
+ || yytbl_write32 (wr, th->th_hsize) < 0)
+ flex_die (_("th_magic|th_hsize write32 failed"));
+ bwritten += 8;
+
+ if (fgetpos (wr->out, &(wr->th_ssize_pos)) != 0)
+ flex_die (_("fgetpos failed"));
+
+ if (yytbl_write32 (wr, th->th_ssize) < 0
+ || yytbl_write16 (wr, th->th_flags) < 0)
+ flex_die (_("th_ssize|th_flags write failed"));
+ bwritten += 6;
+
+ sz = strlen (th->th_version) + 1;
+ if ((rv = yytbl_writen (wr, th->th_version, sz)) != sz)
+ flex_die (_("th_version writen failed"));
+ bwritten += rv;
+
+ sz = strlen (th->th_name) + 1;
+ if ((rv = yytbl_writen (wr, th->th_name, sz)) != sz)
+ flex_die (_("th_name writen failed"));
+ bwritten += rv;
+
+ /* add padding */
+ if ((rv = yytbl_write_pad64 (wr)) < 0)
+ flex_die (_("pad64 failed"));
+ bwritten += rv;
+
+ /* Sanity check */
+ if (bwritten != (int) th->th_hsize)
+ flex_die (_("pad64 failed"));
+
+ return bwritten;
+}
+
+
+/** Write this table.
+ * @param wr the file writer
+ * @param td table data to be written
+ * @return -1 on error, or bytes written on success.
+ */
+int yytbl_data_fwrite (struct yytbl_writer *wr, struct yytbl_data *td)
+{
+ int rv;
+ flex_int32_t bwritten = 0;
+ flex_int32_t i, total_len;
+ fpos_t pos;
+
+ if ((rv = yytbl_write16 (wr, td->td_id)) < 0)
+ return -1;
+ bwritten += rv;
+
+ if ((rv = yytbl_write16 (wr, td->td_flags)) < 0)
+ return -1;
+ bwritten += rv;
+
+ if ((rv = yytbl_write32 (wr, td->td_hilen)) < 0)
+ return -1;
+ bwritten += rv;
+
+ if ((rv = yytbl_write32 (wr, td->td_lolen)) < 0)
+ return -1;
+ bwritten += rv;
+
+ total_len = yytbl_calc_total_len (td);
+ for (i = 0; i < total_len; i++) {
+ switch (YYTDFLAGS2BYTES (td->td_flags)) {
+ case sizeof (flex_int8_t):
+ rv = yytbl_write8 (wr, yytbl_data_geti (td, i));
+ break;
+ case sizeof (flex_int16_t):
+ rv = yytbl_write16 (wr, yytbl_data_geti (td, i));
+ break;
+ case sizeof (flex_int32_t):
+ rv = yytbl_write32 (wr, yytbl_data_geti (td, i));
+ break;
+ default:
+ flex_die (_("invalid td_flags detected"));
+ }
+ if (rv < 0) {
+ flex_die (_("error while writing tables"));
+ return -1;
+ }
+ bwritten += rv;
+ }
+
+ /* Sanity check */
+ if (bwritten != (int) (12 + total_len * YYTDFLAGS2BYTES (td->td_flags))) {
+ flex_die (_("insanity detected"));
+ return -1;
+ }
+
+ /* add padding */
+ if ((rv = yytbl_write_pad64 (wr)) < 0) {
+ flex_die (_("pad64 failed"));
+ return -1;
+ }
+ bwritten += rv;
+
+ /* Now go back and update the th_hsize member */
+ if (fgetpos (wr->out, &pos) != 0
+ || fsetpos (wr->out, &(wr->th_ssize_pos)) != 0
+ || yytbl_write32 (wr, wr->total_written) < 0
+ || fsetpos (wr->out, &pos)) {
+ flex_die (_("get|set|fwrite32 failed"));
+ return -1;
+ }
+ else
+ /* Don't count the int we just wrote. */
+ wr->total_written -= sizeof (flex_int32_t);
+ return bwritten;
+}
+
+/** Write n bytes.
+ * @param wr the table writer
+ * @param v data to be written
+ * @param len number of bytes
+ * @return -1 on error. number of bytes written on success.
+ */
+int yytbl_writen (struct yytbl_writer *wr, void *v, flex_int32_t len)
+{
+ int rv;
+
+ rv = fwrite (v, 1, len, wr->out);
+ if (rv != len)
+ return -1;
+ wr->total_written += len;
+ return len;
+}
+
+/** Write four bytes in network byte order
+ * @param wr the table writer
+ * @param v a dword in host byte order
+ * @return -1 on error. number of bytes written on success.
+ */
+int yytbl_write32 (struct yytbl_writer *wr, flex_uint32_t v)
+{
+ flex_uint32_t vnet;
+ size_t bytes, rv;
+
+ vnet = htonl (v);
+ bytes = sizeof (flex_uint32_t);
+ rv = fwrite (&vnet, bytes, 1, wr->out);
+ if (rv != 1)
+ return -1;
+ wr->total_written += bytes;
+ return bytes;
+}
+
+/** Write two bytes in network byte order.
+ * @param wr the table writer
+ * @param v a word in host byte order
+ * @return -1 on error. number of bytes written on success.
+ */
+int yytbl_write16 (struct yytbl_writer *wr, flex_uint16_t v)
+{
+ flex_uint16_t vnet;
+ size_t bytes, rv;
+
+ vnet = htons (v);
+ bytes = sizeof (flex_uint16_t);
+ rv = fwrite (&vnet, bytes, 1, wr->out);
+ if (rv != 1)
+ return -1;
+ wr->total_written += bytes;
+ return bytes;
+}
+
+/** Write a byte.
+ * @param wr the table writer
+ * @param v the value to be written
+ * @return -1 on error. number of bytes written on success.
+ */
+int yytbl_write8 (struct yytbl_writer *wr, flex_uint8_t v)
+{
+ size_t bytes, rv;
+
+ bytes = sizeof (flex_uint8_t);
+ rv = fwrite (&v, bytes, 1, wr->out);
+ if (rv != 1)
+ return -1;
+ wr->total_written += bytes;
+ return bytes;
+}
+
+
+/* XXX Not Used */
+#if 0
+/** Extract data element [i][j] from array data tables.
+ * @param tbl data table
+ * @param i index into higher dimension array. i should be zero for one-dimensional arrays.
+ * @param j index into lower dimension array.
+ * @param k index into struct, must be 0 or 1. Only valid for YYTD_ID_TRANSITION table
+ * @return data[i][j + k]
+ */
+static flex_int32_t yytbl_data_getijk (const struct yytbl_data *tbl, int i,
+ int j, int k)
+{
+ flex_int32_t lo;
+
+ k %= 2;
+ lo = tbl->td_lolen;
+
+ switch (YYTDFLAGS2BYTES (tbl->td_flags)) {
+ case sizeof (flex_int8_t):
+ return ((flex_int8_t *) (tbl->td_data))[(i * lo + j) * (k + 1) +
+ k];
+ case sizeof (flex_int16_t):
+ return ((flex_int16_t *) (tbl->td_data))[(i * lo + j) * (k +
+ 1) +
+ k];
+ case sizeof (flex_int32_t):
+ return ((flex_int32_t *) (tbl->td_data))[(i * lo + j) * (k +
+ 1) +
+ k];
+ default:
+ flex_die (_("invalid td_flags detected"));
+ break;
+ }
+
+ return 0;
+}
+#endif /* Not used */
+
+/** Extract data element [i] from array data tables treated as a single flat array of integers.
+ * Be careful for 2-dimensional arrays or for YYTD_ID_TRANSITION, which is an array
+ * of structs.
+ * @param tbl data table
+ * @param i index into array.
+ * @return data[i]
+ */
+static flex_int32_t yytbl_data_geti (const struct yytbl_data *tbl, int i)
+{
+
+ switch (YYTDFLAGS2BYTES (tbl->td_flags)) {
+ case sizeof (flex_int8_t):
+ return ((flex_int8_t *) (tbl->td_data))[i];
+ case sizeof (flex_int16_t):
+ return ((flex_int16_t *) (tbl->td_data))[i];
+ case sizeof (flex_int32_t):
+ return ((flex_int32_t *) (tbl->td_data))[i];
+ default:
+ flex_die (_("invalid td_flags detected"));
+ break;
+ }
+ return 0;
+}
+
+/** Set data element [i] in array data tables treated as a single flat array of integers.
+ * Be careful for 2-dimensional arrays or for YYTD_ID_TRANSITION, which is an array
+ * of structs.
+ * @param tbl data table
+ * @param i index into array.
+ * @param newval new value for data[i]
+ */
+static void yytbl_data_seti (const struct yytbl_data *tbl, int i,
+ flex_int32_t newval)
+{
+
+ switch (YYTDFLAGS2BYTES (tbl->td_flags)) {
+ case sizeof (flex_int8_t):
+ ((flex_int8_t *) (tbl->td_data))[i] = (flex_int8_t) newval;
+ break;
+ case sizeof (flex_int16_t):
+ ((flex_int16_t *) (tbl->td_data))[i] = (flex_int16_t) newval;
+ break;
+ case sizeof (flex_int32_t):
+ ((flex_int32_t *) (tbl->td_data))[i] = (flex_int32_t) newval;
+ break;
+ default:
+ flex_die (_("invalid td_flags detected"));
+ break;
+ }
+}
+
+/** Calculate the number of bytes needed to hold the largest
+ * absolute value in this data array.
+ * @param tbl the data table
+ * @return sizeof(n) where n in {flex_int8_t, flex_int16_t, flex_int32_t}
+ */
+static size_t min_int_size (struct yytbl_data *tbl)
+{
+ flex_uint32_t i, total_len;
+ flex_int32_t max = 0;
+
+ total_len = yytbl_calc_total_len (tbl);
+
+ for (i = 0; i < total_len; i++) {
+ flex_int32_t n;
+
+ n = abs (yytbl_data_geti (tbl, i));
+
+ if (n > max)
+ max = n;
+ }
+
+ if (max <= INT8_MAX)
+ return sizeof (flex_int8_t);
+ else if (max <= INT16_MAX)
+ return sizeof (flex_int16_t);
+ else
+ return sizeof (flex_int32_t);
+}
+
+/** Transform data to smallest possible of (int32, int16, int8).
+ * For example, we may have generated an int32 array due to user options
+ * (e.g., %option align), but if the maximum value in that array
+ * is 80 (for example), then we can serialize it with only 1 byte per int.
+ * This is NOT the same as compressed DFA tables. We're just trying
+ * to save storage space here.
+ *
+ * @param tbl the table to be compressed
+ */
+void yytbl_data_compress (struct yytbl_data *tbl)
+{
+ flex_int32_t i, newsz, total_len;
+ struct yytbl_data newtbl;
+
+ yytbl_data_init (&newtbl, tbl->td_id);
+ newtbl.td_hilen = tbl->td_hilen;
+ newtbl.td_lolen = tbl->td_lolen;
+ newtbl.td_flags = tbl->td_flags;
+
+ newsz = min_int_size (tbl);
+
+
+ if (newsz == (int) YYTDFLAGS2BYTES (tbl->td_flags))
+ /* No change in this table needed. */
+ return;
+
+ if (newsz > (int) YYTDFLAGS2BYTES (tbl->td_flags)) {
+ flex_die (_("detected negative compression"));
+ return;
+ }
+
+ total_len = yytbl_calc_total_len (tbl);
+ newtbl.td_data = calloc (total_len, newsz);
+ newtbl.td_flags =
+ TFLAGS_CLRDATA (newtbl.td_flags) | BYTES2TFLAG (newsz);
+
+ for (i = 0; i < total_len; i++) {
+ flex_int32_t g;
+
+ g = yytbl_data_geti (tbl, i);
+ yytbl_data_seti (&newtbl, i, g);
+ }
+
+
+ /* Now copy over the old table */
+ free (tbl->td_data);
+ *tbl = newtbl;
+}
+
+/* vim:set noexpandtab cindent tabstop=8 softtabstop=0 shiftwidth=8 textwidth=0: */
diff --git a/src/tables.h b/src/tables.h
new file mode 100644
index 0000000..2e4afe5
--- /dev/null
+++ b/src/tables.h
@@ -0,0 +1,85 @@
+/* tables.h - tables serialization code
+ *
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Vern Paxson.
+ *
+ * The United States Government has rights in this work pursuant
+ * to contract no. DE-AC03-76SF00098 between the United States
+ * Department of Energy and the University of California.
+ *
+ * This file is part of flex.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+#ifndef TABLES_H
+#define TABLES_H
+
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/* Tables serialization API declarations. */
+#include "tables_shared.h"
+struct yytbl_writer {
+ FILE *out;
+ flex_uint32_t total_written;
+ /**< bytes written so far */
+ fpos_t th_ssize_pos;
+ /**< position of th_ssize */
+};
+
+/* These are used by main.c, gen.c, etc.
+ * tablesext - if true, create external tables
+ * tablesfilename - filename for external tables
+ * tablesname - name that goes in serialized data, e.g., "yytables"
+ * tableswr - writer for external tables
+ * tablesverify - true if tables-verify option specified
+ * gentables - true if we should spit out the normal C tables
+ */
+extern bool tablesext, tablesverify,gentables;
+extern char *tablesfilename, *tablesname;
+extern struct yytbl_writer tableswr;
+
+int yytbl_writer_init (struct yytbl_writer *, FILE *);
+int yytbl_hdr_init (struct yytbl_hdr *th, const char *version_str,
+ const char *name);
+int yytbl_data_init (struct yytbl_data *tbl, enum yytbl_id id);
+int yytbl_data_destroy (struct yytbl_data *td);
+int yytbl_hdr_fwrite (struct yytbl_writer *wr,
+ const struct yytbl_hdr *th);
+int yytbl_data_fwrite (struct yytbl_writer *wr, struct yytbl_data *td);
+void yytbl_data_compress (struct yytbl_data *tbl);
+struct yytbl_data *mkftbl (void);
+
+
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#endif
+
+/* vim:set expandtab cindent tabstop=4 softtabstop=4 shiftwidth=4 textwidth=0: */
diff --git a/src/tables_shared.c b/src/tables_shared.c
new file mode 100644
index 0000000..123626c
--- /dev/null
+++ b/src/tables_shared.c
@@ -0,0 +1,70 @@
+#ifdef FLEX_SCANNER
+/*
+dnl tables_shared.c - tables serialization code
+dnl
+dnl Copyright (c) 1990 The Regents of the University of California.
+dnl All rights reserved.
+dnl
+dnl This code is derived from software contributed to Berkeley by
+dnl Vern Paxson.
+dnl
+dnl The United States Government has rights in this work pursuant
+dnl to contract no. DE-AC03-76SF00098 between the United States
+dnl Department of Energy and the University of California.
+dnl
+dnl This file is part of flex.
+dnl
+dnl Redistribution and use in source and binary forms, with or without
+dnl modification, are permitted provided that the following conditions
+dnl are met:
+dnl
+dnl 1. Redistributions of source code must retain the above copyright
+dnl notice, this list of conditions and the following disclaimer.
+dnl 2. Redistributions in binary form must reproduce the above copyright
+dnl notice, this list of conditions and the following disclaimer in the
+dnl documentation and/or other materials provided with the distribution.
+dnl
+dnl Neither the name of the University nor the names of its contributors
+dnl may be used to endorse or promote products derived from this software
+dnl without specific prior written permission.
+dnl
+dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+dnl PURPOSE.
+dnl
+*/
+
+/* This file is meant to be included in both the skeleton and the actual
+ * flex code (hence the name "_shared").
+ */
+#ifndef yyskel_static
+#define yyskel_static static
+#endif
+#else
+#include "flexdef.h"
+#include "tables.h"
+#ifndef yyskel_static
+#define yyskel_static
+#endif
+#endif
+
+
+/** Get the number of integers in this table. This is NOT the
+ * same thing as the number of elements.
+ * @param tbl the table
+ * @return the number of integers in the table
+ */
+yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
+{
+ flex_int32_t n;
+
+ /* total number of ints */
+ n = tbl->td_lolen;
+ if (tbl->td_hilen > 0)
+ n *= tbl->td_hilen;
+
+ if (tbl->td_id == YYTD_ID_TRANSITION)
+ n *= 2;
+ return n;
+}
diff --git a/src/tables_shared.h b/src/tables_shared.h
new file mode 100644
index 0000000..bbf9910
--- /dev/null
+++ b/src/tables_shared.h
@@ -0,0 +1,144 @@
+#ifdef FLEX_SCANNER
+/*
+dnl tables_shared.h - tables serialization header
+dnl
+dnl Copyright (c) 1990 The Regents of the University of California.
+dnl All rights reserved.
+dnl
+dnl This code is derived from software contributed to Berkeley by
+dnl Vern Paxson.
+dnl
+dnl The United States Government has rights in this work pursuant
+dnl to contract no. DE-AC03-76SF00098 between the United States
+dnl Department of Energy and the University of California.
+dnl
+dnl This file is part of flex.
+dnl
+dnl Redistribution and use in source and binary forms, with or without
+dnl modification, are permitted provided that the following conditions
+dnl are met:
+dnl
+dnl 1. Redistributions of source code must retain the above copyright
+dnl notice, this list of conditions and the following disclaimer.
+dnl 2. Redistributions in binary form must reproduce the above copyright
+dnl notice, this list of conditions and the following disclaimer in the
+dnl documentation and/or other materials provided with the distribution.
+dnl
+dnl Neither the name of the University nor the names of its contributors
+dnl may be used to endorse or promote products derived from this software
+dnl without specific prior written permission.
+dnl
+dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+dnl PURPOSE.
+
+dnl
+dnl This file is meant to be included in both the skeleton and the actual
+dnl flex code (hence the name "_shared").
+*/
+#ifndef yyskel_static
+#define yyskel_static static
+#endif
+#else
+#ifndef yyskel_static
+#define yyskel_static
+#endif
+#endif
+
+/* Structures and prototypes for serializing flex tables. The
+ * binary format is documented in the manual.
+ *
+ * Design considerations:
+ *
+ * - The format allows many tables per file.
+ * - The tables can be streamed.
+ * - All data is stored in network byte order.
+ * - We do not hinder future unicode support.
+ * - We can lookup tables by name.
+ */
+
+/** Magic number for serialized format. */
+#ifndef YYTBL_MAGIC
+#define YYTBL_MAGIC 0xF13C57B1
+#endif
+
+/** Calculate (0-7) = number bytes needed to pad n to next 64-bit boundary. */
+#ifndef yypad64
+#define yypad64(n) ((8-((n)%8))%8)
+#endif
+
+
+#ifndef YYTABLES_TYPES
+#define YYTABLES_TYPES
+/** Possible values for td_id field. Each one corresponds to a
+ * scanner table of the same name.
+ */
+enum yytbl_id {
+ YYTD_ID_ACCEPT = 0x01, /**< 1-dim ints */
+ YYTD_ID_BASE = 0x02, /**< 1-dim ints */
+ YYTD_ID_CHK = 0x03, /**< 1-dim ints */
+ YYTD_ID_DEF = 0x04, /**< 1-dim ints */
+ YYTD_ID_EC = 0x05, /**< 1-dim ints */
+ YYTD_ID_META = 0x06, /**< 1-dim ints */
+ YYTD_ID_NUL_TRANS = 0x07, /**< 1-dim ints, maybe indices */
+ YYTD_ID_NXT = 0x08, /**< may be 2 dimensional ints */
+ YYTD_ID_RULE_CAN_MATCH_EOL = 0x09, /**< 1-dim ints */
+ YYTD_ID_START_STATE_LIST = 0x0A, /**< 1-dim indices into trans tbl */
+ YYTD_ID_TRANSITION = 0x0B, /**< structs */
+ YYTD_ID_ACCLIST = 0x0C /**< 1-dim ints */
+};
+
+/** bit flags for t_flags field of struct yytbl_data */
+enum yytbl_flags {
+ /* These first three are mutually exclusive */
+ YYTD_DATA8 = 0x01, /**< data is an array of type flex_int8_t */
+ YYTD_DATA16 = 0x02, /**< data is an array of type flex_int16_t */
+ YYTD_DATA32 = 0x04, /**< data is an array of type flex_int32_t */
+
+ /* These two are mutually exclusive. */
+ YYTD_PTRANS = 0x08, /**< data is a list of indexes of entries
+ into the expanded `yy_transition'
+ array. See notes in manual. */
+ YYTD_STRUCT = 0x10 /**< data consists of yy_trans_info structs */
+};
+
+/* The serialized tables header. */
+struct yytbl_hdr {
+ flex_uint32_t th_magic; /**< Must be 0xF13C57B1 (comes from "Flex Table") */
+ flex_uint32_t th_hsize; /**< Size of this header in bytes. */
+ flex_uint32_t th_ssize; /**< Size of this dataset, in bytes, including header. */
+ flex_uint16_t th_flags; /**< Currently unused, must be 0 */
+ char *th_version; /**< Flex version string. NUL terminated. */
+ char *th_name; /**< The name of this table set. NUL terminated. */
+};
+
+/** A single serialized table */
+struct yytbl_data {
+ flex_uint16_t td_id; /**< enum yytbl_id table identifier */
+ flex_uint16_t td_flags; /**< how to interpret this data */
+ flex_uint32_t td_hilen; /**< num elements in highest dimension array */
+ flex_uint32_t td_lolen; /**< num elements in lowest dimension array */
+ void *td_data; /**< table data */
+};
+#endif
+
+/** Extract corresponding data size_t from td_flags */
+#ifndef YYTDFLAGS2BYTES
+#define YYTDFLAGS2BYTES(td_flags)\
+ (((td_flags) & YYTD_DATA8)\
+ ? sizeof(flex_int8_t)\
+ :(((td_flags) & YYTD_DATA16)\
+ ? sizeof(flex_int16_t)\
+ :sizeof(flex_int32_t)))
+#endif
+
+#ifdef FLEX_SCANNER
+%not-for-header
+#endif
+yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl);
+#ifdef FLEX_SCANNER
+%ok-for-header
+#endif
+
+/* vim:set noexpandtab cindent tabstop=8 softtabstop=0 shiftwidth=8 textwidth=0: */
diff --git a/src/tblcmp.c b/src/tblcmp.c
new file mode 100644
index 0000000..0c058e6
--- /dev/null
+++ b/src/tblcmp.c
@@ -0,0 +1,853 @@
+/* tblcmp - table compression routines */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include "flexdef.h"
+
+
+/* declarations for functions that have forward references */
+
+void mkentry PROTO ((int *, int, int, int, int));
+void mkprot PROTO ((int[], int, int));
+void mktemplate PROTO ((int[], int, int));
+void mv2front PROTO ((int));
+int tbldiff PROTO ((int[], int, int[]));
+
+
+/* bldtbl - build table entries for dfa state
+ *
+ * synopsis
+ * int state[numecs], statenum, totaltrans, comstate, comfreq;
+ * bldtbl( state, statenum, totaltrans, comstate, comfreq );
+ *
+ * State is the statenum'th dfa state. It is indexed by equivalence class and
+ * gives the number of the state to enter for a given equivalence class.
+ * totaltrans is the total number of transitions out of the state. Comstate
+ * is that state which is the destination of the most transitions out of State.
+ * Comfreq is how many transitions there are out of State to Comstate.
+ *
+ * A note on terminology:
+ * "protos" are transition tables which have a high probability of
+ * either being redundant (a state processed later will have an identical
+ * transition table) or nearly redundant (a state processed later will have
+ * many of the same out-transitions). A "most recently used" queue of
+ * protos is kept around with the hope that most states will find a proto
+ * which is similar enough to be usable, and therefore compacting the
+ * output tables.
+ * "templates" are a special type of proto. If a transition table is
+ * homogeneous or nearly homogeneous (all transitions go to the same
+ * destination) then the odds are good that future states will also go
+ * to the same destination state on basically the same character set.
+ * These homogeneous states are so common when dealing with large rule
+ * sets that they merit special attention. If the transition table were
+ * simply made into a proto, then (typically) each subsequent, similar
+ * state will differ from the proto for two out-transitions. One of these
+ * out-transitions will be that character on which the proto does not go
+ * to the common destination, and one will be that character on which the
+ * state does not go to the common destination. Templates, on the other
+ * hand, go to the common state on EVERY transition character, and therefore
+ * cost only one difference.
+ */
+
+void bldtbl (state, statenum, totaltrans, comstate, comfreq)
+ int state[], statenum, totaltrans, comstate, comfreq;
+{
+ int extptr, extrct[2][CSIZE + 1];
+ int mindiff, minprot, i, d;
+
+ /* If extptr is 0 then the first array of extrct holds the result
+ * of the "best difference" to date, which is those transitions
+ * which occur in "state" but not in the proto which, to date,
+ * has the fewest differences between itself and "state". If
+ * extptr is 1 then the second array of extrct hold the best
+ * difference. The two arrays are toggled between so that the
+ * best difference to date can be kept around and also a difference
+ * just created by checking against a candidate "best" proto.
+ */
+
+ extptr = 0;
+
+ /* If the state has too few out-transitions, don't bother trying to
+ * compact its tables.
+ */
+
+ if ((totaltrans * 100) < (numecs * PROTO_SIZE_PERCENTAGE))
+ mkentry (state, numecs, statenum, JAMSTATE, totaltrans);
+
+ else {
+ /* "checkcom" is true if we should only check "state" against
+ * protos which have the same "comstate" value.
+ */
+ int checkcom =
+
+ comfreq * 100 > totaltrans * CHECK_COM_PERCENTAGE;
+
+ minprot = firstprot;
+ mindiff = totaltrans;
+
+ if (checkcom) {
+ /* Find first proto which has the same "comstate". */
+ for (i = firstprot; i != NIL; i = protnext[i])
+ if (protcomst[i] == comstate) {
+ minprot = i;
+ mindiff = tbldiff (state, minprot,
+ extrct[extptr]);
+ break;
+ }
+ }
+
+ else {
+ /* Since we've decided that the most common destination
+ * out of "state" does not occur with a high enough
+ * frequency, we set the "comstate" to zero, assuring
+ * that if this state is entered into the proto list,
+ * it will not be considered a template.
+ */
+ comstate = 0;
+
+ if (firstprot != NIL) {
+ minprot = firstprot;
+ mindiff = tbldiff (state, minprot,
+ extrct[extptr]);
+ }
+ }
+
+ /* We now have the first interesting proto in "minprot". If
+ * it matches within the tolerances set for the first proto,
+ * we don't want to bother scanning the rest of the proto list
+ * to see if we have any other reasonable matches.
+ */
+
+ if (mindiff * 100 >
+ totaltrans * FIRST_MATCH_DIFF_PERCENTAGE) {
+ /* Not a good enough match. Scan the rest of the
+ * protos.
+ */
+ for (i = minprot; i != NIL; i = protnext[i]) {
+ d = tbldiff (state, i, extrct[1 - extptr]);
+ if (d < mindiff) {
+ extptr = 1 - extptr;
+ mindiff = d;
+ minprot = i;
+ }
+ }
+ }
+
+ /* Check if the proto we've decided on as our best bet is close
+ * enough to the state we want to match to be usable.
+ */
+
+ if (mindiff * 100 >
+ totaltrans * ACCEPTABLE_DIFF_PERCENTAGE) {
+ /* No good. If the state is homogeneous enough,
+ * we make a template out of it. Otherwise, we
+ * make a proto.
+ */
+
+ if (comfreq * 100 >=
+ totaltrans * TEMPLATE_SAME_PERCENTAGE)
+ mktemplate (state, statenum,
+ comstate);
+
+ else {
+ mkprot (state, statenum, comstate);
+ mkentry (state, numecs, statenum,
+ JAMSTATE, totaltrans);
+ }
+ }
+
+ else { /* use the proto */
+ mkentry (extrct[extptr], numecs, statenum,
+ prottbl[minprot], mindiff);
+
+ /* If this state was sufficiently different from the
+ * proto we built it from, make it, too, a proto.
+ */
+
+ if (mindiff * 100 >=
+ totaltrans * NEW_PROTO_DIFF_PERCENTAGE)
+ mkprot (state, statenum, comstate);
+
+ /* Since mkprot added a new proto to the proto queue,
+ * it's possible that "minprot" is no longer on the
+ * proto queue (if it happened to have been the last
+ * entry, it would have been bumped off). If it's
+ * not there, then the new proto took its physical
+ * place (though logically the new proto is at the
+ * beginning of the queue), so in that case the
+ * following call will do nothing.
+ */
+
+ mv2front (minprot);
+ }
+ }
+}
+
+
+/* cmptmps - compress template table entries
+ *
+ * Template tables are compressed by using the 'template equivalence
+ * classes', which are collections of transition character equivalence
+ * classes which always appear together in templates - really meta-equivalence
+ * classes.
+ */
+
+void cmptmps ()
+{
+ int tmpstorage[CSIZE + 1];
+ int *tmp = tmpstorage, i, j;
+ int totaltrans, trans;
+
+ peakpairs = numtemps * numecs + tblend;
+
+ if (usemecs) {
+ /* Create equivalence classes based on data gathered on
+ * template transitions.
+ */
+ nummecs = cre8ecs (tecfwd, tecbck, numecs);
+ }
+
+ else
+ nummecs = numecs;
+
+ while (lastdfa + numtemps + 1 >= current_max_dfas)
+ increase_max_dfas ();
+
+ /* Loop through each template. */
+
+ for (i = 1; i <= numtemps; ++i) {
+ /* Number of non-jam transitions out of this template. */
+ totaltrans = 0;
+
+ for (j = 1; j <= numecs; ++j) {
+ trans = tnxt[numecs * i + j];
+
+ if (usemecs) {
+ /* The absolute value of tecbck is the
+ * meta-equivalence class of a given
+ * equivalence class, as set up by cre8ecs().
+ */
+ if (tecbck[j] > 0) {
+ tmp[tecbck[j]] = trans;
+
+ if (trans > 0)
+ ++totaltrans;
+ }
+ }
+
+ else {
+ tmp[j] = trans;
+
+ if (trans > 0)
+ ++totaltrans;
+ }
+ }
+
+ /* It is assumed (in a rather subtle way) in the skeleton
+ * that if we're using meta-equivalence classes, the def[]
+ * entry for all templates is the jam template, i.e.,
+ * templates never default to other non-jam table entries
+ * (e.g., another template)
+ */
+
+ /* Leave room for the jam-state after the last real state. */
+ mkentry (tmp, nummecs, lastdfa + i + 1, JAMSTATE,
+ totaltrans);
+ }
+}
+
+
+
+/* expand_nxt_chk - expand the next check arrays */
+
+void expand_nxt_chk ()
+{
+ int old_max = current_max_xpairs;
+
+ current_max_xpairs += MAX_XPAIRS_INCREMENT;
+
+ ++num_reallocs;
+
+ nxt = reallocate_integer_array (nxt, current_max_xpairs);
+ chk = reallocate_integer_array (chk, current_max_xpairs);
+
+ zero_out ((char *) (chk + old_max),
+ (size_t) (MAX_XPAIRS_INCREMENT * sizeof (int)));
+}
+
+
+/* find_table_space - finds a space in the table for a state to be placed
+ *
+ * synopsis
+ * int *state, numtrans, block_start;
+ * int find_table_space();
+ *
+ * block_start = find_table_space( state, numtrans );
+ *
+ * State is the state to be added to the full speed transition table.
+ * Numtrans is the number of out-transitions for the state.
+ *
+ * find_table_space() returns the position of the start of the first block (in
+ * chk) able to accommodate the state
+ *
+ * In determining if a state will or will not fit, find_table_space() must take
+ * into account the fact that an end-of-buffer state will be added at [0],
+ * and an action number will be added in [-1].
+ */
+
+int find_table_space (state, numtrans)
+ int *state, numtrans;
+{
+ /* Firstfree is the position of the first possible occurrence of two
+ * consecutive unused records in the chk and nxt arrays.
+ */
+ int i;
+ int *state_ptr, *chk_ptr;
+ int *ptr_to_last_entry_in_state;
+
+ /* If there are too many out-transitions, put the state at the end of
+ * nxt and chk.
+ */
+ if (numtrans > MAX_XTIONS_FULL_INTERIOR_FIT) {
+ /* If table is empty, return the first available spot in
+ * chk/nxt, which should be 1.
+ */
+ if (tblend < 2)
+ return 1;
+
+ /* Start searching for table space near the end of
+ * chk/nxt arrays.
+ */
+ i = tblend - numecs;
+ }
+
+ else
+ /* Start searching for table space from the beginning
+ * (skipping only the elements which will definitely not
+ * hold the new state).
+ */
+ i = firstfree;
+
+ while (1) { /* loops until a space is found */
+ while (i + numecs >= current_max_xpairs)
+ expand_nxt_chk ();
+
+ /* Loops until space for end-of-buffer and action number
+ * are found.
+ */
+ while (1) {
+ /* Check for action number space. */
+ if (chk[i - 1] == 0) {
+ /* Check for end-of-buffer space. */
+ if (chk[i] == 0)
+ break;
+
+ else
+ /* Since i != 0, there is no use
+ * checking to see if (++i) - 1 == 0,
+ * because that's the same as i == 0,
+ * so we skip a space.
+ */
+ i += 2;
+ }
+
+ else
+ ++i;
+
+ while (i + numecs >= current_max_xpairs)
+ expand_nxt_chk ();
+ }
+
+ /* If we started search from the beginning, store the new
+ * firstfree for the next call of find_table_space().
+ */
+ if (numtrans <= MAX_XTIONS_FULL_INTERIOR_FIT)
+ firstfree = i + 1;
+
+ /* Check to see if all elements in chk (and therefore nxt)
+ * that are needed for the new state have not yet been taken.
+ */
+
+ state_ptr = &state[1];
+ ptr_to_last_entry_in_state = &chk[i + numecs + 1];
+
+ for (chk_ptr = &chk[i + 1];
+ chk_ptr != ptr_to_last_entry_in_state; ++chk_ptr)
+ if (*(state_ptr++) != 0 && *chk_ptr != 0)
+ break;
+
+ if (chk_ptr == ptr_to_last_entry_in_state)
+ return i;
+
+ else
+ ++i;
+ }
+}
+
+
+/* inittbl - initialize transition tables
+ *
+ * Initializes "firstfree" to be one beyond the end of the table. Initializes
+ * all "chk" entries to be zero.
+ */
+void inittbl ()
+{
+ int i;
+
+ zero_out ((char *) chk,
+
+ (size_t) (current_max_xpairs * sizeof (int)));
+
+ tblend = 0;
+ firstfree = tblend + 1;
+ numtemps = 0;
+
+ if (usemecs) {
+ /* Set up doubly-linked meta-equivalence classes; these
+ * are sets of equivalence classes which all have identical
+ * transitions out of TEMPLATES.
+ */
+
+ tecbck[1] = NIL;
+
+ for (i = 2; i <= numecs; ++i) {
+ tecbck[i] = i - 1;
+ tecfwd[i - 1] = i;
+ }
+
+ tecfwd[numecs] = NIL;
+ }
+}
+
+
+/* mkdeftbl - make the default, "jam" table entries */
+
+void mkdeftbl ()
+{
+ int i;
+
+ jamstate = lastdfa + 1;
+
+ ++tblend; /* room for transition on end-of-buffer character */
+
+ while (tblend + numecs >= current_max_xpairs)
+ expand_nxt_chk ();
+
+ /* Add in default end-of-buffer transition. */
+ nxt[tblend] = end_of_buffer_state;
+ chk[tblend] = jamstate;
+
+ for (i = 1; i <= numecs; ++i) {
+ nxt[tblend + i] = 0;
+ chk[tblend + i] = jamstate;
+ }
+
+ jambase = tblend;
+
+ base[jamstate] = jambase;
+ def[jamstate] = 0;
+
+ tblend += numecs;
+ ++numtemps;
+}
+
+
+/* mkentry - create base/def and nxt/chk entries for transition array
+ *
+ * synopsis
+ * int state[numchars + 1], numchars, statenum, deflink, totaltrans;
+ * mkentry( state, numchars, statenum, deflink, totaltrans );
+ *
+ * "state" is a transition array "numchars" characters in size, "statenum"
+ * is the offset to be used into the base/def tables, and "deflink" is the
+ * entry to put in the "def" table entry. If "deflink" is equal to
+ * "JAMSTATE", then no attempt will be made to fit zero entries of "state"
+ * (i.e., jam entries) into the table. It is assumed that by linking to
+ * "JAMSTATE" they will be taken care of. In any case, entries in "state"
+ * marking transitions to "SAME_TRANS" are treated as though they will be
+ * taken care of by whereever "deflink" points. "totaltrans" is the total
+ * number of transitions out of the state. If it is below a certain threshold,
+ * the tables are searched for an interior spot that will accommodate the
+ * state array.
+ */
+
+void mkentry (state, numchars, statenum, deflink, totaltrans)
+ int *state;
+ int numchars, statenum, deflink, totaltrans;
+{
+ int minec, maxec, i, baseaddr;
+ int tblbase, tbllast;
+
+ if (totaltrans == 0) { /* there are no out-transitions */
+ if (deflink == JAMSTATE)
+ base[statenum] = JAMSTATE;
+ else
+ base[statenum] = 0;
+
+ def[statenum] = deflink;
+ return;
+ }
+
+ for (minec = 1; minec <= numchars; ++minec) {
+ if (state[minec] != SAME_TRANS)
+ if (state[minec] != 0 || deflink != JAMSTATE)
+ break;
+ }
+
+ if (totaltrans == 1) {
+ /* There's only one out-transition. Save it for later to fill
+ * in holes in the tables.
+ */
+ stack1 (statenum, minec, state[minec], deflink);
+ return;
+ }
+
+ for (maxec = numchars; maxec > 0; --maxec) {
+ if (state[maxec] != SAME_TRANS)
+ if (state[maxec] != 0 || deflink != JAMSTATE)
+ break;
+ }
+
+ /* Whether we try to fit the state table in the middle of the table
+ * entries we have already generated, or if we just take the state
+ * table at the end of the nxt/chk tables, we must make sure that we
+ * have a valid base address (i.e., non-negative). Note that
+ * negative base addresses dangerous at run-time (because indexing
+ * the nxt array with one and a low-valued character will access
+ * memory before the start of the array.
+ */
+
+ /* Find the first transition of state that we need to worry about. */
+ if (totaltrans * 100 <= numchars * INTERIOR_FIT_PERCENTAGE) {
+ /* Attempt to squeeze it into the middle of the tables. */
+ baseaddr = firstfree;
+
+ while (baseaddr < minec) {
+ /* Using baseaddr would result in a negative base
+ * address below; find the next free slot.
+ */
+ for (++baseaddr; chk[baseaddr] != 0; ++baseaddr) ;
+ }
+
+ while (baseaddr + maxec - minec + 1 >= current_max_xpairs)
+ expand_nxt_chk ();
+
+ for (i = minec; i <= maxec; ++i)
+ if (state[i] != SAME_TRANS &&
+ (state[i] != 0 || deflink != JAMSTATE) &&
+ chk[baseaddr + i - minec] != 0) { /* baseaddr unsuitable - find another */
+ for (++baseaddr;
+ baseaddr < current_max_xpairs &&
+ chk[baseaddr] != 0; ++baseaddr) ;
+
+ while (baseaddr + maxec - minec + 1 >=
+ current_max_xpairs)
+ expand_nxt_chk ();
+
+ /* Reset the loop counter so we'll start all
+ * over again next time it's incremented.
+ */
+
+ i = minec - 1;
+ }
+ }
+
+ else {
+ /* Ensure that the base address we eventually generate is
+ * non-negative.
+ */
+ baseaddr = MAX (tblend + 1, minec);
+ }
+
+ tblbase = baseaddr - minec;
+ tbllast = tblbase + maxec;
+
+ while (tbllast + 1 >= current_max_xpairs)
+ expand_nxt_chk ();
+
+ base[statenum] = tblbase;
+ def[statenum] = deflink;
+
+ for (i = minec; i <= maxec; ++i)
+ if (state[i] != SAME_TRANS)
+ if (state[i] != 0 || deflink != JAMSTATE) {
+ nxt[tblbase + i] = state[i];
+ chk[tblbase + i] = statenum;
+ }
+
+ if (baseaddr == firstfree)
+ /* Find next free slot in tables. */
+ for (++firstfree; chk[firstfree] != 0; ++firstfree) ;
+
+ tblend = MAX (tblend, tbllast);
+}
+
+
+/* mk1tbl - create table entries for a state (or state fragment) which
+ * has only one out-transition
+ */
+
+void mk1tbl (state, sym, onenxt, onedef)
+ int state, sym, onenxt, onedef;
+{
+ if (firstfree < sym)
+ firstfree = sym;
+
+ while (chk[firstfree] != 0)
+ if (++firstfree >= current_max_xpairs)
+ expand_nxt_chk ();
+
+ base[state] = firstfree - sym;
+ def[state] = onedef;
+ chk[firstfree] = state;
+ nxt[firstfree] = onenxt;
+
+ if (firstfree > tblend) {
+ tblend = firstfree++;
+
+ if (firstfree >= current_max_xpairs)
+ expand_nxt_chk ();
+ }
+}
+
+
+/* mkprot - create new proto entry */
+
+void mkprot (state, statenum, comstate)
+ int state[], statenum, comstate;
+{
+ int i, slot, tblbase;
+
+ if (++numprots >= MSP || numecs * numprots >= PROT_SAVE_SIZE) {
+ /* Gotta make room for the new proto by dropping last entry in
+ * the queue.
+ */
+ slot = lastprot;
+ lastprot = protprev[lastprot];
+ protnext[lastprot] = NIL;
+ }
+
+ else
+ slot = numprots;
+
+ protnext[slot] = firstprot;
+
+ if (firstprot != NIL)
+ protprev[firstprot] = slot;
+
+ firstprot = slot;
+ prottbl[slot] = statenum;
+ protcomst[slot] = comstate;
+
+ /* Copy state into save area so it can be compared with rapidly. */
+ tblbase = numecs * (slot - 1);
+
+ for (i = 1; i <= numecs; ++i)
+ protsave[tblbase + i] = state[i];
+}
+
+
+/* mktemplate - create a template entry based on a state, and connect the state
+ * to it
+ */
+
+void mktemplate (state, statenum, comstate)
+ int state[], statenum, comstate;
+{
+ int i, numdiff, tmpbase, tmp[CSIZE + 1];
+ Char transset[CSIZE + 1];
+ int tsptr;
+
+ ++numtemps;
+
+ tsptr = 0;
+
+ /* Calculate where we will temporarily store the transition table
+ * of the template in the tnxt[] array. The final transition table
+ * gets created by cmptmps().
+ */
+
+ tmpbase = numtemps * numecs;
+
+ if (tmpbase + numecs >= current_max_template_xpairs) {
+ current_max_template_xpairs +=
+ MAX_TEMPLATE_XPAIRS_INCREMENT;
+
+ ++num_reallocs;
+
+ tnxt = reallocate_integer_array (tnxt,
+ current_max_template_xpairs);
+ }
+
+ for (i = 1; i <= numecs; ++i)
+ if (state[i] == 0)
+ tnxt[tmpbase + i] = 0;
+ else {
+ transset[tsptr++] = i;
+ tnxt[tmpbase + i] = comstate;
+ }
+
+ if (usemecs)
+ mkeccl (transset, tsptr, tecfwd, tecbck, numecs, 0);
+
+ mkprot (tnxt + tmpbase, -numtemps, comstate);
+
+ /* We rely on the fact that mkprot adds things to the beginning
+ * of the proto queue.
+ */
+
+ numdiff = tbldiff (state, firstprot, tmp);
+ mkentry (tmp, numecs, statenum, -numtemps, numdiff);
+}
+
+
+/* mv2front - move proto queue element to front of queue */
+
+void mv2front (qelm)
+ int qelm;
+{
+ if (firstprot != qelm) {
+ if (qelm == lastprot)
+ lastprot = protprev[lastprot];
+
+ protnext[protprev[qelm]] = protnext[qelm];
+
+ if (protnext[qelm] != NIL)
+ protprev[protnext[qelm]] = protprev[qelm];
+
+ protprev[qelm] = NIL;
+ protnext[qelm] = firstprot;
+ protprev[firstprot] = qelm;
+ firstprot = qelm;
+ }
+}
+
+
+/* place_state - place a state into full speed transition table
+ *
+ * State is the statenum'th state. It is indexed by equivalence class and
+ * gives the number of the state to enter for a given equivalence class.
+ * Transnum is the number of out-transitions for the state.
+ */
+
+void place_state (state, statenum, transnum)
+ int *state, statenum, transnum;
+{
+ int i;
+ int *state_ptr;
+ int position = find_table_space (state, transnum);
+
+ /* "base" is the table of start positions. */
+ base[statenum] = position;
+
+ /* Put in action number marker; this non-zero number makes sure that
+ * find_table_space() knows that this position in chk/nxt is taken
+ * and should not be used for another accepting number in another
+ * state.
+ */
+ chk[position - 1] = 1;
+
+ /* Put in end-of-buffer marker; this is for the same purposes as
+ * above.
+ */
+ chk[position] = 1;
+
+ /* Place the state into chk and nxt. */
+ state_ptr = &state[1];
+
+ for (i = 1; i <= numecs; ++i, ++state_ptr)
+ if (*state_ptr != 0) {
+ chk[position + i] = i;
+ nxt[position + i] = *state_ptr;
+ }
+
+ if (position + numecs > tblend)
+ tblend = position + numecs;
+}
+
+
+/* stack1 - save states with only one out-transition to be processed later
+ *
+ * If there's room for another state on the "one-transition" stack, the
+ * state is pushed onto it, to be processed later by mk1tbl. If there's
+ * no room, we process the sucker right now.
+ */
+
+void stack1 (statenum, sym, nextstate, deflink)
+ int statenum, sym, nextstate, deflink;
+{
+ if (onesp >= ONE_STACK_SIZE - 1)
+ mk1tbl (statenum, sym, nextstate, deflink);
+
+ else {
+ ++onesp;
+ onestate[onesp] = statenum;
+ onesym[onesp] = sym;
+ onenext[onesp] = nextstate;
+ onedef[onesp] = deflink;
+ }
+}
+
+
+/* tbldiff - compute differences between two state tables
+ *
+ * "state" is the state array which is to be extracted from the pr'th
+ * proto. "pr" is both the number of the proto we are extracting from
+ * and an index into the save area where we can find the proto's complete
+ * state table. Each entry in "state" which differs from the corresponding
+ * entry of "pr" will appear in "ext".
+ *
+ * Entries which are the same in both "state" and "pr" will be marked
+ * as transitions to "SAME_TRANS" in "ext". The total number of differences
+ * between "state" and "pr" is returned as function value. Note that this
+ * number is "numecs" minus the number of "SAME_TRANS" entries in "ext".
+ */
+
+int tbldiff (state, pr, ext)
+ int state[], pr, ext[];
+{
+ int i, *sp = state, *ep = ext, *protp;
+ int numdiff = 0;
+
+ protp = &protsave[numecs * (pr - 1)];
+
+ for (i = numecs; i > 0; --i) {
+ if (*++protp == *++sp)
+ *++ep = SAME_TRANS;
+ else {
+ *++ep = *sp;
+ ++numdiff;
+ }
+ }
+
+ return numdiff;
+}
diff --git a/src/version.h b/src/version.h
new file mode 100644
index 0000000..b9e5d6c
--- /dev/null
+++ b/src/version.h
@@ -0,0 +1 @@
+#define FLEX_VERSION VERSION
diff --git a/src/yylex.c b/src/yylex.c
new file mode 100644
index 0000000..17b3e61
--- /dev/null
+++ b/src/yylex.c
@@ -0,0 +1,212 @@
+/* yylex - scanner front-end for flex */
+
+/* Copyright (c) 1990 The Regents of the University of California. */
+/* All rights reserved. */
+
+/* This code is derived from software contributed to Berkeley by */
+/* Vern Paxson. */
+
+/* The United States Government has rights in this work pursuant */
+/* to contract no. DE-AC03-76SF00098 between the United States */
+/* Department of Energy and the University of California. */
+
+/* This file is part of flex. */
+
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+
+/* Neither the name of the University nor the names of its contributors */
+/* may be used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+
+/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE. */
+
+#include <ctype.h>
+#include "flexdef.h"
+#include "parse.h"
+
+
+/* yylex - scan for a regular expression token */
+
+extern char *yytext;
+int yylex (void)
+{
+ int toktype;
+ static int beglin = false;
+
+ if (eofseen)
+ toktype = EOF;
+ else
+ toktype = flexscan ();
+
+ if (toktype == EOF || toktype == 0) {
+ eofseen = 1;
+
+ if (sectnum == 1) {
+ synerr (_("premature EOF"));
+ sectnum = 2;
+ toktype = SECTEND;
+ }
+
+ else
+ toktype = 0;
+ }
+
+ if (trace) {
+ if (beglin) {
+ fprintf (stderr, "%d\t", num_rules + 1);
+ beglin = 0;
+ }
+
+ switch (toktype) {
+ case '<':
+ case '>':
+ case '^':
+ case '$':
+ case '"':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ case '|':
+ case '(':
+ case ')':
+ case '-':
+ case '/':
+ case '\\':
+ case '?':
+ case '.':
+ case '*':
+ case '+':
+ case ',':
+ (void) putc (toktype, stderr);
+ break;
+
+ case '\n':
+ (void) putc ('\n', stderr);
+
+ if (sectnum == 2)
+ beglin = 1;
+
+ break;
+
+ case SCDECL:
+ fputs ("%s", stderr);
+ break;
+
+ case XSCDECL:
+ fputs ("%x", stderr);
+ break;
+
+ case SECTEND:
+ fputs ("%%\n", stderr);
+
+ /* We set beglin to be true so we'll start
+ * writing out numbers as we echo rules.
+ * flexscan() has already assigned sectnum.
+ */
+ if (sectnum == 2)
+ beglin = 1;
+
+ break;
+
+ case NAME:
+ fprintf (stderr, "'%s'", nmstr);
+ break;
+
+ case CHAR:
+ switch (yylval) {
+ case '<':
+ case '>':
+ case '^':
+ case '$':
+ case '"':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ case '|':
+ case '(':
+ case ')':
+ case '-':
+ case '/':
+ case '\\':
+ case '?':
+ case '.':
+ case '*':
+ case '+':
+ case ',':
+ fprintf (stderr, "\\%c", yylval);
+ break;
+
+ default:
+ if (!isascii (yylval) || !isprint (yylval)) {
+ if(trace_hex)
+ fprintf (stderr, "\\x%02x", (unsigned int) yylval);
+ else
+ fprintf (stderr, "\\%.3o", (unsigned int) yylval);
+ } else
+ (void) putc (yylval, stderr);
+ break;
+ }
+
+ break;
+
+ case NUMBER:
+ fprintf (stderr, "%d", yylval);
+ break;
+
+ case PREVCCL:
+ fprintf (stderr, "[%d]", yylval);
+ break;
+
+ case EOF_OP:
+ fprintf (stderr, "<<EOF>>");
+ break;
+
+ case OPTION_OP:
+ fprintf (stderr, "%s ", yytext);
+ break;
+
+ case OPT_OUTFILE:
+ case OPT_PREFIX:
+ case CCE_ALNUM:
+ case CCE_ALPHA:
+ case CCE_BLANK:
+ case CCE_CNTRL:
+ case CCE_DIGIT:
+ case CCE_GRAPH:
+ case CCE_LOWER:
+ case CCE_PRINT:
+ case CCE_PUNCT:
+ case CCE_SPACE:
+ case CCE_UPPER:
+ case CCE_XDIGIT:
+ fprintf (stderr, "%s", yytext);
+ break;
+
+ case 0:
+ fprintf (stderr, _("End Marker\n"));
+ break;
+
+ default:
+ fprintf (stderr,
+ _
+ ("*Something Weird* - tok: %d val: %d\n"),
+ toktype, yylval);
+ break;
+ }
+ }
+
+ return toktype;
+}