21 Commits
Author SHA1 Message Date
Will Estes 83d5d1695a Declared version 2.6.0 2015-11-17 11:16:43 -05:00
Will Estes d34b6160af Dated, described flex release 2.6.0 2015-11-17 11:14:05 -05:00
Will Estes 5263986825 Declared version 2.6.0rc1 2015-11-13 14:56:25 -05:00
lukeallardyce 54201ab377 Supplied versioning information in flex libraries.
Resolves sourceforge bug #182. On OSX, and possibly other platforms, building the libfl libraries without versioning information caused a build failures.
2015-11-13 14:48:19 -05:00
Will Estes 0be145eea8 Cleaned up more precisely after make check.
BUILT_SOURCES is now just the list of headers built as per the
automake manual. We provide the list of files to clean to make
rebuilding the test suite programs easier. We then use the CLEANFILES
list in a dist-hook to clean up the distribution that automake gathers
since not distributing flex generated files is foreign to automake's
mindset, but we need exactly that.

Additionally, we locate inputs to the tables-related tests more
precisely. Some files are in srcdir and some are in builddir, which
the arguments to the log compiler are now made aware of.
2015-11-12 21:44:07 -05:00
Will Estes 4864c4f23a Pulled out scripts in tests/Makefile.am 2015-11-11 19:08:26 -05:00
Will Estes 83006c65f8 Added srcdir to tableopts.am include 2015-11-11 18:22:17 -05:00
Will Estes b54685ff22 Changed man page dependencies.
The man page is just the --help output as reformatted by help2man. The
--help option is most likely to change when the flex skeleton changes
or one of the option parsing files changes or the configure.ac script
itself changes. The dependencies reflect this now.

It is still necessary, under some circumstances, to rebuild flex
explicitly before building the man page. In theory, it's possible to
have automake arrange to do this all the time, but doing so works out
to be fragile, given the rest of the build system.
2015-11-11 15:20:56 -05:00
Will Estes 589bb43094 Called libtoolize directly because autoreconf fails to pick up LT_INIT properly 2015-11-10 17:26:39 -05:00
Will Estes b382a56bf3 Added tableopts.sh to EXTRA_DIST 2015-11-10 17:24:28 -05:00
Mightyjo 461f987f09 Made tests depend on the built flex binary. 2015-11-10 14:28:17 -05:00
Mightyjo a6ceb756d9 Merge branch 'master' into streamrefs 2015-11-08 15:43:09 -08:00
Mightyjo cf6cb4dce7 Cleaned more generated sources.
Added skel.c explicitly to MAINTAINERCLEANFILES in src/Makefile.am.

Added a bunch of files to built_SOURCES in tests/Makefile.am so that the
suite is easier to clean up.
2015-11-08 14:59:29 -05:00
Mightyjo 1f4c0e67fe Updated documentation to reflect the revisions to FlexLexer.h 2015-11-07 23:28:09 -08:00
Mightyjo 336a1deaa5 Changed several pointers to istream (and ostream) to references in c++-only sections of the skeleton.
Patched up a variety of expected errors caused by changing istream* to istream&.

Added a stray 'make' at line 545.  Oops.

Changed the buffer_state struct to store std::streambuf* instead of std::istream* for C++ mode.  Changed interfaces in FlexLexer.h to take std::istream& instead of *.  Backward compatibility temporarily broken.

Patched up backward compatibility with reasonable behavior in the presence of null pointers.

Re-added backward-compatible versions of the yyFlexLexer methods that take iostream pointers.  All tests passing.
2015-11-07 23:25:24 -08:00
Translation Project 5acd407ed4 new zh_CN translation from the translation project 2015-09-29 15:53:33 -04:00
Jaska Uimonen b4b8b7ed81 fix possible resource leak with yynultrans_tbl 2015-08-06 09:28:21 -04:00
Jaska Uimonen 5f23fc0033 fix possible uninitialized array values 2015-08-06 09:27:30 -04:00
Will Estes 4f2ae90b28 add %{...%} block to example in manual 2015-08-05 15:27:37 -04:00
Will Estes b6fa146a0f initialize libtool earlier in build system generation 2015-07-15 15:20:11 -04:00
Translation Project 341bfbd389 new da translation from the Translation Project 2015-05-08 15:15:56 -04:00
47 changed files with 1106 additions and 1568 deletions
+35 -1
View File
@@ -3,7 +3,41 @@ changes between releases of flex.
See the file COPYING for copying conditions.
* version 2.6.0-pre
* version 2.6.0 released 2015-11-17
** User Visible Changes
*** C++ scanners now use references instead of pointers. See the manual for details.
*** A number of compiler warnings were addressed, so flex generated scanners should be quieter under compiler warning scenarios.
*** Allow error reporting routines to accept varying number of arguments
*** Removed deprecated 'register' storage class specifier
*** Changeed output formats from octal to hexadecimal
*** check limits before using array index cclp; resolves sf-166
*** Suppress clang warning about empty @param paragraph; resolves sf#158
*** Fixed malloc/realloc replacement, resolves sf bug#151.
*** Adjusted buffer sizes on ia64.
*** various documentation and code clean up fixes: resolves sf bugs #167, #168, among other patches.
** Flex Internals
*** flex is now organized into subdirectories. This keeps the tree neater at the top level and puts like things near each other and unlike things away from each other.
*** The test suite has been reorganized and is now run with the parallel test suite harness from automake.
*** Cleaned up the automake parts of the build system to better reflect what automake does on its own. Also added a call to libtoolize in autogen.sh because autoreconf gets confused without a prior run of libtoolize.
*** po/Makefile now includes a rule to fetch the latest translations from the translation project. "make -f po/Makefile getpo" from the top level of the flex tree will fetch the files.
*** New da translation from the translation project
* flex version 2.5.39 released 2014-03-26
+2 -1
View File
@@ -29,4 +29,5 @@
#Makefile first.)
touch ChangeLog
autoreconf --install --verbose --force
libtoolize --install --force
autoreconf --install --force
+2 -2
View File
@@ -24,15 +24,15 @@
# autoconf requirements and initialization
AC_INIT([the fast lexical analyser generator], [2.6.0-pre],
AC_INIT([the fast lexical analyser generator], [2.6.0],
[flex-help@lists.sourceforge.net], [flex])
AC_CONFIG_SRCDIR([src/scan.l])
AC_CONFIG_AUX_DIR([build-aux])
LT_INIT
AM_INIT_AUTOMAKE([gnu check-news std-options dist-bzip2 dist-xz parallel-tests 1.14.1])
AC_CONFIG_HEADER([src/config.h])
AC_CONFIG_LIBOBJ_DIR([lib])
AC_CONFIG_MACRO_DIR([m4])
LT_INIT
SHARED_VERSION_INFO="2:0:0"
AC_SUBST(SHARED_VERSION_INFO)
+1 -1
View File
@@ -23,7 +23,7 @@ CLEANFILES = \
flex.vr \
flex.vrs
$(dist_man_MANS): $(top_srcdir)/src/main.c
$(dist_man_MANS): $(top_srcdir)/configure.ac $(top_srcdir)/src/flex.skl $(top_srcdir)/src/options.c $(top_srcdir)/src/options.h
for i in $(dist_man_MANS) ; do \
$(help2man) --name='$(PACKAGE_NAME)' \
--section=`echo $$i | sed -e 's/.*\.\([^.]*\)$$/\1/'` \
+16 -7
View File
@@ -3764,8 +3764,7 @@ defaults to generating the scanner to the file @file{lex.yy.cc} instead
of @file{lex.yy.c}. The generated scanner includes the header file
@file{FlexLexer.h}, which defines the interface to two C++ classes.
The first class,
@code{FlexLexer},
The first class in @file{FlexLexer.h}, @code{FlexLexer},
provides an abstract base class defining the general scanner class
interface. It provides the following member functions:
@@ -3799,10 +3798,10 @@ returns the current setting of the debugging flag.
Also provided are member functions equivalent to
@code{yy_switch_to_buffer()}, @code{yy_create_buffer()} (though the
first argument is an @code{istream*} object pointer and not a
first argument is an @code{istream&} object reference and not a
@code{FILE*)}, @code{yy_flush_buffer()}, @code{yy_delete_buffer()}, and
@code{yyrestart()} (again, the first argument is a @code{istream*}
object pointer).
@code{yyrestart()} (again, the first argument is a @code{istream&}
object reference).
@tindex yyFlexLexer (C++ only)
@tindex FlexLexer (C++ only)
@@ -3813,9 +3812,12 @@ additional member functions:
@table @code
@findex yyFlexLexer constructor (C++ only)
@item yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 )
@item yyFlexLexer( istream& arg_yyin, ostream& arg_yyout )
constructs a @code{yyFlexLexer} object using the given streams for input
and output. If not specified, the streams default to @code{cin} and
@code{cout}, respectively.
@code{cout}, respectively. @code{yyFlexLexer} does not take ownership of
its stream arguments. It's up to the user to ensure the streams pointed
to remain alive at least as long as the @code{yyFlexLexer} instance.
@findex yylex (C++ version)
@item virtual int yylex()
@@ -3832,11 +3834,13 @@ instead of @code{yyFlexLexer}. In this case, rather than generating
@findex switch_streams (C++ only)
@item virtual void switch_streams(istream* new_in = 0, ostream* new_out = 0)
@item virtual void switch_streams(istream& new_in, ostream& new_out)
reassigns @code{yyin} to @code{new_in} (if non-null) and @code{yyout} to
@code{new_out} (if non-null), deleting the previous input buffer if
@code{yyin} is reassigned.
@item int yylex( istream* new_in, ostream* new_out = 0 )
@item int yylex( istream& new_in, ostream& new_out )
first switches the input streams via @code{switch_streams( new_in,
new_out )} and then returns the value of @code{yylex()}.
@end table
@@ -3893,7 +3897,7 @@ Here is an example of a simple C++ scanner:
int mylineno = 0;
%}
%option noyywrap
%option noyywrap c++
string \"[^\n"]+\"
@@ -3938,6 +3942,9 @@ Here is an example of a simple C++ scanner:
%%
// This include is required if main() is an another source file.
//#include <FlexLexer.h>
int main( int /* argc */, char** /* argv */ )
{
FlexLexer* lexer = new yyFlexLexer;
@@ -4910,8 +4917,10 @@ custom allocator through @code{yyextra}.
%option reentrant
/* Initialize the allocator. */
%{
#define YY_EXTRA_TYPE struct allocator*
#define YY_USER_INIT yyextra = allocator_create();
%}
%%
.|\n ;
+139 -101
View File
@@ -2,20 +2,37 @@
# Copyright (C) 2007 The Flex Project (msgids)
# This file is distributed under the same license as the flex package.
# Johan Linde <jl@theophys.kth.se>, 1996.
# Keld Simonsen <keld@keldix.com>, 2000-2011.
# Keld Simonsen <keld@keldix.com>, 2000-2011, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: flex-2.5.35\n"
"Project-Id-Version: flex-2.5.38\n"
"Report-Msgid-Bugs-To: flex-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2008-02-26 16:34-0500\n"
"PO-Revision-Date: 2011-01-11 09:12+0100\n"
"POT-Creation-Date: 2014-02-11 16:15-0500\n"
"PO-Revision-Date: 2015-04-26 09:12+0200\n"
"Last-Translator: Keld Simonsen <keld@keldix.com>\n"
"Language-Team: Danish <dansk@dansk-gruppen.dk>\n"
"Language: da\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8-bit\n"
#: buf.c:78
msgid "Allocation of buffer to print string failed"
msgstr "Tildeling af buffer til udskrivningsstreng mislykkedes"
#: buf.c:100
msgid "Allocation of buffer for line directive failed"
msgstr "Tildeling af buffer til linjedirektiv mislykkedes"
#: buf.c:177
msgid "Allocation of buffer for m4 def failed"
msgstr "Tildeling af buffer til m4 def mislykkedes"
#: buf.c:197
msgid "Allocation of buffer for m4 undef failed"
msgstr "Tildeling af buffer til m4 undef mislykkedes"
#: dfa.c:61
#, c-format
msgid "State #%d is non-accepting -\n"
@@ -75,7 +92,7 @@ msgstr "tilstand %d:\n"
msgid "Could not write yynxt_tbl[][]"
msgstr "Kunne ikke skrive yynxt_tbl[][]"
#: dfa.c:1052
#: dfa.c:1049
msgid "bad transition character detected in sympartition()"
msgstr "forkert overgangstegn fundet i sympartition()"
@@ -159,353 +176,357 @@ msgstr "Kunne ikke skrive eoltbl"
msgid "Could not write yynultrans_tbl"
msgstr "Kunne ikke skrive yynultrans_tbl"
#: main.c:189
#: main.c:191
msgid "rule cannot be matched"
msgstr "reglen kan ikke matches"
#: main.c:194
#: main.c:196
msgid "-s option given but default rule can be matched"
msgstr "flaget -s angivet, men standardreglen kan følges"
#: main.c:234
#: main.c:236
msgid "Can't use -+ with -l option"
msgstr "-+ kan ikke bruges sammen med flaget -l"
#: main.c:237
#: main.c:239
msgid "Can't use -f or -F with -l option"
msgstr "-f eller -F kan ikke bruges sammen med -l"
#: main.c:241
#: main.c:243
msgid "Can't use --reentrant or --bison-bridge with -l option"
msgstr "Kan ikke bruge --reentrant eller --bison-bridge sammen med flaget -l"
#: main.c:278
#: main.c:275
msgid "-Cf/-CF and -Cm don't make sense together"
msgstr "-Cf/-CF og -Cm kan ikke bruges sammen"
#: main.c:281
#: main.c:278
msgid "-Cf/-CF and -I are incompatible"
msgstr "-Cf/-CF og -I kan ikke bruges sammen"
#: main.c:285
#: main.c:282
msgid "-Cf/-CF are incompatible with lex-compatibility mode"
msgstr "-Cf/-CF kan ikke bruges i lex-kompatibilitetstilstand"
#: main.c:290
#: main.c:287
msgid "-Cf and -CF are mutually exclusive"
msgstr "-Cf og -CF er gensidigt udelukkende"
#: main.c:294
#: main.c:291
msgid "Can't use -+ with -CF option"
msgstr "-+ kan ikke bruges sammen med flaget -CF"
#: main.c:297
#: main.c:294
#, c-format
msgid "%array incompatible with -+ option"
msgstr "-+ kan ikke bruges sammen med %array"
#: main.c:302
#: main.c:299
msgid "Options -+ and --reentrant are mutually exclusive."
msgstr "Flagene -+ og --reentrant er gensidigt udelukkende."
#: main.c:305
#: main.c:302
msgid "bison bridge not supported for the C++ scanner."
msgstr "bisonbro understøttes ikke for C++-skanneren."
#: main.c:360 main.c:406
#: main.c:357 main.c:403
#, c-format
msgid "could not create %s"
msgstr "kunne ikke oprette %s"
#: main.c:419
#: main.c:416
msgid "could not write tables header"
msgstr "kunne ikke skrive tabellhoved"
#: main.c:423
#: main.c:420
#, c-format
msgid "can't open skeleton file %s"
msgstr "kan ikke åbne skabelonfilen %s"
#: main.c:505
#: main.c:456
msgid "allocation of macro definition failed"
msgstr "tildeling af makro-definition mislykkedes"
#: main.c:504
#, c-format
msgid "input error reading skeleton file %s"
msgstr "fejl ved læsning af skabelonsfilen %s"
#: main.c:509
#: main.c:508
#, c-format
msgid "error closing skeleton file %s"
msgstr "fejl ved lukning af skabelonfilen %s"
#: main.c:694
#: main.c:693
#, c-format
msgid "error creating header file %s"
msgstr "fejl ved oprettelsen af headerfilen %s"
#: main.c:702
#: main.c:701
#, c-format
msgid "error writing output file %s"
msgstr "fejl ved skrivning af udfilen %s"
#: main.c:706
#: main.c:705
#, c-format
msgid "error closing output file %s"
msgstr "fejl ved lukning af udfilen %s"
#: main.c:710
#: main.c:709
#, c-format
msgid "error deleting output file %s"
msgstr "fejl ved sletning af udfilen %s"
#: main.c:717
#: main.c:716
#, c-format
msgid "No backing up.\n"
msgstr "Ingen sikkerhedskopiering.\n"
#: main.c:721
#: main.c:720
#, c-format
msgid "%d backing up (non-accepting) states.\n"
msgstr "%d sikkerhedskopierer (ikke-accepterende) tilstande.\n"
#: main.c:725
#: main.c:724
#, c-format
msgid "Compressed tables always back up.\n"
msgstr "Komprimerete tabeller backer alltid tillbaka.\n"
#: main.c:728
#: main.c:727
#, c-format
msgid "error writing backup file %s"
msgstr "fejl ved skrivning af sikkerhedskopifilen %s"
#: main.c:732
#: main.c:731
#, c-format
msgid "error closing backup file %s"
msgstr "fejl ved lukning af sikerhedskopifilen %s"
#: main.c:737
#: main.c:736
#, c-format
msgid "%s version %s usage statistics:\n"
msgstr "Statistik over brugaf %s version %s:\n"
#: main.c:740
#: main.c:739
#, c-format
msgid " scanner options: -"
msgstr " fortolkningsflag: -"
#: main.c:819
#: main.c:818
#, c-format
msgid " %d/%d NFA states\n"
msgstr " %d/%d NFA-tilstand\n"
#: main.c:821
#: main.c:820
#, c-format
msgid " %d/%d DFA states (%d words)\n"
msgstr " %d/%d DFA-tilstand (%d ord)\n"
#: main.c:823
#: main.c:822
#, c-format
msgid " %d rules\n"
msgstr " %d regler\n"
#: main.c:828
#: main.c:827
#, c-format
msgid " No backing up\n"
msgstr " Ingen sikkerhedskopiering\n"
#: main.c:832
#: main.c:831
#, c-format
msgid " %d backing-up (non-accepting) states\n"
msgstr " %d sikkerhedskopierer (ikke-accepterende) tilstande.\n"
#: main.c:837
#: main.c:836
#, c-format
msgid " Compressed tables always back-up\n"
msgstr " Komprimerede tabeller bakker altid tilbake\n"
#: main.c:841
#: main.c:840
#, c-format
msgid " Beginning-of-line patterns used\n"
msgstr " Begyndelse-af-linje-mønster brugt\n"
#: main.c:843
#: main.c:842
#, c-format
msgid " %d/%d start conditions\n"
msgstr " %d/%d startbetingelse\n"
#: main.c:847
#: main.c:846
#, c-format
msgid " %d epsilon states, %d double epsilon states\n"
msgstr " %d epsilontilstande, %d dobbelte epsilontilstande\n"
#: main.c:851
#: main.c:850
#, c-format
msgid " no character classes\n"
msgstr " ingen tegnklasser\n"
#: main.c:855
#: main.c:854
#, c-format
msgid " %d/%d character classes needed %d/%d words of storage, %d reused\n"
msgstr " %d/%d tegnklasser behøvede %d/%d ord for gemning, %d genbrugte\n"
#: main.c:860
#: main.c:859
#, c-format
msgid " %d state/nextstate pairs created\n"
msgstr " %d par med tilstand/næste-tilstand oprettede\n"
#: main.c:863
#: main.c:862
#, c-format
msgid " %d/%d unique/duplicate transitions\n"
msgstr " %d/%d unikke/duplikerede overgange\n"
#: main.c:868
#: main.c:867
#, c-format
msgid " %d table entries\n"
msgstr " %d tabelposter\n"
#: main.c:876
#: main.c:875
#, c-format
msgid " %d/%d base-def entries created\n"
msgstr " %d/%d base/standard-poster oprettede\n"
#: main.c:880
#: main.c:879
#, c-format
msgid " %d/%d (peak %d) nxt-chk entries created\n"
msgstr " %d/%d (max %d) næste/test-poster oprettede\n"
#: main.c:884
#: main.c:883
#, c-format
msgid " %d/%d (peak %d) template nxt-chk entries created\n"
msgstr " %d/%d (max %d) skablon-næste/test-poster oprettede\n"
#: main.c:888
#: main.c:887
#, c-format
msgid " %d empty table entries\n"
msgstr " %d tomme tabelposter\n"
#: main.c:890
#: main.c:889
#, c-format
msgid " %d protos created\n"
msgstr " %d prototyper oprettede\n"
#: main.c:893
#: main.c:892
#, c-format
msgid " %d templates created, %d uses\n"
msgstr " %d skabloner oprettede, %d formål\n"
#: main.c:901
#: main.c:900
#, c-format
msgid " %d/%d equivalence classes created\n"
msgstr " %d/%d ækvivalensklasser oprettet\n"
#: main.c:909
#: main.c:908
#, c-format
msgid " %d/%d meta-equivalence classes created\n"
msgstr " %d/%d meta-ækvivalensklasser oprettede\n"
#: main.c:915
#: main.c:914
#, c-format
msgid " %d (%d saved) hash collisions, %d DFAs equal\n"
msgstr " %d (%d gemte) hash-kollisioner, %d DFA'er er ens\n"
#: main.c:917
#: main.c:916
#, c-format
msgid " %d sets of reallocations needed\n"
msgstr " %d opsætninger med omallokeringer krævedes\n"
#: main.c:919
#: main.c:918
#, c-format
msgid " %d total table entries needed\n"
msgstr " %d totale tabelposter kræves\n"
#: main.c:996
#: main.c:995
#, c-format
msgid "Internal error. flexopts are malformed.\n"
msgstr "Intern fejl. flexopts er fejlbehæftede.\n"
#: main.c:1006
#: main.c:1005
#, c-format
msgid "Try `%s --help' for more information.\n"
msgstr "Prøv '%s --help' for mere information.\n"
#: main.c:1063
#: main.c:1062
#, c-format
msgid "unknown -C option '%c'"
msgstr "ukendt flag til -C '%c'"
#: main.c:1192
#: main.c:1191
#, c-format
msgid "%s %s\n"
msgstr "%s %s\n"
#: main.c:1467
#: main.c:1466
msgid "fatal parse error"
msgstr "uoprettelig fejl ved analysen"
#: main.c:1499
#: main.c:1498
#, c-format
msgid "could not create backing-up info file %s"
msgstr "kunne ikke oprette sikkerhedskopi af info-fil %s"
#: main.c:1520
#: main.c:1519
#, c-format
msgid "-l AT&T lex compatibility option entails a large performance penalty\n"
msgstr "flaget -l for opførsel som AT&T's lex medfører et væsentligt præstationstab\n"
#: main.c:1523
#: main.c:1522
#, c-format
msgid " and may be the actual source of other reported performance penalties\n"
msgstr " og kan være den egentlige årsag til andre rapporter om dette\n"
#: main.c:1529
#: main.c:1528
#, c-format
msgid "%%option yylineno entails a performance penalty ONLY on rules that can match newline characters\n"
msgstr "%%option yylineno medfører et præstationstab KUN på regler der kan matche nylinje-tegn\n"
#: main.c:1536
#: main.c:1535
#, c-format
msgid "-I (interactive) entails a minor performance penalty\n"
msgstr "-I (interaktiv) medfører et mindre præstationstab\n"
#: main.c:1541
#: main.c:1540
#, c-format
msgid "yymore() entails a minor performance penalty\n"
msgstr "yymore() medfører et mindre præstationstab\n"
#: main.c:1547
#: main.c:1546
#, c-format
msgid "REJECT entails a large performance penalty\n"
msgstr "REJECT medfører et væsentligt præstationstab\n"
#: main.c:1552
#: main.c:1551
#, c-format
msgid "Variable trailing context rules entail a large performance penalty\n"
msgstr "Regler for variabel efterfølgende kontekst medfører et væsentlig præstationstab\n"
#: main.c:1564
#: main.c:1563
msgid "REJECT cannot be used with -f or -F"
msgstr "REJECT kan ikke bruges sammen med -f eller -F"
#: main.c:1567
#: main.c:1566
#, c-format
msgid "%option yylineno cannot be used with REJECT"
msgstr "%option yylineno kan ikke bruges sammen med REJECT"
#: main.c:1570
#: main.c:1569
msgid "variable trailing context rules cannot be used with -f or -F"
msgstr ""
"regler for variabel efterfølgende kontekst kan ikke bruges\n"
"sammen med -f eller -F"
#: main.c:1691
#: main.c:1692
#, c-format
msgid "%option yyclass only meaningful for C++ scanners"
msgstr "%option yyclass er kun meningsfyldt for C++-fortolkere"
#: main.c:1798
#: main.c:1799
#, c-format
msgid "Usage: %s [OPTIONS] [FILE]...\n"
msgstr "Brug: %s [FLAG] [FIL]...\n"
#: main.c:1801
#: main.c:1802
#, c-format
msgid ""
"Generates programs that perform pattern-matching on text.\n"
@@ -630,43 +651,47 @@ msgstr ""
" -h, --help udskriv denne hjælpebesked\n"
" -V, --version udskriv %s version\n"
#: misc.c:100 misc.c:126
#: misc.c:65
msgid "allocation of sko_stack failed"
msgstr "tildeling af sko_stack mislykkedes"
#: misc.c:102 misc.c:128
#, c-format
msgid "name \"%s\" ridiculously long"
msgstr "navnet '%s' er latterligt langt"
#: misc.c:175
#: misc.c:177
msgid "memory allocation failed in allocate_array()"
msgstr "hukommelsestildelingen mislykkedes i allocate_array()"
#: misc.c:250
#: misc.c:230
#, c-format
msgid "bad character '%s' detected in check_char()"
msgstr "forkert tegn '%s' fundet i check_char()"
#: misc.c:255
#: misc.c:235
#, c-format
msgid "scanner requires -8 flag to use the character %s"
msgstr "skanneren kræver flaget -8 for at kunne bruge tegnet %s"
#: misc.c:288
#: misc.c:268
msgid "dynamic memory failure in copy_string()"
msgstr "dynamisk hukommelsesfejl i copy_string()"
#: misc.c:422
#: misc.c:367
#, c-format
msgid "%s: fatal internal error, %s\n"
msgstr "%s: uoprettelig intern fejl, %s\n"
#: misc.c:875
#: misc.c:803
msgid "attempt to increase array size failed"
msgstr "forsøg på at øge arraystørrelse mislykkedes"
#: misc.c:1002
#: misc.c:930
msgid "bad line in skeleton file"
msgstr "forkert linje i skeletfilen"
#: misc.c:1051
#: misc.c:979
msgid "memory allocation failed in yy_flex_xmalloc()"
msgstr "hukommelsestildelingen mislykkedes i yy_flex_xmalloc()"
@@ -700,20 +725,20 @@ msgstr "tom maskine i dupmachine()"
msgid "Variable trailing context rule at line %d\n"
msgstr "Regel for variabel efterfølgende kontekst på linje %d\n"
#: nfa.c:353
#: nfa.c:364
msgid "bad state type in mark_beginning_as_normal()"
msgstr "forkert tilstandstype i mark_beginning_as_normal()"
#: nfa.c:598
#: nfa.c:609
#, c-format
msgid "input rules are too complicated (>= %d NFA states)"
msgstr "inddatareglerne er for komplicerede (>= %d NFA-tilstand)"
#: nfa.c:677
#: nfa.c:688
msgid "found too many transitions in mkxtion()"
msgstr "fandt for mange overgange i mkxtion()"
#: nfa.c:703
#: nfa.c:714
#, c-format
msgid "too many rules (> %d)!"
msgstr "for mange regler (> %d)!"
@@ -742,24 +767,24 @@ msgstr "fejlagtige iterationsv
msgid "iteration value must be positive"
msgstr "iterationsværdi skal være positiv"
#: parse.y:806 parse.y:816
#: parse.y:804 parse.y:814
#, c-format
msgid "the character range [%c-%c] is ambiguous in a case-insensitive scanner"
msgstr "tegnintervallet [%c-%c] er flertydigt i en versalufølsom skanner"
#: parse.y:821
#: parse.y:819
msgid "negative range in character class"
msgstr "negativt interval i tegnklasse"
#: parse.y:918
#: parse.y:916
msgid "[:^lower:] is ambiguous in case insensitive scanner"
msgstr "[:^lower:] er flertydigt i en versalufølsom skanner"
#: parse.y:924
#: parse.y:922
msgid "[:^upper:] ambiguous in case insensitive scanner"
msgstr "[:^upper:] er flertydigt i en versalufølsom skanner"
#: scan.l:75 scan.l:192 scan.l:300 scan.l:443 scan.l:618 scan.l:676
#: scan.l:75 scan.l:618 scan.l:676
msgid "Input line too long\n"
msgstr "For lang inddatalinje\n"
@@ -773,14 +798,27 @@ msgstr "fejlagtigt '%top'-direktiv"
msgid "unrecognized '%' directive"
msgstr "ukendt '%'-direktiv"
#: scan.l:192
msgid "Definition name too long\n"
msgstr "For langt definitionsnavn\n"
#: scan.l:284
msgid "Unmatched '{'"
msgstr "Ensomt '{'"
#: scan.l:300
#, c-format
msgid "Definition value for {%s} too long\n"
msgstr "Definitionsværdi for (%s) for langt\n"
#: scan.l:317
msgid "incomplete name definition"
msgstr "ufuldstændig navnedefinition"
#: scan.l:443
msgid "Option line too long\n"
msgstr "For lang valgmulighedslinje\n"
#: scan.l:451
#, c-format
msgid "unrecognized %%option: %s"
@@ -840,27 +878,27 @@ msgstr "kan ikke
msgid "Usage: %s [OPTIONS]...\n"
msgstr "Brug: %s [FLAG]...\n"
#: scanopt.c:565
#: scanopt.c:564
#, c-format
msgid "option `%s' doesn't allow an argument\n"
msgstr "flaget '%s' tager ikke noget argument\n"
#: scanopt.c:570
#: scanopt.c:569
#, c-format
msgid "option `%s' requires an argument\n"
msgstr "flaget '%s' kræver et argument\n"
#: scanopt.c:574
#: scanopt.c:573
#, c-format
msgid "option `%s' is ambiguous\n"
msgstr "flaget '%s' er flertydig\n"
#: scanopt.c:578
#: scanopt.c:577
#, c-format
msgid "Unrecognized option `%s'\n"
msgstr "Ukendt flag: '%s'\n"
#: scanopt.c:582
#: scanopt.c:581
#, c-format
msgid "Unknown error=(%d)\n"
msgstr "Ukendt fejl=(%d)\n"
+523 -314
View File
File diff suppressed because it is too large Load Diff
+37 -40
View File
@@ -53,11 +53,6 @@
# define FLEX_STD std::
# endif
#ifndef YY_CHAR_DEFINED
#define YY_CHAR_DEFINED
typedef unsigned char YY_CHAR;
#endif
extern "C++" {
struct yy_buffer_state;
@@ -67,45 +62,48 @@ class FlexLexer {
public:
virtual ~FlexLexer() { }
const YY_CHAR* YYText() const { return yytext; }
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 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 = 0 )
{
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 = 0,
FLEX_STD ostream* new_out = 0 ) = 0;
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; }
#ifdef YY_CHARSET
void set_charset(char *charset);
char* get_charset();
#endif
protected:
YY_CHAR* yytext;
#ifdef YY_CHARSET
char *yycharset;
#endif
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"
@@ -126,20 +124,28 @@ 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 );
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 = 0 );
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:
@@ -147,11 +153,11 @@ protected:
virtual void LexerOutput( const char* buf, int size );
virtual void LexerError( const char* msg );
void yyunput( int c, YY_CHAR* buf_ptr );
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_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;
@@ -166,26 +172,17 @@ protected:
yy_state_type yy_try_NUL_trans( yy_state_type current_state );
int yy_get_next_buffer();
#ifdef YY_CHARSET
size_t yycharset_convert(char* source, size_t source_bytes, YY_CHAR* target,
size_t target_length, size_t* converted_bytes);
virtual size_t yycharset_handler(char *charset,
char *source, size_t source_bytes,
YY_CHAR *target, size_t target_length,
size_t *converted_bytes);
#endif
FLEX_STD istream* yyin; // input source for default LexerInput
FLEX_STD ostream* yyout; // output sink for default LexerOutput
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.
YY_CHAR yy_hold_char;
char yy_hold_char;
// Number of characters read into yy_ch_buf.
int yy_n_chars;
// Points to current character in buffer.
YY_CHAR* yy_c_buf_p;
char* yy_c_buf_p;
int yy_init; // whether we need to initialize
int yy_start; // start state number
@@ -204,12 +201,12 @@ protected:
// on use of certain flex features (like REJECT or yymore()).
yy_state_type yy_last_accepting_state;
YY_CHAR* yy_last_accepting_cpos;
char* yy_last_accepting_cpos;
yy_state_type* yy_state_buf;
yy_state_type* yy_state_ptr;
YY_CHAR* yy_full_match;
char* yy_full_match;
int* yy_full_state;
int yy_full_lp;
+4 -2
View File
@@ -39,13 +39,13 @@ libfl_la_SOURCES = \
libmain.c \
libyywrap.c
libfl_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@
libfl_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
libfl_pic_la_SOURCES = \
libmain.c \
libyywrap.c
libfl_pic_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@
libfl_pic_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
noinst_HEADERS = \
flexdef.h \
@@ -67,6 +67,8 @@ EXTRA_DIST = \
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
+1 -1
View File
@@ -400,7 +400,7 @@ void ntod ()
* from 1 to CSIZE, so their size must be CSIZE + 1.
*/
int duplist[CSIZE + 1], state[CSIZE + 1];
int targfreq[CSIZE + 1], targstate[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.
+146 -343
View File
@@ -77,10 +77,6 @@ m4_ifelse(M4_YY_PREFIX,yy,,
#define yyalloc M4_YY_PREFIX[[alloc]]
#define yyrealloc M4_YY_PREFIX[[realloc]]
#define yyfree M4_YY_PREFIX[[free]]
m4_ifdef( [[M4_YY_CHARSET]], [[
#define yycharset M4_YY_PREFIX[[charset]]
#define yycharset_handler M4_YY_PREFIX[[charset_handler]]
]])
)
%endif
%endif
@@ -156,12 +152,6 @@ m4preproc_define(`M4_GEN_PREFIX',
[[
M4_GEN_PREFIX(`get_column')
M4_GEN_PREFIX(`set_column')
m4_ifdef( [[M4_YY_CHARSET]], [[
M4_GEN_PREFIX(`get_charset')
M4_GEN_PREFIX(`set_charset')
M4_GEN_PREFIX(`get_charset_handler')
M4_GEN_PREFIX(`set_charset_handler')
]])
]])
M4_GEN_PREFIX(`wrap')
%endif
@@ -284,7 +274,7 @@ m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
* we want to instead treat it as an 8-bit unsigned char, hence the
* double cast.
*/
#define YY_SC_TO_UI(c) ((unsigned int) (YY_CHAR)c)
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
%ok-for-header
@@ -336,10 +326,6 @@ m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
#define yytext YY_G(yytext_r)
#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
m4_ifdef( [[M4_YY_CHARSET]], [[
#define yycharset YY_G(yycharset_r)
#define yycharset_handler YY_G(yycharset_handler_r)
]])
#define yy_flex_debug YY_G(yy_flex_debug_r)
m4_define( [[M4_YY_INCR_LINENO]],
@@ -414,19 +400,6 @@ m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
$3 $4; [[\]]
$5 $6; [[\]]
M4_YY_DECL_LAST_ARG]])
m4_define( [[YYFARGS4]], [[($2,$4,$6,$8 M4_YY_DEF_LAST_ARG) [[\]]
$1 $2; [[\]]
$3 $4; [[\]]
$5 $6; [[\]]
$7 $8; [[\]]
M4_YY_DECL_LAST_ARG]])
m4_define( [[YYFARGS5]], [[($2,$4,$6,$8,$10 M4_YY_DEF_LAST_ARG) [[\]]
$1 $2; [[\]]
$3 $4; [[\]]
$5 $6; [[\]]
$7 $8; [[\]]
$9 $10; [[\]]
M4_YY_DECL_LAST_ARG]])
]],
[[
%# Generate C99 function defs.
@@ -434,10 +407,6 @@ m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
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_define( [[YYFARGS4]], [[($1 $2, $3 $4, $5 $6, $7 $8
M4_YY_DEF_LAST_ARG)]])
m4_define( [[YYFARGS5]], [[($1 $2, $3 $4, $5 $6, $7 $8, $9 $10
M4_YY_DEF_LAST_ARG)]])
]])
m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
@@ -514,9 +483,6 @@ extern yy_size_t yyleng;
%if-c-only
%if-not-reentrant
extern FILE *yyin, *yyout;
m4_ifdef( [[M4_YY_CHARSET]], [[
extern char *yycharset;
]])
%endif
%endif
@@ -547,7 +513,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
}while(0)
#define YY_LINENO_REWIND_TO(dst) \
do {\
const YY_CHAR *p;\
const char *p;\
for ( p = yy_cp-1; p >= (dst); --p)\
if ( *p == '\n' )\
--yylineno;\
@@ -581,8 +547,6 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
#define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
]])
%% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
@@ -592,12 +556,12 @@ struct yy_buffer_state
%endif
%if-c++-only
std::istream* yy_input_file;
std::streambuf* yy_input_file;
%endif
YY_CHAR *yy_ch_buf; /* input buffer */
YY_CHAR *yy_buf_pos; /* current position in input buffer */
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.
@@ -638,12 +602,6 @@ struct yy_buffer_state
int yy_fill_buffer;
int yy_buffer_status;
m4_ifdef( [[M4_YY_CHARSET]],[[
char *yy_input_buffer;
size_t yy_input_buffer_length;
]])
m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
[[
#define YY_BUFFER_NEW 0
@@ -701,12 +659,12 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
%if-not-reentrant
%not-for-header
/* yy_hold_char holds the character lost when yytext is formed. */
static YY_CHAR yy_hold_char;
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 YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
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 */
@@ -737,7 +695,7 @@ 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( YY_CHAR *base, yy_size_t size M4_YY_PROTO_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 );
@@ -783,6 +741,8 @@ 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
@@ -870,10 +830,10 @@ struct yyguts_t
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. */
YY_CHAR yy_hold_char;
char yy_hold_char;
yy_size_t yy_n_chars;
yy_size_t yyleng_r;
YY_CHAR *yy_c_buf_p;
char *yy_c_buf_p;
int yy_init;
int yy_start;
int yy_did_buffer_switch_on_eof;
@@ -881,7 +841,7 @@ struct yyguts_t
int yy_start_stack_depth;
int *yy_start_stack;
yy_state_type yy_last_accepting_state;
YY_CHAR* yy_last_accepting_cpos;
char* yy_last_accepting_cpos;
int yylineno_r;
int yy_flex_debug_r;
@@ -890,7 +850,7 @@ m4_ifdef( [[M4_YY_USES_REJECT]],
[[
yy_state_type *yy_state_buf;
yy_state_type *yy_state_ptr;
YY_CHAR *yy_full_match;
char *yy_full_match;
int yy_lp;
/* These are only needed for trailing context rules,
@@ -902,13 +862,13 @@ m4_ifdef( [[M4_YY_USES_REJECT]],
m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
[[
YY_CHAR yytext_r[YYLMAX];
YY_CHAR *yytext_ptr;
char yytext_r[YYLMAX];
char *yytext_ptr;
int yy_more_offset;
int yy_prev_more_offset;
]],
[[
YY_CHAR *yytext_r;
char *yytext_r;
int yy_more_flag;
int yy_more_len;
]])
@@ -923,16 +883,6 @@ m4_ifdef( [[<M4_YY_BISON_LLOC>]],
YYLTYPE * yylloc_r;
]])
m4_ifdef( [[M4_YY_CHARSET]], [[
char *yycharset_r; /** current charset name */
]])
m4_ifdef( [[M4_YY_CXX]],,[[
m4_ifdef( [[M4_YY_CHARSET]],[[
yycharset_handler_t yycharset_handler_r; /** charset handle function */
]])
]])
}; /* end struct yyguts_t */
]])
@@ -1024,7 +974,7 @@ yy_size_t yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
[[
YY_CHAR *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
@@ -1053,28 +1003,6 @@ void yyset_column M4_YY_PARAMS( int _column_no M4_YY_PROTO_LAST_ARG );
]])
]])
m4_ifdef( [[M4_YY_REENTRANT]],[[
m4_ifdef( [[M4_YY_CHARSET]],[[
m4_ifdef( [[M4_YY_NO_GET_CHARSET]],,[[
char *yyget_charset M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
%if-c-only
yycharset_handler_t yyget_charset_handler M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
%endif
]])
]])
]])
m4_ifdef( [[M4_YY_REENTRANT]],[[
m4_ifdef( [[M4_YY_CHARSET]], [[
m4_ifdef( [[M4_YY_NO_SET_CHARSET]],,[[
void yyset_charset M4_YY_PARAMS( char *charset M4_YY_PROTO_LAST_ARG );
%if-c-only
void yyset_charset_handler M4_YY_PARAMS( yycharset_handler_t charset_handler M4_YY_PROTO_LAST_ARG );
%endif
]])
]])
]])
%if-bison-bridge
m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
[[
@@ -1120,7 +1048,7 @@ extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
%endif
#ifndef yytext_ptr
static void yy_flex_strncpy M4_YY_PARAMS( YY_CHAR *, yyconst YY_CHAR *, int M4_YY_PROTO_LAST_ARG);
static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
#endif
#ifdef YY_NEED_STRLEN
@@ -1200,7 +1128,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
%endif
%if-c++-only C++ definition
#define ECHO LexerOutput( reinterpret_cast<char*>(yytext), yyleng )
#define ECHO LexerOutput( yytext, yyleng )
%endif
#endif
]])
@@ -1212,14 +1140,13 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
do {\
%% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
\
%if-c++-only C++ definition \
if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
%endif \
} while(0)
if ( (int)(result = LexerInput( (char *) buf, max_size )) < 0 ) \
YY_FATAL_ERROR( "input in flex scanner failed" );
%endif
#endif
]])
@@ -1360,7 +1287,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
YY_DECL
{
yy_state_type yy_current_state;
YY_CHAR *yy_cp, *yy_bp;
char *yy_cp, *yy_bp;
int yy_act;
M4_YY_DECL_GUTS_VAR();
@@ -1411,7 +1338,7 @@ m4_ifdef( [[M4_YY_USES_REJECT]],
yyin = stdin;
%endif
%if-c++-only
yyin = & std::cin;
yyin.rdbuf(std::cin.rdbuf());
%endif
if ( ! yyout )
@@ -1419,7 +1346,7 @@ m4_ifdef( [[M4_YY_USES_REJECT]],
yyout = stdout;
%endif
%if-c++-only
yyout = & std::cout;
yyout.rdbuf(std::cout.rdbuf());
%endif
if ( ! YY_CURRENT_BUFFER ) {
@@ -1485,7 +1412,12 @@ do_action: /* This label is used only to access EOF actions. */
* 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;
}
@@ -1496,7 +1428,7 @@ do_action: /* This label is used only to access EOF actions. */
* end-of-buffer state). Contrast this with the test
* in input().
*/
if ( ((YY_CHAR*)(YY_G(yy_c_buf_p))) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
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;
@@ -1574,9 +1506,8 @@ do_action: /* This label is used only to access EOF actions. */
goto yy_match;
case EOB_ACT_LAST_MATCH:
YY_G(yy_c_buf_p) = ((YY_CHAR*)(
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)]
));
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 );
@@ -1599,11 +1530,29 @@ do_action: /* This label is used only to access EOF actions. */
%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( std::istream* arg_yyin, std::ostream* arg_yyout )
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()
{
yyin = arg_yyin;
yyout = arg_yyout;
yy_c_buf_p = 0;
yy_init = 0;
yy_start = 0;
@@ -1644,18 +1593,31 @@ yyFlexLexer::~yyFlexLexer()
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 )
{
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);
}
if( ! new_in ) {
new_in = &yyin;
}
if ( new_out )
yyout = new_out;
if ( ! new_out ) {
new_out = &yyout;
}
switch_streams(*new_in, *new_out);
}
#ifdef YY_INTERACTIVE
@@ -1664,88 +1626,37 @@ int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
int yyFlexLexer::LexerInput( char* buf, int max_size )
#endif
{
if ( yyin->eof() || yyin->fail() )
if ( yyin.eof() || yyin.fail() )
return 0;
#ifdef YY_INTERACTIVE
yyin->get( buf[0] );
yyin.get( buf[0] );
if ( yyin->eof() )
if ( yyin.eof() )
return 0;
if ( yyin->bad() )
if ( yyin.bad() )
return -1;
return 1;
#else
(void) yyin->read( buf, max_size );
(void) yyin.read( buf, max_size );
if ( yyin->bad() )
if ( yyin.bad() )
return -1;
else
return yyin->gcount();
return yyin.gcount();
#endif
}
void yyFlexLexer::LexerOutput( const char* buf, int size )
{
(void) yyout->write( buf, size );
(void) yyout.write( buf, size );
}
%ok-for-header
%endif
m4_ifdef( [[M4_YY_NOT_IN_HEADER]],[[
m4_ifdef( [[M4_YY_CHARSET]],[[
/* yycharset_convert - convert incoming data from arbitrary
* charset into internal representation
*/
%if-c-only
static size_t yycharset_convert YYFARGS5(
char*, source, size_t, source_bytes,
YY_CHAR*, target, size_t, target_length,
size_t*, converted_bytes) {
%endif
%if-c++-only
size_t yyFlexLexer::yycharset_convert(
char* source, size_t source_bytes,
YY_CHAR* target, size_t target_length,
size_t* converted_bytes) {
%endif
M4_YY_DECL_GUTS_VAR();
if(strcmp(yycharset, "M4_YY_CHARSET_SOURCE")==0) {
if(target_length < source_bytes)
YY_FATAL_ERROR("Too small buffer");
strncpy((char*)target, source, source_bytes);
*converted_bytes = source_bytes;
return source_bytes;
}
%if-c-only
else if(yycharset_handler)
%endif
return yycharset_handler(yycharset, source, source_bytes,
target, target_length, converted_bytes M4_YY_CALL_LAST_ARG);
/* Code below just outputs an error message saying that selected encoding
* is not supported. In C scanner it is an end part of yycharset_convert,
* while in C++ scanner it is a default implementation of yycharset_handler */
%if-c++-only
}
size_t yyFlexLexer::yycharset_handler(char *charset,
char *source, size_t source_bytes,
YY_CHAR *target, size_t target_length,
size_t *converted_bytes) {
%endif
char msg[256];
snprintf(msg, sizeof(msg),
"Unsupported character encoding: %s", yycharset);
YY_FATAL_ERROR(msg);
return 0;
}
]])
]])
m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
[[
/* yy_get_next_buffer - try to read in a new buffer
@@ -1763,12 +1674,12 @@ int yyFlexLexer::yy_get_next_buffer()
%endif
{
M4_YY_DECL_GUTS_VAR();
YY_CHAR *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
YY_CHAR *source = YY_G(yytext_ptr);
int number_to_move, i;
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_CHAR*)( &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1])) )
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" );
@@ -1822,7 +1733,7 @@ m4_ifdef( [[M4_YY_USES_REJECT]],
YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
int yy_c_buf_p_offset =
(int) (YY_G(yy_c_buf_p) - ((YY_CHAR*)(b->yy_ch_buf)) );
(int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
if ( b->yy_is_our_buffer )
{
@@ -1833,10 +1744,10 @@ m4_ifdef( [[M4_YY_USES_REJECT]],
else
b->yy_buf_size *= 2;
b->yy_ch_buf = (YY_CHAR *)
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
yyrealloc( (void *) b->yy_ch_buf,
(b->yy_buf_size + 2)*sizeof(YY_CHAR) M4_YY_CALL_LAST_ARG );
b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
}
else
/* Can't grow it, we don't own it. */
@@ -1857,43 +1768,6 @@ m4_ifdef( [[M4_YY_USES_REJECT]],
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
m4_ifdef([[M4_YY_CHARSET]],[[
if(yycharset) {
const size_t max_size = YY_READ_BUF_SIZE * sizeof(YY_CHAR);
char buffer[max_size];
memcpy(buffer, YY_CURRENT_BUFFER_LVALUE->yy_input_buffer,
YY_CURRENT_BUFFER_LVALUE->yy_input_buffer_length);
size_t read_bytes, converted_characters;
YY_INPUT(
(&buffer[YY_CURRENT_BUFFER_LVALUE->yy_input_buffer_length]),
(read_bytes),
(max_size-YY_CURRENT_BUFFER_LVALUE->yy_input_buffer_length)
);
size_t converted_bytes = 0;
converted_characters = yycharset_convert(
buffer,
YY_CURRENT_BUFFER_LVALUE->yy_input_buffer_length+read_bytes,
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move],
num_to_read,
&converted_bytes M4_YY_CALL_LAST_ARG);
if(converted_characters == 0 && read_bytes != 0)
YY_FATAL_ERROR("Could not convert input characters");
YY_G(yy_n_chars) = converted_characters;
/* store left bytes in yy_input_buffer */
YY_CURRENT_BUFFER_LVALUE->yy_input_buffer_length +=
read_bytes-converted_bytes;
YY_CURRENT_BUFFER_LVALUE->yy_input_buffer = (char*)yyrealloc(
(void*) YY_CURRENT_BUFFER_LVALUE->yy_input_buffer,
YY_CURRENT_BUFFER_LVALUE->yy_input_buffer_length
M4_YY_CALL_LAST_ARG);
memcpy(YY_CURRENT_BUFFER_LVALUE->yy_input_buffer,
&buffer[converted_bytes],
YY_CURRENT_BUFFER_LVALUE->yy_input_buffer_length);
} else
]])
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
YY_G(yy_n_chars), num_to_read );
@@ -1922,8 +1796,8 @@ m4_ifdef([[M4_YY_CHARSET]],[[
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 = (YY_CHAR *) yyrealloc(
(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size*sizeof(YY_CHAR) M4_YY_CALL_LAST_ARG );
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()" );
}
@@ -1949,7 +1823,7 @@ m4_ifdef([[M4_YY_CHARSET]],[[
%endif
{
yy_state_type yy_current_state;
YY_CHAR *yy_cp;
char *yy_cp;
M4_YY_DECL_GUTS_VAR();
%% [15.0] code to get the start state into yy_current_state goes here
@@ -1988,13 +1862,13 @@ m4_ifdef([[M4_YY_CHARSET]],[[
%if-c-only
m4_ifdef( [[M4_YY_NO_UNPUT]],,
[[
static void yyunput YYFARGS2( int,c, YY_CHAR *,yy_bp)
static void yyunput YYFARGS2( int,c, char *,yy_bp)
%endif
%if-c++-only
void yyFlexLexer::yyunput( int c, YY_CHAR* yy_bp)
void yyFlexLexer::yyunput( int c, char* yy_bp)
%endif
{
YY_CHAR *yy_cp;
char *yy_cp;
M4_YY_DECL_GUTS_VAR();
yy_cp = YY_G(yy_c_buf_p);
@@ -2006,9 +1880,9 @@ m4_ifdef( [[M4_YY_NO_UNPUT]],,
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
yy_size_t number_to_move = YY_G(yy_n_chars) + 2;
YY_CHAR *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
YY_CHAR *source =
char *source =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
@@ -2135,7 +2009,7 @@ m4_ifdef( [[M4_YY_USE_LINENO]],
void yyrestart YYFARGS1( FILE *,input_file)
%endif
%if-c++-only
void yyFlexLexer::yyrestart( std::istream* input_file )
void yyFlexLexer::yyrestart( std::istream& input_file )
%endif
{
M4_YY_DECL_GUTS_VAR();
@@ -2150,6 +2024,18 @@ m4_ifdef( [[M4_YY_USE_LINENO]],
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
@@ -2202,7 +2088,12 @@ static void yy_load_buffer_state YYFARGS0(void)
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);
}
@@ -2216,7 +2107,7 @@ static void yy_load_buffer_state YYFARGS0(void)
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 )
YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream& file, int size )
%endif
{
YY_BUFFER_STATE b;
@@ -2231,7 +2122,7 @@ static void yy_load_buffer_state YYFARGS0(void)
/* 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 = (YY_CHAR *) yyalloc( (b->yy_buf_size + 2)*sizeof(YY_CHAR) M4_YY_CALL_LAST_ARG );
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()" );
@@ -2242,6 +2133,19 @@ static void yy_load_buffer_state YYFARGS0(void)
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
@@ -2276,7 +2180,7 @@ static void yy_load_buffer_state YYFARGS0(void)
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 )
void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream& file )
%endif
{
@@ -2285,7 +2189,12 @@ static void yy_load_buffer_state YYFARGS0(void)
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_
@@ -2316,11 +2225,6 @@ m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
b->yy_is_interactive = 0;
%endif
errno = oerrno;
m4_ifdef([[M4_YY_CHARSET]],[[
b->yy_input_buffer = NULL;
b->yy_input_buffer_length = 0;
]])
}
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
@@ -2446,7 +2350,7 @@ void yyFlexLexer::yyensure_buffer_stack(void)
* 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;
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);
@@ -2493,7 +2397,7 @@ m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
* M4_YY_DOC_PARAM
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE yy_scan_buffer YYFARGS2( YY_CHAR *,base, yy_size_t ,size)
YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
{
YY_BUFFER_STATE b;
m4_dnl M4_YY_DECL_GUTS_VAR();
@@ -2560,14 +2464,14 @@ m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, yy_size_t ,_yybytes_len)
{
YY_BUFFER_STATE b;
YY_CHAR *buf;
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 = (YY_CHAR *) yyalloc( n*sizeof(YY_CHAR) M4_YY_CALL_LAST_ARG );
buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
@@ -2754,55 +2658,7 @@ int yyget_column YYFARGS0(void)
}
]])
]])
%endif
m4_ifdef([[M4_YY_CHARSET]],[[
m4_ifdef([[M4_YY_REENTRANT]],[[
m4_ifdef([[M4_YY_NO_GET_CHARSET]],,[[
m4_define([[M4_YY_GET_CHARSET]],[[
char* yyget_charset YYFARGS0(void)
]])
]])
m4_ifdef([[M4_YY_NO_GET_CHARSET_HANDLER]],,[[
m4_define([[M4_YY_GET_CHARSET_HANDLER]],[[
yycharset_handler_t yyget_charset_handler YYFARGS0(void)
]])
]])
]])
m4_ifdef([[M4_YY_CXX]], [[
m4_define( [[M4_YY_GET_CHARSET]], [[
char *FlexLexer::get_charset()
]])
]])
]])
m4_ifdef( [[M4_YY_GET_CHARSET]], [[
/** Get the current charset name
* M4_YY_DOC_PARAM
* @return charset name
*/
M4_YY_GET_CHARSET
{
M4_YY_DECL_GUTS_VAR();
return yycharset;
}
]])
m4_ifdef( [[M4_YY_GET_CHARSET_HANDLER]],[[
/** Get the currently set charset handler
* M4_YY_DOC_PARAM
*/
M4_YY_GET_CHARSET_HANDLER
{
M4_YY_DECL_GUTS_VAR();
return yycharset_handler;
}
]])
%if-c-only
m4_ifdef( [[M4_YY_NO_GET_IN]],,
[[
/** Get the input stream.
@@ -2844,7 +2700,7 @@ yy_size_t yyget_leng YYFARGS0(void)
*/
m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
[[
YY_CHAR *yyget_text YYFARGS0(void)
char *yyget_text YYFARGS0(void)
{
M4_YY_DECL_GUTS_VAR();
return yytext;
@@ -2908,56 +2764,8 @@ void yyset_column YYFARGS1( int , _column_no)
}
]])
]])
%endif
m4_ifdef([[M4_YY_CHARSET]], [[
m4_ifdef([[M4_YY_REENTRANT]],[[
m4_ifdef([[M4_YY_NO_SET_CHARSET]],,[[
m4_define([[M4_YY_SET_CHARSET]], [[
void yyset_charset YYFARGS1(char*, charset)
]])
]])
m4_ifdef([[M4_YY_NO_SET_CHARSET_HANDLER]],,[[
m4_define([[M4_YY_SET_CHARSET_HANDLER]],[[
void yyset_charset_handler YYFARGS1(yycharset_handler_t, charset_handler)
]])
]])
]])
m4_ifdef( [[M4_YY_CXX]],[[
m4_define( [[M4_YY_SET_CHARSET]], [[
void FlexLexer::set_charset(char *charset)
]])
]])
]])
m4_ifdef( [[M4_YY_SET_CHARSET]],[[
/** Set the current charset name
* @param charset charset name
* M4_YY_DOC_PARAM
*/
M4_YY_SET_CHARSET
{
M4_YY_DECL_GUTS_VAR();
yycharset = strdup(charset);
}
]])
m4_ifdef( [[M4_YY_SET_CHARSET_HANDLER]],[[
/** Set the current charset handler
* @param charset_handler handler function
* M4_YY_DOC_PARAM
*/
void yyset_charset_handler YYFARGS1( yycharset_handler_t, charset_handler)
{
M4_YY_DECL_GUTS_VAR();
yycharset_handler = charset_handler;
}
]])
%if-c-only
m4_ifdef( [[M4_YY_NO_SET_IN]],,
[[
/** Set the input stream. This does not discard the current
@@ -3125,7 +2933,7 @@ int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
}
%endif if-c-only
%# Actually, that ended an if-rentrant section
%if-c-only
static int yy_init_globals YYFARGS0(void)
@@ -3146,7 +2954,7 @@ m4_ifdef( [[M4_YY_USE_LINENO]],
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) = (YY_CHAR *) 0;
YY_G(yy_c_buf_p) = (char *) 0;
YY_G(yy_init) = 0;
YY_G(yy_start) = 0;
@@ -3172,11 +2980,6 @@ m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
YY_G(yy_prev_more_offset) = 0;
]])
m4_ifdef( [[M4_YY_CHARSET]],[[
yycharset = NULL;
yycharset_handler = NULL;
]])
/* Defined in main.c */
#ifdef YY_STDINIT
yyin = stdin;
@@ -3248,7 +3051,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
[[
#ifndef yytext_ptr
static void yy_flex_strncpy YYFARGS3( YY_CHAR*,s1, yyconst YY_CHAR *,s2, int,n)
static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
{
M4_YY_DECL_GUTS_VAR();
M4_YY_NOOP_GUTS_VAR();
+1 -8
View File
@@ -396,7 +396,6 @@ char *alloca ();
* 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
* charset_enabled - true if charset interface has been enabled
*/
extern int printstats, syntaxerror, eofseen, ddebug, trace, nowarn,
@@ -412,7 +411,6 @@ extern int yymore_used, reject, real_reject, continued_action, in_rule;
extern int yymore_really_used, reject_really_used;
extern int trace_hex;
extern bool charset_enabled;
/* Variables used in the flex input routines:
* datapos - characters on current output line
@@ -427,7 +425,6 @@ extern bool charset_enabled;
* infilename - name of input file
* outfilename - name of output file
* headerfilename - name of the .h file to generate
* headercharfilename - name of the .h file to fill with character type defintion
* 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
@@ -437,8 +434,6 @@ extern bool charset_enabled;
* num_input_files - size of input_files array
* program_name - name with which program was invoked
*
* charset_source - character set that has been declared as used in source file
*
* 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
@@ -453,7 +448,7 @@ 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, *headercharfilename;
extern char *infilename, *outfilename, *headerfilename;
extern int did_outfilename;
extern char *prefix, *yyclass, *extra_type;
extern int do_stdinit, use_stdout;
@@ -461,8 +456,6 @@ extern char **input_files;
extern int num_input_files;
extern char *program_name;
extern char *charset_source;
extern char *action_array;
extern int action_size;
extern int defs1_offset, prolog_offset, action_offset, action_index;
+12 -8
View File
@@ -960,7 +960,7 @@ void gen_NUL_trans (void)
/* We're going to need yy_cp lying around for the call
* below to gen_backing_up().
*/
indent_puts ("YY_CHAR *yy_cp = YY_G(yy_c_buf_p);");
indent_puts ("char *yy_cp = YY_G(yy_c_buf_p);");
outc ('\n');
@@ -1525,7 +1525,7 @@ void make_tables (void)
{
int i;
int did_eof_rule = false;
struct yytbl_data *yynultrans_tbl;
struct yytbl_data *yynultrans_tbl = NULL;
skelout (); /* %% [2.0] - break point in skel */
@@ -1709,7 +1709,7 @@ void make_tables (void)
indent_puts
("static yy_state_type yy_last_accepting_state;");
indent_puts
("static YY_CHAR *yy_last_accepting_cpos;\n");
("static char *yy_last_accepting_cpos;\n");
}
}
@@ -1755,9 +1755,13 @@ void make_tables (void)
0)
flexerror (_
("Could not write yynultrans_tbl"));
}
if (yynultrans_tbl != NULL) {
yytbl_data_destroy (yynultrans_tbl);
yynultrans_tbl = NULL;
}
}
/* End generating yy_NUL_trans */
}
@@ -1781,7 +1785,7 @@ void make_tables (void)
/* Declare state buffer variables. */
if (!C_plus_plus && !reentrant) {
outn ("static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;");
outn ("static YY_CHAR *yy_full_match;");
outn ("static char *yy_full_match;");
outn ("static int yy_lp;");
}
@@ -1876,14 +1880,14 @@ void make_tables (void)
outn ("#define YYLMAX 8192");
outn ("#endif\n");
if (!reentrant){
outn ("YY_CHAR yytext[YYLMAX];");
outn ("YY_CHAR *yytext_ptr;");
outn ("char yytext[YYLMAX];");
outn ("char *yytext_ptr;");
}
}
else {
if(! reentrant)
outn ("YY_CHAR *yytext;");
outn ("char *yytext;");
}
}
+12 -102
View File
@@ -64,7 +64,7 @@ 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, *headercharfilename = NULL;
char *infilename = NULL, *outfilename = NULL, *headerfilename = NULL;
int did_outfilename;
char *prefix, *yyclass, *extra_type = NULL;
int do_stdinit, use_stdout;
@@ -100,15 +100,13 @@ 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;
FILE *char_header_file = NULL;
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, charset_enabled = false;
char *charset_source = NULL;
bool ansi_func_defs, ansi_func_protos;
bool tablesext, tablesverify, gentables;
char *tablesfilename=0,*tablesname=0;
@@ -304,8 +302,6 @@ void check_options ()
if (C_plus_plus && bison_bridge_lval)
flexerror (_("bison bridge not supported for the C++ scanner."));
if(C_plus_plus)
buf_m4_define( &m4defs_buf, "M4_YY_CXX", NULL);
if (useecs) { /* Set up doubly-linked equivalence classes. */
@@ -372,42 +368,6 @@ void check_options ()
filter_create_ext(output_chain, m4, "-P", 0);
filter_create_int(output_chain, filter_fix_linedirs, NULL);
if(headerfilename && !headercharfilename) {
char *suffix = ".h";
char *basesuffix = "_char";
size_t suffix_len = strlen(suffix);
size_t basesuffix_len = strlen(basesuffix);
size_t headerfilename_len = strlen(headerfilename);
char *p = strstr(headerfilename, suffix);
if(p && headerfilename+headerfilename_len-suffix_len == p)
headerfilename_len -= suffix_len; /* cut out suffix */
headercharfilename = malloc(headerfilename_len+basesuffix_len+suffix_len+1);
p = headercharfilename;
strncpy(p, headerfilename, headerfilename_len);
p += headerfilename_len;
strncpy(p, basesuffix, basesuffix_len);
p += basesuffix_len;
strncpy(p, suffix, suffix_len);
}
/* Setup char header file */
if(headercharfilename) {
char_header_file = fopen(headercharfilename, "w");
fprintf(char_header_file, "#pragma once\n");
fprintf(char_header_file, "\n");
fflush(char_header_file);
buf_strappend(&userdef_buf, "#include \"");
buf_strappend(&userdef_buf, headercharfilename);
buf_strappend(&userdef_buf, "\"\n");
}
/* For debugging, only run the requested number of filters. */
if (preproc_level > 0) {
filter_truncate(output_chain, preproc_level);
@@ -480,12 +440,6 @@ void check_options ()
if (do_yylineno)
buf_m4_define (&m4defs_buf, "M4_YY_USE_LINENO", NULL);
if(charset_enabled)
buf_m4_define(&m4defs_buf, "M4_YY_CHARSET", NULL);
if(charset_source)
buf_m4_define(&m4defs_buf, "M4_YY_CHARSET_SOURCE", charset_source);
/* Create the alignment type. */
buf_strdefine (&userdef_buf, "YY_INT_ALIGNED",
long_align ? "long int" : "short int");
@@ -546,10 +500,6 @@ void flexend (exit_status)
if (++called_before)
FLEX_EXIT (exit_status);
if(char_header_file && fclose (char_header_file))
lerrsf (_("error closing char header file %s"),
headercharfilename);
if (skelfile != NULL) {
if (ferror (skelfile))
lerr (_("input error reading skeleton file %s"),
@@ -1511,13 +1461,6 @@ void readin ()
static char yy_stdinit[] = "FILE *yyin = stdin, *yyout = stdout;";
static char yy_nostdinit[] =
"FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;";
static char character_type_uchar[] = "typedef unsigned char YY_CHAR;";
static char character_type_char[] = "typedef char YY_CHAR;";
static char character_defined[] = "#define YY_CHAR_DEFINED";
static char charset_handler_t[] = "typedef size_t(*yycharset_handler_t)(char*,char*,size_t,YY_CHAR*,size_t,size_t*);\n";
static char charset_handler_t_reentrant[] = "typedef size_t(*yycharset_handler_t)(char*,char*,size_t,YY_CHAR*,size_t,size_t*,yyscan_t);\n";
line_directive_out ((FILE *) 0, 1);
@@ -1647,27 +1590,12 @@ void readin ()
outn ("\n#define FLEX_DEBUG");
OUT_BEGIN_CODE ();
outn("#ifndef YY_CHAR_DEFINED");
if (csize == 256) {
outn (character_type_uchar);
if(char_header_file)
fprintf(char_header_file, "%s\n", character_type_uchar);
} else {
outn (character_type_char);
if(char_header_file)
fprintf(char_header_file, "%s\n", character_type_char);
}
outn(character_defined);
outn("#endif");
if(char_header_file) {
fprintf(char_header_file, "%s\n", character_defined);
fflush(char_header_file);
}
if (csize == 256)
outn ("typedef unsigned char YY_CHAR;");
else
outn ("typedef char YY_CHAR;");
OUT_END_CODE ();
if(charset_enabled)
outn ("#define YY_CHARSET");
if (C_plus_plus) {
outn ("#define yytext_ptr yytext");
@@ -1750,20 +1678,18 @@ void readin ()
*/
if (yytext_is_array) {
if (!reentrant)
outn ("extern YY_CHAR yytext[];\n");
outn ("extern char yytext[];\n");
}
else {
/* This prevents warning of "already defined macro" in multiple
* non-reentrant scanners */
outn("#ifdef yytext_ptr");
outn("#undef yytext_ptr");
outn("#endif");
if (reentrant) {
outn ("#define yytext_ptr yytext_r");
}
else {
outn ("extern YY_CHAR *yytext;");
outn ("extern char *yytext;");
outn("#ifdef yytext_ptr");
outn("#undef yytext_ptr");
outn("#endif");
outn ("#define yytext_ptr yytext");
}
}
@@ -1773,22 +1699,6 @@ void readin ()
("%option yyclass only meaningful for C++ scanners"));
}
outn("");
if(charset_enabled) {
if(!reentrant)
outn(charset_handler_t);
else
outn(charset_handler_t_reentrant);
OUT_BEGIN_CODE ();
if(!C_plus_plus && !reentrant) {
outn("char *yycharset = NULL;");
outn("yycharset_handler_t yycharset_handler = NULL;");
}
OUT_END_CODE ();
}
if (useecs)
numecs = cre8ecs (nextecm, ecgroup, csize);
else
+2 -6
View File
@@ -1,8 +1,8 @@
/* 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_HEADER_CHAR
%token OPT_EXTRA_TYPE OPT_TABLES OPT_CHARSET_SOURCE
%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
@@ -204,12 +204,8 @@ option : OPT_OUTFILE '=' NAME
{ yyclass = copy_string( nmstr ); }
| OPT_HEADER '=' NAME
{ headerfilename = copy_string( nmstr ); }
| OPT_HEADER_CHAR '=' NAME
{ headercharfilename = copy_string( nmstr ); }
| OPT_TABLES '=' NAME
{ tablesext = true; tablesfilename = copy_string( nmstr ); }
| OPT_CHARSET_SOURCE '=' NAME
{ charset_source = copy_string(nmstr); }
;
sect2 : sect2 scon initforrule flexrule '\n'
-3
View File
@@ -349,7 +349,6 @@ M4QEND "]]"
"c++" C_plus_plus = option_sense;
caseful|case-sensitive sf_set_case_ins(!option_sense);
caseless|case-insensitive sf_set_case_ins(option_sense);
charset charset_enabled = true;
debug ddebug = option_sense;
default spprdflt = ! option_sense;
ecs useecs = option_sense;
@@ -426,9 +425,7 @@ M4QEND "]]"
prefix return OPT_PREFIX;
yyclass return OPT_YYCLASS;
header(-file)? return OPT_HEADER;
header-char(-file)? return OPT_HEADER_CHAR;
tables-file return OPT_TABLES;
charset-source return OPT_CHARSET_SOURCE;
tables-verify {
tablesverify = option_sense;
if(!tablesext && option_sense)
+114 -50
View File
@@ -36,7 +36,7 @@ REJECT_LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_REJECT_LOG_FLAGS = -d $(srcdir) -i reject.txt -r
TABLE_LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_TABLE_LOG_FLAGS = -d $(srcdir) -i reject.txt -t
AM_TABLE_LOG_FLAGS = -d $(builddir) -i $(srcdir)/reject.txt -t
DIRECT_LOG_COMPILER=$(srcdir)/testwrapper.sh
AM_DIRECT_LOG_FLAGS = -d $(srcdir)
@@ -88,7 +88,7 @@ simple_tests = \
prefix_r \
quotes \
string_nr \
string_r \
string_r \
top \
yyextra
@@ -107,7 +107,7 @@ DIRECT_TESTS = \
rescan_nr.direct \
rescan_r.direct
I3_TESTS = \
I3_TESTS = \
cxx_yywrap.i3
if want_pthread
@@ -169,44 +169,117 @@ top_SOURCES = top.l top_main.c
yyextra_SOURCES = yyextra.l
BUILT_SOURCES = \
bison_nr_scanner.h \
bison_nr_parser.h \
bison_nr_scanner.h \
bison_yylloc_parser.h \
bison_yylloc_scanner.h \
bison_yylval_parser.h \
bison_yylval_scanner.h \
c_cxx_nr.cc \
c_cxx_r.cc \
header_nr_scanner.h \
header_r_scanner.h \
multiple_scanners_nr_1.h \
multiple_scanners_nr_2.h \
multiple_scanners_r_1.h \
multiple_scanners_r_2.h \
top.h
# Normally, automake would distribute files built by flex. Since the
# point of the test suite is to test the files that flex builds, and
# since anyone who has the flex distribution can build a flex binary
# without having a flex binary, we want to not distribute the files
# built by flex in the test suite. The dist-hook target accomplishes
# this goal. It's also handy to have the list of files to clean since
# automake doesn't know about the whacky ways in which we're abusing
# it.
CLEANFILES = \
array_nr.c \
array_r.c \
basic_nr.c \
basic_r.c \
bison_nr_parser.c \
bison_nr_parser.h \
bison_nr_scanner.c \
bison_nr_scanner.h \
bison_yylloc_parser.c \
bison_yylloc_parser.h \
bison_yylloc_scanner.c \
bison_yylloc_scanner.h \
bison_yylval_parser.c \
bison_yylval_parser.h \
bison_yylval_scanner.c \
bison_yylval_scanner.h \
c_cxx_nr.cc \
c_cxx_r.cc \
ccl.c \
cxx_basic.cc \
cxx_multiple_scanners_1.cc \
cxx_multiple_scanners_2.cc \
cxx_yywrap.cc \
debug_nr.c \
debug_r.c \
extended.c \
header_nr_scanner.c \
header_nr_scanner.h \
header_r_scanner.c \
header_r_scanner.h \
include_by_buffer.direct.c \
include_by_push.direct.c \
include_by_reentrant.direct.c \
lineno_nr.c \
lineno_r.c \
lineno_trailing.c \
mem_nr.c \
mem_r.c \
multiple_scanners_nr_1.c \
multiple_scanners_nr_1.h \
multiple_scanners_nr_2.c \
multiple_scanners_nr_2.h \
multiple_scanners_r_1.c \
multiple_scanners_r_1.h \
multiple_scanners_r_2.c \
multiple_scanners_r_2.h \
noansi_nr.c \
noansi_r.c \
posix.c \
posixly_correct.c \
prefix_nr.c \
prefix_r.c \
pthread.c \
quotes.c \
reject_nr.reject.c \
reject_r.reject.c \
reject_ver.table.c \
reject_ser.table.c \
top.h \
$(tableopts_c)
reject_ser.table.tables \
reject_ver.table.c \
reject_ver.table.tables \
rescan_nr.direct.c \
rescan_r.direct.c \
string_nr.c \
string_r.c \
top.c \
top.h \
yyextra.c \
alloc_extra.c \
$(tableopts_c) \
$(tableopts_tables)
dist-hook:
for file in $(CLEANFILES) ; do \
rm -f $(distdir)/$$file \
; done
EXTRA_DIST = \
README \
testwrapper.sh \
alloc_extra.txt \
array_nr.txt \
array_r.txt \
basic_nr.txt \
basic_nr.txt \
basic_r.txt \
bison_nr_scanner.h \
bison_nr.txt \
bison_yylloc_scanner.h \
bison_yylloc.txt \
bison_yylval_scanner.h \
bison_yylval.txt \
c_cxx_nr.cc \
c_cxx_nr.txt \
c_cxx_r.cc \
c_cxx_r.txt \
ccl.txt \
cxx_basic.txt \
@@ -215,9 +288,7 @@ basic_nr.txt \
debug_nr.txt \
debug_r.txt \
extended.txt \
header_nr_scanner.h \
header_nr.txt \
header_r_scanner.h \
header_r.txt \
include_by_buffer.direct.txt \
include_by_buffer.direct_2.txt \
@@ -234,10 +305,6 @@ basic_nr.txt \
mem_nr.txt \
mem_r.txt \
noansi_nr.txt \
multiple_scanners_nr_1.h \
multiple_scanners_nr_2.h \
multiple_scanners_r_1.h \
multiple_scanners_r_2.h \
noansi_r.txt \
prefix_nr.txt \
prefix_r.txt \
@@ -247,22 +314,19 @@ basic_nr.txt \
pthread_4.txt \
pthread_5.txt \
reject.txt \
reject_nr.reject.c \
reject_r.reject.c \
reject_ver.table.c \
reject_ver.table.tables \
reject_ser.table.c \
reject_ser.table.tables \
rescan_nr.direct.txt \
rescan_r.direct.txt \
quotes.txt \
top.h \
top.txt \
yyextra.txt \
$(tableopts_c) \
$(tableopts_tables) \
tableopts.txt \
options.cn
tableopts.txt
dist_noinst_SCRIPTS = \
tableopts.sh
dist_check_SCRIPTS = \
options.cn \
testwrapper.sh
pthread_pthread_LDADD = -lpthread
@@ -270,10 +334,10 @@ pthread_pthread_LDADD = -lpthread
FLEX = $(top_builddir)/src/flex
.l.c:
.l.c: $(FLEX)
$(FLEX) -o $@ $<
.ll.cc:
.ll.cc: $(FLEX)
$(FLEX) -+ -o $@ $<
bison_nr_main.($OBJEXT): bison_nr_parser.h bison_nr_scanner.h
@@ -288,7 +352,7 @@ bison_yylval_scanner.h: bison_yylval_scanner.c
# automake does not support compiling flex scanners output in C as C++
# so we explicitly sayhow, using the .lll suffix for the lex input file
.lll.cc:
.lll.cc: $(FLEX)
$(FLEX) -o $@ $<
header_nr_main.$(OBJEXT): header_nr_scanner.h
@@ -311,16 +375,16 @@ multiple_scanners_r_main.$(OBJEXT): multiple_scanners_r_1.h multiple_scanners_r_
multiple_scanners_r_1.h: multiple_scanners_r_1.c
multiple_scanners_r_2.h: multiple_scanners_r_2.c
posixly_correct.c: posixly_correct.l
posixly_correct.c: posixly_correct.l $(FLEX)
POSIXLY_CORRECT=1 $(FLEX) -o $@ $<
reject_nr.reject.c: reject.l4
reject_nr.reject.c: reject.l4 $(FLEX)
$(FLEX) -o $@ $<
reject_nr.reject$(EXEEXT): reject_nr.reject.$(OBJEXT)
$(LINK) $^
reject_r.reject.c: reject.l4
reject_r.reject.c: reject.l4 $(FLEX)
$(FLEX) --reentrant -o $@ $<
reject_r.reject.$(OBJEXT): reject_r.reject.c
@@ -329,7 +393,7 @@ reject_r.reject.$(OBJEXT): reject_r.reject.c
reject_r.reject$(EXEEXT): reject_r.reject.$(OBJEXT)
$(LINK) $^
reject_ver.table.c: reject.l4
reject_ver.table.c: reject.l4 $(FLEX)
$(FLEX) -o $@ --tables-verify --tables-file=$(basename $@).tables $<
reject_ver.table.$(OBJEXT): reject_ver.table.c
@@ -338,7 +402,7 @@ reject_ver.table.$(OBJEXT): reject_ver.table.c
reject_ver.table$(EXEEXT): reject_ver.table.$(OBJEXT)
$(LINK) $^
reject_ser.table.c: reject.l4
reject_ser.table.c: reject.l4 $(FLEX)
$(FLEX) -o $@ --tables-file=$(basename $@).tables $<
reject_ser.table.$(OBJEXT): reject_ser.table.c
@@ -359,7 +423,7 @@ top.h: top.c
tableopts.am: tableopts.sh
$(srcdir)/tableopts.sh > $(srcdir)/tableopts.am
include tableopts.am
include $(srcdir)/tableopts.am
tableopts := -Ca -Ce -Cf -CF -Cm -Cem -Cae -Caef -CaeF -Cam -Caem
tableopts_opt_tests := $(foreach opt,$(tableopts), tableopts_opt_nr$(opt) tableopts_opt_r$(opt))
@@ -372,37 +436,37 @@ tableopts_c := $(addsuffix .c,$(tableopts_tests))
OPT_LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_OPT_LOG_FLAGS = -d $(srcdir) -i tableopts.txt -r
tableopts_opt_nr%.c: tableopts.l4
tableopts_opt_nr%.c: tableopts.l4 $(FLEX)
$(FLEX) -P $(subst -,_,$(basename $(*F))) $* -o $@ $<
tableopts_opt_nr%.$(OBJEXT): tableopts_opt_nr%.c
$(COMPILE) -c -o $@ $<
tableopts_opt_r%.c: tableopts.l4
tableopts_opt_r%.c: tableopts.l4 $(FLEX)
$(FLEX) -P $(subst -,_,$(basename $(*F))) --reentrant $* -o $@ $<
tableopts_opt_r%.$(OBJEXT): tableopts_opt_r%.c
$(COMPILE) -DTEST_IS_REENTRANT -c -o $@ $<
SER_LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_SER_LOG_FLAGS = -d $(srcdir) -i tableopts.txt -r -t
AM_SER_LOG_FLAGS = -d $(builddir) -i $(srcdir)/tableopts.txt -r -t
tableopts_ser_nr%.c: tableopts.l4
tableopts_ser_nr%.c: tableopts.l4 $(FLEX)
$(FLEX) -P $(subst -,_,$(basename $(*F))) --tables-file="tableopts_ser_nr$*.ser.tables" $* -o $@ $<
tableopts_ser_nr%.$(OBJEXT): tableopts_ser_nr%.c
$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
tableopts_ser_r%.c: tableopts.l4
tableopts_ser_r%.c: tableopts.l4 $(FLEX)
$(FLEX) -P $(subst -,_,$(basename $(*F))) -R --tables-file="tableopts_ser_r$*.ser.tables" $* -o $@ $<
tableopts_ser_r%.$(OBJEXT): tableopts_ser_r%.c
$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -DTEST_IS_REENTRANT -c -o $@ $<
VER_LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_VER_LOG_FLAGS = -d $(srcdir) -i tableopts.txt -r -t
AM_VER_LOG_FLAGS = -d $(builddir) -i $(srcdir)/tableopts.txt -r -t
tableopts_ver_nr%.c: tableopts.l4
tableopts_ver_nr%.c: tableopts.l4 $(FLEX)
$(FLEX) -P $(subst -,_,$(basename $(*F))) --tables-file="tableopts_ver_nr$*.ver.tables" --tables-verify $* -o $@ $<
tableopts_ver_nr%.$(OBJEXT): tableopts_ver_nr%.c
@@ -411,7 +475,7 @@ tableopts_ver_nr%.$(OBJEXT): tableopts_ver_nr%.c
tableopts_ver_nr%.ver$(EXEEXT): tableopts_ver_nr%.$(OBJEXT)
$(LINK) -o $@ $^
tableopts_ver_r%.c: tableopts.l4
tableopts_ver_r%.c: tableopts.l4 $(FLEX)
$(FLEX) -P $(subst -,_,$(basename $(*F))) -R --tables-file="tableopts_ver_r$*.ver.tables" --tables-verify $* -o $@ $<
tableopts_ver_r%.$(OBJEXT): tableopts_ver_r%.c
-1
View File
@@ -23,7 +23,6 @@
#include "bison_nr_parser.h"
#include "bison_nr_scanner.h"
#include "bison_nr_scanner_char.h"
extern int testparse(void);
+2 -3
View File
@@ -32,7 +32,6 @@
#include "config.h"
#include "bison_nr_parser.h"
#include "bison_nr_scanner.h"
#include "bison_nr_scanner_char.h"
#define YYERROR_VERBOSE 1
/* #define YYPARSE_PARAM scanner */
@@ -43,7 +42,7 @@ extern int testget_lineno(void);
/* A dummy function. A check against seg-faults in yylval->str. */
int process_text(YY_CHAR* s) {
int process_text(char* s) {
int total =0;
while(*s) {
total += (int) *s;
@@ -59,7 +58,7 @@ int process_text(YY_CHAR* s) {
%union {
int lineno;
YY_CHAR * str;
char * str;
}
%token <str> IDENT
%token <lineno> LINENO
+9 -4
View File
@@ -26,8 +26,8 @@
#include <stdio.h>
#include <stdlib.h>
#include "bison_nr_parser.h"
#include "strutils.h"
#include "config.h"
static char* STRDUP(char* s1);
#define YY_EXTRA_TYPE int
%}
@@ -35,23 +35,28 @@
%option bison-locations yylineno
%option prefix="test" header="bison_nr_scanner.h" yylineno
%option nomain nounput noyy_top_state noyywrap nodefault noinput warn
%option header-char="bison_nr_scanner_char.h"
%%
^[[:digit:]]+ {
yylval->lineno = yylineno;
yylloc->first_line = (int)yy_utils_strtol(yytext,NULL,10);
yylloc->first_line = (int)strtol(yytext,NULL,10);
return LINENO;
}
":" { return COLON; }
" " { return SPACE; }
"=" { return EQUAL; }
[[:alnum:]_]+ { yylval->str = yy_utils_strdup(yytext); return IDENT;}
[[:alnum:]_]+ { yylval->str = STRDUP(yytext); return IDENT;}
\r|\n { }
. { yyterminate();}
%%
static char* STRDUP(char* s1)
{
char* s2 = (char*)malloc(strlen(s1)+1);
sprintf(s2,"%s",s1);
return s2;
}
-1
View File
@@ -23,7 +23,6 @@
#include "bison_yylloc_parser.h"
#include "bison_yylloc_scanner.h"
#include "bison_yylloc_scanner_char.h"
int main ( int argc, char** argv )
{
+2 -3
View File
@@ -35,7 +35,6 @@
#include "config.h"
#include "bison_yylloc_parser.h"
#include "bison_yylloc_scanner.h"
#include "bison_yylloc_scanner_char.h"
int yyerror(YYLTYPE *location, void* scanner, const char* msg);
@@ -45,7 +44,7 @@ extern int testget_lineno(void*);
/* A dummy function. A check against seg-faults in yylval->str. */
int process_text(YY_CHAR* s) {
int process_text(char* s) {
int total =0;
while(*s) {
total += (int) *s;
@@ -61,7 +60,7 @@ int process_text(YY_CHAR* s) {
%union {
int lineno;
YY_CHAR * str;
char * str;
}
%token <str> IDENT
%token <lineno> LINENO
+11 -5
View File
@@ -27,7 +27,7 @@
#include <stdlib.h>
#include "bison_yylloc_parser.h"
#include "config.h"
#include "strutils.h"
static char* STRDUP(char* s1);
#define YY_EXTRA_TYPE int
%}
@@ -35,8 +35,6 @@
%option reentrant bison-bridge bison-locations yylineno
%option header="bison_yylloc_scanner.h"
%option nomain nounput noyy_top_state noyywrap nodefault noinput warn
%option nomain nounput noyy_top_state noyywrap nodefault warn
%option header-char="bison_yylloc_scanner_char.h"
%%
@@ -46,14 +44,22 @@
^[[:digit:]]+ {
yylval->lineno = yyextra++;
yylloc->first_line = (int)yy_utils_strtol(yytext,NULL,10);
yylloc->first_line = (int)strtol(yytext,NULL,10);
return LINENO;
}
":" { return COLON; }
" " { return SPACE; }
"=" { return EQUAL; }
[[:alnum:]_]+ { yylval->str = yy_utils_strdup(yytext); return IDENT;}
[[:alnum:]_]+ { yylval->str = STRDUP(yytext); return IDENT;}
\r|\n { }
. { yyterminate();}
%%
static char* STRDUP(char* s1)
{
char* s2 = (char*)malloc(strlen(s1)+1);
sprintf(s2,"%s",s1);
return s2;
}
+1 -2
View File
@@ -21,9 +21,8 @@
* PURPOSE.
*/
<<<#include "bison_yylval_parser.h"
#include "bison_yylval_parser.h"
#include "bison_yylval_scanner.h"
#include "bison_yylval_scanner_char.h"
int main ( int argc, char** argv )
{
+2 -3
View File
@@ -34,14 +34,13 @@
#include "config.h"
#include "bison_yylval_parser.h"
#include "bison_yylval_scanner.h"
#include "bison_yylval_scanner_char.h"
#define YYERROR_VERBOSE 1
int yyerror(void* scanner, const char* msg);
/* A dummy function. A check against seg-faults in yylval->str. */
int process_text(YY_CHAR* s) {
int process_text(char* s) {
int total =0;
while(*s) {
total += (int) *s;
@@ -57,7 +56,7 @@ int process_text(YY_CHAR* s) {
%union {
long unused;
YY_CHAR * str;
char * str;
}
%token <str> TAGNAME TEXT
+11 -5
View File
@@ -27,7 +27,7 @@
#include <stdlib.h>
#include "bison_yylval_parser.h"
#include "config.h"
#include "strutils.h"
static char* STRDUP(char* s1);
enum yesno_t { no=0, yes=1 };
#define YY_EXTRA_TYPE enum yesno_t
@@ -37,8 +37,6 @@ enum yesno_t { no=0, yes=1 };
%option reentrant bison-bridge
%option header="bison_yylval_scanner.h"
%option noyywrap nomain nounput noyy_top_state noyywrap nodefault noinput warn
%option noyywrap nomain nounput noyy_top_state noyywrap nodefault warn
%option header-char="bison_yylval_scanner_char.h"
%option stack
@@ -54,14 +52,14 @@ enum yesno_t { no=0, yes=1 };
"</" { NEED_TAG_NAME= yes; yy_push_state( IN_TAG, yyscanner); return LTSLASH;}
"<"[^[:alpha:]] { yy_push_state(DISCARD_THRU_GT,yyscanner); }
"<" { NEED_TAG_NAME= yes; yy_push_state( IN_TAG, yyscanner); return LT; }
[^<]{1,512} { yyget_lval(yyscanner)->str = yy_utils_strdup(yytext); return TEXT;}
[^<]{1,512} { yyget_lval(yyscanner)->str = STRDUP(yytext); return TEXT;}
}
<IN_TAG>{
">" { yy_pop_state( yyscanner ); return GT; }
[[:alpha:]][[:alnum:]]* {
if( NEED_TAG_NAME == yes){
NEED_TAG_NAME=no;
yylval->str = yy_utils_strdup(yytext);
yylval->str = STRDUP(yytext);
return TAGNAME;
}
}
@@ -73,3 +71,11 @@ enum yesno_t { no=0, yes=1 };
">" { yy_pop_state(yyscanner);}
}
%%
static char* STRDUP(char* s1)
{
char* s2 = (char*)malloc(strlen(s1)+1);
sprintf(s2,"%s",s1);
return s2;
}
+7 -11
View File
@@ -38,17 +38,13 @@ main ( int argc, char** argv )
S1_FlexLexer* S1 = new S1_FlexLexer;
S2_FlexLexer* S2 = new S2_FlexLexer;
while(testlex(scanner)) {
YY_CHAR * text;
int line;
line = testget_lineno(scanner);
text = testget_text(scanner);
if( (char*)testget_extra(scanner) != extra)
break;
if ( !text || line < 0)
continue;
// scan simultaneously.
while(S1_ok || S2_ok)
{
if (S1_ok)
S1_ok = S1->yylex();
if (S2_ok)
S2_ok = S2->yylex();
}
printf("TEST RETURNING OK.\n");
delete S1;
+1 -1
View File
@@ -50,7 +50,7 @@ main ( int argc, char** argv )
assert(fp == stdout);
while(testlex(scanner)) {
YY_CHAR * text;
char * text;
int line;
line = testget_lineno(scanner);
text = testget_text(scanner);
+1 -1
View File
@@ -54,7 +54,7 @@ int include_stack_ptr = 0;
/* recurse */
yytext[yyleng-1]='\0';
include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
if((yyin=fopen((char*)yytext,"r"))==NULL) {
if((yyin=fopen(yytext,"r"))==NULL) {
fprintf(stderr,"*** Error: Could not open include file \"%s\".\n",yytext);
yyterminate();
}
+1 -1
View File
@@ -48,7 +48,7 @@
[[:alnum:]_.-]+> {
/* recurse */
yytext[yyleng-1]='\0';
if((yyin=fopen((char*)yytext,"r"))==NULL) {
if((yyin=fopen(yytext,"r"))==NULL) {
fprintf(stderr,"*** Error: Could not open include file \"%s\".\n",yytext);
yyterminate();
}
+1 -1
View File
@@ -51,7 +51,7 @@
yyscan_t scanner;
FILE * fp;
yytext[yyleng-1]='\0';
if((fp=fopen((char*)yytext,"r"))==NULL) {
if((fp=fopen(yytext,"r"))==NULL) {
fprintf(stderr,"*** Error: Could not open include file \"%s\".\n",
yytext);
yyterminate();
+2 -2
View File
@@ -46,7 +46,7 @@
FOO_flush_buffer((YY_BUFFER_STATE)0);
FOO_init_buffer((YY_BUFFER_STATE)0,(FILE*)0);
FOO_load_buffer_state();
FOO_scan_buffer((YY_CHAR*)0,(yy_size_t)0);
FOO_scan_buffer((char*)0,(yy_size_t)0);
FOO_scan_bytes((yyconst char*)0, 0);
FOO_scan_string((yyconst char*)0);
FOO_switch_to_buffer((YY_BUFFER_STATE)0);
@@ -55,7 +55,7 @@
yyleng = 0;
yylex();
yyrestart((FILE*)0);
yytext = (YY_CHAR*)0;
yytext = (char*)0;
}
}
%%
+1 -1
View File
@@ -47,7 +47,7 @@
FOO_flush_buffer( (YY_BUFFER_STATE)0, yyscanner);
FOO_init_buffer( (YY_BUFFER_STATE)0, (FILE*)0, yyscanner);
FOO_load_buffer_state( yyscanner);
FOO_scan_buffer( (YY_CHAR*)0, (yy_size_t)0, yyscanner);
FOO_scan_buffer( (char*)0, (yy_size_t)0, yyscanner);
FOO_scan_bytes( (yyconst char*)0, 0, yyscanner);
FOO_scan_string( (yyconst char*)0, yyscanner);
FOO_switch_to_buffer( (YY_BUFFER_STATE)0, yyscanner);
+3 -3
View File
@@ -61,7 +61,7 @@ int main(void);
int
main ()
{
YY_CHAR* buf;
char * buf;
int len;
YY_BUFFER_STATE state;
@@ -82,8 +82,8 @@ main ()
We make a copy, since the buffer will be modified by flex.*/
printf("Testing: yy_scan_buffer(%s): ",INPUT_STRING_1); fflush(stdout);
len = strlen(INPUT_STRING_1) + 2;
buf = (YY_CHAR*)malloc( len*sizeof(YY_CHAR) );
strcpy( (char*)buf, INPUT_STRING_1);
buf = (char*)malloc( len );
strcpy( buf, INPUT_STRING_1);
buf[ len -2 ] = 0; /* Flex requires two NUL bytes at end of buffer. */
buf[ len -1 ] =0;
+3 -3
View File
@@ -61,7 +61,7 @@ int main(void);
int
main ()
{
YY_CHAR * buf;
char * buf;
int len;
YY_BUFFER_STATE state;
yyscan_t scanner=NULL;
@@ -87,8 +87,8 @@ main ()
We make a copy, since the buffer will be modified by flex.*/
printf("Testing: yy_scan_buffer(%s): ",INPUT_STRING_1); fflush(stdout);
len = strlen(INPUT_STRING_1) + 2;
buf = (YY_CHAR*)malloc( len*sizeof(YY_CHAR) );
strcpy( (char*)buf, INPUT_STRING_1);
buf = (char*)malloc( len );
strcpy( buf, INPUT_STRING_1);
buf[ len -2 ] = 0; /* Flex requires two NUL bytes at end of buffer. */
buf[ len -1 ] =0;
-122
View File
@@ -1,122 +0,0 @@
/* 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
*/
/*
* Those are utility functions that are reimplementations of some standard
* C functions for strings manipulation, but using YY_CHAR macro instead of
* raw char type.
*
* These functions are only used in some test suites, not in the flex itself.
*/
#pragma once
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "strutils.h"
size_t yy_utils_strlen(YY_CHAR* str)
{
YY_CHAR *ptr = str;
while(*ptr != 0) ptr++;
return ptr-str;
}
YY_CHAR* yy_utils_strcpy(YY_CHAR *destination, const YY_CHAR *source)
{
YY_CHAR *ptr = destination;
while((*destination++ = *source++));
return ptr;
}
int yy_utils_strcmp(YY_CHAR *str1, YY_CHAR *str2)
{
while(*str1 == *str2++)
if(*str1++ == 0)
return 0;
return *str1 - *(str2-1);
}
YY_CHAR* yy_utils_strdup(YY_CHAR* s1)
{
YY_CHAR* s2 = (YY_CHAR*)malloc((yy_utils_strlen(s1)+1)*sizeof(YY_CHAR));
yy_utils_strcpy(s2, s1);
return s2;
}
bool yy_utils_isany(YY_CHAR ch, const YY_CHAR *set, size_t set_size) {
size_t i;
for(i = 0; i < set_size; ++i)
if(set[i] == ch)
return true;
return false;
}
bool yy_utils_isspace(YY_CHAR ch) {
static const YY_CHAR set[] = {' ', '\r', '\n', '\t'};
return yy_utils_isany(ch, set, sizeof(set)/sizeof(set[0]));
}
bool yy_utils_isupper(YY_CHAR ch) {
static const YY_CHAR set[] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
return yy_utils_isany(ch, set, sizeof(set)/sizeof(set[0]));
}
bool yy_utils_islower(YY_CHAR ch) {
static const YY_CHAR set[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
return yy_utils_isany(ch, set, sizeof(set)/sizeof(set[0]));
}
bool yy_utils_isdigit(YY_CHAR ch) {
static const YY_CHAR set[] = {'0','1','2','3','4','5','6','7','8','9'};
return yy_utils_isany(ch, set, sizeof(set)/sizeof(set[0]));
}
long int yy_utils_strtol(const YY_CHAR *str, YY_CHAR **endptr, int base)
{
while(yy_utils_isspace(*str)) str++;
bool neg = false;
if(*str == '-') neg = true, str++;
else if(*str == '+') str++;
YY_CHAR ch;
long int n = 0;
while((ch = *str++)) {
long int v = -1;
if(yy_utils_isdigit(ch))
v = ch-'0';
else if(yy_utils_isupper(ch))
v = ch-'A'+10;
else if(yy_utils_islower(ch))
v = ch-'a'+10;
else
break;
if(v >= base)
break;
n *= base;
n += v;
}
if(endptr)
*endptr = (YY_CHAR*)str-1;
if(neg)
n = -n;
return n;
}
-68
View File
@@ -1,68 +0,0 @@
# 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.
FLEX = $(top_builddir)/src/flex
cases := ISO-8859-1 EBCDIC-500 CP850
variants := r nr
test_variants := $(foreach variant,$(variants), test-charset-$(variant)-test)
LFILES := $(foreach VARIANT, $(VARIANTS), scanner-$(VARIANT).l)
CFILES := $(foreach VARIANT, $(VARIANTS), scanner-$(VARIANT).c)
EXEFILES := $(foreach VARIANT, $(VARIANTS), test-charset-$(VARIANT)$(EXEEXT))
test_case_files := $(foreach case,$(cases), test-$(case).input test-$(case).output)
EXTRA_DIST = scanner.l.in $(test_case_files)
CLEANFILES = $(LFILES) $(CFILES) $(EXEFILES)
AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir)/src -I$(top_builddir)
scanner-nr.l: $(srcdir)/scanner.l.in
m4 -P $< > $@
scanner-r.l: $(srcdir)/scanner.l.in
m4 -P -DVARIANT_REENTRANT=1 $< > $@
scanner-cxx.l: $(srcdir)/scanner.l.in
m4 -P -DVARIANT_CPLUSPLUS=1 $< > $@
scanner-%.c: scanner-%.l
$(FLEX) -o $@ $<
scanner.cpp: scanner-cxx.l
$(FLEX) -o $@ $<
test-charset-%$(EXEEXT): scanner-%.c
$(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) -o $@ $(LDFLAGS) $< $(LOADLIBES)
test-charset-cpp$(EXEEXT): scanner.cpp
$(CXX) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) -o $@ $(LDFLAGS) $< $(LOADLIBES)
test-charset-%-test: test-charset-%$(EXEEXT) test-charset-cpp
for c in $(cases) ; do \
(./$(<) $$c < $(srcdir)/test-$$c.input | diff -au - $(srcdir)/test-$$c.output) || (echo "Test $$exe failed in $$c case"; exit 1 ); \
done
test: $(test_variants)
-214
View File
@@ -1,214 +0,0 @@
/*
* 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.
*/
/*
* This test present ability to handle various encodings of incoming data
* by that same compiled parser. Test verifies ability to properly handle
* files in three encodings.
*
* This scanner file is written in ISO-8859-1 (LATIN-1), and this is also the
* first readable charset for generated scanner. Second and third, EBCDIC-500
* and CP850 are processed in charset_handler function provided in this .l file.
*
* This file generates both reentrant and no-reentrant scanners by being
* preprocessed by m4 with or without VARIANT_REENTRANT value defined.
*/
%{
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "config.h"
m4_ifdef(`VARIANT_REENTRANT', `#define VARIANT_REENTRANT 1', `')
m4_ifdef(`VARIANT_CPLUSPLUS', `#define VARIANT_CPLUSPLUS 1', `')
#if VARIANT_CPLUSPLUS
#define out(str) (*yyout << str)
#else
#define out(str) (fprintf(yyout, str))
#endif
%}
%option 8bit prefix="test" charset-source="ISO-8859-1"
%option nounput nomain noinput noyywrap charset
%option warn
m4_ifdef(`VARIANT_REENTRANT', `%option reentrant', `')
m4_ifdef(`VARIANT_CPLUSPLUS', `%option c++')
%%
[A-ZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ] { out("U"); }
[a-zàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿß] { out("L"); }
[0-9] { out("N"); }
%%
#if VARIANT_CPLUSPLUS
class TestFlexLexer: public yyFlexLexer {
public:
#endif
/*
* The function provided by scanner to handle encodings. It gets set of incoming
* bytes and convert into set of characters in internal representation - in the
* case of 7/8bit parsers, internal representation is always the same as
* "charset-source"
*
* charset - charset name (in ASCII)
* source - incoming bytes
* source_bytes - count of incoming bytes
* target - where to place output characters
* target_length - maximum number of characters (in YY_CHARs) that can be placed
* in "target" buffer
* converted_bytes - pointer to variable that should be set to number of bytes
* that has been properly converted from "source" buffer
*
* RETURNS: number of characters that has been written into "target" buffer.
* Must not be greater than value of "target_length" parameter.
*/
#if VARIANT_CPLUSPLUS
size_t yycharset_handler(char *charset, char* source, size_t source_bytes,
YY_CHAR* target, size_t target_length, size_t* converted_bytes)
#else
size_t charset_handler(char *charset, char* source, size_t source_bytes,
YY_CHAR* target, size_t target_length, size_t* converted_bytes
#if VARIANT_REENTRANT
, yyscan_t yyscanner
#endif
)
#endif
{
/* conversion from CP850 to ISO-8859-1. Unrepresentable values are set to -1 */
static int conversion_table_cp850[256] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
0xC7, 0xFC, 0xE9, 0xE2, 0xE4, 0xE0, 0xE5, 0xE7, 0xEA, 0xEB, 0xE8, 0xEF, 0xEE, 0xEC, 0xC4, 0xC5,
0xC9, 0xE6, 0xC6, 0xF4, 0xF6, 0xF2, 0xFB, 0xF9, 0xFF, 0xD6, 0xDC, 0xF8, 0xA3, 0xD8, 0xD7, -1,
0xE1, 0xED, 0xF3, 0xFA, 0xF1, 0xD1, 0xAA, 0xBA, 0xBF, 0xAE, 0xAC, 0xBD, 0xBC, 0xA1, 0xAB, 0xBB,
-1, -1, -1, -1, -1, 0xC1, 0xC2, 0xC0, 0xA9, -1, -1, -1, -1, 0xA2, 0xA5, -1,
-1, -1, -1, -1, -1, -1, 0xE3, 0xC3, -1, -1, -1, -1, -1, -1, -1, 0xA4,
0xF0, 0xD0, 0xCA, 0xCB, 0xC8, -1, 0xCD, 0xCE, 0xCF, -1, -1, -1, -1, 0xA6, 0xCC, -1,
0xD3, 0xDF, 0xD4, 0xD2, 0xF5, 0xD5, 0xB5, 0xFE, 0xDE, 0xDA, 0xDB, 0xD9, 0xFD, 0xDD, 0xAF, 0xB4,
0xAD, 0xB1, -1, 0xBE, 0xB6, 0xA7, 0xF7, 0xB8, 0xB0, 0xA8, 0xB7, 0xB9, 0xB3, 0xB2, -1, 0xA0
};
/* conversion from EBCDIC-500 to ISO-8859-1. Unrepresentable values are set to -1 */
static int conversion_table_ebcdic500[256] = {
0x00, 0x01, 0x02, 0x03, -1, 0x09, -1, 0x7F, -1, -1, -1, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, -1, 0x85, 0x08, -1, 0x18, 0x19, -1, -1, 0x1C, 0x1D, 0x1E, 0x1F,
-1, -1, -1, -1, -1, 0x0A, 0x17, 0x1B, -1, -1, -1, -1, -1, 0x05, 0x06, 0x07,
-1, -1, 0x16, -1, -1, -1, -1, 0x04, -1, -1, -1, -1, 0x14, 0x15, -1, 0x1A,
0x20, 0xA0, 0xE2, 0xE4, 0xE0, 0xE1, 0xE3, 0xE5, 0xE7, 0xF1, 0x5B, 0x2E, 0x3C, 0x28, 0x2B, 0x21,
0x26, 0xE9, 0xEA, 0xEB, 0xE8, 0xED, 0xEE, 0xEF, 0xEC, 0xDF, 0x5D, 0x24, 0x2A, 0x29, 0x3B, 0x5E,
0x2D, 0x2F, 0xC2, 0xC4, 0xC0, 0xC1, 0xC3, 0xC5, 0xC7, 0xD1, 0xA6, 0x2C, 0x25, 0x5F, 0x3E, 0x3F,
0xF8, 0xC9, 0xCA, 0xCB, 0xC8, 0xCD, 0xCE, 0xCF, 0xCC, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22,
0xD8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0xAB, 0xBB, 0xF0, 0xFD, 0xFE, 0xB1,
0xB0, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0xAA, 0xBA, 0xE6, 0xB8, 0xC6, 0xA4,
0xB5, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0xA1, 0xBF, 0xD0, 0xDD, 0xDE, 0xAE,
0xA2, 0xA3, 0xA5, 0xB7, 0xA9, 0xA7, 0xB6, 0xBC, 0xBD, 0xBE, 0xAC, 0x7C, 0xAF, 0xA8, 0xB4, 0xD7,
0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0xAD, 0xF4, 0xF6, 0xF2, 0xF3, 0xF5,
0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0xB9, 0xFB, 0xFC, 0xF9, 0xFA, 0xFF,
0x5C, 0xF7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0xB2, 0xD4, 0xD6, 0xD2, 0xD3, 0xD5,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, -1
};
static int *cnv = NULL;
if(strcmp(charset, "CP850") == 0)
cnv = conversion_table_cp850;
else if(strcmp(charset, "EBCDIC-500") == 0)
cnv = conversion_table_ebcdic500;
else
YY_FATAL_ERROR("Unknown encoding");
if(target_length < source_bytes)
YY_FATAL_ERROR("Too small buffer");
int i;
for(i = 0; i < source_bytes; ++i) {
char in = source[i];
int ch = cnv[(unsigned char)in];
if(ch == -1) {
char msg[256];
snprintf(msg, sizeof(msg), "Unsupported byte 0x%x",
(unsigned int)(unsigned char)in);
YY_FATAL_ERROR(msg);
}
target[i] = ch;
}
*converted_bytes = source_bytes;
return source_bytes;
}
#if VARIANT_CPLUSPLUS
};
#endif
int main (int argc, char *argv[])
{
if(argc < 2) {
fprintf(stderr, "USAGE: %s [CHARSET]", argv[0]);
return 1;
}
char *charset = argv[1];
#if VARIANT_CPLUSPLUS
TestFlexLexer lexer;
lexer.set_charset(charset);
assert(strcmp(lexer.get_charset(), charset)==0);
lexer.yylex();
#elif VARIANT_REENTRANT
yyscan_t lexer;
yylex_init(&lexer);
yyset_in(stdin, lexer);
yyset_out(stdout, lexer);
yyset_charset(charset, lexer);
assert(strcmp(yyget_charset(lexer), charset)==0);
yyset_charset_handler(charset_handler, lexer);
assert(yyget_charset_handler(lexer) == charset_handler);
yylex( lexer );
yylex_destroy( lexer);
#else
yyin = stdin;
yyout = stdout;
yycharset = charset;
yycharset_handler = charset_handler;
yylex();
#endif
return 0;
}
-1
View File
@@ -1 +0,0 @@
0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzキ��カιニ私醇酎€�叶ぴ意迦斎。ラ鈷錦ミ・、纒爐笂裝剩撥�鬟齧噤澈韈倔
-1
View File
@@ -1 +0,0 @@
NNNNNNNNNNULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULLL
-1
View File
@@ -1 +0,0 @@
�����チ�づζ����伊禾待蔦屯盤便儲鱗俛吮「罐荀螂讎遘險鬩dDeEbBfFcCgG棡hHtTqQrRsSxXuUvVwWャ景I楨﨩���€p�ン�゙錞�ュ紺釈Y
@@ -1 +0,0 @@
NNNNNNNNNNULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULLL
-1
View File
@@ -1 +0,0 @@
0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz类玲骡勉匿佩奇晴辱砷赎穗天晚晤巷叙疡因芋贼挣嘱伉蠃邡埯茳蔟撖��
@@ -1 +0,0 @@
NNNNNNNNNNULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULLL
-35
View File
@@ -1,35 +0,0 @@
# 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.
testname = test-tests_strutils
OBJS = test_strutils.o
AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir)/tests
$(testname)$(EXEEXT): $(OBJS)
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
test: $(testname)$(EXEEXT)
./$(testname)$(EXEEXT)
.c.o:
$(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
-81
View File
@@ -1,81 +0,0 @@
/* 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
*/
/*
* This test verifies that utility functions in `tests/strutils.h` are working
* properly.
*/
#include <stdint.h>
#include <stdio.h>
#define YY_CHAR uint32_t
#include "strutils.h"
#define STR(x) (#x)
#define CHECK(v) do{ \
if(!(v)) { \
fprintf(stderr, "Check failed: %s\n", STR(v)); \
return 1; \
} \
}while(0)
int main(int argc, char **argv) {
fprintf(stderr, "Starting strutils tests\n");
(void)argc;
(void)argv;
YY_CHAR str[] = {'W', 'h', 'a', 't', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 'g', '!', 0};
/* yy_utils_strlen */
CHECK(yy_utils_strlen(str) == 14);
/* yy_utils_strcpy, yy_utils_strcmp */
YY_CHAR dst1[15];
yy_utils_strcpy(dst1, str);
CHECK(yy_utils_strcmp(dst1, str) == 0);
/* yy_utils_strdup */
YY_CHAR *dst2 = yy_utils_strdup(str);
CHECK(yy_utils_strcmp(dst2, str) == 0);
free(dst2);
/* yy_utils_strtol */
YY_CHAR i1s[] = {' ', '\t', '\r', '\n', '1', '2', '3', 'a', 's', 'd', 0};
YY_CHAR *endptr;
CHECK(yy_utils_strtol(i1s, &endptr, 10) == 123);
CHECK(endptr == i1s+7);
CHECK(yy_utils_strtol(i1s, &endptr, 16) == 0x123a);
CHECK(endptr == i1s+8);
YY_CHAR i2s[] = {' ', '\t', '\r', '\n', '-', '1', '2', '3', 'a', 's', 'd', 0};
CHECK(yy_utils_strtol(i2s, &endptr, 10) == -123);
CHECK(endptr == i2s+8);
CHECK(yy_utils_strtol(i2s, &endptr, 16) == -0x123a);
CHECK(endptr == i2s+9);
fprintf(stderr, "Tests succeeded\n");
return 0;
}
+1 -1
View File
@@ -50,7 +50,7 @@ main ( int argc, char** argv )
assert(fp == stdout);
while(testlex(scanner)) {
YY_CHAR * text;
char * text;
int line;
line = testget_lineno(scanner);
text = testget_text(scanner);