5 Commits
176 changed files with 31930 additions and 17229 deletions
+4 -6
View File
@@ -1,8 +1,8 @@
*.orig
*.rej
*.sig
*.tar.bz2
*.tar.gz
*.tar.lz
*.tar.xz
*~
.deps
.libs
@@ -13,13 +13,11 @@ Makefile
Makefile.in
aclocal.m4
autom4te.cache
autoscan.log
build-aux/
config.log
config.status
configure
configure.scan
flex-*/
libtool
m4/
stamp-*
m4/
build-aux/
-50
View File
@@ -1,50 +0,0 @@
Aaron Stone <sodabrew@users.sourceforge.net>
Akim Demaille <akim@lrde.epita.fr>
Alastair Hughes <hobbitalastair@gmail.com>
Alex Kennedy <alexzanderkennedy@gmail.com>
Alexis La Goutte <alexis.lagoutte@gmail.com>
Bastian Köcher <git@kchr.de>
Christoph Junghans <ottxor@gentoo.org>
Christos Zoulas <christos@zoulas.com>
Cyril Brulebois <kibi@debian.org>
Demi Obenour <demiobenour@gmail.com>
Dennis Clarke <dclarke@blastwave.org>
Egor Pugin <egor.pugin@gmail.com>
Elias Pipping <pipping@users.sourceforge.net>
Explorer09 <explorer09@gmail.com>
Hans-Bernhard Broeker <HBBroeker@T-Online.de>
Harald van Dijk <harald@gigawatt.nl>
Hugh Sasse <hgs@dmu.ac.uk>
Jaska Uimonen <jaska.uimonen@helsinki.fi>
Jeff Smith <whydoubt@gmail.com>
John Millaway <john43@users.sourceforge.net>
Manoj Srivastava <srivasta@golden-gryphon.com>
Mariusz Pluciński <mplucinski@mplucinski.com>
Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Michael McConville <mmcconville@mykolab.com> <mmcco@mykolab.com>
Michael Reed <m.reed@mykolab.com>
Michael van Elst <mlelstv@NetBSD.org>
Mightyjo <mightyjo@gmail.com>
Mike Frysinger <vapier@gentoo.org>
OBATA Akio <obache@NetBSD.org>
Robert Larice <Robert.Larice@t-online.de> rlar <rlar>
Robert Larice <Robert.Larice@t-online.de> Robert.Larice Robert Larice <Robert.Larice@t-online.de>
Robert Minsk <rminsk@users.sourceforge.net>
Samuel Thibault <samuel.thibault@ens-lyon.org>
Sean McBride <sean@rogue-research.com>
Serguey Parkhomovsky <sergueyparkhomovsky@gmail.com> <xindigo@gmail.com>
Simon Sobisch <simonsobisch@web.de>
Stefan Reinauer <stefan.reinauer@coreboot.org>
Thomas Klausner <wiz@NetBSD.org>
Till Varoquaux <till.varoquaux@gmail.com>
Tobias Klauser <tklauser@distanz.ch>
Todd C. Miller <Todd.Miller@courtesan.com>
Translation Project <coordinator@translationproject.org> <coordinators@translationproject.org>
Translation Project <coordinator@translationproject.org> <translation@translationproject.org>
Vern Paxson <vern@ee.lbl.gov>
Will Estes <westes575@gmail.com> <wlestes@users.sourceforge.net>
Yuri <yuri@tsoft.com>
luistung <dongliang1986@gmail.com>
lukeallardyce <lukeallardyce@users.sourceforge.net>
nomis52 <nomis52@users.sourceforge.net>
viktor.shepel <shepelvictor@bigmir.net>
-1
View File
@@ -1 +0,0 @@
2.6.4
-24
View File
@@ -1,24 +0,0 @@
language: c
compiler:
- gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- autoconf
- bison
- gcc-6
- help2man
- lzip
- texinfo
- texlive
before_script:
- ./.travis/install-gettext.sh
- ./.travis/install-automake.sh
- export PATH=$HOME/bin:$PATH
script: ./autogen.sh && ./configure && make && make check && make distcheck
-24
View File
@@ -1,24 +0,0 @@
#!/bin/bash -ex
wget -nv https://ftp.gnu.org/gnu/automake/automake-1.15.1.tar.gz
# Verify tarball against hard-coded hashes. GPG signatures require an external
# keyserver which might be offline, which is undesirable for build server use.
# It's equally secure to just hard-code hashes, provided they're trusted (i.e.
# you verify a hash against a GPG signature once).
echo 'd3cd5fc9bbea9f977b51799180cde5d253dcba96 *automake-1.15.1.tar.gz'|
sha1sum -c || :
printf '%s *automake-1.15.1.tar.gz\n' \
f0d4717ebe2c76cec5d487de090f6e1c0f784b0d382fd964ffa846287e2a364a\
52531a26ab98b7033ac04ed302a247b3b114299def54819a03439bfc962ff61b|
sha512sum -c || :
tar xf automake-1.15.1.tar.gz
cd automake-1.15.1
# Don't flood Travis CI build log with dependency packages unless error occurs.
./configure --quiet --prefix="$HOME" ||
{ s=$? && cat config.log && (exit $s); }
make -s V=0 >/dev/null 2>&1 || make -s V=1
make -s install >make_install.log 2>&1 ||
{ s=$? && cat make_install.log && (exit $s); }
rm make_install.log || :
-25
View File
@@ -1,25 +0,0 @@
#!/bin/bash -ex
wget -nv https://ftp.gnu.org/gnu/gettext/gettext-0.19.8.1.tar.lz
# Verify tarball against hard-coded hashes. GPG signatures require an external
# keyserver which might be offline, which is undesirable for build server use.
# It's equally secure to just hard-code hashes, provided they're trusted (i.e.
# you verify a hash against a GPG signature once).
echo '404e072c455f79be4a2458863c19fb55a217771e *gettext-0.19.8.1.tar.lz'|
sha1sum -c || :
printf '%s *gettext-0.19.8.1.tar.lz\n' \
27c7a15be1ffd30a0182e264d0bf896850a295160872e1b1b9d1e9a15bc486cd\
93465c131f948206fa0bbe2e3eacfc8489dd0cfc5ea5dcf05eff3829e27fc60f|
sha512sum -c || :
tar xf gettext-0.19.8.1.tar.lz
cd gettext-0.19.8.1
# Don't flood Travis CI build log with dependency packages unless error occurs.
# libacl is not used in this Travis build system.
./configure --quiet --prefix="$HOME" --disable-acl ||
{ s=$? && cat config.log && (exit $s); }
make -s V=0 >/dev/null 2>&1 || make -s V=1
make -s install >make_install.log 2>&1 ||
{ s=$? && cat make_install.log && (exit $s); }
rm make_install.log || :
+107
View File
@@ -0,0 +1,107 @@
This is a list of bugs still in the queue at lex.sf.net at the time we closed
out the project and moved it to flex.sf.net.
-------------------------------------------------------------
Some strict compilers warn about a few internal flex variables signedness. They
are bogus warnings and can be ignored, but people send in reports nonethless.
-------------------------------------------------------------
The initializer of the yy_transition array in the
generated scanner
contains fewer entries than the declared size of the array.
Examples include yy_transition[6504] with 6250 entries,
yy_transition[13215] with 12961 entries. This looks
like it
is always 254 fewer entries than the declared size.
This bug is present in flex 2.5.4a as well. It appears to be harmless.
-------------------------------------------------------------
The examples in the chapter "Generating C++ Scanners"
contain suspicious code. Attached is a patch that
corrects this, and after these
modifications this example compiles and works.
-------------------------------------------------------------
C++ scanners derived from the yyFlexLexer base class
will not compile with flex-2.5.31 because the
&lt;FlexLexer.h&gt; automatically gets included into the
scanner twice. Because yyFlexLexer is now defined by
default even if no prefix is specified, including
FlexLexer.h twice causes the class yyFlexLexer to be
declared twice. In flex-2.5.4 because yyFlexLexer was
not defined by flex in the scanner code, including
FlexLexer.h more than once only declared yyFlexLexer
once. I appreciate that this is because of the M4
additions to flex, but I can not find a way to stop
flex defining yyFlexLexer if it is not needed.
Here is an example of a class that will not compile:
derived_lexer.h:
#ifndef __derived_lexer__
#define __derived_lexer__
#include &lt;FlexLexer.h&gt;
class derived_lexer : public yyFlexLexer
{
public:
derived_lexer(std::istream* arg_yyin = 0) :
yyFlexLexer(arg_yyin){}
int yylex();
int x;
};
#endif
derived_lexer.l:
%{
#include &quot;derived_lexer.h&quot;
%}
%option yyclass=&quot;derived_lexer&quot;
%%
[0-9]+ {
x = atoi(yytext);
}
%%
main.cpp:
#include &quot;derived_lexer.h&quot;
#include &lt;fstream&gt;
int main()
{
std::ifstream input;
input.open(&quot;input&quot;);
derived_lexer lexer(&amp;input);
lexer.yylex();
}
-------------------------------------------------------------
Hi, the anomally is that if I generate a c++ parser it will not make
yy_scan_buffer and friends.
this is happenning on flex version 2.5.4.
Is this the intent, if so how do I make a c++ parser read from my buffer?
P.S. in c++ it will only generate:
#ifndef YY_NO_SCAN_BUFFER
#endif
#ifndef YY_NO_SCAN_STRING
#endif
#ifndef YY_NO_SCAN_BYTES
#endif
-------------------------------------------------------------
-5
View File
@@ -1,5 +0,0 @@
# Contributor Code of Conduct
This project adheres to No Code of Conduct. We are all adults. We accept anyone's contributions. Nothing else matters.
For more information please visit the [No Code of Conduct](https://github.com/domgetter/NCoC) homepage.
+11 -34
View File
@@ -27,24 +27,28 @@
# and 7-bit scanners when using uncompressed tables (-f or -F options).
# For flex to always generate 8-bit scanners, add "-DDEFAULT_CSIZE=256"
# to DEFS.
#
# For Vax/VMS, add "-DVMS" to DEFS.
#
# For MS-DOS, add "-DMS_DOS" to DEFS. See the directory MISC/MSDOS for
# additional info.
ACLOCAL_AMFLAGS = -I m4
indent = @INDENT@
dist_doc_DATA = \
AUTHORS \
COPYING \
NEWS \
ONEWS \
README.md
README
EXTRA_DIST = \
.indent.pro
dist_noinst_SCRIPTS = \
autogen.sh \
po/update_linguas.sh
.indent.pro \
autogen.sh
SUBDIRS = \
lib \
src \
doc \
examples \
@@ -52,29 +56,6 @@ SUBDIRS = \
tests \
tools
# Convenience targets to build libfl only
# These are actually wrappers around automake- and libtool-generated targets
libfl:
cd src && $(MAKE) $(AM_MAKEFLAGS) libfl.la libfl.pc
install-libfl:
cd src && \
$(MAKE) $(AM_MAKEFLAGS) lib_LTLIBRARIES=libfl.la \
pkgconfig_DATA=libfl.pc install-libLTLIBRARIES install-pkgconfigDATA
uninstall-libfl:
cd src && \
$(MAKE) $(AM_MAKEFLAGS) \
lib_LTLIBRARIES=libfl.la pkgconfig_DATA=libfl.pc \
uninstall-libLTLIBRARIES uninstall-pkgconfigDATA
# libfl.pc is cleaned via 'distclean' target
clean-libfl:
cd src && \
$(MAKE) $(AM_MAKEFLAGS) lib_LTLIBRARIES=libfl.la clean-libLTLIBRARIES \
clean-libtool
# Create the ChangeLog, but only if we're inside a git working directory
ChangeLog: $(srcdir)/tools/git2cl
@@ -82,12 +63,8 @@ ChangeLog: $(srcdir)/tools/git2cl
$(srcdir)/tools/git2cl > $@ \
; fi
indent:
cd src && $(MAKE) $(AM_MAKEFLAGS) indent
install-exec-hook:
cd $(DESTDIR)$(bindir) && \
$(LN_S) -f flex$(EXEEXT) flex++$(EXEEXT)
.PHONY: libfl install-libfl uninstall-libfl clean-libfl \
ChangeLog indent
.PHONY: ChangeLog tags indent
+4 -270
View File
@@ -1,273 +1,9 @@
flex NEWS
This is the file NEWS for the flex package. It records user -visible
changes between releases of flex.
* Noteworthy changes in release ?.? (????-??-??) [?]
See the file COPYING for copying conditions.
** build
*** Flex now includes its own <config.h> header before including
system headers so that any system specific features detected by
configure are taken into account during compilation of flex
itself.
*** The flex build system now includes Makefile targets at the top
level to allow just building and installing libfl.
*** The flex distribution now includes a file, src/libfl.pc, to allow
using pkgconfig to find out what flags to use when building
against libfl from flex.
*** Various edge cases, mostly involving out-of-tree builds have been
accounted for in the autotools build system.
*** A crash during building on NetBSD has been fixed.
*** Flex is now automatically built by travis-ci. That should increase
the visibility of bugs and help prevent regressions.
** documentation
*** new bg, pt, uk translations from the translation project
** scanner
*** Some memory leaks have been fixed.
*** A long standing bug that effected expressions of the form c{i,j}
where 'c' is a character and {i,j} describes the number of times
to match against 'c' when case sensitivity was turned on has been
fixed.
*** New option: --backup-file allows setting the name of the file
written containing backing up information. Useful if you need
backing up information from multiple scanners in the same
directory.
*** flex emits correct line number directives when line numbers refer
to the file containing the line number directives.
*** The options {no,}yy{get,set}_column are now supported.
** test
*** Generating the various tableoptions make rules is now more portable.
*** Tests of the options -C*f and -C*F will now run correctly on
filesystems that are not case sensitive.
* Noteworthy changes in release 2.6.4 (2017-05-06) [stable]
** build
*** The indent target now knows about flex's new (as of 2.6.0)
layout. The indent rules it would apply are not correct and do
need to be fixed.
*** The files included in the flex distribution are now built by the
version of flex that is included in the distribution.
*** The configure script has a better idea of which headers are
required to build flex. It will also error when missing functions
are detected.
*** We have lowered the versions of automake and gettext that
configure.ac lists as required for building flex. In autogen.sh,
we now check for how to call libtoolize and use what we find in
the rest of the script.
*** Since files in lib/ are picked up as needed by src/, we no longer
generate a Makefile for that directory.
*** Flex can be cross compiled.
** documentation
*** Some typos were removed from the manual.
** scanner
*** Some minor performance enhancements.
*** We honor user defined yy_* macros again. We are also more careful
to not leak macro definitions into header files.
*** A number of portability fixes were introduced so building flex is
more reliable on more platforms. Additionally, outdated function
calls were removed.
*** When building the flex executable itself, %# comments from
flex.skl are removed when generating the C source code array. This
reduces the size of flex.
** test suite
*** All scripts in the test suite are now run by $(SHELL) and the
needed portability fixes have been included.
*** Test suite dependencies are handled much better. This only matters
if you are actively developing flex or its test suite.
*** Tests that depend on platform dependent features now properly skip
when those platforms are not present.
*** When running "make check", you can now pas V=0 to silence more of
the build. This is useful when you're less connncerned about the
details of building and linking the test programs themselves.
* Noteworthy changes in release 2.6.3 (2016-12-30) [stable]
** scanner
*** several bug fixes resolved problems introduced in recent flex
versions regarding processing of comments, literals and various
quoting scenarios.
*** If the path to m4 was sufficiently long, a buffer overflow could
occur. This has been resolved. The fix also removes dependence on
the constant PATH_MAX.
** build
*** A new configure option --disable-bootstrap changes the behavior of
the build system when building flex. The default
"--enable-bootstrap" behavior is to build flex, then to use that
flex to build flex again. With --disable-bootstrap, the scanner is
simply built by sedding the scanner source. This is friendlier to
cross compilation.
*** The compatibility functions in lib/ are no longer built as a
library. Instead, they are built as $(LIBOBJ) objects. This is
simpler and friendlier to cross compilation.
*** It is now possible to build flex without building the accompanying
libfl. This is friendlier to cross compilation. See the
--disable-libfl option to configure. Resolves #99.
*** the PIC version of libfl was not correctly built. It is no longer
included in the build/installation targets of flex since it was
unused.
*** the distributed man page is only rebuilt when the relevant source
files change or when the binary doesn't exist. In particular, this
is friendlier to cross compilation. Resolves #108
** test
*** the shell scripts in the test suite are more portable across different shell implementations.
* version 2.6.2 released 2016-10-24
** flex internals
*** a segfalt involving yyrestart(NULL) has been fixed
*** flex should now handle quoting when mixed with m4 processing correctly
*** flex handles `[[' and `]]' correctly
*** flex no longer generates non-ANSI code
*** more compilation warnings were squashed in generated scanners
*** prevented a buffer overflow that could occur when input buffers were the exact wrong size
** test suite
*** input filenames on MSWindows are now calculated correctly
*** general code cleanups in a number of tests now make the test suite compile much more cleanly
** build system
*** the xz archive has been replaced with an lzip archive
*** a new option to configure --enable-warnings to encapsulate passing
of warning-related flags which is useful in testing flex
*** make indent now works for out of source builds
*** Portability warnings when generating Makefile.in files are now suppressed; they were just noise and the use of GNU extensions in Makefile.{am,in,} was intentional and well known.
** bugs
*** resolved gh#67
** new sv translation from the translation project
* version 2.6.1 released 2016-03-01
** flex resources
*** The flex project is now hosted at github. Consider this a "period of transition". In particular, you should start at https://github.com/westes/flex for the flex codebase, issue tracking and pull requests.
*** New releases of flex are to be found at https://github.com/westes/flex/releases.
** flex internals
*** Flex now uses more modern and more standard names for variable types. There's more work to be done on that front yet, though.
*** A number of compiler warnings have been remedied.
*** Line directives should now work as expected and be absent when that is expected.
** test suite
*** When running the test suite, c++ files are compiled with the c++ header inside the flex distribution, rather than relying on the build system's flex header , which might not be installed yet or which might be out of date with respect to what flex tests expect.
*** Some portability fixes in the test suite such as opening files for reading in binary mode
** Building flex
*** The file src/scan.c asdistributed with flex source is now built with the current version of flex. Occasionally this had to be done manually to pick up new flex features. It's now just a part of flex's build system.
*** The pdf version of the manual is no longer distributed with flex, although if you have the texinfo package installed, you can still build it.
*** lots of general build system cleanup
*** the build system tries a bit harder to find libtoolize and texi2dvi.
*** When help2man and texi2dvi are missing, the error messages are now much more helpful.
** bug fixes
*** resolved github issues #53, #54, #55, #61.
*** Resolved sf bugs #128, #129, #155, #160, #184, #187, #195.
* 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
* version 2.6.0-pre
* flex version 2.5.39 released 2014-03-26
@@ -792,8 +528,6 @@ But the inverse is still true
See the file ONEWS for changes in earlier releases.
See the file COPYING for copying conditions.
Local Variables:
mode: text
mode: outline-minor
+113
View File
@@ -0,0 +1,113 @@
This is flex, the fast lexical analyzer generator.
flex is a tool for generating scanners: programs which recognize
lexical patterns in text.
More information about flex as well as the latest official release of
flex can be found at:
http://flex.sourceforge.net/
Bug reports should be submitted using the SourceForge Bug Tracker for
flex at:
http://sourceforge.net/tracker/?group_id=97492&atid=618177
The flex codebase is kept in git at:
https://github.com/westes/flex
There are several mailing lists available as well:
flex-announce@lists.sourceforge.net - where posts will be made
announcing new releases of flex.
flex-help@lists.sourceforge.net - where you can post questions about
using flex
flex-devel@lists.sourceforge.net - where you can discuss development of
flex itself
Find information on subscribing to the mailing lists at:
http://sourceforge.net/mail/?group_id=97492
The flex distribution contains the following files which may be of interest:
README - This file.
NEWS - current version number and list of user-visible changes.
INSTALL - basic installation information.
ABOUT-NLS - description of internationalization support in flex.
COPYING - flex's copyright and license.
doc/ - user documentation.
examples/ - containing examples of some possible flex scanners and a
few other things. See the file examples/README for more details.
TODO - outstanding bug reports, desired features, etc.
tests/ - regression tests. See TESTS/README for details.
po/ - internationalization support files.
You need the following tools to build flex from the maintainer's
repository:
compiler suite - flex is built with gcc
bash, or a good Bourne-style shell
m4 - m4 -p needs to work; GNU m4 and a few others are suitable
GNU bison; to generate parse.c from parse.y
autoconf 2.69; for handling the build system
automake 1.12.2; for Makefile generation
gettext 0.18; fori18n support
help2man 1.36; to generate the flex man page
tar, gzip, etc.; for packaging of the source distribution
GNU texinfo 498; to build and test the flex manual
GNU indent 2.8; for indenting the flex source the way we want it done
Once you have all the necessary tools installed, life becomes
simple. To prepare the flex tree for building, run the script:
$ ./autogen.sh
in the top level of the flex source tree.
This script calls the various tools needed to get flex ready for the
GNU-style configure script to be able to work.
From this point on, building flex follows the usual configure, make,
make install routine.
This file is part of flex.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
-114
View File
@@ -1,114 +0,0 @@
[![Build Status](https://travis-ci.org/westes/flex.svg?branch=master)](https://travis-ci.org/westes/flex)
This is flex, the fast lexical analyzer generator.
flex is a tool for generating scanners: programs which recognize
lexical patterns in text.
The flex codebase is kept in
[Git on GitHub.](https://github.com/westes/flex) Source releases of flex with some intermediate files already built can be found on [the github releases page.](https://github.com/westes/flex/releases)
Use GitHub's [issues](https://github.com/westes/flex/issues) and
[pull request](https://github.com/westes/flex) features to file bugs
and submit patches.
There are several mailing lists available as well:
* flex-announce@lists.sourceforge.net - where posts will be made
announcing new releases of flex.
* flex-help@lists.sourceforge.net - where you can post questions about
using flex
* flex-devel@lists.sourceforge.net - where you can discuss development
of flex itself
Find information on subscribing to the mailing lists or search in the
archive at: https://sourceforge.net/p/flex/mailman/
Note: Posting is only allowed from addresses that are subscribed to
the lists.
The flex distribution contains the following files which may be of
interest:
* README - This file.
* NEWS - current version number and list of user-visible changes.
* INSTALL - basic installation information.
* ABOUT-NLS - description of internationalization support in flex.
* COPYING - flex's copyright and license.
* doc/ - user documentation.
* examples/ - containing examples of some possible flex scanners and a
few other things. See the file examples/README for more
details.
* tests/ - regression tests. See TESTS/README for details.
* po/ - internationalization support files.
You need the following tools to build flex from the maintainer's
repository:
* compiler suite - flex is built with gcc
* bash, or a good Bourne-style shell
* m4 - `m4 -P` needs to work; GNU m4 and a few others are suitable
* GNU bison; to generate parse.c from parse.y
* autoconf; for handling the build system
* automake; for Makefile generation
* gettext; for i18n support
* help2man; to generate the flex man page
* tar, gzip, lzip, etc.; for packaging of the source distribution
* GNU texinfo; to build and test the flex manual. Note that if you want
to build the dvi/ps/pdf versions of the documentation you will need
texi2dvi and related programs, along with a sufficiently powerful
implementation of TeX to process them. See your operating system
documentation for how to achieve this. The printable versions of the
manual are not built unless specifically requested, but the targets
are included by automake.
* GNU indent; for indenting the flex source the way we want it done
In cases where the versions of the above tools matter, the file
configure.ac will specify the minimum required versions.
Once you have all the necessary tools installed, life becomes
simple. To prepare the flex tree for building, run the script:
```bash
./autogen.sh
```
in the top level of the flex source tree.
This script calls the various tools needed to get flex ready for the
GNU-style configure script to be able to work.
From this point on, building flex follows the usual routine:
```bash
configure && make && make install
```
---
This file is part of flex.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
+66
View File
@@ -0,0 +1,66 @@
* the manual:
** do an end-to-end proofread of the manual (this is under way, but is
going slowly)
** pretty up the dvi output; overflows, etc.
** faq
*** clean up the faqs section. The information is good; the texinfo
could use some touching up.
*** index the faq entries
*** mention that it's possible to use a variable to scan matching
brackets, nested comments etc.
*** include something about lexing/parsing fortran
** create a section on flex design, features, etc.
* getext
** make sure all flex modules use gettext translation facilities
*subdirectories
** in examples/manual, integrate the Makefile.examples into the
Makefile.am
* test suite
** integrate the test suite into automake's framework (note that the
test suite can be run from the top level directory with "make
check". Still, we want to get it completely under automake's control.)
** make test suite more complete
* generic coding
** move as much skeleton code as possible out of gen.c and into
flex.skl
** figure out whether we want to add the capability to have
auto-generated backout rules
** token-type and token buffer support
** check if we still need to #undef macros at the end of a header
** merge yylineno into support for location tracking
** bug where yylineno is not decremented on REJECT
** bug where yylineno is counted in trailing context
* C++
** have a separate skeleton for c++
** revisit the C++ API. We get requests to make it more complete.
Local Variables:
Mode: text
mode: outline-minor
End:
+2 -21
View File
@@ -24,28 +24,9 @@
# If you see no configure script, then run ./autogen.sh to create it
# and procede with the "normal" build procedures.
# use LIBTOOLIZE, if set
LIBTOOLIZE_ORIG="$LIBTOOLIZE";
if test "x$LIBTOOLIZE" = "x"; then LIBTOOLIZE=libtoolize; fi
# test libtoolize
$LIBTOOLIZE --version 2>/dev/null
if test "$?" -ne 0; then
LIBTOOLIZE=glibtoolize
$LIBTOOLIZE --version 2>/dev/null
if test "$?" -ne 0; then
echo "error: libtoolize not working, re-run with LIBTOOLIZE=/path/to/libtoolize"
echo " LIBTOOLIZE is currently \"$LIBTOOLIZE_ORIG\""
exit 1
fi
fi
#if we pretend to have a ChangeLog, then automake is less
#worried. (Don't worry, we *do* have a ChangeLog, we just need the
#Makefile first.)
if ! test -f ChangeLog; then
touch ChangeLog
fi
"$LIBTOOLIZE" --install --force
autoreconf --install --force
touch ChangeLog
autoreconf --install --verbose --force
+30 -90
View File
@@ -24,79 +24,33 @@
# autoconf requirements and initialization
AC_INIT([the fast lexical analyser generator],[2.6.4],[flex-help@lists.sourceforge.net],[flex])
AC_PREREQ([2.60])
AC_INIT([the fast lexical analyser generator], [2.6.0-pre],
[flex-help@lists.sourceforge.net], [flex])
AC_CONFIG_SRCDIR([src/scan.l])
AC_CONFIG_AUX_DIR([build-aux])
AC_USE_SYSTEM_EXTENSIONS
LT_INIT
AM_INIT_AUTOMAKE([1.15 -Wno-portability foreign std-options dist-lzip parallel-tests subdir-objects])
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)
# checks for programs
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.7])
AM_GNU_GETTEXT_VERSION([0.19])
AC_PROG_YACC
AS_IF([test "$YACC" != 'bison -y'], [
YACC="\${top_srcdir}/build-aux/missing bison -y"
AC_MSG_NOTICE(no bison program found: only required for maintainers)
])
AM_CONDITIONAL([HAVE_BISON], [test "$YACC" = 'bison -y'])
AM_PROG_LEX
AC_PROG_CC
AX_PROG_CC_FOR_BUILD
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_LN_S
AC_PROG_AWK
AC_PROG_INSTALL
pkgconfigdir=${libdir}/pkgconfig
AC_SUBST(pkgconfigdir)
# allow passing a variable `WARNINGFLAGS',
# either when invoking `configure', or when invoking `make'
# default to something useful if GCC was detected
AC_ARG_ENABLE([warnings],
[AS_HELP_STRING([--enable-warnings],
[enable a bunch of compiler warning flags (defaults to GCC warning flags).])],
[AS_IF([test "x$GCC" = xyes],
[ : ${WARNINGFLAGS="-Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wconversion -Wno-unused-but-set-variable"} ])])
AC_SUBST([WARNINGFLAGS])
AC_ARG_ENABLE([libfl],
[AS_HELP_STRING([--disable-libfl],
[do not build -lfl runtime support library])],
[], [enable_libfl=yes])
AM_CONDITIONAL([ENABLE_LIBFL], [test "x$enable_libfl" = xyes])
# --disable-bootstrap is intended only to workaround problems with bootstrap
# (e.g. when cross-compiling flex or when bootstrapping has bugs).
# Ideally we should be able to bootstrap even when cross-compiling.
AC_ARG_ENABLE([bootstrap],
[AS_HELP_STRING([--disable-bootstrap],
[don't perform a bootstrap when building flex])],
[], [enable_bootstrap=yes])
AM_CONDITIONAL([ENABLE_BOOTSTRAP], [test "x$enable_bootstrap" = xyes])
AM_CONDITIONAL([CROSS], [test "x$cross_compiling" = xyes])
AC_PATH_PROG([HELP2MAN], help2man, [\${top_srcdir}/build-aux/missing help2man])
AS_IF([test "$HELP2MAN" = "\${top_srcdir}/build-aux/missing help2man"],
AC_MSG_WARN(help2man: program not found: building man page will not work)
)
AC_PATH_PROGS([TEXI2DVI], [gtexi2dvi texi2dvi], [\${top_srcdir}/build-aux/missing texi2dvi])
AS_IF([test "$TEXI2DVI" = "\${top_srcdir}/build-aux/missing texi2dvi"],
AC_MSG_WARN(texi2dvi: program not found: building pdf version of manual will not work)
)
AC_PATH_PROG(BISON, bison,bison)
AC_PATH_PROG(HELP2MAN, help2man, help2man)
# Check for a m4 that supports -P
@@ -109,20 +63,25 @@ AC_CACHE_CHECK([for m4 that supports -P], [ac_cv_path_M4],
AC_SUBST([M4], [$ac_cv_path_M4])
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the m4 executable name.])
AC_PATH_PROG([INDENT], indent, [\${top_srcdir}/build-aux/missing indent])
AC_MSG_CHECKING(if $INDENT is GNU indent)
AS_IF([$INDENT --version 2>/dev/null | head -n 1 | grep "GNU indent" >/dev/null],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
AC_MSG_WARN($INDENT does not appear to be GNU indent; 'make indent' may not function properly)
])
AC_PATH_PROG(INDENT, indent, indent)
# if INDENT is set to 'indent' then we didn't find indent
if test "$INDENT" != indent ; then
AC_MSG_CHECKING(if $INDENT is GNU indent)
if $INDENT --version 2>/dev/null | head -n 1|grep "GNU indent" > /dev/null ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_WARN($INDENT does not appear to be GNU indent.)
fi
else
AC_MSG_WARN(no indent program found: make indent target will not function)
fi
# checks for headers
AC_CHECK_HEADERS([regex.h strings.h sys/stat.h sys/wait.h unistd.h], [],
[AC_MSG_ERROR(required header not found on your system)])
AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h])
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h regex.h stddef.h stdlib.h string.h strings.h unistd.h])
# checks for libraries
@@ -130,12 +89,12 @@ AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h])
# all we need is the preprocessor symbol defined since we don't need
# LIBS to include libpthread for building flex.
LIBPTHREAD=''
AC_CHECK_LIB(pthread, pthread_mutex_lock,
[AC_CHECK_HEADERS([pthread.h], [LIBPTHREAD=-lpthread],
[AC_MSG_WARN([pthread tests will be skipped])])],
[AC_MSG_WARN([pthread tests will be skipped])])
AC_SUBST([LIBPTHREAD])
AC_DEFINE([HAVE_LIBPTHREAD], 1, [pthread library] ),
AC_DEFINE([HAVE_LIBPTHREAD], 0, [pthread library] )
)
AC_CHECK_HEADERS([pthread.h])
AM_CONDITIONAL([want_pthread], [test x$ac_cv_lib_pthread_pthread_mutex_lock = xyes])
AC_CHECK_LIB(m, log10)
@@ -149,28 +108,9 @@ AC_TYPE_SIZE_T
AC_FUNC_ALLOCA
AC_FUNC_FORK
dnl Autoconf bug: AC_FUNC_MALLOC and AC_FUNC_REALLOC might not warn of cross
dnl compilation. Workaround this.
AC_FUNC_MALLOC
AS_IF([test "$cross_compiling" = yes],
AC_MSG_WARN([result $ac_cv_func_malloc_0_nonnull guessed because of cross compilation]))
AC_FUNC_REALLOC
AS_IF([test "$cross_compiling" = yes],
AC_MSG_WARN([result $ac_cv_func_realloc_0_nonnull guessed because of cross compilation]))
dnl Autoheader (<= 2.69) bug: "dnl" comments in a quoted argument of
dnl AC_CHECK_FUNCS will expand wierdly in config.h.in.
dnl (https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html)
AC_CHECK_FUNCS([dup2 memset regcomp strcasecmp strchr strdup strtol], [],
[AC_MSG_ERROR(required library function not found on your system)])
# Optional library functions:
# pow - Used only by "examples/manual/expr".
# setlocale - Needed only if NLS is enabled.
# reallocarr - NetBSD function. Use reallocarray if not available.
# reallocarray - OpenBSD function. We have replacement if not available.
AC_CHECK_FUNCS([pow setlocale reallocarr reallocarray])
AC_CHECK_FUNCS([dup2 isascii memset pow regcomp setlocale strchr strtol])
AC_CONFIG_FILES(
Makefile
@@ -178,8 +118,8 @@ doc/Makefile
examples/Makefile
examples/fastwc/Makefile
examples/manual/Makefile
lib/Makefile
po/Makefile.in
src/libfl.pc
src/Makefile
tools/Makefile
tests/Makefile
+26 -9
View File
@@ -1,14 +1,31 @@
FLEX = $(top_builddir)/src/flex$(EXEEXT)
help2man = @HELP2MAN@
info_TEXINFOS = flex.texi
dist_man_MANS = flex.1
MAINTAINERCLEANFILES = flex.1
dist_doc_DATA= flex.pdf
CLEANFILES = *.aux *.cp *.cps *.fn *.fns *.hk *.hks *.ky *.log \
*.op *.ops *.pg *.toc *.tp *.tps *.vr *.vrs
CLEANFILES = \
flex.aux \
flex.cp \
flex.cps \
flex.fn \
flex.fns \
flex.hk \
flex.hks \
flex.ky \
flex.log \
flex.op \
flex.ops \
flex.pg \
flex.toc \
flex.tp \
flex.tps \
flex.vr \
flex.vrs
flex.1: $(top_srcdir)/configure.ac $(top_srcdir)/src/cpp-flex.skl $(top_srcdir)/src/options.c $(top_srcdir)/src/options.h | $(FLEX)
$(HELP2MAN) --name='$(PACKAGE_NAME)' --section=1 \
--source='The Flex Project' --manual='Programming' \
--output=$@ $(FLEX) \
|| rm -f $@
$(dist_man_MANS): $(top_srcdir)/src/main.c
for i in $(dist_man_MANS) ; do \
$(help2man) --name='$(PACKAGE_NAME)' \
--section=`echo $$i | sed -e 's/.*\.\([^.]*\)$$/\1/'` \
$(top_srcdir)/src/flex$(EXEEXT) > $$i || rm -f $$i ; \
done
+36 -155
View File
@@ -192,7 +192,7 @@ FAQ
* How can I build a two-pass scanner?::
* How do I match any string not matched in the preceding rules?::
* I am trying to port code from AT&T lex that uses yysptr and yysbuf.::
* Is there a way to make flex treat NUL like a regular character?::
* Is there a way to make flex treat NULL like a regular character?::
* Whenever flex can not match the input it says "flex scanner jammed".::
* Why doesn't flex have non-greedy operators like perl does?::
* Memory leak - 16386 bytes allocated by malloc.::
@@ -269,7 +269,6 @@ Appendices
* Bison Bridge::
* M4 Dependency::
* Common Patterns::
* Adding More Target Languages
Indices
@@ -297,7 +296,8 @@ Indices
@cindex reporting bugs
If you find a bug in @code{flex}, please report it using
GitHub's issue tracking facility at @url{https://github.com/westes/flex/issues/}
the SourceForge Bug Tracking facilities which can be found on
@url{http://sourceforge.net/projects/flex,flex's SourceForge Page}.
@node Introduction, Simple Examples, Reporting Bugs, Top
@chapter Introduction
@@ -409,7 +409,7 @@ A somewhat more complicated example:
"+"|"-"|"*"|"/" printf( "An operator: %s\n", yytext );
"{"[^{}\n]*"}" /* eat up one-line comments */
"{"[\^{}}\n]*"}" /* eat up one-line comments */
[ \t\n]+ /* eat up whitespace */
@@ -735,7 +735,7 @@ if X is @samp{a}, @samp{b}, @samp{f}, @samp{n}, @samp{r}, @samp{t}, or
@samp{v}, then the ANSI-C interpretation of @samp{\x}. Otherwise, a
literal @samp{X} (used to escape operators such as @samp{*})
@cindex NUL character in patterns, syntax of
@cindex NULL character in patterns, syntax of
@item \0
a NUL character (ASCII code 0)
@@ -1492,14 +1492,15 @@ the scanning routine using a K&R-style/non-prototyped function
declaration, you must terminate the definition with a semi-colon (;).
@code{flex} generates @samp{C99} function definitions by
default. Flex used to have the ability to generate obsolete, er,
@samp{traditional}, function definitions. This was to support
default. However flex does have the ability to generate obsolete, er,
@samp{traditional}, function definitions. This is to support
bootstrapping gcc on old systems. Unfortunately, traditional
definitions prevent us from using any standard data types smaller than
int (such as short, char, or bool) as function arguments. Furthermore,
traditional definitions support added extra complexity in the skeleton file.
For this reason, current versions of @code{flex} generate standard C99 code
only, leaving K&R-style functions to the historians.
int (such as short, char, or bool) as function arguments. For this
reason, future versions of @code{flex} may generate standard C99 code
only, leaving K&R-style functions to the historians. Currently, if you
do @strong{not} want @samp{C99} definitions, then you must use
@code{%option noansi-definitions}.
@cindex stdin, default for yyin
@cindex yyin
@@ -1979,23 +1980,15 @@ as though you had used
@deftypefun void yy_pop_state ()
pops the top of the stack and switches to it via
@code{BEGIN}.
The program execution aborts, if there is no state on the stack.
@end deftypefun
@deftypefun int yy_top_state ()
returns the top of the stack without altering the stack's contents
if a top state on the stack exists or the current state via
@code{YY_START}
otherwise.
returns the top of the stack without altering the stack's contents.
@end deftypefun
@cindex memory, for start condition stacks
The start condition stack grows dynamically and so has no built-in size
limitation. If memory is exhausted, program execution aborts.
The stack is not automatically reset. The function
@code{yylex_destroy}
should be called to reset and destroy the state stack which then frees
other resources used by the scanner.
To use start condition stacks, your scanner must include a @code{%option
stack} directive (@pxref{Scanner Options}).
@@ -2191,7 +2184,7 @@ manages its own input buffer stack manually (instead of letting flex do it).
}
<<EOF>> {
if ( --include_stack_ptr == 0 )
if ( --include_stack_ptr 0 )
{
yyterminate();
}
@@ -2868,13 +2861,19 @@ calls @code{yylex()} again).
@opindex ---option-ansi-definitions
@opindex ansi-definitions
@item --ansi-definitions, @code{%option ansi-definitions}
Deprecated, ignored
instruct flex to generate ANSI C99 definitions for functions.
This option is enabled by default.
If @code{%option noansi-definitions} is specified, then the obsolete style
is generated.
@anchor{option-ansi-prototypes}
@opindex ---option-ansi-prototypes
@opindex ansi-prototypes
@item --ansi-prototypes, @code{%option ansi-prototypes}
Deprecated, ignored
instructs flex to generate ANSI C99 prototypes for functions.
This option is enabled by default.
If @code{noansi-prototypes} is specified, then
prototypes will have empty parameter lists.
@anchor{option-bison-bridge}
@opindex ---bison-bridge
@@ -3765,7 +3764,8 @@ 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 in @file{FlexLexer.h}, @code{FlexLexer},
The first class,
@code{FlexLexer},
provides an abstract base class defining the general scanner class
interface. It provides the following member functions:
@@ -3799,10 +3799,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 reference and not a
first argument is an @code{istream*} object pointer 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 reference).
@code{yyrestart()} (again, the first argument is a @code{istream*}
object pointer).
@tindex yyFlexLexer (C++ only)
@tindex FlexLexer (C++ only)
@@ -3813,12 +3813,9 @@ 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{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.
@code{cout}, respectively.
@findex yylex (C++ version)
@item virtual int yylex()
@@ -3835,13 +3832,11 @@ 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
@@ -3898,7 +3893,7 @@ Here is an example of a simple C++ scanner:
int mylineno = 0;
%}
%option noyywrap c++
%option noyywrap
string \"[^\n"]+\"
@@ -3943,9 +3938,6 @@ 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;
@@ -4918,10 +4910,8 @@ custom allocator through @code{yyextra}.
%option reentrant
/* Initialize the allocator. */
%{
#define YY_EXTRA_TYPE struct allocator*
#define YY_USER_INIT yyextra = allocator_create();
%}
%%
.|\n ;
@@ -5149,10 +5139,10 @@ the version of flex that was used to create the serialized tables.
@item th_name[]
Contains the name of this table set. The default is @samp{yytables},
and is prefixed accordingly, e.g., @samp{footables}. Must be NUL-terminated.
and is prefixed accordingly, e.g., @samp{footables}. Must be NULL-terminated.
@item th_pad64[]
Zero or more NUL bytes, padding the entire header to the next 64-bit boundary
Zero or more NULL bytes, padding the entire header to the next 64-bit boundary
as calculated from the beginning of the header.
@end table
@@ -5240,7 +5230,7 @@ The table data. This array may be a one- or two-dimensional array, of type
@code{td_flags}, @code{td_hilen}, and @code{td_lolen} fields.
@item td_pad64[]
Zero or more NUL bytes, padding the entire table to the next 64-bit boundary as
Zero or more NULL bytes, padding the entire table to the next 64-bit boundary as
calculated from the beginning of this table.
@end table
@@ -5448,7 +5438,7 @@ publish them here.
* How can I build a two-pass scanner?::
* How do I match any string not matched in the preceding rules?::
* I am trying to port code from AT&T lex that uses yysptr and yysbuf.::
* Is there a way to make flex treat NUL like a regular character?::
* Is there a way to make flex treat NULL like a regular character?::
* Whenever flex can not match the input it says "flex scanner jammed".::
* Why doesn't flex have non-greedy operators like perl does?::
* Memory leak - 16386 bytes allocated by malloc.::
@@ -6061,8 +6051,8 @@ what they're doing, and then replace @code{input()} with an appropriate definiti
@code{YY_INPUT}. You shouldn't need to (and must not) replace
@code{flex}'s @code{unput()} function.
@node Is there a way to make flex treat NUL like a regular character?
@unnumberedsec Is there a way to make flex treat NUL like a regular character?
@node Is there a way to make flex treat NULL like a regular character?
@unnumberedsec Is there a way to make flex treat NULL like a regular character?
Yes, @samp{\0} and @samp{\x00} should both do the trick. Perhaps you have an ancient
version of @code{flex}. The latest release is version @value{VERSION}.
@@ -7698,7 +7688,6 @@ to declare local variables.
@end example
@c TODO: Evaluate this faq.
@c Note that the file is now named cpp-flex.skl
@node unnamed-faq-87
@unnumberedsec unnamed-faq-87
@example
@@ -8168,7 +8157,6 @@ See @ref{Top, , , bison, the GNU Bison Manual}.
* Bison Bridge::
* M4 Dependency::
* Common Patterns::
* Retargeting Flex::
@end menu
@node Makefiles and Flex, Bison Bridge, Appendices, Appendices
@@ -8415,7 +8403,7 @@ removing such sequences from your code.
@code{m4} is only required at the time you run @code{flex}. The generated
scanner is ordinary C or C++, and does @emph{not} require @code{m4}.
@node Common Patterns,Retargeting Flex,M4 Dependency, Appendices
@node Common Patterns, ,M4 Dependency, Appendices
@section Common Patterns
@cindex patterns, common
@@ -8563,113 +8551,6 @@ to appear in a URI, including spaces and control characters. See
@end table
@node Retargeting Flex, ,Common Patterns, Appendices
@section Retargeting Flex
@cindex retargeting
@cindex language independence
This appendix describes how to add support for a new target language
to Flex.
The flex code has been factored to isolate knowledge of the specifics
of each target language from the logic for building the lexer state
tables.
The only assumption that is absolutely baked into all of Flex is that
the bodies of initializers for arrays of integers consist of decimal
numeric literals separated by commas (and optional whitespace).
Otherwise, knowledge of each target langage's syntax lives in two
places: (1) a table of language-specific syntax-generator methods,
and (2) A language-specific skeleton file.
For example: The methods for the C and C++ back end live in a source
file named @file{cpp_backend.c} (so named because both languages use the C
preprocessor), and in a skeleton file named @file{cpp-flex.skl}.
All the code that accesses language-specific code generators goes
through a global pointer named "backend" to a method table. The
results of these generators are used to fill in some parts of the
language-specific skeleton file and conditionalize others.
Read the definition of struct backend_t in @file{src/flexdefs.h}, and
attached comments, to get a feel for the methods. Don't worry
about understandng table generator names at first.
To write support for a language, you'll want to do the following
steps:
@enumerate
@item
Clone one of the existing back-end/skeleton pairs. If the language
you are supporting is named @var{foo}, you should create files named
@file{foo_backend.c} and @file{foo-flex.skl}.
@item
Add @file{foo_backend.c} to COMMON_SOURCES in @file{src/Makefile.am}. Add the
name of your skeleton file to EXTRA_DIST.
@item
Add a production to @file{src/Makefile.am} parallel to the one that
produces @file{cpp-skel.h}. Your objective is to make a string list
initializer from your skeleton file that can be linked with flex and
is pointed at by the skel nember of your language back end.
@item
Add some logic to @file{main.c} that enables the new back end with a
new command-line option. Following this step you should be
able to run Flex on a specification and get code out in the
language of whatever back end you cloned.
@item
The interesting part: mutate your new back end and skeleton so they
produce code in your desired target langage.
@item
Add a test suite for your back end. You should be able to clone
one of the existing sets of test loads to get good coverage. Note
that is highly unlikely your back end will be accepted into the
flex distribution without a test suite.
@end enumerate
Syntactically C-like languages such as Go, Rust, and Java should be easy
targets. Almost anything generally descended from Algol shouldn't be
much more difficult; this certainly includes the whole
Pascal/Modula/Oberon family.
A hint about the interesting part:
@itemize
@item
Don't bother supporting non-reentrant parser generation.
The interface of original Lex with all those globals hanging out
needs to be supported in C for backwards compatibility, but
there is no need to carry it forward.
@end itemize
The following assumptions in the code might trip you up and
require fixes outside a back end.
@enumerate
@item
The item separator in data initializers is a comma.
@item
The language has a case-arm syntax that looks like
a (possibly empty) prefix, followed by a value
expression, followed by a colon.
@item
Either case arms can be stacked as in C; that is, there is
an implicit fallthrough if the case arm has no code. Or,
there is an explicit fallthrough keyword that enables this,
as in Go.
@end enumerate
By putting a @code{yyterminate()} call in the fallthrough member
and a null pointer in the endcase member, you could handle
languages like Pascal.
@node Indices, , Appendices, Top
@unnumbered Indices
+3 -3
View File
@@ -39,13 +39,13 @@ number {num1}|{num2}
}
}
{number} std::cout << "number " << YYText() << '\n';
{number} FLEX_STD cout << "number " << YYText() << '\n';
\n mylineno++;
{name} std::cout << "name " << YYText() << '\n';
{name} FLEX_STD cout << "name " << YYText() << '\n';
{string} std::cout << "string " << YYText() << '\n';
{string} FLEX_STD cout << "string " << YYText() << '\n';
%%
+4
View File
@@ -0,0 +1,4 @@
noinst_LTLIBRARIES = libcompat.la
libcompat_la_SOURCES = lib.c
libcompat_la_LIBADD = $(LTLIBOBJS)
+7
View File
@@ -0,0 +1,7 @@
/* Since building an empty library could cause problems, we provide a
* function to go into the library. We could make this non-trivial by
* moving something that flex treats as a library function into this
* directory. */
void do_nothing(){ return;}
-125
View File
@@ -1,125 +0,0 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PROG_CC_FOR_BUILD
#
# DESCRIPTION
#
# This macro searches for a C compiler that generates native executables,
# that is a C compiler that surely is not a cross-compiler. This can be
# useful if you have to generate source code at compile-time like for
# example GCC does.
#
# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything
# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD).
# The value of these variables can be overridden by the user by specifying
# a compiler with an environment variable (like you do for standard CC).
#
# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object
# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if
# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are
# substituted in the Makefile.
#
# LICENSE
#
# Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 8
AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
AC_REQUIRE([AC_EXEEXT])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
dnl Use the standard macros, but make them use other variable names
dnl
pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
pushdef([ac_cv_objext], ac_cv_build_objext)dnl
pushdef([ac_exeext], ac_build_exeext)dnl
pushdef([ac_objext], ac_build_objext)dnl
pushdef([CC], CC_FOR_BUILD)dnl
pushdef([CPP], CPP_FOR_BUILD)dnl
pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
pushdef([host], build)dnl
pushdef([host_alias], build_alias)dnl
pushdef([host_cpu], build_cpu)dnl
pushdef([host_vendor], build_vendor)dnl
pushdef([host_os], build_os)dnl
pushdef([ac_cv_host], ac_cv_build)dnl
pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
pushdef([ac_cv_host_os], ac_cv_build_os)dnl
pushdef([ac_cpp], ac_build_cpp)dnl
pushdef([ac_compile], ac_build_compile)dnl
pushdef([ac_link], ac_build_link)dnl
save_cross_compiling=$cross_compiling
save_ac_tool_prefix=$ac_tool_prefix
cross_compiling=no
ac_tool_prefix=
AC_PROG_CC
AC_PROG_CPP
AC_EXEEXT
ac_tool_prefix=$save_ac_tool_prefix
cross_compiling=$save_cross_compiling
dnl Restore the old definitions
dnl
popdef([ac_link])dnl
popdef([ac_compile])dnl
popdef([ac_cpp])dnl
popdef([ac_cv_host_os])dnl
popdef([ac_cv_host_vendor])dnl
popdef([ac_cv_host_cpu])dnl
popdef([ac_cv_host_alias])dnl
popdef([ac_cv_host])dnl
popdef([host_os])dnl
popdef([host_vendor])dnl
popdef([host_cpu])dnl
popdef([host_alias])dnl
popdef([host])dnl
popdef([LDFLAGS])dnl
popdef([CPPFLAGS])dnl
popdef([CFLAGS])dnl
popdef([CPP])dnl
popdef([CC])dnl
popdef([ac_objext])dnl
popdef([ac_exeext])dnl
popdef([ac_cv_objext])dnl
popdef([ac_cv_exeext])dnl
popdef([ac_cv_prog_cc_g])dnl
popdef([ac_cv_prog_cc_cross])dnl
popdef([ac_cv_prog_cc_works])dnl
popdef([ac_cv_prog_gcc])dnl
popdef([ac_cv_prog_CPP])dnl
dnl Finally, set Makefile variables
dnl
BUILD_EXEEXT=$ac_build_exeext
BUILD_OBJEXT=$ac_build_objext
AC_SUBST(BUILD_EXEEXT)dnl
AC_SUBST(BUILD_OBJEXT)dnl
AC_SUBST([CFLAGS_FOR_BUILD])dnl
AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
AC_SUBST([LDFLAGS_FOR_BUILD])dnl
])
+23 -2
View File
@@ -1,2 +1,23 @@
# List of available languages.
bg ca da de en@boldquot en@quot eo es fi fr ga hr ko nl pl pt pt_BR ro ru sr sv tr uk vi zh_CN zh_TW
ca
da
de
en@quot
en@boldquot
eo
es
fi
fr
ga
hr
ko
nl
pl
pt_BR
ro
ru
sr
sv
tr
vi
zh_CN
zh_TW
+1 -38
View File
@@ -8,7 +8,7 @@ subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --language=C --keyword=_ --keyword=N_
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
@@ -20,13 +20,6 @@ XGETTEXT_OPTIONS = --language=C --keyword=_ --keyword=N_
# their copyright.
COPYRIGHT_HOLDER =
# This tells whether or not to prepend "GNU " prefix to the package
# name that gets inserted into the header of the $(DOMAIN).pot file.
# Possible values are "yes", "no", or empty. If it is empty, try to
# detect it automatically by scanning the files in $(top_srcdir) for
# "GNU packagename" string.
PACKAGE_GNU = "no"
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
@@ -46,33 +39,3 @@ MSGID_BUGS_ADDRESS = flex-devel@lists.sourceforge.net
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =
# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
# context. Possible values are "yes" and "no". Set this to yes if the
# package uses functions taking also a message context, like pgettext(), or
# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
USE_MSGCTXT = no
# These options get passed to msgmerge.
# Useful options are in particular:
# --previous to keep previous msgids of translated messages,
# --quiet to reduce the verbosity.
MSGMERGE_OPTIONS =
# These options get passed to msginit.
# If you want to disable line wrapping when writing PO files, add
# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
# MSGINIT_OPTIONS.
MSGINIT_OPTIONS =
# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
# has changed. Possible values are "yes" and "no". Set this to no if
# the POT file is checked in the repository and the version control
# program ignores timestamps.
PO_DEPENDS_ON_POT = yes
# This tells whether or not to forcibly update $(DOMAIN).pot and
# regenerate PO files on "make dist". Possible values are "yes" and
# "no". Set this to no if the POT file and PO files are maintained
# externally.
DIST_DEPENDS_ON_UPDATE_PO = no
+1
View File
@@ -12,6 +12,7 @@ src/options.c
src/parse.y
src/scan.l
src/scanopt.c
src/skel.c
src/sym.c
src/tblcmp.c
src/yylex.c
+9
View File
@@ -0,0 +1,9 @@
# Rules to fetch the translation project's po files for a domain
# Just rsync the *.po files for a particular textual domain into the
# po/ subdirectory of the project's source tree
getpo:
rsync -Ltvz translationproject.org::tp/latest/flex/*.po $(top_srcdir)/po
.PHONY: getpo
-932
View File
@@ -1,932 +0,0 @@
# Bulgarian translation of flex po-file.
# Copyright (C) 2019 The Flex Project (msgids)
# This file is distributed under the same license as the flex package.
# Alexander Shopov <ash@kambanaria.org>, 2019.
msgid ""
msgstr ""
"Project-Id-Version: flex 2.5.38\n"
"Report-Msgid-Bugs-To: flex-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2014-02-11 16:15-0500\n"
"PO-Revision-Date: 2019-06-20 18:39+0200\n"
"Last-Translator: Alexander Shopov <ash@kambanaria.org>\n"
"Language-Team: Bulgarian <dict@ludost.net>\n"
"Language: bg\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Bugs: Report translation errors to the Language-Team address.\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: buf.c:78
msgid "Allocation of buffer to print string failed"
msgstr "Неуспешно заделяне на буфер за отпечатване на низ"
#: buf.c:100
msgid "Allocation of buffer for line directive failed"
msgstr "Неуспешно заделяне на буфер за редова директива"
#: buf.c:177
msgid "Allocation of buffer for m4 def failed"
msgstr "Неуспешно заделяне на буфер за добавяне на дефиниция за „m4“"
#: buf.c:197
msgid "Allocation of buffer for m4 undef failed"
msgstr "Неуспешно заделяне на буфер за премахване на дефиниция за „m4“"
#: dfa.c:61
#, c-format
msgid "State #%d is non-accepting -\n"
msgstr "Състояние №%d не приема —\n"
#: dfa.c:124
msgid "dangerous trailing context"
msgstr "опасен последващ контекст"
#: dfa.c:166
#, c-format
msgid " associated rule line numbers:"
msgstr " номера на редове на съответното правило:"
#: dfa.c:202
#, c-format
msgid " out-transitions: "
msgstr " изходни преходи: "
#: dfa.c:210
#, c-format
msgid ""
"\n"
" jam-transitions: EOF "
msgstr ""
"\n"
" същински преходи: край на файл"
#: dfa.c:341
msgid "consistency check failed in epsclosure()"
msgstr "неуспешна проверка за консистентност в „epsclosure()“"
#: dfa.c:429
msgid ""
"\n"
"\n"
"DFA Dump:\n"
"\n"
msgstr ""
"\n"
"\n"
"Извеждане на ДКА:\n"
"\n"
#: dfa.c:604
msgid "could not create unique end-of-buffer state"
msgstr "уникалното състояние за край на буфер не може да се създаде"
#: dfa.c:625
#, c-format
msgid "state # %d:\n"
msgstr "състояние №%d:\n"
#: dfa.c:785
msgid "Could not write yynxt_tbl[][]"
msgstr "„yynxt_tbl[][]“ не може да се запише"
#: dfa.c:1049
msgid "bad transition character detected in sympartition()"
msgstr "в „sympartition()“ има неправилен знак за преход"
#: gen.c:478
msgid ""
"\n"
"\n"
"Equivalence Classes:\n"
"\n"
msgstr ""
"\n"
"\n"
"Класове на еквивалентност:\n"
"\n"
#: gen.c:662 gen.c:691 gen.c:1215
#, c-format
msgid "state # %d accepts: [%d]\n"
msgstr "състояние №%d приема: [%d]\n"
#: gen.c:1110
#, c-format
msgid "state # %d accepts: "
msgstr "състояние №%d приема: "
#: gen.c:1157
msgid "Could not write yyacclist_tbl"
msgstr "„yyacclist_tbl“ не може да се запише"
#: gen.c:1233
msgid "Could not write yyacc_tbl"
msgstr "„yyacc_tbl“ не може да се запише"
#: gen.c:1248 gen.c:1633 gen.c:1656
msgid "Could not write ecstbl"
msgstr "„ecstbl“ не може да се запише"
#: gen.c:1271
msgid ""
"\n"
"\n"
"Meta-Equivalence Classes:\n"
msgstr ""
"\n"
"\n"
"Класове за мета-еквивалентност:\n"
#: gen.c:1293
msgid "Could not write yymeta_tbl"
msgstr "„yymeta_tbl“ не може да се запише"
#: gen.c:1354
msgid "Could not write yybase_tbl"
msgstr "„yybase_tbl“ не може да се запише"
#: gen.c:1388
msgid "Could not write yydef_tbl"
msgstr "„yydef_tbl“ не може да се запише"
#: gen.c:1428
msgid "Could not write yynxt_tbl"
msgstr "„yynxt_tbl“ не може да се запише"
#: gen.c:1464
msgid "Could not write yychk_tbl"
msgstr "„yychk_tbl“ не може да се запише"
#: gen.c:1618 gen.c:1647
msgid "Could not write ftbl"
msgstr "„ftbl“ не може да се запише"
#: gen.c:1624
msgid "Could not write ssltbl"
msgstr "„ssltbl“ не може да се запише"
#: gen.c:1675
msgid "Could not write eoltbl"
msgstr "„eoltbl“ не може да се запише"
#: gen.c:1735
msgid "Could not write yynultrans_tbl"
msgstr "„yynultrans_tbl“ не може да се запише"
#: main.c:191
msgid "rule cannot be matched"
msgstr "правилото не напасва"
#: main.c:196
msgid "-s option given but default rule can be matched"
msgstr "зададена е опцията „-s“, но стандартното правило напасва"
#: main.c:236
msgid "Can't use -+ with -l option"
msgstr "опциите „-+“ и „-l“ са несъвместими"
#: main.c:239
msgid "Can't use -f or -F with -l option"
msgstr "опциите „-f“/„-F“ и „-l“ са несъвместими"
#: main.c:243
msgid "Can't use --reentrant or --bison-bridge with -l option"
msgstr "опциите „--reentrant“/„--bison-bridge“ и „-l“ са несъвместими"
#: main.c:275
msgid "-Cf/-CF and -Cm don't make sense together"
msgstr "опциите „-Cf“/„-CF“ и „-Cm“ са несъвместими"
#: main.c:278
msgid "-Cf/-CF and -I are incompatible"
msgstr "опциите „-Cf“/„-CF“ и „-I“ са несъвместими"
#: main.c:282
msgid "-Cf/-CF are incompatible with lex-compatibility mode"
msgstr "опциите „-Cf“/„-CF“ са несъвместими с режима за съвместимост с „lex“"
#: main.c:287
msgid "-Cf and -CF are mutually exclusive"
msgstr "опциите „-Cf“ и „-CF“ са несъвместими"
#: main.c:291
msgid "Can't use -+ with -CF option"
msgstr "опциите „-+“ и „-CF“ са несъвместими"
#: main.c:294
#, c-format
msgid "%array incompatible with -+ option"
msgstr "опцията „-+“ e несъвместима с декларация „%array“"
#: main.c:299
msgid "Options -+ and --reentrant are mutually exclusive."
msgstr "Опциите „-+“ и „--reentrant“ са несъвместими."
#: main.c:302
msgid "bison bridge not supported for the C++ scanner."
msgstr "анализатори, които са на C++, не поддържат допълнителната поддръжка за „bison“."
#: main.c:357 main.c:403
#, c-format
msgid "could not create %s"
msgstr "„%s“ не може да се създаде"
#: main.c:416
msgid "could not write tables header"
msgstr "заглавният файл за таблиците не може за се запише"
#: main.c:420
#, c-format
msgid "can't open skeleton file %s"
msgstr "файлът-скеле „%s“ не може да се отвори"
#: main.c:456
msgid "allocation of macro definition failed"
msgstr "неуспешно заделяне на памет за дефиниция на макрос"
#: main.c:504
#, c-format
msgid "input error reading skeleton file %s"
msgstr "входна грешка при изчитане на файла-скеле „%s“"
#: main.c:508
#, c-format
msgid "error closing skeleton file %s"
msgstr "грешка при затваряне на файла-скеле „%s“"
#: main.c:693
#, c-format
msgid "error creating header file %s"
msgstr "грешка при създаването на заглавен файл „%s“"
#: main.c:701
#, c-format
msgid "error writing output file %s"
msgstr "грешка при записването на изходния файл „%s“"
#: main.c:705
#, c-format
msgid "error closing output file %s"
msgstr "грешка при затварянето на изходния файл „%s“"
#: main.c:709
#, c-format
msgid "error deleting output file %s"
msgstr "грешка при изтриването на изходния файл „%s“"
#: main.c:716
#, c-format
msgid "No backing up.\n"
msgstr "Без връщане назад.\n"
#: main.c:720
#, c-format
msgid "%d backing up (non-accepting) states.\n"
msgstr "%d състояния за връщане (без приемане)\n"
#: main.c:724
#, c-format
msgid "Compressed tables always back up.\n"
msgstr "Компресираните таблици винаги водят до връщане назад.\n"
#: main.c:727
#, c-format
msgid "error writing backup file %s"
msgstr "грешка при записа на файла с връщанията назад „%s“"
#: main.c:731
#, c-format
msgid "error closing backup file %s"
msgstr "грешка при затварянето на файла с връщанията назад „%s“"
#: main.c:736
#, c-format
msgid "%s version %s usage statistics:\n"
msgstr "Статистика за употреба на %s, версия %s:\n"
#: main.c:739
#, c-format
msgid " scanner options: -"
msgstr " опции на лексическия анализатор: -"
#: main.c:818
#, c-format
msgid " %d/%d NFA states\n"
msgstr " %d/%d състояния на НКА\n"
#: main.c:820
#, c-format
msgid " %d/%d DFA states (%d words)\n"
msgstr " %d/%d състояния на ДКА (%d думи)\n"
#: main.c:822
#, c-format
msgid " %d rules\n"
msgstr " %d правила\n"
#: main.c:827
#, c-format
msgid " No backing up\n"
msgstr " Без връщане назад\n"
#: main.c:831
#, c-format
msgid " %d backing-up (non-accepting) states\n"
msgstr " %d състояния за връщане (без приемане)\n"
#: main.c:836
#, c-format
msgid " Compressed tables always back-up\n"
msgstr " Компресираните таблици винаги водят до връщане\n"
#: main.c:840
#, c-format
msgid " Beginning-of-line patterns used\n"
msgstr " Използвани са правила за начало на ред\n"
#: main.c:842
#, c-format
msgid " %d/%d start conditions\n"
msgstr " %d/%d начални състояния\n"
#: main.c:846
#, c-format
msgid " %d epsilon states, %d double epsilon states\n"
msgstr " %d ε-състояния, %d двойни ε-състояния\n"
#: main.c:850
#, c-format
msgid " no character classes\n"
msgstr " няма класове знаци\n"
#: main.c:854
#, c-format
msgid " %d/%d character classes needed %d/%d words of storage, %d reused\n"
msgstr " %d/%d класове за знаци изискваха %d/%d думи за съхранение, преизползвани са %d\n"
#: main.c:859
#, c-format
msgid " %d state/nextstate pairs created\n"
msgstr " %d двойки състояние/преход\n"
#: main.c:862
#, c-format
msgid " %d/%d unique/duplicate transitions\n"
msgstr " %d/%d уникални/повтарящи се преходи\n"
#: main.c:867
#, c-format
msgid " %d table entries\n"
msgstr " %d таблични записи\n"
#: main.c:875
#, c-format
msgid " %d/%d base-def entries created\n"
msgstr " %d/%d записи за основни дефиниции\n"
#: main.c:879
#, c-format
msgid " %d/%d (peak %d) nxt-chk entries created\n"
msgstr " %d/%d (максимум %d) записи\n"
#: main.c:883
#, c-format
msgid " %d/%d (peak %d) template nxt-chk entries created\n"
msgstr " %d/%d (максимум %d) шаблонни записи\n"
#: main.c:887
#, c-format
msgid " %d empty table entries\n"
msgstr " %d празни таблични записи\n"
#: main.c:889
#, c-format
msgid " %d protos created\n"
msgstr " %d създадени прототипи\n"
#: main.c:892
#, c-format
msgid " %d templates created, %d uses\n"
msgstr " %d създадени шаблони, %d употреби\n"
#: main.c:900
#, c-format
msgid " %d/%d equivalence classes created\n"
msgstr " създадени са %d/%d класове за еквивалентност\n"
#: main.c:908
#, c-format
msgid " %d/%d meta-equivalence classes created\n"
msgstr " създадени са %d/%d класове за мета-еквивалентност\n"
#: main.c:914
#, c-format
msgid " %d (%d saved) hash collisions, %d DFAs equal\n"
msgstr " %d (%d запазени) конфликти по суми, %d ДКА са еднакви\n"
#: main.c:916
#, c-format
msgid " %d sets of reallocations needed\n"
msgstr " необходими са %d пъти заделяния на памет наново\n"
#: main.c:918
#, c-format
msgid " %d total table entries needed\n"
msgstr " необходими са общо %d записи в таблица\n"
#: main.c:995
#, c-format
msgid "Internal error. flexopts are malformed.\n"
msgstr "Вътрешна грешка. Неправилни опции за flex.\n"
#: main.c:1005
#, c-format
msgid "Try `%s --help' for more information.\n"
msgstr "За повече информация изпълнете „%s --help“.\n"
#: main.c:1062
#, c-format
msgid "unknown -C option '%c'"
msgstr "непозната опция към „-C“: „%c“"
#: main.c:1191
#, c-format
msgid "%s %s\n"
msgstr "%s %s\n"
#: main.c:1466
msgid "fatal parse error"
msgstr "фатална грешка на анализатора"
#: main.c:1498
#, c-format
msgid "could not create backing-up info file %s"
msgstr "файлът с информация за връщане назад не може да се създаде: „%s“"
#: main.c:1519
#, c-format
msgid "-l AT&T lex compatibility option entails a large performance penalty\n"
msgstr "опцията за съвместимост с „lex“ на AT&T: „-l“, води до голяма загуба на производителност\n"
#: main.c:1522
#, c-format
msgid " and may be the actual source of other reported performance penalties\n"
msgstr " и може да доведе до допълнителни проблеми с производителността\n"
#: main.c:1528
#, c-format
msgid "%%option yylineno entails a performance penalty ONLY on rules that can match newline characters\n"
msgstr "директивата за „%%option“ — „yylineno“ води до загуба на производителност, само за правилата, които напасват знак за нов ред\n"
#: main.c:1535
#, c-format
msgid "-I (interactive) entails a minor performance penalty\n"
msgstr "„-I“ (интерактивният режим) води до малка загуба на производителност\n"
#: main.c:1540
#, c-format
msgid "yymore() entails a minor performance penalty\n"
msgstr "„yymore()“ води до малка загуба на производителност\n"
#: main.c:1546
#, c-format
msgid "REJECT entails a large performance penalty\n"
msgstr "Отхвърлянето (REJECT) води до голяма загуба на производителност\n"
#: main.c:1551
#, c-format
msgid "Variable trailing context rules entail a large performance penalty\n"
msgstr "Правила с последващ контекст, който не е константен, водят до голяма загуба на производителност\n"
#: main.c:1563
msgid "REJECT cannot be used with -f or -F"
msgstr "Отхвърлянето (REJECT) е несъвместимо с „-f“ или „-F“"
#: main.c:1566
#, c-format
msgid "%option yylineno cannot be used with REJECT"
msgstr "директивата за „%option“ — „yylineno“ е несъвместима с отхвърляне (REJECT)"
#: main.c:1569
msgid "variable trailing context rules cannot be used with -f or -F"
msgstr "правила с последващ контекст, който не е константен, не може да се ползват заедно с „-f“ или „-F“"
#: main.c:1692
#, c-format
msgid "%option yyclass only meaningful for C++ scanners"
msgstr "директивата за „%option“ — „yyclass“ важи само за анализаторите, които са на C++"
#: main.c:1799
#, c-format
msgid "Usage: %s [OPTIONS] [FILE]...\n"
msgstr "Употреба: %s [ОПЦИЯ] [ФАЙЛ]…\n"
#: main.c:1802
#, c-format
msgid ""
"Generates programs that perform pattern-matching on text.\n"
"\n"
"Table Compression:\n"
" -Ca, --align trade off larger tables for better memory alignment\n"
" -Ce, --ecs construct equivalence classes\n"
" -Cf do not compress tables; use -f representation\n"
" -CF do not compress tables; use -F representation\n"
" -Cm, --meta-ecs construct meta-equivalence classes\n"
" -Cr, --read use read() instead of stdio for scanner input\n"
" -f, --full generate fast, large scanner. Same as -Cfr\n"
" -F, --fast use alternate table representation. Same as -CFr\n"
" -Cem default compression (same as --ecs --meta-ecs)\n"
"\n"
"Debugging:\n"
" -d, --debug enable debug mode in scanner\n"
" -b, --backup write backing-up information to %s\n"
" -p, --perf-report write performance report to stderr\n"
" -s, --nodefault suppress default rule to ECHO unmatched text\n"
" -T, --trace %s should run in trace mode\n"
" -w, --nowarn do not generate warnings\n"
" -v, --verbose write summary of scanner statistics to stdout\n"
"\n"
"Files:\n"
" -o, --outfile=FILE specify output filename\n"
" -S, --skel=FILE specify skeleton file\n"
" -t, --stdout write scanner on stdout instead of %s\n"
" --yyclass=NAME name of C++ class\n"
" --header-file=FILE create a C header file in addition to the scanner\n"
" --tables-file[=FILE] write tables to FILE\n"
"\n"
"Scanner behavior:\n"
" -7, --7bit generate 7-bit scanner\n"
" -8, --8bit generate 8-bit scanner\n"
" -B, --batch generate batch scanner (opposite of -I)\n"
" -i, --case-insensitive ignore case in patterns\n"
" -l, --lex-compat maximal compatibility with original lex\n"
" -X, --posix-compat maximal compatibility with POSIX lex\n"
" -I, --interactive generate interactive scanner (opposite of -B)\n"
" --yylineno track line count in yylineno\n"
"\n"
"Generated code:\n"
" -+, --c++ generate C++ scanner class\n"
" -Dmacro[=defn] #define macro defn (default defn is '1')\n"
" -L, --noline suppress #line directives in scanner\n"
" -P, --prefix=STRING use STRING as prefix instead of \"yy\"\n"
" -R, --reentrant generate a reentrant C scanner\n"
" --bison-bridge scanner for bison pure parser.\n"
" --bison-locations include yylloc support.\n"
" --stdinit initialize yyin/yyout to stdin/stdout\n"
" --noansi-definitions old-style function definitions\n"
" --noansi-prototypes empty parameter list in prototypes\n"
" --nounistd do not include <unistd.h>\n"
" --noFUNCTION do not generate a particular FUNCTION\n"
"\n"
"Miscellaneous:\n"
" -c do-nothing POSIX option\n"
" -n do-nothing POSIX option\n"
" -?\n"
" -h, --help produce this help message\n"
" -V, --version report %s version\n"
msgstr ""
"Генериране на програма за лексически анализ на текст.\n"
"\n"
"Компресиране на таблиците\n"
" -Ca, --align по-точно подравняване в паметта, но по-големи таблици\n"
" -Ce, --ecs създаване на класовете за еквивалентност\n"
" -Cf без компресия на таблиците, представяне както с „-f“\n"
" -CF без компресия на таблиците, представяне както с „-F“\n"
" -Cm, --meta-ecs създаване на класовете за мета-еквивалентност\n"
" -Cr, --read четене чрез „read()“, а не от стандартния вход\n"
" -f, --full генериране на голям, но бърз анализатор, (≡„-Cfr“)\n"
" -F, --fast алтернативно представяне на таблиците (≡„-CFr“)\n"
" -Cem стандартна компресия (≡„--ecs --meta-ecs“)\n"
"\n"
"Изчистване на грешки:\n"
" -d, --debug режим на изчистване на грешки в анализатора\n"
" -b, --backup запазване на информацията за връщане назад в „%s“\n"
" -p, --perf-report доклад-производителността към стандартната грешка\n"
" -s, --nodefault потискане на стандартното правило за извеждане на\n"
" текста, който не напасва\n"
" -T, --trace „%s“ да се изпълнява в режим на трасиране\n"
" -w, --nowarn без предупреждения\n"
" -v, --verbose доклад-статистика за анализатора към стандартния изход\n"
"\n"
"Файлове:\n"
" -o, --outfile=ФАЙЛ задаване на изходния ФАЙЛ\n"
" -S, --skel=ФАЙЛ задаване на ФАЙЛа-скеле\n"
" -t, --stdout извеждане на анализатора на стандартния изход, а\n"
" не в „%s“\n"
" --yyclass=ИМЕ ИМЕ на клас за C++\n"
" --header-file=ФАЙЛ създаване и на заглавен файл на Cr\n"
" --tables-file[=ФАЙЛ] извеждане на таблиците във ФАЙЛа\n"
"\n"
"Поведение на анализатора:\n"
" -7, --7bit анализатор за 7-битов вход\n"
" -8, --8bit анализатор за 8-битов вход\n"
" -B, --batch пакетен анализатор (обратното на „-I“)\n"
" -i, --case-insensitive без разлика между главни и малки знаци\n"
" -l, --lex-compat максимална съвместимост с оригиналния „lex“\n"
" -X, --posix-compat максимална съвместимост с „lex“ по POSIX\n"
" -I, --interactive интерактивен анализатор (обратното на „-B“)\n"
" --yylineno следене на броя на редовете чрез „yylineno“\n"
"\n"
"Генериран код:\n"
" -+, --c++ генериране на анализатор като клас на C++\n"
" -DМАКРОС[=ДЕФИНИЦИЯ] „#define МАКРОС ДЕФИНИЦИЯ“ (стандартно\n"
" ДЕФИНИЦИЯта е „1“)\n"
" -L, --noline без директиви „#line“ в анализатора\n"
" -P, --prefix=НИЗ използване на този НИЗ за префикс вместо обичайния „yy“\n"
" -R, --reentrant анализатор на C с възможност за повторно извикване\n"
" --bison-bridge допълнителна поддръжка за „bison“\n"
" --bison-locations поддръжка на „yylloc“\n"
" --stdinit първоначалните стойности на „yyin“ и „yyout“ да са\n"
" съответно стандартният вход и изход\n"
" --noansi-definitions\n"
" остаряло дефиниране на функциите на C (преди ANSI)\n"
" --noansi-prototypes празен списък с параметри в прототипите\n"
" --nounistd без ползване на „<unistd.h>“\n"
" --noФУНКЦИЯ без създаването на определена ФУНКЦИЯ\n"
"\n"
"Други:\n"
" -c опция по POSIX, която не прави нищо\n"
" -n опция по POSIX, която не прави нищо\n"
" -?\n"
" -h, --help извеждане на това помощно съобщение\n"
" -V, --version извеждане на версията на „%s“\n"
#: misc.c:65
msgid "allocation of sko_stack failed"
msgstr "неуспешно заделяне на памет за „sko_stack“"
#: misc.c:102 misc.c:128
#, c-format
msgid "name \"%s\" ridiculously long"
msgstr "прекалено дълго име: „%s“"
#: misc.c:177
msgid "memory allocation failed in allocate_array()"
msgstr "неуспешно заделяне на памет в „allocate_array()“"
#: misc.c:230
#, c-format
msgid "bad character '%s' detected in check_char()"
msgstr "„check_char()“ се натъкна на неправилен знак: „%s“"
#: misc.c:235
#, c-format
msgid "scanner requires -8 flag to use the character %s"
msgstr "опцията „-8“ е задължителна, за да ползвате знака „%s“ в анализатора"
#: misc.c:268
msgid "dynamic memory failure in copy_string()"
msgstr "проблем с динамичната памет в „copy_string()“"
#: misc.c:367
#, c-format
msgid "%s: fatal internal error, %s\n"
msgstr "%s: фатална вътрешна грешка — %s\n"
#: misc.c:803
msgid "attempt to increase array size failed"
msgstr "неуспешен опит за увеличаване на размер на масив"
#: misc.c:930
msgid "bad line in skeleton file"
msgstr "неправилен файл във файл-скеле"
#: misc.c:979
msgid "memory allocation failed in yy_flex_xmalloc()"
msgstr "неуспешно заделяне на памет в „yy_flex_xmalloc()“"
#: nfa.c:104
#, c-format
msgid ""
"\n"
"\n"
"********** beginning dump of nfa with start state %d\n"
msgstr ""
"\n"
"\n"
"•••••••••• начало на извеждането на НКА с начално състояние %d\n"
#: nfa.c:115
#, c-format
msgid "state # %4d\t"
msgstr "състояние №%4d"
#: nfa.c:130
#, c-format
msgid "********** end of dump\n"
msgstr "•••••••••• край на извеждането\n"
#: nfa.c:174
msgid "empty machine in dupmachine()"
msgstr "празен автомат в „dupmachine()“"
#: nfa.c:240
#, c-format
msgid "Variable trailing context rule at line %d\n"
msgstr "Правило с последващ контекст, който не е константен, на ред %d\n"
#: nfa.c:364
msgid "bad state type in mark_beginning_as_normal()"
msgstr "неправилен вид състояние в „mark_beginning_as_normal()“"
#: nfa.c:609
#, c-format
msgid "input rules are too complicated (>= %d NFA states)"
msgstr "входните правила са прекалено сложни (≥ %d състояния на НКА)"
#: nfa.c:688
msgid "found too many transitions in mkxtion()"
msgstr "прекалено много преходи в „mkxtion()“"
#: nfa.c:714
#, c-format
msgid "too many rules (> %d)!"
msgstr "прекалено много правила (> %d)!"
#: parse.y:159
msgid "unknown error processing section 1"
msgstr "непозната грешка при обработка на 1ви раздел"
#: parse.y:184 parse.y:351
msgid "bad start condition list"
msgstr "неправилен списък на началните състояния"
#: parse.y:315
msgid "unrecognized rule"
msgstr "непознато правило"
#: parse.y:434 parse.y:447 parse.y:516
msgid "trailing context used twice"
msgstr "двукратно ползване на последващ контекст"
#: parse.y:552 parse.y:562 parse.y:635 parse.y:645
msgid "bad iteration values"
msgstr "неправилни стойности на итерация"
#: parse.y:580 parse.y:598 parse.y:663 parse.y:681
msgid "iteration value must be positive"
msgstr "стойността на итерацията трябва да е положителна"
#: parse.y:804 parse.y:814
#, c-format
msgid "the character range [%c-%c] is ambiguous in a case-insensitive scanner"
msgstr "диапазонът знаци [%c-%c] не е еднозначен при лексичен анализатор, който не прави разлика между главни и малки знаци"
#: parse.y:819
msgid "negative range in character class"
msgstr "изключващ диапазон в клас знаци"
#: parse.y:916
msgid "[:^lower:] is ambiguous in case insensitive scanner"
msgstr "диапазонът знаци [:^lower:] не е еднозначен при лексичен анализатор, който не прави разлика между главни и малки знаци"
#: parse.y:922
msgid "[:^upper:] ambiguous in case insensitive scanner"
msgstr "диапазонът знаци [:^upper:] не е еднозначен при лексичен анализатор, който не прави разлика между главни и малки знаци"
#: scan.l:75 scan.l:618 scan.l:676
msgid "Input line too long\n"
msgstr "Входният ред е твърде дълъг\n"
#: scan.l:161
#, c-format
msgid "malformed '%top' directive"
msgstr "неправилна директива „%top“"
#: scan.l:183
#, no-c-format
msgid "unrecognized '%' directive"
msgstr "непозната директива, започваща с „%“"
#: scan.l:192
msgid "Definition name too long\n"
msgstr "Името на дефиницията е твърде дълго\n"
#: scan.l:284
msgid "Unmatched '{'"
msgstr "„{“ без еш"
#: scan.l:300
#, c-format
msgid "Definition value for {%s} too long\n"
msgstr "Стойността на дефиницията „{%s}“ е твърде дълга\n"
#: scan.l:317
msgid "incomplete name definition"
msgstr "дефиниция с непълно име"
#: scan.l:443
msgid "Option line too long\n"
msgstr "Редът за опция е твърде дълъг\n"
#: scan.l:451
#, c-format
msgid "unrecognized %%option: %s"
msgstr "непозната опция „%%option“: „%s“"
#: scan.l:633 scan.l:800
msgid "bad character class"
msgstr "неправилен клас знаци"
#: scan.l:683
#, c-format
msgid "undefined definition {%s}"
msgstr "липсваща дефиниция „{%s}“"
#: scan.l:755
#, c-format
msgid "bad <start condition>: %s"
msgstr "лошо начално условие: „%s“"
#: scan.l:768
msgid "missing quote"
msgstr "липсваща кавичка"
#: scan.l:834
#, c-format
msgid "bad character class expression: %s"
msgstr "неправилен израз за клас от знаци: „%s“"
#: scan.l:856
msgid "bad character inside {}'s"
msgstr "неправилен знак между „{“ и „}“"
#: scan.l:862
msgid "missing }"
msgstr "липсва „}“"
#: scan.l:940
msgid "EOF encountered inside an action"
msgstr "край на файл в действие"
#: scan.l:945
msgid "EOF encountered inside pattern"
msgstr "край на файл в шаблон"
#: scan.l:967
#, c-format
msgid "bad character: %s"
msgstr "неправилен знак: %s"
#: scan.l:996
#, c-format
msgid "can't open %s"
msgstr "„%s“ не може да се отвори"
#: scanopt.c:291
#, c-format
msgid "Usage: %s [OPTIONS]...\n"
msgstr "Употреба: %s [ОПЦИЯ]…\n"
#: scanopt.c:564
#, c-format
msgid "option `%s' doesn't allow an argument\n"
msgstr "опцията „%s“ се използва без аргументи\n"
#: scanopt.c:569
#, c-format
msgid "option `%s' requires an argument\n"
msgstr "опцията „%s“ изисква аргумент\n"
#: scanopt.c:573
#, c-format
msgid "option `%s' is ambiguous\n"
msgstr "опцията „%s“ не е еднозначна\n"
#: scanopt.c:577
#, c-format
msgid "Unrecognized option `%s'\n"
msgstr "непозната опция „%s“\n"
#: scanopt.c:581
#, c-format
msgid "Unknown error=(%d)\n"
msgstr "Неизвестна грешка=(%d)\n"
#: sym.c:100
msgid "symbol table memory allocation failed"
msgstr "неуспешно заделяне на памет за таблицата със символите"
#: sym.c:202
msgid "name defined twice"
msgstr "името е дефинирано двукратно"
#: sym.c:253
#, c-format
msgid "start condition %s declared twice"
msgstr "началното условие „%s“ е дефинирано двукратно"
#: yylex.c:56
msgid "premature EOF"
msgstr "преждевременен край (EOF)"
#: yylex.c:198
#, c-format
msgid "End Marker\n"
msgstr "Маркер за край\n"
#: yylex.c:204
#, c-format
msgid "*Something Weird* - tok: %d val: %d\n"
msgstr "•Нещо странно• — лекс.: %d ст-ст: %d\n"
+202 -260
View File
File diff suppressed because it is too large Load Diff
+174 -240
View File
File diff suppressed because it is too large Load Diff
+189 -230
View File
File diff suppressed because it is too large Load Diff
+182 -212
View File
File diff suppressed because it is too large Load Diff
+190 -397
View File
File diff suppressed because it is too large Load Diff
+194 -238
View File
File diff suppressed because it is too large Load Diff
+199 -249
View File
File diff suppressed because it is too large Load Diff
+211 -283
View File
File diff suppressed because it is too large Load Diff
+174 -192
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: flex 2.5.37\n"
"Report-Msgid-Bugs-To: flex-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2017-05-06 10:49-0400\n"
"POT-Creation-Date: 2012-07-22 20:48-0400\n"
"PO-Revision-Date: 2012-10-05 16:48+0200\n"
"Last-Translator: Tomislav Krznar <tomislav.krznar@gmail.com>\n"
"Language-Team: Croatian <lokalizacija@linux.hr>\n"
@@ -15,58 +15,56 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Bugs: Report translation errors to the Language-Team address.\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"X-Generator: Lokalize 1.4\n"
#: src/buf.c:79
#: buf.c:78
msgid "Allocation of buffer to print string failed"
msgstr ""
#: src/buf.c:107
#: buf.c:100
msgid "Allocation of buffer for line directive failed"
msgstr ""
#: src/buf.c:177
#: buf.c:177
msgid "Allocation of buffer for m4 def failed"
msgstr ""
#: src/buf.c:198
#: buf.c:197
msgid "Allocation of buffer for m4 undef failed"
msgstr ""
#: src/dfa.c:59
#: dfa.c:61
#, c-format
msgid "State #%d is non-accepting -\n"
msgstr ""
#: src/dfa.c:119
#: dfa.c:124
msgid "dangerous trailing context"
msgstr ""
#: src/dfa.c:159
#: dfa.c:166
#, c-format
msgid " associated rule line numbers:"
msgstr ""
#: src/dfa.c:193
#: dfa.c:202
#, c-format
msgid " out-transitions: "
msgstr ""
#: src/dfa.c:201
#: dfa.c:210
#, c-format
msgid ""
"\n"
" jam-transitions: EOF "
msgstr ""
#: src/dfa.c:331
#: dfa.c:341
msgid "consistency check failed in epsclosure()"
msgstr ""
#: src/dfa.c:419
#: dfa.c:429
msgid ""
"\n"
"\n"
@@ -74,24 +72,24 @@ msgid ""
"\n"
msgstr ""
#: src/dfa.c:587
#: dfa.c:604
msgid "could not create unique end-of-buffer state"
msgstr ""
#: src/dfa.c:608
#: dfa.c:625
#, c-format
msgid "state # %d:\n"
msgstr ""
#: src/dfa.c:768
#: dfa.c:785
msgid "Could not write yynxt_tbl[][]"
msgstr ""
#: src/dfa.c:1028
#: dfa.c:1049
msgid "bad transition character detected in sympartition()"
msgstr ""
#: src/gen.c:480
#: gen.c:478
msgid ""
"\n"
"\n"
@@ -99,426 +97,420 @@ msgid ""
"\n"
msgstr ""
#: src/gen.c:669 src/gen.c:698 src/gen.c:1218
#: gen.c:662 gen.c:691 gen.c:1215
#, c-format
msgid "state # %d accepts: [%d]\n"
msgstr ""
#: src/gen.c:1115
#: gen.c:1110
#, c-format
msgid "state # %d accepts: "
msgstr ""
#: src/gen.c:1162
#: gen.c:1157
msgid "Could not write yyacclist_tbl"
msgstr ""
#: src/gen.c:1236
#: gen.c:1233
msgid "Could not write yyacc_tbl"
msgstr ""
#: src/gen.c:1251 src/gen.c:1623 src/gen.c:1646
#: gen.c:1248 gen.c:1633 gen.c:1656
msgid "Could not write ecstbl"
msgstr ""
#: src/gen.c:1271
#: gen.c:1271
msgid ""
"\n"
"\n"
"Meta-Equivalence Classes:\n"
msgstr ""
#: src/gen.c:1293
#: gen.c:1293
msgid "Could not write yymeta_tbl"
msgstr ""
#: src/gen.c:1352
#: gen.c:1354
msgid "Could not write yybase_tbl"
msgstr ""
#: src/gen.c:1384
#: gen.c:1388
msgid "Could not write yydef_tbl"
msgstr ""
#: src/gen.c:1422
#: gen.c:1428
msgid "Could not write yynxt_tbl"
msgstr ""
#: src/gen.c:1456
#: gen.c:1464
msgid "Could not write yychk_tbl"
msgstr ""
#: src/gen.c:1608 src/gen.c:1637
#: gen.c:1618 gen.c:1647
msgid "Could not write ftbl"
msgstr ""
#: src/gen.c:1614
#: gen.c:1624
msgid "Could not write ssltbl"
msgstr ""
#: src/gen.c:1665
#: gen.c:1675
msgid "Could not write eoltbl"
msgstr ""
#: src/gen.c:1722
#: gen.c:1735
msgid "Could not write yynultrans_tbl"
msgstr ""
#: src/main.c:178
#: main.c:189
msgid "rule cannot be matched"
msgstr ""
#: src/main.c:183
#: main.c:194
msgid "-s option given but default rule can be matched"
msgstr ""
#: src/main.c:221
#: main.c:234
msgid "Can't use -+ with -l option"
msgstr ""
#: src/main.c:224
#: main.c:237
msgid "Can't use -f or -F with -l option"
msgstr ""
#: src/main.c:228
#: main.c:241
msgid "Can't use --reentrant or --bison-bridge with -l option"
msgstr ""
#: src/main.c:260
#: main.c:278
msgid "-Cf/-CF and -Cm don't make sense together"
msgstr ""
#: src/main.c:263
#: main.c:281
msgid "-Cf/-CF and -I are incompatible"
msgstr ""
#: src/main.c:267
#: main.c:285
msgid "-Cf/-CF are incompatible with lex-compatibility mode"
msgstr ""
#: src/main.c:272
#: main.c:290
msgid "-Cf and -CF are mutually exclusive"
msgstr ""
#: src/main.c:276
#: main.c:294
msgid "Can't use -+ with -CF option"
msgstr ""
#: src/main.c:279
#: main.c:297
#, c-format
msgid "%array incompatible with -+ option"
msgstr ""
#: src/main.c:284
#: main.c:302
msgid "Options -+ and --reentrant are mutually exclusive."
msgstr ""
#: src/main.c:287
#: main.c:305
msgid "bison bridge not supported for the C++ scanner."
msgstr ""
#: src/main.c:336 src/main.c:419
#: main.c:360 main.c:406
#, c-format
msgid "could not create %s"
msgstr ""
#: src/main.c:431
#: main.c:419
msgid "could not write tables header"
msgstr ""
#: src/main.c:435
#: main.c:423
#, c-format
msgid "can't open skeleton file %s"
msgstr ""
#: src/main.c:450
msgid "Prefix cannot include '[' or ']'"
msgstr ""
#: src/main.c:474
#: main.c:459
msgid "allocation of macro definition failed"
msgstr ""
#: src/main.c:521
#: main.c:507
#, c-format
msgid "input error reading skeleton file %s"
msgstr ""
#: src/main.c:525
#: main.c:511
#, c-format
msgid "error closing skeleton file %s"
msgstr "greška pri zatvaranju datoteke predloška %s"
#: src/main.c:709
#: main.c:696
#, c-format
msgid "error creating header file %s"
msgstr "greška pri stvaranju datoteke zaglavlja %s"
#: src/main.c:717
#: main.c:704
#, c-format
msgid "error writing output file %s"
msgstr "greška pri pisanju izlazne datoteke %s"
#: src/main.c:721
#: main.c:708
#, c-format
msgid "error closing output file %s"
msgstr "greška pri zatvaranju izlazne datoteke %s"
#: src/main.c:725
#: main.c:712
#, c-format
msgid "error deleting output file %s"
msgstr "greška pri uklanjanju izlazne datoteke %s"
#: src/main.c:732
#: main.c:719
#, c-format
msgid "No backing up.\n"
msgstr ""
#: src/main.c:736
#: main.c:723
#, c-format
msgid "%d backing up (non-accepting) states.\n"
msgstr ""
#: src/main.c:740
#: main.c:727
#, c-format
msgid "Compressed tables always back up.\n"
msgstr ""
#: src/main.c:743
#: main.c:730
#, c-format
msgid "error writing backup file %s"
msgstr ""
#: src/main.c:747
#: main.c:734
#, c-format
msgid "error closing backup file %s"
msgstr ""
#: src/main.c:752
#: main.c:739
#, c-format
msgid "%s version %s usage statistics:\n"
msgstr ""
#: src/main.c:755
#: main.c:742
#, c-format
msgid " scanner options: -"
msgstr ""
#: src/main.c:834
#: main.c:821
#, c-format
msgid " %d/%d NFA states\n"
msgstr ""
#: src/main.c:836
#: main.c:823
#, c-format
msgid " %d/%d DFA states (%d words)\n"
msgstr ""
#: src/main.c:838
#: main.c:825
#, c-format
msgid " %d rules\n"
msgstr ""
#: src/main.c:843
#: main.c:830
#, c-format
msgid " No backing up\n"
msgstr ""
#: src/main.c:847
#: main.c:834
#, c-format
msgid " %d backing-up (non-accepting) states\n"
msgstr ""
#: src/main.c:852
#: main.c:839
#, c-format
msgid " Compressed tables always back-up\n"
msgstr ""
#: src/main.c:856
#: main.c:843
#, c-format
msgid " Beginning-of-line patterns used\n"
msgstr ""
#: src/main.c:858
#: main.c:845
#, c-format
msgid " %d/%d start conditions\n"
msgstr ""
#: src/main.c:862
#: main.c:849
#, c-format
msgid " %d epsilon states, %d double epsilon states\n"
msgstr ""
#: src/main.c:866
#: main.c:853
#, c-format
msgid " no character classes\n"
msgstr ""
#: src/main.c:870
#: main.c:857
#, c-format
msgid " %d/%d character classes needed %d/%d words of storage, %d reused\n"
msgstr ""
#: src/main.c:875
#: main.c:862
#, c-format
msgid " %d state/nextstate pairs created\n"
msgstr ""
#: src/main.c:878
#: main.c:865
#, c-format
msgid " %d/%d unique/duplicate transitions\n"
msgstr ""
#: src/main.c:883
#: main.c:870
#, c-format
msgid " %d table entries\n"
msgstr ""
#: src/main.c:891
#: main.c:878
#, c-format
msgid " %d/%d base-def entries created\n"
msgstr ""
#: src/main.c:895
#: main.c:882
#, c-format
msgid " %d/%d (peak %d) nxt-chk entries created\n"
msgstr ""
#: src/main.c:899
#: main.c:886
#, c-format
msgid " %d/%d (peak %d) template nxt-chk entries created\n"
msgstr ""
#: src/main.c:903
#: main.c:890
#, c-format
msgid " %d empty table entries\n"
msgstr ""
#: src/main.c:905
#: main.c:892
#, c-format
msgid " %d protos created\n"
msgstr ""
#: src/main.c:908
#: main.c:895
#, c-format
msgid " %d templates created, %d uses\n"
msgstr ""
#: src/main.c:916
#: main.c:903
#, c-format
msgid " %d/%d equivalence classes created\n"
msgstr ""
#: src/main.c:924
#: main.c:911
#, c-format
msgid " %d/%d meta-equivalence classes created\n"
msgstr ""
#: src/main.c:930
#: main.c:917
#, c-format
msgid " %d (%d saved) hash collisions, %d DFAs equal\n"
msgstr ""
#: src/main.c:932
#: main.c:919
#, c-format
msgid " %d sets of reallocations needed\n"
msgstr ""
#: src/main.c:934
#: main.c:921
#, c-format
msgid " %d total table entries needed\n"
msgstr ""
#: src/main.c:1008
#: main.c:998
#, c-format
msgid "Internal error. flexopts are malformed.\n"
msgstr ""
#: src/main.c:1018
#: main.c:1008
#, c-format
msgid "Try `%s --help' for more information.\n"
msgstr "Pokušajte „%s --help” za više informacija.\n"
#: src/main.c:1075
#: main.c:1065
#, c-format
msgid "unknown -C option '%c'"
msgstr "nepoznata -C opcija „%c”"
#: src/main.c:1204
#: main.c:1194
#, c-format
msgid "%s %s\n"
msgstr "%s %s\n"
#: src/main.c:1476
#: main.c:1469
msgid "fatal parse error"
msgstr "fatalna greška analize"
#: src/main.c:1508
#: main.c:1501
#, c-format
msgid "could not create backing-up info file %s"
msgstr ""
#: src/main.c:1529
#: main.c:1522
#, c-format
msgid "-l AT&T lex compatibility option entails a large performance penalty\n"
msgstr ""
#: src/main.c:1532
#: main.c:1525
#, c-format
msgid " and may be the actual source of other reported performance penalties\n"
msgstr ""
#: src/main.c:1538
#: main.c:1531
#, c-format
msgid ""
"%%option yylineno entails a performance penalty ONLY on rules that can match "
"newline characters\n"
msgid "%%option yylineno entails a performance penalty ONLY on rules that can match newline characters\n"
msgstr ""
#: src/main.c:1545
#: main.c:1538
#, c-format
msgid "-I (interactive) entails a minor performance penalty\n"
msgstr ""
#: src/main.c:1550
#: main.c:1543
#, c-format
msgid "yymore() entails a minor performance penalty\n"
msgstr ""
#: src/main.c:1556
#: main.c:1549
#, c-format
msgid "REJECT entails a large performance penalty\n"
msgstr ""
#: src/main.c:1561
#: main.c:1554
#, c-format
msgid "Variable trailing context rules entail a large performance penalty\n"
msgstr ""
#: src/main.c:1573
#: main.c:1566
msgid "REJECT cannot be used with -f or -F"
msgstr ""
#: src/main.c:1576
#: main.c:1569
#, c-format
msgid "%option yylineno cannot be used with REJECT"
msgstr ""
#: src/main.c:1579
#: main.c:1572
msgid "variable trailing context rules cannot be used with -f or -F"
msgstr ""
#: src/main.c:1704
#: main.c:1695
#, c-format
msgid "%option yyclass only meaningful for C++ scanners"
msgstr ""
#: src/main.c:1791
#: main.c:1802
#, c-format
msgid "Usage: %s [OPTIONS] [FILE]...\n"
msgstr "Uporaba: %s [OPCIJE] [DATOTEKA]...\n"
#: src/main.c:1794
#: main.c:1805
#, c-format
msgid ""
"Generates programs that perform pattern-matching on text.\n"
@@ -542,16 +534,13 @@ msgid ""
" -T, --trace %s should run in trace mode\n"
" -w, --nowarn do not generate warnings\n"
" -v, --verbose write summary of scanner statistics to stdout\n"
" --hex use hexadecimal numbers instead of octal in debug "
"outputs\n"
"\n"
"Files:\n"
" -o, --outfile=FILE specify output filename\n"
" -S, --skel=FILE specify skeleton file\n"
" -t, --stdout write scanner on stdout instead of %s\n"
" --yyclass=NAME name of C++ class\n"
" --header-file=FILE create a C header file in addition to the "
"scanner\n"
" --header-file=FILE create a C header file in addition to the scanner\n"
" --tables-file[=FILE] write tables to FILE\n"
"\n"
"Scanner behavior:\n"
@@ -573,6 +562,8 @@ msgid ""
" --bison-bridge scanner for bison pure parser.\n"
" --bison-locations include yylloc support.\n"
" --stdinit initialize yyin/yyout to stdin/stdout\n"
" --noansi-definitions old-style function definitions\n"
" --noansi-prototypes empty parameter list in prototypes\n"
" --nounistd do not include <unistd.h>\n"
" --noFUNCTION do not generate a particular FUNCTION\n"
"\n"
@@ -584,52 +575,51 @@ msgid ""
" -V, --version report %s version\n"
msgstr ""
#: src/misc.c:64
#: misc.c:65
msgid "allocation of sko_stack failed"
msgstr ""
#: src/misc.c:100
#: misc.c:102 misc.c:128
#, c-format
msgid "name \"%s\" ridiculously long"
msgstr ""
#: src/misc.c:155
#: misc.c:177
msgid "memory allocation failed in allocate_array()"
msgstr ""
#: src/misc.c:205
#: misc.c:230
#, c-format
msgid "bad character '%s' detected in check_char()"
msgstr ""
#: src/misc.c:210
#: misc.c:235
#, c-format
msgid "scanner requires -8 flag to use the character %s"
msgstr ""
#: src/misc.c:229
#, fuzzy
msgid "memory allocation failure in xstrdup()"
msgstr "alokacija memorije za tablicu simbola nije uspjela"
#: misc.c:268
msgid "dynamic memory failure in copy_string()"
msgstr ""
#: src/misc.c:303
#: misc.c:367
#, c-format
msgid "%s: fatal internal error, %s\n"
msgstr ""
#: src/misc.c:671
#: misc.c:803
msgid "attempt to increase array size failed"
msgstr ""
#: src/misc.c:795
#: misc.c:930
msgid "bad line in skeleton file"
msgstr "neispravan redak u datoteci predloška"
#: src/misc.c:845
#: misc.c:979
msgid "memory allocation failed in yy_flex_xmalloc()"
msgstr ""
#: src/nfa.c:100
#: nfa.c:104
#, c-format
msgid ""
"\n"
@@ -637,234 +627,226 @@ msgid ""
"********** beginning dump of nfa with start state %d\n"
msgstr ""
#: src/nfa.c:111
#: nfa.c:115
#, c-format
msgid "state # %4d\t"
msgstr ""
#: src/nfa.c:126
#: nfa.c:130
#, c-format
msgid "********** end of dump\n"
msgstr ""
#: src/nfa.c:169
#: nfa.c:174
msgid "empty machine in dupmachine()"
msgstr ""
#: src/nfa.c:234
#: nfa.c:240
#, c-format
msgid "Variable trailing context rule at line %d\n"
msgstr ""
#: src/nfa.c:357
#: nfa.c:353
msgid "bad state type in mark_beginning_as_normal()"
msgstr ""
#: src/nfa.c:595
#: nfa.c:598
#, c-format
msgid "input rules are too complicated (>= %d NFA states)"
msgstr ""
#: src/nfa.c:673
#: nfa.c:677
msgid "found too many transitions in mkxtion()"
msgstr ""
#: src/nfa.c:699
#: nfa.c:703
#, c-format
msgid "too many rules (> %d)!"
msgstr "previše pravila (> %d)!"
#: src/parse.y:159
#: parse.y:159
msgid "unknown error processing section 1"
msgstr ""
#: src/parse.y:184 src/parse.y:353
#: parse.y:184 parse.y:351
msgid "bad start condition list"
msgstr ""
#: src/parse.y:204
msgid "Prefix must not contain [ or ]"
msgstr ""
#: src/parse.y:317
#: parse.y:315
msgid "unrecognized rule"
msgstr "neprepoznato pravilo"
#: src/parse.y:436 src/parse.y:449 src/parse.y:518
#: parse.y:434 parse.y:447 parse.y:516
msgid "trailing context used twice"
msgstr ""
#: src/parse.y:554 src/parse.y:564 src/parse.y:637 src/parse.y:647
#: parse.y:552 parse.y:562 parse.y:635 parse.y:645
msgid "bad iteration values"
msgstr "neispravne vrijednosti iteracije"
#: src/parse.y:582 src/parse.y:600 src/parse.y:665 src/parse.y:683
#: parse.y:580 parse.y:598 parse.y:663 parse.y:681
msgid "iteration value must be positive"
msgstr "vrijednost iteracije mora biti pozitivna"
#: src/parse.y:806 src/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 ""
#: src/parse.y:821
#: parse.y:819
msgid "negative range in character class"
msgstr ""
#: src/parse.y:918
#: parse.y:916
msgid "[:^lower:] is ambiguous in case insensitive scanner"
msgstr ""
#: src/parse.y:924
#: parse.y:922
msgid "[:^upper:] ambiguous in case insensitive scanner"
msgstr ""
#: src/scan.l:82 src/scan.l:644 src/scan.l:702
#: scan.l:75 scan.l:618 scan.l:676
msgid "Input line too long\n"
msgstr "Ulazni redak je predugačak\n"
#: src/scan.l:183
#: scan.l:161
#, c-format
msgid "malformed '%top' directive"
msgstr ""
#: src/scan.l:205
#: scan.l:183
#, no-c-format
msgid "unrecognized '%' directive"
msgstr ""
#: src/scan.l:214
#: scan.l:192
msgid "Definition name too long\n"
msgstr "Ime definicije je predugačko\n"
#: src/scan.l:309
#: scan.l:284
msgid "Unmatched '{'"
msgstr "Neuparena „{”"
#: src/scan.l:325
#: scan.l:300
#, c-format
msgid "Definition value for {%s} too long\n"
msgstr ""
#: src/scan.l:342
#: scan.l:317
msgid "incomplete name definition"
msgstr "nepotpuna definicija imena"
#: src/scan.l:467
#: scan.l:443
msgid "Option line too long\n"
msgstr "Redak opcija je predugačak\n"
#: src/scan.l:475
#: scan.l:451
#, c-format
msgid "unrecognized %%option: %s"
msgstr ""
#: src/scan.l:659 src/scan.l:832
#: scan.l:633 scan.l:800
msgid "bad character class"
msgstr "neispravan razred znakova"
#: src/scan.l:709
#: scan.l:683
#, c-format
msgid "undefined definition {%s}"
msgstr "nedefinirana definicija {%s}"
#: src/scan.l:772
msgid "unbalanced parenthesis"
msgstr ""
#: src/scan.l:787
#: scan.l:755
#, c-format
msgid "bad <start condition>: %s"
msgstr ""
#: src/scan.l:800
#: scan.l:768
msgid "missing quote"
msgstr "nedostaje navodnik"
#: src/scan.l:866
#: scan.l:834
#, c-format
msgid "bad character class expression: %s"
msgstr ""
#: src/scan.l:888
#: scan.l:856
msgid "bad character inside {}'s"
msgstr "neispravan znak unutar {}"
#: src/scan.l:894
#: scan.l:862
msgid "missing }"
msgstr "nedostaje }"
#: src/scan.l:972
#: scan.l:940
msgid "EOF encountered inside an action"
msgstr ""
#: src/scan.l:977
#: scan.l:945
msgid "EOF encountered inside pattern"
msgstr ""
#: src/scan.l:1010
#: scan.l:967
#, c-format
msgid "bad character: %s"
msgstr "neispravan znak: %s"
#: src/scan.l:1038
#: scan.l:996
#, c-format
msgid "can't open %s"
msgstr "ne mogu otvoriti %s"
#: src/scanopt.c:259
#: scanopt.c:291
#, c-format
msgid "Usage: %s [OPTIONS]...\n"
msgstr "Uporaba: %s [OPCIJE]...\n"
#: src/scanopt.c:524
#: scanopt.c:564
#, c-format
msgid "option `%s' doesn't allow an argument\n"
msgstr "opcija „%s” ne dozvoljava argument\n"
#: src/scanopt.c:529
#: scanopt.c:569
#, c-format
msgid "option `%s' requires an argument\n"
msgstr "opcija „%s” zahtijeva argument\n"
#: src/scanopt.c:533
#: scanopt.c:573
#, c-format
msgid "option `%s' is ambiguous\n"
msgstr "opcija „%s” je višeznačna\n"
#: src/scanopt.c:537
#: scanopt.c:577
#, c-format
msgid "Unrecognized option `%s'\n"
msgstr "Neprepoznata opcija „%s”\n"
#: src/scanopt.c:541
#: scanopt.c:581
#, c-format
msgid "Unknown error=(%d)\n"
msgstr "Nepoznata greška=(%d)\n"
#: src/sym.c:92
#: sym.c:100
msgid "symbol table memory allocation failed"
msgstr "alokacija memorije za tablicu simbola nije uspjela"
#: src/sym.c:183
#: sym.c:202
msgid "name defined twice"
msgstr "ime je dvaput definirano"
#: src/sym.c:231
#: sym.c:253
#, c-format
msgid "start condition %s declared twice"
msgstr ""
#: src/yylex.c:57
#: yylex.c:56
msgid "premature EOF"
msgstr "preuranjen EOF"
#: src/yylex.c:200
#: yylex.c:198
#, c-format
msgid "End Marker\n"
msgstr "Oznaka kraja\n"
#: src/yylex.c:206
#: yylex.c:204
#, c-format
msgid "*Something Weird* - tok: %d val: %d\n"
msgstr "*Nešto je čudno* - simbol: %d vrijednost: %d\n"
+588 -972
View File
File diff suppressed because it is too large Load Diff
+188 -228
View File
File diff suppressed because it is too large Load Diff
+187 -224
View File
File diff suppressed because it is too large Load Diff
-929
View File
@@ -1,929 +0,0 @@
# Portuguese (Portugal) translation for the flex package.
# Copyright (C) 2019 The Flex Project (msgids)
# This file is put in the public domain.
# Pedro Albuquerque <palbuquerque73@gmail.com>, 2019.
#
msgid ""
msgstr ""
"Project-Id-Version: flex 2.5.38\n"
"Report-Msgid-Bugs-To: flex-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2014-02-11 16:15-0500\n"
"PO-Revision-Date: 2019-05-23 10:15+0100\n"
"Last-Translator: Pedro Albuquerque <palbuquerque73@gmail.com>\n"
"Language-Team: Portuguese <translation-team-pt@lists.sourceforge.net>\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Bugs: Report translation errors to the Language-Team address.\n"
"Plural-Forms: nplurals=2; plural=n != 1;\\n\n"
"X-Bugs: Report translation errors to the Language-Team address.\n"
#: buf.c:78
msgid "Allocation of buffer to print string failed"
msgstr "Falha ao alocar buffer para imprimir a cadeia"
#: buf.c:100
msgid "Allocation of buffer for line directive failed"
msgstr "Falha ao alocar buffer para directiva de linha"
#: buf.c:177
msgid "Allocation of buffer for m4 def failed"
msgstr "Falha ao alocar buffer para m4 def"
#: buf.c:197
msgid "Allocation of buffer for m4 undef failed"
msgstr "Falha ao alocar buffer para m4 undef"
#: dfa.c:61
#, c-format
msgid "State #%d is non-accepting -\n"
msgstr "Estado nº %d não está a aceitar -\n"
#: dfa.c:124
msgid "dangerous trailing context"
msgstr "conteúdo final perigoso"
#: dfa.c:166
#, c-format
msgid " associated rule line numbers:"
msgstr " números de linha de regra associada:"
#: dfa.c:202
#, c-format
msgid " out-transitions: "
msgstr " out-transitions: "
#: dfa.c:210
#, c-format
msgid ""
"\n"
" jam-transitions: EOF "
msgstr ""
"\n"
" jam-transitions: EOF "
#: dfa.c:341
msgid "consistency check failed in epsclosure()"
msgstr "falha no teste de consistência em epsclosure()"
#: dfa.c:429
msgid ""
"\n"
"\n"
"DFA Dump:\n"
"\n"
msgstr ""
"\n"
"\n"
"DFA Dump:\n"
"\n"
#: dfa.c:604
msgid "could not create unique end-of-buffer state"
msgstr "impossível criar estado end-of-buffer exclusivo"
#: dfa.c:625
#, c-format
msgid "state # %d:\n"
msgstr "estado nº %d\n"
#: dfa.c:785
msgid "Could not write yynxt_tbl[][]"
msgstr "Impossível escrever yynxt_tbl[][]"
#: dfa.c:1049
msgid "bad transition character detected in sympartition()"
msgstr "detectado um mau carácter de transição em sympartition()"
#: gen.c:478
msgid ""
"\n"
"\n"
"Equivalence Classes:\n"
"\n"
msgstr ""
"\n"
"\n"
"Classes de equivalência:\n"
"\n"
#: gen.c:662 gen.c:691 gen.c:1215
#, c-format
msgid "state # %d accepts: [%d]\n"
msgstr "estado nº %d aceita: [%d]\n"
#: gen.c:1110
#, c-format
msgid "state # %d accepts: "
msgstr "estado nº %d aceita: "
#: gen.c:1157
msgid "Could not write yyacclist_tbl"
msgstr "Impossível escrever yyacclist_tbl"
#: gen.c:1233
msgid "Could not write yyacc_tbl"
msgstr "Impossível escrever yyacc_tbl"
#: gen.c:1248 gen.c:1633 gen.c:1656
msgid "Could not write ecstbl"
msgstr "Impossível escrever ecstbl"
#: gen.c:1271
msgid ""
"\n"
"\n"
"Meta-Equivalence Classes:\n"
msgstr ""
"\n"
"\n"
"Classes de meta-equivalência:\n"
#: gen.c:1293
msgid "Could not write yymeta_tbl"
msgstr "Impossível escrever yymeta_tbl"
#: gen.c:1354
msgid "Could not write yybase_tbl"
msgstr "Impossível escrever yybase_tbl"
#: gen.c:1388
msgid "Could not write yydef_tbl"
msgstr "Impossível escrever yydef_tbl"
#: gen.c:1428
msgid "Could not write yynxt_tbl"
msgstr "Impossível escrever yynxt_tbl"
#: gen.c:1464
msgid "Could not write yychk_tbl"
msgstr "Impossível escrever yychk_tbl"
#: gen.c:1618 gen.c:1647
msgid "Could not write ftbl"
msgstr "Impossível escrever ftbl"
#: gen.c:1624
msgid "Could not write ssltbl"
msgstr "Impossível escrever ssltbl"
#: gen.c:1675
msgid "Could not write eoltbl"
msgstr "Impossível escrever eoltbl"
#: gen.c:1735
msgid "Could not write yynultrans_tbl"
msgstr "Impossível escrever yynultrans_tbl"
#: main.c:191
msgid "rule cannot be matched"
msgstr "impossível comparar a regra"
#: main.c:196
msgid "-s option given but default rule can be matched"
msgstr "indicada a opção -s, mas a regra predefinida pode ser comparada"
#: main.c:236
msgid "Can't use -+ with -l option"
msgstr "Impossível usar -+ com a opção -l"
#: main.c:239
msgid "Can't use -f or -F with -l option"
msgstr "Impossível usar -f ou -F com a opção -l"
#: main.c:243
msgid "Can't use --reentrant or --bison-bridge with -l option"
msgstr "Impossível usar --reentrant ou --bison-bridge com a opção -l"
#: main.c:275
msgid "-Cf/-CF and -Cm don't make sense together"
msgstr "-Cf/-CF e -Cm não fazem sentido em conjunto"
#: main.c:278
msgid "-Cf/-CF and -I are incompatible"
msgstr "-Cf/-CF e -I são incompatíveis"
#: main.c:282
msgid "-Cf/-CF are incompatible with lex-compatibility mode"
msgstr "-Cf/-CF são incompatíveis com o modo lex-compatibility"
#: main.c:287
msgid "-Cf and -CF are mutually exclusive"
msgstr "-Cf e -CF são mutuamente exclusivas"
#: main.c:291
msgid "Can't use -+ with -CF option"
msgstr "Impossível usar -+ com a opção -CF"
#: main.c:294
#, c-format
msgid "%array incompatible with -+ option"
msgstr "%array incompatível com a opção -+"
#: main.c:299
msgid "Options -+ and --reentrant are mutually exclusive."
msgstr "As opções -+ e --reentrant são mutuamente exclusivas."
#: main.c:302
msgid "bison bridge not supported for the C++ scanner."
msgstr "bison bridge não suportada no analisador C++."
#: main.c:357 main.c:403
#, c-format
msgid "could not create %s"
msgstr "impossível criar %s"
#: main.c:416
msgid "could not write tables header"
msgstr "impossível criar cabeçalho de tabelas"
#: main.c:420
#, c-format
msgid "can't open skeleton file %s"
msgstr "impossível abrir ficheiro esqueleto %s"
#: main.c:456
msgid "allocation of macro definition failed"
msgstr "falha ao alocar definição de macro"
#: main.c:504
#, c-format
msgid "input error reading skeleton file %s"
msgstr "erro de entrada ao ler ficheiro esqueleto %s"
#: main.c:508
#, c-format
msgid "error closing skeleton file %s"
msgstr "erro ao fechar ficheiro esqueleto %s"
#: main.c:693
#, c-format
msgid "error creating header file %s"
msgstr "erro ao criar ficheiro de cabeçalho %s"
#: main.c:701
#, c-format
msgid "error writing output file %s"
msgstr "erro ao escrever ficheiro de saída %s"
#: main.c:705
#, c-format
msgid "error closing output file %s"
msgstr "erro ao fechar ficheiro de saída %s"
#: main.c:709
#, c-format
msgid "error deleting output file %s"
msgstr "erro ao eliminar ficheiro de saída %s"
#: main.c:716
#, c-format
msgid "No backing up.\n"
msgstr "Sem seguranças.\n"
#: main.c:720
#, c-format
msgid "%d backing up (non-accepting) states.\n"
msgstr "%d estados de segurança (não aceitando).\n"
#: main.c:724
#, c-format
msgid "Compressed tables always back up.\n"
msgstr "Tabelas comprimidas têm sempre segurança.\n"
#: main.c:727
#, c-format
msgid "error writing backup file %s"
msgstr "erro ao escrever segurança %s"
#: main.c:731
#, c-format
msgid "error closing backup file %s"
msgstr "erro ao fechar segurança %s"
#: main.c:736
#, c-format
msgid "%s version %s usage statistics:\n"
msgstr "%s versão %s estatisticas de uso:\n"
#: main.c:739
#, c-format
msgid " scanner options: -"
msgstr " opções do analisador: -"
#: main.c:818
#, c-format
msgid " %d/%d NFA states\n"
msgstr " estados NFA %d/%d\n"
#: main.c:820
#, c-format
msgid " %d/%d DFA states (%d words)\n"
msgstr " estados DFA %d/%d (%d palavras)\n"
#: main.c:822
#, c-format
msgid " %d rules\n"
msgstr " %d regras\n"
#: main.c:827
#, c-format
msgid " No backing up\n"
msgstr " Sem seguranças\n"
#: main.c:831
#, c-format
msgid " %d backing-up (non-accepting) states\n"
msgstr " %d estados de segurança (não aceitando).\n"
#: main.c:836
#, c-format
msgid " Compressed tables always back-up\n"
msgstr "Tabelas comprimidas têm sempre segurança.\n"
#: main.c:840
#, c-format
msgid " Beginning-of-line patterns used\n"
msgstr " Padrões de início de linha usados\n"
#: main.c:842
#, c-format
msgid " %d/%d start conditions\n"
msgstr " condições iniciais %d/%d\n"
#: main.c:846
#, c-format
msgid " %d epsilon states, %d double epsilon states\n"
msgstr " estados epsilon %d, estados duplo epsilon %d\n"
#: main.c:850
#, c-format
msgid " no character classes\n"
msgstr " sem classes de carácter\n"
#: main.c:854
#, c-format
msgid " %d/%d character classes needed %d/%d words of storage, %d reused\n"
msgstr " classes de carácter %d/%d necessárias %d/%d palavras de armazenamento, %d reutilizadas\n"
#: main.c:859
#, c-format
msgid " %d state/nextstate pairs created\n"
msgstr " %d pares estado/estado seguinte criados\n"
#: main.c:862
#, c-format
msgid " %d/%d unique/duplicate transitions\n"
msgstr " %d/%d transições únicas/duplicadas\n"
#: main.c:867
#, c-format
msgid " %d table entries\n"
msgstr " %d entradas de tabela\n"
#: main.c:875
#, c-format
msgid " %d/%d base-def entries created\n"
msgstr " %d/%d entradas base-def criadas\n"
#: main.c:879
#, c-format
msgid " %d/%d (peak %d) nxt-chk entries created\n"
msgstr " %d/%d (pico %d) entradas nxt-chk criadas\n"
#: main.c:883
#, c-format
msgid " %d/%d (peak %d) template nxt-chk entries created\n"
msgstr " %d/%d (pico %d) entradas modelo nxt-chk criadas\n"
#: main.c:887
#, c-format
msgid " %d empty table entries\n"
msgstr " %d entradas de tabela vazias\n"
#: main.c:889
#, c-format
msgid " %d protos created\n"
msgstr " %d protos criados\n"
#: main.c:892
#, c-format
msgid " %d templates created, %d uses\n"
msgstr " %d modelos criados, %d usos\n"
#: main.c:900
#, c-format
msgid " %d/%d equivalence classes created\n"
msgstr " %d/%d classes de equivalência criadas\n"
#: main.c:908
#, c-format
msgid " %d/%d meta-equivalence classes created\n"
msgstr " %d/%d classes de meta-equivalência criadas\n"
#: main.c:914
#, c-format
msgid " %d (%d saved) hash collisions, %d DFAs equal\n"
msgstr " %d (%d gravadas) colisões de hash, %d DFAs iguais\n"
#: main.c:916
#, c-format
msgid " %d sets of reallocations needed\n"
msgstr " %d conjuntos de re-alocação necessários\n"
#: main.c:918
#, c-format
msgid " %d total table entries needed\n"
msgstr " %d entradas de tabela totais necessárias\n"
#: main.c:995
#, c-format
msgid "Internal error. flexopts are malformed.\n"
msgstr "Erro interno. flexopts mal formados.\n"
#: main.c:1005
#, c-format
msgid "Try `%s --help' for more information.\n"
msgstr "Tente \"%s --help\" para mais informação.\n"
#: main.c:1062
#, c-format
msgid "unknown -C option '%c'"
msgstr "Opção -C \"%c\" desconhecida"
#: main.c:1191
#, c-format
msgid "%s %s\n"
msgstr "%s %s\n"
#: main.c:1466
msgid "fatal parse error"
msgstr "erro de processamento fatal"
#: main.c:1498
#, c-format
msgid "could not create backing-up info file %s"
msgstr "impossível criar ficheiro de informação de segurança %s"
#: main.c:1519
#, c-format
msgid "-l AT&T lex compatibility option entails a large performance penalty\n"
msgstr "a opção de compatibilidade -l AT&T lex implica uma grande perda de desempenho\n"
#: main.c:1522
#, c-format
msgid " and may be the actual source of other reported performance penalties\n"
msgstr " e pode ser a fonte actual de outras penalizações de desempenho reportadas\n"
#: main.c:1528
#, c-format
msgid "%%option yylineno entails a performance penalty ONLY on rules that can match newline characters\n"
msgstr "a %%opção yylineno implica uma perda de desempenho SÓ em regras que possam comparar caracteres de nova linha\n"
#: main.c:1535
#, c-format
msgid "-I (interactive) entails a minor performance penalty\n"
msgstr "-I (interactiva) implica uma perda menor de desempenho\n"
#: main.c:1540
#, c-format
msgid "yymore() entails a minor performance penalty\n"
msgstr "yymore() implica uma perda menor de desempenho\n"
#: main.c:1546
#, c-format
msgid "REJECT entails a large performance penalty\n"
msgstr "REJECT implica uma grave perda de desempenho\n"
#: main.c:1551
#, c-format
msgid "Variable trailing context rules entail a large performance penalty\n"
msgstr "Regras variáveis de contexto final implicam uma grave perda de desempenho\n"
#: main.c:1563
msgid "REJECT cannot be used with -f or -F"
msgstr "REJECT não ode ser usado com -f ou -F"
#: main.c:1566
#, c-format
msgid "%option yylineno cannot be used with REJECT"
msgstr "a %opção yylineno não pode ser usada com REJECT"
#: main.c:1569
msgid "variable trailing context rules cannot be used with -f or -F"
msgstr "regras variáveis de contexto final não podem ser usadas com -f ou -F"
#: main.c:1692
#, c-format
msgid "%option yyclass only meaningful for C++ scanners"
msgstr "a %opção yyclass só tem significado para analisadores C++"
#: main.c:1799
#, c-format
msgid "Usage: %s [OPTIONS] [FILE]...\n"
msgstr "Uso: %s [OPÇÕES] [FICHEIRO]...\n"
#: main.c:1802
#, c-format
msgid ""
"Generates programs that perform pattern-matching on text.\n"
"\n"
"Table Compression:\n"
" -Ca, --align trade off larger tables for better memory alignment\n"
" -Ce, --ecs construct equivalence classes\n"
" -Cf do not compress tables; use -f representation\n"
" -CF do not compress tables; use -F representation\n"
" -Cm, --meta-ecs construct meta-equivalence classes\n"
" -Cr, --read use read() instead of stdio for scanner input\n"
" -f, --full generate fast, large scanner. Same as -Cfr\n"
" -F, --fast use alternate table representation. Same as -CFr\n"
" -Cem default compression (same as --ecs --meta-ecs)\n"
"\n"
"Debugging:\n"
" -d, --debug enable debug mode in scanner\n"
" -b, --backup write backing-up information to %s\n"
" -p, --perf-report write performance report to stderr\n"
" -s, --nodefault suppress default rule to ECHO unmatched text\n"
" -T, --trace %s should run in trace mode\n"
" -w, --nowarn do not generate warnings\n"
" -v, --verbose write summary of scanner statistics to stdout\n"
"\n"
"Files:\n"
" -o, --outfile=FILE specify output filename\n"
" -S, --skel=FILE specify skeleton file\n"
" -t, --stdout write scanner on stdout instead of %s\n"
" --yyclass=NAME name of C++ class\n"
" --header-file=FILE create a C header file in addition to the scanner\n"
" --tables-file[=FILE] write tables to FILE\n"
"\n"
"Scanner behavior:\n"
" -7, --7bit generate 7-bit scanner\n"
" -8, --8bit generate 8-bit scanner\n"
" -B, --batch generate batch scanner (opposite of -I)\n"
" -i, --case-insensitive ignore case in patterns\n"
" -l, --lex-compat maximal compatibility with original lex\n"
" -X, --posix-compat maximal compatibility with POSIX lex\n"
" -I, --interactive generate interactive scanner (opposite of -B)\n"
" --yylineno track line count in yylineno\n"
"\n"
"Generated code:\n"
" -+, --c++ generate C++ scanner class\n"
" -Dmacro[=defn] #define macro defn (default defn is '1')\n"
" -L, --noline suppress #line directives in scanner\n"
" -P, --prefix=STRING use STRING as prefix instead of \"yy\"\n"
" -R, --reentrant generate a reentrant C scanner\n"
" --bison-bridge scanner for bison pure parser.\n"
" --bison-locations include yylloc support.\n"
" --stdinit initialize yyin/yyout to stdin/stdout\n"
" --noansi-definitions old-style function definitions\n"
" --noansi-prototypes empty parameter list in prototypes\n"
" --nounistd do not include <unistd.h>\n"
" --noFUNCTION do not generate a particular FUNCTION\n"
"\n"
"Miscellaneous:\n"
" -c do-nothing POSIX option\n"
" -n do-nothing POSIX option\n"
" -?\n"
" -h, --help produce this help message\n"
" -V, --version report %s version\n"
msgstr ""
"Gera programas que realizam comparação de padrões em texto.\n"
"\n"
"Compressão de tabela:\n"
" -Ca, --align troca tabelas maiores para melhor alinhamento da memória\n"
" -Ce, --ecs constrói classes de equivalência\n"
" -Cf não comprime tabelas; usa representação -f\n"
" -CF não comprime tabelas; usa representação -F\n"
" -Cm, --meta-ecs constrói classes de meta-equivalência\n"
" -Cr, --read usa read() em vez de stdio para entrada do analisador\n"
" -f, --full gera analisador rápido e grande. Igual a -Cfr\n"
" -F, --fast usa representação de tabela alternativa. Igual a -CFr\n"
" -Cem compressão predefinida (igual a --ecs --meta-ecs)\n"
"\n"
"Depuração:\n"
" -d, --debug activa modo de depuração no analisador\n"
" -b, --backup escreve informação de segurança em %s\n"
" -p, --perf-report escreve relatório de desempenho em stderr\n"
" -s, --nodefault suprime regra predefinida para texto não comparado em ECHO\n"
" -T, --trace %s deve correr em modo de rasto\n"
" -w, --nowarn não gera avisos\n"
" -v, --verbose escreve resumo das estatísticas do analisador em stdout\n"
"\n"
"Ficheiros:\n"
" -o, --outfile=FICH especifica o ficheiro de saída\n"
" -S, --skel=FICH especifica o ficheiro esqueleto\n"
" -t, --stdout escreve o analisador em stdout em vez de %s\n"
" --yyclass=NOME nome da classe C++\n"
" --header-file=FICH cria um ficheiro de cabeçalho C além do analisador\n"
" --tables-file[=FICH] escreve tabelas em FICH\n"
"\n"
"Comportamento do analisador:\n"
" -7, --7bit gera analisador de 7-bit\n"
" -8, --8bit gera analisador de 8-bit\n"
" -B, --batch gera analisador em lote (oposto de -I)\n"
" -i, --case-insensitive ignora maiúsculas em padrões\n"
" -l, --lex-compat compatibilidade máxima com o léxico original\n"
" -X, --posix-compat compatibilidade máxima com o léxico POSIX\n"
" -I, --interactive gera analisador interactivo (oposto de -B)\n"
" --yylineno segue o total de linhas em yylineno\n"
"\n"
"Código gerado:\n"
" -+, --c++ gera classe de analisador C++\n"
" -Dmacro[=defn] #define macro defn (defn predefinido é \"1\")\n"
" -L, --noline suprime directivas #line no analisador\n"
" -P, --prefix=CADEIA usa CADEIA como prefixo em vez de \"yy\"\n"
" -R, --reentrant gera um analisador reentrant C\n"
" --bison-bridge analisador para processador de bison puro.\n"
" --bison-locations inclui suporte yylloc.\n"
" --stdinit inicializa yyin/yyout para stdin/stdout\n"
" --noansi-definitions definições de funções de estilo antigo\n"
" --noansi-prototypes lista de parâmetros em protótipos\n"
" --nounistd não inclui <unistd.h>\n"
" --noFUNÇÃO não gera uma FUNÇÃO em particular\n"
"\n"
"Mistas:\n"
" -c opção POSIX não-fazer-nada\n"
" -n opção POSIX não-fazer-nada\n"
" -?\n"
" -h, --help mostra esta mensagem de ajuda\n"
" -V, --version mostra a versão %s\n"
#: misc.c:65
msgid "allocation of sko_stack failed"
msgstr "falha ao alocar sko_stack"
#: misc.c:102 misc.c:128
#, c-format
msgid "name \"%s\" ridiculously long"
msgstr "nome \"%s\" ridiculamente longo"
#: misc.c:177
msgid "memory allocation failed in allocate_array()"
msgstr "falha ao alocar memória em allocate_array()"
#: misc.c:230
#, c-format
msgid "bad character '%s' detected in check_char()"
msgstr "mau carácter \"%s\" detectado em check_char()"
#: misc.c:235
#, c-format
msgid "scanner requires -8 flag to use the character %s"
msgstr "o analisador requer bandeira -8 para usar o carácter %s"
#: misc.c:268
msgid "dynamic memory failure in copy_string()"
msgstr "falha de memória dinâmica copy_string()"
#: misc.c:367
#, c-format
msgid "%s: fatal internal error, %s\n"
msgstr "%s: erro interno fatal, %s\n"
#: misc.c:803
msgid "attempt to increase array size failed"
msgstr "falha ao tentar aumentar o tamanho da matriz"
#: misc.c:930
msgid "bad line in skeleton file"
msgstr "má linha em ficheiro esqueleto"
#: misc.c:979
msgid "memory allocation failed in yy_flex_xmalloc()"
msgstr "falha ao alocar memória em yy_flex_xmalloc()"
#: nfa.c:104
#, c-format
msgid ""
"\n"
"\n"
"********** beginning dump of nfa with start state %d\n"
msgstr ""
"\n"
"\n"
"********** a começar o despejo de nfa com estado inicial %d\n"
#: nfa.c:115
#, c-format
msgid "state # %4d\t"
msgstr "estado nº %4d\t"
#: nfa.c:130
#, c-format
msgid "********** end of dump\n"
msgstr "********** fim de despejo\n"
#: nfa.c:174
msgid "empty machine in dupmachine()"
msgstr "máquina vazia em dupmachine()"
#: nfa.c:240
#, c-format
msgid "Variable trailing context rule at line %d\n"
msgstr "Regra variável de contexto final na linha %d\n"
#: nfa.c:364
msgid "bad state type in mark_beginning_as_normal()"
msgstr "mau tipo de estado em mark_beginning_as_normal()"
#: nfa.c:609
#, c-format
msgid "input rules are too complicated (>= %d NFA states)"
msgstr "regras de entrada muito complicadas (>= %d estados NFA)"
#: nfa.c:688
msgid "found too many transitions in mkxtion()"
msgstr "encontradas demasiadas transições em mkxtion()"
#: nfa.c:714
#, c-format
msgid "too many rules (> %d)!"
msgstr "demasiadas regras (> %d)!"
#: parse.y:159
msgid "unknown error processing section 1"
msgstr "erro desconhecido ao processar a secção 1"
#: parse.y:184 parse.y:351
msgid "bad start condition list"
msgstr "má lista de condição inicial"
#: parse.y:315
msgid "unrecognized rule"
msgstr "regra não reconhecida"
#: parse.y:434 parse.y:447 parse.y:516
msgid "trailing context used twice"
msgstr "contexto final usado duas vezes"
#: parse.y:552 parse.y:562 parse.y:635 parse.y:645
msgid "bad iteration values"
msgstr "maus valores de iteração"
#: parse.y:580 parse.y:598 parse.y:663 parse.y:681
msgid "iteration value must be positive"
msgstr "o valor de iteração tem de ser positivo"
#: parse.y:804 parse.y:814
#, c-format
msgid "the character range [%c-%c] is ambiguous in a case-insensitive scanner"
msgstr "o intervalo de caracteres [%c-%c] é ambíguo num analisador que ignora maiúsculas"
#: parse.y:819
msgid "negative range in character class"
msgstr "intervalo negativo em classe de carácter"
#: parse.y:916
msgid "[:^lower:] is ambiguous in case insensitive scanner"
msgstr "[:^lower:] é ambíguo num analisador que ignora maiúsculas"
#: parse.y:922
msgid "[:^upper:] ambiguous in case insensitive scanner"
msgstr "[:^upper:] é ambíguo num analisador que ignora maiúsculas"
#: scan.l:75 scan.l:618 scan.l:676
msgid "Input line too long\n"
msgstr "Linha de entrada muito grande\n"
#: scan.l:161
#, c-format
msgid "malformed '%top' directive"
msgstr "directiva \"%top\" mal formada"
#: scan.l:183
#, no-c-format
msgid "unrecognized '%' directive"
msgstr "directiva \"%\" não reconhecida"
#: scan.l:192
msgid "Definition name too long\n"
msgstr "Nome de definição muito longo\n"
#: scan.l:284
msgid "Unmatched '{'"
msgstr "{ sem par"
#: scan.l:300
#, c-format
msgid "Definition value for {%s} too long\n"
msgstr "Valor de definição para {%s} muito longo\n"
#: scan.l:317
msgid "incomplete name definition"
msgstr "Definição de nome incompleta"
#: scan.l:443
msgid "Option line too long\n"
msgstr "Linha de opção muito longa\n"
#: scan.l:451
#, c-format
msgid "unrecognized %%option: %s"
msgstr "%%opção não reconhecida: %s"
#: scan.l:633 scan.l:800
msgid "bad character class"
msgstr "má classe de carácter"
#: scan.l:683
#, c-format
msgid "undefined definition {%s}"
msgstr "definição {%s} indefinida"
#: scan.l:755
#, c-format
msgid "bad <start condition>: %s"
msgstr "má <condição inicial>: %s"
#: scan.l:768
msgid "missing quote"
msgstr "aspa em falta"
#: scan.l:834
#, c-format
msgid "bad character class expression: %s"
msgstr "má expressão de classe de carácter: %s"
#: scan.l:856
msgid "bad character inside {}'s"
msgstr "mau carácter dentro de {}"
#: scan.l:862
msgid "missing }"
msgstr "} em falta"
#: scan.l:940
msgid "EOF encountered inside an action"
msgstr "EOF encontrado dentro de uma acção"
#: scan.l:945
msgid "EOF encountered inside pattern"
msgstr "EOF encontrado dentro de um padrão"
#: scan.l:967
#, c-format
msgid "bad character: %s"
msgstr "mau carácter: %s"
#: scan.l:996
#, c-format
msgid "can't open %s"
msgstr "impossível abrir %s"
#: scanopt.c:291
#, c-format
msgid "Usage: %s [OPTIONS]...\n"
msgstr "Uso: %s [OPÇÕES]...\n"
#: scanopt.c:564
#, c-format
msgid "option `%s' doesn't allow an argument\n"
msgstr "a opção \"%s\" não permite um argumento\n"
#: scanopt.c:569
#, c-format
msgid "option `%s' requires an argument\n"
msgstr "a opção \"%s\" requer um argumento\n"
#: scanopt.c:573
#, c-format
msgid "option `%s' is ambiguous\n"
msgstr "a opção \"%s\" é ambígua\n"
#: scanopt.c:577
#, c-format
msgid "Unrecognized option `%s'\n"
msgstr "Opção \"%s\" não reconhecida\n"
#: scanopt.c:581
#, c-format
msgid "Unknown error=(%d)\n"
msgstr "Erro desconhecido=(%d)\n"
#: sym.c:100
msgid "symbol table memory allocation failed"
msgstr "falha ao alocar memória de tabela de símbolos"
#: sym.c:202
msgid "name defined twice"
msgstr "nome definido duas vezes"
#: sym.c:253
#, c-format
msgid "start condition %s declared twice"
msgstr "condição inicial %s declarada duas vezes"
#: yylex.c:56
msgid "premature EOF"
msgstr "EOF prematuro"
#: yylex.c:198
#, c-format
msgid "End Marker\n"
msgstr "Marcador final\n"
#: yylex.c:204
#, c-format
msgid "*Something Weird* - tok: %d val: %d\n"
msgstr "*Algo esquisito* - tok: %d val: %d\n"
+186 -222
View File
File diff suppressed because it is too large Load Diff
+178 -292
View File
File diff suppressed because it is too large Load Diff
+184 -222
View File
File diff suppressed because it is too large Load Diff
+189 -226
View File
File diff suppressed because it is too large Load Diff
+455 -409
View File
File diff suppressed because it is too large Load Diff
+170 -274
View File
File diff suppressed because it is too large Load Diff
-975
View File
@@ -1,975 +0,0 @@
# Ukrainian translations for flex.
# Copyright (C) 2017 The Flex Project (msgids)
# This file is distributed under the same license as the flex package.
#
# Viktor Shepel <shepelvictor@bigmir.net>, 2017.
# Yuri Chornoivan <yurchor@ukr.net>, 2017.
msgid ""
msgstr ""
"Project-Id-Version: flex 2.5.38\n"
"Report-Msgid-Bugs-To: flex-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2017-05-24 18:00-0400\n"
"PO-Revision-Date: 2017-06-17 09:26+0300\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
"Language-Team: Ukrainian <translation-team-uk@lists.sourceforge.net>\n"
"Language: uk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Bugs: Report translation errors to the Language-Team address.\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"X-Generator: Lokalize 1.5\n"
#: src/buf.c:79
msgid "Allocation of buffer to print string failed"
msgstr "Не вдалось виділити буфер для рядка, що виводиться"
#: src/buf.c:107
msgid "Allocation of buffer for line directive failed"
msgstr "Не вдалось виділити буфер для рядкової директиви"
#: src/buf.c:177
msgid "Allocation of buffer for m4 def failed"
msgstr "Не вдалось виділити буфер для m4 def"
#: src/buf.c:198
msgid "Allocation of buffer for m4 undef failed"
msgstr "Не вдалось виділити буфер для m4 undef"
#: src/dfa.c:59
#, c-format
msgid "State #%d is non-accepting -\n"
msgstr "Стан #%d не є допустимим -\n"
#: src/dfa.c:119
msgid "dangerous trailing context"
msgstr "небезпечний замикаючий контекст"
#: src/dfa.c:159
#, c-format
msgid " associated rule line numbers:"
msgstr " номера рядків асоційованого правила:"
#: src/dfa.c:193
#, c-format
msgid " out-transitions: "
msgstr " out-переходи: "
#: src/dfa.c:201
#, c-format
msgid ""
"\n"
" jam-transitions: EOF "
msgstr ""
"\n"
" jam-переходи: EOF "
#: src/dfa.c:331
msgid "consistency check failed in epsclosure()"
msgstr "помилка при перевірці на цілісність у epsclosure()"
#: src/dfa.c:419
msgid ""
"\n"
"\n"
"DFA Dump:\n"
"\n"
msgstr ""
"\n"
"\n"
"Дамп ДСА:\n"
"\n"
#: src/dfa.c:587
msgid "could not create unique end-of-buffer state"
msgstr "неможливо створити унікальний стан end_of_buffer"
#: src/dfa.c:608
#, c-format
msgid "state # %d:\n"
msgstr "стан # %d:\n"
#: src/dfa.c:768
msgid "Could not write yynxt_tbl[][]"
msgstr "Неможливо записати yynxt_tbl[][]"
#: src/dfa.c:1028
msgid "bad transition character detected in sympartition()"
msgstr "виявлено невірний символ переходу в sympartition()"
#: src/gen.c:480
msgid ""
"\n"
"\n"
"Equivalence Classes:\n"
"\n"
msgstr ""
"\n"
"\n"
"Класи еквівалентності:\n"
"\n"
#: src/gen.c:669 src/gen.c:698 src/gen.c:1218
#, c-format
msgid "state # %d accepts: [%d]\n"
msgstr "стан # %d приймає: [%d]\n"
#: src/gen.c:1115
#, c-format
msgid "state # %d accepts: "
msgstr "стан # %d приймає: "
#: src/gen.c:1162
msgid "Could not write yyacclist_tbl"
msgstr "Неможливо записати yyacclist_tbl"
#: src/gen.c:1236
msgid "Could not write yyacc_tbl"
msgstr "Неможливо записати yyacc_tbl"
#: src/gen.c:1251 src/gen.c:1623 src/gen.c:1646
msgid "Could not write ecstbl"
msgstr "Неможливо записати ecstbl"
#: src/gen.c:1271
msgid ""
"\n"
"\n"
"Meta-Equivalence Classes:\n"
msgstr ""
"\n"
"\n"
"Мета-Еквівалентні Класи:\n"
#: src/gen.c:1293
msgid "Could not write yymeta_tbl"
msgstr "Неможливо записати yymeta_tbl"
#: src/gen.c:1352
msgid "Could not write yybase_tbl"
msgstr "Неможливо записати yybase_tbl"
#: src/gen.c:1384
msgid "Could not write yydef_tbl"
msgstr "Неможливо записати yydef_tbl"
#: src/gen.c:1422
msgid "Could not write yynxt_tbl"
msgstr "Неможливо записати yynxt_tbl"
#: src/gen.c:1456
msgid "Could not write yychk_tbl"
msgstr "Неможливо записати yychk_tbl"
#: src/gen.c:1608 src/gen.c:1637
msgid "Could not write ftbl"
msgstr "Неможливо записати ftbl"
#: src/gen.c:1614
msgid "Could not write ssltbl"
msgstr "Неможливо записати ssltbl"
#: src/gen.c:1665
msgid "Could not write eoltbl"
msgstr "Неможливо записати eoltbl"
#: src/gen.c:1722
msgid "Could not write yynultrans_tbl"
msgstr "Неможливо записати yynultrans_tbl"
#: src/main.c:178
msgid "rule cannot be matched"
msgstr "неможливо застосувати правило"
#: src/main.c:183
msgid "-s option given but default rule can be matched"
msgstr ""
"вказано параметр -s, але правило за замовчуванням може бути застосоване"
#: src/main.c:221
msgid "Can't use -+ with -l option"
msgstr "Неможливо використовувати -+ з параметром -l"
#: src/main.c:224
msgid "Can't use -f or -F with -l option"
msgstr "Неможливо використовувати -f або -F з параметром -l"
#: src/main.c:228
msgid "Can't use --reentrant or --bison-bridge with -l option"
msgstr ""
"Неможливо використовувати --reentrant або --bison-bridge з параметром -l"
#: src/main.c:260
msgid "-Cf/-CF and -Cm don't make sense together"
msgstr "Параметри -Cf/-CF і -Cm разом не мають сенсу"
#: src/main.c:263
msgid "-Cf/-CF and -I are incompatible"
msgstr "Параметри -Cf/-CF і -I несумісні"
#: src/main.c:267
msgid "-Cf/-CF are incompatible with lex-compatibility mode"
msgstr "Параметри -Cf/-CF несумісні з режимом lex-compatibility"
#: src/main.c:272
msgid "-Cf and -CF are mutually exclusive"
msgstr "Параметри -Cf і -CF є взаємовиключними"
#: src/main.c:276
msgid "Can't use -+ with -CF option"
msgstr "Неможливо використовувати -+ з параметром -CF"
#: src/main.c:279
#, c-format
msgid "%array incompatible with -+ option"
msgstr "%array несумісний з параметром -+"
#: src/main.c:284
msgid "Options -+ and --reentrant are mutually exclusive."
msgstr "Параметри -+ і --reentrant є взаємовиключними."
#: src/main.c:287
msgid "bison bridge not supported for the C++ scanner."
msgstr "bison bridge не підтримується для сканера C++."
#: src/main.c:336 src/main.c:419
#, c-format
msgid "could not create %s"
msgstr "неможливо створити %s"
#: src/main.c:431
msgid "could not write tables header"
msgstr "Неможливо записати заголовок таблиць"
#: src/main.c:435
#, c-format
msgid "can't open skeleton file %s"
msgstr "Неможливо відкрити файл-каркас %s"
#: src/main.c:450
msgid "Prefix cannot include '[' or ']'"
msgstr "Префікс не може містити «[» або «]»"
#: src/main.c:474
msgid "allocation of macro definition failed"
msgstr "Не вдалось розмістити визначення макросу"
#: src/main.c:521
#, c-format
msgid "input error reading skeleton file %s"
msgstr "помилка читання файла-каркаса %s"
#: src/main.c:525
#, c-format
msgid "error closing skeleton file %s"
msgstr "помилка при закритті файла-каркаса %s"
#: src/main.c:711
#, c-format
msgid "error creating header file %s"
msgstr "помилка створення файла-заголовку %s"
#: src/main.c:719
#, c-format
msgid "error writing output file %s"
msgstr "помилка запису у вихідний файл %s"
#: src/main.c:723
#, c-format
msgid "error closing output file %s"
msgstr "помилка закриття вихідного файла %s"
#: src/main.c:727
#, c-format
msgid "error deleting output file %s"
msgstr "помилка видалення вихідного файла %s"
#: src/main.c:734
#, c-format
msgid "No backing up.\n"
msgstr "Резервне копіювання вимкнено.\n"
#: src/main.c:738
#, c-format
msgid "%d backing up (non-accepting) states.\n"
msgstr "резервне копіювання %d (недопустимих) станів.\n"
#: src/main.c:742
#, c-format
msgid "Compressed tables always back up.\n"
msgstr "Створення резервних копій стислих таблиць виконується завжди.\n"
#: src/main.c:745
#, c-format
msgid "error writing backup file %s"
msgstr "помилка запису резервної копії файла %s"
#: src/main.c:749
#, c-format
msgid "error closing backup file %s"
msgstr "помилка закриття резервної копії файла %s"
#: src/main.c:754
#, c-format
msgid "%s version %s usage statistics:\n"
msgstr "статистика використання %s версії %s:\n"
#: src/main.c:757
#, c-format
msgid " scanner options: -"
msgstr " параметри сканера: -"
#: src/main.c:836
#, c-format
msgid " %d/%d NFA states\n"
msgstr " %d/%d станів НСА\n"
#: src/main.c:838
#, c-format
msgid " %d/%d DFA states (%d words)\n"
msgstr " %d/%d станів ДСА (%d слів)\n"
#: src/main.c:840
#, c-format
msgid " %d rules\n"
msgstr " %d правил\n"
#: src/main.c:845
#, c-format
msgid " No backing up\n"
msgstr " Резервне копіювання вимкнено\n"
#: src/main.c:849
#, c-format
msgid " %d backing-up (non-accepting) states\n"
msgstr " резервне копіювання %d (недопустимих) станів\n"
#: src/main.c:854
#, c-format
msgid " Compressed tables always back-up\n"
msgstr " Створення резервних копій стислих таблиць виконується завжди\n"
#: src/main.c:858
#, c-format
msgid " Beginning-of-line patterns used\n"
msgstr " Використовуються шаблони початку рядка\n"
#: src/main.c:860
#, c-format
msgid " %d/%d start conditions\n"
msgstr " %d/%d початкових умов\n"
#: src/main.c:864
#, c-format
msgid " %d epsilon states, %d double epsilon states\n"
msgstr " %d епсилон-станів, %d подвійних епсилон-станів\n"
#: src/main.c:868
#, c-format
msgid " no character classes\n"
msgstr " відсутні класи символів\n"
#: src/main.c:872
#, c-format
msgid " %d/%d character classes needed %d/%d words of storage, %d reused\n"
msgstr ""
" %d/%d символьних класів потребують %d/%d слів для зберігання, %d "
"використано вдруге\n"
#: src/main.c:877
#, c-format
msgid " %d state/nextstate pairs created\n"
msgstr " створено %d пар стан/наступний-стан\n"
#: src/main.c:880
#, c-format
msgid " %d/%d unique/duplicate transitions\n"
msgstr " %d/%d унікальних/повторюваних переходів\n"
#: src/main.c:885
#, c-format
msgid " %d table entries\n"
msgstr " %d елементів таблиці\n"
#: src/main.c:893
#, c-format
msgid " %d/%d base-def entries created\n"
msgstr " створено %d/%d base-def елементів\n"
#: src/main.c:897
#, c-format
msgid " %d/%d (peak %d) nxt-chk entries created\n"
msgstr " створено %d/%d (пік %d) записів nxt-chk\n"
#: src/main.c:901
#, c-format
msgid " %d/%d (peak %d) template nxt-chk entries created\n"
msgstr " створено %d/%d (пік %d) шаблонних записів nxt-chk\n"
#: src/main.c:905
#, c-format
msgid " %d empty table entries\n"
msgstr " %d порожніх елементів таблиці\n"
#: src/main.c:907
#, c-format
msgid " %d protos created\n"
msgstr " створено %d прототипів\n"
#: src/main.c:910
#, c-format
msgid " %d templates created, %d uses\n"
msgstr " створено %d шаблонів, %d використовується\n"
#: src/main.c:918
#, c-format
msgid " %d/%d equivalence classes created\n"
msgstr " створено класів еквівалентності %d/%d\n"
#: src/main.c:926
#, c-format
msgid " %d/%d meta-equivalence classes created\n"
msgstr " створено класів мета-еквівалентності %d/%d\n"
#: src/main.c:932
#, c-format
msgid " %d (%d saved) hash collisions, %d DFAs equal\n"
msgstr " %d (%d записано) колізій хеш-таблиці, %d еквівалентних ДСА\n"
#: src/main.c:934
#, c-format
msgid " %d sets of reallocations needed\n"
msgstr " потрібно %d наборів повторних розміщень\n"
#: src/main.c:936
#, c-format
msgid " %d total table entries needed\n"
msgstr " всього потрібно %d елементів таблиці\n"
#: src/main.c:1010
#, c-format
msgid "Internal error. flexopts are malformed.\n"
msgstr "Внутрішня помилка. Неправильне значення flexopts.\n"
#: src/main.c:1020
#, c-format
msgid "Try `%s --help' for more information.\n"
msgstr "Спробуйте «%s --help» для отримання більш докладного опису.\n"
#: src/main.c:1077
#, c-format
msgid "unknown -C option '%c'"
msgstr "невідоме значення «%c» для параметру -C"
#: src/main.c:1206
#, c-format
msgid "%s %s\n"
msgstr "%s %s\n"
#: src/main.c:1486
msgid "fatal parse error"
msgstr "фатальна помилка розбору"
#: src/main.c:1518
#, c-format
msgid "could not create backing-up info file %s"
msgstr "неможливо створити резервну копію інформаційного файла %s"
#: src/main.c:1539
#, c-format
msgid "-l AT&T lex compatibility option entails a large performance penalty\n"
msgstr ""
"Параметр -l сумісності з AT&T lex спричиняє значне зниження продуктивності\n"
#: src/main.c:1542
#, c-format
msgid " and may be the actual source of other reported performance penalties\n"
msgstr "і також може бути істинним джерелом проблем з продуктивністю\n"
#: src/main.c:1548
#, c-format
msgid ""
"%%option yylineno entails a performance penalty ONLY on rules that can match "
"newline characters\n"
msgstr ""
"%%option yylineno спричиняе значне зниження продуктивності ТІЛЬКИ для "
"правил, котрі описують символи нового рядка\n"
#: src/main.c:1555
#, c-format
msgid "-I (interactive) entails a minor performance penalty\n"
msgstr "-I (інтерактивний) спричиняе незначне зниження продуктивності\n"
#: src/main.c:1560
#, c-format
msgid "yymore() entails a minor performance penalty\n"
msgstr "yymore() спричиняе незначне зниження продуктивності\n"
#: src/main.c:1566
#, c-format
msgid "REJECT entails a large performance penalty\n"
msgstr "REJECT спричиняе значне зниження продуктивності\n"
#: src/main.c:1571
#, c-format
msgid "Variable trailing context rules entail a large performance penalty\n"
msgstr ""
"Правила котрі мають замикаючий контекст змінної довжини значно знижують "
"продуктивність\n"
#: src/main.c:1583
msgid "REJECT cannot be used with -f or -F"
msgstr "REJECT не може бути використано разом з -f або -F"
#: src/main.c:1586
#, c-format
msgid "%option yylineno cannot be used with REJECT"
msgstr "%option yylineno не може бути використано з REJECT"
#: src/main.c:1589
msgid "variable trailing context rules cannot be used with -f or -F"
msgstr ""
"Правила котрі мають замикаючий контекст змінної довжини не можуть бути "
"використані з -f or -F"
#: src/main.c:1714
#, c-format
msgid "%option yyclass only meaningful for C++ scanners"
msgstr "%option yyclass має сенс тільки для сканерів C++"
#: src/main.c:1801
#, c-format
msgid "Usage: %s [OPTIONS] [FILE]...\n"
msgstr "Використання: %s [ПАРАМЕТРИ] [ФАЙЛ]…\n"
#: src/main.c:1804
#, fuzzy, c-format
msgid ""
"Generates programs that perform pattern-matching on text.\n"
"\n"
"Table Compression:\n"
" -Ca, --align trade off larger tables for better memory alignment\n"
" -Ce, --ecs construct equivalence classes\n"
" -Cf do not compress tables; use -f representation\n"
" -CF do not compress tables; use -F representation\n"
" -Cm, --meta-ecs construct meta-equivalence classes\n"
" -Cr, --read use read() instead of stdio for scanner input\n"
" -f, --full generate fast, large scanner. Same as -Cfr\n"
" -F, --fast use alternate table representation. Same as -CFr\n"
" -Cem default compression (same as --ecs --meta-ecs)\n"
"\n"
"Debugging:\n"
" -d, --debug enable debug mode in scanner\n"
" -b, --backup write backing-up information to %s\n"
" -p, --perf-report write performance report to stderr\n"
" -s, --nodefault suppress default rule to ECHO unmatched text\n"
" -T, --trace %s should run in trace mode\n"
" -w, --nowarn do not generate warnings\n"
" -v, --verbose write summary of scanner statistics to stdout\n"
" --hex use hexadecimal numbers instead of octal in debug "
"outputs\n"
"\n"
"Files:\n"
" -o, --outfile=FILE specify output filename\n"
" -S, --skel=FILE specify skeleton file\n"
" -t, --stdout write scanner on stdout instead of %s\n"
" --yyclass=NAME name of C++ class\n"
" --header-file=FILE create a C header file in addition to the "
"scanner\n"
" --tables-file[=FILE] write tables to FILE\n"
"\n"
"Scanner behavior:\n"
" -7, --7bit generate 7-bit scanner\n"
" -8, --8bit generate 8-bit scanner\n"
" -B, --batch generate batch scanner (opposite of -I)\n"
" -i, --case-insensitive ignore case in patterns\n"
" -l, --lex-compat maximal compatibility with original lex\n"
" -X, --posix-compat maximal compatibility with POSIX lex\n"
" -I, --interactive generate interactive scanner (opposite of -B)\n"
" --yylineno track line count in yylineno\n"
"\n"
"Generated code:\n"
" -+, --c++ generate C++ scanner class\n"
" -Dmacro[=defn] #define macro defn (default defn is '1')\n"
" -L, --noline suppress #line directives in scanner\n"
" -P, --prefix=STRING use STRING as prefix instead of \"yy\"\n"
" -R, --reentrant generate a reentrant C scanner\n"
" --bison-bridge scanner for bison pure parser.\n"
" --bison-locations include yylloc support.\n"
" --stdinit initialize yyin/yyout to stdin/stdout\n"
" --nounistd do not include <unistd.h>\n"
" --noFUNCTION do not generate a particular FUNCTION\n"
"\n"
"Miscellaneous:\n"
" -c do-nothing POSIX option\n"
" -n do-nothing POSIX option\n"
" -?\n"
" -h, --help produce this help message\n"
" -V, --version report %s version\n"
msgstr ""
"Генерує програми, що знаходять шаблони у тексті.\n"
"\n"
"Стиснення таблиць:\n"
" -Ca, --align вирівняти таблиці у пам'яті збільшивши розмір\n"
" їх елементів\n"
" -Ce, --ecs створювати класи еквівалентності\n"
" -Cf не стискати таблиці; використовувати -f представлення\n"
" -CF не стискати таблиці; використовувати -F представлення\n"
" -Cm, --meta-ecs створювати класи мета-еквівалентності\n"
" -Cr, --read використати read() замість stdio як\n"
" вхідні дані сканера\n"
" -f, --full створити швидкий, великий сканер. Теж саме, що -Cfr\n"
" -F, --fast застосувати альтернативний опис таблиць.\n"
" Теж саме, що -CFr\n"
" -Cem степінь стиснення за замовчуванням\n"
" (теж саме, що --ecs --meta-ecs)\n"
"\n"
"Налагодження:\n"
" -d, --debug увімкнути режим налагодження сканера\n"
" -b, --backup записати резервну копію до %s\n"
" -p, --perf-report записати звіт про продуктивність до stderr\n"
" -s, --nodefault припинити вивід тексту (ECHO до stdout)\n"
" що не збігається з жодним правилом\n"
" -T, --trace %s повинен запускатися у режимі трасування\n"
" -w, --nowarn не видавати попереджень\n"
" -v, --verbose записати підсумкову статистику сканера до stdout\n"
"\n"
"Файли:\n"
" -o, --outfile=ФАЙЛ вказати ім'я вихідного файла\n"
" -S, --skel=ФАЙЛ вказати файл каркасу\n"
" -t, --stdout записати сканер до stdout замість %s\n"
" --yyclass=ІМ'Я ім'я класу C++\n"
" --header-file=ФАЙЛ створити C файл заголовок сканера\n"
" --tables-file[=ФАЙЛ] записати таблиці у ФАЙЛ\n"
"\n"
"Поведінка сканера:\n"
" -7, --7bit створити 7-бітний сканер\n"
" -8, --8bit створити 8-бітний сканер\n"
" -B, --batch створити пакетний сканер\n"
" (протилежна за властивостями до опції -I)\n"
" -i, --case-insensitive ігнорувати регістр символів у шаблонах\n"
" -l, --lex-compat максимальна сумісність з оригінальним lex\n"
" -X, --posix-compat максимальна сумісність з POSIX lex\n"
" -I, --interactive створити інтерактивний сканер\n"
" (протилежна за властивостями до опції -B)\n"
" --yylineno відслідковувати число рядків у yylineno\n"
"\n"
"Генерація коду:\n"
" -+, --c++ створити C++ клас сканера\n"
" -Dmacro[=defn] #define macro defn (за замовчуванням defn='1')\n"
" -L, --noline не створювати #line директиви для сканера\n"
" -P, --prefix=РЯДОК використати РЯДОК як префікс замість «yy»\n"
" -R, --reentrant генерувати реентерабельний C-сканер\n"
" --bison-bridge сканер тільки для bison аналізатору\n"
" --bison-locations додати підтримку yylloc\n"
" --stdinit ініціалізувати yyin/yyout до stdin/stdout\n"
" --noansi-definitions визначення функцій у застарілому стилі\n"
" --noansi-prototypes порожній список параметрів у прототипах\n"
" --nounistd не додавати <unistd.h>\n"
" --noФУНКЦІЯ не генерувати задану функцію ФУНКЦІЯ\n"
"\n"
"Інше:\n"
" -с недіючий POSIX параметр\n"
" -n недіючий POSIX параметр\n"
" -?\n"
" -h, --help показати цю довідку\n"
" -V, --version показати версію %s\n"
#: src/misc.c:64
msgid "allocation of sko_stack failed"
msgstr "не вдалось отримати пам’ять під sko_stack"
#: src/misc.c:100
#, c-format
msgid "name \"%s\" ridiculously long"
msgstr "ім'я «%s» занадто довге"
#: src/misc.c:149 src/misc.c:162
msgid "memory allocation failed in allocate_array()"
msgstr "помилка виділення пам'яті у allocate_array()"
#: src/misc.c:212
#, c-format
msgid "bad character '%s' detected in check_char()"
msgstr "check_char() виявив недопустимий символ «%s»"
#: src/misc.c:217
#, c-format
msgid "scanner requires -8 flag to use the character %s"
msgstr "для використання символу %s сканер потребує опцію -8"
#: src/misc.c:236
msgid "memory allocation failure in xstrdup()"
msgstr "помилка виділення пам'яті у xstrdup()"
#: src/misc.c:310
#, c-format
msgid "%s: fatal internal error, %s\n"
msgstr "%s: фатальна внутрішня помилка, %s\n"
#: src/misc.c:671 src/misc.c:683
msgid "attempt to increase array size failed"
msgstr "помилка при спробі збільшити розмір масиву"
#: src/misc.c:807
msgid "bad line in skeleton file"
msgstr "невідомий рядок у файлі-каркасі"
#: src/misc.c:857
msgid "memory allocation failed in yy_flex_xmalloc()"
msgstr "помилка виділення пам'яті у yy_flex_xmalloc()"
#: src/nfa.c:100
#, c-format
msgid ""
"\n"
"\n"
"********** beginning dump of nfa with start state %d\n"
msgstr ""
"\n"
"\n"
"********** початок дампу НСА з початковим станом %d\n"
#: src/nfa.c:111
#, c-format
msgid "state # %4d\t"
msgstr "стан # %4d\t"
#: src/nfa.c:126
#, c-format
msgid "********** end of dump\n"
msgstr "********** кінець дампу\n"
#: src/nfa.c:169
msgid "empty machine in dupmachine()"
msgstr "порожній автомат у dupmachine()"
#: src/nfa.c:234
#, c-format
msgid "Variable trailing context rule at line %d\n"
msgstr "Правило із замикаючим контекстом змінної довжини у стрічці %d\n"
#: src/nfa.c:357
msgid "bad state type in mark_beginning_as_normal()"
msgstr "невідомий тип стану у mark_beginning_as_normal()"
#: src/nfa.c:595
#, c-format
msgid "input rules are too complicated (>= %d NFA states)"
msgstr "вхідні правила занадто складні (>= %d станів НСА)"
#: src/nfa.c:673
msgid "found too many transitions in mkxtion()"
msgstr "знайдено занадто багато переходів у mkxtion()"
#: src/nfa.c:699
#, c-format
msgid "too many rules (> %d)!"
msgstr "занадто багато правил (> %d)!"
#: src/parse.y:159
msgid "unknown error processing section 1"
msgstr "невідома помилка при обробці розділу 1"
#: src/parse.y:184 src/parse.y:353
msgid "bad start condition list"
msgstr "невірний список початкових умов"
#: src/parse.y:204
msgid "Prefix must not contain [ or ]"
msgstr "Префікс не може містити символи «[» або «]»"
#: src/parse.y:317
msgid "unrecognized rule"
msgstr "нерозпізнане правило"
#: src/parse.y:436 src/parse.y:449 src/parse.y:518
msgid "trailing context used twice"
msgstr "замикаючий контекст використано двічі"
#: src/parse.y:554 src/parse.y:564 src/parse.y:637 src/parse.y:647
msgid "bad iteration values"
msgstr "невірно сформований діапазон ітерацій"
#: src/parse.y:582 src/parse.y:600 src/parse.y:665 src/parse.y:683
msgid "iteration value must be positive"
msgstr "кількість ітерацій повинна бути додатнім числом"
#: src/parse.y:806 src/parse.y:816
#, c-format
msgid "the character range [%c-%c] is ambiguous in a case-insensitive scanner"
msgstr ""
"використання діапазону символів [%c-%c] є двозначним для сканера, що не "
"чутливий до регістру символів"
#: src/parse.y:821
msgid "negative range in character class"
msgstr ""
"символьний клас описано діапазоном, перший елемент котрого більший за "
"останній"
#: src/parse.y:918
msgid "[:^lower:] is ambiguous in case insensitive scanner"
msgstr ""
"використання [:^lower:] є невизначеним для сканера, що не чутливий до "
"регістру символів"
#: src/parse.y:924
msgid "[:^upper:] ambiguous in case insensitive scanner"
msgstr ""
"використання [:^upper:] є невизначеним для сканера, що не чутливий до "
"регістру символів"
#: src/scan.l:82 src/scan.l:646 src/scan.l:704
msgid "Input line too long\n"
msgstr "Занадто довгий вхідний рядок\n"
#: src/scan.l:183
#, c-format
msgid "malformed '%top' directive"
msgstr "нерозпізнана директива «%top»"
#: src/scan.l:205
#, no-c-format
msgid "unrecognized '%' directive"
msgstr "нерозпізнана директива «%»"
#: src/scan.l:214
msgid "Definition name too long\n"
msgstr "Визначення має занадто довге ім'я\n"
#: src/scan.l:309
msgid "Unmatched '{'"
msgstr "Непарна «{»"
#: src/scan.l:325
#, c-format
msgid "Definition value for {%s} too long\n"
msgstr "Визначення {%s} має занадто довге значення\n"
#: src/scan.l:342
msgid "incomplete name definition"
msgstr "неповне визначення імені"
#: src/scan.l:469
msgid "Option line too long\n"
msgstr "Занадто довгий параметр\n"
#: src/scan.l:477
#, c-format
msgid "unrecognized %%option: %s"
msgstr "нерозпізнаний %%option: %s"
#: src/scan.l:661 src/scan.l:834
msgid "bad character class"
msgstr "помилковий символьний клас"
#: src/scan.l:711
#, c-format
msgid "undefined definition {%s}"
msgstr "нерозпізнане визначення {%s}"
#: src/scan.l:774
msgid "unbalanced parenthesis"
msgstr "незбалансовані круглі дужки"
#: src/scan.l:789
#, c-format
msgid "bad <start condition>: %s"
msgstr "невірно сформованана <умова, що активує правило>: %s"
#: src/scan.l:802
msgid "missing quote"
msgstr "відсутні лапки"
#: src/scan.l:868
#, c-format
msgid "bad character class expression: %s"
msgstr "символьний клас заданий некоректним виразом: %s"
#: src/scan.l:890
msgid "bad character inside {}'s"
msgstr "неприйнятний символ всередині {}"
#: src/scan.l:896
msgid "missing }"
msgstr "відсутній }"
#: src/scan.l:974
msgid "EOF encountered inside an action"
msgstr "знайдено EOF всередині коду котрий асоційований з правилом"
#: src/scan.l:979
msgid "EOF encountered inside pattern"
msgstr "знайдено EOF всередині шаблону, що задає правило"
#: src/scan.l:1012
#, c-format
msgid "bad character: %s"
msgstr "неочікуваний символ: %s"
#: src/scan.l:1040
#, c-format
msgid "can't open %s"
msgstr "неможливо відкрити %s"
#: src/scanopt.c:259
#, c-format
msgid "Usage: %s [OPTIONS]...\n"
msgstr "Використання: %s [ПАРАМЕТРИ]…\n"
#: src/scanopt.c:524
#, c-format
msgid "option `%s' doesn't allow an argument\n"
msgstr "параметр «%s» повинен використовуватись без аргументу\n"
#: src/scanopt.c:529
#, c-format
msgid "option `%s' requires an argument\n"
msgstr "параметр «% s» повинен використовуватись з аргументом\n"
#: src/scanopt.c:533
#, c-format
msgid "option `%s' is ambiguous\n"
msgstr "параметр «%s» є двозначним\n"
#: src/scanopt.c:537
#, c-format
msgid "Unrecognized option `%s'\n"
msgstr "Нерозпізнаний параметр «%s»\n"
#: src/scanopt.c:541
#, c-format
msgid "Unknown error=(%d)\n"
msgstr "Невідома помилка=(%d)\n"
#: src/sym.c:92
msgid "symbol table memory allocation failed"
msgstr "помилка виділення пам'яті для таблиці символів"
#: src/sym.c:183
msgid "name defined twice"
msgstr "ім'я визначено двічі"
#: src/sym.c:231
#, c-format
msgid "start condition %s declared twice"
msgstr "початкова умова %s описана двічі"
#: src/yylex.c:57
msgid "premature EOF"
msgstr "неочікуваний EOF"
#: src/yylex.c:200
#, c-format
msgid "End Marker\n"
msgstr "Мітка кінця\n"
#: src/yylex.c:206
#, c-format
msgid "*Something Weird* - tok: %d val: %d\n"
msgstr "*Щось не так* — tok: %d val: %d\n"
#~ msgid "dynamic memory failure in copy_string()"
#~ msgstr "помилка під час роботи з динамічною пам’яттю у copy_string()"
-26
View File
@@ -1,26 +0,0 @@
#!/bin/sh
# shell for updating the translations before a release
# Let this be executed in the po/ subdir.
cd "$(dirname "$0")" || exit
echo "Updating translations via TP"
rsync -Lrtvz translationproject.org::tp/latest/flex/ . # || exit
# Are there now PO files that are not in svn yet?
NEWSTUFF=$(git status --porcelain *.po | grep "^??")
if [ -n "${NEWSTUFF}" ]; then
echo "New languages found; updating LINGUAS"
echo "# List of available languages." >LINGUAS
echo $(printf '%s\n' *.po | LC_ALL=C sort | sed 's/\.po//g') >>LINGUAS
fi
echo "Regenerating POT file and remerging and recompiling PO files..."
make update-po
# Ensure that the PO files are newer than the POT.
touch *.po
# Compile PO files
make
+194 -239
View File
File diff suppressed because it is too large Load Diff
+332 -561
View File
File diff suppressed because it is too large Load Diff
+174 -194
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: flex 2.5.37\n"
"Report-Msgid-Bugs-To: flex-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2017-05-06 10:49-0400\n"
"POT-Creation-Date: 2012-07-22 20:48-0400\n"
"PO-Revision-Date: 2013-02-12 23:23+0800\n"
"Last-Translator: Wei-Lun Chao <bluebat@member.fsf.org>\n"
"Language-Team: Chinese (traditional) <zh-l10n@linux.org.tw>\n"
@@ -16,45 +16,44 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Bugs: Report translation errors to the Language-Team address.\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: src/buf.c:79
#: buf.c:78
msgid "Allocation of buffer to print string failed"
msgstr "給予緩衝區配額以列印字串時失敗"
#: src/buf.c:107
#: buf.c:100
msgid "Allocation of buffer for line directive failed"
msgstr "給予緩衝區配額用於列指令時失敗"
#: src/buf.c:177
#: buf.c:177
msgid "Allocation of buffer for m4 def failed"
msgstr "給予緩衝區配額用於 m4 def 時失敗"
#: src/buf.c:198
#: buf.c:197
msgid "Allocation of buffer for m4 undef failed"
msgstr "給予緩衝區配額用於 m4 undef 時失敗"
#: src/dfa.c:59
#: dfa.c:61
#, c-format
msgid "State #%d is non-accepting -\n"
msgstr "#%d 正處於非存取狀態 -\n"
#: src/dfa.c:119
#: dfa.c:124
msgid "dangerous trailing context"
msgstr "不安全的末端內文"
#: src/dfa.c:159
#: dfa.c:166
#, c-format
msgid " associated rule line numbers:"
msgstr " 關聯的規則列號:"
#: src/dfa.c:193
#: dfa.c:202
#, c-format
msgid " out-transitions: "
msgstr " 外轉換:"
#: src/dfa.c:201
#: dfa.c:210
#, c-format
msgid ""
"\n"
@@ -63,11 +62,11 @@ msgstr ""
"\n"
" 合併轉換:檔案結尾 "
#: src/dfa.c:331
#: dfa.c:341
msgid "consistency check failed in epsclosure()"
msgstr "epsclosure() 中的一致性檢查失敗"
#: src/dfa.c:419
#: dfa.c:429
msgid ""
"\n"
"\n"
@@ -79,24 +78,24 @@ msgstr ""
" DFA 傾印:\n"
"\n"
#: src/dfa.c:587
#: dfa.c:604
msgid "could not create unique end-of-buffer state"
msgstr "無法建立獨一的緩衝區結尾狀態"
#: src/dfa.c:608
#: dfa.c:625
#, c-format
msgid "state # %d:\n"
msgstr "狀態 # %d:\n"
#: src/dfa.c:768
#: dfa.c:785
msgid "Could not write yynxt_tbl[][]"
msgstr "無法寫入 yynxt_tbl[][]"
#: src/dfa.c:1028
#: dfa.c:1049
msgid "bad transition character detected in sympartition()"
msgstr "在 sympartition() 偵測到不當的轉換字元"
#: src/gen.c:480
#: gen.c:478
msgid ""
"\n"
"\n"
@@ -108,29 +107,29 @@ msgstr ""
"等價類別:\n"
"\n"
#: src/gen.c:669 src/gen.c:698 src/gen.c:1218
#: gen.c:662 gen.c:691 gen.c:1215
#, c-format
msgid "state # %d accepts: [%d]\n"
msgstr "狀態 # %d 接受:[%d]\n"
#: src/gen.c:1115
#: gen.c:1110
#, c-format
msgid "state # %d accepts: "
msgstr "狀態 # %d 接受:"
#: src/gen.c:1162
#: gen.c:1157
msgid "Could not write yyacclist_tbl"
msgstr "無法寫入 yyacclist_tbl"
#: src/gen.c:1236
#: gen.c:1233
msgid "Could not write yyacc_tbl"
msgstr "無法寫入 yyacc_tbl"
#: src/gen.c:1251 src/gen.c:1623 src/gen.c:1646
#: gen.c:1248 gen.c:1633 gen.c:1656
msgid "Could not write ecstbl"
msgstr "無法寫入 ecstbl"
#: src/gen.c:1271
#: gen.c:1271
msgid ""
"\n"
"\n"
@@ -140,398 +139,392 @@ msgstr ""
"\n"
" 後設等價類別:\n"
#: src/gen.c:1293
#: gen.c:1293
msgid "Could not write yymeta_tbl"
msgstr "無法寫入 yymeta_tbl"
#: src/gen.c:1352
#: gen.c:1354
msgid "Could not write yybase_tbl"
msgstr "無法寫入 yybase_tbl"
#: src/gen.c:1384
#: gen.c:1388
msgid "Could not write yydef_tbl"
msgstr "無法寫入 yydef_tbl"
#: src/gen.c:1422
#: gen.c:1428
msgid "Could not write yynxt_tbl"
msgstr "無法寫入 yynxt_tbl"
#: src/gen.c:1456
#: gen.c:1464
msgid "Could not write yychk_tbl"
msgstr "無法寫入 yychk_tbl"
#: src/gen.c:1608 src/gen.c:1637
#: gen.c:1618 gen.c:1647
msgid "Could not write ftbl"
msgstr "無法寫入 ftbl"
#: src/gen.c:1614
#: gen.c:1624
msgid "Could not write ssltbl"
msgstr "無法寫入 ssltbl"
#: src/gen.c:1665
#: gen.c:1675
msgid "Could not write eoltbl"
msgstr "無法寫入 eoltbl"
#: src/gen.c:1722
#: gen.c:1735
msgid "Could not write yynultrans_tbl"
msgstr "無法寫入 yynultrans_tbl"
#: src/main.c:178
#: main.c:189
msgid "rule cannot be matched"
msgstr "規則無法吻合"
#: src/main.c:183
#: main.c:194
msgid "-s option given but default rule can be matched"
msgstr "-s 選項已給定但是可以吻合預設規則"
#: src/main.c:221
#: main.c:234
msgid "Can't use -+ with -l option"
msgstr "無法將 -+ 與 -l 選項共同使用"
#: src/main.c:224
#: main.c:237
msgid "Can't use -f or -F with -l option"
msgstr "無法將 -f 或 -F 與 -l 選項共同使用"
#: src/main.c:228
#: main.c:241
msgid "Can't use --reentrant or --bison-bridge with -l option"
msgstr "無法將 --reentrant 或 --bison-bridge 與 -l 選項共同使用"
#: src/main.c:260
#: main.c:278
msgid "-Cf/-CF and -Cm don't make sense together"
msgstr "-Cf/-CF 和 -Cm 共用時不具任何意義"
#: src/main.c:263
#: main.c:281
msgid "-Cf/-CF and -I are incompatible"
msgstr "-Cf/-CF 和 -I 是不相容的"
#: src/main.c:267
#: main.c:285
msgid "-Cf/-CF are incompatible with lex-compatibility mode"
msgstr "-Cf/-CF 與 lex 相容模式是不相容的"
#: src/main.c:272
#: main.c:290
msgid "-Cf and -CF are mutually exclusive"
msgstr "-Cf 和 -CF 是互斥的"
#: src/main.c:276
#: main.c:294
msgid "Can't use -+ with -CF option"
msgstr "無法將 -+ 與 -CF 選項共同使用"
#: src/main.c:279
#: main.c:297
#, c-format
msgid "%array incompatible with -+ option"
msgstr "%array 與 -+ 選項不相容"
#: src/main.c:284
#: main.c:302
msgid "Options -+ and --reentrant are mutually exclusive."
msgstr "選項 -+ 和 --reentrant 是互斥的。"
#: src/main.c:287
#: main.c:305
msgid "bison bridge not supported for the C++ scanner."
msgstr "bison 橋接器不受 C++ 掃描程式支援。"
#: src/main.c:336 src/main.c:419
#: main.c:360 main.c:406
#, c-format
msgid "could not create %s"
msgstr "無法建立 %s"
#: src/main.c:431
#: main.c:419
msgid "could not write tables header"
msgstr "無法寫入表頭"
#: src/main.c:435
#: main.c:423
#, c-format
msgid "can't open skeleton file %s"
msgstr "無法開啟架構檔案 %s"
#: src/main.c:450
msgid "Prefix cannot include '[' or ']'"
msgstr ""
#: src/main.c:474
#: main.c:459
msgid "allocation of macro definition failed"
msgstr "給予巨集定義配額時失敗"
#: src/main.c:521
#: main.c:507
#, c-format
msgid "input error reading skeleton file %s"
msgstr "讀取架構檔案 %s 時輸入錯誤"
#: src/main.c:525
#: main.c:511
#, c-format
msgid "error closing skeleton file %s"
msgstr "關閉架構檔案 %s 時發生錯誤"
#: src/main.c:709
#: main.c:696
#, c-format
msgid "error creating header file %s"
msgstr "建立標頭檔案 %s 時發生錯誤"
#: src/main.c:717
#: main.c:704
#, c-format
msgid "error writing output file %s"
msgstr "寫入輸出檔案 %s 時發生錯誤"
#: src/main.c:721
#: main.c:708
#, c-format
msgid "error closing output file %s"
msgstr "關閉輸出檔案 %s 時發生錯誤"
#: src/main.c:725
#: main.c:712
#, c-format
msgid "error deleting output file %s"
msgstr "刪除輸出檔案 %s 時發生錯誤"
#: src/main.c:732
#: main.c:719
#, c-format
msgid "No backing up.\n"
msgstr "沒有備份。\n"
#: src/main.c:736
#: main.c:723
#, c-format
msgid "%d backing up (non-accepting) states.\n"
msgstr "%d 備份 (非接受) 狀態。\n"
#: src/main.c:740
#: main.c:727
#, c-format
msgid "Compressed tables always back up.\n"
msgstr "壓縮過的表格自動備份。\n"
#: src/main.c:743
#: main.c:730
#, c-format
msgid "error writing backup file %s"
msgstr "寫入備份檔案 %s 時發生錯誤"
#: src/main.c:747
#: main.c:734
#, c-format
msgid "error closing backup file %s"
msgstr "關閉備份檔案 %s 時發生錯誤"
#: src/main.c:752
#: main.c:739
#, c-format
msgid "%s version %s usage statistics:\n"
msgstr "%s 版本 %s 用法統計:\n"
#: src/main.c:755
#: main.c:742
#, c-format
msgid " scanner options: -"
msgstr " 掃描程式選項:-"
#: src/main.c:834
#: main.c:821
#, c-format
msgid " %d/%d NFA states\n"
msgstr " %d/%d NFA 狀態\n"
#: src/main.c:836
#: main.c:823
#, c-format
msgid " %d/%d DFA states (%d words)\n"
msgstr " %d/%d DFA 狀態 (%d 個字詞)\n"
#: src/main.c:838
#: main.c:825
#, c-format
msgid " %d rules\n"
msgstr " %d 條規則\n"
#: src/main.c:843
#: main.c:830
#, c-format
msgid " No backing up\n"
msgstr " 沒有備份\n"
#: src/main.c:847
#: main.c:834
#, c-format
msgid " %d backing-up (non-accepting) states\n"
msgstr " %d 備份 (非接受) 狀態\n"
#: src/main.c:852
#: main.c:839
#, c-format
msgid " Compressed tables always back-up\n"
msgstr " 壓縮過的表格自動備份\n"
#: src/main.c:856
#: main.c:843
#, c-format
msgid " Beginning-of-line patterns used\n"
msgstr " 列首式樣已使用\n"
#: src/main.c:858
#: main.c:845
#, c-format
msgid " %d/%d start conditions\n"
msgstr " %d/%d 起始條件\n"
#: src/main.c:862
#: main.c:849
#, c-format
msgid " %d epsilon states, %d double epsilon states\n"
msgstr " %d ε狀態,%d 雙倍ε狀態\n"
#: src/main.c:866
#: main.c:853
#, c-format
msgid " no character classes\n"
msgstr " 無字元類別\n"
#: src/main.c:870
#: main.c:857
#, c-format
msgid " %d/%d character classes needed %d/%d words of storage, %d reused\n"
msgstr " %d/%d 字元類別所需 %d/%d 字詞的儲存體,%d 重新使用\n"
#: src/main.c:875
#: main.c:862
#, c-format
msgid " %d state/nextstate pairs created\n"
msgstr " %d 狀態/下一狀態對已建立\n"
#: src/main.c:878
#: main.c:865
#, c-format
msgid " %d/%d unique/duplicate transitions\n"
msgstr " %d/%d 獨一/重複轉換\n"
#: src/main.c:883
#: main.c:870
#, c-format
msgid " %d table entries\n"
msgstr " %d 表格項目\n"
#: src/main.c:891
#: main.c:878
#, c-format
msgid " %d/%d base-def entries created\n"
msgstr " %d/%d base-def 項目已建立\n"
#: src/main.c:895
#: main.c:882
#, c-format
msgid " %d/%d (peak %d) nxt-chk entries created\n"
msgstr " %d/%d (尖峰 %d) nxt-chk 項目已建立\n"
#: src/main.c:899
#: main.c:886
#, c-format
msgid " %d/%d (peak %d) template nxt-chk entries created\n"
msgstr " %d/%d (尖峰 %d) 模板 nxt-chk 項目已建立\n"
#: src/main.c:903
#: main.c:890
#, c-format
msgid " %d empty table entries\n"
msgstr " %d 清空表格項目\n"
#: src/main.c:905
#: main.c:892
#, c-format
msgid " %d protos created\n"
msgstr " %d 原型已建立\n"
#: src/main.c:908
#: main.c:895
#, c-format
msgid " %d templates created, %d uses\n"
msgstr " %d 範本已建立,%d 使用\n"
#: src/main.c:916
#: main.c:903
#, c-format
msgid " %d/%d equivalence classes created\n"
msgstr " %d/%d 等價類別已建立\n"
#: src/main.c:924
#: main.c:911
#, c-format
msgid " %d/%d meta-equivalence classes created\n"
msgstr " %d/%d 後設等價類別已建立\n"
#: src/main.c:930
#: main.c:917
#, c-format
msgid " %d (%d saved) hash collisions, %d DFAs equal\n"
msgstr " %d (%d 已儲存) 雜湊碰撞,%d DFAs 相等\n"
#: src/main.c:932
#: main.c:919
#, c-format
msgid " %d sets of reallocations needed\n"
msgstr " 需要 %d 組重新配置\n"
#: src/main.c:934
#: main.c:921
#, c-format
msgid " %d total table entries needed\n"
msgstr " 總計需要 %d 表格項目\n"
#: src/main.c:1008
#: main.c:998
#, c-format
msgid "Internal error. flexopts are malformed.\n"
msgstr "內部錯誤。flexopts 功能異常。\n"
#: src/main.c:1018
#: main.c:1008
#, c-format
msgid "Try `%s --help' for more information.\n"
msgstr "嘗試「%s --help」以獲得更多資訊。\n"
#: src/main.c:1075
#: main.c:1065
#, c-format
msgid "unknown -C option '%c'"
msgstr "不明 -C 選項「%c」"
#: src/main.c:1204
#: main.c:1194
#, c-format
msgid "%s %s\n"
msgstr "%s %s\n"
#: src/main.c:1476
#: main.c:1469
msgid "fatal parse error"
msgstr "嚴重的解析錯誤"
#: src/main.c:1508
#: main.c:1501
#, c-format
msgid "could not create backing-up info file %s"
msgstr "無法建立備份資訊檔案 %s"
#: src/main.c:1529
#: main.c:1522
#, c-format
msgid "-l AT&T lex compatibility option entails a large performance penalty\n"
msgstr "-l AT&T lex 相容性選項會導致大幅效能減退\n"
#: src/main.c:1532
#: main.c:1525
#, c-format
msgid " and may be the actual source of other reported performance penalties\n"
msgstr " 同時也許是其他回報效能減退的實際來源\n"
#: src/main.c:1538
#: main.c:1531
#, c-format
msgid ""
"%%option yylineno entails a performance penalty ONLY on rules that can match "
"newline characters\n"
msgid "%%option yylineno entails a performance penalty ONLY on rules that can match newline characters\n"
msgstr "%%option yylineno 導致效能減退,只有當該規則該吻合新列字元時才會\n"
#: src/main.c:1545
#: main.c:1538
#, c-format
msgid "-I (interactive) entails a minor performance penalty\n"
msgstr "-I (互動式) 導致小幅效能減退\n"
#: src/main.c:1550
#: main.c:1543
#, c-format
msgid "yymore() entails a minor performance penalty\n"
msgstr "yymore() 導致小幅效能減退\n"
#: src/main.c:1556
#: main.c:1549
#, c-format
msgid "REJECT entails a large performance penalty\n"
msgstr "REJECT 導致大幅效能減退\n"
#: src/main.c:1561
#: main.c:1554
#, c-format
msgid "Variable trailing context rules entail a large performance penalty\n"
msgstr "變數末尾內文規則導致大幅效能減退\n"
#: src/main.c:1573
#: main.c:1566
msgid "REJECT cannot be used with -f or -F"
msgstr "REJECT 無法與 -f 或 -F 共同使用"
#: src/main.c:1576
#: main.c:1569
#, c-format
msgid "%option yylineno cannot be used with REJECT"
msgstr "%option yylineno 無法與 REJECT 共同使用"
#: src/main.c:1579
#: main.c:1572
msgid "variable trailing context rules cannot be used with -f or -F"
msgstr "變數末尾內文規則無法與 -f 或 -F 共同使用"
#: src/main.c:1704
#: main.c:1695
#, c-format
msgid "%option yyclass only meaningful for C++ scanners"
msgstr "%option yyclass 只對於 C++ 掃描程式有意義"
#: src/main.c:1791
#: main.c:1802
#, c-format
msgid "Usage: %s [OPTIONS] [FILE]...\n"
msgstr "用法:%s [選項] [檔案]…\n"
#: src/main.c:1794
#, fuzzy, c-format
#: main.c:1805
#, c-format
msgid ""
"Generates programs that perform pattern-matching on text.\n"
"\n"
@@ -554,16 +547,13 @@ msgid ""
" -T, --trace %s should run in trace mode\n"
" -w, --nowarn do not generate warnings\n"
" -v, --verbose write summary of scanner statistics to stdout\n"
" --hex use hexadecimal numbers instead of octal in debug "
"outputs\n"
"\n"
"Files:\n"
" -o, --outfile=FILE specify output filename\n"
" -S, --skel=FILE specify skeleton file\n"
" -t, --stdout write scanner on stdout instead of %s\n"
" --yyclass=NAME name of C++ class\n"
" --header-file=FILE create a C header file in addition to the "
"scanner\n"
" --header-file=FILE create a C header file in addition to the scanner\n"
" --tables-file[=FILE] write tables to FILE\n"
"\n"
"Scanner behavior:\n"
@@ -585,6 +575,8 @@ msgid ""
" --bison-bridge scanner for bison pure parser.\n"
" --bison-locations include yylloc support.\n"
" --stdinit initialize yyin/yyout to stdin/stdout\n"
" --noansi-definitions old-style function definitions\n"
" --noansi-prototypes empty parameter list in prototypes\n"
" --nounistd do not include <unistd.h>\n"
" --noFUNCTION do not generate a particular FUNCTION\n"
"\n"
@@ -656,52 +648,51 @@ msgstr ""
" -h, --help 產生這個說明訊息\n"
" -V, --version 報告 %s 版本\n"
#: src/misc.c:64
#: misc.c:65
msgid "allocation of sko_stack failed"
msgstr "給予 sko_stack 配額時失敗"
#: src/misc.c:100
#: misc.c:102 misc.c:128
#, c-format
msgid "name \"%s\" ridiculously long"
msgstr "名稱「%s」有荒謬的長度"
#: src/misc.c:155
#: misc.c:177
msgid "memory allocation failed in allocate_array()"
msgstr "在 allocatearray() 中記憶體配置失敗"
#: src/misc.c:205
#: misc.c:230
#, c-format
msgid "bad character '%s' detected in check_char()"
msgstr "在 checkchar() 中偵測到不當的字元「%s」"
#: src/misc.c:210
#: misc.c:235
#, c-format
msgid "scanner requires -8 flag to use the character %s"
msgstr "掃描程式需要 -8 旗標以使用字元 %s"
#: src/misc.c:229
#, fuzzy
msgid "memory allocation failure in xstrdup()"
msgstr "在 allocatearray() 中記憶體配置失敗"
#: misc.c:268
msgid "dynamic memory failure in copy_string()"
msgstr "在 copystring() 中動態記憶體失敗"
#: src/misc.c:303
#: misc.c:367
#, c-format
msgid "%s: fatal internal error, %s\n"
msgstr "%s:嚴重內部錯誤,%s\n"
#: src/misc.c:671
#: misc.c:803
msgid "attempt to increase array size failed"
msgstr "試圖增加陣列大小時失敗"
#: src/misc.c:795
#: misc.c:930
msgid "bad line in skeleton file"
msgstr "架構檔案中不當的列"
#: src/misc.c:845
#: misc.c:979
msgid "memory allocation failed in yy_flex_xmalloc()"
msgstr "在 yy_flex_xmalloc() 中的記憶體配置失敗"
#: src/nfa.c:100
#: nfa.c:104
#, c-format
msgid ""
"\n"
@@ -712,237 +703,226 @@ msgstr ""
"\n"
"********** 開始輸出起始狀態為 %d 的 NFA\n"
#: src/nfa.c:111
#: nfa.c:115
#, c-format
msgid "state # %4d\t"
msgstr "狀態 # %4d\t"
#: src/nfa.c:126
#: nfa.c:130
#, c-format
msgid "********** end of dump\n"
msgstr "********** 傾印結束\n"
#: src/nfa.c:169
#: nfa.c:174
msgid "empty machine in dupmachine()"
msgstr "在 dupmachine() 中清空機器"
#: src/nfa.c:234
#: nfa.c:240
#, c-format
msgid "Variable trailing context rule at line %d\n"
msgstr "變數末尾內文規則於列 %d\n"
#: src/nfa.c:357
#: nfa.c:353
msgid "bad state type in mark_beginning_as_normal()"
msgstr "在 mark_beginning_as_normal() 中有不當的狀態輸入"
#: src/nfa.c:595
#: nfa.c:598
#, c-format
msgid "input rules are too complicated (>= %d NFA states)"
msgstr "輸入規則太複雜 (>= %d NFA 狀態)"
#: src/nfa.c:673
#: nfa.c:677
msgid "found too many transitions in mkxtion()"
msgstr "在 mkxtion() 中找到太多轉換"
#: src/nfa.c:699
#: nfa.c:703
#, c-format
msgid "too many rules (> %d)!"
msgstr "太多規則 (> %d)!"
#: src/parse.y:159
#: parse.y:159
msgid "unknown error processing section 1"
msgstr "不明的錯誤處理區段 1"
#: src/parse.y:184 src/parse.y:353
#: parse.y:184 parse.y:351
msgid "bad start condition list"
msgstr "不當的起始條件清單"
#: src/parse.y:204
msgid "Prefix must not contain [ or ]"
msgstr ""
#: src/parse.y:317
#: parse.y:315
msgid "unrecognized rule"
msgstr "無法辨識的規則"
#: src/parse.y:436 src/parse.y:449 src/parse.y:518
#: parse.y:434 parse.y:447 parse.y:516
msgid "trailing context used twice"
msgstr "末尾內文已使用兩次"
#: src/parse.y:554 src/parse.y:564 src/parse.y:637 src/parse.y:647
#: parse.y:552 parse.y:562 parse.y:635 parse.y:645
msgid "bad iteration values"
msgstr "不當的迭代值"
#: src/parse.y:582 src/parse.y:600 src/parse.y:665 src/parse.y:683
#: parse.y:580 parse.y:598 parse.y:663 parse.y:681
msgid "iteration value must be positive"
msgstr "迭代值必須是正值"
#: src/parse.y:806 src/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 "在大小寫不須相符的掃描程式中,字元範圍 [%c-%c] 是模稜兩可的"
#: src/parse.y:821
#: parse.y:819
msgid "negative range in character class"
msgstr "在字元類別中有負值範圍"
#: src/parse.y:918
#: parse.y:916
msgid "[:^lower:] is ambiguous in case insensitive scanner"
msgstr "在大小寫不須相符的掃描程式中,[:^lower:] 是模稜兩可的"
#: src/parse.y:924
#: parse.y:922
msgid "[:^upper:] ambiguous in case insensitive scanner"
msgstr "在大小寫不須相符的掃描程式中,[:^upper:] 是模稜兩可的"
#: src/scan.l:82 src/scan.l:644 src/scan.l:702
#: scan.l:75 scan.l:618 scan.l:676
msgid "Input line too long\n"
msgstr "輸入列太長\n"
#: src/scan.l:183
#: scan.l:161
#, c-format
msgid "malformed '%top' directive"
msgstr "異常的「%top」指令"
#: src/scan.l:205
#: scan.l:183
#, no-c-format
msgid "unrecognized '%' directive"
msgstr "無法辨識的「%」指令"
#: src/scan.l:214
#: scan.l:192
msgid "Definition name too long\n"
msgstr "定義名稱太長\n"
#: src/scan.l:309
#: scan.l:284
msgid "Unmatched '{'"
msgstr "不成對的「{」"
#: src/scan.l:325
#: scan.l:300
#, c-format
msgid "Definition value for {%s} too long\n"
msgstr "{%s} 的定義值太長\n"
#: src/scan.l:342
#: scan.l:317
msgid "incomplete name definition"
msgstr "不完整的名稱定義"
#: src/scan.l:467
#: scan.l:443
msgid "Option line too long\n"
msgstr "選項列太長\n"
#: src/scan.l:475
#: scan.l:451
#, c-format
msgid "unrecognized %%option: %s"
msgstr "無法辨識的 %%option:%s"
#: src/scan.l:659 src/scan.l:832
#: scan.l:633 scan.l:800
msgid "bad character class"
msgstr "不當的字元類別"
#: src/scan.l:709
#: scan.l:683
#, c-format
msgid "undefined definition {%s}"
msgstr "未定義的定義 {%s}"
#: src/scan.l:772
msgid "unbalanced parenthesis"
msgstr ""
#: src/scan.l:787
#: scan.l:755
#, c-format
msgid "bad <start condition>: %s"
msgstr "不當的 <起始條件>:%s"
#: src/scan.l:800
#: scan.l:768
msgid "missing quote"
msgstr "缺少引號"
#: src/scan.l:866
#: scan.l:834
#, c-format
msgid "bad character class expression: %s"
msgstr "不當的字元類別運算式:%s"
#: src/scan.l:888
#: scan.l:856
msgid "bad character inside {}'s"
msgstr "不當字元於 {} 內部"
#: src/scan.l:894
#: scan.l:862
msgid "missing }"
msgstr "缺少 }"
#: src/scan.l:972
#: scan.l:940
msgid "EOF encountered inside an action"
msgstr "在動作之內遇到檔案結束"
#: src/scan.l:977
#: scan.l:945
msgid "EOF encountered inside pattern"
msgstr "在式樣之內遇到檔案結束"
#: src/scan.l:1010
#: scan.l:967
#, c-format
msgid "bad character: %s"
msgstr "不當的字元:%s"
#: src/scan.l:1038
#: scan.l:996
#, c-format
msgid "can't open %s"
msgstr "無法開啟 %s"
#: src/scanopt.c:259
#: scanopt.c:291
#, c-format
msgid "Usage: %s [OPTIONS]...\n"
msgstr "用法:%s [選項]…\n"
#: src/scanopt.c:524
#: scanopt.c:564
#, c-format
msgid "option `%s' doesn't allow an argument\n"
msgstr "選項「%s」不允許任何引數\n"
#: src/scanopt.c:529
#: scanopt.c:569
#, c-format
msgid "option `%s' requires an argument\n"
msgstr "選項「%s」需要一個引數\n"
#: src/scanopt.c:533
#: scanopt.c:573
#, c-format
msgid "option `%s' is ambiguous\n"
msgstr "選項「%s」是模稜兩可的\n"
#: src/scanopt.c:537
#: scanopt.c:577
#, c-format
msgid "Unrecognized option `%s'\n"
msgstr "無法辨識的選項 %s\n"
#: src/scanopt.c:541
#: scanopt.c:581
#, c-format
msgid "Unknown error=(%d)\n"
msgstr "不明錯誤=(%d)\n"
#: src/sym.c:92
#: sym.c:100
msgid "symbol table memory allocation failed"
msgstr "符號表記憶體配置失敗"
#: src/sym.c:183
#: sym.c:202
msgid "name defined twice"
msgstr "名稱定義了兩次"
#: src/sym.c:231
#: sym.c:253
#, c-format
msgid "start condition %s declared twice"
msgstr "起始條件 %s 宣告了兩次"
#: src/yylex.c:57
#: yylex.c:56
msgid "premature EOF"
msgstr "過早出現檔案結尾"
#: src/yylex.c:200
#: yylex.c:198
#, c-format
msgid "End Marker\n"
msgstr "結束標誌\n"
#: src/yylex.c:206
#: yylex.c:204
#, c-format
msgid "*Something Weird* - tok: %d val: %d\n"
msgstr "*情況很怪異* - tok:%d val:%d\n"
#~ msgid "dynamic memory failure in copy_string()"
#~ msgstr "在 copystring() 中動態記憶體失敗"
+1 -4
View File
@@ -4,10 +4,7 @@
config.h
config.h.in
flex
libfl.pc
parse.c
parse.h
scan.c
cpp-skel.h
stage1scan.[cl]
stage1flex
skel.c
+123 -115
View File
@@ -35,74 +35,80 @@
// to rename each yyFlexLexer to some other xxFlexLexer. You then
// include <FlexLexer.h> in your other sources once per lexer class:
//
// #undef yyFlexLexer
// #define yyFlexLexer xxFlexLexer
// #include <FlexLexer.h>
// #undef yyFlexLexer
// #define yyFlexLexer xxFlexLexer
// #include <FlexLexer.h>
//
// #undef yyFlexLexer
// #define yyFlexLexer zzFlexLexer
// #include <FlexLexer.h>
// ...
// #undef yyFlexLexer
// #define yyFlexLexer zzFlexLexer
// #include <FlexLexer.h>
// ...
#ifndef __FLEX_LEXER_H
// Never included before - need to define base class.
#define __FLEX_LEXER_H
#include <iostream>
# ifndef FLEX_STD
# define FLEX_STD std::
# endif
#ifndef YY_CHAR_DEFINED
#define YY_CHAR_DEFINED
typedef unsigned char YY_CHAR;
#endif
extern "C++" {
struct yy_buffer_state;
typedef int yy_state_type;
class FlexLexer
{
class FlexLexer {
public:
virtual ~FlexLexer() { }
virtual ~FlexLexer() { }
const char* YYText() const { return yytext; }
int YYLeng() const { return yyleng; }
const YY_CHAR* YYText() const { return yytext; }
int YYLeng() const { return yyleng; }
virtual void
yy_switch_to_buffer( yy_buffer_state* new_buffer ) = 0;
virtual yy_buffer_state* yy_create_buffer( std::istream* s, int size ) = 0;
virtual yy_buffer_state* yy_create_buffer( std::istream& s, int size ) = 0;
virtual void yy_delete_buffer( yy_buffer_state* b ) = 0;
virtual void yyrestart( std::istream* s ) = 0;
virtual void yyrestart( std::istream& s ) = 0;
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 void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
virtual void yyrestart( FLEX_STD istream* s ) = 0;
virtual int yylex() = 0;
virtual int yylex() = 0;
// Call yylex with new input/output sources.
int yylex( std::istream& new_in, std::ostream& new_out )
{
switch_streams( new_in, new_out );
return yylex();
}
// Call yylex with new input/output sources.
int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 )
{
switch_streams( new_in, new_out );
return yylex();
}
int yylex( std::istream* new_in, 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;
// Switch to new input/output streams. A nil stream pointer
// indicates "keep the current one".
virtual void switch_streams( std::istream* new_in,
std::ostream* new_out ) = 0;
virtual void switch_streams( std::istream& new_in,
std::ostream& new_out ) = 0;
int lineno() const { return yylineno; }
int lineno() const { return yylineno; }
int debug() const { return yy_flex_debug; }
void set_debug( int flag ) { yy_flex_debug = flag; }
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:
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"
YY_CHAR* yytext;
#ifdef YY_CHARSET
char *yycharset;
#endif
int yyleng;
int yylineno; // only maintained if you use %option yylineno
int yy_flex_debug; // only has effect with -d or "%option debug"
};
}
@@ -112,109 +118,111 @@ protected:
// Either this is the first time through (yyFlexLexerOnce not defined),
// or this is a repeated include to define a different flavor of
// yyFlexLexer, as discussed in the flex manual.
# define yyFlexLexerOnce
#define yyFlexLexerOnce
extern "C++" {
class yyFlexLexer : public FlexLexer {
public:
// arg_yyin and arg_yyout default to the cin and cout, but we
// only make that assignment when initializing in yylex().
yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout );
yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 );
private:
void ctor_common();
// 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 = 0, FLEX_STD ostream* arg_yyout = 0 );
public:
virtual ~yyFlexLexer();
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 );
void yy_delete_buffer( struct yy_buffer_state* b );
void yyrestart( FLEX_STD istream* s );
void yy_switch_to_buffer( yy_buffer_state* new_buffer );
yy_buffer_state* yy_create_buffer( std::istream* s, int size );
yy_buffer_state* yy_create_buffer( std::istream& s, int size );
void yy_delete_buffer( yy_buffer_state* b );
void yyrestart( std::istream* s );
void yyrestart( std::istream& s );
void yypush_buffer_state( struct yy_buffer_state* new_buffer );
void yypop_buffer_state();
void yypush_buffer_state( yy_buffer_state* new_buffer );
void yypop_buffer_state();
virtual int yylex();
virtual void switch_streams( std::istream& new_in, std::ostream& new_out );
virtual void switch_streams( std::istream* new_in = 0, std::ostream* new_out = 0 );
virtual int yywrap();
virtual int yylex();
virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 );
virtual int yywrap();
protected:
virtual int LexerInput( char* buf, int max_size );
virtual void LexerOutput( const char* buf, int size );
virtual void LexerError( const char* msg );
virtual int LexerInput( char* buf, int max_size );
virtual void LexerOutput( const char* buf, int size );
virtual void LexerError( const char* msg );
void yyunput( int c, char* buf_ptr );
int yyinput();
void yyunput( int c, YY_CHAR* buf_ptr );
int yyinput();
void yy_load_buffer_state();
void yy_init_buffer( yy_buffer_state* b, std::istream& s );
void yy_flush_buffer( yy_buffer_state* b );
void yy_load_buffer_state();
void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s );
void yy_flush_buffer( struct yy_buffer_state* b );
int yy_start_stack_ptr;
int yy_start_stack_depth;
int* yy_start_stack;
int yy_start_stack_ptr;
int yy_start_stack_depth;
int* yy_start_stack;
void yy_push_state( int new_state );
void yy_pop_state();
int yy_top_state();
void yy_push_state( int new_state );
void yy_pop_state();
int yy_top_state();
yy_state_type yy_get_previous_state();
yy_state_type yy_try_NUL_trans( yy_state_type current_state );
int yy_get_next_buffer();
yy_state_type yy_get_previous_state();
yy_state_type yy_try_NUL_trans( yy_state_type current_state );
int yy_get_next_buffer();
std::istream yyin; // input source for default LexerInput
std::ostream yyout; // output sink for default LexerOutput
#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
// yy_hold_char holds the character lost when yytext is formed.
char yy_hold_char;
FLEX_STD istream* yyin; // input source for default LexerInput
FLEX_STD ostream* yyout; // output sink for default LexerOutput
// Number of characters read into yy_ch_buf.
int yy_n_chars;
// yy_hold_char holds the character lost when yytext is formed.
YY_CHAR yy_hold_char;
// Points to current character in buffer.
char* yy_c_buf_p;
// Number of characters read into yy_ch_buf.
int yy_n_chars;
int yy_init; // whether we need to initialize
int yy_start; // start state number
// Points to current character in buffer.
YY_CHAR* yy_c_buf_p;
// Flag which is used to allow yywrap()'s to do buffer switches
// instead of setting up a fresh yyin. A bit of a hack ...
int yy_did_buffer_switch_on_eof;
int yy_init; // whether we need to initialize
int yy_start; // start state number
// Flag which is used to allow yywrap()'s to do buffer switches
// instead of setting up a fresh yyin. A bit of a hack ...
int yy_did_buffer_switch_on_eof;
size_t yy_buffer_stack_top; /**< index of top of stack. */
size_t yy_buffer_stack_max; /**< capacity of stack. */
yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
void yyensure_buffer_stack(void);
size_t yy_buffer_stack_top; /**< index of top of stack. */
size_t yy_buffer_stack_max; /**< capacity of stack. */
struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
void yyensure_buffer_stack(void);
// The following are not always needed, but may be depending
// on use of certain flex features (like REJECT or yymore()).
// The following are not always needed, but may be depending
// on use of certain flex features (like REJECT or yymore()).
yy_state_type yy_last_accepting_state;
char* yy_last_accepting_cpos;
yy_state_type yy_last_accepting_state;
YY_CHAR* yy_last_accepting_cpos;
yy_state_type* yy_state_buf;
yy_state_type* yy_state_ptr;
yy_state_type* yy_state_buf;
yy_state_type* yy_state_ptr;
char* yy_full_match;
int* yy_full_state;
int yy_full_lp;
YY_CHAR* yy_full_match;
int* yy_full_state;
int yy_full_lp;
int yy_lp;
int yy_looking_for_trail_begin;
int yy_lp;
int yy_looking_for_trail_begin;
int yy_more_flag;
int yy_more_len;
int yy_more_offset;
int yy_prev_more_offset;
int yy_more_flag;
int yy_more_len;
int yy_more_offset;
int yy_prev_more_offset;
};
}
#endif // yyFlexLexer || ! yyFlexLexerOnce
+78 -112
View File
@@ -1,132 +1,101 @@
AM_YFLAGS = -d
AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
LIBS = @LIBS@
pkgconfigdir = @pkgconfigdir@
localedir = $(datadir)/locale
AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/intl
LIBS = @LIBINTL@ @LIBS@
m4 = @M4@
bin_PROGRAMS = flex
if ENABLE_BOOTSTRAP
noinst_PROGRAMS = stage1flex
endif
if ENABLE_LIBFL
lib_LTLIBRARIES = libfl.la
pkgconfig_DATA = libfl.pc
endif
libfl_la_SOURCES = \
libmain.c \
libyywrap.c
libfl_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
stage1flex_SOURCES = \
scan.l \
$(COMMON_SOURCES)
if CROSS
stage1flex_LDADD =
stage1flex_SOURCES += \
../lib/malloc.c \
../lib/realloc.c
stage1flex_LINK = $(LIBTOOL) --tag=CC --mode=link $(CC_FOR_BUILD) \
$(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
$(stage1flex_OBJECTS): CC=$(CC_FOR_BUILD)
$(stage1flex_OBJECTS): CFLAGS=$(CFLAGS_FOR_BUILD)
$(stage1flex_OBJECTS): CPP=$(CPP_FOR_BUILD)
$(stage1flex_OBJECTS): CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
$(stage1flex_OBJECTS): LDFLAGS=$(LDFLAGS_FOR_BUILD)
else
stage1flex_LDADD = $(LDADD)
stage1flex_LINK = $(LINK)
stage1flex_CFLAGS = $(AM_CFLAGS)
endif
lib_LTLIBRARIES = \
libfl.la \
libfl_pic.la
flex_SOURCES = \
$(COMMON_SOURCES)
nodist_flex_SOURCES = \
cpp-skel.h \
stage1scan.c
flex_CFLAGS = $(AM_CFLAGS) $(WARNINGFLAGS)
COMMON_SOURCES = \
buf.c \
ccl.c \
cpp_backend.c \
dfa.c \
ecs.c \
filter.c \
flexdef.h \
flexint.h \
flexint_shared.h \
scanflags.c \
gen.c \
main.c \
misc.c \
nfa.c \
options.c \
options.h \
parse.y \
regex.c \
scanflags.c \
scanopt.c \
scanopt.h \
scan.l \
skel.c \
sym.c \
tables.c \
tables.h \
tables_shared.c \
tables_shared.h \
tblcmp.c \
yylex.c \
options.c \
scanopt.c \
buf.c \
tables.c \
tables_shared.c \
filter.c \
regex.c
LDADD = ../lib/libcompat.la
libfl_la_SOURCES = \
libmain.c \
libyywrap.c
libfl_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@
libfl_pic_la_SOURCES = \
libmain.c \
libyywrap.c
libfl_pic_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@
noinst_HEADERS = \
flexdef.h \
flexint.h \
version.h \
yylex.c
LDADD = $(LIBOBJS) @LIBINTL@
$(LIBOBJS): $(LIBOBJDIR)$(am__dirstamp)
options.h \
scanopt.h \
tables.h \
tables_shared.h
include_HEADERS = \
FlexLexer.h
EXTRA_DIST = \
cpp-flex.skl \
flex.skl \
mkskel.sh \
gettext.h
CLEANFILES = stage1scan.c stage1flex$(EXEEXT) cpp-skel.h
BUILT_SOURCES = \
skel.c
MAINTAINERCLEANFILES = c9pp-skel.h
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
flex-cpp_backend.$(OBJEXT): cpp-skel.h
cpp-skel.h: cpp-flex.skl mkskel.sh flexint_shared.h tables_shared.h tables_shared.c
$(SHELL) $(srcdir)/mkskel.sh cpp $(srcdir) $(m4) $(VERSION) > $@.tmp
mv -f $@.tmp $@
if ENABLE_BOOTSTRAP
stage1scan.c: scan.l stage1flex$(EXEEXT)
./stage1flex$(EXEEXT) $(AM_LFLAGS) $(LFLAGS) -o $@ $(srcdir)/scan.l
else
stage1scan.c: scan.c
sed 's|^\(#line .*\)"'`printf %s $< | sed 's|[][\\\\.*]|\\\\&|g'`'"|\1"$@"|g' $< > $@
endif
dist-hook: scan.l flex$(EXEEXT)
chmod u+w $(distdir) && \
./flex$(EXEEXT) -o scan.c $< && \
mv -f scan.c $(distdir)
# make needs to be told to make parse.h so that parallelized runs will
# not fail.
stage1flex-main.$(OBJEXT): parse.h
flex-main.$(OBJEXT): parse.h
stage1flex-yylex.$(OBJEXT): parse.h
flex-yylex.$(OBJEXT): parse.h
stage1flex-scan.$(OBJEXT): parse.h
flex-stage1scan.$(OBJEXT): parse.h
# Explicitly describe dependencies.
# You can recreate this with `gcc -I. -MM *.c'
buf.o: buf.c flexdef.h flexint.h
ccl.o: ccl.c flexdef.h flexint.h
dfa.o: dfa.c flexdef.h flexint.h tables.h tables_shared.h
ecs.o: ecs.c flexdef.h flexint.h
scanflags.o: scanflags.c flexdef.h flexint.h
gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h
libmain.o: libmain.c
libyywrap.o: libyywrap.c
main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \
tables.h tables_shared.h
misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h
nfa.o: nfa.c flexdef.h flexint.h
options.o: options.c options.h scanopt.h flexdef.h flexint.h
parse.o: parse.c flexdef.h flexint.h tables.h tables_shared.h
scan.o: scan.c flexdef.h flexint.h parse.h
scanopt.o: scanopt.c flexdef.h flexint.h scanopt.h
skel.o: skel.c flexdef.h flexint.h
sym.o: sym.c flexdef.h flexint.h
tables.o: tables.c flexdef.h flexint.h tables.h tables_shared.h
tables_shared.o: tables_shared.c flexdef.h flexint.h tables.h \
tables_shared.h
tblcmp.o: tblcmp.c flexdef.h flexint.h
yylex.o: yylex.c flexdef.h flexint.h parse.h
filter.o: filter.c flexdef.h flexint.h
# Run GNU indent on sources. Don't run this unless all the sources compile cleanly.
#
@@ -163,14 +132,11 @@ indentfiles = \
tables_shared.h \
tblcmp.c
indent: $(top_srcdir)/.indent.pro
cd $(top_srcdir) && \
for f in $(indentfiles); do \
f=src/$$f; \
echo indenting $$f; \
INDENT_PROFILE=.indent.pro $(INDENT) <$$f >/dev/null && \
INDENT_PROFILE=.indent.pro $(INDENT) $$f || \
echo $$f FAILED to indent; \
done;
.PHONY: indent
indent:
if [ -f .indent.pro ] ; then \
for f in $(indentfiles);\
do\
echo indenting $$f ;\
$(indent) < $$f >/dev/null && indent $$f || echo $$f FAILED to indent ;\
done \
fi
+47 -42
View File
@@ -73,13 +73,12 @@ struct Buf *buf_prints (struct Buf *buf, const char *fmt, const char *s)
char *t;
size_t tsz;
tsz = strlen(fmt) + strlen(s) + 1;
t = malloc(tsz);
t = flex_alloc (tsz = strlen (fmt) + strlen (s) + 1);
if (!t)
flexfatal (_("Allocation of buffer to print string failed"));
snprintf (t, tsz, fmt, s);
buf = buf_strappend (buf, t);
free(t);
flex_free (t);
return buf;
}
@@ -93,26 +92,21 @@ struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno)
{
char *dst, *t;
const char *src;
size_t tsz;
if (gen_line_dirs)
return buf;
tsz = strlen("#line \"\"\n") + /* constant parts */
2 * strlen (filename) + /* filename with possibly all backslashes escaped */
(size_t) (1 + ceil (log10 (abs (lineno)))) + /* line number */
1; /* NUL */
t = malloc(tsz);
t = flex_alloc (strlen ("#line \"\"\n") + /* constant parts */
2 * strlen (filename) + /* filename with possibly all backslashes escaped */
(int) (1 + log10 (abs (lineno))) + /* line number */
1); /* NUL */
if (!t)
flexfatal (_("Allocation of buffer for line directive failed"));
for (dst = t + snprintf (t, tsz, "#line %d \"", lineno), src = filename; *src; *dst++ = *src++)
for (dst = t + sprintf (t, "#line %d \"", lineno), src = filename; *src; *dst++ = *src++)
if (*src == '\\') /* escape backslashes */
*dst++ = '\\';
*dst++ = '"';
*dst++ = '\n';
*dst = '\0';
buf = buf_strappend (buf, t);
free(t);
flex_free (t);
return buf;
}
@@ -130,7 +124,10 @@ struct Buf *buf_concat(struct Buf* dest, const struct Buf* src)
/* Appends n characters in str to buf. */
struct Buf *buf_strnappend (struct Buf *buf, const char *str, int n)
struct Buf *buf_strnappend (buf, str, n)
struct Buf *buf;
const char *str;
int n;
{
buf_append (buf, str, n + 1);
@@ -141,13 +138,18 @@ struct Buf *buf_strnappend (struct Buf *buf, const char *str, int n)
}
/* Appends characters in str to buf. */
struct Buf *buf_strappend (struct Buf *buf, const char *str)
struct Buf *buf_strappend (buf, str)
struct Buf *buf;
const char *str;
{
return buf_strnappend (buf, str, (int) strlen (str));
return buf_strnappend (buf, str, strlen (str));
}
/* appends "#define str def\n" */
struct Buf *buf_strdefine (struct Buf *buf, const char *str, const char *def)
struct Buf *buf_strdefine (buf, str, def)
struct Buf *buf;
const char *str;
const char *def;
{
buf_strappend (buf, "#define ");
buf_strappend (buf, " ");
@@ -166,13 +168,12 @@ struct Buf *buf_strdefine (struct Buf *buf, const char *str, const char *def)
*/
struct Buf *buf_m4_define (struct Buf *buf, const char* def, const char* val)
{
const char * fmt = "m4_define( [[%s]], [[[[%s]]]])m4_dnl\n";
const char * fmt = "m4_define( [[%s]], [[%s]])m4_dnl\n";
char * str;
size_t strsz;
val = val?val:"";
strsz = strlen(fmt) + strlen(def) + strlen(val) + 2;
str = malloc(strsz);
str = (char*)flex_alloc(strsz = strlen(fmt) + strlen(def) + strlen(val) + 2);
if (!str)
flexfatal (_("Allocation of buffer for m4 def failed"));
@@ -192,8 +193,7 @@ struct Buf *buf_m4_undefine (struct Buf *buf, const char* def)
char * str;
size_t strsz;
strsz = strlen(fmt) + strlen(def) + 2;
str = malloc(strsz);
str = (char*)flex_alloc(strsz = strlen(fmt) + strlen(def) + 2);
if (!str)
flexfatal (_("Allocation of buffer for m4 undef failed"));
@@ -203,21 +203,23 @@ struct Buf *buf_m4_undefine (struct Buf *buf, const char* def)
}
/* create buf with 0 elements, each of size elem_size. */
void buf_init (struct Buf *buf, size_t elem_size)
void buf_init (buf, elem_size)
struct Buf *buf;
size_t elem_size;
{
buf->elts = NULL;
buf->elts = (void *) 0;
buf->nelts = 0;
buf->elt_size = elem_size;
buf->nmax = 0;
}
/* frees memory */
void buf_destroy (struct Buf *buf)
void buf_destroy (buf)
struct Buf *buf;
{
if (buf) {
free(buf->elts);
buf->elts = NULL;
}
if (buf && buf->elts)
flex_free (buf->elts);
buf->elts = (void *) 0;
}
@@ -227,7 +229,10 @@ void buf_destroy (struct Buf *buf)
* We grow by mod(512) boundaries.
*/
struct Buf *buf_append (struct Buf *buf, const void *ptr, int n_elem)
struct Buf *buf_append (buf, ptr, n_elem)
struct Buf *buf;
const void *ptr;
int n_elem;
{
int n_alloc = 0;
@@ -237,30 +242,30 @@ struct Buf *buf_append (struct Buf *buf, const void *ptr, int n_elem)
/* May need to alloc more. */
if (n_elem + buf->nelts > buf->nmax) {
/* exact count needed... */
n_alloc = n_elem + buf->nelts;
/* exact amount needed... */
n_alloc = (n_elem + buf->nelts) * buf->elt_size;
/* ...plus some extra */
if ((((size_t) n_alloc * buf->elt_size) % 512) != 0
if (((n_alloc * buf->elt_size) % 512) != 0
&& buf->elt_size < 512)
n_alloc += (int)
((512 -
(((size_t) n_alloc * buf->elt_size) % 512)) /
buf->elt_size);
n_alloc +=
(512 -
((n_alloc * buf->elt_size) % 512)) /
buf->elt_size;
if (!buf->elts)
buf->elts =
allocate_array ((int) n_alloc, buf->elt_size);
allocate_array (n_alloc, buf->elt_size);
else
buf->elts =
reallocate_array (buf->elts, (int) n_alloc,
reallocate_array (buf->elts, n_alloc,
buf->elt_size);
buf->nmax = n_alloc;
}
memcpy ((char *) buf->elts + (size_t) buf->nelts * buf->elt_size, ptr,
(size_t) n_elem * buf->elt_size);
memcpy ((char *) buf->elts + buf->nelts * buf->elt_size, ptr,
n_elem * buf->elt_size);
buf->nelts += n_elem;
return buf;
+10 -12
View File
@@ -52,7 +52,9 @@ ccl_contains (const int cclp, const int ch)
/* ccladd - add a single character to a ccl */
void ccladd (int cclp, int ch)
void ccladd (cclp, ch)
int cclp;
int ch;
{
int ind, len, newpos, i;
@@ -73,13 +75,6 @@ void ccladd (int cclp, int ch)
newpos = ind + len;
/* For a non-last cclp, expanding the set will overflow and overwrite a
* char in the next cclp.
* FIXME: Need another allocation scheme for ccl's. */
if (cclp != lastccl) {
flexfatal(_("internal error: trying to add a char to a non-last ccl.\n"));
}
if (newpos >= current_max_ccl_tbl_size) {
current_max_ccl_tbl_size += MAX_CCL_TBL_SIZE_INCREMENT;
@@ -90,7 +85,7 @@ void ccladd (int cclp, int ch)
}
ccllen[cclp] = len + 1;
ccltbl[newpos] = (unsigned char) ch;
ccltbl[newpos] = ch;
}
/* dump_cclp - same thing as list_character_set, but for cclps. */
@@ -190,7 +185,7 @@ ccl_set_union (int a, int b)
/* cclinit - return an empty ccl */
int cclinit (void)
int cclinit ()
{
if (++lastccl >= current_maxccls) {
current_maxccls += MAX_CCLS_INCREMENT;
@@ -230,7 +225,8 @@ int cclinit (void)
/* cclnegate - negate the given ccl */
void cclnegate (int cclp)
void cclnegate (cclp)
int cclp;
{
cclng[cclp] = 1;
ccl_has_nl[cclp] = !ccl_has_nl[cclp];
@@ -244,7 +240,9 @@ void cclnegate (int cclp)
* has a non-zero value in the cset array.
*/
void list_character_set (FILE *file, int cset[])
void list_character_set (file, cset)
FILE *file;
int cset[];
{
int i;
-3968
View File
File diff suppressed because it is too large Load Diff
-639
View File
@@ -1,639 +0,0 @@
/* flex - tool to generate fast lexical analyzers */
/* Copyright (c) 1990 The Regents of the University of California. */
/* All rights reserved. */
/* This code is derived from software contributed to Berkeley by */
/* Vern Paxson. */
/* The United States Government has rights in this work pursuant */
/* to contract no. DE-AC03-76SF00098 between the United States */
/* Department of Energy and the University of California. */
/* This file is part of flex. */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following conditions */
/* are met: */
/* 1. Redistributions of source code must retain the above copyright */
/* notice, this list of conditions and the following disclaimer. */
/* 2. Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in the */
/* documentation and/or other materials provided with the distribution. */
/* Neither the name of the University nor the names of its contributors */
/* may be used to endorse or promote products derived from this software */
/* without specific prior written permission. */
/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */
#include "flexdef.h"
/* Code specific to the C/C++ back end starts here */
static const char *cpp_suffix (void)
{
char *suffix;
if (C_plus_plus)
suffix = "cc";
else
suffix = "c";
return suffix;
}
/* cpp_prolog - make rules prolog specific to cpp-using languages.
*
* If you don't ship this, you will effectively be assuming that your
* parsers are always reentrant, always allow reject, always have a
* yywrap() method, have a debug member in the wrapper class, and are
* interactive. This eliminates most of the boilerplate in the C/C++
* scanner prolog. It means such parsers will be a bit larger and
* slower than C/C++ ones, but since we're not running on 1987's
* hardware we officially do not care.
*
* A detail to beware of: If you're not issuing this prologue, you may
* want to write your own definition of YY_CHAR in your skel
* file. It's a typedef to an unsigned octet in C/C++, but if your
* target language has a Unicode code-point type like Go's 'rune' is
* may be appropriate.
*/
static void cpp_prolog (void)
{
static char yy_stdinit[] = "FILE *yyin = stdin, *yyout = stdout;";
static char yy_nostdinit[] =
"FILE *yyin = NULL, *yyout = NULL;";
if (!do_yywrap) {
if (!C_plus_plus) {
if (reentrant)
out_str ("\n#define %swrap(yyscanner) (/*CONSTCOND*/1)\n", prefix);
else
out_str ("\n#define %swrap() (/*CONSTCOND*/1)\n", prefix);
}
outn ("#define YY_SKIP_YYWRAP");
}
if (ddebug)
outn ("\n#define FLEX_DEBUG");
OUT_BEGIN_CODE ();
outn ("typedef flex_uint8_t YY_CHAR;");
OUT_END_CODE ();
if (C_plus_plus) {
outn ("#define yytext_ptr yytext");
if (interactive)
outn ("#define YY_INTERACTIVE");
}
else {
OUT_BEGIN_CODE ();
/* In reentrant scanner, stdinit is handled in flex.skl. */
if (do_stdinit) {
if (reentrant){
outn ("#ifdef VMS");
outn ("#ifdef __VMS_POSIX");
outn ("#define YY_STDINIT");
outn ("#endif");
outn ("#else");
outn ("#define YY_STDINIT");
outn ("#endif");
}
outn ("#ifdef VMS");
outn ("#ifndef __VMS_POSIX");
outn (yy_nostdinit);
outn ("#else");
outn (yy_stdinit);
outn ("#endif");
outn ("#else");
outn (yy_stdinit);
outn ("#endif");
}
else {
if(!reentrant)
outn (yy_nostdinit);
}
OUT_END_CODE ();
}
OUT_BEGIN_CODE ();
if (fullspd)
outn ("typedef const struct yy_trans_info *yy_state_type;");
else if (!C_plus_plus)
outn ("typedef int yy_state_type;");
OUT_END_CODE ();
if (lex_compat)
outn ("#define YY_FLEX_LEX_COMPAT");
if (!C_plus_plus && !reentrant) {
outn ("extern int yylineno;");
OUT_BEGIN_CODE ();
outn ("int yylineno = 1;");
OUT_END_CODE ();
}
if (C_plus_plus) {
outn ("\n#include <FlexLexer.h>");
if (!do_yywrap) {
outn("\nint yyFlexLexer::yywrap() { return 1; }");
}
if (yyclass) {
outn ("int yyFlexLexer::yylex()");
outn ("\t{");
outn ("\tLexerError( \"yyFlexLexer::yylex invoked but %option yyclass used\" );");
outn ("\treturn 0;");
outn ("\t}");
out_str ("\n#define YY_DECL int %s::yylex()\n",
yyclass);
}
}
else {
/* Watch out: yytext_ptr is a variable when yytext is an array,
* but it's a macro when yytext is a pointer.
*/
if (yytext_is_array) {
if (!reentrant)
outn ("extern char yytext[];\n");
}
else {
if (reentrant) {
outn ("#define yytext_ptr yytext_r");
}
else {
outn ("extern char *yytext;");
outn("#ifdef yytext_ptr");
outn("#undef yytext_ptr");
outn("#endif");
outn ("#define yytext_ptr yytext");
}
}
if (yyclass)
flexerror (_
("%option yyclass only meaningful for C++ scanners"));
}
}
static void cpp_epilog (void)
{
#if 0
fprintf (header_out,
"#ifdef YY_HEADER_EXPORT_START_CONDITIONS\n");
fprintf (header_out,
"/* Beware! Start conditions are not prefixed. */\n");
/* Special case for "INITIAL" */
fprintf (header_out,
"#undef INITIAL\n#define INITIAL 0\n");
for (i = 2; i <= lastsc; i++)
fprintf (header_out, "#define %s %d\n", scname[i], i - 1);
fprintf (header_out,
"#endif /* YY_HEADER_EXPORT_START_CONDITIONS */\n\n");
/* Kill ALL flex-related macros. This is so the user
* can #include more than one generated header file. */
fprintf (header_out, "#ifndef YY_HEADER_NO_UNDEFS\n");
fprintf (header_out,
"/* Undefine all internal macros, etc., that do no belong in the header. */\n\n");
{
const char * undef_list[] = {
"BEGIN",
"ECHO",
"EOB_ACT_CONTINUE_SCAN",
"EOB_ACT_END_OF_FILE",
"EOB_ACT_LAST_MATCH",
"FLEX_SCANNER",
"REJECT",
"YYFARGS0",
"YYFARGS1",
"YYFARGS2",
"YYFARGS3",
"YYLMAX",
"YYSTATE",
"YY_AT_BOL",
"YY_BREAK",
"YY_BUFFER_EOF_PENDING",
"YY_BUFFER_NEW",
"YY_BUFFER_NORMAL",
"YY_BUF_SIZE",
"M4_YY_CALL_LAST_ARG",
"M4_YY_CALL_ONLY_ARG",
"YY_CURRENT_BUFFER",
"YY_DECL",
"M4_YY_DECL_LAST_ARG",
"M4_YY_DEF_LAST_ARG",
"M4_YY_DEF_ONLY_ARG",
"YY_DO_BEFORE_ACTION",
"YY_END_OF_BUFFER",
"YY_END_OF_BUFFER_CHAR",
"YY_EXIT_FAILURE",
"YY_EXTRA_TYPE",
"YY_FATAL_ERROR",
"YY_FLEX_DEFINED_ECHO",
"YY_FLEX_LEX_COMPAT",
"YY_FLEX_MAJOR_VERSION",
"YY_FLEX_MINOR_VERSION",
"YY_FLEX_SUBMINOR_VERSION",
"YY_FLUSH_BUFFER",
"YY_G",
"YY_INPUT",
"YY_INTERACTIVE",
"YY_INT_ALIGNED",
"YY_LAST_ARG",
"YY_LESS_LINENO",
"YY_LEX_ARGS",
"YY_LEX_DECLARATION",
"YY_LEX_PROTO",
"YY_MAIN",
"YY_MORE_ADJ",
"YY_NEED_STRLEN",
"YY_NEW_FILE",
"YY_NULL",
"YY_NUM_RULES",
"YY_ONLY_ARG",
"YY_PARAMS",
"YY_PROTO",
"M4_YY_PROTO_LAST_ARG",
"M4_YY_PROTO_ONLY_ARG void",
"YY_READ_BUF_SIZE",
"YY_REENTRANT",
"YY_RESTORE_YY_MORE_OFFSET",
"YY_RULE_SETUP",
"YY_SC_TO_UI",
"YY_SKIP_YYWRAP",
"YY_START",
"YY_START_STACK_INCR",
"YY_STATE_EOF",
"YY_STDINIT",
"YY_TRAILING_HEAD_MASK",
"YY_TRAILING_MASK",
"YY_USER_ACTION",
"YY_USE_CONST",
"YY_USE_PROTOS",
"unput",
"yyTABLES_NAME",
"yy_create_buffer",
"yy_delete_buffer",
"yy_flex_debug",
"yy_flush_buffer",
"yy_init_buffer",
"yy_load_buffer_state",
"yy_new_buffer",
"yy_scan_buffer",
"yy_scan_bytes",
"yy_scan_string",
"yy_set_bol",
"yy_set_interactive",
"yy_switch_to_buffer",
"yypush_buffer_state",
"yypop_buffer_state",
"yyensure_buffer_stack",
"yyalloc",
"const",
"yyextra",
"yyfree",
"yyget_debug",
"yyget_extra",
"yyget_in",
"yyget_leng",
"yyget_column",
"yyget_lineno",
"yyget_lloc",
"yyget_lval",
"yyget_out",
"yyget_text",
"yyin",
"yyleng",
"yyless",
"yylex",
"yylex_destroy",
"yylex_init",
"yylex_init_extra",
"yylineno",
"yylloc",
"yylval",
"yymore",
"yyout",
"yyrealloc",
"yyrestart",
"yyset_debug",
"yyset_extra",
"yyset_in",
"yyset_column",
"yyset_lineno",
"yyset_lloc",
"yyset_lval",
"yyset_out",
"yytables_destroy",
"yytables_fload",
"yyterminate",
"yytext",
"yytext_ptr",
"yywrap",
/* must be null-terminated */
NULL};
for (i=0; undef_list[i] != NULL; i++)
fprintf (header_out, "#undef %s\n", undef_list[i]);
}
/* undef any of the auto-generated symbols. */
for (i = 0; i < defs_buf.nelts; i++) {
/* don't undef start conditions */
if (sclookup (((char **) defs_buf.elts)[i]) > 0)
continue;
fprintf (header_out, "#undef %s\n",
((char **) defs_buf.elts)[i]);
}
fprintf (header_out,
"#endif /* !YY_HEADER_NO_UNDEFS */\n");
fprintf (header_out, "\n");
fprintf (header_out, "#undef %sIN_HEADER\n", prefix);
fprintf (header_out, "#endif /* %sHEADER_H */\n", prefix);
if (ferror (header_out))
lerr (_("error creating header file %s"),
headerfilename);
fflush (header_out);
fclose (header_out);
#endif
}
static const char *cpp_yy_int_aligned(void)
{
return long_align ? "long int" : "short int";
}
static void cpp_comment(const char *txt)
{
out_str("/* [[%s]] */\n", txt);
}
static const char *cpp_get_int16_decl (void)
{
return (gentables)
? "static const flex_int16_t %s[%d] =\n { 0,\n"
: "static const flex_int16_t * %s = 0;\n";
}
static const char *cpp_get_int32_decl (void)
{
return (gentables)
? "static const flex_int32_t %s[%d] =\n { 0,\n"
: "static const flex_int32_t * %s = 0;\n";
}
static const char *cpp_get_state_decl (void)
{
return (gentables)
? "static const yy_state_type %s[%d] =\n { 0,\n"
: "static const yy_state_type * %s = 0;\n";
}
static const char *cpp_get_yy_char_decl (void)
{
return (gentables)
? "static const YY_CHAR %s[%d] =\n { 0,\n"
: "static const YY_CHAR * %s = 0;\n";
}
static void cpp_ntod(size_t num_full_table_rows)
// Generate nxt table for ntod
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
long_align ? "flex_int32_t" : "flex_int16_t");
/* Unless -Ca, declare it "short" because it's a real
* long-shot that that won't be large enough.
*/
if (gentables)
out_str_dec
("static const %s yy_nxt[][%d] =\n {\n",
long_align ? "flex_int32_t" : "flex_int16_t",
num_full_table_rows);
else {
out_dec ("#undef YY_NXT_LOLEN\n#define YY_NXT_LOLEN (%d)\n", num_full_table_rows);
out_str ("static const %s *yy_nxt =0;\n",
long_align ? "flex_int32_t" : "flex_int16_t");
}
}
static void cpp_mkeoltbl()
// Make end-of-line-table - only used when yylinemo tracking is on
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_RULE_CAN_MATCH_EOL, (void**)&yy_rule_can_match_eol, sizeof(%s)},\n",
"flex_int32_t");
}
static void cpp_geneoltbl(size_t sz)
// Generate end-of-line-transitions - only used when yylineno tracking is on
{
outn ("/* Table of booleans, true if rule could match eol. */");
out_str_dec (cpp_get_int32_decl (), "yy_rule_can_match_eol", sz);
}
static void cpp_mkctbl (size_t sz)
// Make full-speed compressed transition table
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_TRANSITION, (void**)&yy_transition, sizeof(%s)},\n",
(sz >= INT16_MAX
|| long_align) ? "flex_int32_t" : "flex_int16_t");
}
static void cpp_mkssltbl (void)
// Make start_state_list table
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_START_STATE_LIST, (void**)&yy_start_state_list, sizeof(%s)},\n",
"struct yy_trans_info*");
}
static void cpp_gen_yy_trans(size_t sz)
// Table of verify for transition and offset to next state. (sic)
{
if (gentables)
out_dec ("static const struct yy_trans_info yy_transition[%d] =\n {\n", sz);
else
outn ("static const struct yy_trans_info *yy_transition = 0;");
}
static void cpp_start_state_list(size_t sz)
// Start initializer for table of pointers to start state
{
/* Table of pointers to start states. */
if (gentables)
out_dec ("static const struct yy_trans_info *yy_start_state_list[%d] =\n", sz);
else
outn ("static const struct yy_trans_info **yy_start_state_list =0;");
}
static void cpp_mkecstbl(void)
// Make equivalence-class tables
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_EC, (void**)&yy_ec, sizeof(%s)},\n",
"YY_CHAR");
}
static void cpp_mkftbl(void)
// Make full table
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_ACCEPT, (void**)&yy_accept, sizeof(%s)},\n",
long_align ? "flex_int32_t" : "flex_int16_t");
}
static void cpp_gentabs_acclist(void)
// Generate accept list initializer
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_ACCLIST, (void**)&yy_acclist, sizeof(%s)},\n",
long_align ? "flex_int32_t" : "flex_int16_t");
}
static void cpp_gentabs_accept(void)
// Generate accept table initializer
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_ACCEPT, (void**)&yy_accept, sizeof(%s)},\n",
long_align ? "flex_int32_t" : "flex_int16_t");
}
static void cpp_gentabs_yy_meta(void)
// Generate yy_meta table initializer
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_META, (void**)&yy_meta, sizeof(%s)},\n",
"YY_CHAR");
}
static void cpp_gentabs_yy_base(void)
// Generate yy_meta base initializer
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_BASE, (void**)&yy_base, sizeof(%s)},\n",
(tblend >= INT16_MAX
|| long_align) ? "flex_int32_t" : "flex_int16_t");
}
static void cpp_gentabs_yy_def(size_t total_states)
// Generate yy_def initializer
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_DEF, (void**)&yy_def, sizeof(%s)},\n",
(total_states >= INT16_MAX
|| long_align) ? "flex_int32_t" : "flex_int16_t");
}
static void cpp_gentabs_yy_nxt(size_t total_states)
// Generate yy_nxt initializer
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
(total_states >= INT16_MAX
|| long_align) ? "flex_int32_t" : "flex_int16_t");
}
static void cpp_gentabs_yy_chk(size_t total_states)
// Generate yy_chk initializer
{
buf_prints (&yydmap_buf,
"\t{YYTD_ID_CHK, (void**)&yy_chk, sizeof(%s)},\n",
(total_states >= INT16_MAX
|| long_align) ? "flex_int32_t" : "flex_int16_t");
}
static void cpp_nultrans(int fullspd)
// Generate nulltrans initializer
{
// Making this a backend method may be overzealous.
// How many other languages have to sprcial-case NUL
// because it's a string terminator?
buf_prints (&yydmap_buf,
"\t{YYTD_ID_NUL_TRANS, (void**)&yy_NUL_trans, sizeof(%s)},\n",
(fullspd) ? "struct yy_trans_info*" :
"flex_int32_t");
}
static const char *cpp_trans_offset_type(int total_table_size)
{
return (total_table_size >= INT16_MAX || long_align) ?
"flex_int32_t" : "flex_int16_t";
}
const char *cpp_skel[] = {
#include "cpp-skel.h"
0,
};
/* This backend is only accessed through this method table */
struct flex_backend_t cpp_backend = {
.suffix = cpp_suffix,
.prolog = cpp_prolog,
.skel = cpp_skel,
.epilog = cpp_epilog,
.yy_int_aligned = cpp_yy_int_aligned,
.trace_fmt = "#line %d \"%s\"\n",
.int_define_fmt = "#define %s %d\n",
.string_define_fmt = "#define %s %s\n",
.table_opener = " {",
.table_continuation = " },\n",
.table_closer = " };\n",
.dyad = " {%4d,%4d },",
.comment = cpp_comment,
.get_int16_decl = cpp_get_int16_decl,
.get_int32_decl = cpp_get_int32_decl,
.get_state_decl = cpp_get_state_decl,
.get_yy_char_decl = cpp_get_yy_char_decl,
.ntod = cpp_ntod,
.mkeoltbl = cpp_mkeoltbl,
.geneoltbl = cpp_geneoltbl,
.mkctbl = cpp_mkctbl,
.mkssltbl = cpp_mkssltbl,
.gen_yy_trans = cpp_gen_yy_trans,
.start_state_list = cpp_start_state_list,
.state_entry_fmt = " &yy_transition[%d],\n",
.mkecstbl = cpp_mkecstbl,
.mkftbl = cpp_mkftbl,
.gentabs_acclist = cpp_gentabs_acclist,
.gentabs_accept = cpp_gentabs_accept,
.gentabs_yy_meta = cpp_gentabs_yy_meta,
.gentabs_yy_base = cpp_gentabs_yy_base,
.gentabs_yy_def = cpp_gentabs_yy_def,
.gentabs_yy_nxt = cpp_gentabs_yy_nxt,
.gentabs_yy_chk = cpp_gentabs_yy_chk,
.nultrans = cpp_nultrans,
.trans_offset_type = cpp_trans_offset_type,
.caseprefix = "case ",
.fallthrough = NULL,
.endcase = "yyterminate();",
.c_like = 1,
};
+75 -35
View File
@@ -34,10 +34,10 @@
/* declare functions that have forward references */
void dump_associated_rules(FILE *, int);
void dump_transitions(FILE *, int[]);
void sympartition(int[], int, int[], int[]);
int symfollowset(int[], int, int, int[]);
void dump_associated_rules PROTO ((FILE *, int));
void dump_transitions PROTO ((FILE *, int[]));
void sympartition PROTO ((int[], int, int[], int[]));
int symfollowset PROTO ((int[], int, int, int[]));
/* check_for_backing_up - check a DFA state for backing up
@@ -49,7 +49,9 @@ int symfollowset(int[], int, int, int[]);
* indexed by equivalence class.
*/
void check_for_backing_up (int ds, int state[])
void check_for_backing_up (ds, state)
int ds;
int state[];
{
if ((reject && !dfaacc[ds].dfaacc_set) || (!reject && !dfaacc[ds].dfaacc_state)) { /* state is non-accepting */
++num_backing_up;
@@ -94,7 +96,10 @@ void check_for_backing_up (int ds, int state[])
* accset[1 .. nacc] is the list of accepting numbers for the DFA state.
*/
void check_trailing_context (int *nfa_states, int num_states, int *accset, int nacc)
void check_trailing_context (nfa_states, num_states, accset, nacc)
int *nfa_states, num_states;
int *accset;
int nacc;
{
int i, j;
@@ -132,7 +137,9 @@ void check_trailing_context (int *nfa_states, int num_states, int *accset, int n
* and writes a report to the given file.
*/
void dump_associated_rules (FILE *file, int ds)
void dump_associated_rules (file, ds)
FILE *file;
int ds;
{
int i, j;
int num_associated_rules = 0;
@@ -154,7 +161,7 @@ void dump_associated_rules (FILE *file, int ds)
}
}
qsort (&rule_set [1], (size_t) num_associated_rules, sizeof (rule_set [1]), intcmp);
qsort (&rule_set [1], num_associated_rules, sizeof (rule_set [1]), intcmp);
fprintf (file, _(" associated rule line numbers:"));
@@ -180,7 +187,9 @@ void dump_associated_rules (FILE *file, int ds)
* is done to the given file.
*/
void dump_transitions (FILE *file, int state[])
void dump_transitions (file, state)
FILE *file;
int state[];
{
int i, ec;
int out_char_set[CSIZE];
@@ -226,7 +235,8 @@ void dump_transitions (FILE *file, int state[])
* hashval is the hash value for the dfa corresponding to the state set.
*/
int *epsclosure (int *t, int *ns_addr, int accset[], int *nacc_addr, int *hv_addr)
int *epsclosure (t, ns_addr, accset, nacc_addr, hv_addr)
int *t, *ns_addr, accset[], *nacc_addr, *hv_addr;
{
int stkpos, ns, tsp;
int numstates = *ns_addr, nacc, hashval, transsym, nfaccnum;
@@ -341,7 +351,7 @@ ADD_STATE(state); \
/* increase_max_dfas - increase the maximum number of DFAs */
void increase_max_dfas (void)
void increase_max_dfas ()
{
current_max_dfas += MAX_DFAS_INCREMENT;
@@ -368,7 +378,7 @@ void increase_max_dfas (void)
* dfa starts out in state #1.
*/
void ntod (void)
void ntod ()
{
int *accset, ds, nacc, newds;
int sym, hashval, numstates, dsize;
@@ -390,7 +400,7 @@ void ntod (void)
* from 1 to CSIZE, so their size must be CSIZE + 1.
*/
int duplist[CSIZE + 1], state[CSIZE + 1];
int targfreq[CSIZE + 1] = {0}, targstate[CSIZE + 1];
int targfreq[CSIZE + 1], 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.
@@ -463,9 +473,14 @@ void ntod (void)
/* We still may want to use the table if numecs
* is a power of 2.
*/
if (numecs <= csize && is_power_of_2(numecs)) {
use_NUL_table = true;
}
int power_of_two;
for (power_of_two = 1; power_of_two <= csize;
power_of_two *= 2)
if (numecs == power_of_two) {
use_NUL_table = true;
break;
}
}
if (use_NUL_table)
@@ -506,21 +521,40 @@ void ntod (void)
* So we'll have to realloc() on the way...
* we'll wait until we can calculate yynxt_tbl->td_hilen.
*/
yynxt_tbl = calloc(1, sizeof (struct yytbl_data));
yynxt_tbl =
(struct yytbl_data *) calloc (1,
sizeof (struct
yytbl_data));
yytbl_data_init (yynxt_tbl, YYTD_ID_NXT);
yynxt_tbl->td_hilen = 1;
yynxt_tbl->td_lolen = (flex_uint32_t) num_full_table_rows;
yynxt_tbl->td_lolen = num_full_table_rows;
yynxt_tbl->td_data = yynxt_data =
calloc(yynxt_tbl->td_lolen *
(flex_int32_t *) calloc (yynxt_tbl->td_lolen *
yynxt_tbl->td_hilen,
sizeof (flex_int32_t));
yynxt_curr = 0;
backend->ntod(num_full_table_rows);
buf_prints (&yydmap_buf,
"\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
long_align ? "flex_int32_t" : "flex_int16_t");
/* Unless -Ca, declare it "short" because it's a real
* long-shot that that won't be large enough.
*/
if (gentables)
out_str_dec
("static yyconst %s yy_nxt[][%d] =\n {\n",
long_align ? "flex_int32_t" : "flex_int16_t",
num_full_table_rows);
else {
out_dec ("#undef YY_NXT_LOLEN\n#define YY_NXT_LOLEN (%d)\n", num_full_table_rows);
out_str ("static yyconst %s *yy_nxt =0;\n",
long_align ? "flex_int32_t" : "flex_int16_t");
}
if (gentables)
outn (backend->table_opener);
outn (" {");
/* Generate 0 entries for state #0. */
for (i = 0; i < num_full_table_rows; ++i) {
@@ -530,7 +564,7 @@ void ntod (void)
dataflush ();
if (gentables)
outn (backend->table_continuation);
outn (" },\n");
}
/* Create the first states. */
@@ -679,12 +713,14 @@ void ntod (void)
/* Each time we hit here, it's another td_hilen, so we realloc. */
yynxt_tbl->td_hilen++;
yynxt_tbl->td_data = yynxt_data =
realloc (yynxt_data,
(flex_int32_t *) realloc (yynxt_data,
yynxt_tbl->td_hilen *
yynxt_tbl->td_lolen *
sizeof (flex_int32_t));
if (gentables)
outn (backend->table_opener);
outn (" {");
/* Supply array's 0-element. */
if (ds == end_of_buffer_state) {
@@ -709,7 +745,7 @@ void ntod (void)
dataflush ();
if (gentables)
out (backend->table_continuation);
outn (" },\n");
}
else if (fullspd)
@@ -769,8 +805,8 @@ void ntod (void)
mkdeftbl ();
}
free(accset);
free(nset);
flex_free ((void *) accset);
flex_free ((void *) nset);
}
@@ -784,7 +820,8 @@ void ntod (void)
* On return, the dfa state number is in newds.
*/
int snstods (int sns[], int numstates, int accset[], int nacc, int hashval, int *newds_addr)
int snstods (sns, numstates, accset, nacc, hashval, newds_addr)
int sns[], numstates, accset[], nacc, hashval, *newds_addr;
{
int didsort = 0;
int i, j;
@@ -799,7 +836,7 @@ int snstods (int sns[], int numstates, int accset[], int nacc, int hashval, int
/* We sort the states in sns so we
* can compare it to oldsns quickly.
*/
qsort (&sns [1], (size_t) numstates, sizeof (sns [1]), intcmp);
qsort (&sns [1], numstates, sizeof (sns [1]), intcmp);
didsort = 1;
}
@@ -834,7 +871,7 @@ int snstods (int sns[], int numstates, int accset[], int nacc, int hashval, int
*/
if (!didsort)
qsort (&sns [1], (size_t) numstates, sizeof (sns [1]), intcmp);
qsort (&sns [1], numstates, sizeof (sns [1]), intcmp);
for (i = 1; i <= numstates; ++i)
dss[newds][i] = sns[i];
@@ -844,7 +881,7 @@ int snstods (int sns[], int numstates, int accset[], int nacc, int hashval, int
if (nacc == 0) {
if (reject)
dfaacc[newds].dfaacc_set = NULL;
dfaacc[newds].dfaacc_set = (int *) 0;
else
dfaacc[newds].dfaacc_state = 0;
@@ -857,7 +894,7 @@ int snstods (int sns[], int numstates, int accset[], int nacc, int hashval, int
* match in the event of ties will work.
*/
qsort (&accset [1], (size_t) nacc, sizeof (accset [1]), intcmp);
qsort (&accset [1], nacc, sizeof (accset [1]), intcmp);
dfaacc[newds].dfaacc_set =
allocate_integer_array (nacc + 1);
@@ -905,7 +942,8 @@ int snstods (int sns[], int numstates, int accset[], int nacc, int hashval, int
* int transsym, int nset[current_max_dfa_size] );
*/
int symfollowset (int ds[], int dsize, int transsym, int nset[])
int symfollowset (ds, dsize, transsym, nset)
int ds[], dsize, transsym, nset[];
{
int ns, tsp, sym, i, j, lenccl, ch, numstates, ccllist;
@@ -982,7 +1020,9 @@ int symfollowset (int ds[], int dsize, int transsym, int nset[])
* int symlist[numecs], int duplist[numecs] );
*/
void sympartition (int ds[], int numstates, int symlist[], int duplist[])
void sympartition (ds, numstates, symlist, duplist)
int ds[], numstates;
int symlist[], duplist[];
{
int tch, i, j, k, ns, dupfwd[CSIZE + 1], lenccl, cclp, ich;
+11 -8
View File
@@ -36,7 +36,7 @@
/* ccl2ecl - convert character classes to set of equivalence classes */
void ccl2ecl (void)
void ccl2ecl ()
{
int i, ich, newlen, cclp, ccls, cclmec;
@@ -56,8 +56,7 @@ void ccl2ecl (void)
cclmec = ecgroup[ich];
if (cclmec > 0) {
/* Note: range 1..256 is mapped to 1..255,0 */
ccltbl[cclp + newlen] = (unsigned char) cclmec;
ccltbl[cclp + newlen] = cclmec;
++newlen;
}
}
@@ -75,7 +74,8 @@ void ccl2ecl (void)
* Returned is the number of classes.
*/
int cre8ecs (int fwd[], int bck[], int num)
int cre8ecs (fwd, bck, num)
int fwd[], bck[], num;
{
int i, j, numcl;
@@ -100,9 +100,9 @@ int cre8ecs (int fwd[], int bck[], int num)
/* mkeccl - update equivalence classes based on character class xtions
*
* synopsis
* unsigned char ccls[];
* Char ccls[];
* int lenccl, fwd[llsiz], bck[llsiz], llsiz, NUL_mapping;
* void mkeccl( unsigned char ccls[], int lenccl, int fwd[llsiz], int bck[llsiz],
* void mkeccl( Char ccls[], int lenccl, int fwd[llsiz], int bck[llsiz],
* int llsiz, int NUL_mapping );
*
* ccls contains the elements of the character class, lenccl is the
@@ -112,7 +112,9 @@ int cre8ecs (int fwd[], int bck[], int num)
* NUL_mapping is the value which NUL (0) should be mapped to.
*/
void mkeccl (unsigned char ccls[], int lenccl, int fwd[], int bck[], int llsiz, int NUL_mapping)
void mkeccl (ccls, lenccl, fwd, bck, llsiz, NUL_mapping)
Char ccls[];
int lenccl, fwd[], bck[], llsiz, NUL_mapping;
{
int cclp, oldec, newec;
int cclm, i, j;
@@ -199,7 +201,8 @@ void mkeccl (unsigned char ccls[], int lenccl, int fwd[], int bck[], int llsi
/* mkechar - create equivalence class for single character */
void mkechar (int tch, int fwd[], int bck[])
void mkechar (tch, fwd, bck)
int tch, fwd[], bck[];
{
/* If until now the character has been a proper subset of
* an equivalence class, break it away to create a new ec
+36 -27
View File
@@ -47,9 +47,10 @@ struct filter *filter_create_ext (struct filter *chain, const char *cmd,
va_list ap;
/* allocate and initialize new filter */
f = calloc(sizeof(struct filter), 1);
f = (struct filter *) flex_alloc (sizeof (struct filter));
if (!f)
flexerror(_("calloc failed (f) in filter_create_ext"));
flexerror (_("flex_alloc failed (f) in filter_create_ext"));
memset (f, 0, sizeof (*f));
f->filter_func = NULL;
f->extra = NULL;
f->next = NULL;
@@ -65,16 +66,23 @@ struct filter *filter_create_ext (struct filter *chain, const char *cmd,
/* allocate argv, and populate it with the argument list. */
max_args = 8;
f->argv = malloc(sizeof(char *) * (size_t) (max_args + 1));
f->argv =
(const char **) flex_alloc (sizeof (char *) *
(max_args + 1));
if (!f->argv)
flexerror(_("malloc failed (f->argv) in filter_create_ext"));
flexerror (_("flex_alloc failed (f->argv) in filter_create_ext"));
f->argv[f->argc++] = cmd;
va_start (ap, cmd);
while ((s = va_arg (ap, const char *)) != NULL) {
if (f->argc >= max_args) {
max_args += 8;
f->argv = realloc(f->argv, sizeof(char*) * (size_t) (max_args + 1));
f->argv =
(const char **) flex_realloc (f->argv,
sizeof (char
*) *
(max_args +
1));
}
f->argv[f->argc++] = s;
}
@@ -99,9 +107,10 @@ struct filter *filter_create_int (struct filter *chain,
struct filter *f;
/* allocate and initialize new filter */
f = calloc(sizeof(struct filter), 1);
f = (struct filter *) flex_alloc (sizeof (struct filter));
if (!f)
flexerror(_("calloc failed in filter_create_int"));
flexerror (_("flex_alloc failed in filter_create_int"));
memset (f, 0, sizeof (*f));
f->next = NULL;
f->argc = 0;
f->argv = NULL;
@@ -165,8 +174,6 @@ clearerr(stdin);
flexfatal (_("dup2(pipes[0],0)"));
close (pipes[0]);
fseek (stdin, 0, SEEK_CUR);
ungetc(' ', stdin); /* still an evil hack, but one that works better */
(void)fgetc(stdin); /* on NetBSD than the fseek attempt does */
/* run as a filter, either internally or by exec */
if (chain->filter_func) {
@@ -174,7 +181,7 @@ clearerr(stdin);
if ((r = chain->filter_func (chain)) == -1)
flexfatal (_("filter_func failed"));
FLEX_EXIT (0);
exit (0);
}
else {
execvp (chain->argv[0],
@@ -183,7 +190,7 @@ clearerr(stdin);
chain->argv[0]);
}
FLEX_EXIT (1);
exit (1);
}
/* Parent */
@@ -228,7 +235,8 @@ int filter_tee_header (struct filter *chain)
* header file at the same time.
*/
char buf[512];
const int readsz = 512;
char *buf;
int to_cfd = -1;
FILE *to_c = NULL, *to_h = NULL;
bool write_header;
@@ -280,7 +288,10 @@ int filter_tee_header (struct filter *chain)
fprintf (to_c, "m4_define( [[M4_YY_OUTFILE_NAME]],[[%s]])m4_dnl\n",
outfilename ? outfilename : "<stdout>");
while (fgets (buf, sizeof buf, stdin)) {
buf = (char *) flex_alloc (readsz);
if (!buf)
flexerror (_("flex_alloc failed in filter_tee_header"));
while (fgets (buf, readsz, stdin)) {
fputs (buf, to_c);
if (write_header)
fputs (buf, to_h);
@@ -290,8 +301,7 @@ int filter_tee_header (struct filter *chain)
fprintf (to_h, "\n");
/* write a fake line number. It will get fixed by the linedir filter. */
if (gen_line_dirs)
fprintf (to_h, "#line 4000 \"M4_YY_OUTFILE_NAME\"\n");
fprintf (to_h, "#line 4000 \"M4_YY_OUTFILE_NAME\"\n");
fprintf (to_h, "#undef %sIN_HEADER\n", prefix);
fprintf (to_h, "#endif /* %sHEADER_H */\n", prefix);
@@ -318,17 +328,10 @@ int filter_tee_header (struct filter *chain)
while (wait (0) > 0) ;
FLEX_EXIT (0);
exit (0);
return 0;
}
static bool is_blank_line (const char *str)
{
while (isspace(*str))
str++;
return (*str == '\0');
}
/** Adjust the line numbers in the #line directives of the generated scanner.
* After the m4 expansion, the line numbers are incorrect since the m4 macros
* can add or remove lines. This only adjusts line numbers for generated code,
@@ -337,8 +340,8 @@ static bool is_blank_line (const char *str)
*/
int filter_fix_linedirs (struct filter *chain)
{
char buf[4096];
const size_t readsz = sizeof buf;
char *buf;
const int readsz = 512;
int lineno = 1;
bool in_gen = true; /* in generated code */
bool last_was_blank = false;
@@ -346,7 +349,11 @@ int filter_fix_linedirs (struct filter *chain)
if (!chain)
return 0;
while (fgets (buf, (int) readsz, stdin)) {
buf = (char *) flex_alloc (readsz);
if (!buf)
flexerror (_("flex_alloc failed in filter_fix_linedirs"));
while (fgets (buf, readsz, stdin)) {
regmatch_t m[10];
@@ -400,7 +407,9 @@ int filter_fix_linedirs (struct filter *chain)
}
/* squeeze blank lines from generated code */
else if (in_gen && is_blank_line(buf)) {
else if (in_gen
&& regexec (&regex_blank_line, buf, 0, NULL,
0) == 0) {
if (last_was_blank)
continue;
else
+3749
View File
File diff suppressed because it is too large Load Diff
+268 -217
View File
@@ -39,6 +39,22 @@
#include <config.h>
#endif
/* AIX requires this to be the first thing in the file. */
#if !defined(__GNUC__) && !defined(__lint__)
# if HAVE_ALLOCA_H
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
# endif
# endif
#endif
#ifdef STDC_HEADERS
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -46,7 +62,7 @@
#include <ctype.h>
#include <string.h>
#include <math.h>
#endif
#ifdef HAVE_ASSERT_H
#include <assert.h>
#else
@@ -56,30 +72,32 @@
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
/* Required: dup() and dup2() in <unistd.h> */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_SYS_PARAMS_H
#include <sys/params.h>
#endif
/* Required: stat() in <sys/stat.h> */
#include <sys/stat.h>
/* Required: wait() in <sys/wait.h> */
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
#include <stdarg.h>
/* Required: regcomp(), regexec() and regerror() in <regex.h> */
#else
#define bool int
#define true 1
#define false 0
#endif
#ifdef HAVE_REGEX_H
#include <regex.h>
/* Required: strcasecmp() in <strings.h> */
#include <strings.h>
#endif
#include "flexint.h"
/* We use gettext. So, when we write strings which should be translated, we
* mark them with _()
*/
#if defined(ENABLE_NLS) && ENABLE_NLS
/* We use gettext. So, when we write strings which should be translated, we mark them with _() */
#ifdef ENABLE_NLS
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif /* HAVE_LOCALE_H */
@@ -91,12 +109,33 @@
/* Always be prepared to generate an 8-bit scanner. */
#define CSIZE 256
#define Char unsigned char
/* Size of input alphabet - should be size of ASCII set. */
#ifndef DEFAULT_CSIZE
#define DEFAULT_CSIZE 128
#endif
#ifndef PROTO
#if defined(__STDC__)
#define PROTO(proto) proto
#else
#define PROTO(proto) ()
#endif
#endif
#ifdef VMS
#ifndef __VMS_POSIX
#define unlink remove
#define SHORT_FILE_NAMES
#endif
#endif
#ifdef MS_DOS
#define SHORT_FILE_NAMES
#endif
/* Maximum line length we'll have to deal with. */
#define MAXLINE 2048
@@ -110,8 +149,11 @@
#define ABS(x) ((x) < 0 ? -(x) : (x))
#endif
/* Whether an integer is a power of two */
#define is_power_of_2(n) ((n) > 0 && ((n) & ((n) - 1)) == 0)
/* ANSI C does not guarantee that isascii() is defined */
#ifndef isascii
#define isascii(c) ((c) <= 0177)
#endif
#define unspecified -1
@@ -303,56 +345,6 @@
*/
#define MAX_SHORT 32700
/* Method table describing a language-specific back end */
struct flex_backend_t {
const char *(*suffix)(void); // Generate suffix for lexer source code
void (*prolog)(void);
const char **skel;
void (*epilog)(void);
const char *(*yy_int_aligned)(void); // Generate aligned type for this back end
char *trace_fmt; // Trace message format
// Language syntax generation
char *int_define_fmt; // Format for integer constant definitions
char *string_define_fmt; // Format for string constant definitions
char *table_opener; // Open an array initializer with this
char *table_continuation; // Open an array initializer with this
char *table_closer; // How to continue a two-level initializer
char *dyad; // How to format and int[2] initializer
void (*comment)(const char *); // Wrap a comment line
const char *(*get_int16_decl)(void); // Format for declaring array initializer of int16s
const char *(*get_int32_decl)(void); // Format for declaring array initializer of int32s
const char *(*get_state_decl)(void); // Format for declaring array initializer of state values
const char *(*get_yy_char_decl)(void); // Format for declaring array initializer of input chars
// Flex table generation
void (*ntod)(size_t); // Generate nxt table for ntod
void (*mkeoltbl)(void); // Make end-of-line table
void (*geneoltbl)(size_t); // Generate end-of-line transitions
void (*mkctbl)(size_t); // Make full-speed compressed table
void (*mkssltbl)(void); // Make start_state_list table
void (*gen_yy_trans)(size_t); // Table of verify for transition and offset to next state. (sic)
void (*start_state_list)(size_t); // Start initializer for table of pointers to start states
void (*mkftbl)(); // Make full table
const char *state_entry_fmt; // Format of state table entry
void (*mkecstbl)(void); // Make equivalence-class tables
void (*gentabs_acclist)(void); // Generate accept list initializer
void (*gentabs_accept)(void); // Generate accept table initializer
void (*gentabs_yy_meta)(void); // Generate yy_meta table initializer
void (*gentabs_yy_base)(void); // Generate yy_base table initializer
void (*gentabs_yy_def)(size_t); // Generate yy_def initializer
void (*gentabs_yy_nxt)(size_t); // Generate yy_nxt initializer
void (*gentabs_yy_chk)(size_t); // Generate yy_chk initializer
void (*nultrans)(int); // Generate nulltrans initializer
const char *(*trans_offset_type)(int); // Compute an efficient type for transition tables
char *caseprefix; // Prefix of an arm in the language's case construct
char *fallthrough; // Finish a case arm with this to fall through
char *endcase; // What to ship after all EOF-state case arms
int c_like; // Will &yy_transition[%d]," produce a pointer table entry?
};
extern bool gentables;
extern struct flex_backend_t cpp_backend;
/* Declarations for global variables. */
@@ -404,6 +396,7 @@ extern struct flex_backend_t cpp_backend;
* 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,14 +405,14 @@ extern int interactive, lex_compat, posix_compat, do_yylineno;
extern int useecs, fulltbl, usemecs, fullspd;
extern int gen_line_dirs, performance_report, backing_up_report;
extern int reentrant, bison_bridge_lval, bison_bridge_lloc;
extern bool ansi_func_defs, ansi_func_protos;
extern int C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap;
extern int csize;
extern int yymore_used, reject, real_reject, continued_action, in_rule;
extern int yymore_really_used, reject_really_used;
extern int trace_hex;
extern struct flex_backend_t *backend;
extern bool charset_enabled;
/* Variables used in the flex input routines:
* datapos - characters on current output line
@@ -434,6 +427,7 @@ extern struct flex_backend_t *backend;
* 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
@@ -443,6 +437,8 @@ extern struct flex_backend_t *backend;
* 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
@@ -454,10 +450,10 @@ extern struct flex_backend_t *backend;
*/
extern int datapos, dataline, linenum;
extern FILE *skelfile, *backing_up_file;
extern FILE *skelfile, *yyin, *backing_up_file;
extern const char *skel[];
extern int skel_ind;
extern char *infilename, *outfilename, *headerfilename;
extern char *infilename, *outfilename, *headerfilename, *headercharfilename;
extern int did_outfilename;
extern char *prefix, *yyclass, *extra_type;
extern int do_stdinit, use_stdout;
@@ -465,6 +461,8 @@ 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;
@@ -656,7 +654,7 @@ extern int end_of_buffer_state;
extern int lastccl, *cclmap, *ccllen, *cclng, cclreuse;
extern int current_maxccls, current_max_ccl_tbl_size;
extern unsigned char *ccltbl;
extern Char *ccltbl;
/* Variables for miscellaneous information:
@@ -684,50 +682,62 @@ extern int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs;
extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
extern int num_backing_up, bol_needed;
void *allocate_array(int, size_t);
void *reallocate_array(void *, int, size_t);
void *allocate_array PROTO ((int, size_t));
void *reallocate_array PROTO ((void *, int, size_t));
void *flex_alloc PROTO ((size_t));
void *flex_realloc PROTO ((void *, size_t));
void flex_free PROTO ((void *));
#define allocate_integer_array(size) \
allocate_array(size, sizeof(int))
(int *) allocate_array( size, sizeof( int ) )
#define reallocate_integer_array(array,size) \
reallocate_array((void *) array, size, sizeof(int))
(int *) reallocate_array( (void *) array, size, sizeof( int ) )
#define allocate_bool_array(size) \
allocate_array(size, sizeof(bool))
(bool *) allocate_array( size, sizeof( bool ) )
#define reallocate_bool_array(array,size) \
reallocate_array((void *) array, size, sizeof(bool))
(bool *) reallocate_array( (void *) array, size, sizeof( bool ) )
#define allocate_int_ptr_array(size) \
allocate_array(size, sizeof(int *))
(int **) allocate_array( size, sizeof( int * ) )
#define allocate_char_ptr_array(size) \
allocate_array(size, sizeof(char *))
(char **) allocate_array( size, sizeof( char * ) )
#define allocate_dfaacc_union(size) \
allocate_array(size, sizeof(union dfaacc_union))
(union dfaacc_union *) \
allocate_array( size, sizeof( union dfaacc_union ) )
#define reallocate_int_ptr_array(array,size) \
reallocate_array((void *) array, size, sizeof(int *))
(int **) reallocate_array( (void *) array, size, sizeof( int * ) )
#define reallocate_char_ptr_array(array,size) \
reallocate_array((void *) array, size, sizeof(char *))
(char **) reallocate_array( (void *) array, size, sizeof( char * ) )
#define reallocate_dfaacc_union(array, size) \
reallocate_array((void *) array, size, sizeof(union dfaacc_union))
(union dfaacc_union *) \
reallocate_array( (void *) array, size, sizeof( union dfaacc_union ) )
#define allocate_character_array(size) \
allocate_array( size, sizeof(char))
(char *) allocate_array( size, sizeof( char ) )
#define reallocate_character_array(array,size) \
reallocate_array((void *) array, size, sizeof(char))
(char *) reallocate_array( (void *) array, size, sizeof( char ) )
#define allocate_Character_array(size) \
allocate_array(size, sizeof(unsigned char))
(Char *) allocate_array( size, sizeof( Char ) )
#define reallocate_Character_array(array,size) \
reallocate_array((void *) array, size, sizeof(unsigned char))
(Char *) reallocate_array( (void *) array, size, sizeof( Char ) )
/* Used to communicate between scanner and parser. The type should really
* be YYSTYPE, but we can't easily get our hands on it.
*/
extern int yylval;
/* External functions that are cross-referenced among the flex source files. */
@@ -735,120 +745,146 @@ void *reallocate_array(void *, int, size_t);
/* from file ccl.c */
extern void ccladd(int, int); /* add a single character to a ccl */
extern int cclinit(void); /* make an empty ccl */
extern void cclnegate(int); /* negate a ccl */
extern void ccladd PROTO ((int, int)); /* add a single character to a ccl */
extern int cclinit PROTO ((void)); /* make an empty ccl */
extern void cclnegate PROTO ((int)); /* negate a ccl */
extern int ccl_set_diff (int a, int b); /* set difference of two ccls. */
extern int ccl_set_union (int a, int b); /* set union of two ccls. */
/* List the members of a set of characters in CCL form. */
extern void list_character_set(FILE *, int[]);
extern void list_character_set PROTO ((FILE *, int[]));
/* from file dfa.c */
/* Check a DFA state for backing up. */
extern void check_for_backing_up(int, int[]);
extern void check_for_backing_up PROTO ((int, int[]));
/* Check to see if NFA state set constitutes "dangerous" trailing context. */
extern void check_trailing_context(int *, int, int *, int);
extern void check_trailing_context PROTO ((int *, int, int *, int));
/* Construct the epsilon closure of a set of ndfa states. */
extern int *epsclosure(int *, int *, int[], int *, int *);
extern int *epsclosure PROTO ((int *, int *, int[], int *, int *));
/* Increase the maximum number of dfas. */
extern void increase_max_dfas(void);
extern void increase_max_dfas PROTO ((void));
extern void ntod(void); /* convert a ndfa to a dfa */
extern void ntod PROTO ((void)); /* convert a ndfa to a dfa */
/* Converts a set of ndfa states into a dfa state. */
extern int snstods(int[], int, int[], int, int, int *);
extern int snstods PROTO ((int[], int, int[], int, int, int *));
/* from file ecs.c */
/* Convert character classes to set of equivalence classes. */
extern void ccl2ecl(void);
extern void ccl2ecl PROTO ((void));
/* Associate equivalence class numbers with class members. */
extern int cre8ecs(int[], int[], int);
extern int cre8ecs PROTO ((int[], int[], int));
/* Update equivalence classes based on character class transitions. */
extern void mkeccl(unsigned char[], int, int[], int[], int, int);
extern void mkeccl PROTO ((Char[], int, int[], int[], int, int));
/* Create equivalence class for single character. */
extern void mkechar(int, int[], int[]);
extern void mkechar PROTO ((int, int[], int[]));
/* from file gen.c */
extern void do_indent(void); /* indent to the current level */
extern void do_indent PROTO ((void)); /* indent to the current level */
/* Generate the code to keep backing-up information. */
extern void gen_backing_up PROTO ((void));
/* Generate the code to perform the backing up. */
extern void gen_bu_action PROTO ((void));
/* Generate full speed compressed transition table. */
extern void genctbl(void);
extern void genctbl PROTO ((void));
/* generate full transition table */
extern void genftbl(void);
/* Generate the code to find the action number. */
extern void gen_find_action PROTO ((void));
extern void genftbl PROTO ((void)); /* generate full transition table */
/* Generate the code to find the next compressed-table state. */
extern void gen_next_compressed_state PROTO ((char *));
/* Generate the code to find the next match. */
extern void gen_next_match PROTO ((void));
/* Generate the code to find the next state. */
extern void gen_next_state PROTO ((int));
/* Generate the code to make a NUL transition. */
extern void gen_NUL_trans PROTO ((void));
/* Generate the code to find the start state. */
extern void gen_start_state PROTO ((void));
/* Generate data statements for the transition tables. */
extern void gentabs(void);
extern void gentabs PROTO ((void));
/* Write out a formatted string at the current indentation level. */
extern void indent_put2s(const char *, const char *);
extern void indent_put2s PROTO ((const char *, const char *));
/* Write out a string + newline at the current indentation level. */
extern void indent_puts(const char *);
extern void indent_puts PROTO ((const char *));
extern void make_tables(void); /* generate transition tables */
extern void make_tables PROTO ((void)); /* generate transition tables */
/* from file main.c */
extern void check_options(void);
extern void flexend(int);
extern void usage(void);
extern void check_options PROTO ((void));
extern void flexend PROTO ((int));
extern void usage PROTO ((void));
/* from file misc.c */
/* Add a #define to the action file. */
extern void action_define(const char *defname, int value);
extern void action_define PROTO ((const char *defname, int value));
/* Add the given text to the stored actions. */
extern void add_action(const char *new_text);
extern void add_action PROTO ((const char *new_text));
/* True if a string is all lower case. */
extern int all_lower(char *);
extern int all_lower PROTO ((char *));
/* True if a string is all upper case. */
extern int all_upper(char *);
extern int all_upper PROTO ((char *));
/* Compare two integers for use by qsort. */
extern int intcmp(const void *, const void *);
extern int intcmp PROTO ((const void *, const void *));
/* Check a character to make sure it's in the expected range. */
extern void check_char(int c);
extern void check_char PROTO ((int c));
/* Replace upper-case letter to lower-case. */
extern unsigned char clower(int);
extern Char clower PROTO ((int));
/* strdup() that fails fatally on allocation failures. */
extern char *xstrdup(const char *);
/* Returns a dynamically allocated copy of a string. */
extern char *copy_string PROTO ((const char *));
/* Returns a dynamically allocated copy of a (potentially) unsigned string. */
extern Char *copy_unsigned_string PROTO ((Char *));
/* Compare two characters for use by qsort with '\0' sorting last. */
extern int cclcmp(const void *, const void *);
extern int cclcmp PROTO ((const void *, const void *));
/* Finish up a block of data declarations. */
extern void dataend(void);
extern void dataend PROTO ((void));
/* Flush generated data statements. */
extern void dataflush(void);
extern void dataflush PROTO ((void));
/* Report an error message and terminate. */
extern void flexerror(const char *);
extern void flexerror PROTO ((const char *));
/* Report a fatal error message and terminate. */
extern void flexfatal(const char *);
extern void flexfatal PROTO ((const char *));
/* Report a fatal error with a pinpoint, and terminate */
#if HAVE_DECL___FUNC__
@@ -871,195 +907,208 @@ extern void flexfatal(const char *);
}while(0)
#endif /* ! HAVE_DECL___func__ */
/* Convert a hexadecimal digit string to an integer value. */
extern int htoi PROTO ((Char[]));
/* Report an error message formatted */
extern void lerr(const char *, ...)
extern void lerr PROTO ((const char *, ...))
#if defined(__GNUC__) && __GNUC__ >= 3
__attribute__((__format__(__printf__, 1, 2)))
#endif
;
/* Like lerr, but also exit after displaying message. */
extern void lerr_fatal(const char *, ...)
extern void lerr_fatal PROTO ((const char *, ...))
#if defined(__GNUC__) && __GNUC__ >= 3
__attribute__((__format__(__printf__, 1, 2)))
#endif
;
/* Spit out a "#line" statement. */
extern void line_directive_out(FILE *, int);
extern void line_directive_out PROTO ((FILE *, int));
/* Mark the current position in the action array as the end of the section 1
* user defs.
*/
extern void mark_defs1(void);
extern void mark_defs1 PROTO ((void));
/* Mark the current position in the action array as the end of the prolog. */
extern void mark_prolog(void);
extern void mark_prolog PROTO ((void));
/* Generate a data statment for a two-dimensional array. */
extern void mk2data(int);
extern void mk2data PROTO ((int));
extern void mkdata(int); /* generate a data statement */
extern void mkdata PROTO ((int)); /* generate a data statement */
/* Return the integer represented by a string of digits. */
extern int myctoi(const char *);
extern int myctoi PROTO ((const char *));
/* Return character corresponding to escape sequence. */
extern unsigned char myesc(unsigned char[]);
extern Char myesc PROTO ((Char[]));
/* Convert an octal digit string to an integer value. */
extern int otoi PROTO ((Char[]));
/* Output a (possibly-formatted) string to the generated scanner. */
extern void out(const char *);
extern void out_dec(const char *, int);
extern void out_dec2(const char *, int, int);
extern void out_hex(const char *, unsigned int);
extern void out_str(const char *, const char *);
extern void out_str3(const char *, const char *, const char *, const char *);
extern void out_str_dec(const char *, const char *, int);
extern void outc(int);
extern void outn(const char *);
extern void out_m4_define(const char* def, const char* val);
extern void out PROTO ((const char *));
extern void out_dec PROTO ((const char *, int));
extern void out_dec2 PROTO ((const char *, int, int));
extern void out_hex PROTO ((const char *, unsigned int));
extern void out_str PROTO ((const char *, const char *));
extern void out_str3
PROTO ((const char *, const char *, const char *, const char *));
extern void out_str_dec PROTO ((const char *, const char *, int));
extern void outc PROTO ((int));
extern void outn PROTO ((const char *));
extern void out_m4_define (const char* def, const char* val);
/* Return a printable version of the given character, which might be
* 8-bit.
*/
extern char *readable_form(int);
extern char *readable_form PROTO ((int));
/* Write out one section of the skeleton file. */
extern void skelout(void);
extern void skelout PROTO ((void));
/* Output a yy_trans_info structure. */
extern void transition_struct_out(int, int);
extern void transition_struct_out PROTO ((int, int));
/* Only needed when using certain broken versions of bison to build parse.c. */
extern void *yy_flex_xmalloc(int);
extern void *yy_flex_xmalloc PROTO ((int));
/* Set a region of memory to 0. */
extern void zero_out PROTO ((char *, size_t));
/* from file nfa.c */
/* Add an accepting state to a machine. */
extern void add_accept(int, int);
extern void add_accept PROTO ((int, int));
/* Make a given number of copies of a singleton machine. */
extern int copysingl(int, int);
extern int copysingl PROTO ((int, int));
/* Debugging routine to write out an nfa. */
extern void dumpnfa(int);
extern void dumpnfa PROTO ((int));
/* Finish up the processing for a rule. */
extern void finish_rule(int, int, int, int, int);
extern void finish_rule PROTO ((int, int, int, int, int));
/* Connect two machines together. */
extern int link_machines(int, int);
extern int link_machines PROTO ((int, int));
/* Mark each "beginning" state in a machine as being a "normal" (i.e.,
* not trailing context associated) state.
*/
extern void mark_beginning_as_normal(int);
extern void mark_beginning_as_normal PROTO ((int));
/* Make a machine that branches to two machines. */
extern int mkbranch(int, int);
extern int mkbranch PROTO ((int, int));
extern int mkclos(int); /* convert a machine into a closure */
extern int mkopt(int); /* make a machine optional */
extern int mkclos PROTO ((int)); /* convert a machine into a closure */
extern int mkopt PROTO ((int)); /* make a machine optional */
/* Make a machine that matches either one of two machines. */
extern int mkor(int, int);
extern int mkor PROTO ((int, int));
/* Convert a machine into a positive closure. */
extern int mkposcl(int);
extern int mkposcl PROTO ((int));
extern int mkrep(int, int, int); /* make a replicated machine */
extern int mkrep PROTO ((int, int, int)); /* make a replicated machine */
/* Create a state with a transition on a given symbol. */
extern int mkstate(int);
extern int mkstate PROTO ((int));
extern void new_rule(void); /* initialize for a new rule */
extern void new_rule PROTO ((void)); /* initialize for a new rule */
/* from file parse.y */
/* Build the "<<EOF>>" action for the active start conditions. */
extern void build_eof_action(void);
extern void build_eof_action PROTO ((void));
/* Write out a message formatted with one string, pinpointing its location. */
extern void format_pinpoint_message(const char *, const char *);
extern void format_pinpoint_message PROTO ((const char *, const char *));
/* Write out a message, pinpointing its location. */
extern void pinpoint_message(const char *);
extern void pinpoint_message PROTO ((const char *));
/* Write out a warning, pinpointing it at the given line. */
extern void line_warning(const char *, int);
extern void line_warning PROTO ((const char *, int));
/* Write out a message, pinpointing it at the given line. */
extern void line_pinpoint(const char *, int);
extern void line_pinpoint PROTO ((const char *, int));
/* Report a formatted syntax error. */
extern void format_synerr(const char *, const char *);
extern void synerr(const char *); /* report a syntax error */
extern void format_warn(const char *, const char *);
extern void lwarn(const char *); /* report a warning */
extern void yyerror(const char *); /* report a parse error */
extern int yyparse(void); /* the YACC parser */
extern void format_synerr PROTO ((const char *, const char *));
extern void synerr PROTO ((const char *)); /* report a syntax error */
extern void format_warn PROTO ((const char *, const char *));
extern void warn PROTO ((const char *)); /* report a warning */
extern void yyerror PROTO ((const char *)); /* report a parse error */
extern int yyparse PROTO ((void)); /* the YACC parser */
/* from file scan.l */
/* The Flex-generated scanner for flex. */
extern int flexscan(void);
extern int flexscan PROTO ((void));
/* Open the given file (if NULL, stdin) for scanning. */
extern void set_input_file(char *);
extern void set_input_file PROTO ((char *));
/* Wrapup a file in the lexical analyzer. */
extern int yywrap PROTO ((void));
/* from file sym.c */
/* Save the text of a character class. */
extern void cclinstal(char[], int);
extern void cclinstal PROTO ((Char[], int));
/* Lookup the number associated with character class. */
extern int ccllookup(char[]);
extern int ccllookup PROTO ((Char[]));
extern void ndinstal(const char *, char[]); /* install a name definition */
extern char *ndlookup(const char *); /* lookup a name definition */
extern void ndinstal PROTO ((const char *, Char[])); /* install a name definition */
extern Char *ndlookup PROTO ((const char *)); /* lookup a name definition */
/* Increase maximum number of SC's. */
extern void scextend(void);
extern void scinstal(const char *, int); /* make a start condition */
extern void scextend PROTO ((void));
extern void scinstal PROTO ((const char *, int)); /* make a start condition */
/* Lookup the number associated with a start condition. */
extern int sclookup(const char *);
extern int sclookup PROTO ((const char *));
/* from file tblcmp.c */
/* Build table entries for dfa state. */
extern void bldtbl(int[], int, int, int, int);
extern void bldtbl PROTO ((int[], int, int, int, int));
extern void cmptmps(void); /* compress template table entries */
extern void expand_nxt_chk(void); /* increase nxt/chk arrays */
extern void cmptmps PROTO ((void)); /* compress template table entries */
extern void expand_nxt_chk PROTO ((void)); /* increase nxt/chk arrays */
/* Finds a space in the table for a state to be placed. */
extern int find_table_space(int *, int);
extern void inittbl(void); /* initialize transition tables */
extern int find_table_space PROTO ((int *, int));
extern void inittbl PROTO ((void)); /* initialize transition tables */
/* Make the default, "jam" table entries. */
extern void mkdeftbl(void);
extern void mkdeftbl PROTO ((void));
/* Create table entries for a state (or state fragment) which has
* only one out-transition.
*/
extern void mk1tbl(int, int, int, int);
extern void mk1tbl PROTO ((int, int, int, int));
/* Place a state into full speed transition table. */
extern void place_state(int *, int, int);
extern void place_state PROTO ((int *, int, int));
/* Save states with only one out-transition to be processed later. */
extern void stack1(int, int, int, int);
extern void stack1 PROTO ((int, int, int, int));
/* from file yylex.c */
extern int yylex(void);
extern int yylex PROTO ((void));
/* A growable array. See buf.c. */
struct Buf {
@@ -1069,28 +1118,30 @@ struct Buf {
int nmax; /* max capacity of elements. */
};
extern void buf_init(struct Buf * buf, size_t elem_size);
extern void buf_destroy(struct Buf * buf);
extern struct Buf *buf_append(struct Buf * buf, const void *ptr, int n_elem);
extern struct Buf *buf_concat(struct Buf* dest, const struct Buf* src);
extern struct Buf *buf_strappend(struct Buf *, const char *str);
extern struct Buf *buf_strnappend(struct Buf *, const char *str, int nchars);
extern struct Buf *buf_strdefine(struct Buf * buf, const char *str, const char *def);
extern struct Buf *buf_prints(struct Buf *buf, const char *fmt, const char* s);
extern struct Buf *buf_m4_define(struct Buf *buf, const char* def, const char* val);
extern struct Buf *buf_m4_undefine(struct Buf *buf, const char* def);
extern struct Buf *buf_print_strings(struct Buf * buf, FILE* out);
extern struct Buf *buf_linedir(struct Buf *buf, const char* filename, int lineno);
extern void buf_init PROTO ((struct Buf * buf, size_t elem_size));
extern void buf_destroy PROTO ((struct Buf * buf));
extern struct Buf *buf_append
PROTO ((struct Buf * buf, const void *ptr, int n_elem));
extern struct Buf *buf_concat PROTO((struct Buf* dest, const struct Buf* src));
extern struct Buf *buf_strappend PROTO ((struct Buf *, const char *str));
extern struct Buf *buf_strnappend
PROTO ((struct Buf *, const char *str, int nchars));
extern struct Buf *buf_strdefine
PROTO ((struct Buf * buf, const char *str, const char *def));
extern struct Buf *buf_prints PROTO((struct Buf *buf, const char *fmt, const char* s));
extern struct Buf *buf_m4_define PROTO((struct Buf *buf, const char* def, const char* val));
extern struct Buf *buf_m4_undefine PROTO((struct Buf *buf, const char* def));
extern struct Buf *buf_print_strings PROTO((struct Buf * buf, FILE* out));
extern struct Buf *buf_linedir PROTO((struct Buf *buf, const char* filename, int lineno));
extern struct Buf userdef_buf; /* a string buffer for #define's generated by user-options on cmd line. */
extern struct Buf defs_buf; /* a char* buffer to save #define'd some symbols generated by flex. */
extern struct Buf yydmap_buf; /* a string buffer to hold yydmap elements */
extern struct Buf m4defs_buf; /* Holds m4 definitions. */
extern struct Buf top_buf; /* contains %top code. String buffer. */
extern bool no_section3_escape; /* True if the undocumented option --unsafe-no-m4-sect3-escape was passed */
/* For blocking out code from the header file. */
#define OUT_BEGIN_CODE() outn("m4_ifdef( [[M4_YY_IN_HEADER]],,[[m4_dnl")
#define OUT_BEGIN_CODE() outn("m4_ifdef( [[M4_YY_IN_HEADER]],,[[")
#define OUT_END_CODE() outn("]])")
/* For setjmp/longjmp (instead of calling exit(2)). Linkage in main.c */
@@ -1143,21 +1194,21 @@ struct filter {
/* output filter chain */
extern struct filter * output_chain;
extern struct filter *filter_create_ext (struct filter * chain, const char *cmd, ...);
struct filter *filter_create_int(struct filter *chain,
extern struct filter *filter_create_ext PROTO((struct filter * chain, const char *cmd, ...));
struct filter *filter_create_int PROTO((struct filter *chain,
int (*filter_func) (struct filter *),
void *extra);
extern bool filter_apply_chain(struct filter * chain);
extern int filter_truncate(struct filter * chain, int max_len);
extern int filter_tee_header(struct filter *chain);
extern int filter_fix_linedirs(struct filter *chain);
void *extra));
extern bool filter_apply_chain PROTO((struct filter * chain));
extern int filter_truncate (struct filter * chain, int max_len);
extern int filter_tee_header PROTO((struct filter *chain));
extern int filter_fix_linedirs PROTO((struct filter *chain));
/*
* From "regex.c"
*/
extern regex_t regex_linedir;
extern regex_t regex_linedir, regex_blank_line;
bool flex_init_regex(void);
void flex_regcomp(regex_t *preg, const char *regex, int cflags);
char *regmatch_dup (regmatch_t * m, const char *src);
@@ -1170,9 +1221,9 @@ bool regmatch_empty (regmatch_t * m);
typedef unsigned int scanflags_t;
extern scanflags_t* _sf_stk;
extern size_t _sf_top_ix, _sf_max; /**< stack of scanner flags. */
#define _SF_CASE_INS ((scanflags_t) 0x0001)
#define _SF_DOT_ALL ((scanflags_t) 0x0002)
#define _SF_SKIP_WS ((scanflags_t) 0x0004)
#define _SF_CASE_INS 0x0001
#define _SF_DOT_ALL 0x0002
#define _SF_SKIP_WS 0x0004
#define sf_top() (_sf_stk[_sf_top_ix])
#define sf_case_ins() (sf_top() & _SF_CASE_INS)
#define sf_dot_all() (sf_top() & _SF_DOT_ALL)
+21 -12
View File
@@ -3,17 +3,31 @@
#ifndef FLEXINT_H
#define FLEXINT_H
/* C++ systems might need __STDC_LIMIT_MACROS defined before including
* <stdint.h>, if you want the limit (max/min) macros for int types.
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif
/* "flexint_shared.h" will be included also in skeleton. It will include
* <inttypes.h> (if available) and define flex's integral types.
*/
#include "flexint_shared.h"
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
/* Limits of integral types. */
#ifndef INT8_MIN
@@ -44,11 +58,6 @@
#define UINT32_MAX (4294967295U)
#endif
#ifndef INT_MAX
#define INT_MAX ((int)(~0U)>>1)
#endif
#ifndef SIZE_MAX
#define SIZE_MAX (~(size_t)0)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
-50
View File
@@ -1,50 +0,0 @@
/* flex integer type definitions */
#ifndef YYFLEX_INTTYPES_DEFINED
#define YYFLEX_INTTYPES_DEFINED
/* Prefer C99 integer types if available. */
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* Include <inttypes.h> and not <stdint.h> because Solaris 2.6 has the former
* and not the latter.
*/
#include <inttypes.h>
# define YYFLEX_USE_STDINT
# else
# if defined(_MSC_VER) && _MSC_VER >= 1600
/* Visual C++ 2010 does not define __STDC_VERSION__ and has <stdint.h> but not
* <inttypes.h>.
*/
#include <stdint.h>
# define YYFLEX_USE_STDINT
# endif
# endif
# ifdef YYFLEX_USE_STDINT
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
# else
typedef unsigned char flex_uint8_t;
typedef short int flex_int16_t;
typedef unsigned short int flex_uint16_t;
# ifdef __STDC__
typedef signed char flex_int8_t;
/* ISO C only requires at least 16 bits for int. */
#include <limits.h>
# if UINT_MAX >= 4294967295
# define YYFLEX_INT32_DEFINED
typedef int flex_int32_t;
typedef unsigned int flex_uint32_t;
# endif
# else
typedef char flex_int8_t;
# endif
# ifndef YYFLEX_INT32_DEFINED
typedef long int flex_int32_t;
typedef unsigned long int flex_uint32_t;
# endif
# endif
#endif /* YYFLEX_INTTYPES_DEFINED */
+1286 -284
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -20,7 +20,7 @@
#define _LIBGETTEXT_H 1
/* NLS can be disabled through the configure --disable-nls option. */
#ifdef ENABLE_NLS
#if ENABLE_NLS
/* Get declarations of GNU message catalog functions. */
# include <libintl.h>
-8
View File
@@ -1,8 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
Name: libfl
Description: Flex (the fast lexical analyzer) support library
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lfl
+1 -3
View File
@@ -21,8 +21,6 @@
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */
#include <stdlib.h>
extern int yylex (void);
int main (int argc, char *argv[])
@@ -32,5 +30,5 @@ int main (int argc, char *argv[])
while (yylex () != 0) ;
exit(0);
return 0;
}
+555 -143
View File
@@ -36,15 +36,16 @@
#include "version.h"
#include "options.h"
#include "tables.h"
#include "parse.h"
static char flex_version[] = FLEX_VERSION;
/* declare functions that have forward references */
void flexinit(int, char **);
void readin(void);
void set_up_initial_allocations(void);
void flexinit PROTO ((int, char **));
void readin PROTO ((void));
void set_up_initial_allocations PROTO ((void));
static char *basename2 PROTO ((char *path, int should_strip_ext));
/* these globals are all defined and commented in flexdef.h */
int printstats, syntaxerror, eofseen, ddebug, trace, nowarn, spprdflt;
@@ -63,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;
char *infilename = NULL, *outfilename = NULL, *headerfilename = NULL, *headercharfilename = NULL;
int did_outfilename;
char *prefix, *yyclass, *extra_type = NULL;
int do_stdinit, use_stdout;
@@ -93,20 +94,21 @@ int *accsiz, *dhash, numas;
int numsnpairs, jambase, jamstate;
int lastccl, *cclmap, *ccllen, *cclng, cclreuse;
int current_maxccls, current_max_ccl_tbl_size;
unsigned char *ccltbl;
Char *ccltbl;
char nmstr[MAXLINE];
int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs;
int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
int num_backing_up, bol_needed;
FILE *backing_up_file;
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';
struct flex_backend_t *backend;
bool ansi_func_defs, ansi_func_protos, charset_enabled = false;
char *charset_source = NULL;
bool tablesext, tablesverify, gentables;
char *tablesfilename=0,*tablesname=0;
@@ -117,9 +119,19 @@ struct yytbl_writer tableswr;
*/
char *program_name = "flex";
#ifndef SHORT_FILE_NAMES
static const char outfile_template[] = "lex.%s.%s";
static const char *backing_name = "lex.backup";
static const char backing_name[] = "lex.backup";
static const char tablesfile_template[] = "lex.%s.tables";
#else
static const char outfile_template[] = "lex%s.%s";
static const char backing_name[] = "lex.bck";
static const char tablesfile_template[] = "lex%s.tbl";
#endif
#ifdef MS_DOS
extern unsigned _stklen = 16384;
#endif
/* From scan.l */
extern FILE* yyout;
@@ -128,15 +140,18 @@ static char outfile_path[MAXLINE];
static int outfile_created = 0;
static char *skelname = NULL;
static int _stdout_closed = 0; /* flag to prevent double-fclose() on stdout. */
const char *escaped_qstart = "]]M4_YY_NOOP[M4_YY_NOOP[M4_YY_NOOP[[";
const char *escaped_qend = "]]M4_YY_NOOP]M4_YY_NOOP]M4_YY_NOOP[[";
const char *escaped_qstart = "[[]]M4_YY_NOOP[M4_YY_NOOP[M4_YY_NOOP[[]]";
const char *escaped_qend = "[[]]M4_YY_NOOP]M4_YY_NOOP]M4_YY_NOOP[[]]";
/* For debugging. The max number of filters to apply to skeleton. */
static int preproc_level = 1000;
int flex_main (int argc, char *argv[]);
int flex_main PROTO ((int argc, char *argv[]));
int main PROTO ((int argc, char *argv[]));
int flex_main (int argc, char *argv[])
int flex_main (argc, argv)
int argc;
char *argv[];
{
int i, exit_status, child_status;
@@ -170,9 +185,6 @@ int flex_main (int argc, char *argv[])
readin ();
if (backend->prolog)
backend->prolog ();
skelout ();
/* %% [1.5] DFA */
ntod ();
@@ -199,9 +211,11 @@ int flex_main (int argc, char *argv[])
}
/* Wrapper around flex_main, so flex_main can be built as a library. */
int main (int argc, char *argv[])
int main (argc, argv)
int argc;
char *argv[];
{
#if defined(ENABLE_NLS) && ENABLE_NLS
#if ENABLE_NLS
#if HAVE_LOCALE_H
setlocale (LC_MESSAGES, "");
setlocale (LC_CTYPE, "");
@@ -215,7 +229,7 @@ int main (int argc, char *argv[])
/* check_options - check user-specified options */
void check_options (void)
void check_options ()
{
int i;
const char * m4 = NULL;
@@ -280,7 +294,7 @@ void check_options (void)
flexerror (_("Can't use -+ with -CF option"));
if (C_plus_plus && yytext_is_array) {
lwarn (_("%array incompatible with -+ option"));
warn (_("%array incompatible with -+ option"));
yytext_is_array = false;
}
@@ -290,6 +304,8 @@ void check_options (void)
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. */
@@ -314,15 +330,28 @@ void check_options (void)
}
}
if (extra_type)
buf_m4_define( &m4defs_buf, "M4_EXTRA_TYPE_DEFS", extra_type);
if (!ansi_func_defs)
buf_m4_define( &m4defs_buf, "M4_YY_NO_ANSI_FUNC_DEFS", NULL);
if (!ansi_func_protos)
buf_m4_define( &m4defs_buf, "M4_YY_NO_ANSI_FUNC_PROTOS", NULL);
if (extra_type)
buf_m4_define( &m4defs_buf, "M4_EXTRA_TYPE_DEFS", extra_type);
if (!use_stdout) {
FILE *prev_stdout;
if (!did_outfilename) {
char *suffix;
if (C_plus_plus)
suffix = "cc";
else
suffix = "c";
snprintf (outfile_path, sizeof(outfile_path), outfile_template,
prefix, backend->suffix());
prefix, suffix);
outfilename = outfile_path;
}
@@ -338,48 +367,47 @@ void check_options (void)
/* Setup the filter chain. */
output_chain = filter_create_int(NULL, filter_tee_header, headerfilename);
if ( !(m4 = getenv("M4"))) {
char *slash;
m4 = M4;
if ((slash = strrchr(M4, '/')) != NULL) {
m4 = slash+1;
/* break up $PATH */
const char *path = getenv("PATH");
if (!path) {
m4 = M4;
} else {
int m4_length = strlen(m4);
do {
size_t length = strlen(path);
struct stat sbuf;
const char *endOfDir = strchr(path, ':');
if (!endOfDir)
endOfDir = path+length;
{
char *m4_path = calloc(endOfDir-path + 1 + m4_length + 1, 1);
memcpy(m4_path, path, endOfDir-path);
m4_path[endOfDir-path] = '/';
memcpy(m4_path + (endOfDir-path) + 1, m4, m4_length + 1);
if (stat(m4_path, &sbuf) == 0 &&
(S_ISREG(sbuf.st_mode)) && sbuf.st_mode & S_IXUSR) {
m4 = m4_path;
break;
}
free(m4_path);
}
path = endOfDir+1;
} while (path[0]);
if (!path[0])
m4 = M4;
}
}
}
if ( !(m4 = getenv("M4")))
m4 = M4;
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);
@@ -402,25 +430,26 @@ void check_options (void)
FILE *tablesout;
struct yytbl_hdr hdr;
char *pname = 0;
size_t nbytes = 0;
int nbytes = 0;
buf_m4_define (&m4defs_buf, "M4_YY_TABLES_EXTERNAL", NULL);
if (!tablesfilename) {
nbytes = strlen (prefix) + strlen (tablesfile_template) + 2;
tablesfilename = pname = calloc(nbytes, 1);
tablesfilename = pname = (char *) calloc (nbytes, 1);
snprintf (pname, nbytes, tablesfile_template, prefix);
}
if ((tablesout = fopen (tablesfilename, "w")) == NULL)
lerr (_("could not create %s"), tablesfilename);
free(pname);
if (pname)
free (pname);
tablesfilename = 0;
yytbl_writer_init (&tableswr, tablesout);
nbytes = strlen (prefix) + strlen ("tables") + 2;
tablesname = calloc(nbytes, 1);
tablesname = (char *) calloc (nbytes, 1);
snprintf (tablesname, nbytes, "%stables", prefix);
yytbl_hdr_init (&hdr, flex_version, tablesname);
@@ -443,8 +472,6 @@ void check_options (void)
if ( bison_bridge_lloc)
buf_m4_define (&m4defs_buf, "<M4_YY_BISON_LLOC>", NULL);
if (strchr(prefix, '[') || strchr(prefix, ']'))
flexerror(_("Prefix cannot include '[' or ']'"));
buf_m4_define(&m4defs_buf, "M4_YY_PREFIX", prefix);
if (did_outfilename)
@@ -453,45 +480,47 @@ void check_options (void)
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", backend->yy_int_aligned());
buf_strdefine (&userdef_buf, "YY_INT_ALIGNED",
long_align ? "long int" : "short int");
/* Define the start condition macros. */
{
struct Buf tmpbuf;
buf_init(&tmpbuf, sizeof(char));
for (i = 1; i <= lastsc; i++) {
char *str, *fmt = backend->int_define_fmt;
size_t strsz;
/* Define the start condition macros. */
{
struct Buf tmpbuf;
buf_init(&tmpbuf, sizeof(char));
for (i = 1; i <= lastsc; i++) {
char *str, *fmt = "#define %s %d\n";
size_t strsz;
strsz = strlen(fmt) + strlen(scname[i]) + (size_t)(1 + ceil (log10(i))) + 2;
str = malloc(strsz);
if (!str)
flexfatal(_("allocation of macro definition failed"));
snprintf(str, strsz, fmt, scname[i], i - 1);
buf_strappend(&tmpbuf, str);
free(str);
}
buf_m4_define(&m4defs_buf, "M4_YY_SC_DEFS", tmpbuf.elts);
buf_destroy(&tmpbuf);
}
str = (char*)flex_alloc(strsz = strlen(fmt) + strlen(scname[i]) + (int)(1 + log10(i)) + 2);
if (!str)
flexfatal(_("allocation of macro definition failed"));
snprintf(str, strsz, fmt, scname[i], i - 1);
buf_strappend(&tmpbuf, str);
free(str);
}
buf_m4_define(&m4defs_buf, "M4_YY_SC_DEFS", tmpbuf.elts);
buf_destroy(&tmpbuf);
}
/* This is where we begin writing to the file. */
/* This is where we begin writing to the file. */
/* Dump the %top code. */
if( top_buf.elts)
outn((char*) top_buf.elts);
/* Dump the %top code. */
if( top_buf.elts)
outn((char*) top_buf.elts);
/* Dump the m4 definitions. */
buf_print_strings(&m4defs_buf, stdout);
m4defs_buf.nelts = 0; /* memory leak here. */
/* Dump the m4 definitions. */
buf_print_strings(&m4defs_buf, stdout);
m4defs_buf.nelts = 0; /* memory leak here. */
/* Place a bogus line directive, it will be fixed in the filter. */
if (gen_line_dirs && backend->trace_fmt) {
char buf2[4096];
snprintf(buf2, sizeof(buf2), backend->trace_fmt, 0, "M4_YY_OUTFILE_NAME");
outn(buf2);
}
/* Place a bogus line directive, it will be fixed in the filter. */
outn("#line 0 \"M4_YY_OUTFILE_NAME\"\n");
/* Dump the user defined preproc directives. */
if (userdef_buf.elts)
@@ -507,7 +536,9 @@ void check_options (void)
* This routine does not return.
*/
void flexend (int exit_status)
void flexend (exit_status)
int exit_status;
{
static int called_before = -1; /* prevent infinite recursion. */
int tblsiz;
@@ -515,6 +546,10 @@ void flexend (int 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"),
@@ -525,8 +560,192 @@ void flexend (int exit_status)
skelname);
}
if (backend->epilog)
backend->epilog();
#if 0
fprintf (header_out,
"#ifdef YY_HEADER_EXPORT_START_CONDITIONS\n");
fprintf (header_out,
"/* Beware! Start conditions are not prefixed. */\n");
/* Special case for "INITIAL" */
fprintf (header_out,
"#undef INITIAL\n#define INITIAL 0\n");
for (i = 2; i <= lastsc; i++)
fprintf (header_out, "#define %s %d\n", scname[i], i - 1);
fprintf (header_out,
"#endif /* YY_HEADER_EXPORT_START_CONDITIONS */\n\n");
/* Kill ALL flex-related macros. This is so the user
* can #include more than one generated header file. */
fprintf (header_out, "#ifndef YY_HEADER_NO_UNDEFS\n");
fprintf (header_out,
"/* Undefine all internal macros, etc., that do no belong in the header. */\n\n");
{
const char * undef_list[] = {
"BEGIN",
"ECHO",
"EOB_ACT_CONTINUE_SCAN",
"EOB_ACT_END_OF_FILE",
"EOB_ACT_LAST_MATCH",
"FLEX_SCANNER",
"FLEX_STD",
"REJECT",
"YYFARGS0",
"YYFARGS1",
"YYFARGS2",
"YYFARGS3",
"YYLMAX",
"YYSTATE",
"YY_AT_BOL",
"YY_BREAK",
"YY_BUFFER_EOF_PENDING",
"YY_BUFFER_NEW",
"YY_BUFFER_NORMAL",
"YY_BUF_SIZE",
"M4_YY_CALL_LAST_ARG",
"M4_YY_CALL_ONLY_ARG",
"YY_CURRENT_BUFFER",
"YY_DECL",
"M4_YY_DECL_LAST_ARG",
"M4_YY_DEF_LAST_ARG",
"M4_YY_DEF_ONLY_ARG",
"YY_DO_BEFORE_ACTION",
"YY_END_OF_BUFFER",
"YY_END_OF_BUFFER_CHAR",
"YY_EXIT_FAILURE",
"YY_EXTRA_TYPE",
"YY_FATAL_ERROR",
"YY_FLEX_DEFINED_ECHO",
"YY_FLEX_LEX_COMPAT",
"YY_FLEX_MAJOR_VERSION",
"YY_FLEX_MINOR_VERSION",
"YY_FLEX_SUBMINOR_VERSION",
"YY_FLUSH_BUFFER",
"YY_G",
"YY_INPUT",
"YY_INTERACTIVE",
"YY_INT_ALIGNED",
"YY_LAST_ARG",
"YY_LESS_LINENO",
"YY_LEX_ARGS",
"YY_LEX_DECLARATION",
"YY_LEX_PROTO",
"YY_MAIN",
"YY_MORE_ADJ",
"YY_NEED_STRLEN",
"YY_NEW_FILE",
"YY_NULL",
"YY_NUM_RULES",
"YY_ONLY_ARG",
"YY_PARAMS",
"YY_PROTO",
"M4_YY_PROTO_LAST_ARG",
"M4_YY_PROTO_ONLY_ARG void",
"YY_READ_BUF_SIZE",
"YY_REENTRANT",
"YY_RESTORE_YY_MORE_OFFSET",
"YY_RULE_SETUP",
"YY_SC_TO_UI",
"YY_SKIP_YYWRAP",
"YY_START",
"YY_START_STACK_INCR",
"YY_STATE_EOF",
"YY_STDINIT",
"YY_TRAILING_HEAD_MASK",
"YY_TRAILING_MASK",
"YY_USER_ACTION",
"YY_USE_CONST",
"YY_USE_PROTOS",
"unput",
"yyTABLES_NAME",
"yy_create_buffer",
"yy_delete_buffer",
"yy_flex_debug",
"yy_flush_buffer",
"yy_init_buffer",
"yy_load_buffer_state",
"yy_new_buffer",
"yy_scan_buffer",
"yy_scan_bytes",
"yy_scan_string",
"yy_set_bol",
"yy_set_interactive",
"yy_switch_to_buffer",
"yypush_buffer_state",
"yypop_buffer_state",
"yyensure_buffer_stack",
"yyalloc",
"yyconst",
"yyextra",
"yyfree",
"yyget_debug",
"yyget_extra",
"yyget_in",
"yyget_leng",
"yyget_lineno",
"yyget_lloc",
"yyget_lval",
"yyget_out",
"yyget_text",
"yyin",
"yyleng",
"yyless",
"yylex",
"yylex_destroy",
"yylex_init",
"yylex_init_extra",
"yylineno",
"yylloc",
"yylval",
"yymore",
"yyout",
"yyrealloc",
"yyrestart",
"yyset_debug",
"yyset_extra",
"yyset_in",
"yyset_lineno",
"yyset_lloc",
"yyset_lval",
"yyset_out",
"yytables_destroy",
"yytables_fload",
"yyterminate",
"yytext",
"yytext_ptr",
"yywrap",
/* must be null-terminated */
NULL};
for (i=0; undef_list[i] != NULL; i++)
fprintf (header_out, "#undef %s\n", undef_list[i]);
}
/* undef any of the auto-generated symbols. */
for (i = 0; i < defs_buf.nelts; i++) {
/* don't undef start conditions */
if (sclookup (((char **) defs_buf.elts)[i]) > 0)
continue;
fprintf (header_out, "#undef %s\n",
((char **) defs_buf.elts)[i]);
}
fprintf (header_out,
"#endif /* !YY_HEADER_NO_UNDEFS */\n");
fprintf (header_out, "\n");
fprintf (header_out, "#undef %sIN_HEADER\n", prefix);
fprintf (header_out, "#endif /* %sHEADER_H */\n", prefix);
if (ferror (header_out))
lerr (_("error creating header file %s"),
headerfilename);
fflush (header_out);
fclose (header_out);
#endif
if (exit_status != 0 && outfile_created) {
if (ferror (stdout))
@@ -757,7 +976,9 @@ void flexend (int exit_status)
/* flexinit - initialize flex */
void flexinit (int argc, char **argv)
void flexinit (argc, argv)
int argc;
char **argv;
{
int i, sawcmpflag, rv, optind;
char *arg;
@@ -782,6 +1003,7 @@ void flexinit (int argc, char **argv)
tablesext = tablesverify = false;
gentables = true;
tablesfilename = tablesname = NULL;
ansi_func_defs = ansi_func_protos = true;
sawcmpflag = false;
@@ -810,9 +1032,9 @@ void flexinit (int argc, char **argv)
flex_init_regex();
/* Enable C++ if program name ends with '+'. */
program_name = argv[0];
program_name = basename2 (argv[0], 0);
if (program_name != NULL &&
if (program_name[0] != '\0' &&
program_name[strlen (program_name) - 1] == '+')
C_plus_plus = true;
@@ -849,11 +1071,6 @@ void flexinit (int argc, char **argv)
backing_up_report = true;
break;
case OPT_BACKUP_FILE:
backing_up_report = true;
backing_name = arg;
break;
case OPT_DONOTHING:
break;
@@ -938,7 +1155,7 @@ void flexinit (int argc, char **argv)
break;
case OPT_PREPROC_LEVEL:
preproc_level = (int) strtol(arg,NULL,0);
preproc_level = strtol(arg,NULL,0);
break;
case OPT_MAIN:
@@ -1022,7 +1239,7 @@ void flexinit (int argc, char **argv)
break;
case OPT_VERSION:
printf ("%s %s\n", (C_plus_plus ? "flex++" : "flex"), flex_version);
printf (_("%s %s\n"), program_name, flex_version);
FLEX_EXIT (0);
case OPT_WARN:
@@ -1089,16 +1306,24 @@ void flexinit (int argc, char **argv)
{
/* arg is "symbol" or "symbol=definition". */
char *def;
char buf2[4096];
for (def = arg;
*def != '\0' && *def != '='; ++def)
continue;
if (*def == '\0')
def = "1";
*def != '\0' && *def != '='; ++def) ;
snprintf(buf2, sizeof(buf2), backend->string_define_fmt, arg, def);
buf_strappend (&userdef_buf, buf2);
buf_strappend (&userdef_buf, "#define ");
if (*def == '\0') {
buf_strappend (&userdef_buf, arg);
buf_strappend (&userdef_buf,
" 1\n");
}
else {
buf_strnappend (&userdef_buf, arg,
def - arg);
buf_strappend (&userdef_buf, " ");
buf_strappend (&userdef_buf,
def + 1);
buf_strappend (&userdef_buf, "\n");
}
}
break;
@@ -1155,6 +1380,14 @@ void flexinit (int argc, char **argv)
reject_really_used = false;
break;
case OPT_NO_ANSI_FUNC_DEFS:
ansi_func_defs = false;
break;
case OPT_NO_ANSI_FUNC_PROTOS:
ansi_func_protos = false;
break;
case OPT_NO_YY_PUSH_STATE:
//buf_strdefine (&userdef_buf, "YY_NO_PUSH_STATE", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_PUSH_STATE",0);
@@ -1207,14 +1440,6 @@ void flexinit (int argc, char **argv)
//buf_strdefine (&userdef_buf, "YY_NO_SET_LINENO", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LINENO",0);
break;
case OPT_NO_YYGET_COLUMN:
//buf_strdefine (&userdef_buf, "YY_NO_GET_COLUMN", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_COLUMN",0);
break;
case OPT_NO_YYSET_COLUMN:
//buf_strdefine (&userdef_buf, "YY_NO_SET_COLUMN", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_COLUMN",0);
break;
case OPT_NO_YYGET_IN:
//buf_strdefine (&userdef_buf, "YY_NO_GET_IN", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_IN",0);
@@ -1249,10 +1474,6 @@ void flexinit (int argc, char **argv)
break;
case OPT_HEX:
trace_hex = 1;
break;
case OPT_NO_SECT3_ESCAPE:
no_section3_escape = true;
break;
} /* switch */
} /* while scanopt() */
@@ -1280,16 +1501,25 @@ void flexinit (int argc, char **argv)
lastprot = 1;
set_up_initial_allocations ();
backend = &cpp_backend;
}
/* readin - read in the rules section of the input file(s) */
void readin (void)
void readin ()
{
line_directive_out(NULL, 1);
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);
if (yyparse ()) {
pinpoint_message (_("fatal parse error"));
@@ -1398,6 +1628,167 @@ void readin (void)
("variable trailing context rules cannot be used with -f or -F"));
}
if (reject){
out_m4_define( "M4_YY_USES_REJECT", NULL);
//outn ("\n#define YY_USES_REJECT");
}
if (!do_yywrap) {
if (!C_plus_plus) {
if (reentrant)
outn ("\n#define yywrap(yyscanner) (/*CONSTCOND*/1)");
else
outn ("\n#define yywrap() (/*CONSTCOND*/1)");
}
outn ("#define YY_SKIP_YYWRAP");
}
if (ddebug)
outn ("\n#define FLEX_DEBUG");
OUT_BEGIN_CODE ();
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);
}
OUT_END_CODE ();
if(charset_enabled)
outn ("#define YY_CHARSET");
if (C_plus_plus) {
outn ("#define yytext_ptr yytext");
if (interactive)
outn ("#define YY_INTERACTIVE");
}
else {
OUT_BEGIN_CODE ();
/* In reentrant scanner, stdinit is handled in flex.skl. */
if (do_stdinit) {
if (reentrant){
outn ("#ifdef VMS");
outn ("#ifdef __VMS_POSIX");
outn ("#define YY_STDINIT");
outn ("#endif");
outn ("#else");
outn ("#define YY_STDINIT");
outn ("#endif");
}
outn ("#ifdef VMS");
outn ("#ifndef __VMS_POSIX");
outn (yy_nostdinit);
outn ("#else");
outn (yy_stdinit);
outn ("#endif");
outn ("#else");
outn (yy_stdinit);
outn ("#endif");
}
else {
if(!reentrant)
outn (yy_nostdinit);
}
OUT_END_CODE ();
}
OUT_BEGIN_CODE ();
if (fullspd)
outn ("typedef yyconst struct yy_trans_info *yy_state_type;");
else if (!C_plus_plus)
outn ("typedef int yy_state_type;");
OUT_END_CODE ();
if (lex_compat)
outn ("#define YY_FLEX_LEX_COMPAT");
if (!C_plus_plus && !reentrant) {
outn ("extern int yylineno;");
OUT_BEGIN_CODE ();
outn ("int yylineno = 1;");
OUT_END_CODE ();
}
if (C_plus_plus) {
outn ("\n#include <FlexLexer.h>");
if (!do_yywrap) {
outn("\nint yyFlexLexer::yywrap() { return 1; }");
}
if (yyclass) {
outn ("int yyFlexLexer::yylex()");
outn ("\t{");
outn ("\tLexerError( \"yyFlexLexer::yylex invoked but %option yyclass used\" );");
outn ("\treturn 0;");
outn ("\t}");
out_str ("\n#define YY_DECL int %s::yylex()\n",
yyclass);
}
}
else {
/* Watch out: yytext_ptr is a variable when yytext is an array,
* but it's a macro when yytext is a pointer.
*/
if (yytext_is_array) {
if (!reentrant)
outn ("extern YY_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 ("#define yytext_ptr yytext");
}
}
if (yyclass)
flexerror (_
("%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
@@ -1411,9 +1802,10 @@ void readin (void)
ccl2ecl ();
}
/* set_up_initial_allocations - allocate memory for internal tables */
void set_up_initial_allocations (void)
void set_up_initial_allocations ()
{
maximum_mns = (long_align ? MAXIMUM_MNS_LONG : MAXIMUM_MNS);
current_mns = INITIAL_MNS;
@@ -1467,11 +1859,31 @@ void set_up_initial_allocations (void)
dss = allocate_int_ptr_array (current_max_dfas);
dfaacc = allocate_dfaacc_union (current_max_dfas);
nultrans = NULL;
nultrans = (int *) 0;
}
void usage (void)
/* extracts basename from path, optionally stripping the extension "\.*"
* (same concept as /bin/sh `basename`, but different handling of extension). */
static char *basename2 (path, strip_ext)
char *path;
int strip_ext; /* boolean */
{
char *b, *e = 0;
b = path;
for (b = path; *path; path++)
if (*path == '/')
b = path + 1;
else if (*path == '.')
e = path;
if (strip_ext && e && e > b)
*e = '\0';
return b;
}
void usage ()
{
FILE *f = stdout;
@@ -1510,8 +1922,7 @@ void usage (void)
" -t, --stdout write scanner on stdout instead of %s\n"
" --yyclass=NAME name of C++ class\n"
" --header-file=FILE create a C header file in addition to the scanner\n"
" --tables-file[=FILE] write tables to FILE\n"
" --backup-file=FILE write backing-up information to FILE\n" "\n"
" --tables-file[=FILE] write tables to FILE\n" "\n"
"Scanner behavior:\n"
" -7, --7bit generate 7-bit scanner\n"
" -8, --8bit generate 8-bit scanner\n"
@@ -1530,6 +1941,8 @@ void usage (void)
" --bison-bridge scanner for bison pure parser.\n"
" --bison-locations include yylloc support.\n"
" --stdinit initialize yyin/yyout to stdin/stdout\n"
" --noansi-definitions old-style function definitions\n"
" --noansi-prototypes empty parameter list in prototypes\n"
" --nounistd do not include <unistd.h>\n"
" --noFUNCTION do not generate a particular FUNCTION\n"
"\n" "Miscellaneous:\n"
@@ -1538,7 +1951,6 @@ void usage (void)
" -?\n"
" -h, --help produce this help message\n"
" -V, --version report %s version\n"),
backing_name, "flex", outfile_path, "flex");
backing_name, program_name, outfile_path, program_name);
}
+253 -120
View File
@@ -30,6 +30,7 @@
/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */
#include "flexdef.h"
#include "tables.h"
@@ -59,15 +60,14 @@ static void sko_push(bool dc)
{
if(!sko_stack){
sko_sz = 1;
sko_stack = malloc(sizeof(struct sko_state) * (size_t) sko_sz);
sko_stack = (struct sko_state*)flex_alloc(sizeof(struct sko_state)*sko_sz);
if (!sko_stack)
flexfatal(_("allocation of sko_stack failed"));
sko_len = 0;
}
if(sko_len >= sko_sz){
sko_sz *= 2;
sko_stack = realloc(sko_stack,
sizeof(struct sko_state) * (size_t) sko_sz);
sko_stack = (struct sko_state*)flex_realloc(sko_stack,sizeof(struct sko_state)*sko_sz);
}
/* initialize to zero and push */
@@ -90,7 +90,9 @@ static void sko_pop(bool* dc)
}
/* Append "#define defname value\n" to the running buffer. */
void action_define (const char *defname, int value)
void action_define (defname, value)
const char *defname;
int value;
{
char buf[MAXLINE];
char *cpy;
@@ -106,24 +108,50 @@ void action_define (const char *defname, int value)
add_action (buf);
/* track #defines so we can undef them when we're done. */
cpy = xstrdup(defname);
cpy = copy_string (defname);
buf_append (&defs_buf, &cpy, 1);
}
/* Append "new_text" to the running buffer. */
void add_action (const char *new_text)
#ifdef notdef
/** Append "m4_define([[defname]],[[value]])m4_dnl\n" to the running buffer.
* @param defname The macro name.
* @param value The macro value, can be NULL, which is the same as the empty string.
*/
static void action_m4_define (const char *defname, const char * value)
{
int len = (int) strlen (new_text);
char buf[MAXLINE];
flexfatal ("DO NOT USE THIS FUNCTION!");
if ((int) strlen (defname) > MAXLINE / 2) {
format_pinpoint_message (_
("name \"%s\" ridiculously long"),
defname);
return;
}
snprintf (buf, sizeof(buf), "m4_define([[%s]],[[%s]])m4_dnl\n", defname, value?value:"");
add_action (buf);
}
#endif
/* Append "new_text" to the running buffer. */
void add_action (new_text)
const char *new_text;
{
int len = strlen (new_text);
while (len + action_index >= action_size - 10 /* slop */ ) {
int new_size = action_size * 2;
if (action_size > INT_MAX / 2)
if (new_size <= 0)
/* Increase just a little, to try to avoid overflow
* on 16-bit machines.
*/
action_size += action_size / 8;
else
action_size = action_size * 2;
action_size = new_size;
action_array =
reallocate_character_array (action_array,
@@ -138,35 +166,29 @@ void add_action (const char *new_text)
/* allocate_array - allocate memory for an integer array of the given size */
void *allocate_array (int size, size_t element_size)
void *allocate_array (size, element_size)
int size;
size_t element_size;
{
void *new_array;
#if HAVE_REALLOCARR
new_array = NULL;
if (reallocarr(&new_array, (size_t) size, element_size))
flexfatal (_("memory allocation failed in allocate_array()"));
#else
# if HAVE_REALLOCARRAY
new_array = reallocarray(NULL, (size_t) size, element_size);
# else
/* Do manual overflow detection */
size_t num_bytes = (size_t) size * element_size;
new_array = (size && SIZE_MAX / (size_t) size < element_size) ? NULL :
malloc(num_bytes);
# endif
if (!new_array)
flexfatal (_("memory allocation failed in allocate_array()"));
#endif
return new_array;
void *mem;
size_t num_bytes = element_size * size;
mem = flex_alloc (num_bytes);
if (!mem)
flexfatal (_
("memory allocation failed in allocate_array()"));
return mem;
}
/* all_lower - true if a string is all lower-case */
int all_lower (char *str)
int all_lower (str)
char *str;
{
while (*str) {
if (!isascii ((unsigned char) * str) || !islower ((unsigned char) * str))
if (!isascii ((Char) * str) || !islower ((Char) * str))
return 0;
++str;
}
@@ -177,10 +199,11 @@ int all_lower (char *str)
/* all_upper - true if a string is all upper-case */
int all_upper (char *str)
int all_upper (str)
char *str;
{
while (*str) {
if (!isascii ((unsigned char) * str) || !isupper ((unsigned char) * str))
if (!isascii ((Char) * str) || !isupper ((Char) * str))
return 0;
++str;
}
@@ -202,7 +225,8 @@ int intcmp (const void *a, const void *b)
* and exits.
*/
void check_char (int c)
void check_char (c)
int c;
{
if (c >= CSIZE)
lerr (_("bad character '%s' detected in check_char()"),
@@ -218,20 +242,57 @@ void check_char (int c)
/* clower - replace upper-case letter to lower-case */
unsigned char clower (int c)
Char clower (c)
int c;
{
return (unsigned char) ((isascii (c) && isupper (c)) ? tolower (c) : c);
return (Char) ((isascii (c) && isupper (c)) ? tolower (c) : c);
}
char *xstrdup(const char *s)
/* copy_string - returns a dynamically allocated copy of a string */
char *copy_string (str)
const char *str;
{
char *s2;
const char *c1;
char *c2;
char *copy;
unsigned int size;
if ((s2 = strdup(s)) == NULL)
flexfatal (_("memory allocation failure in xstrdup()"));
/* find length */
for (c1 = str; *c1; ++c1) ;
return s2;
size = (c1 - str + 1) * sizeof (char);
copy = (char *) flex_alloc (size);
if (copy == NULL)
flexfatal (_("dynamic memory failure in copy_string()"));
for (c2 = copy; (*c2++ = *str++) != 0;) ;
return copy;
}
/* copy_unsigned_string -
* returns a dynamically allocated copy of a (potentially) unsigned string
*/
Char *copy_unsigned_string (str)
Char *str;
{
Char *c;
Char *copy;
/* find length */
for (c = str; *c; ++c) ;
copy = allocate_Character_array (c - str + 1);
for (c = copy; (*c++ = *str++) != 0;) ;
return copy;
}
@@ -239,19 +300,19 @@ char *xstrdup(const char *s)
int cclcmp (const void *a, const void *b)
{
if (!*(const unsigned char *) a)
if (!*(const Char *) a)
return 1;
else
if (!*(const unsigned char *) b)
if (!*(const Char *) b)
return - 1;
else
return *(const unsigned char *) a - *(const unsigned char *) b;
return *(const Char *) a - *(const Char *) b;
}
/* dataend - finish up a block of data declarations */
void dataend (void)
void dataend ()
{
/* short circuit any output */
if (gentables) {
@@ -260,7 +321,7 @@ void dataend (void)
dataflush ();
/* add terminator for initialization; { for vi */
outn (backend->table_closer);
outn (" } ;\n");
}
dataline = 0;
datapos = 0;
@@ -269,7 +330,7 @@ void dataend (void)
/* dataflush - flush generated data statements */
void dataflush (void)
void dataflush ()
{
/* short circuit any output */
if (!gentables)
@@ -292,7 +353,8 @@ void dataflush (void)
/* flexerror - report an error message and terminate */
void flexerror (const char *msg)
void flexerror (msg)
const char *msg;
{
fprintf (stderr, "%s: %s\n", program_name, msg);
flexend (1);
@@ -301,7 +363,8 @@ void flexerror (const char *msg)
/* flexfatal - report a fatal error message and terminate */
void flexfatal (const char *msg)
void flexfatal (msg)
const char *msg;
{
fprintf (stderr, _("%s: fatal internal error, %s\n"),
program_name, msg);
@@ -309,10 +372,22 @@ void flexfatal (const char *msg)
}
/* htoi - convert a hexadecimal digit string to an integer value */
int htoi (str)
Char str[];
{
unsigned int result;
(void) sscanf ((char *) str, "%x", &result);
return result;
}
/* lerr - report an error message */
void lerr (const char *msg, ...)
{
void lerr (const char *msg, ...) {
char errmsg[MAXLINE];
va_list args;
@@ -339,10 +414,13 @@ void lerr_fatal (const char *msg, ...)
/* line_directive_out - spit out a "#line" statement */
void line_directive_out (FILE *output_file, int do_infile)
void line_directive_out (output_file, do_infile)
FILE *output_file;
int do_infile;
{
char directive[MAXLINE*2], filename[MAXLINE];
char directive[MAXLINE], filename[MAXLINE];
char *s1, *s2, *s3;
static const char *line_fmt = "#line %d \"%s\"\n";
if (!gen_line_dirs)
return;
@@ -356,8 +434,8 @@ void line_directive_out (FILE *output_file, int do_infile)
s3 = &filename[sizeof (filename) - 2];
while (s2 < s3 && *s1) {
if (*s1 == '\\' || *s1 == '"')
/* Escape the '\' or '"' */
if (*s1 == '\\')
/* Escape the '\' */
*s2++ = '\\';
*s2++ = *s1++;
@@ -365,12 +443,11 @@ void line_directive_out (FILE *output_file, int do_infile)
*s2 = '\0';
if (backend->trace_fmt)
if (do_infile)
snprintf (directive, sizeof(directive), backend->trace_fmt, linenum, filename);
else {
snprintf (directive, sizeof(directive), backend->trace_fmt, 0, filename);
}
if (do_infile)
snprintf (directive, sizeof(directive), line_fmt, linenum, filename);
else {
snprintf (directive, sizeof(directive), line_fmt, 0, filename);
}
/* If output_file is nil then we should put the directive in
* the accumulated actions.
@@ -387,7 +464,7 @@ void line_directive_out (FILE *output_file, int do_infile)
* representing where the user's section 1 definitions end
* and the prolog begins
*/
void mark_defs1 (void)
void mark_defs1 ()
{
defs1_offset = 0;
action_array[action_index++] = '\0';
@@ -399,7 +476,7 @@ void mark_defs1 (void)
/* mark_prolog - mark the current position in the action array as
* representing the end of the action prolog
*/
void mark_prolog (void)
void mark_prolog ()
{
action_array[action_index++] = '\0';
action_offset = action_index;
@@ -411,7 +488,8 @@ void mark_prolog (void)
*
* Generates a data statement initializing the current 2-D array to "value".
*/
void mk2data (int value)
void mk2data (value)
int value;
{
/* short circuit any output */
if (!gentables)
@@ -440,7 +518,8 @@ void mk2data (int value)
* Generates a data statement initializing the current array element to
* "value".
*/
void mkdata (int value)
void mkdata (value)
int value;
{
/* short circuit any output */
if (!gentables)
@@ -465,7 +544,8 @@ void mkdata (int value)
/* myctoi - return the integer represented by a string of digits */
int myctoi (const char *array)
int myctoi (array)
const char *array;
{
int val = 0;
@@ -477,9 +557,10 @@ int myctoi (const char *array)
/* myesc - return character corresponding to escape sequence */
unsigned char myesc (unsigned char array[])
Char myesc (array)
Char array[];
{
unsigned char c, esc_char;
Char c, esc_char;
switch (array[1]) {
case 'b':
@@ -492,10 +573,19 @@ unsigned char myesc (unsigned char array[])
return '\r';
case 't':
return '\t';
#if defined (__STDC__)
case 'a':
return '\a';
case 'v':
return '\v';
#else
case 'a':
return '\007';
case 'v':
return '\013';
#endif
case '0':
case '1':
case '2':
@@ -507,15 +597,18 @@ unsigned char myesc (unsigned char array[])
{ /* \<octal> */
int sptr = 1;
while (sptr <= 3 &&
array[sptr] >= '0' && array[sptr] <= '7') {
while (isascii (array[sptr]) &&
isdigit (array[sptr]))
/* Don't increment inside loop control
* because if isdigit() is a macro it might
* expand into multiple increments ...
*/
++sptr;
}
c = array[sptr];
array[sptr] = '\0';
esc_char = (unsigned char) strtoul (array + 1, NULL, 8);
esc_char = otoi (array + 1);
array[sptr] = c;
@@ -526,18 +619,18 @@ unsigned char myesc (unsigned char array[])
{ /* \x<hex> */
int sptr = 2;
while (sptr <= 3 && isxdigit (array[sptr])) {
while (isascii (array[sptr]) &&
isxdigit (array[sptr]))
/* Don't increment inside loop control
* because if isxdigit() is a macro it might
* because if isdigit() is a macro it might
* expand into multiple increments ...
*/
++sptr;
}
c = array[sptr];
array[sptr] = '\0';
esc_char = (unsigned char) strtoul (array + 2, NULL, 16);
esc_char = htoi (array + 2);
array[sptr] = c;
@@ -550,51 +643,76 @@ unsigned char myesc (unsigned char array[])
}
/* otoi - convert an octal digit string to an integer value */
int otoi (str)
Char str[];
{
unsigned int result;
(void) sscanf ((char *) str, "%o", &result);
return result;
}
/* out - various flavors of outputing a (possibly formatted) string for the
* generated scanner, keeping track of the line count.
*/
void out (const char *str)
void out (str)
const char *str;
{
fputs (str, stdout);
}
void out_dec (const char *fmt, int n)
void out_dec (fmt, n)
const char *fmt;
int n;
{
fprintf (stdout, fmt, n);
}
void out_dec2 (const char *fmt, int n1, int n2)
void out_dec2 (fmt, n1, n2)
const char *fmt;
int n1, n2;
{
fprintf (stdout, fmt, n1, n2);
}
void out_hex (const char *fmt, unsigned int x)
void out_hex (fmt, x)
const char *fmt;
unsigned int x;
{
fprintf (stdout, fmt, x);
}
void out_str (const char *fmt, const char str[])
void out_str (fmt, str)
const char *fmt, str[];
{
fprintf (stdout,fmt, str);
}
void out_str3 (const char *fmt, const char s1[], const char s2[], const char s3[])
void out_str3 (fmt, s1, s2, s3)
const char *fmt, s1[], s2[], s3[];
{
fprintf (stdout,fmt, s1, s2, s3);
}
void out_str_dec (const char *fmt, const char str[], int n)
void out_str_dec (fmt, str, n)
const char *fmt, str[];
int n;
{
fprintf (stdout,fmt, str, n);
}
void outc (int c)
void outc (c)
int c;
{
fputc (c, stdout);
}
void outn (const char *str)
void outn (str)
const char *str;
{
fputs (str,stdout);
fputc('\n',stdout);
@@ -616,7 +734,8 @@ void out_m4_define (const char* def, const char* val)
* The returned string is in static storage.
*/
char *readable_form (int c)
char *readable_form (c)
int c;
{
static char rform[20];
@@ -632,10 +751,14 @@ char *readable_form (int c)
return "\\r";
case '\t':
return "\\t";
#if defined (__STDC__)
case '\a':
return "\\a";
case '\v':
return "\\v";
#endif
default:
if(trace_hex)
snprintf (rform, sizeof(rform), "\\x%.2x", (unsigned int) c);
@@ -649,7 +772,7 @@ char *readable_form (int c)
return "' '";
else {
rform[0] = (char) c;
rform[0] = c;
rform[1] = '\0';
return rform;
@@ -659,25 +782,18 @@ char *readable_form (int c)
/* reallocate_array - increase the size of a dynamic array */
void *reallocate_array (void *array, int size, size_t element_size)
void *reallocate_array (array, size, element_size)
void *array;
int size;
size_t element_size;
{
void *new_array;
#if HAVE_REALLOCARR
new_array = array;
if (reallocarr(&new_array, (size_t) size, element_size))
flexfatal (_("attempt to increase array size failed"));
#else
# if HAVE_REALLOCARRAY
new_array = reallocarray(array, (size_t) size, element_size);
# else
/* Do manual overflow detection */
size_t num_bytes = (size_t) size * element_size;
new_array = (size && SIZE_MAX / (size_t) size < element_size) ? NULL :
realloc(array, num_bytes);
# endif
size_t num_bytes = element_size * size;
new_array = flex_realloc (array, num_bytes);
if (!new_array)
flexfatal (_("attempt to increase array size failed"));
#endif
return new_array;
}
@@ -688,7 +804,7 @@ void *reallocate_array (void *array, int size, size_t element_size)
* Copies skelfile or skel array to stdout until a line beginning with
* "%%" or EOF is found.
*/
void skelout (void)
void skelout ()
{
char buf_storage[MAXLINE];
char *buf = buf_storage;
@@ -702,11 +818,11 @@ void skelout (void)
/* Loop pulling lines either from the skelfile, if we're using
* one, or from the selected back end's skel[] array.
* one, or from the skel[] array.
*/
while (skelfile ?
(fgets (buf, MAXLINE, skelfile) != NULL) :
((buf = (char *) backend->skel[skel_ind++]) != 0)) {
((buf = (char *) skel[skel_ind++]) != 0)) {
if (skelfile)
chomp (buf);
@@ -728,10 +844,7 @@ void skelout (void)
*/
#define cmd_match(s) (strncmp(buf,(s),strlen(s))==0)
if (buf[1] == '#') {
/* %# indicates comment line to be ignored */
}
else if (buf[1] == '%') {
if (buf[1] == '%') {
/* %% is a break point for skelout() */
return;
}
@@ -776,9 +889,8 @@ void skelout (void)
outn ((char *) (yydmap_buf.elts));
}
else if (cmd_match (CMD_DEFINE_YYTABLES)) {
if ( tablesext )
out_str( "#define YYTABLES_NAME \"%s\"\n",
tablesname ? tablesname : "yytables" );
out_str("#define YYTABLES_NAME \"%s\"\n",
tablesname?tablesname:"yytables");
}
else if (cmd_match (CMD_IF_CPP_ONLY)) {
/* only for C++ */
@@ -803,6 +915,9 @@ void skelout (void)
/* %e end linkage-only code. */
OUT_END_CODE ();
}
else if (buf[1] == '#') {
/* %# a comment in the skel. ignore. */
}
else {
flexfatal (_("bad line in skeleton file"));
}
@@ -820,14 +935,15 @@ void skelout (void)
* element_n. Formats the output with spaces and carriage returns.
*/
void transition_struct_out (int element_v, int element_n)
void transition_struct_out (element_v, element_n)
int element_v, element_n;
{
/* short circuit any output */
if (!gentables)
return;
out_dec2 (backend->dyad, element_v, element_n);
out_dec2 (" {%4d,%4d },", element_v, element_n);
datapos += TRANS_STRUCT_PRINT_LENGTH;
@@ -844,14 +960,12 @@ void transition_struct_out (int element_v, int element_n)
/* The following is only needed when building flex's parser using certain
* broken versions of bison.
*
* XXX: this is should go soon
*/
void *yy_flex_xmalloc (int size)
void *yy_flex_xmalloc (size)
int size;
{
void *result;
void *result = flex_alloc ((size_t) size);
result = malloc((size_t) size);
if (!result)
flexfatal (_
("memory allocation failed in yy_flex_xmalloc()"));
@@ -860,10 +974,29 @@ void *yy_flex_xmalloc (int size)
}
/* zero_out - set a region of memory to 0
*
* Sets region_ptr[0] through region_ptr[size_in_bytes - 1] to zero.
*/
void zero_out (region_ptr, size_in_bytes)
char *region_ptr;
size_t size_in_bytes;
{
char *rp, *rp_end;
rp = region_ptr;
rp_end = region_ptr + size_in_bytes;
while (rp < rp_end)
*rp++ = 0;
}
/* Remove all '\n' and '\r' characters, if any, from the end of str.
* str can be any null-terminated string, or NULL.
* returns str. */
char *chomp (char *str)
char *chomp (str)
char *str;
{
char *p = str;
+14 -24
View File
@@ -21,27 +21,17 @@
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
if test ! $# = 4; then
echo 'Usage: mkskel.sh lang srcdir m4 version' >&2
exit 1
fi
lang=$1
srcdir=$2
m4=$3
VERSION=$4
case $VERSION in
*[!0-9.]*) echo 'Invalid version number' >&2; exit 1;;
esac
IFS=.
set $VERSION
sed 's/4_/a4_/g
s/m4preproc_/m4_/g
' "$srcdir/${lang}-flex.skl" |
"$m4" -P -I "$srcdir" "-DFLEX_MAJOR_VERSION=$1" \
"-DFLEX_MINOR_VERSION=$2" \
"-DFLEX_SUBMINOR_VERSION=$3" |
sed '/^%#/d
s/m4_/m4preproc_/g
s/a4_/4_/g
s/[\\"]/\\&/g
s/[^\r]*/ "&",/'
cat <<!
/* File created from flex.skl via mkskel.sh */
#include "flexdef.h"
const char *skel[] = {
!
sed 's/\\/&&/g' | sed 's/"/\\"/g' | sed 's/.*/ "&",/'
cat <<!
0
};
!
+36 -23
View File
@@ -36,8 +36,8 @@
/* declare functions that have forward references */
int dupmachine(int);
void mkxtion(int, int);
int dupmachine PROTO ((int));
void mkxtion PROTO ((int, int));
/* add_accept - add an accepting state to a machine
@@ -45,7 +45,8 @@ void mkxtion(int, int);
* accepting_number becomes mach's accepting number.
*/
void add_accept (int mach, int accepting_number)
void add_accept (mach, accepting_number)
int mach, accepting_number;
{
/* Hang the accepting number off an epsilon state. if it is associated
* with a state that has a non-epsilon out-transition, then the state
@@ -76,7 +77,8 @@ void add_accept (int mach, int accepting_number)
* num - the number of copies of singl to be present in newsng
*/
int copysingl (int singl, int num)
int copysingl (singl, num)
int singl, num;
{
int copy, i;
@@ -91,7 +93,9 @@ int copysingl (int singl, int num)
/* dumpnfa - debugging routine to write out an nfa */
void dumpnfa (int state1)
void dumpnfa (state1)
int state1;
{
int sym, tsp1, tsp2, anum, ns;
@@ -144,7 +148,8 @@ void dumpnfa (int state1)
* states accessible by the arrays firstst and lastst
*/
int dupmachine (int mach)
int dupmachine (mach)
int mach;
{
int i, init, state_offset;
int state = 0;
@@ -191,8 +196,9 @@ int dupmachine (int mach)
* context has variable length.
*/
void finish_rule (int mach, int variable_trail_rule, int headcnt, int trailcnt,
int pcont_act)
void finish_rule (mach, variable_trail_rule, headcnt, trailcnt,
pcont_act)
int mach, variable_trail_rule, headcnt, trailcnt, pcont_act;
{
char action_text[MAXLINE];
@@ -286,8 +292,7 @@ void finish_rule (int mach, int variable_trail_rule, int headcnt, int trailcn
if (!continued_action)
add_action ("YY_RULE_SETUP\n");
line_directive_out(NULL, 1);
add_action("[[");
line_directive_out ((FILE *) 0, 1);
}
@@ -307,7 +312,8 @@ void finish_rule (int mach, int variable_trail_rule, int headcnt, int trailcn
* FIRST is set to new by the operation. last is unmolested.
*/
int link_machines (int first, int last)
int link_machines (first, last)
int first, last;
{
if (first == NIL)
return last;
@@ -333,7 +339,8 @@ int link_machines (int first, int last)
* The "beginning" states are the epsilon closure of the first state
*/
void mark_beginning_as_normal (int mach)
void mark_beginning_as_normal (mach)
int mach;
{
switch (state_type[mach]) {
case STATE_NORMAL:
@@ -374,7 +381,8 @@ void mark_beginning_as_normal (int mach)
* more mkbranch's. Compare with mkor()
*/
int mkbranch (int first, int second)
int mkbranch (first, second)
int first, second;
{
int eps;
@@ -401,7 +409,8 @@ int mkbranch (int first, int second)
* new - a new state which matches the closure of "state"
*/
int mkclos (int state)
int mkclos (state)
int state;
{
return mkopt (mkposcl (state));
}
@@ -421,7 +430,8 @@ int mkclos (int state)
* 2. mach is destroyed by the call
*/
int mkopt (int mach)
int mkopt (mach)
int mach;
{
int eps;
@@ -457,7 +467,8 @@ int mkopt (int mach)
* the number of epsilon states needed
*/
int mkor (int first, int second)
int mkor (first, second)
int first, second;
{
int eps, orend;
@@ -499,8 +510,6 @@ int mkor (int first, int second)
}
}
firstst[first] = MIN(firstst[first], firstst[second]);
finalst[first] = orend;
return first;
}
@@ -514,7 +523,8 @@ int mkor (int first, int second)
* new - a machine matching the positive closure of "state"
*/
int mkposcl (int state)
int mkposcl (state)
int state;
{
int eps;
@@ -543,7 +553,8 @@ int mkposcl (int state)
* if "ub" is INFINITE_REPEAT then "new" matches "lb" or more occurrences of "mach"
*/
int mkrep (int mach, int lb, int ub)
int mkrep (mach, lb, ub)
int mach, lb, ub;
{
int base_mach, tail, copy, i;
@@ -589,7 +600,8 @@ int mkrep (int mach, int lb, int ub)
* that it admittedly is)
*/
int mkstate (int sym)
int mkstate (sym)
int sym;
{
if (++lastnfa >= current_mns) {
if ((current_mns += MNS_INCREMENT) >= maximum_mns)
@@ -665,7 +677,8 @@ current_mns);
* stateto - the state to which the transition is to be made
*/
void mkxtion (int statefrom, int stateto)
void mkxtion (statefrom, stateto)
int statefrom, stateto;
{
if (trans1[statefrom] == NO_TRANSITION)
trans1[statefrom] = stateto;
@@ -682,7 +695,7 @@ void mkxtion (int statefrom, int stateto)
/* new_rule - initialize for a new rule */
void new_rule (void)
void new_rule ()
{
if (++num_rules >= current_max_rules) {
++num_reallocs;
+5 -8
View File
@@ -62,8 +62,6 @@ optspec_t flexopts[] = {
,
{"--backup", OPT_BACKUP, 0}
, /* Generate backing-up information to lex.backup. */
{"--backup-file=FILE", OPT_BACKUP_FILE, 0}
, /* Generate backing-up information to FILE. */
{"-B", OPT_BATCH, 0}
,
{"--batch", OPT_BATCH, 0}
@@ -215,6 +213,10 @@ optspec_t flexopts[] = {
,
{"--nowarn", OPT_NO_WARN, 0}
, /* Suppress warning messages. */
{"--noansi-definitions", OPT_NO_ANSI_FUNC_DEFS, 0}
,
{"--noansi-prototypes", OPT_NO_ANSI_FUNC_PROTOS, 0}
,
{"--yyclass=NAME", OPT_YYCLASS, 0}
,
{"--yylineno", OPT_YYLINENO, 0}
@@ -257,10 +259,6 @@ optspec_t flexopts[] = {
,
{"--noyyset_lineno", OPT_NO_YYSET_LINENO, 0}
,
{"--noyyget_column", OPT_NO_YYGET_COLUMN, 0}
,
{"--noyyset_column", OPT_NO_YYSET_COLUMN, 0}
,
{"--noyyget_in", OPT_NO_YYGET_IN, 0}
,
{"--noyyset_in", OPT_NO_YYSET_IN, 0}
@@ -277,8 +275,7 @@ optspec_t flexopts[] = {
,
{"--noyyset_lloc", OPT_NO_YYSET_LLOC, 0}
,
{"--unsafe-no-m4-sect3-escape", OPT_NO_SECT3_ESCAPE, 0}
,
{0, 0, 0} /* required final NULL entry. */
};
+3 -5
View File
@@ -46,7 +46,6 @@ enum flexopt_flag_t {
OPT_ALWAYS_INTERACTIVE,
OPT_ARRAY,
OPT_BACKUP,
OPT_BACKUP_FILE,
OPT_BATCH,
OPT_BISON_BRIDGE,
OPT_BISON_BRIDGE_LOCATIONS,
@@ -69,6 +68,8 @@ enum flexopt_flag_t {
OPT_META_ECS,
OPT_NEVER_INTERACTIVE,
OPT_NO_ALIGN,
OPT_NO_ANSI_FUNC_DEFS,
OPT_NO_ANSI_FUNC_PROTOS,
OPT_NO_DEBUG,
OPT_NO_DEFAULT,
OPT_NO_ECS,
@@ -84,7 +85,6 @@ enum flexopt_flag_t {
OPT_NO_YYGET_IN,
OPT_NO_YYGET_LENG,
OPT_NO_YYGET_LINENO,
OPT_NO_YYGET_COLUMN,
OPT_NO_YYGET_LLOC,
OPT_NO_YYGET_LVAL,
OPT_NO_YYGET_OUT,
@@ -94,7 +94,6 @@ enum flexopt_flag_t {
OPT_NO_YYSET_EXTRA,
OPT_NO_YYSET_IN,
OPT_NO_YYSET_LINENO,
OPT_NO_YYSET_COLUMN,
OPT_NO_YYSET_LLOC,
OPT_NO_YYSET_LVAL,
OPT_NO_YYSET_OUT,
@@ -128,8 +127,7 @@ enum flexopt_flag_t {
OPT_YYCLASS,
OPT_YYLINENO,
OPT_YYMORE,
OPT_YYWRAP,
OPT_NO_SECT3_ESCAPE,
OPT_YYWRAP
};
#endif
+51 -39
View File
@@ -1,8 +1,8 @@
/* parse.y - parser for flex input */
%token CHAR NUMBER SECTEND SCDECL XSCDECL NAME PREVCCL EOF_OP
%token TOK_OPTION TOK_OUTFILE TOK_PREFIX TOK_YYCLASS TOK_HEADER_FILE TOK_EXTRA_TYPE
%token TOK_TABLES_FILE
%token OPTION_OP OPT_OUTFILE OPT_PREFIX OPT_YYCLASS OPT_HEADER OPT_HEADER_CHAR
%token OPT_EXTRA_TYPE OPT_TABLES OPT_CHARSET_SOURCE
%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
@@ -80,7 +80,7 @@ int previous_continued_action; /* whether the previous rule's action was '|' */
do{ \
char fw3_msg[MAXLINE];\
snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\
lwarn( fw3_msg );\
warn( fw3_msg );\
}while(0)
/* Expand a POSIX character class expression. */
@@ -140,7 +140,7 @@ goal : initlex sect1 sect1end sect2 initforrule
else
add_action( "ECHO" );
add_action( ";\n\tYY_BREAK]]\n" );
add_action( ";\n\tYY_BREAK\n" );
}
;
@@ -184,30 +184,32 @@ namelist1 : namelist1 NAME
{ synerr( _("bad start condition list") ); }
;
options : TOK_OPTION optionlist
options : OPTION_OP optionlist
;
optionlist : optionlist option
|
;
option : TOK_OUTFILE '=' NAME
option : OPT_OUTFILE '=' NAME
{
outfilename = xstrdup(nmstr);
outfilename = copy_string( nmstr );
did_outfilename = 1;
}
| TOK_EXTRA_TYPE '=' NAME
{ extra_type = xstrdup(nmstr); }
| TOK_PREFIX '=' NAME
{ prefix = xstrdup(nmstr);
if (strchr(prefix, '[') || strchr(prefix, ']'))
flexerror(_("Prefix must not contain [ or ]")); }
| TOK_YYCLASS '=' NAME
{ yyclass = xstrdup(nmstr); }
| TOK_HEADER_FILE '=' NAME
{ headerfilename = xstrdup(nmstr); }
| TOK_TABLES_FILE '=' NAME
{ tablesext = true; tablesfilename = xstrdup(nmstr); }
| OPT_EXTRA_TYPE '=' NAME
{ extra_type = copy_string( nmstr ); }
| OPT_PREFIX '=' NAME
{ prefix = copy_string( nmstr ); }
| OPT_YYCLASS '=' NAME
{ yyclass = copy_string( nmstr ); }
| OPT_HEADER '=' NAME
{ headerfilename = copy_string( nmstr ); }
| OPT_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'
@@ -305,7 +307,7 @@ flexrule : '^' rule
scon_stk[++scon_stk_ptr] = i;
if ( scon_stk_ptr == 0 )
lwarn(
warn(
"all start conditions already have <<EOF>> rules" );
else
@@ -400,7 +402,7 @@ rule : re2 re
* erroneously.
*/
if ( ! varlength || headcnt != 0 )
lwarn(
warn(
"trailing context made variable due to preceding '|' action" );
/* Mark as variable. */
@@ -455,7 +457,7 @@ rule : re2 re
/* See the comment in the rule for "re2 re"
* above.
*/
lwarn(
warn(
"trailing context made variable due to preceding '|' action" );
varlength = true;
@@ -727,7 +729,7 @@ singleton : singleton '*'
{
/* Sort characters for fast searching.
*/
qsort( ccltbl + cclmap[$1], (size_t) ccllen[$1], sizeof (*ccltbl), cclcmp );
qsort( ccltbl + cclmap[$1], ccllen[$1], sizeof (*ccltbl), cclcmp );
if ( useecs )
mkeccl( ccltbl + cclmap[$1], ccllen[$1],
@@ -915,13 +917,13 @@ ccl_expr:
| CCE_NEG_XDIGIT { CCL_NEG_EXPR(isxdigit); }
| CCE_NEG_LOWER {
if ( sf_case_ins() )
lwarn(_("[:^lower:] is ambiguous in case insensitive scanner"));
warn(_("[:^lower:] is ambiguous in case insensitive scanner"));
else
CCL_NEG_EXPR(islower);
}
| CCE_NEG_UPPER {
if ( sf_case_ins() )
lwarn(_("[:^upper:] ambiguous in case insensitive scanner"));
warn(_("[:^upper:] ambiguous in case insensitive scanner"));
else
CCL_NEG_EXPR(isupper);
}
@@ -953,7 +955,7 @@ string : string CHAR
* conditions
*/
void build_eof_action(void)
void build_eof_action()
{
int i;
char action_text[MAXLINE];
@@ -978,8 +980,7 @@ void build_eof_action(void)
}
}
line_directive_out(NULL, 1);
add_action("[[");
line_directive_out( (FILE *) 0, 1 );
/* This isn't a normal rule after all - don't count it as
* such, so we don't have any holes in the rule numbering
@@ -993,7 +994,8 @@ void build_eof_action(void)
/* format_synerr - write out formatted syntax error */
void format_synerr( const char *msg, const char arg[] )
void format_synerr( msg, arg )
const char *msg, arg[];
{
char errmsg[MAXLINE];
@@ -1004,7 +1006,8 @@ void format_synerr( const char *msg, const char arg[] )
/* synerr - report a syntax error */
void synerr( const char *str )
void synerr( str )
const char *str;
{
syntaxerror = true;
pinpoint_message( str );
@@ -1013,18 +1016,20 @@ void synerr( const char *str )
/* format_warn - write out formatted warning */
void format_warn( const char *msg, const char arg[] )
void format_warn( msg, arg )
const char *msg, arg[];
{
char warn_msg[MAXLINE];
snprintf( warn_msg, sizeof(warn_msg), msg, arg );
lwarn( warn_msg );
warn( warn_msg );
}
/* lwarn - report a warning, unless -w was given */
/* warn - report a warning, unless -w was given */
void lwarn( const char *str )
void warn( str )
const char *str;
{
line_warning( str, linenum );
}
@@ -1033,7 +1038,8 @@ void lwarn( const char *str )
* pinpointing its location
*/
void format_pinpoint_message( const char *msg, const char arg[] )
void format_pinpoint_message( msg, arg )
const char *msg, arg[];
{
char errmsg[MAXLINE];
@@ -1044,7 +1050,8 @@ void format_pinpoint_message( const char *msg, const char arg[] )
/* pinpoint_message - write out a message, pinpointing its location */
void pinpoint_message( const char *str )
void pinpoint_message( str )
const char *str;
{
line_pinpoint( str, linenum );
}
@@ -1052,7 +1059,9 @@ void pinpoint_message( const char *str )
/* line_warning - report a warning at a given line, unless -w was given */
void line_warning( const char *str, int line )
void line_warning( str, line )
const char *str;
int line;
{
char warning[MAXLINE];
@@ -1066,7 +1075,9 @@ void line_warning( const char *str, int line )
/* line_pinpoint - write out a message, pinpointing it at the given line */
void line_pinpoint( const char *str, int line )
void line_pinpoint( str, line )
const char *str;
int line;
{
fprintf( stderr, "%s:%d: %s\n", infilename, line, str );
}
@@ -1076,7 +1087,8 @@ void line_pinpoint( const char *str, int line )
* currently, messages are ignore
*/
void yyerror( const char *msg )
void yyerror( msg )
const char *msg;
{
(void)msg;
}
+21 -13
View File
@@ -25,8 +25,10 @@
static const char* REGEXP_LINEDIR = "^#line ([[:digit:]]+) \"(.*)\"";
static const char* REGEXP_BLANK_LINE = "^[[:space:]]*$";
regex_t regex_linedir; /**< matches line directives */
regex_t regex_blank_line; /**< matches blank lines */
/** Initialize the regular expressions.
@@ -35,6 +37,8 @@ regex_t regex_linedir; /**< matches line directives */
bool flex_init_regex(void)
{
flex_regcomp(&regex_linedir, REGEXP_LINEDIR, REG_EXTENDED);
flex_regcomp(&regex_blank_line, REGEXP_BLANK_LINE, REG_EXTENDED);
return true;
}
@@ -50,17 +54,21 @@ void flex_regcomp(regex_t *preg, const char *regex, int cflags)
memset (preg, 0, sizeof (regex_t));
if ((err = regcomp (preg, regex, cflags)) != 0) {
const size_t errbuf_sz = 200;
char *errbuf;
int n;
const int errbuf_sz = 200;
char *errbuf, *rxerr;
errbuf = malloc(errbuf_sz * sizeof(char));
errbuf = (char*)flex_alloc(errbuf_sz *sizeof(char));
if (!errbuf)
flexfatal(_("Unable to allocate buffer to report regcomp"));
n = snprintf(errbuf, errbuf_sz, "regcomp for \"%s\" failed: ", regex);
regerror(err, preg, errbuf+n, errbuf_sz-(size_t)n);
rxerr = (char*)flex_alloc(errbuf_sz *sizeof(char));
if (!rxerr)
flexfatal(_("Unable to allocate buffer for regerror"));
regerror (err, preg, rxerr, errbuf_sz);
snprintf (errbuf, errbuf_sz, "regcomp for \"%s\" failed: %s", regex, rxerr);
flexfatal (errbuf); /* never returns - no need to free(errbuf) */
flexfatal (errbuf);
free(errbuf);
free(rxerr);
}
}
@@ -72,12 +80,12 @@ void flex_regcomp(regex_t *preg, const char *regex, int cflags)
char *regmatch_dup (regmatch_t * m, const char *src)
{
char *str;
size_t len;
int len;
if (m == NULL || m->rm_so < 0 || m->rm_eo < m->rm_so)
if (m == NULL || m->rm_so < 0)
return NULL;
len = (size_t) (m->rm_eo - m->rm_so);
str = malloc((len + 1) * sizeof(char));
len = m->rm_eo - m->rm_so;
str = (char *) flex_alloc ((len + 1) * sizeof (char));
if (!str)
flexfatal(_("Unable to allocate a copy of the match"));
strncpy (str, src + m->rm_so, len);
@@ -99,7 +107,7 @@ char *regmatch_cpy (regmatch_t * m, char *dest, const char *src)
return dest;
}
snprintf (dest, (size_t) regmatch_len(m), "%s", src + m->rm_so);
snprintf (dest, regmatch_len(m), "%s", src + m->rm_so);
return dest;
}
@@ -142,7 +150,7 @@ int regmatch_strtol (regmatch_t * m, const char *src, char **endptr,
else
s = regmatch_dup (m, src);
n = (int) strtol (s, endptr, base);
n = strtol (s, endptr, base);
if (s != buf)
free (s);
+182 -205
View File
@@ -1,11 +1,5 @@
/* scan.l - scanner for flex input -*-C-*- */
%top{
/* flexdef.h includes config.h, which may contain macros that alter the API */
/* of libc functions. Must include first before any libc header. */
#include "flexdef.h"
}
%{
/* Copyright (c) 1990 The Regents of the University of California. */
/* All rights reserved. */
@@ -38,17 +32,12 @@
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */
#include "flexdef.h"
#include "parse.h"
extern bool tablesverify, tablesext;
extern int trlcontxt; /* Set in parse.y for each rule. */
extern const char *escaped_qstart, *escaped_qend;
#define M4QSTART "[""["
#define M4QEND "]""]"
#define ESCAPED_QSTART "[" M4QEND M4QSTART "[" M4QEND M4QSTART
#define ESCAPED_QEND M4QEND "]" M4QSTART M4QEND "]" M4QSTART
#define ACTION_ECHO add_action( yytext )
#define ACTION_IFDEF(def, should_define) \
{ \
@@ -56,8 +45,8 @@ extern const char *escaped_qstart, *escaped_qend;
action_define( def, 1 ); \
}
#define ACTION_ECHO_QSTART add_action (ESCAPED_QSTART)
#define ACTION_ECHO_QEND add_action (ESCAPED_QEND)
#define ACTION_ECHO_QSTART add_action (escaped_qstart)
#define ACTION_ECHO_QEND add_action (escaped_qend)
#define ACTION_M4_IFDEF(def, should_define) \
do{ \
@@ -70,7 +59,7 @@ extern const char *escaped_qstart, *escaped_qend;
#define MARK_END_OF_PROLOG mark_prolog();
#define YY_DECL \
int flexscan(void)
int flexscan()
#define RETURNCHAR \
yylval = (unsigned char) yytext[0]; \
@@ -79,20 +68,18 @@ extern const char *escaped_qstart, *escaped_qend;
#define RETURNNAME \
if(yyleng < MAXLINE) \
{ \
strncpy( nmstr, yytext, sizeof(nmstr) ); \
return NAME; \
strcpy( nmstr, yytext ); \
} \
else \
do { \
{ \
synerr(_("Input line too long\n")); \
FLEX_EXIT(EXIT_FAILURE); \
} while (0)
} \
return NAME;
#define PUT_BACK_STRING(str, start) \
{ size_t i = strlen( str ); \
while ( i > start ) \
unput((str)[--i]); \
}
for ( i = strlen( str ) - 1; i >= start; --i ) \
unput((str)[i])
#define CHECK_REJECT(str) \
if ( all_upper( str ) ) \
@@ -106,23 +93,6 @@ extern const char *escaped_qstart, *escaped_qend;
if ( getenv("POSIXLY_CORRECT") ) \
posix_compat = true;
#define START_CODEBLOCK(x) do { \
/* Emit the needed line directive... */\
if (indented_code == false) { \
linenum++; \
line_directive_out(NULL, 1); \
} \
add_action(M4QSTART); \
yy_push_state(CODEBLOCK); \
if ((indented_code = x)) ACTION_ECHO; \
} while(0)
#define END_CODEBLOCK do { \
yy_pop_state();\
add_action(M4QEND); \
if (!indented_code) line_directive_out(NULL, 0);\
} while (0)
%}
%option caseless nodefault noreject stack noyy_top_state
@@ -134,9 +104,7 @@ extern const char *escaped_qstart, *escaped_qend;
%x GROUP_WITH_PARAMS
%x GROUP_MINUS_PARAMS
%x EXTENDED_COMMENT
%x COMMENT_DISCARD CODE_COMMENT
%x SECT3_NOESCAPE
%x CHARACTER_CONSTANT
%x COMMENT_DISCARD
WS [[:blank:]]+
OPTWS [[:blank:]]*
@@ -157,8 +125,8 @@ CCL_EXPR ("[:"^?[[:alpha:]]+":]")
LEXOPT [aceknopr]
M4QSTART "[""["
M4QEND "]""]"
M4QSTART "[["
M4QEND "]]"
%%
static int bracelevel, didadef, indented_code;
@@ -166,17 +134,22 @@ M4QEND "]""]"
static int option_sense;
int doing_codeblock = false;
int brace_depth=0, brace_start_line=0;
char nmdef[MAXLINE];
int i, brace_depth=0, brace_start_line=0;
Char nmdef[MAXLINE];
<INITIAL>{
^{WS} START_CODEBLOCK(true);
^"/*" add_action("/*[""["); yy_push_state( COMMENT );
^{WS} indented_code = true; BEGIN(CODEBLOCK);
^"/*" ACTION_ECHO; yy_push_state( COMMENT );
^#{OPTWS}line{WS} yy_push_state( LINEDIR );
^"%s"{NAME}? return SCDECL;
^"%x"{NAME}? return XSCDECL;
^"%{".*{NL} START_CODEBLOCK(false);
^"%{".*{NL} {
++linenum;
line_directive_out( (FILE *) 0, 1 );
indented_code = false;
BEGIN(CODEBLOCK);
}
^"%top"[[:blank:]]*"{"[[:blank:]]*{NL} {
brace_start_line = linenum;
++linenum;
@@ -193,7 +166,7 @@ M4QEND "]""]"
sectnum = 2;
bracelevel = 0;
mark_defs1();
line_directive_out(NULL, 1);
line_directive_out( (FILE *) 0, 1 );
BEGIN(SECT2PROLOG);
return SECTEND;
}
@@ -201,7 +174,7 @@ M4QEND "]""]"
^"%pointer".*{NL} yytext_is_array = false; ++linenum;
^"%array".*{NL} yytext_is_array = true; ++linenum;
^"%option" BEGIN(OPTION); return TOK_OPTION;
^"%option" BEGIN(OPTION); return OPTION_OP;
^"%"{LEXOPT}{OPTWS}[[:digit:]]*{OPTWS}{NL} ++linenum; /* ignore */
^"%"{LEXOPT}{WS}.*{NL} ++linenum; /* ignore */
@@ -212,7 +185,7 @@ M4QEND "]""]"
^{NAME} {
if(yyleng < MAXLINE)
{
strncpy( nmstr, yytext, sizeof(nmstr) );
strcpy( nmstr, yytext );
}
else
{
@@ -230,17 +203,13 @@ M4QEND "]""]"
}
<COMMENT,CODE_COMMENT>{ /* */
[^\[\]\*\n]* ACTION_ECHO;
. ACTION_ECHO;
{NL} ++linenum; ACTION_ECHO;
}
<COMMENT>{
"*/" add_action("*/]""]"); yy_pop_state();
}
<CODE_COMMENT>{
"*/" ACTION_ECHO; yy_pop_state();
"*/" ACTION_ECHO; yy_pop_state();
"*" ACTION_ECHO;
{M4QSTART} ACTION_ECHO_QSTART;
{M4QEND} ACTION_ECHO_QEND;
[^*\n] ACTION_ECHO;
{NL} ++linenum; ACTION_ECHO;
}
<COMMENT_DISCARD>{
@@ -254,33 +223,33 @@ M4QEND "]""]"
<EXTENDED_COMMENT>{
")" yy_pop_state();
[^\n\)]+ ;
{NL} ++linenum;
{NL} ++linenum;
}
<LINEDIR>{
\n yy_pop_state();
[[:digit:]]+ linenum = myctoi( yytext );
"\""[^""\n]*"\"" {
free(infilename);
infilename = xstrdup(yytext + 1);
\"[^"\n]*\" {
flex_free( (void *) infilename );
infilename = copy_string( yytext + 1 );
infilename[strlen( infilename ) - 1] = '\0';
}
. /* ignore spurious characters */
}
<ACTION,CODEBLOCK,ACTION_STRING,PERCENT_BRACE_ACTION,CHARACTER_CONSTANT,COMMENT,CODE_COMMENT>{
{M4QSTART} ACTION_ECHO_QSTART;
{M4QEND} ACTION_ECHO_QEND;
}
<CODEBLOCK>{
^"%}".*{NL} ++linenum; END_CODEBLOCK;
[^\n%\[\]]* ACTION_ECHO;
. ACTION_ECHO;
^"%}".*{NL} ++linenum; BEGIN(INITIAL);
{M4QSTART} ACTION_ECHO_QSTART;
{M4QEND} ACTION_ECHO_QEND;
. ACTION_ECHO;
{NL} {
++linenum;
ACTION_ECHO;
if ( indented_code ) END_CODEBLOCK;
if ( indented_code )
BEGIN(INITIAL);
}
}
@@ -303,11 +272,12 @@ M4QEND "]""]"
buf_strnappend(&top_buf, yytext, yyleng);
}
{M4QSTART} buf_strnappend(&top_buf, escaped_qstart, (int) strlen(escaped_qstart));
{M4QEND} buf_strnappend(&top_buf, escaped_qend, (int) strlen(escaped_qend));
([^{}\r\n\[\]]+)|[^{}\r\n] {
buf_strnappend(&top_buf, yytext, yyleng);
}
{M4QSTART} buf_strnappend(&top_buf, escaped_qstart, strlen(escaped_qstart));
{M4QEND} buf_strnappend(&top_buf, escaped_qend, strlen(escaped_qend));
[^{}\r\n] {
buf_strnappend(&top_buf, yytext, yyleng);
}
<<EOF>> {
linenum = brace_start_line;
@@ -323,7 +293,7 @@ M4QEND "]""]"
{NOT_WS}[^\r\n]* {
if(yyleng < MAXLINE)
{
strncpy( nmdef, yytext, sizeof(nmdef) );
strcpy( (char *) nmdef, yytext );
}
else
{
@@ -331,12 +301,12 @@ M4QEND "]""]"
FLEX_EXIT(EXIT_FAILURE);
}
/* Skip trailing whitespace. */
{
size_t i = strlen( nmdef );
while (i > 0 && (nmdef[i-1] == ' ' || nmdef[i-1] == '\t'))
--i;
nmdef[i] = '\0';
}
for ( i = strlen( (char *) nmdef ) - 1;
i >= 0 && (nmdef[i] == ' ' || nmdef[i] == '\t');
--i )
;
nmdef[i + 1] = '\0';
ndinstal( nmstr, nmdef );
didadef = true;
@@ -368,6 +338,8 @@ M4QEND "]""]"
interactive = option_sense;
}
array yytext_is_array = option_sense;
ansi-definitions ansi_func_defs = option_sense;
ansi-prototypes ansi_func_protos = option_sense;
backup backing_up_report = option_sense;
batch interactive = ! option_sense;
bison-bridge bison_bridge_lval = option_sense;
@@ -377,6 +349,7 @@ 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;
@@ -392,7 +365,6 @@ M4QEND "]""]"
interactive interactive = option_sense;
lex-compat lex_compat = option_sense;
posix-compat posix_compat = option_sense;
line gen_line_dirs = option_sense;
main {
ACTION_M4_IFDEF( "M4""_YY_MAIN", option_sense);
/* Override yywrap */
@@ -438,8 +410,6 @@ M4QEND "]""]"
yyset_extra ACTION_M4_IFDEF("M4""_YY_NO_SET_EXTRA", ! option_sense);
yyget_leng ACTION_M4_IFDEF("M4""_YY_NO_GET_LENG", ! option_sense);
yyget_text ACTION_M4_IFDEF("M4""_YY_NO_GET_TEXT", ! option_sense);
yyget_column ACTION_M4_IFDEF("M4""_YY_NO_GET_COLUMN", ! option_sense);
yyset_column ACTION_M4_IFDEF("M4""_YY_NO_SET_COLUMN", ! option_sense);
yyget_lineno ACTION_M4_IFDEF("M4""_YY_NO_GET_LINENO", ! option_sense);
yyset_lineno ACTION_M4_IFDEF("M4""_YY_NO_SET_LINENO", ! option_sense);
yyget_in ACTION_M4_IFDEF("M4""_YY_NO_GET_IN", ! option_sense);
@@ -451,12 +421,14 @@ M4QEND "]""]"
yyget_lloc ACTION_M4_IFDEF("M4""_YY_NO_GET_LLOC", ! option_sense);
yyset_lloc ACTION_M4_IFDEF("M4""_YY_NO_SET_LLOC", ! option_sense);
extra-type return TOK_EXTRA_TYPE;
outfile return TOK_OUTFILE;
prefix return TOK_PREFIX;
yyclass return TOK_YYCLASS;
header(-file)? return TOK_HEADER_FILE;
tables-file return TOK_TABLES_FILE;
extra-type return OPT_EXTRA_TYPE;
outfile return OPT_OUTFILE;
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)
@@ -464,10 +436,10 @@ M4QEND "]""]"
}
"\""[^""\n]*"\"" {
\"[^"\n]*\" {
if(yyleng-1 < MAXLINE)
{
strncpy( nmstr, yytext + 1, sizeof(nmstr) );
strcpy( nmstr, yytext + 1 );
}
else
{
@@ -492,20 +464,19 @@ M4QEND "]""]"
^"%{".* ++bracelevel; yyless( 2 ); /* eat only %{ */
^"%}".* --bracelevel; yyless( 2 ); /* eat only %} */
^{WS} START_CODEBLOCK(true); /* indented code in prolog */
^{WS}.* ACTION_ECHO; /* indented code in prolog */
^{NOT_WS}.* {
/* non-indented code */
if ( bracelevel <= 0 ) {
/* not in %{ ... %} */
yyless( 0 ); /* put it all back */
yy_set_bol( 1 );
mark_prolog();
BEGIN(SECT2);
} else {
START_CODEBLOCK(true);
}
}
^{NOT_WS}.* { /* non-indented code */
if ( bracelevel <= 0 )
{ /* not in %{ ... %} */
yyless( 0 ); /* put it all back */
yy_set_bol( 1 );
mark_prolog();
BEGIN(SECT2);
}
else
ACTION_ECHO;
}
. ACTION_ECHO;
{NL} ++linenum; ACTION_ECHO;
@@ -534,7 +505,7 @@ M4QEND "]""]"
return '<';
}
^{OPTWS}"^" return '^';
"\"" BEGIN(QUOTE); return '"';
\" BEGIN(QUOTE); return '"';
"{"/[[:digit:]] {
BEGIN(NUM);
if ( lex_compat || posix_compat )
@@ -559,11 +530,11 @@ M4QEND "]""]"
if (sf_skip_ws()){
/* We're in the middle of a (?x: ) pattern. */
/* Push back everything starting at the "|" */
int amt = (int) (strchr (yytext, '|') - yytext);
size_t amt;
amt = strchr (yytext, '|') - yytext;
yyless(amt);
}
else {
add_action("]""]");
continued_action = true;
++linenum;
return '\n';
@@ -633,10 +604,9 @@ M4QEND "]""]"
^"%%".* {
sectnum = 3;
BEGIN(no_section3_escape ? SECT3_NOESCAPE : SECT3);
BEGIN(SECT3);
outn("/* Begin user sect3 */");
yyterminate(); /* to stop the parser */
}
"["({FIRST_CCL_CHAR}|{CCL_EXPR})({CCL_CHAR}|{CCL_EXPR})* {
@@ -644,7 +614,7 @@ M4QEND "]""]"
if(yyleng < MAXLINE)
{
strncpy( nmstr, yytext, sizeof(nmstr) );
strcpy( nmstr, yytext );
}
else
{
@@ -660,7 +630,7 @@ M4QEND "]""]"
* The reason it was disabled is so yacc/bison can parse
* ccl operations, such as ccl difference and union.
*/
&& (cclval = ccllookup( nmstr )) != 0 )
&& (cclval = ccllookup( (Char *) nmstr )) != 0 )
{
if ( input() != ']' )
synerr( _( "bad character class" ) );
@@ -674,7 +644,7 @@ M4QEND "]""]"
/* We fudge a bit. We know that this ccl will
* soon be numbered as lastccl + 1 by cclinit.
*/
cclinstal( nmstr, lastccl + 1 );
cclinstal( (Char *) nmstr, lastccl + 1 );
/* Push back everything but the leading bracket
* so the ccl can be rescanned.
@@ -694,7 +664,7 @@ M4QEND "]""]"
* context.
*/
"{"{NAME}"}"[[:space:]]? {
char *nmdefptr;
Char *nmdefptr;
int end_is_ws, end_ch;
end_ch = yytext[yyleng-1];
@@ -702,7 +672,7 @@ M4QEND "]""]"
if(yyleng-1 < MAXLINE)
{
strncpy( nmstr, yytext + 1, sizeof(nmstr) );
strcpy( nmstr, yytext + 1 );
}
else
{
@@ -718,7 +688,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
else
{ /* push back name surrounded by ()'s */
size_t len = strlen( nmdefptr );
int len = strlen( (char *) nmdefptr );
if (end_is_ws)
unput(end_ch);
@@ -726,7 +696,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
(len > 0 && nmdefptr[len - 1] == '$')
|| (end_is_ws && trlcontxt && !sf_skip_ws()))
{ /* don't use ()'s after all */
PUT_BACK_STRING(nmdefptr, 0);
PUT_BACK_STRING((char *) nmdefptr, 0);
if ( nmdefptr[0] == '^' )
BEGIN(CARETISBOL);
@@ -735,7 +705,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
else
{
unput(')');
PUT_BACK_STRING(nmdefptr, 0);
PUT_BACK_STRING((char *) nmdefptr, 0);
unput('(');
}
}
@@ -771,13 +741,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
return '(';
}
"(" sf_push(); return '(';
")" {
if (_sf_top_ix > 0) {
sf_pop();
return ')';
} else
synerr(_("unbalanced parenthesis"));
}
")" sf_pop(); return ')';
[/|*+?.(){}] return (unsigned char) yytext[0];
. RETURNCHAR;
@@ -800,8 +764,8 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
<QUOTE>{
[^""\n] RETURNCHAR;
"\"" BEGIN(SECT2); return '"';
[^"\n] RETURNCHAR;
\" BEGIN(SECT2); return '"';
{NL} {
synerr( _( "missing quote" ) );
@@ -909,31 +873,35 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
<PERCENT_BRACE_ACTION>{
{OPTWS}"%}".* bracelevel = 0;
<ACTION>"/*" ACTION_ECHO; yy_push_state( CODE_COMMENT );
<ACTION>"/*" ACTION_ECHO; yy_push_state( COMMENT );
<CODEBLOCK,ACTION>{
"reject" {
ACTION_ECHO;
CHECK_REJECT(yytext);
}
"yymore" {
ACTION_ECHO;
CHECK_YYMORE(yytext);
}
"reject" {
ACTION_ECHO;
CHECK_REJECT(yytext);
}
"yymore" {
ACTION_ECHO;
CHECK_YYMORE(yytext);
}
}
. ACTION_ECHO;
{NL} {
++linenum;
ACTION_ECHO;
if (bracelevel <= 0 || (doing_codeblock && indented_code)) {
if ( doing_rule_action )
add_action( "\tYY_BREAK]""]\n" );
{M4QSTART} ACTION_ECHO_QSTART;
{M4QEND} ACTION_ECHO_QEND;
. ACTION_ECHO;
{NL} {
++linenum;
ACTION_ECHO;
if ( bracelevel == 0 ||
(doing_codeblock && indented_code) )
{
if ( doing_rule_action )
add_action( "\tYY_BREAK\n" );
doing_rule_action = doing_codeblock = false;
BEGIN(SECT2);
}
}
doing_rule_action = doing_codeblock = false;
BEGIN(SECT2);
}
}
}
@@ -941,41 +909,37 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
<ACTION>{
"{" ACTION_ECHO; ++bracelevel;
"}" ACTION_ECHO; --bracelevel;
[^[:alpha:]_{}""''/\n\[\]]+ ACTION_ECHO;
{NAME} ACTION_ECHO;
"'"([^''\\\n]|\\.)"'" ACTION_ECHO; /* character constant */
"'" ACTION_ECHO; BEGIN(CHARACTER_CONSTANT);
"\"" ACTION_ECHO; BEGIN(ACTION_STRING);
{NL} {
++linenum;
ACTION_ECHO;
if (bracelevel <= 0) {
if ( doing_rule_action )
add_action( "\tYY_BREAK]""]\n" );
{M4QSTART} ACTION_ECHO_QSTART;
{M4QEND} ACTION_ECHO_QEND;
[^[:alpha:]_{}"'/\n\[\]]+ ACTION_ECHO;
[\[\]] ACTION_ECHO;
{NAME} ACTION_ECHO;
"'"([^'\\\n]|\\.)*"'" ACTION_ECHO; /* character constant */
\" ACTION_ECHO; BEGIN(ACTION_STRING);
{NL} {
++linenum;
ACTION_ECHO;
if ( bracelevel == 0 )
{
if ( doing_rule_action )
add_action( "\tYY_BREAK\n" );
doing_rule_action = false;
BEGIN(SECT2);
}
}
. ACTION_ECHO;
doing_rule_action = false;
BEGIN(SECT2);
}
}
. ACTION_ECHO;
}
<ACTION_STRING>{
[^\[\]""\\\n]+ ACTION_ECHO;
"\"" ACTION_ECHO; BEGIN(ACTION);
}
<CHARACTER_CONSTANT>{
[^\[\]''\\\n]+ ACTION_ECHO;
"'" ACTION_ECHO; BEGIN(ACTION);
}
<ACTION_STRING,CHARACTER_CONSTANT>{
(\\\n)* ACTION_ECHO;
\\(\\\n)*. ACTION_ECHO;
{NL} ++linenum; ACTION_ECHO; if (bracelevel <= 0) { BEGIN(SECT2); } else { BEGIN(ACTION); }
. ACTION_ECHO;
[^"\\\n]+ ACTION_ECHO;
\\. ACTION_ECHO;
{NL} ++linenum; ACTION_ECHO; BEGIN(ACTION);
\" ACTION_ECHO; BEGIN(ACTION);
. ACTION_ECHO;
}
<COMMENT,CODE_COMMENT,COMMENT_DISCARD,ACTION,ACTION_STRING,CHARACTER_CONSTANT><<EOF>> {
<COMMENT,COMMENT_DISCARD,ACTION,ACTION_STRING><<EOF>> {
synerr( _( "EOF encountered inside an action" ) );
yyterminate();
}
@@ -986,7 +950,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
}
<SECT2,QUOTE,FIRSTCCL,CCL>{ESCSEQ} {
yylval = myesc( (unsigned char *) yytext );
yylval = myesc( (Char *) yytext );
if ( YY_START == FIRSTCCL )
BEGIN(CCL);
@@ -994,32 +958,21 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
return CHAR;
}
<SECT3>{
{M4QSTART} fputs(escaped_qstart, yyout);
{M4QEND} fputs(escaped_qend, yyout);
[^\[\]]* ECHO;
[][] ECHO;
<<EOF>> {
sectnum = 0;
yyterminate();
}
}
<SECT3_NOESCAPE>{
{M4QSTART} fprintf(yyout, "[""[%s]""]", escaped_qstart);
{M4QEND} fprintf(yyout, "[""[%s]""]", escaped_qend);
[^][]* ECHO;
[][] ECHO;
<<EOF>> {
sectnum = 0;
yyterminate();
}
{M4QSTART} fwrite (escaped_qstart, 1, strlen(escaped_qstart), yyout);
{M4QEND} fwrite (escaped_qend, 1, strlen(escaped_qend), yyout);
[^\[\]\n]*(\n?) ECHO;
(.|\n) ECHO;
<<EOF>> sectnum = 0; yyterminate();
}
<*>.|\n format_synerr( _( "bad character: %s" ), yytext );
%%
int yywrap(void)
int yywrap()
{
if ( --num_input_files > 0 )
{
@@ -1034,11 +987,12 @@ int yywrap(void)
/* set_input_file - open the given file (if NULL, stdin) for scanning */
void set_input_file( char *file )
void set_input_file( file )
char *file;
{
if ( file && strcmp( file, "-" ) )
{
infilename = xstrdup(file);
infilename = copy_string( file );
yyin = fopen( infilename, "r" );
if ( yyin == NULL )
@@ -1048,8 +1002,31 @@ void set_input_file( char *file )
else
{
yyin = stdin;
infilename = xstrdup("<stdin>");
infilename = copy_string( "<stdin>" );
}
linenum = 1;
}
/* Wrapper routines for accessing the scanner's malloc routines. */
void *flex_alloc( size )
size_t size;
{
return (void *) malloc( size );
}
void *flex_realloc( ptr, size )
void *ptr;
size_t size;
{
return (void *) realloc( ptr, size );
}
void flex_free( ptr )
void *ptr;
{
if ( ptr )
free( ptr );
}
+3 -6
View File
@@ -39,10 +39,8 @@ size_t _sf_top_ix=0, _sf_max=0;
void
sf_push (void)
{
if (_sf_top_ix + 1 >= _sf_max) {
_sf_max += 32;
_sf_stk = realloc(_sf_stk, sizeof(scanflags_t) * _sf_max);
}
if (_sf_top_ix + 1 >= _sf_max)
_sf_stk = (scanflags_t*) flex_realloc ( (void*) _sf_stk, sizeof(scanflags_t) * (_sf_max += 32));
// copy the top element
_sf_stk[_sf_top_ix + 1] = _sf_stk[_sf_top_ix];
@@ -61,8 +59,7 @@ void
sf_init (void)
{
assert(_sf_stk == NULL);
_sf_max = 32;
_sf_stk = malloc(sizeof(scanflags_t) * _sf_max);
_sf_stk = (scanflags_t*) flex_alloc ( sizeof(scanflags_t) * (_sf_max = 32));
if (!_sf_stk)
lerr_fatal(_("Unable to allocate %zu of stack"), sizeof(scanflags_t));
_sf_stk[_sf_top_ix] = 0;
+168 -77
View File
@@ -37,6 +37,20 @@
/* Internal structures */
#ifdef HAVE_STRCASECMP
#define STRCASECMP(a,b) strcasecmp(a,b)
#else
static int STRCASECMP PROTO ((const char *, const char *));
static int STRCASECMP (a, b)
const char *a;
const char *b;
{
while (tolower ((unsigned char)*a++) == tolower ((unsigned char)*b++)) ;
return b - a;
}
#endif
#define ARG_NONE 0x01
#define ARG_REQ 0x02
#define ARG_OPT 0x04
@@ -63,45 +77,56 @@ struct _scanopt_t {
};
/* Accessor functions. These WOULD be one-liners, but portability calls. */
static const char *NAME(struct _scanopt_t *, int);
static int PRINTLEN(struct _scanopt_t *, int);
static int RVAL(struct _scanopt_t *, int);
static int FLAGS(struct _scanopt_t *, int);
static const char *DESC(struct _scanopt_t *, int);
static void scanopt_err(struct _scanopt_t *, int, int);
static int matchlongopt(char *, char **, int *, char **, int *);
static int find_opt(struct _scanopt_t *, int, char *, int, int *, int *opt_offset);
static const char *NAME PROTO ((struct _scanopt_t *, int));
static int PRINTLEN PROTO ((struct _scanopt_t *, int));
static int RVAL PROTO ((struct _scanopt_t *, int));
static int FLAGS PROTO ((struct _scanopt_t *, int));
static const char *DESC PROTO ((struct _scanopt_t *, int));
static int scanopt_err PROTO ((struct _scanopt_t *, int, int));
static int matchlongopt PROTO ((char *, char **, int *, char **, int *));
static int find_opt
PROTO ((struct _scanopt_t *, int, char *, int, int *, int *opt_offset));
static const char *NAME (struct _scanopt_t *s, int i)
static const char *NAME (s, i)
struct _scanopt_t *s;
int i;
{
return s->options[i].opt_fmt +
((s->aux[i].flags & IS_LONG) ? 2 : 1);
}
static int PRINTLEN (struct _scanopt_t *s, int i)
static int PRINTLEN (s, i)
struct _scanopt_t *s;
int i;
{
return s->aux[i].printlen;
}
static int RVAL (struct _scanopt_t *s, int i)
static int RVAL (s, i)
struct _scanopt_t *s;
int i;
{
return s->options[i].r_val;
}
static int FLAGS (struct _scanopt_t *s, int i)
static int FLAGS (s, i)
struct _scanopt_t *s;
int i;
{
return s->aux[i].flags;
}
static const char *DESC (struct _scanopt_t *s, int i)
static const char *DESC (s, i)
struct _scanopt_t *s;
int i;
{
return s->options[i].desc ? s->options[i].desc : "";
}
#ifndef NO_SCANOPT_USAGE
static int get_cols (void);
static int get_cols PROTO ((void));
static int get_cols (void)
static int get_cols ()
{
char *env;
int cols = 80; /* default */
@@ -134,11 +159,15 @@ static int get_cols (void)
(s)->subscript= 0; \
}while(0)
scanopt_t *scanopt_init (const optspec_t *options, int argc, char **argv, int flags)
scanopt_t *scanopt_init (options, argc, argv, flags)
const optspec_t *options;
int argc;
char **argv;
int flags;
{
int i;
struct _scanopt_t *s;
s = malloc(sizeof (struct _scanopt_t));
s = (struct _scanopt_t *) malloc (sizeof (struct _scanopt_t));
s->options = options;
s->optc = 0;
@@ -157,10 +186,10 @@ scanopt_t *scanopt_init (const optspec_t *options, int argc, char **argv, int fl
s->optc++;
/* Build auxiliary data */
s->aux = malloc((size_t) s->optc * sizeof (struct _aux));
s->aux = (struct _aux *) malloc (s->optc * sizeof (struct _aux));
for (i = 0; i < s->optc; i++) {
const unsigned char *p, *pname;
const Char *p, *pname;
const struct optspec_t *opt;
struct _aux *aux;
@@ -171,14 +200,14 @@ scanopt_t *scanopt_init (const optspec_t *options, int argc, char **argv, int fl
if (opt->opt_fmt[0] == '-' && opt->opt_fmt[1] == '-') {
aux->flags |= IS_LONG;
pname = (const unsigned char *)(opt->opt_fmt + 2);
pname = (const Char *)(opt->opt_fmt + 2);
s->has_long = 1;
}
else {
pname = (const unsigned char *)(opt->opt_fmt + 1);
pname = (const Char *)(opt->opt_fmt + 1);
s->has_short = 1;
}
aux->printlen = (int) strlen (opt->opt_fmt);
aux->printlen = strlen (opt->opt_fmt);
aux->namelen = 0;
for (p = pname + 1; *p; p++) {
@@ -186,21 +215,21 @@ scanopt_t *scanopt_init (const optspec_t *options, int argc, char **argv, int fl
if (*p == '=' || isspace ((unsigned char)*p)
|| !(aux->flags & IS_LONG)) {
if (aux->namelen == 0)
aux->namelen = (int) (p - pname);
aux->namelen = p - pname;
aux->flags |= ARG_REQ;
aux->flags &= ~ARG_NONE;
}
/* detect optional arg. This overrides required arg. */
if (*p == '[') {
if (aux->namelen == 0)
aux->namelen = (int) (p - pname);
aux->namelen = p - pname;
aux->flags &= ~(ARG_REQ | ARG_NONE);
aux->flags |= ARG_OPT;
break;
}
}
if (aux->namelen == 0)
aux->namelen = (int) (p - pname);
aux->namelen = p - pname;
}
return (scanopt_t *) s;
}
@@ -226,31 +255,45 @@ typedef struct usg_elem usg_elem;
[indent][option, alias1, alias2...][indent][description line1
description line2...]
*/
int scanopt_usage (scanopt_t *scanner, FILE *fp, const char *usage)
int scanopt_usage (scanner, fp, usage)
scanopt_t *scanner;
FILE *fp;
const char *usage;
{
struct _scanopt_t *s;
int i, columns;
const int indent = 2;
int i, columns, indent = 2;
usg_elem *byr_val = NULL; /* option indices sorted by r_val */
usg_elem *store; /* array of preallocated elements. */
int store_idx = 0;
usg_elem *ue;
int opt_col_width = 0, desc_col_width = 0;
int desccol;
int maxlen[2];
int desccol = 0;
int print_run = 0;
maxlen[0] = 0;
maxlen[1] = 0;
s = (struct _scanopt_t *) scanner;
if (usage) {
fprintf (fp, "%s\n", usage);
}
else {
fprintf (fp, _("Usage: %s [OPTIONS]...\n"), s->argv[0]);
/* Find the basename of argv[0] */
const char *p;
p = s->argv[0] + strlen (s->argv[0]);
while (p != s->argv[0] && *p != '/')
--p;
if (*p == '/')
p++;
fprintf (fp, _("Usage: %s [OPTIONS]...\n"), p);
}
fprintf (fp, "\n");
/* Sort by r_val and string. Yes, this is O(n*n), but n is small. */
store = malloc((size_t) s->optc * sizeof (usg_elem));
store = (usg_elem *) malloc (s->optc * sizeof (usg_elem));
for (i = 0; i < s->optc; i++) {
/* grab the next preallocate node. */
@@ -276,7 +319,7 @@ int scanopt_usage (scanopt_t *scanner, FILE *fp, const char *usage)
}
if (!ptr_if_no_alias
&&
strcasecmp (NAME (s, (*ue_curr)->idx),
STRCASECMP (NAME (s, (*ue_curr)->idx),
NAME (s, ue->idx)) > 0) {
ptr_if_no_alias = ue_curr;
}
@@ -313,36 +356,65 @@ int scanopt_usage (scanopt_t *scanner, FILE *fp, const char *usage)
/* first pass calculate how much room we need. */
for (ue = byr_val; ue; ue = ue->next) {
usg_elem *ap;
int len;
int len = 0;
int nshort = 0, nlong = 0;
len = PRINTLEN(s, ue->idx);
#define CALC_LEN(i) do {\
if(FLAGS(s,i) & IS_LONG) \
len += (nlong++||nshort) ? 2+PRINTLEN(s,i) : PRINTLEN(s,i);\
else\
len += (nshort++||nlong)? 2+PRINTLEN(s,i) : PRINTLEN(s,i);\
}while(0)
if (!(FLAGS (s, ue->idx) & IS_LONG))
CALC_LEN (ue->idx);
/* do short aliases first. */
for (ap = ue->alias; ap; ap = ap->next) {
len += PRINTLEN(s, ap->idx) + (int) strlen(", ");
if (FLAGS (s, ap->idx) & IS_LONG)
continue;
CALC_LEN (ap->idx);
}
if (len > opt_col_width)
opt_col_width = len;
if (FLAGS (s, ue->idx) & IS_LONG)
CALC_LEN (ue->idx);
/* repeat the above loop, this time for long aliases. */
for (ap = ue->alias; ap; ap = ap->next) {
if (!(FLAGS (s, ap->idx) & IS_LONG))
continue;
CALC_LEN (ap->idx);
}
if (len > maxlen[0])
maxlen[0] = len;
/* It's much easier to calculate length for description column! */
len = (int) strlen (DESC (s, ue->idx));
if (len > desc_col_width)
desc_col_width = len;
len = strlen (DESC (s, ue->idx));
if (len > maxlen[1])
maxlen[1] = len;
}
/* Determine how much room we have, and how much we will allocate to each col.
* Do not address pathological cases. Output will just be ugly. */
columns = get_cols () - 1;
if (opt_col_width + desc_col_width + indent * 2 > columns) {
/* opt col gets whatever it wants. we'll wrap the desc col. */
desc_col_width = columns - (opt_col_width + indent * 2);
if (desc_col_width < 14) /* 14 is arbitrary lower limit on desc width. */
desc_col_width = INT_MAX;
if (maxlen[0] + maxlen[1] + indent * 2 > columns) {
/* col 0 gets whatever it wants. we'll wrap the desc col. */
maxlen[1] = columns - (maxlen[0] + indent * 2);
if (maxlen[1] < 14) /* 14 is arbitrary lower limit on desc width. */
maxlen[1] = INT_MAX;
}
desccol = opt_col_width + indent * 2;
desccol = maxlen[0] + indent * 2;
#define PRINT_SPACES(fp,n)\
do{\
int _n;\
_n=(n);\
while(_n-- > 0)\
fputc(' ',(fp));\
}while(0)
#define PRINT_SPACES(fp,n) \
fprintf((fp), "%*s", (n), "")
/* Second pass (same as above loop), this time we print. */
/* Sloppy hack: We iterate twice. The first time we print short and long options.
@@ -396,7 +468,7 @@ int scanopt_usage (scanopt_t *scanner, FILE *fp, const char *usage)
/* pad to desccol */
PRINT_SPACES (fp, desccol - nchars);
/* Print description, wrapped to desc_col_width columns. */
/* Print description, wrapped to maxlen[1] columns. */
if (1) {
const char *pstart;
@@ -407,7 +479,7 @@ int scanopt_usage (scanopt_t *scanner, FILE *fp, const char *usage)
p = pstart;
while (*p && n < desc_col_width
while (*p && n < maxlen[1]
&& *p != '\n') {
if (isspace ((unsigned char)(*p))
|| *p == '-') lastws =
@@ -457,7 +529,10 @@ int scanopt_usage (scanopt_t *scanner, FILE *fp, const char *usage)
#endif /* no scanopt_usage */
static void scanopt_err(struct _scanopt_t *s, int is_short, int err)
static int scanopt_err (s, is_short, err)
struct _scanopt_t *s;
int is_short;
int err;
{
const char *optname = "";
char optchar[2];
@@ -502,6 +577,7 @@ static void scanopt_err(struct _scanopt_t *s, int is_short, int err)
break;
}
}
return err;
}
@@ -511,11 +587,16 @@ static void scanopt_err(struct _scanopt_t *s, int is_short, int err)
* optname will point to str + 2
*
*/
static int matchlongopt (char *str, char **optname, int *optlen, char **arg, int *arglen)
static int matchlongopt (str, optname, optlen, arg, arglen)
char *str;
char **optname;
int *optlen;
char **arg;
int *arglen;
{
char *p;
*optname = *arg = NULL;
*optname = *arg = (char *) 0;
*optlen = *arglen = 0;
/* Match regex /--./ */
@@ -524,13 +605,13 @@ static int matchlongopt (char *str, char **optname, int *optlen, char **arg, int
return 0;
p += 2;
*optname = p;
*optname = (char *) p;
/* find the end of optname */
while (*p && *p != '=')
++p;
*optlen = (int) (p - *optname);
*optlen = p - *optname;
if (!*p)
/* an option with no '=...' part. */
@@ -542,7 +623,7 @@ static int matchlongopt (char *str, char **optname, int *optlen, char **arg, int
*arg = p;
while (*p)
++p;
*arglen = (int) (p - *arg);
*arglen = p - *arg;
return 1;
}
@@ -553,8 +634,13 @@ static int matchlongopt (char *str, char **optname, int *optlen, char **arg, int
* Short options must be exact.
* Return boolean true if found and no error.
* Error stored in err_code or zero if no error. */
static int find_opt (struct _scanopt_t *s, int lookup_long, char *optstart, int
len, int *err_code, int *opt_offset)
static int find_opt (s, lookup_long, optstart, len, err_code, opt_offset)
struct _scanopt_t *s;
int lookup_long;
char *optstart;
int len;
int *err_code;
int *opt_offset;
{
int nmatch = 0, lastr_val = 0, i;
@@ -565,15 +651,17 @@ static int find_opt (struct _scanopt_t *s, int lookup_long, char *optstart, int
return 0;
for (i = 0; i < s->optc; i++) {
const char *optname;
char *optname;
optname = s->options[i].opt_fmt + (lookup_long ? 2 : 1);
optname =
(char *) (s->options[i].opt_fmt +
(lookup_long ? 2 : 1));
if (lookup_long && (s->aux[i].flags & IS_LONG)) {
if (len > s->aux[i].namelen)
continue;
if (strncmp (optname, optstart, (size_t) len) == 0) {
if (strncmp (optname, optstart, len) == 0) {
nmatch++;
*opt_offset = i;
@@ -611,7 +699,10 @@ static int find_opt (struct _scanopt_t *s, int lookup_long, char *optstart, int
}
int scanopt (scanopt_t *svoid, char **arg, int *optindex)
int scanopt (svoid, arg, optindex)
scanopt_t *svoid;
char **arg;
int *optindex;
{
char *optname = NULL, *optarg = NULL, *pstart;
int namelen = 0, arglen = 0;
@@ -688,8 +779,7 @@ int scanopt (scanopt_t *svoid, char **arg, int *optindex)
if (!find_opt
(s, 0, pstart, namelen, &errcode, &opt_offset)) {
scanopt_err(s, 1, errcode);
return errcode;
return scanopt_err (s, 1, errcode);
}
optarg = pstart + 1;
@@ -698,7 +788,7 @@ int scanopt (scanopt_t *svoid, char **arg, int *optindex)
arglen = 0;
}
else
arglen = (int) strlen (optarg);
arglen = strlen (optarg);
}
/* At this point, we have a long or short option matched at opt_offset into
@@ -708,7 +798,8 @@ int scanopt (scanopt_t *svoid, char **arg, int *optindex)
/* Look ahead in argv[] to see if there is something
* that we can use as an argument (if needed). */
has_next = s->index + 1 < s->argc;
has_next = s->index + 1 < s->argc
&& strcmp ("--", s->argv[s->index + 1]) != 0;
optp = s->options + opt_offset;
auxp = s->aux + opt_offset;
@@ -716,9 +807,9 @@ int scanopt (scanopt_t *svoid, char **arg, int *optindex)
/* case: no args allowed */
if (auxp->flags & ARG_NONE) {
if (optarg && !is_short) {
scanopt_err(s, is_short, SCANOPT_ERR_ARG_NOT_ALLOWED);
scanopt_err (s, is_short, errcode = SCANOPT_ERR_ARG_NOT_ALLOWED);
INC_INDEX (s, 1);
return SCANOPT_ERR_ARG_NOT_ALLOWED;
return errcode;
}
else if (!optarg)
INC_INDEX (s, 1);
@@ -729,10 +820,8 @@ int scanopt (scanopt_t *svoid, char **arg, int *optindex)
/* case: required */
if (auxp->flags & ARG_REQ) {
if (!optarg && !has_next) {
scanopt_err(s, is_short, SCANOPT_ERR_ARG_NOT_FOUND);
return SCANOPT_ERR_ARG_NOT_FOUND;
}
if (!optarg && !has_next)
return scanopt_err (s, is_short, SCANOPT_ERR_ARG_NOT_FOUND);
if (!optarg) {
/* Let the next argv element become the argument. */
@@ -759,14 +848,16 @@ int scanopt (scanopt_t *svoid, char **arg, int *optindex)
}
int scanopt_destroy (scanopt_t *svoid)
int scanopt_destroy (svoid)
scanopt_t *svoid;
{
struct _scanopt_t *s;
s = (struct _scanopt_t *) svoid;
if (s != NULL) {
free(s->aux);
free(s);
if (s) {
if (s->aux)
free (s->aux);
free (s);
}
return 0;
}
+14 -5
View File
@@ -47,6 +47,9 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifndef PROTO
#define PROTO(args) args
#endif
/* Error codes. */ enum scanopt_err_t {
SCANOPT_ERR_OPT_UNRECOGNIZED = -1, /* Unrecognized option. */
SCANOPT_ERR_OPT_AMBIGUOUS = -2, /* It matched more than one option name. */
@@ -82,12 +85,12 @@ extern "C" {
* flags - Control behavior.
* Return: A malloc'd pointer .
*/
scanopt_t *scanopt_init (const optspec_t * options, int argc,
char **argv, int flags);
scanopt_t *scanopt_init PROTO ((const optspec_t * options,
int argc, char **argv, int flags));
/* Frees memory used by scanner.
* Always returns 0. */
int scanopt_destroy (scanopt_t * scanner);
int scanopt_destroy PROTO ((scanopt_t * scanner));
#ifndef NO_SCANOPT_USAGE
/* Prints a usage message based on contents of optlist.
@@ -97,7 +100,10 @@ extern "C" {
* usage - Text to be prepended to option list. May be NULL.
* Return: Always returns 0 (zero).
*/
int scanopt_usage (scanopt_t * scanner, FILE * fp, const char *usage);
int scanopt_usage
PROTO (
(scanopt_t * scanner, FILE * fp,
const char *usage));
#endif
/* Scans command-line options in argv[].
@@ -114,7 +120,10 @@ extern "C" {
* < 0 on error (return value is an error code).
*
*/
int scanopt (scanopt_t * scanner, char **optarg, int *optindex);
int scanopt
PROTO (
(scanopt_t * scanner, char **optarg,
int *optindex));
#ifdef __cplusplus
}
+46 -23
View File
@@ -59,10 +59,12 @@ static struct hash_entry *ccltab[CCL_HASH_SIZE];
/* declare functions that have forward references */
static int addsym(char[], char *, int, hash_table, int);
static struct hash_entry *findsym (const char *sym, hash_table table,
int table_size);
static int hashfunct(const char *, int);
static int addsym PROTO ((char[], char *, int, hash_table, int));
static struct hash_entry *findsym PROTO ((const char *sym,
hash_table table,
int table_size));
static int hashfunct PROTO ((const char *, int));
/* addsym - add symbol and definitions to symbol table
@@ -70,7 +72,12 @@ static int hashfunct(const char *, int);
* -1 is returned if the symbol already exists, and the change not made.
*/
static int addsym (char sym[], char *str_def, int int_def, hash_table table, int table_size)
static int addsym (sym, str_def, int_def, table, table_size)
char sym[];
char *str_def;
int int_def;
hash_table table;
int table_size;
{
int hash_val = hashfunct (sym, table_size);
struct hash_entry *sym_entry = table[hash_val];
@@ -86,7 +93,8 @@ static int addsym (char sym[], char *str_def, int int_def, hash_table table, int
}
/* create new entry */
new_entry = malloc(sizeof(struct hash_entry));
new_entry = (struct hash_entry *)
flex_alloc (sizeof (struct hash_entry));
if (new_entry == NULL)
flexfatal (_("symbol table memory allocation failed"));
@@ -111,13 +119,15 @@ static int addsym (char sym[], char *str_def, int int_def, hash_table table, int
/* cclinstal - save the text of a character class */
void cclinstal (char ccltxt[], int cclnum)
void cclinstal (ccltxt, cclnum)
Char ccltxt[];
int cclnum;
{
/* We don't bother checking the return status because we are not
* called unless the symbol is new.
*/
(void) addsym (xstrdup(ccltxt),
(void) addsym ((char *) copy_unsigned_string (ccltxt),
(char *) 0, cclnum, ccltab, CCL_HASH_SIZE);
}
@@ -127,18 +137,23 @@ void cclinstal (char ccltxt[], int cclnum)
* Returns 0 if there's no CCL associated with the text.
*/
int ccllookup (char ccltxt[])
int ccllookup (ccltxt)
Char ccltxt[];
{
return findsym (ccltxt, ccltab, CCL_HASH_SIZE)->int_val;
return findsym ((char *) ccltxt, ccltab, CCL_HASH_SIZE)->int_val;
}
/* findsym - find symbol in symbol table */
static struct hash_entry *findsym (const char *sym, hash_table table, int table_size)
static struct hash_entry *findsym (sym, table, table_size)
const char *sym;
hash_table table;
int table_size;
{
static struct hash_entry empty_entry = {
NULL, NULL, NULL, NULL, 0,
(struct hash_entry *) 0, (struct hash_entry *) 0,
(char *) 0, (char *) 0, 0,
};
struct hash_entry *sym_entry =
@@ -155,7 +170,9 @@ static struct hash_entry *findsym (const char *sym, hash_table table, int table_
/* hashfunct - compute the hash value for "str" and hash size "hash_size" */
static int hashfunct (const char *str, int hash_size)
static int hashfunct (str, hash_size)
const char *str;
int hash_size;
{
int hashval;
int locstr;
@@ -174,11 +191,13 @@ static int hashfunct (const char *str, int hash_size)
/* ndinstal - install a name definition */
void ndinstal (const char *name, char definition[])
void ndinstal (name, definition)
const char *name;
Char definition[];
{
if (addsym (xstrdup(name),
xstrdup(definition), 0,
if (addsym (copy_string (name),
(char *) copy_unsigned_string (definition), 0,
ndtbl, NAME_TABLE_HASH_SIZE))
synerr (_("name defined twice"));
}
@@ -189,15 +208,16 @@ void ndinstal (const char *name, char definition[])
* Returns a nil pointer if the name definition does not exist.
*/
char *ndlookup (const char *nd)
Char *ndlookup (nd)
const char *nd;
{
return findsym (nd, ndtbl, NAME_TABLE_HASH_SIZE)->str_val;
return (Char *) findsym (nd, ndtbl, NAME_TABLE_HASH_SIZE)->str_val;
}
/* scextend - increase the maximum number of start conditions */
void scextend (void)
void scextend ()
{
current_max_scs += MAX_SCS_INCREMENT;
@@ -217,15 +237,17 @@ void scextend (void)
* The start condition is "exclusive" if xcluflg is true.
*/
void scinstal (const char *str, int xcluflg)
void scinstal (str, xcluflg)
const char *str;
int xcluflg;
{
if (++lastsc >= current_max_scs)
scextend ();
scname[lastsc] = xstrdup(str);
scname[lastsc] = copy_string (str);
if (addsym(scname[lastsc], NULL, lastsc,
if (addsym (scname[lastsc], (char *) 0, lastsc,
sctbl, START_COND_HASH_SIZE))
format_pinpoint_message (_
("start condition %s declared twice"),
@@ -243,7 +265,8 @@ str);
* Returns 0 if no such start condition.
*/
int sclookup (const char *str)
int sclookup (str)
const char *str;
{
return findsym (str, sctbl, START_COND_HASH_SIZE)->int_val;
}
+37 -37
View File
@@ -55,7 +55,7 @@
int yytbl_write32 (struct yytbl_writer *wr, flex_uint32_t v);
int yytbl_write16 (struct yytbl_writer *wr, flex_uint16_t v);
int yytbl_write8 (struct yytbl_writer *wr, flex_uint8_t v);
int yytbl_writen (struct yytbl_writer *wr, void *v, int len);
int yytbl_writen (struct yytbl_writer *wr, void *v, flex_int32_t len);
static flex_int32_t yytbl_data_geti (const struct yytbl_data *tbl, int i);
/* XXX Not used
static flex_int32_t yytbl_data_getijk (const struct yytbl_data *tbl, int i,
@@ -86,12 +86,12 @@ int yytbl_hdr_init (struct yytbl_hdr *th, const char *version_str,
memset (th, 0, sizeof (struct yytbl_hdr));
th->th_magic = YYTBL_MAGIC;
th->th_hsize = (flex_uint32_t) (14 + strlen (version_str) + 1 + strlen (name) + 1);
th->th_hsize += (8 - (th->th_hsize % 8)) % 8; // Pad to 64-bit boundary
th->th_hsize = 14 + strlen (version_str) + 1 + strlen (name) + 1;
th->th_hsize += yypad64 (th->th_hsize);
th->th_ssize = 0; // Not known at this point.
th->th_flags = 0;
th->th_version = xstrdup(version_str);
th->th_name = xstrdup(name);
th->th_version = copy_string (version_str);
th->th_name = copy_string (name);
return 0;
}
@@ -115,7 +115,8 @@ int yytbl_data_init (struct yytbl_data *td, enum yytbl_id id)
*/
int yytbl_data_destroy (struct yytbl_data *td)
{
free(td->td_data);
if (td->td_data)
free (td->td_data);
td->td_data = 0;
free (td);
return 0;
@@ -124,14 +125,14 @@ int yytbl_data_destroy (struct yytbl_data *td)
/** Write enough padding to bring the file pointer to a 64-bit boundary. */
static int yytbl_write_pad64 (struct yytbl_writer *wr)
{
int bwritten = 0;
int pad, bwritten = 0;
while (wr->total_written % (8 * sizeof(flex_uint8_t)) > 0) {
pad = yypad64 (wr->total_written);
while (pad-- > 0)
if (yytbl_write8 (wr, 0) < 0)
return -1;
else
bwritten++;
}
return bwritten;
}
@@ -158,12 +159,12 @@ int yytbl_hdr_fwrite (struct yytbl_writer *wr, const struct yytbl_hdr *th)
flex_die (_("th_ssize|th_flags write failed"));
bwritten += 6;
sz = (int) strlen (th->th_version) + 1;
sz = strlen (th->th_version) + 1;
if ((rv = yytbl_writen (wr, th->th_version, sz)) != sz)
flex_die (_("th_version writen failed"));
bwritten += rv;
sz = (int) strlen (th->th_name) + 1;
sz = strlen (th->th_name) + 1;
if ((rv = yytbl_writen (wr, th->th_name, sz)) != sz)
flex_die (_("th_name writen failed"));
bwritten += rv;
@@ -213,13 +214,13 @@ int yytbl_data_fwrite (struct yytbl_writer *wr, struct yytbl_data *td)
for (i = 0; i < total_len; i++) {
switch (YYTDFLAGS2BYTES (td->td_flags)) {
case sizeof (flex_int8_t):
rv = yytbl_write8 (wr, (flex_uint8_t) yytbl_data_geti (td, i));
rv = yytbl_write8 (wr, yytbl_data_geti (td, i));
break;
case sizeof (flex_int16_t):
rv = yytbl_write16 (wr, (flex_uint16_t) yytbl_data_geti (td, i));
rv = yytbl_write16 (wr, yytbl_data_geti (td, i));
break;
case sizeof (flex_int32_t):
rv = yytbl_write32 (wr, (flex_uint32_t) yytbl_data_geti (td, i));
rv = yytbl_write32 (wr, yytbl_data_geti (td, i));
break;
default:
flex_die (_("invalid td_flags detected"));
@@ -232,7 +233,7 @@ int yytbl_data_fwrite (struct yytbl_writer *wr, struct yytbl_data *td)
}
/* Sanity check */
if (bwritten != (12 + total_len * (int) YYTDFLAGS2BYTES (td->td_flags))) {
if (bwritten != (int) (12 + total_len * YYTDFLAGS2BYTES (td->td_flags))) {
flex_die (_("insanity detected"));
return -1;
}
@@ -247,14 +248,14 @@ int yytbl_data_fwrite (struct yytbl_writer *wr, struct yytbl_data *td)
/* Now go back and update the th_hsize member */
if (fgetpos (wr->out, &pos) != 0
|| fsetpos (wr->out, &(wr->th_ssize_pos)) != 0
|| yytbl_write32 (wr, (flex_uint32_t) wr->total_written) < 0
|| yytbl_write32 (wr, wr->total_written) < 0
|| fsetpos (wr->out, &pos)) {
flex_die (_("get|set|fwrite32 failed"));
return -1;
}
else
/* Don't count the int we just wrote. */
wr->total_written -= (int) sizeof (flex_int32_t);
wr->total_written -= sizeof (flex_int32_t);
return bwritten;
}
@@ -264,11 +265,11 @@ int yytbl_data_fwrite (struct yytbl_writer *wr, struct yytbl_data *td)
* @param len number of bytes
* @return -1 on error. number of bytes written on success.
*/
int yytbl_writen (struct yytbl_writer *wr, void *v, int len)
int yytbl_writen (struct yytbl_writer *wr, void *v, flex_int32_t len)
{
int rv;
rv = (int) fwrite (v, 1, (size_t) len, wr->out);
rv = fwrite (v, 1, len, wr->out);
if (rv != len)
return -1;
wr->total_written += len;
@@ -283,11 +284,11 @@ int yytbl_writen (struct yytbl_writer *wr, void *v, int len)
int yytbl_write32 (struct yytbl_writer *wr, flex_uint32_t v)
{
flex_uint32_t vnet;
int bytes, rv;
size_t bytes, rv;
vnet = htonl (v);
bytes = (int) sizeof (flex_uint32_t);
rv = (int) fwrite (&vnet, (size_t) bytes, 1, wr->out);
bytes = sizeof (flex_uint32_t);
rv = fwrite (&vnet, bytes, 1, wr->out);
if (rv != 1)
return -1;
wr->total_written += bytes;
@@ -302,11 +303,11 @@ int yytbl_write32 (struct yytbl_writer *wr, flex_uint32_t v)
int yytbl_write16 (struct yytbl_writer *wr, flex_uint16_t v)
{
flex_uint16_t vnet;
int bytes, rv;
size_t bytes, rv;
vnet = htons (v);
bytes = (int) sizeof (flex_uint16_t);
rv = (int) fwrite (&vnet, (size_t) bytes, 1, wr->out);
bytes = sizeof (flex_uint16_t);
rv = fwrite (&vnet, bytes, 1, wr->out);
if (rv != 1)
return -1;
wr->total_written += bytes;
@@ -320,10 +321,10 @@ int yytbl_write16 (struct yytbl_writer *wr, flex_uint16_t v)
*/
int yytbl_write8 (struct yytbl_writer *wr, flex_uint8_t v)
{
int bytes, rv;
size_t bytes, rv;
bytes = (int) sizeof (flex_uint8_t);
rv = (int) fwrite (&v, (size_t) bytes, 1, wr->out);
bytes = sizeof (flex_uint8_t);
rv = fwrite (&v, bytes, 1, wr->out);
if (rv != 1)
return -1;
wr->total_written += bytes;
@@ -427,7 +428,7 @@ static void yytbl_data_seti (const struct yytbl_data *tbl, int i,
*/
static size_t min_int_size (struct yytbl_data *tbl)
{
flex_int32_t i, total_len;
flex_uint32_t i, total_len;
flex_int32_t max = 0;
total_len = yytbl_calc_total_len (tbl);
@@ -437,7 +438,7 @@ static size_t min_int_size (struct yytbl_data *tbl)
n = abs (yytbl_data_geti (tbl, i));
if (max < n)
if (n > max)
max = n;
}
@@ -460,8 +461,7 @@ static size_t min_int_size (struct yytbl_data *tbl)
*/
void yytbl_data_compress (struct yytbl_data *tbl)
{
flex_int32_t i, total_len;
size_t newsz;
flex_int32_t i, newsz, total_len;
struct yytbl_data newtbl;
yytbl_data_init (&newtbl, tbl->td_id);
@@ -472,19 +472,19 @@ void yytbl_data_compress (struct yytbl_data *tbl)
newsz = min_int_size (tbl);
if (newsz == YYTDFLAGS2BYTES (tbl->td_flags))
if (newsz == (int) YYTDFLAGS2BYTES (tbl->td_flags))
/* No change in this table needed. */
return;
if (newsz > YYTDFLAGS2BYTES (tbl->td_flags)) {
if (newsz > (int) YYTDFLAGS2BYTES (tbl->td_flags)) {
flex_die (_("detected negative compression"));
return;
}
total_len = yytbl_calc_total_len (tbl);
newtbl.td_data = calloc ((size_t) total_len, newsz);
newtbl.td_flags = (flex_uint16_t)
(TFLAGS_CLRDATA (newtbl.td_flags) | BYTES2TFLAG (newsz));
newtbl.td_data = calloc (total_len, newsz);
newtbl.td_flags =
TFLAGS_CLRDATA (newtbl.td_flags) | BYTES2TFLAG (newsz);
for (i = 0; i < total_len; i++) {
flex_int32_t g;
+1 -1
View File
@@ -45,7 +45,7 @@ extern "C" {
#include "tables_shared.h"
struct yytbl_writer {
FILE *out;
int total_written;
flex_uint32_t total_written;
/**< bytes written so far */
fpos_t th_ssize_pos;
/**< position of th_ssize */
+2 -2
View File
@@ -57,7 +57,7 @@ dnl
*/
yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
{
flex_uint32_t n;
flex_int32_t n;
/* total number of ints */
n = tbl->td_lolen;
@@ -66,5 +66,5 @@ yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
if (tbl->td_id == YYTD_ID_TRANSITION)
n *= 2;
return (flex_int32_t) n;
return n;
}
+6
View File
@@ -63,6 +63,12 @@ dnl flex code (hence the name "_shared").
#define YYTBL_MAGIC 0xF13C57B1
#endif
/** Calculate (0-7) = number bytes needed to pad n to next 64-bit boundary. */
#ifndef yypad64
#define yypad64(n) ((8-((n)%8))%8)
#endif
#ifndef YYTABLES_TYPES
#define YYTABLES_TYPES
/** Possible values for td_id field. Each one corresponds to a
+37 -25
View File
@@ -36,11 +36,11 @@
/* declarations for functions that have forward references */
void mkentry(int *, int, int, int, int);
void mkprot(int[], int, int);
void mktemplate(int[], int, int);
void mv2front(int);
int tbldiff(int[], int, int[]);
void mkentry PROTO ((int *, int, int, int, int));
void mkprot PROTO ((int[], int, int));
void mktemplate PROTO ((int[], int, int));
void mv2front PROTO ((int));
int tbldiff PROTO ((int[], int, int[]));
/* bldtbl - build table entries for dfa state
@@ -78,7 +78,8 @@ int tbldiff(int[], int, int[]);
* cost only one difference.
*/
void bldtbl (int state[], int statenum, int totaltrans, int comstate, int comfreq)
void bldtbl (state, statenum, totaltrans, comstate, comfreq)
int state[], statenum, totaltrans, comstate, comfreq;
{
int extptr, extrct[2][CSIZE + 1];
int mindiff, minprot, i, d;
@@ -220,7 +221,7 @@ void bldtbl (int state[], int statenum, int totaltrans, int comstate, int com
* classes.
*/
void cmptmps (void)
void cmptmps ()
{
int tmpstorage[CSIZE + 1];
int *tmp = tmpstorage, i, j;
@@ -288,7 +289,7 @@ void cmptmps (void)
/* expand_nxt_chk - expand the next check arrays */
void expand_nxt_chk (void)
void expand_nxt_chk ()
{
int old_max = current_max_xpairs;
@@ -299,7 +300,8 @@ void expand_nxt_chk (void)
nxt = reallocate_integer_array (nxt, current_max_xpairs);
chk = reallocate_integer_array (chk, current_max_xpairs);
memset(chk + old_max, 0, MAX_XPAIRS_INCREMENT * sizeof(int));
zero_out ((char *) (chk + old_max),
(size_t) (MAX_XPAIRS_INCREMENT * sizeof (int)));
}
@@ -322,7 +324,8 @@ void expand_nxt_chk (void)
* and an action number will be added in [-1].
*/
int find_table_space (int *state, int numtrans)
int find_table_space (state, numtrans)
int *state, numtrans;
{
/* Firstfree is the position of the first possible occurrence of two
* consecutive unused records in the chk and nxt arrays.
@@ -416,11 +419,13 @@ int find_table_space (int *state, int numtrans)
* Initializes "firstfree" to be one beyond the end of the table. Initializes
* all "chk" entries to be zero.
*/
void inittbl (void)
void inittbl ()
{
int i;
memset(chk, 0, (size_t) current_max_xpairs * sizeof(int));
zero_out ((char *) chk,
(size_t) (current_max_xpairs * sizeof (int)));
tblend = 0;
firstfree = tblend + 1;
@@ -446,7 +451,7 @@ void inittbl (void)
/* mkdeftbl - make the default, "jam" table entries */
void mkdeftbl (void)
void mkdeftbl ()
{
int i;
@@ -495,8 +500,9 @@ void mkdeftbl (void)
* state array.
*/
void mkentry (int *state, int numchars, int statenum, int deflink,
int totaltrans)
void mkentry (state, numchars, statenum, deflink, totaltrans)
int *state;
int numchars, statenum, deflink, totaltrans;
{
int minec, maxec, i, baseaddr;
int tblbase, tbllast;
@@ -610,7 +616,8 @@ void mkentry (int *state, int numchars, int statenum, int deflink,
* has only one out-transition
*/
void mk1tbl (int state, int sym, int onenxt, int onedef)
void mk1tbl (state, sym, onenxt, onedef)
int state, sym, onenxt, onedef;
{
if (firstfree < sym)
firstfree = sym;
@@ -635,7 +642,8 @@ void mk1tbl (int state, int sym, int onenxt, int onedef)
/* mkprot - create new proto entry */
void mkprot (int state[], int statenum, int comstate)
void mkprot (state, statenum, comstate)
int state[], statenum, comstate;
{
int i, slot, tblbase;
@@ -672,10 +680,11 @@ void mkprot (int state[], int statenum, int comstate)
* to it
*/
void mktemplate (int state[], int statenum, int comstate)
void mktemplate (state, statenum, comstate)
int state[], statenum, comstate;
{
int i, numdiff, tmpbase, tmp[CSIZE + 1];
unsigned char transset[CSIZE + 1];
Char transset[CSIZE + 1];
int tsptr;
++numtemps;
@@ -703,8 +712,7 @@ void mktemplate (int state[], int statenum, int comstate)
if (state[i] == 0)
tnxt[tmpbase + i] = 0;
else {
/* Note: range 1..256 is mapped to 1..255,0 */
transset[tsptr++] = (unsigned char) i;
transset[tsptr++] = i;
tnxt[tmpbase + i] = comstate;
}
@@ -724,7 +732,8 @@ void mktemplate (int state[], int statenum, int comstate)
/* mv2front - move proto queue element to front of queue */
void mv2front (int qelm)
void mv2front (qelm)
int qelm;
{
if (firstprot != qelm) {
if (qelm == lastprot)
@@ -750,7 +759,8 @@ void mv2front (int qelm)
* Transnum is the number of out-transitions for the state.
*/
void place_state (int *state, int statenum, int transnum)
void place_state (state, statenum, transnum)
int *state, statenum, transnum;
{
int i;
int *state_ptr;
@@ -792,7 +802,8 @@ void place_state (int *state, int statenum, int transnum)
* no room, we process the sucker right now.
*/
void stack1 (int statenum, int sym, int nextstate, int deflink)
void stack1 (statenum, sym, nextstate, deflink)
int statenum, sym, nextstate, deflink;
{
if (onesp >= ONE_STACK_SIZE - 1)
mk1tbl (statenum, sym, nextstate, deflink);
@@ -821,7 +832,8 @@ void stack1 (int statenum, int sym, int nextstate, int deflink)
* number is "numecs" minus the number of "SAME_TRANS" entries in "ext".
*/
int tbldiff (int state[], int pr, int ext[])
int tbldiff (state, pr, ext)
int state[], pr, ext[];
{
int i, *sp = state, *ep = ext, *protp;
int numdiff = 0;
+7 -8
View File
@@ -37,19 +37,18 @@
/* yylex - scan for a regular expression token */
extern char *yytext;
extern FILE *yyout;
bool no_section3_escape = false;
int yylex (void)
{
int toktype;
static int beglin = false;
if (eofseen) {
if (eofseen)
toktype = EOF;
} else {
else
toktype = flexscan ();
}
if (toktype == EOF || toktype == 0) {
eofseen = 1;
@@ -175,12 +174,12 @@ int yylex (void)
fprintf (stderr, "<<EOF>>");
break;
case TOK_OPTION:
case OPTION_OP:
fprintf (stderr, "%s ", yytext);
break;
case TOK_OUTFILE:
case TOK_PREFIX:
case OPT_OUTFILE:
case OPT_PREFIX:
case CCE_ALNUM:
case CCE_ALPHA:
case CCE_BLANK:
+4 -4
View File
@@ -31,8 +31,6 @@ cxx_basic
cxx_basic.cc
cxx_multiple_scanners
cxx_multiple_scanners_[12].cc
cxx_restart
cxx_restart.cc
cxx_yywrap.i3
cxx_yywrap.cc
debug_nr
@@ -65,6 +63,10 @@ multiple_scanners_nr
multiple_scanners_nr_[12].[ch]
multiple_scanners_r
multiple_scanners_r_[12].[ch]
noansi_nr
noansi_nr.c
noansi_r
noansi_r.c
posix
posix.c
posixly_correct
@@ -87,8 +89,6 @@ rescan_nr.direct
rescan_nr.direct.c
rescan_r.direct
rescan_r.direct.c
quote_in_comment
quote_in_comment.c
quotes
quotes.c
string_nr
+112 -204
View File
@@ -19,8 +19,6 @@
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
AM_CFLAGS = $(WARNINGFLAGS)
TESTS = $(check_PROGRAMS) options.cn
# The script testwrapper.sh will run most tests as is. A couple tests
@@ -31,32 +29,31 @@ TESTS = $(check_PROGRAMS) options.cn
TEST_EXTENSIONS = .reject .table .direct .cn .i3 .pthread .one .opt .ser .ver
LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_LOG_FLAGS = -d $(srcdir) -r
REJECT_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
AM_REJECT_LOG_FLAGS = -d $(srcdir) -i $(srcdir)/reject.txt -r
REJECT_LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_REJECT_LOG_FLAGS = -d $(srcdir) -i reject.txt -r
TABLE_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
AM_TABLE_LOG_FLAGS = -d $(builddir) -i $(srcdir)/reject.txt -t
TABLE_LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_TABLE_LOG_FLAGS = -d $(srcdir) -i reject.txt -t
DIRECT_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper-direct.sh
AM_DIRECT_LOG_FLAGS = -b $(abs_builddir) -s $(srcdir)
DIRECT_LOG_COMPILER=$(srcdir)/testwrapper.sh
AM_DIRECT_LOG_FLAGS = -d $(srcdir)
CN_LOG_COMPILER = $(SHELL) $(srcdir)/options.cn
AM_CN_LOG_FLAGS = $(FLEX)
CN_LOG_COMPILER=$(srcdir)/options.cn
AM_CN_LOG_FLAGS=$(FLEX)
I3_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
AM_I3_LOG_FLAGS = -i $(srcdir)/cxx_yywrap.txt -i $(srcdir)/cxx_yywrap.txt -i $(srcdir)/cxx_yywrap.txt
I3_LOG_COMPILER=$(srcdir)/testwrapper.sh
AM_I3_LOG_FLAGS=-i $(srcdir)/cxx_yywrap.txt -i $(srcdir)/cxx_yywrap.txt -i $(srcdir)/cxx_yywrap.txt
PTHREAD_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
AM_PTHREAD_LOG_FLAGS = -i $(srcdir)/pthread_1.txt -i $(srcdir)/pthread_2.txt -i $(srcdir)/pthread_3.txt -i $(srcdir)/pthread_4.txt -i $(srcdir)/pthread_5.txt
PTHREAD_LOG_COMPILER=$(srcdir)/testwrapper.sh
AM_PTHREAD_LOG_FLAGS=-i $(srcdir)/pthread_1.txt -i $(srcdir)/pthread_2.txt -i $(srcdir)/pthread_3.txt -i $(srcdir)/pthread_4.txt -i $(srcdir)/pthread_5.txt
ONE_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
ONE_LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_ONE_LOG_FLAGS = -1 -d $(srcdir)
AM_YFLAGS = -d -p test
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src
check_PROGRAMS = $(simple_tests) $(reject_tests) $(TABLE_TESTS) $(DIRECT_TESTS) $(I3_TESTS) $(PTHREAD_TESTS) $(ONE_TESTS) $(TABLEOPTS_TESTS)
@@ -74,7 +71,6 @@ simple_tests = \
ccl \
cxx_basic \
cxx_multiple_scanners \
cxx_restart \
debug_nr \
debug_r \
extended \
@@ -84,14 +80,15 @@ simple_tests = \
mem_r \
multiple_scanners_nr \
multiple_scanners_r \
noansi_nr \
noansi_r \
posix \
posixly_correct \
prefix_nr \
prefix_r \
quote_in_comment \
quotes \
string_nr \
string_r \
string_r \
top \
yyextra
@@ -110,49 +107,38 @@ DIRECT_TESTS = \
rescan_nr.direct \
rescan_r.direct
I3_TESTS = \
I3_TESTS = \
cxx_yywrap.i3
if want_pthread
PTHREAD_TESTS = \
pthread.pthread
endif
ONE_TESTS = \
lineno_nr.one \
lineno_r.one \
lineno_trailing.one
quote_in_comment_SOURCES = quote_in_comment.l
alloc_extra_SOURCES = alloc_extra.l
array_nr_SOURCES = array_nr.l
array_r_SOURCES = array_r.l
basic_nr_SOURCES = basic_nr.l
basic_r_SOURCES = basic_r.l
if HAVE_BISON
bison_nr_SOURCES = bison_nr_scanner.l bison_nr_parser.y bison_nr_main.c
nodist_bison_nr_SOURCES = bison_nr_parser.h bison_nr_scanner.h
bison_yylloc_SOURCES = bison_yylloc_scanner.l bison_yylloc_parser.y bison_yylloc_main.c
nodist_bison_yylloc_SOURCES = bison_yylloc_parser.h bison_yylloc_scanner.h
bison_yylval_SOURCES = bison_yylval_scanner.l bison_yylval_parser.y bison_yylval_main.c
nodist_bison_yylval_SOURCES = bison_yylval_parser.h bison_yylval_scanner.h
else
bison_nr_SOURCES = no_bison_stub.c
bison_yylloc_SOURCES = no_bison_stub.c
bison_yylval_SOURCES = no_bison_stub.c
endif
c_cxx_nr_SOURCES = c_cxx_nr.lll
c_cxx_r_SOURCES = c_cxx_r.lll
ccl_SOURCES = ccl.l
cxx_basic_SOURCES = cxx_basic.ll
cxx_restart_SOURCES = cxx_restart.ll
cxx_multiple_scanners_SOURCES = cxx_multiple_scanners_main.cc cxx_multiple_scanners_1.ll cxx_multiple_scanners_2.ll
cxx_yywrap_i3_SOURCES = cxx_yywrap.ll
debug_nr_SOURCES = debug_nr.l
debug_r_SOURCES = debug_r.l
extended_SOURCES = extended.l
header_nr_SOURCES = header_nr_scanner.l header_nr_main.c
nodist_header_nr_SOURCES = header_nr_scanner.h
header_r_SOURCES = header_r_scanner.l header_r_main.c
nodist_header_r_SOURCES = header_r_scanner.h
include_by_buffer_direct_SOURCES = include_by_buffer.direct.l
include_by_push_direct_SOURCES = include_by_push.direct.l
include_by_reentrant_direct_SOURCES = include_by_reentrant.direct.l
@@ -162,9 +148,9 @@ lineno_trailing_one_SOURCES = lineno_trailing.l
mem_nr_SOURCES = mem_nr.l
mem_r_SOURCES = mem_r.l
multiple_scanners_nr_SOURCES = multiple_scanners_nr_main.c multiple_scanners_nr_1.l multiple_scanners_nr_2.l
nodist_multiple_scanners_nr_SOURCES = multiple_scanners_nr_1.h multiple_scanners_nr_2.h
multiple_scanners_r_SOURCES = multiple_scanners_r_main.c multiple_scanners_r_1.l multiple_scanners_r_2.l
nodist_multiple_scanners_r_SOURCES = multiple_scanners_nr_1.h multiple_scanners_nr_2.h
noansi_nr_SOURCES = noansi_nr.l
noansi_r_SOURCES = noansi_r.l
posix_SOURCES = posix.l
posixly_correct_SOURCES = posixly_correct.l
prefix_nr_SOURCES = prefix_nr.l
@@ -180,117 +166,58 @@ rescan_r_direct_SOURCES = rescan_r.direct.l
string_nr_SOURCES = string_nr.l
string_r_SOURCES = string_r.l
top_SOURCES = top.l top_main.c
nodist_top_SOURCES = top.h
yyextra_SOURCES = yyextra.l
# 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 = \
alloc_extra.c \
array_nr.c \
array_r.c \
basic_nr.c \
basic_r.c \
bison_nr_parser.c \
bison_nr_parser.h \
bison_nr_scanner.c \
BUILT_SOURCES = \
bison_nr_scanner.h \
bison_yylloc_parser.c \
bison_nr_parser.h \
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_restart.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 \
posix.c \
posixly_correct.c \
prefix_nr.c \
prefix_r.c \
pthread.c \
quote_in_comment.c \
quotes.c \
reject_nr.reject.c \
reject_r.reject.c \
reject_ser.table.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 \
$(tableopts_c) \
$(tableopts_tables)
dist-hook:
chmod u+w $(distdir) && \
for file in $(CLEANFILES) ; do \
rm -f $(distdir)/$$file \
; done
reject_ser.table.c \
top.h \
$(tableopts_c)
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 \
cxx_multiple_scanners.txt \
cxx_restart.txt \
cxx_yywrap.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 \
@@ -306,6 +233,12 @@ EXTRA_DIST = \
lineno_trailing.one.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 \
pthread_1.txt \
@@ -314,130 +247,105 @@ EXTRA_DIST = \
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 \
quote_in_comment.txt \
quotes.txt \
top.h \
top.txt \
yyextra.txt \
tableopts.txt
$(tableopts_c) \
$(tableopts_tables) \
tableopts.txt \
options.cn
dist_noinst_SCRIPTS = \
tableopts.sh
dist_check_SCRIPTS = \
options.cn \
testwrapper-direct.sh \
testwrapper.sh
pthread_pthread_LDADD = @LIBPTHREAD@
pthread_pthread_LDADD = -lpthread
# specify how to process .l files in order to test the flex built by make all
TESTOPTS = -L
FLEX = $(top_builddir)/src/flex
.l.c: $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) -o $@ $<
.l.c:
$(FLEX) -o $@ $<
.ll.cc: $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) -+ -o $@ $<
bison_nr_main.$(OBJEXT): bison_nr_parser.h bison_nr_scanner.h
bison_nr_scanner.$(OBJEXT): bison_nr_parser.h
.ll.cc:
$(FLEX) -+ -o $@ $<
bison_nr_main.($OBJEXT): bison_nr_parser.h bison_nr_scanner.h
bison_nr_scanner.h: bison_nr_scanner.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
bison_yylloc_main.$(OBJEXT): bison_yylloc_parser.h bison_yylloc_scanner.h
bison_yylloc_scanner.$(OBJEXT): bison_yylloc_parser.h
bison_yylloc_scanner.h: bison_yylloc_scanner.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
bison_yylval_main.$(OBJEXT): bison_yylval_parser.h bison_yylval_scanner.h
bison_yylval_scanner.$(OBJEXT): bison_yylval_parser.h
bison_yylval_scanner.h: bison_yylval_scanner.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
# 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: $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) -o $@ $<
.lll.cc:
$(FLEX) -o $@ $<
header_nr_main.$(OBJEXT): header_nr_scanner.h
header_nr_scanner.h: header_nr_scanner.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
header_r_main.$(OBJEXT): header_r_scanner.h
header_r_scanner.h: header_r_scanner.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
include_by_buffer.direct$(EXE): include_by_buffer.direct.txt include_by_buffer.direct_2.txt include_by_buffer.direct_3.txt
include_by_push.direct$(EXE): include_by_push.direct.txt include_by_push.direct_2.txt include_by_push.direct_3.txt
include_by_reentrant.direct$(EXE): include_by_reentrant.direct.txt include_by_reentrant.direct_2.txt include_by_reentrant.direct_3.txt
multiple_scanners_nr_main.$(OBJEXT): multiple_scanners_nr_1.h multiple_scanners_nr_2.h
multiple_scanners_nr_1.h: multiple_scanners_nr_1.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
multiple_scanners_nr_2.h: multiple_scanners_nr_2.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
multiple_scanners_r_main.$(OBJEXT): multiple_scanners_r_1.h multiple_scanners_r_2.h
multiple_scanners_r_1.h: multiple_scanners_r_1.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
multiple_scanners_r_2.h: multiple_scanners_r_2.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi
posixly_correct.c: posixly_correct.l $(FLEX)
$(AM_V_LEX)POSIXLY_CORRECT=1 $(FLEX) $(TESTOPTS) -o $@ $<
posixly_correct.c: posixly_correct.l
POSIXLY_CORRECT=1 $(FLEX) -o $@ $<
reject_nr.reject.c: reject.l4 $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) --unsafe-no-m4-sect3-escape -o $@ $<
reject_nr.reject.c: reject.l4
$(FLEX) -o $@ $<
reject_nr.reject$(EXEEXT): reject_nr.reject.$(OBJEXT)
$(AM_V_CCLD)$(LINK) $^
$(LINK) $^
reject_r.reject.c: reject.l4 $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) --unsafe-no-m4-sect3-escape --reentrant -o $@ $<
reject_r.reject.c: reject.l4
$(FLEX) --reentrant -o $@ $<
reject_r.reject.$(OBJEXT): reject_r.reject.c
$(AM_V_CC)$(COMPILE) -DTEST_IS_REENTRANT -c -o $@ $<
$(COMPILE) -DTEST_IS_REENTRANT -c -o $@ $<
reject_r.reject$(EXEEXT): reject_r.reject.$(OBJEXT)
$(AM_V_CCLD)$(LINK) $^
$(LINK) $^
reject_ver.table.c: reject.l4 $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) --unsafe-no-m4-sect3-escape -o $@ --tables-verify --tables-file=$(basename $@).tables $<
reject_ver.table.c: reject.l4
$(FLEX) -o $@ --tables-verify --tables-file=$(basename $@).tables $<
reject_ver.table.$(OBJEXT): reject_ver.table.c
$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
reject_ver.table$(EXEEXT): reject_ver.table.$(OBJEXT)
$(AM_V_CCLD)$(LINK) $^
$(LINK) $^
reject_ser.table.c: reject.l4 $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) -o $@ --unsafe-no-m4-sect3-escape --tables-file=$(basename $@).tables $<
reject_ser.table.c: reject.l4
$(FLEX) -o $@ --tables-file=$(basename $@).tables $<
reject_ser.table.$(OBJEXT): reject_ser.table.c
$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
reject_ser.table$(EXEEXT): reject_ser.table.$(OBJEXT)
$(AM_V_CCLD)$(LINK) $^
$(LINK) $^
top_main.$(OBJEXT): top.h
top.h: top.c
@@ -448,10 +356,10 @@ top.h: top.c
# things) and the resultant list is both long an unenlightening. And
# it can be / is generated by a shell script, tableopts.sh.
$(srcdir)/tableopts.am: tableopts.sh
$(SHELL) $(srcdir)/tableopts.sh > $(srcdir)/tableopts.am
tableopts.am: tableopts.sh
$(srcdir)/tableopts.sh > $(srcdir)/tableopts.am
include $(srcdir)/tableopts.am
include 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))
@@ -461,50 +369,50 @@ tableopts_tests := $(tableopts_opttests) $(tableopts_vertests) $(tableopts_sert
tableopts_c := $(addsuffix .c,$(tableopts_tests))
OPT_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
AM_OPT_LOG_FLAGS = -d $(srcdir) -i $(srcdir)/tableopts.txt -r
OPT_LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_OPT_LOG_FLAGS = -d $(srcdir) -i tableopts.txt -r
tableopts_opt_nr%.c: tableopts.l4 $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) --unsafe-no-m4-sect3-escape -P $(subst -,_,$(basename $(*F))) $(*:_F=F) -o $@ $<
tableopts_opt_nr%.c: tableopts.l4
$(FLEX) -P $(subst -,_,$(basename $(*F))) $* -o $@ $<
tableopts_opt_nr%.$(OBJEXT): tableopts_opt_nr%.c
$(AM_V_CC)$(COMPILE) -c -o $@ $<
$(COMPILE) -c -o $@ $<
tableopts_opt_r%.c: tableopts.l4 $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) --unsafe-no-m4-sect3-escape -P $(subst -,_,$(basename $(*F))) --reentrant $(subst _F,F,$*) -o $@ $<
tableopts_opt_r%.c: tableopts.l4
$(FLEX) -P $(subst -,_,$(basename $(*F))) --reentrant $* -o $@ $<
tableopts_opt_r%.$(OBJEXT): tableopts_opt_r%.c
$(AM_V_CC)$(COMPILE) -DTEST_IS_REENTRANT -c -o $@ $<
$(COMPILE) -DTEST_IS_REENTRANT -c -o $@ $<
SER_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
AM_SER_LOG_FLAGS = -d $(builddir) -i $(srcdir)/tableopts.txt -r -t
SER_LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_SER_LOG_FLAGS = -d $(srcdir) -i tableopts.txt -r -t
tableopts_ser_nr%.c: tableopts.l4 $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) --unsafe-no-m4-sect3-escape -P $(subst -,_,$(basename $(*F))) --tables-file="tableopts_ser_nr$*.ser.tables" $(subst _F,F,$*) -o $@ $<
tableopts_ser_nr%.c: tableopts.l4
$(FLEX) -P $(subst -,_,$(basename $(*F))) --tables-file="tableopts_ser_nr$*.ser.tables" $* -o $@ $<
tableopts_ser_nr%.$(OBJEXT): tableopts_ser_nr%.c
$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
tableopts_ser_r%.c: tableopts.l4 $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) --unsafe-no-m4-sect3-escape -P $(subst -,_,$(basename $(*F))) -R --tables-file="tableopts_ser_r$*.ser.tables" $(subst _F,F,$*) -o $@ $<
tableopts_ser_r%.c: tableopts.l4
$(FLEX) -P $(subst -,_,$(basename $(*F))) -R --tables-file="tableopts_ser_r$*.ser.tables" $* -o $@ $<
tableopts_ser_r%.$(OBJEXT): tableopts_ser_r%.c
$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -DTEST_IS_REENTRANT -c -o $@ $<
$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -DTEST_IS_REENTRANT -c -o $@ $<
VER_LOG_COMPILER = $(SHELL) $(srcdir)/testwrapper.sh
AM_VER_LOG_FLAGS = -d $(builddir) -i $(srcdir)/tableopts.txt -r -t
VER_LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_VER_LOG_FLAGS = -d $(srcdir) -i tableopts.txt -r -t
tableopts_ver_nr%.c: tableopts.l4 $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) --unsafe-no-m4-sect3-escape -P $(subst -,_,$(basename $(*F))) --tables-file="tableopts_ver_nr$*.ver.tables" --tables-verify $(subst _F,F,$*) -o $@ $<
tableopts_ver_nr%.c: tableopts.l4
$(FLEX) -P $(subst -,_,$(basename $(*F))) --tables-file="tableopts_ver_nr$*.ver.tables" --tables-verify $* -o $@ $<
tableopts_ver_nr%.$(OBJEXT): tableopts_ver_nr%.c
$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -c -o $@ $<
tableopts_ver_nr%.ver$(EXEEXT): tableopts_ver_nr%.$(OBJEXT)
$(AM_V_CCLD)$(LINK) -o $@ $^
$(LINK) -o $@ $^
tableopts_ver_r%.c: tableopts.l4 $(FLEX)
$(AM_V_LEX)$(FLEX) $(TESTOPTS) --unsafe-no-m4-sect3-escape -P $(subst -,_,$(basename $(*F))) -R --tables-file="tableopts_ver_r$*.ver.tables" --tables-verify $(subst _F,F,$*) -o $@ $<
tableopts_ver_r%.c: tableopts.l4
$(FLEX) -P $(subst -,_,$(basename $(*F))) -R --tables-file="tableopts_ver_r$*.ver.tables" --tables-verify $* -o $@ $<
tableopts_ver_r%.$(OBJEXT): tableopts_ver_r%.c
$(AM_V_CC)$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -DTEST_IS_REENTRANT -c -o $@ $<
$(COMPILE) -DTEST_HAS_TABLES_EXTERNAL -DTEST_IS_REENTRANT -c -o $@ $<
+1 -2
View File
@@ -50,8 +50,7 @@ stderr, which will have been redirected to the log file created by the
automake test suite harness.
** If your test is skipped (e.g., because bison was not found), then
the test should return 77 (seventy-seven). This is the exit status that
would be recognized by automake's "test-driver" as _skipped_.
the test should return 2 (two).
** Once your work is done, submit a patch via the flex development
mailing list, the github pull request mechanism or some other
+7 -4
View File
@@ -43,6 +43,9 @@ struct Check {
/* Save char into junk array at next position. */
static void check_extra ( yyscan_t scanner );
/* Special yyalloc */
void *yyalloc ( size_t size, yyscan_t scanner );
%}
%option 8bit prefix="test"
@@ -62,7 +65,7 @@ static void check_extra ( yyscan_t scanner );
int main(void);
int
main (void)
main ()
{
yyscan_t scanner;
struct Check check;
@@ -75,8 +78,8 @@ main (void)
testset_in(stdin, scanner);
testset_out(stdout, scanner);
/* Test to confirm that testalloc was called from
* testlex_init_extra with the testextra argument.
/* Test to confirm that yyalloc was called from
* yylex_init_extra with the yyextra argument.
*/
check_extra(scanner);
@@ -86,7 +89,7 @@ main (void)
return 0;
}
void *testalloc(size_t size, yyscan_t scanner)
void *yyalloc(size_t size, yyscan_t scanner)
{
struct Check *check;
check = testget_extra(scanner);
+1 -1
View File
@@ -45,7 +45,7 @@
int main (void);
int
main (void)
main ()
{
yyin = stdin;
yyout = stdout;
+1 -1
View File
@@ -45,7 +45,7 @@
int main(void);
int
main (void)
main ()
{
yyscan_t lexer;
+1 -1
View File
@@ -52,7 +52,7 @@ WS [[:blank:]]
int main(void);
int main (void)
int main ()
{
yyin = stdin;
yyout = stdout;
+6 -6
View File
@@ -52,16 +52,16 @@ WS [[:blank:]]
int main(void);
int main (void)
int main ()
{
yyscan_t lexer;
testlex_init( &lexer );
testset_out ( stdout,lexer);
testset_in ( stdin, lexer);
while( testlex(lexer) )
yylex_init( &lexer );
yyset_out ( stdout,lexer);
yyset_in ( stdin, lexer);
while( yylex(lexer) )
{
}
testlex_destroy( lexer );
yylex_destroy( lexer );
printf("TEST RETURNING OK.\n");
return 0;
}
+2
View File
@@ -23,7 +23,9 @@
#include "bison_nr_parser.h"
#include "bison_nr_scanner.h"
#include "bison_nr_scanner_char.h"
extern int testparse(void);
int main ( int argc, char** argv )
{
+5 -3
View File
@@ -32,16 +32,18 @@
#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 */
/* #define YYLEX_PARAM scanner */
int yyerror(const char* msg);
extern int testget_lineno(void);
/* A dummy function. A check against seg-faults in yylval->str. */
static int process_text(char* s) {
int process_text(YY_CHAR* s) {
int total =0;
while(*s) {
total += (int) *s;
@@ -53,11 +55,11 @@ static int process_text(char* s) {
%}
%pure-parser
%pure_parser
%union {
int lineno;
char * str;
YY_CHAR * str;
}
%token <str> IDENT
%token <lineno> LINENO
+4 -9
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,28 +35,23 @@ static char* STRDUP(char* s1);
%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)strtol(yytext,NULL,10);
yylloc->first_line = (int)yy_utils_strtol(yytext,NULL,10);
return LINENO;
}
":" { return COLON; }
" " { return SPACE; }
"=" { return EQUAL; }
[[:alnum:]_]+ { yylval->str = STRDUP(yytext); return IDENT;}
[[:alnum:]_]+ { yylval->str = yy_utils_strdup(yytext); return IDENT;}
\r|\n { }
. { yyterminate();}
%%
static char* STRDUP(char* s1)
{
char* s2 = malloc(strlen(s1)+1);
sprintf(s2,"%s",s1);
return s2;
}
+1
View File
@@ -23,6 +23,7 @@
#include "bison_yylloc_parser.h"
#include "bison_yylloc_scanner.h"
#include "bison_yylloc_scanner_char.h"
int main ( int argc, char** argv )
{
+5 -2
View File
@@ -35,14 +35,17 @@
#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);
#define YYERROR_VERBOSE 1
extern int testget_lineno(void*);
/* A dummy function. A check against seg-faults in yylval->str. */
static int process_text(char* s) {
int process_text(YY_CHAR* s) {
int total =0;
while(*s) {
total += (int) *s;
@@ -58,7 +61,7 @@ static int process_text(char* s) {
%union {
int lineno;
char * str;
YY_CHAR * str;
}
%token <str> IDENT
%token <lineno> LINENO

Some files were not shown because too many files have changed in this diff Show More