717 Commits
Author SHA1 Message Date
Will Estes 1c49f7e585 Documented building and installation of flex
Since GNU autotools no longer provides a stock INSTALLATION file, we provide one that speaks to flex specifically.

fixes #402
2022-09-27 16:50:19 -04:00
Will Estes 7f5cd60976 updates from translation project 2022-09-27 14:22:07 -04:00
Will Estes ea6493d9b6 Merge pull request #527 from Mightyjo/issue-525
Fix Issue #525 - Segfault in yyinput
2022-06-17 07:57:52 -04:00
Will Estes e1a5285cbf Merge pull request #529 from ggujjula/issue_369
Add documentation about option '--yymore'
2022-06-17 07:54:37 -04:00
Will Estes 1cba28b65b Merge pull request #528 from xiaohanyu/fix-doc-error
fix some tiny doc errors.
2022-06-17 07:52:11 -04:00
Will Estes 1656033045 Merge pull request #531 from Explorer09/flexint-include
Also check for C++ standard version when deciding to include <stdint.h>
2022-06-17 07:46:28 -04:00
Explorer09 8ab4ea7364 Also check for C++ standard version when deciding to include <stdint.h>
Fixes: #517

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2022-06-17 19:35:49 +08:00
ggujjula e0e7091dc7 Add anchors and refs to areas relevant to '--yymore' 2022-05-31 01:19:47 -05:00
ggujjula 16ff9d0133 Add documentation for option '--yymore' 2022-05-31 01:19:35 -05:00
Xiao Hanyu 7535b35bf1 fix some tiny doc error. 2022-05-26 21:00:47 +08:00
Joseph Langley 4581eccf1e fix(issue-525): Fail gracefully when yy_get_next_buffer can't find one.
Demonstrate yyinput() error checking for this condition.
2022-05-18 11:15:49 -04:00
Joseph Langley 9d9a039c31 fix(issue-525): Add regression test for Issue 525.
yyrestart should not set yy_fill_buffer to 1 when it was previously set to 0 (e.g. by yy_scan_buffer).
2022-05-18 11:13:46 -04:00
Will Estes 74a89fd6ab Merge pull request #513 from ggujjula/issue_398
Issue 398; Documentation fix; Additional command-line options
2022-05-16 15:59:30 -04:00
Will Estes 00bfa85257 Merge pull request #524 from Mightyjo/issue-521
doc(manual): Character classes
2022-05-16 15:55:38 -04:00
Will Estes 4c0345cc28 Merge pull request #523 from Mightyjo/github-ci
GitHub Actions (Replacing TravisCI)
2022-05-16 15:48:15 -04:00
Joseph Langley 2bacaef4cf doc(manual): Correct character class examples and special meaning discussion.
See Issue 521 and 478.
2022-05-11 17:41:53 -04:00
Joseph Langley 342104d61b chore(ci): Remove testing configs from GH Action workflows. 2022-05-11 16:14:22 -04:00
Joseph Langley 4a42e91987 chore(ci): Update GH Actions scripts to Ubuntu 20 2022-05-11 15:41:54 -04:00
Joseph Langley 5cdd61549d chore(ci): Enable GitHub Actions on github-ci branch. 2022-05-11 14:55:43 -04:00
Joseph Langley 87ff2861e6 chore(travisci): Remove Travis CI configs. 2022-05-11 14:47:30 -04:00
Joseph Langley a0c76652f7 chore(gh-actions): Build and test on GitHub Actions CI platform.
Use ubuntu-18.04.
2022-05-11 14:47:30 -04:00
Will Estes 3fe96958fa new pl translation from the translation project 2022-01-03 12:35:03 -05:00
ggujjula 1677eff252 Add command-line options --noyyget_debug and --noyyset_debug 2021-12-29 16:47:43 -06:00
ggujjula c947396cda Replace mention of input() in documentation with yyinput() 2021-12-29 16:31:18 -06:00
ggujjula 1565a740db Add command-line options --noinput and --noyyinput 2021-12-29 16:23:14 -06:00
Sean McBride 974bb68e10 Remove trailing whitespace
Many projects have pre-commit hooks that check for pedantic things like trailing whitespace. No harm in removing it to pacify them.
2021-10-23 23:07:14 -04:00
Will Estes 7ea145a7e6 Merge pull request #491 from Mightyjo/issue_469
Issue 469; Compute length of yy_state_buf correctly
2021-08-13 11:37:10 -04:00
Joseph Langley eac0901186 chore(action): Clean up dead code
Leave clear instructions on what to do if the Autobuild step breaks.
2021-08-13 11:16:11 -04:00
Joseph Langley e864186c57 fix(action): Let Autobuild do most of the work
Try preparing configure with autogen.sh, then letting codeql-action/autobuild do it's work prior to analysis.
2021-08-13 11:16:11 -04:00
Joseph Langley af75357b17 Update codeql-analysis.yml 2021-08-13 11:16:11 -04:00
Joseph Langley fceec5d95a chore(skel): Fix permissions on cpp-flex.skl 2021-07-02 18:52:14 -04:00
Joseph Langley 5cccc82072 chore(skel): Improve comment at state buffer init. 2021-07-02 18:49:38 -04:00
Joseph Langley 79da5dfa0f fix(skel): Init state buffer correctly
State buffer initialization in cpp-flex.skl got lost during a rebase. Added it back in from c99-flex.skl and made improvements suggested by smcpeak.
2021-07-02 18:46:52 -04:00
Joseph Langley 8100144eb4 chore(perm): Fix permissions 755->644 2021-07-02 17:53:29 -04:00
Simon Sobisch b198864a75 fix compile warning originating in cpp skeleton
`gcount()` is of type `streamsize` which has a system-dependent size with at least `int`. Because of the `int max_size` limit no bigger value will be returned, the explicit cast fixes warnings from compilers/static analyzers.
2021-06-22 20:27:20 +02:00
Joseph Langley ab783a0b99 chore(make): Ensure distcheck cleans up directories. 2021-06-09 21:46:01 -04:00
Joseph Langley 50819bb82a fix(skel): Fix porting errors from the cpp to the c99 and go skeletons. 2021-06-09 21:46:01 -04:00
Joseph Langley 1d128474a7 fix(skel): Use yypanic in place of YY_FATAL_ERROR.
yypanic() is new in the c99 and go skeletons.
2021-06-09 21:46:01 -04:00
Joseph Langley 988d379eb0 fix(skel): Add state buffer size handling to reentrant scanner skeletons. 2021-06-09 21:46:01 -04:00
Joseph Langley 916636cb96 chore(test): Declare script variables before use.
For set -euvx
2021-06-09 21:46:01 -04:00
Joseph Langley d1ed12a1b0 fix(skel): Add state buffer size handling to non-reentrant scanner skeletons. 2021-06-09 21:46:01 -04:00
Mightyjo e61f190ef6 Ensure size of Reject state buffer is sufficient each time yy_switch_to_buffer is called. 2021-06-09 21:46:00 -04:00
Mightyjo 379af7681d Don't use C++ auto, it angers TravisCI. 2021-06-09 21:46:00 -04:00
Mightyjo b4162d3653 Fix test failure on TravisCI. 2021-06-09 21:46:00 -04:00
Mightyjo 470c8a201f Test for reversion of CVE-2006-0459. 2021-06-09 21:46:00 -04:00
Mightyjo 7e6ad373b8 Test for reversion of CVE-2006-0459. 2021-06-09 21:46:00 -04:00
Will Estes 7b073fdda2 Merge branch 'yy-init-buffer-nonnull' of git://github.com/Explorer09/flex into Explorer09-yy-init-buffer-nonnull 2021-06-08 11:11:28 -04:00
Explorer09 60c4453b6a scanner: Fix compiler confusion in yy_init_buffer()
When complied with 'gcc -O3', the yy_init_buffer call can confuse gcc,
thinking the 'b' pointer may be NULL. (gcc would warn that if
'-Wnull-dereference' is used). Fix the confusion by never pass a NULL
constant to the function.

Fixes: #377

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2021-06-07 09:30:46 +08:00
Explorer09 dada40b50f Remove manual m4 search code. No more stat() dependency.
This reverts commit c34590c4bf
and all search code patches that followed it.

The execvp() would do the $PATH searching of m4 for flex. There's no
need to duplicate the effort.

Another reason for the removal is to remove dependency on stat()
system call, which would cause a problem in a 32-bit OS accessing a
filesystem with 64-bit inode number (see #413).

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2021-06-07 08:39:52 +08:00
Will Estes c26cd7bc13 Merge branch 'autogen-sh' of git://github.com/Explorer09/flex into Explorer09-autogen-sh 2021-06-05 14:37:20 -04:00
Will Estes 83aaf1b4ce Merge branch 'doc_fix_typo' of git://github.com/houtanb/flex into houtanb-doc_fix_typo 2021-06-05 14:21:51 -04:00
Joseph Langley cb2e0aacca Merge branch 'westes:master' into esr_retargeting 2021-06-05 11:36:21 -04:00
Will Estes 5bd5b0213a Create codeql-analysis.yml 2021-06-05 07:24:00 -04:00
Joseph Langley 0d5d2dd4af chore(test): Clean up debugging in tests 2021-06-05 01:29:41 -04:00
Joseph Langley 5772bb456e fix(test): Re-add posix test input to repo. 2021-06-05 01:14:26 -04:00
Joseph Langley 1e893215c5 chore(test): Enable shell '-eu' strictness 2021-06-05 01:08:37 -04:00
Joseph Langley 90713678d8 chore(test): Regenerate ruleset.am 2021-06-05 00:46:26 -04:00
Joseph Langley 455d913d34 fix(test): Make test generating scripts work in VPATH builds 2021-06-05 00:29:05 -04:00
Joseph Langley aeb2cb5539 fix(test): Re-add test inputs to tests/
Generating these test inputs on the fly breaks VPATH builds and 'make distcheck'.
Glad we have a lot fewer of them now, at least.
2021-06-05 00:26:47 -04:00
Joseph Langley 5fa412a3d9 fix(build): Set texi2* include paths for VPATH.
Override the TEXI2DVI and TEXI2PDF automake variables to add an include directory so VPATH builds work.
I'm not thrilled with doing this. The right thing is probably to move the included examples to doc/ and do the
VPATH magic in examples/manual/ where LaTeX is better able to deal with it.
2021-06-04 00:37:59 -04:00
Joseph Langley 46299d7dbc fix(build): Expand wildcards in Makefile.am.
Wildcards were causing automake to generate spurious build targets.
2021-06-04 00:34:40 -04:00
Joseph Langley e6472493e2 fix(build): Replace wildcards in Makefile.am.
Wildcards were causing automake to generate build rules for the *-filename dummies. They're not generally portable.
2021-06-04 00:33:30 -04:00
Joseph Langley e50f889082 fix(build): Prevent automake computing default _SOURCES for tests.
Automake attempts to compute default _SOURCES for the test-yydecl-*.sh runners generated by test-yydecl-gen.sh. Providing an intentionally empty _SOURCES variable for each script fixes the attendant errors.

Also removed EXTRA_DIST lines for deleted test inputs.
2021-06-03 21:56:59 -04:00
Joseph Langley a297d520ae Merge pull request #16 from eric-s-raymond/retargeting
Reviewing ESR's Retargeting branch from westes/flex
2021-06-02 20:17:38 -04:00
Eric S. Raymond 5d93876e22 Remove prrequisite from .l.go suffix rule
autogen gets indigestion iv you give a suffix rule a prerequisite,
so don't do that.
2021-02-05 07:33:45 -05:00
Eric S. Raymond f5960fabba Go back end: More Goification of names. 2020-12-04 11:31:27 -05:00
Eric S. Raymond 33bd31b74b Portability fix in tests - not all languages have ++ and --. 2020-12-04 06:49:26 -05:00
Daniel Brooks 7b022d451d check that each skeleton we build has the correct number of sections (#7)
Probably we could turn the section markers into m4 macros, but until
then this will prevent accidents.
2020-11-26 16:47:37 -05:00
Daniel Brooks d5c3fcfb3e Mollify picky C compilers some more (#8) 2020-11-26 16:24:28 -05:00
Eric S. Raymond b528c7efdc Improve standards conformance in C99 and Go skeletons. 2020-11-26 07:25:25 -05:00
Eric S. Raymond 9f1c6960ce Deal with a GCC warning elicited by upgrade to GCC 10.2.0. 2020-11-20 07:32:35 -05:00
Eric S. Raymond dd0fb2920b In the Go back end, more moves towards Go conventions.
All documented in the go-flex.skl header comment.
2020-11-20 07:32:35 -05:00
Eric S. Raymond 7b3f8db536 Improve information hiding in C99 and Go back ends.
Things that don't need to be declared before that DFA
tables shouldn't be.
2020-11-20 05:52:06 -05:00
Eric S. Raymond 0d6d37f246 In the Go back end, begin Go-ifying the public interface.
struct yyguts_t becomes FlexLexer typedef.
2020-11-20 04:52:32 -05:00
Eric S. Raymond 5a9a913893 Eliminate forwards in the C99 back end. 2020-11-19 18:26:48 -05:00
Eric S. Raymond 75da1e1d8a In the Go back end, elimate some forwards. 2020-11-19 17:33:02 -05:00
Eric S. Raymond df34448330 More Go back end cleanup.
Remove the Bison-bdidge kludge.

Rearrange yyguts_t so the public members are grouped together.
2020-11-19 17:07:37 -05:00
Eric S. Raymond 820199d2a9 In the C99 and Go back ends, rearrange code...
...to clean out a forward declaeation.
2020-11-19 09:29:22 -05:00
Eric S. Raymond 6c37e76ca5 Improve type checking in c99 and Go back ends. 2020-11-19 08:54:42 -05:00
Eric S. Raymond c1105abd8b In the Go back end, more moves towards Go-like names.
Not touching the public interface yet.
2020-11-19 08:46:41 -05:00
Eric S. Raymond e502c5d485 More massaging of the fake Go skeleton in the direction of Go. 2020-11-19 01:55:55 -05:00
Eric S. Raymond ce66818db5 Stop emitting unbalanced markup in the skeleton.
It was fixed up by generating matcing unbalanced markuo in dfa.c,
but a good idea this was not.
2020-11-19 01:28:58 -05:00
Eric S. Raymond 8b0503e168 In C88 and Go back ends, remove remnant GENTABLES conditionals. 2020-11-19 01:20:31 -05:00
Eric S. Raymond 48a25d4966 Partial move of Go back end to Go canelCasing in names.
No publicly visible names are touched yet. This is all preep work.
All tesrs pass.
2020-11-19 01:00:11 -05:00
Eric S. Raymond 866e31dafd Go back end: Change the prefix option to set Go package name...
...presebtly commented out.  All tests pass.
2020-11-18 00:02:04 -05:00
Eric S. Raymond 30d15dfae9 TYhis commit is a model for how to add a new back end.
Begin the Go back end. Right now it's a fake that generates C...

...but this commit puts all the build and testnmachinery in place
for when it's not.  All tests pass.
2020-11-17 07:28:40 -05:00
Eric S. Raymond be50e74b5c Improve cleanup of generated .txt after tests. 2020-11-17 05:52:08 -05:00
Eric S. Raymond eaf12696af Convert the debug test to be ruleset-based, 2020-11-17 05:42:50 -05:00
Eric S. Raymond e2a64fa174 Rename some rules files to make maintaining .gitignore simpler.
Due to some limitayions in git ignore wildcarding.
2020-11-17 00:07:07 -05:00
Eric S. Raymond 52e6bb3e84 Fix error in testnmaker: shell case alternations evaluate easrky. 2020-11-16 23:24:30 -05:00
Eric S. Raymond b068bede45 Merge remote-tracking branch 'westes/master' into retargeting
All tests pass.
2020-11-16 19:36:31 -05:00
Eric S. Raymond ad9f2d493e In C99, remove unneeded forward declarations. 2020-11-16 17:55:59 -05:00
Eric S. Raymond 654ab2012f Up-gun a test to use the lineno code in the array+BOL case...
...and fix the bug that turned up.
2020-11-16 17:32:40 -05:00
Eric S. Raymond a67532dd57 Remove now-unused parts of test/testwrapper.sh. 2020-11-16 06:10:47 -05:00
Eric S. Raymond 22b9ea63bd Remove the ".one" category of tests; they've been replaced by rulesets.
This reduces the complexitry of the test machinery as well as making
tests less backend-specific.
2020-11-16 05:54:38 -05:00
Eric S. Raymond f0f53f6930 Remove now-unused SOURCES declarations. 2020-11-16 05:32:38 -05:00
Eric S. Raymond eacb312e5b Improve instrumentation of test failures.
Also, yyinpt.txt is generated and does not need to be checked in.
2020-11-16 04:51:00 -05:00
Eric S. Raymond 709c1724ed Repair some bitrotted variable-trailing-context code.
It decayed because the test for this feature only exercised the nr
back end. We add a ruleset--based test to verify on all back ends.
2020-11-15 22:37:24 -05:00
Eric S. Raymond df632cf2eb Fix typo revealed by Go porting work, and improve test coverage to match.
We a ruleset test for BOL matching and a test for the array case of yymore.
Improve yymore testing by adding tests that require a BOL match in
both array and pointer cases.

Also, convert lineno sporadic test to be ruleset-based so it's
applied on all back ends.

No cide changes.
2020-11-15 12:24:35 -05:00
Eric S. Raymond 3603f03350 Minor build system fixes before starting the Go port.
Remove two dependencies that the C99 back end no longer has.

Repair to force in-time building of skel.h files.  This way of doing
it reduces where a new skel dependency has to be declared in the
vuilld recipe to the one spot where the flex.h file is made from the
flex.skl file.

The posixly correct test only needs to be done once, since it only
affects how the tables are genetated rather than setting code
conditionals in the back end.

Also, some comment typo fixes.
2020-11-13 08:23:10 -05:00
Eric S. Raymond 1a48798ca9 In C99, more rearrangement to make public API calls visible in actions...
..,without resorting to forward declarations. Last C99 cleanup before
the Go port begins.
2020-11-12 18:45:54 -05:00
Eric S. Raymond e3e0d791ea Documentation polishing. 2020-11-12 10:49:10 -05:00
Eric S. Raymond 110899d69e Clean up test/Makefile,am's EXTRA_DIST. 2020-11-12 09:53:26 -05:00
Eric S. Raymond fa6a0fc666 Declare that rulset.am depends on *.rules files...
...for automatic remake when a new one is added.
2020-11-12 08:37:50 -05:00
Eric S. Raymond 1991ad515f Fix another carnivorous typo. 2020-11-12 07:53:29 -05:00
Eric S. Raymond 6c8b6c1c1f Clean out some small C dependencies. 2020-11-11 23:15:55 -05:00
Eric S. Raymond 8a973b0efd Booleanization. 2020-11-11 22:52:47 -05:00
Eric S. Raymond 43aed9f0c9 Typo fix. 2020-11-11 20:57:39 -05:00
Eric S. Raymond 1b27cb2366 Fix two minor m4 errors found by Daniel Brooks. 2020-11-11 18:37:31 -05:00
Eric S. Raymond 01850d3ba1 Eliminate almost all forward declarations from C99.
One less C-ism to deal wit h when porting to a new target languages.
2020-11-11 18:13:15 -05:00
Eric S. Raymond 3854cd2c67 Add a test for trailing conyext rules. Fix the bug it turned up.
Also, roperly condition some variables related to trailing contexts.
Makes generated parsers ever so slightly smaller in this case.
2020-11-11 06:52:49 -05:00
Eric S. Raymond ab32ad65bb Repair some markup damage in the manual. 2020-11-10 19:56:39 -05:00
Eric S. Raymond 2056b2184d Add a trailing guard to the magic-rewrite recignizer. 2020-11-10 07:33:10 -05:00
Eric S. Raymond 87686ff2fb Successful elimination of preprocessor dependencies fromm C99 skeleton.
There's only one left. in the prefix code.  We leave that in place
because ity will be needed if we ever want to replace the default
C back end with C99.
2020-11-10 06:55:22 -05:00
Eric S. Raymond 9b68eb3634 Change two member names to make rewite rules easier. 2020-11-09 15:39:49 -05:00
Eric S. Raymond aa782b6233 Explain why 3 API functions don't have magic rewrite rules.
The functions are: yy_current_buffer(), yy_flush_current_buffer(), and
yy_set_interactive().
2020-11-09 04:26:56 -05:00
Eric S. Raymond 2995af0eeb yy_flex_debug -> yyflexdebug. 2020-11-08 17:38:42 -05:00
Eric S. Raymond db1dca76c1 Make the rewrite flag visible. 2020-11-08 17:38:42 -05:00
Eric S. Raymond 191d7068c3 Fully m4ize yymore() 2020-11-08 17:38:42 -05:00
Eric S. Raymond 8aabc897cd Add a test for yymore, and fix a bug it turned up. 2020-11-07 01:48:56 -05:00
Eric S. Raymond ec140e6477 m4ize yyreject() handling. 2020-11-06 12:04:20 -05:00
Eric S. Raymond d056db08e6 Fix errors that were masking problems with yyreject().
Ensure that derived skel.h includes are removed on every clean.

Fix a bad shell line that prevented proper cleaming of derived *.c
files from tests.
2020-11-04 06:43:47 -05:00
Eric S. Raymond b9414d653c Revert "Successful m4ization of yyreject()."
There seems to be something in the build recipe or test system that
makes the yyreject test unreliable.  Reverting until I figure out
what.
2020-11-04 02:40:37 -05:00
Eric S. Raymond 9b27be4b2e YY_AT_BOL() -> yyatbol(), yy_set_bol() -> yysetbol(), and make them magic.
The tradeoff is a bit delicate here; yy_set_bol() did not strictly
speaking need to change. On the other hand, squeezing the underscores
out of YY_AT_BOL() but not yy_set_bol() would have been exactly the
kind of irregularity that people trip over and curse.

The underlying issue is of course languages like Go and Python with
validators that get upset by all caps and embedded underscores. On the
one hand, we want to not be churning the Flex API gratuitously.  On
the other hand it is desirable if as few entry point names as possible
need to change in different target languages.

The approach I'm taking to deciding this question in individual cases
is this: if an entry point name is likely to appear in actions, and
must be recognized as magic by Flex itself in order to have a final
context argument added or an object reference prepended, then it must
be multilanguage-safe - not all-caps and no underscores.

Any name that does *not* need to be wired into Flex can be left
alone. Users may have to change it when they port.
2020-11-03 12:58:06 -05:00
Eric S. Raymond 2e6b59bb7a Documentation polishing. 2020-11-03 11:11:58 -05:00
Eric S. Raymond 35cdc7cabe Implement and document the rewrite/norewrite option. 2020-11-03 02:00:09 -05:00
Eric S. Raymond f2f38557ee Pull two random flags into the ctrl structure.
Also, some documentation polishing.
2020-11-02 20:35:28 -05:00
Eric S. Raymond eb6e30e9d5 Successful m4ization of yyreject(). 2020-11-02 05:58:28 -05:00
Eric S. Raymond 22d0a5d192 yyless is successfully m4ized. 2020-11-02 01:33:46 -05:00
Eric S. Raymond a6499117d7 Add a test for yyless. 2020-11-01 17:38:58 -05:00
Eric S. Raymond b9002f8f93 Simplify and generalize the testmaker macros. 2020-11-01 12:55:35 -05:00
Eric S. Raymond 8b1d12f0cd Portability improvement on the extended test. 2020-11-01 03:54:07 -05:00
Eric S. Raymond 2f449b4211 shellcheck cleanup on all scripts. Turned up a minor bug in testmaker.sh. 2020-11-01 03:53:46 -05:00
Eric S. Raymond a53aec8e86 Rulesets now carry their test loads with them.
Makes it easier to see what the tests are doing.
2020-10-31 18:19:29 -04:00
Eric S. Raymond 2b5ef23d70 Modify the reject.rules ruleset so it actually tests yyreject().
This turns up the fact that m4ization of yyrehect() didn't work, so
we back that change out.
2020-10-31 11:59:59 -04:00
Eric S. Raymond 3fe9c68941 m4ize handling of yyterminate, and translate another stray #define. 2020-10-31 05:15:37 -04:00
Eric S. Raymond 076ee33fc4 More small steps towards taking cpp out of the required pipeline. 2020-10-30 23:06:57 -04:00
Eric S. Raymond 48d47f6423 Convert yyreject() from a cpp macro to an m4 macro. 2020-10-30 23:06:00 -04:00
Eric S. Raymond f4de7a57a7 Fix a minor bug in gathering removables. 2020-10-30 22:32:28 -04:00
Eric S. Raymond 4cc8835d3c Add %option bufsize, required for testing under non-C targets...
...since we can't count on the C preprocessor to do it.
2020-10-29 20:34:14 -04:00
Eric S. Raymond 95efae5469 Abolish a platform microtweak after consulting with Will Estes. 2020-10-29 17:48:32 -04:00
Eric S. Raymond 8bf1889ca7 More de-preprocessorization. 2020-10-29 17:19:47 -04:00
Eric S. Raymond 59c26779eb In C99, make --nounistd a no-op. Explain this in the manual. 2020-10-29 00:18:25 -04:00
Eric S. Raymond dc11ff3020 In C99, assume <stdint.h> is available to simplify the code. 2020-10-28 23:09:26 -04:00
Eric S. Raymond 02237b18b2 Convert handling of USER_ACTION, YY_END_OF_BUFFER_CHAR, YY_STATE_BUF_SIZE...
...to use pure m4, not cpp.
2020-10-28 20:49:19 -04:00
Eric S. Raymond cbdc123fde In C99, de-cpp-izee processing of USER_INIT and RULE_SETUP.
Also, fix a harmless compiler warning introced three commits back.
2020-10-28 20:28:17 -04:00
Eric S. Raymond 15948a9b14 In C99, process yylex declaration stting directly through m4...
...instead of relying on cpp to do it. This commit also adds a
test for correctness of yydecl on all back ends.
2020-10-28 20:15:24 -04:00
Eric S. Raymond 9de953f78f In C99, remove more preprocessor dependencies. 2020-10-28 13:01:21 -04:00
Eric S. Raymond 29116efd20 Remove cpp from the way the extra type is handled, use pure m4 instead.
Has the effect of making the code a bit smaller when no extra type
is born.
2020-10-28 12:39:26 -04:00
Eric S. Raymond aea2d30573 Finally ever the dependency on the YY_FATAL_ERROR macro.
Still supported as a legacy interface in the default back end.
2020-10-28 12:39:26 -04:00
Eric S. Raymond 079b2d1c86 Eliminate YY_BREAK macro, replaced with an m4 hook. 2020-10-28 12:39:26 -04:00
Eric S. Raymond baaaa45b40 A step towards getting rid of YY_FATAL_ERROR...
...because we can no longer depend on cpp to be in the pipeline.
2020-10-28 12:39:26 -04:00
Eric S. Raymond 6ba9f483bf Remove for cpp dependencies. 2020-10-28 12:39:26 -04:00
Eric S. Raymond af8d41eb94 In C99, abolish indirection through a void pointer...
...to get to the scanner internals structure.  While this was a valiant
effort at information hiding, it won't port out of C to any other plausible
target language.  That being the case, we cut the LOC.
2020-10-28 12:39:26 -04:00
Eric S. Raymond 169612a929 Remove cpp dependencies. 2020-10-28 12:39:26 -04:00
Eric S. Raymond d1dc1c0911 Sever a number of dependencies on cpp by adding rewrite rules...
...in the flex scanner.  Presently this works for yyecho(), yyinput(),
yystart(), yybegin(), and yyunput().  These no longer need to be nacros.

A few more remain to be done, notably yyless() and yymore().

Along the way, deprecate YY_FATAL_ERROR and add a replacement option.
2020-10-28 12:39:26 -04:00
Eric S. Raymond f854b71051 Clean C preprocessor assumptions out of C99.
Also, continue booleanizing where we can.
2020-10-28 12:39:26 -04:00
Eric S. Raymond 7af5fa13bb Outside cpp #define doesn't work, so deprecate YY_FLEX_SUBMINOR_VERSION. 2020-10-28 12:39:26 -04:00
Eric S. Raymond b244d82cf0 Remove an ugly little knor in the C99 yyunput code...
..left there from a weird compromise when the default C back end also
supported C++.  Add a yyunput ruleset testing it on all back ends to
verify that the change is good.
2020-10-26 23:26:28 -04:00
Eric S. Raymond f5d2d88a6d Fix C emission lurking previously undiscovered in nfa.c. 2020-10-26 20:03:22 -04:00
Eric S. Raymond baafce5c71 In C99, factor a nasty hunk of macrology into a function. 2020-10-26 15:45:23 -04:00
Eric S. Raymond ffcdee1fa2 In C99, use bools where it is semantically reasonable.
Also, abandon the old-fashioned practice of using ! as a NULL
test on pointer-valued expressions.
2020-10-26 14:26:49 -04:00
Eric S. Raymond e8de043be2 In C99, group macros for use in user actions...
..and move the group as late in the generated code as we can.
There's no reason for those to be in scope when tables are
being generated.
2020-10-26 10:52:53 -04:00
Eric S. Raymond 9bfc5ce27d In C99, remove most code dependencies on yyin/yyout/yyleng/yytext macros.
These served a purpose when the code had to handle both reentrant and
non-reentrant cases.  Now, while they should still be available in user
actions, the generated code is much less confusing if the yyg pointer
in the references is explicit.

Also, drop VMS support and consolidate platform-specific references
at one spot. This is in the same commit with the macro cleanup because
it included getting rid of the last stray yyin/yyout references.
2020-10-26 09:56:18 -04:00
Eric S. Raymond c050411566 In C99, strip out ccp #ifndefs that can't fire if not using cpp. 2020-10-26 08:07:06 -04:00
Eric S. Raymond 18b3523680 Strip legacy macro definitions out of C99.
This is both a step towards Go/Rust and a demonstration that
all the ruleset-based tests run wtout them.
2020-10-26 07:59:36 -04:00
Eric S. Raymond 4a4cd247ca Polish documentation and fix up some uses of the old interface. 2020-10-25 22:34:23 -04:00
Eric S. Raymond 5e71dbbf5d Polish tests and test documentation. 2020-10-25 22:08:16 -04:00
Daniel Brooks e7b758041c Expand M4_HOOK_CONST_DEFINE into multiple macros for different types (#6)
The Rust backend needs to know the type of every constant; it can't
just guess and it doesn't have text macros like C.
2020-10-25 22:08:33 -04:00
Daniel Brooks ac97741a0b Fix Next link in the Overview of the Retargeting section of the manual (#3) 2020-10-25 22:08:18 -04:00
Eric S. Raymond 307645b7b7 Narrow the interface between Flex and the skeleton file...
...and reduce C preprocessor entanglement in the C99 skeleton.
2020-10-25 09:53:18 -04:00
Eric S. Raymond 393b0b5733 yyconst is a pre-ANSI archaism. Remove it from the test code...
...so the C99 back end doesn;'t have to carry it.  It's still defined
in the default C back end.
2020-10-25 00:13:56 -04:00
Eric S. Raymond 68d658f60c Sever a C99 dependency on ECHO, 2020-10-25 00:00:47 -04:00
Eric S. Raymond 7ec30d9fee Strip legacy support from the c99 back end.
Gone: C++ support, M4_YY_IN_HEADER. M4_YY_REENTRANT,
and their negation symbols. The strange macrology
requitred to makecunction signatures conditionally
compile for npn-rentrant or reentrant is gone.

The default C back end is not touched by these changes.
2020-10-25 00:00:47 -04:00
Eric S. Raymond eaf84e669d Add tests for both senses of the Lex compatibility option...
...fulfilling a promise made in " Fix buggy handling of lex
compatibility..."
2020-10-24 12:28:19 -04:00
Eric S. Raymond 8301e241dc Move some boilerplate out of rules files.
They are now pure Flex rulesets.
2020-10-24 08:52:51 -04:00
Eric S. Raymond 91b3016f9d Add a test for correctness of {n} behavior when posix_compat is off.
Also, document what the posix and posixlycorrect rulesets are doing
netter.  I lost a day because the dependency on setting POSIXLY_CORRECT
omn the envoronment was not obvious.
2020-10-24 07:46:41 -04:00
Eric S. Raymond 8bec427f3e Turn the posixlycorrect test into a ruleset-based one.
Required generating the posixlycorrrect rules with tests/ruleset.sh
so all platforms will have them.
2020-10-24 07:10:58 -04:00
Eric S. Raymond a5b4a2ee96 Force reentrancy on on the c99 back end...
...amd repair the one c99 test with a non-reentrant main.
The reentrant no longer needs to be specified in an %option line
for C99.
2020-10-23 20:06:42 -04:00
Eric S. Raymond c92f5df6a1 Make the ccl test ruleset-based for all back ends. 2020-10-22 21:03:59 -04:00
Eric S. Raymond 683fa301a7 Documentation cleanup - fix a wrong assumption about tests.
The quotes test is backend-independent and doesn't need
to be run anywhere but C.

Also, remove some debris from the C99 skeleton,
it injects noise into C output comparisons.
2020-10-22 19:50:54 -04:00
Eric S. Raymond 97b5bc730f Repair CLEANFILES and EXTRA_DIST in tests/Makefile.am/
My previous changes were based on incorrect assumptions
about time of evaluation.
2020-10-22 13:53:48 -04:00
Eric S. Raymond efb179b87d Use wildcarding and negation toi cut the verbiage in tests/.gitignore 2020-10-22 12:24:38 -04:00
Eric S. Raymond f5017c14b0 Fix buggy handling of lex compatiblity option introduced during the retargeting work.
Not caught because we don't test that option. It's on my TODO list.
2020-10-22 11:24:27 -04:00
Eric S. Raymond ee9f33ac5d Convert the "posix" test to be ruleset-based...
...so it will run automatically on all back ends.
2020-10-22 11:24:27 -04:00
Eric S. Raymond dddcaa7c97 Another big sinmplification of the test machinery.
If you drop a file with the extension ".rules" in tests/,
"make check" will now automatically make and run tests
for all back ends - presently nr, r, and c99.

It would be trivial to change ruleset.sh so all table-compression
options are checked for all rulesets, and probably a good idea.
2020-10-22 08:29:28 -04:00
Eric S. Raymond cd6fdfdadf Remove unused variable settings in tests/Makefile.am...
...and group the log-compiler settings together where they can be
audited.
2020-10-22 07:15:26 -04:00
Eric S. Raymond 2ff19867ca Abolish the cpp test extension. Those things are just tessts.
The distinction was intriduced when I was first feeling my way
through the test machinery. It doesn't buy us anything.
2020-10-22 07:06:23 -04:00
Daniel Brooks cf6e72bb33 fix a few shellcheck lints that have shown up (#5) 2020-10-21 23:02:40 -04:00
Eric S. Raymond f7cc373669 This commit adds c99 to the list of back ends for tableopts testing.
The overhaul of the test system is done for now, though there will be
more woro to do when testing has to support compilers for non-C
back ends.
2020-10-21 21:58:24 -04:00
Eric S. Raymond cf0f126d13 The new test system now covers table option tests. 2020-10-21 21:12:13 -04:00
Eric S. Raymond 2fb90cc835 Generate some dependency relationships...
...rather than maintaining them by hand.
2020-10-21 19:45:27 -04:00
Eric S. Raymond 1200a3da64 Documentation polishing. 2020-10-21 18:02:12 -04:00
Eric S. Raymond cd8e62a1b7 Teach testwrapper.sh to parse compression options from testnames. 2020-10-21 18:00:07 -04:00
Eric S. Raymond d9826a40d9 Use CxF rather than C_F to prevent case ambiguity, so...
......test names can be split on _ characters in order to parse
the compression options desired in the test.
2020-10-21 17:58:16 -04:00
Eric S. Raymond a110b3b67d Simplify testwrapper.sh by abolishing the -t option.
It's easy enough to tell if a testfile wants a table by looking at its
name.  Getting rid of this option is a step towards putting all
tableopts tests in the generated set so they are trivially portable to
new back ends.
2020-10-21 17:13:01 -04:00
Daniel Brooks 8be9597d7d Use shellcheck on most of the shell scripts in the repository.
And add a "lint" target that runs shellcheck on them.
2020-10-21 17:08:22 -04:00
Eric S. Raymond 1726f1ca2d Documentation polishing. 2020-10-20 16:28:22 -04:00
Eric S. Raymond 30b86fbc07 Abolish reject.l4; all the reject tests are in the new system now.
Still have the tableopts tests to do.
2020-10-20 15:51:58 -04:00
Eric S. Raymond 9ea7800162 Fold non-table-serialization reject tests into new test-generator system.
Enables us to get rid of some spacial-purpose stuff in Makefile.am.
2020-10-20 07:58:33 -04:00
Eric S. Raymond 2034298f3d Integrate all possible simple tests into the new test templating system.
Still to be folded in: all the reject and tableopts tests.

Note: I understand VPATH builds just well enough to suspect that this
commit and my previous broke them, but not well enough to test
or fix it. Mea culpa.
2020-10-20 06:47:15 -04:00
Eric S. Raymond 5a1544256b Greatly simplify CLEANFILES and EXTRA_DIST by using wildcarding.
This reduces the amount of hand-work trquired to add a back end.
2020-10-20 04:53:49 -04:00
Eric S. Raymond 16f19cd7ae Introduce testmaker.m4 and testmaker.sh
The existing method of generating multiple tests from l4 files is not
flexible enough to handle multilanguage - reliance on the C
preprocessor prevents that. This commit creates replacement machinery
that's more flexible and will greatly reduce the complexity of adding
new back ends.

The idea is to generate test .l files by combining a
backend-independent ruleset with backend-dependent boilerplate for
test mains and preambles.

This commit creates the rules files, the m4 to template them into
tests, and a shell wrapper to drive the m4 expansion.  The autoconf
integration works OK, but requires additional rules at the
end of tests/Makefile.am that probably ought to be autogenerated.

There was one other change forced by this.  In order for the new
testmaker to work, it needs to be possible to analyze test file names
into stems and option modifiers.  Having underscores in the stem
would make the analysis slower and bug-prone.

I wanted to change them to "-" rather than deleting them, but this
gives autoconf fits - it seems to not like filenames with embedded
dashes in certain contexts.

At this commit, only one test - array_nr.l - is generated using the new
system.
2020-10-20 03:31:20 -04:00
Eric S. Raymond c23d0161dc Cut down on input-file proliferation.
With a minor tweak to testwrapper we can allow all the versions of
a test for different back ends (counting _r and _nr as back ends)
to share a common input file.
2020-10-17 22:12:25 -04:00
Eric S. Raymond b642977f1c MAINTAINERCLEANFILES typo fix. 2020-10-17 14:59:21 -04:00
Eric S. Raymond f735bad052 Add C99 lineno test. 2020-10-17 14:52:05 -04:00
Eric S. Raymond 07440122ca Improve explanation of m4 quoting. 2020-10-17 14:13:12 -04:00
Eric S. Raymond bd08ddcf8f Fix some minor typos recently introduced in tests/Makefile.am. 2020-10-17 10:29:20 -04:00
Eric S. Raymond e858600158 Documentation polishing. 2020-10-17 10:19:36 -04:00
Eric S. Raymond 1c439cfab2 Finish up the simple-test set for C99. 2020-10-17 08:40:29 -04:00
Daniel Brooks ff0f995851 quick editing pass over recent changes to documentation and comments (#2) 2020-10-16 14:27:46 -04:00
Eric S. Raymond f07c52fdc5 Fix a gacomment garbled by an incautuius replace. 2020-10-16 14:07:03 -04:00
Eric S. Raymond 9a4495add5 Added exteded_c00 test. 2020-10-16 12:34:58 -04:00
Eric S. Raymond 4615b6420c extended -> etended_cpp. 2020-10-16 12:27:07 -04:00
Eric S. Raymond 3290c37223 Actually *commit* the documentation on test conventions. 2020-10-16 12:07:22 -04:00
Eric S. Raymond e6931c9f6c Docunent the -e/--emit backend switch and the new test convention. 2020-10-16 11:56:13 -04:00
Eric S. Raymond 4724e14e38 Adding more c99 tests: alloc_extra_c99, array_c99, ccl_c99, debug_c99.
alloc_extra -> alloc_extra_cpp
ccl -> ccl_cpp

These rena,es meam that the tests for all backends are in either two
parallel series (*_cpp, *_c99) or three (*_nr, *_r, *_c99).
2020-10-16 11:10:16 -04:00
Eric S. Raymond 3c9898eb13 Add first C99 backend test, the C99 spin of basic_r.l.
Illustrates how to adapt an exisying test - in this case,
basic_r.l - for the new c99 back end.
2020-10-16 08:57:36 -04:00
Eric S. Raymond 978a4a3a63 Begin work on a C99 front end.
The idea behind this is to exploit the existing test suite - write a
stripped-down, cleaned up C skeleton that only does reentrant scanners
and tosses out features like loadable tables and header generation
that can't be ported to other languages.

The C99 skeleton can then serve both as a launch point for the Go back
end and a model for back ends in procedural languages without OO.  The
initial version is identical to the cpp skeleton except for different
name and suffix properties abd having M4_MODE_C_OLY forcrd on.  The
latter means it blows up on the C++ tests.
2020-10-16 08:46:39 -04:00
Eric S. Raymond 0e32cd6ce3 Add and document machinery to choose a back end by name.
Back end is now reported in the metadata comments near the top of
generated files.

All is in readiness for the start of direct work on Go support.
2020-10-16 06:10:02 -04:00
Nick Downing c99e66b54d Change inner loops to use int not YY_CHAR, removing need for separate NUL table 2020-10-15 16:47:42 -04:00
Eric S. Raymond 30d0e5f954 Push some C-specific assumptions out of filter.c to the skel file.
The way this is done is by adding a capabiiliy to mine string-valued
properties out of skel files in Flex's binary.

Also, some reorganization to improve the encapsulation of
knowledge about skel files.

No changes in generated test files from this patch.
2020-10-15 15:06:48 -04:00
Eric S. Raymond d658c1c167 Make the format for detecting trace lines a backend property.
No changes in generated test code from this commit.
2020-10-15 07:36:02 -04:00
Eric S. Raymond dd60560bfd Refactor filter.c to use line_directive_out().
To make this work, use line_directive_out() had to be servered from
its deoendence on hidden globaks.  Which was a good idea anyway,

No diffs in generated test code from this commit.

Yet another well-hidden C assumption.  I begin to woner if I will
expire of old age before fkushing out all of these.
2020-10-15 06:43:21 -04:00
Eric S. Raymond 20779d47a7 Factor C/C++ assumptions out of filter.c.
No diffs in generated test code from this commit.
2020-10-15 06:13:24 -04:00
Eric S. Raymond 65b508798f More documentation polishing. 2020-10-14 18:59:05 -04:00
Eric S. Raymond f7f447793a Typo and markup fixes in the manual. 2020-10-14 13:58:29 -04:00
Eric S. Raymond e740e500e2 Documentation polishing. 2020-10-14 13:16:44 -04:00
Eric S. Raymond 35c1cf3426 Remove unused code. 2020-10-14 11:57:24 -04:00
Eric S. Raymond 10daafd5b4 Remove interpretation of %-markup.
Before this commit, "rm cpp-skel.h" may be required in addition
to "make clean".

Since there  no longer any pusging or poping operations, the sko
stack goes away.
2020-10-14 10:56:57 -04:00
Eric S. Raymond efed8275c5 Replace all conditional markup in the skeleton with macro conditionals.
Because having two different consitionalization syntaxes was ugly
and conducive to error.  After this change there are %% breakpoints
and %# comments and nothing else.  Comments on %if lines have been
preserved.

I used the following script:

========================================================================

import sys

flagstack = []
for line in sys.stdin:
    if (not line.startswith("%if")) and (not line.startswith("%endif")) and (not line.startswith("%ok-for")) and (not line.startswith("%not-for")):
        sys.stdout.write(line)
        continue
    elif line.startswith("%endif"):
        if flagstack.pop():
            sys.stdout.write("]])\n")
        continue
    fields = line.strip().split()
    trailer = " ".join(fields[1:]) + "\n"
    if line.startswith("%if-bison-bridge"):
        sys.stdout.write("m4_ifdef([[M4_YY_BISON_LVAL]], [[\n")
        flagstack.append(True)
    elif line.startswith("%if-c++-only"):
        sys.stdout.write("m4_ifdef([[M4_MODE_CXX_ONLY]], [[\n")
        flagstack.append(True)
    elif line.startswith("%if-c-only"):
        sys.stdout.write("m4_ifdef([[M4_MODE_C_ONLY]], [[\n")
        flagstack.append(True)
    elif line.startswith("%if-c-or-c++"):
        flagstack.append(False)
    elif line.startswith("%if-not-reentrant"):
        sys.stdout.write("m4_ifdef([[M4_YY_NOT_REENTRANT]], [[\n")
        flagstack.append(True)
    elif line.startswith("%if-reentrant"):
        sys.stdout.write("m4_ifdef([[M4_YY_REENTRANT]], [[\n")
        flagstack.append(True)
    elif line.startswith("%if-tables-serialization"):
        sys.stdout.write("m4_ifdef([[M4_MODE_TABLESEXT]], [[\n")
        flagstack.append(True)
    elif line.startswith("%not-for-header"):
        sys.stdout.write("m4_ifdef( [[M4_YY_IN_HEADER]],,[[m4_dnl\n")
    elif line.startswith("%ok-for-header"):
        sys.stdout.write("]])\n")
    else:
        sys.stderr.write("depercent: unrecognized %r\n" % line)
        raise SystemExit(1)
    if trailer.strip():
        sys.stdout.write("%# " + trailer)

========================================================================

One nasty little abuse if markup around yyread_r had to be fixed up by hand.
2020-10-14 06:48:07 -04:00
Eric S. Raymond ee6ae49d67 Fix typo introduced when yyunput was added.
The bad commit was:
"Rename unput() to yyunput(); follow through in option switches."

I shouldn't have missed this, but te build has normal warnings
that obscured the waning from Flex.
2020-10-14 06:23:17 -04:00
Eric S. Raymond 18ece7e249 Modernize the C in the skeleton file.
Good modern style in C is to write it as though it were a strongly typed
language even though it isn't; thius, it's no l;onger considered good practice
to apply ! to non-booleans.

Also, fix some indentation annd vraxe usage for uniformity.
2020-10-13 10:27:31 -04:00
Eric S. Raymond bcd8575897 Documentation polishing. 2020-10-13 09:29:24 -04:00
Eric S. Raymond e7611bea3c Three more namespace cleanups for multilanguage.
Replace YY_FLUSH_BUFFER with yy_flush_current_buffer()
Replace YY_CURRENT_BUFFER with yy_current_buffer().
Replace YY_BUFFER_STATE with yybuffer.

The following are the all-caps definitions still exposed:

YY_FLEX_MAJOR_VERSION
YY_FLEX_MINOR_VERSION
YY_FLEX_SUBMINOR_VERSION
YY_NULL
YY_END_OF_BUFFER_CHAR
YY_BUF_SIZE
YYLMAX

It is not idea for this list to be nonempty, but
at least these are all actual comple-time constants
rather than function calls or type names.
2020-10-13 07:44:36 -04:00
Eric S. Raymond 8d0162b80a Update all the examples to use the new API elements.
Add a fully reentrant example.  And update to TODO file.
2020-10-12 21:07:14 -04:00
Eric S. Raymond 68711fc4a7 Replace YY_USER_INIT, YY_USER_ACION, and YY_BREAK #defines with Flex options.
These were the last preprocessor abuses in the Flex interface.

Also, add a TODO listing tests that need to be added.
2020-10-12 16:23:59 -04:00
Eric S. Raymond a4dd4772d2 Make yydecl an ordinary string-valued option rather than a special directive.
This corrects a minor mistake I made earlier because I did not yet understand
the full generality of the option syntax.

Also fixes some minor markup errors in the manual.
2020-10-12 11:06:26 -04:00
Eric S. Raymond 7bd654ca0c Deprecate #define YY_EXTRA_TYPE in favor of the extra-type option.
Follow this through in the examples and manual.
2020-10-12 10:38:18 -04:00
Eric S. Raymond da0cd947c3 Make flex --help work again.
Fixes a stupid, trivial initialization-time bug introduce
during methodizatiion.
2020-10-12 09:36:44 -04:00
Eric S. Raymond aac8fe8896 Revise the manual so the reentrant interface is recommended early.
Also add the first example friom the manual, and a reentrant variant
of it, to the example set.  And document how to integrate examples.
2020-10-12 09:16:40 -04:00
Eric S. Raymond 721622ea6e Rename unput() to yyunput(); follow through in option switches.
This change was not strictly necessary to sever a preprocessor
dependency nor make the API uniform aross both C and C++.  But it
cried out to be made, because now *all* the rule hooks are in the yy*
namespace.  This makes the API easier to document and remember.

unput() is left in place as a compatibility macro for existing
users, but only documented as a legacy interface.  The "unput"
variants of switches and options have also been retained.
2020-10-12 06:56:56 -04:00
Eric S. Raymond dad680611b Deprecate input(); document yyinput() for the C back end...
...leaving an "input" macro in place for legacy compatibility.

input() had already become yyinput() in the C++ back end in order to
avoid collision with predefibed C++ inoput. In a multi-language world,
this is good policy in general.  There's no real reason for C to
be different, and excellent reason to pull all possible entry
points into the yy namespace.
2020-10-12 05:35:24 -04:00
Eric S. Raymond 526be1f459 Introduce the term "rule hook" so we can use the term "macro" less.
Non-C/C++ back ends won't have macros, so the documentation should
treat macro-ness as an implementation detail when it has to be
mentioned at all - and usually it doesn't.

The key thing about rule hooks like yyless(), yymore() etc. isn't that
they're macros, it's that they can only br used in rule actions (e.g.
inside the body of the genetated tyylex code.

This documentation patch removes the term "macro" where it isn't needed.
2020-10-11 16:55:08 -04:00
Eric S. Raymond f8225f259e Implement and document yystart(), replacing YY_START.
As usual, legacy interface left in place but deprecated.
2020-10-11 15:46:05 -04:00
Eric S. Raymond cecae8b6aa Implement and document %noyyread, replacing YY_INPUT. 2020-10-11 13:04:57 -04:00
Eric S. Raymond 956ac03b7d Refactor YY_INPUT so it calls a new yyread() internal function....
...rather than splicing a bunch of exposed guts into the middle of
yylex().  yyread() is put in the set of functions that gets
prefix-modified.

This means buffer refill can be documented without C-specific
references to YY_INPUT.

It should also enable actually having a non-macro replacement
for YY_INPUT, with a bit more work.
2020-10-11 11:05:12 -04:00
Eric S. Raymond 1094c2a137 Revise Flex manual to say useful things about multilanguage support.
No specific thing can be said about a non-C/C++ backend yet, but
this patch prepares the way by explaining which features and aspects
of the Flex interface are specific to C/C++.

It also fixes one pre-ANSI prototype - that of non-reentrant yylex(),
which should be declared yylex(void) in this day and age.

These changes make one new commitment. Observing that the YY_INPUT
macro is impossible to port out of the C/C++ context, I have observed that
it is probably extinct in the wild (due to the later introduction of
the multi-buffer primitives, though I don't say that explicitly). The
text says tat people who really need the equivalent of this capability
in a non-C/C++ back end should file an issue with the Flex maintainers.

I don't actually expect this to happen.
2020-10-11 05:14:41 -04:00
Eric S. Raymond 3158c7f072 Implement and document %option yylmax to replace #define YYLMAX.
Test in tests/test-yylmax.
2020-10-10 19:25:32 -04:00
Eric S. Raymond 0d1959c595 Implement and document %yydecl directive to replace #define YY_DECL.
Also added a deprecation note abut the old mechanism.
2020-10-10 17:21:11 -04:00
Eric S. Raymond 76affdf894 Deprecate ECHO in favor of yyecho().
I changed the tests to use yyecho(), but the ECHO macro is still
exercised in the bootstrap scanner.
2020-10-09 23:28:42 -04:00
Eric S. Raymond 3612bc281e Deprecate BEGIN in favor of yybegin(). Worst of the awkward squad. 2020-10-09 19:06:32 -04:00
Eric S. Raymond 62a13a3a3d First step towards an interface independent of C macros.
This patch implements and documents a yyreject() macro to replace
argumentless REJECT.  It does not remove REJECT, but warns that this
macro will not be supported in non-C languages and deprecates it.

This commit begins a new appendix in the Flex manual, to list
deprecated interfaces and explain why they have been superseded.
2020-10-09 08:29:55 -04:00
Eric S. Raymond 1e9c36271e Do consistent optimal packing of arrays.
Flex has a strategy of packing its arrays with in32 or imt32 depending
on length, but it wasn't applied consistently. While I don't thinlk this
kind of space optimization matters a lot in 2020, if we're going to do it at
all we should do it thoroughly.
2020-10-08 16:03:03 -04:00
Eric S. Raymond 723fd2c3b4 Remove unused code.
Indepemdent of the retargeting changes.
2020-10-08 14:13:28 -04:00
Eric S. Raymond 700f9d3b6a Eliminate the c_like backend member.
No need for it, since the skel content is in core
and the relevant hook can be searched for.

This is a postscript to the retargeting series.  It's
not necessary, but it imoroves the code slightly.
2020-10-08 14:13:28 -04:00
Eric S. Raymond 8da857acc6 Update the documentation on writing a back end,
It will doubtless need expansion and revision when we actually
write one.

No diffs in generated test code.

#70 and last in the retargeting patch series
2020-10-07 19:11:19 -04:00
Eric S. Raymond 102c7a0149 Finish up macro abstraction.
Everything Flex ships to the skeleton-file expansion phase is
now either a macro expansion or a macro call.  This almost finishes
the retargeting patch series; the wrapup will be documentation.

Sadky, this does not get us *all* the way to target-syntax independence.
The probem is the inclusion of tables_shared.c when table serialization is
enabled. Which ,eans table serialization is not practical to support
outside the C/C++ back end.

No diffs in generated test code from this commit.

#69 in the retargeting patch series
2020-10-07 17:19:31 -04:00
Eric S. Raymond de76933658 Macroize all the remaining code-generation methods.
Produces a tediously large diff in generated test code that
is all table moving around.  This is due to them being shipped
as macros and being substitured in a fixed order determined
by the calls in the skell file, rather than veing generated as
the functrions originally emitting the tables are called.

#68 in the retargeting patch series
2020-10-07 16:35:59 -04:00
Eric S. Raymond 34771445d5 Inline all yydmap entries, get rid of %tables-yydmap.
What it used to do is now handled entirely by macro conditionals.
Besides being a good complexoty reduction in itself, this is one
of the last steps in turning C backend methods into macro deliveries.

Order of the yydmap table is perturbed. No other non-whitespace
diffs and no logic changes,

#67 in the retargeting patch series
2020-10-07 06:28:09 -04:00
Eric S. Raymond fd8748a311 Preparationn for macroizing the last eight methods.
This commit collects several minor changes:

* Fix a minor type specification bug in a tablesext initializer.

* macroize the trans_offset, mkctbl, and mkftbl methods.

* Fix a bug in footprint computation.

This commit oroduces no code diffs in the generated test code, but the
footprint reports change due to the bug fix.

#66 in the retargeting patch series
2020-10-06 14:25:56 -04:00
Eric S. Raymond 716cb63ff2 Tweak the indent style of tables with macroexpanded bodies...
...to have an indent style uniform with the rest of the code,
and one that makes it easier noy to miss the trailing table delimiters.

Not all tables are generated this way yet.  I'm working on it.

Is isolated in its own commit so the format change can't confuse a
reviewer's eyeballs out of noticing real mutations in the table data.

#65 in the retargeting patch series
2020-10-06 01:17:19 -04:00
Eric S. Raymond 96e004a296 Macroize the yy_meta, gen_yy_trans and start_state_list methods.
Also macro-generate yydmap entry for the yymeta table.

We're npw about 75% of the way through pushing all
C syntax out of the method table.
Permutes table order in the generated code.

#64 in the retargeting patch series
2020-10-05 21:02:51 -04:00
Eric S. Raymond 64cf032806 Eliminate a lurking cpp-ism from scan.l
Also, remove now-unused functions from buf.c.
And corral another global.

Produces no diffs in generated test code.

#63 in the retargeting patch series
2020-10-05 20:55:47 -04:00
Eric S. Raymond fafc0ef10c Replace the comment method with a hook macro.
This required addin a new 0.0 breakpoint right after the
M4_HOOK_* definitions so they will be visible early.

Produces no diffs in generated test code.

#62 in the retargeting patch series
2020-10-05 09:28:02 -04:00
Eric S. Raymond 83d8bd5fb9 Enliminate several backend methods by shipping hook macros instead.
They were: geneol, fulltable, eecs, and debug.

To accomplish this, dataend's emission of trailing } needed to be
suppressable.

Also, remove a %% mark that is no longer required.

This doesn't change any of the generated tables, but does change the
orer in which they're generated, froducing large diffs in the
generated test code that don't actually mean anything.  The reason for
this is that tables used to come out in a variable order as functions
like geneecs were called ar variable times depending on the
compressuion mode.  Now, instead, the order is fixed by where the
tanle-body macros these functions define are expanded.

More methods remain to be turnerd into macro generators.

#61 in the retargeting patch series, following an unnumbered
bugfix patch that I shipped in too much of a hurry.
2020-10-05 05:12:49 -04:00
Eric S. Raymond aea91d7e4b Reopair a buuld recipe bug introduced in #52...
...by an icatous replace operation.  Insidious because
it's undetectibe until you run configure again,

Two-phase build systems suck.
2020-10-04 00:17:17 -04:00
Eric S. Raymond e5386ba368 Refactor so all skelout calls are in visible sequence in flex_main().
This makes the overall control flow easier to understand.

#59 in the retargeting patch series
2020-10-03 13:03:28 -04:00
Eric S. Raymond 6c1b4a95f9 Begin replacing method table entries with hook macros
Do this for table opener/closer/continuation syntax, the trace-format
string, the state entry string, constant definitions, the state-dyad
format, and the three pieces of EOF state syntax.  The documentation
appendix on how to write a back end is also updated.

There are comment diffs because I decided generating an
explicit fallthrough marker and some other new explanatory comments
was a good idea.

#58 in the retargeting patch series
2020-10-03 13:03:28 -04:00
Eric S. Raymond ea32296019 As of this commit, all mode symbolds are finally visible.
All symbols except a handful dependent on nultrans and the number of
backups are now written in one visible group right at the start of m4
generation.  The exception are exceptions because their values
are not known until after DFA computation.

Has comment diffs in generated test code due to one symbol rename and
symbols beoming visible. Should be the last time the latter happens.

#57 in the retargeting patch series
2020-10-02 21:57:54 -04:00
Eric S. Raymond 0fc45ce97c Clean up various sporadic symbol definitions that weren't going through ctrl.
Includes handling of --nounistd, --always_interactive, --never_interactive, --stack,
their corresponding lexer items, and and noinput.

An unavoidable side effect is that the place where "#define
YY_NO_INPUT 1" is inserted, if it's inserted. has to move because it's
done by a different route - m4 expansion rather than the action_define
function (which is now gone - this was the last use). I have put the
new insertion point just iin time for the first reference to the macro.

Otherwise the only diffs in generarted test code are symbol
definitions becoming visible.

#56 in the retargeting patch series
2020-10-02 13:13:40 -04:00
Eric S. Raymond 7e77d8f475 Move almost all m4 symbol setting to one spot.
Formerly, Flex's own lexer and the logic for pocessing command-line
options both did calls to write M4 conditionals to a buffer that was
later dumped into the befinning of the text that m4 expands, before
the body of the skel file.

This was bad layering.  Instead, both these places now set flags in
the ctrl structure.  Later, (almost) all the generated m4 conditionals
are shipped at once.

It's "almost" because there are a couple of awkward cases to be
cleaned up.  Again, this was the part that could be done
simply via almost mechanical cut and paste.

In generated code, there are some comment diffs because symbols that
used to be invisibly set are now visibly set - that is, shown at the
beginning of the generated C.

#55 in the retargeting patch series
2020-10-02 05:55:36 -04:00
Eric S. Raymond c5d0e408e2 Methodize a suffix computation and move headerfile into ctrl.
This cleans up some loose ends before the next big move.

#54 in the retargeting patch series. #53 slipped out unnumbered.
2020-10-02 04:55:37 -04:00
Eric S. Raymond 9dbc704ad4 yytext_is_array moves to the ctrl structure.
This is separate from the big reorganization in commit #52 because
there's a comment about this variable in flexdef.h that makes me
nervous.  According to the comment this variable is a trit, but
it looks to me like flexinit sets it to false and I can't find
anywhere in the code that sets it to a non-boolean value.

This commit asumes that the comment is stale and the member
can be typed boolean. Should be audited.
2020-10-02 00:17:31 -04:00
Eric S. Raymond 99e6b1c89a Impose some namespace control on the global variables.
As I was working on some layer separation.  I realized that I
was getting confused a lot by the huge pile of globals that
control this program.

In particular, I need to be able to clearly distinguish those that set
m4 conditional symbols from those that don't.  So I've done something
about it. Almost all globals that can be set by options are now
bundled into two context structures, "ctrl" for options that have
corresponding m4 symbols and "env" for options that don't.

The few I haven't moved have sufficiently tricky interdependencies
that I'm going to break out any changes related to them into smaller
patches that can be easier to review.  In this one I did only the bulk
of straightforward changes that could be done mechanically with search
and replace.

I changed one varuable name to reflext its senantics better;
the performance_report global is now env.performance_hint.

Ideally there ought to be a third structure that bundles all the
shared state used by DFA/NDFSA table computation, so all globals would
live in one of three context structures.  I may do that in a later
commit, but this patch is already unpleasantly large as it is.

No diffs in generated test code, nor any logic changes.

#52 in the retargeting patch series.
2020-10-01 17:40:06 -04:00
Eric S. Raymond 5c6661bb2e Eliminate all uses of buf_strdefine().
There were only two left, for YY_MAIN, and that definition
was moved so it's in the visible controls.

This is a step towards making *all* conditionalization symbols
viible in generated comments.

This commit also cleans up some misnamed mode symbols.  There are
still a couple of duplicative pairs, to be cleaned up in a later
commit.

We can now report generated M4 symbols with values in the "m4
controls" part of a generated file. Partly as a result, the following
symbols become visible in generare code from the tests:
M4_MODE_PREFIX, M4_YY_TABLES_VERIFY, M4_YY_REENTRANT, and
M4_MODE_PREFIX.

No other diffs.

#51 in the retargeting patch series. #50 was accidentally
unnumbered.
2020-10-01 01:34:07 -04:00
Eric S. Raymond 7877454e42 Eliminate the epilog member from the method table.
It was a no-op anyway in the C version, there as a placeholder
in case other languages needed it.  But in the new organization
of things, with everything being done by conditional expansion in
the skeleton file, there's no point.

No diffs at all in generated test code.

Thios does remove some cpde that was conditioned out, an abandoned
attempt to undefine all #defines at the end of code generation.
2020-09-30 21:18:34 -04:00
Eric S. Raymond 8c2d23d9a8 Eliminate the prolog method from the method table.
Now that all the mode conditionals are visible early, wverything that
used to be done in the prolog can be done as conditionalized code in the
skeleton.

Whitespace and comment diffs only.

#49 in the retargeting patch series
2020-09-30 20:53:57 -04:00
Eric S. Raymond 981867ff15 Land the footprint-reporting feature.
Also, clean up some unused and duplicative symbols.

In generated test code, comment and whitespace diffs only
except for YY_INT_ALIGNED going away.

#48 in the retargeting patch series
2020-09-30 08:37:39 -04:00
Eric S. Raymond 31c3f7703d Methodize section marker output and refactor initialization.
The point of this change is to move the setting of the M4_MODE_*
controls up to the front of the generated code so that they can be
used for conditionalization earlier, notably in replacing the prolog
method.  I tried to do this in #46 but dididn't move the mode
setting far enough up.

(Also, rename instances of a duplicated mode switch.)

In generated code, the m4 controls move but nothing else changes.

#47 in the retargeting patch series
2020-09-30 07:29:43 -04:00
Eric S. Raymond abe2c1fe70 Transplant where the mode controls are shipped to earlier.
This should make it possible to eliminate much of the C-specific
prolog code.

Sadly, because of the moves of the generated comments this makes
a rather noisy diff.  All comments and whitespace, though;
what looks like being other than that is pieces of generated code
being shifteed around.

#46 in the retargeting patch series
2020-09-29 21:23:46 -04:00
Eric S. Raymond a9e86a3299 Eliminate two backend methods in favor of m4 expansion.
Produces only whitespace diffs in generated code for tests, except the
order of items in the initializer for table serialization changes.

#45 in the retargeting patch series
2020-09-29 17:18:43 -04:00
Eric S. Raymond 4b952cbf80 Eliminate ugly %define-yytables magic in skelout().
This feature is better implemented with m4 macroexpansion;
that way skelout() does not have to know that #define is a thing.

Also in skelout(), use the backend comment method rather than
embedding knowledge about /* and */, and int_format_define
to factor out knowedge about #define.

Produces only comment diffs in the generated test code.

#44 in the retargeting patch series
2020-09-29 16:53:47 -04:00
Eric S. Raymond 34b84d5823 Narrow the driver interface.
This patch is a pure refactoring step.  It changes the
interface between gen.c and the back end so that the
method table can shed a number of methods and no headers
are generated in gen.c any more.

Most methods now return the amount of memory they
allocate.  Eventually this will be used to add
a report on this to the generated code.

No diffs in generated code, even without ignoring whitespace.

#43 in the retargeting patch series, which turned out
not to be finished after all. These is ugly magic in skelout()
that needs to be factored out.
2020-09-29 04:53:46 -04:00
Eric S. Raymond 103634e4ca Clean up the indentation and brace usage in the skeleton file.
It was in a mix of several different styles tht made it hard
to read.  I've massaged it all ibto K&R with tabs and mandatory
braces.  No logic changes.
2020-09-27 11:08:36 -04:00
Eric S. Raymond 42a39df0f5 Fo;d documentation on how to write bac ends into the Texinfo manual. 2020-09-25 22:14:32 -04:00
Eric S. Raymond c842b49f83 Finish the retargeting patch series with a couple of small fixups.
Pull the C mode setting for M4_YYL_BASE into m4.

Use if/then/else extension of m4_ifdef to simplify how yy_flex_debug
is set.  In the process, fix a bug introduced earlier in this patchest
where yy_flex_debug initialization was inverted.

Remove unused skel breakpoints and renumber those left.

Diffs have only commenmt and whitespace changes *except* for the
corrected initialzation of yy_flex_debug.

#40 in the retargeting patch series
2020-09-25 18:09:44 -04:00
Eric S. Raymond 8521281aef indent_puts and friends go away, they're no longer needed.
I did some indentation of the end-of-file case statements with tabs to
make the generated code a bit more readable.  So there are trivial
whitespace diffs in generated code.

#39 in the retargeting patch series
2020-09-25 15:40:03 -04:00
Eric S. Raymond 219db78e6a Last procedural-code generation in C goes to m4.
Diffs are comments and whiespace, as usual.

#38 in the retargeting patch series
2020-09-25 15:26:06 -04:00
Eric S. Raymond efeb6ef019 m4ize the code for handling NUL transitions.
Finally, scavenge trailing skel breakpoints that are no
longer used, as theey no longer carry information.

Diffs in generated code are all comments and whitesoace, as usual

#37 in the retargeting patch series
2020-09-24 20:40:47 -04:00
Eric S. Raymond 31b751703f Chase down some methodization details missed earlier.
No generated-code diffs from this change.

#36 in the retargeting patch series
2020-09-24 06:52:27 -04:00
Eric S. Raymond d7cb3bf631 Dump the state of the m4 conditionals near start of generated code.
Of course, this produces exactly that in diffs.

#35 in the retargeting patch series
2020-09-24 05:14:05 -04:00
Eric S. Raymond 5cb26ac3f9 Conditionalization of the debug flag moves to m4.
Turned out to be mildly trick because %if/%endif pairs have push/pop
behavior rather than combining.

In generated code, the location of the debug declarations moves,
and that's all.

#34 in the retargeting patch series
2020-09-23 22:21:03 -04:00
Eric S. Raymond c9ade3f92b Methodize whether fullspd mode can use a pointer table.
Presently only C can do this.  Otherwise we fall through to storing
numeric indices for a tiny loss of performance.

No generated-code changes from this.

#33 in the retargeting patch series
2020-09-23 19:49:31 -04:00
Eric S. Raymond ca94d99782 m4ize code generation associated with skel breakpoint 11.0.
Moves one table initializer in the generated code, but doesn't alter
it.

Leaves one FIXME. The computation of M4_YYL_BASE really ought to be
done in m4, but for some unknown reason I couldn't beat it into
dping the right thing.  Do be revisited, bu right now finishing
off the last bits of code generation is more important.

#32 in the retargeting patch series
2020-09-23 19:00:56 -04:00
Eric S. Raymond d45bd0692e Code formerly generated at skel breakpoint 8.0 goes to m4.
No generated-code diffs from this change.

#31 in the retargeting patch series
2020-09-23 19:00:56 -04:00
Eric S. Raymond 2eb82096a4 Move code generation of YY_DO_BEFORE_ACTION to m4.
Generated-code diffs are blank lines with ] continuations and
shifted %% commends made by skel breakpoint directives.  I could garbage
collect those, but I plan to do that all at once in a commit of its
own for clarity's sake.

#30 in the retargeting patch series
2020-09-23 19:00:56 -04:00
Eric S. Raymond d694cb8d3f Push C-generated code for YYINPUT to the m4 skeleton.
Diffs in generated code are trivial, a couple of
blank lines with continuations due to % directives.

#29 in the retargeting patch series
2020-09-23 11:24:11 -04:00
Eric S. Raymond 9cfe5b9b09 All the M4_MODE settings now live in one place where they can be audited.
No changes in generated code.

#28 in the retargeting patch series
2020-09-23 10:50:07 -04:00
Eric S. Raymond 0f2a58a818 Partial m4ization of nultrans code.
Also, remove two insertion points in the skel file
that are no longer used because we're now using m4
conditionals instead.

In the generated C, two magic comments from the insertion points go
away.

#27 in the retargeting patch series
2020-09-23 10:20:48 -04:00
Eric S. Raymond b101188a76 Push the definition of struct yy_trans_info out to m4.
Required defining a new method table entry and shuffling the order in
which things are generated a bit, but the generated-code diffs are all
trivial.  Some comments from the previous C code are now in the
skeleton.

#26 in the retargeting patch series
2020-09-22 20:52:58 -04:00
Eric S. Raymond d5574c7387 Banish gcc warnings so errors won't get lost in the clutter. 2020-09-22 18:44:26 -04:00
Eric S. Raymond feeba9873f Tie up loose ends in the abstraction of table initializer syntax...
...and case statements.  Add guidance to backend.adoc.  This is the
"eventually" promised in the comment on #10 of this series.

No diffs in generated code.

#25 in the retargeting patch series
2020-09-22 12:52:32 -04:00
Eric S. Raymond 9a501a4238 Replace last use of gen_next_compressed_state*( with equivalent m4...
...and then inline the code of gen_NUL_trans() at its callsite.  This
contains all remaining procedural code generation in make_tables(),
on the way to moving it to m4.

Generated code diffs are like those of #20 and #22, for the same
reasons.  They add comments, whitespace changes, and uses of the
YY_NUL_EC and YY+JAMSTATE macros equivalent to the old numeric
literals.

#24 in the retargeting patch series
2020-09-22 11:52:50 -04:00
Eric S. Raymond e7b3a67adf Code to do back-up for compressed tables and set up yy_cp goes to m4.
Also, move the yymatch label to the skeleton. Remove an unused
prototype. And fix a typo.

In generated C, comment and whitespace changes only.

#23 in the retargeting patch series
2020-09-22 10:59:30 -04:00
Eric S. Raymond 01f4aaddd9 gen_next_state(true) becomes m4 code.
As with patch #20 in this series, the changes in generated code fall in the classes:

1. Addition of comments.  I elected to copy the comments from the
   generator functions into their corresponding m4 macros in hopes of
   making the generated code less nasty to read.

2. Lines like "if ( yy_current_state >= 12 )" changing so the numeric
   literal is replaced by YY_JAMSTATE + 1. This was a consequence of the
   change in #15 to simplify the C code generators so they could be
   translated into static nacros.

3. "YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : YY_NUL_EC);:
   being replaced by "YY_CHAR yy_c = (*yy_cp ?
   *(yy_ec+YY_SC_TO_UI(*yy_cp)) : YY_NUL_EC);" The strange way of
   indexing yy_ec avoids a syntactic collision with the use of [] as
   m4 quotes.

The gen_next_state(false) case was translated to m4 at patch #20

#22 in the retargeting patch series
2020-09-22 10:51:23 -04:00
Eric S. Raymond e6fa974cd7 gen_bu_action() becomes m4 code.
Also, two GEN_START_STATE calls get inlined in the skeleton file.

Changes in generated C from the tests are all comments and whitespace.

#21 in the retargeting patch series
2020-09-22 06:08:10 -04:00
Eric S. Raymond 30788806b9 gen_next_match() becomes m4 code.
To verify this patch, notice that the non-whitespace changes in the
generated C from the tests are of only three kinds:

1. Addition of comments.  I elected to copy the comments from the
generator functions into their corresponding m4 macros in hopes of
making the generated code less nasty to read.

2. Lines like "if ( yy_current_state >= 12 )" changing so the numeric
literal is replaced by YY_JAMSTATE + 1. This was a consequence of the
change in #15 to simplify the C code generators so they could be
translated into static nacros.

3. "YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]" being replaced by
"YY_CHAR yy_c = *(yy_ec+YY_SC_TO_UI(*yy_cp));".  The strange way of indexing yy_ec
avoids a syntactic collision with the use of [] as m4 quotes.

#20 in the retargeting patch series
2020-09-22 04:47:05 -04:00
Eric S. Raymond 6711981a2d gen_backing_up() becomes an m4 macro.
Generated-code changes consist of whitespace and a comment.

Thus patch also fixes the computation of two guard symbols
that weren't actually used yet, prospectively introduced in
patch #15 of this series. At the time I wrote that I didn't
understand what num_backing_up was doing and failed to
translate it properly.

#19 in the retargeting patch series
2020-09-22 03:16:04 -04:00
Eric S. Raymond abe63d33d1 Push code generation for some housekeeping from gen.c to m4.
The pieces are BOL checking, yylineno updating, and YY_RULE_SETUP
generation.

No generated code changes at all from this.

#18 in the retargeting patch series
2020-09-22 01:32:40 -04:00
Eric S. Raymond feac8a6abf Clean up a couple of methodization loose ends.
Generated-code differences are trivial whitespace.

#17 in the retargeting patch series
2020-09-22 00:14:56 -04:00
Eric S. Raymond 2ab6a3baf7 Move debug code generation from C to m4.
Differences in generated code are trivial. Some integer
literals turn into symbol expressions as a side effect
of the previous patch.

#16 in the retargeting patch series
2020-09-21 23:04:50 -04:00
Eric S. Raymond 90bf7c7bcb Create m4 symbols for things that used to be generated as int literals.
Changes the generated C sources from the tests, but only by making
them easier to read.  In future patches this is going to make them
easier to compare by eyeball as well.

#15 in the retargeting patch series
2020-09-21 22:01:41 -04:00
Eric S. Raymond f858b63e23 Turn gen_start_state() into an M4 macro.
This is the first patch in the retargeting series to substantively
modify the skeleton file.  (The only previous one to touch it just
renamed a mode switch.)

Adds some comments and whitespace to the generated code in the tests,
but produces no logic changes.

#14 in the retargeting patch series
2020-09-21 17:11:29 -04:00
Eric S. Raymond 5f41ac5a99 Create a TESTOPTS variable that can be used to pass options to flex in testing.
Presently this is used to pass -L, making it easier to compare changes
in generared C code cross revisions.

To perform such comparisons, do this at a base (before) revision:

# Make generated code
make clean; (cd tests; make clean); make check

# Save a smashot of it
rm -fr snapshot && mkdir snapshot && cp tests/*.c snapshot

Then rebuild at the later revision and do this:

# Compare gemerated code to snapshot
do diff -b -B -u $x tests/`basename $x`; done

#13 in the retargeting patch series
2020-09-21 10:35:18 -04:00
Eric S. Raymond cd01f7ff4e Remove a redundant macro guard setting....
...and clean up some comments.

Removal should have happened in #11 when the
guard symbol was renamed.

#12 in the retargeting patch series
2020-09-21 00:45:47 -04:00
Eric S. Raymond cdb639cd7b Add code to initialize the macro conditional symbols we'll need.
These aren't used yet.  They will be as we push code feneration out
of gen.c into the epansion of the m4 skeleton.

This is the first revision to touch the C skeleton file, changing
M4_YY_USES_REJECT to M4_MODE_USES_REJECT for uniformity with the other
mode switches.

C code generated from the tests is still unchanged at this revision.

#11 in the retargeting patch series
2020-09-21 00:21:42 -04:00
Eric S. Raymond ef4f78f43b Continue methodization, with some target-language-specific formats...
...and one additional method.

This almost finushes off all language-specfic detauks outside of
gen.c.  The one exception is just below the comment "add terminator
for initialization" in dfa.c; we'll get to this eventually.

#10 in the retargeting patch series
2020-09-21 00:05:05 -04:00
Eric S. Raymond c0ca7faab9 Two member name changes in the method table.
Cosmetic change,

#9 in the retargeting patch series
2020-09-20 23:17:00 -04:00
Eric S. Raymond e58cdd1de0 Start a HOWTO on writing target-language back ends.
#8 in the retargeting patch series
2020-09-20 22:38:31 -04:00
Eric S. Raymond 673f2caf34 Methodize generation of C initializers for automaton tables.
A large patch, but conceptually simple. Takes a bunch of functions and
callsites that knew details of C initializer and declaration syntax
and moves them into methods in the C backend table.

This is a pure refactoring step.  At this point in the patch series,
not only do all tests pass but nothing in the lex-generated C code
from the tests has changed.

#7 in the retargeting patch series
2020-09-20 21:55:07 -04:00
Eric S. Raymond 2cce209b58 The C/C++ back end moves to its own source file.
Someday, there might be go-backend.c etc.

#6 in the retargeting patch series
2020-09-20 20:52:01 -04:00
Eric S. Raymond bb9f458eb1 Generated skel data is now stuffed in an array in the C/C++ back end.
This means it's possible to have multiple language-specific skel
files.  All go through the same double m4 macroexpansion.

#5 in the retargeting patch series
2020-09-20 20:52:01 -04:00
Eric S. Raymond f754c608ff Pull the format for error-tracking lines into the method table.
#4 in the retargeting patch series.
2020-09-20 18:36:39 -04:00
Eric S. Raymond f1bfe65b3d Create a method table for the C back end,
#3 in the retargeting patch series.
2020-09-20 18:36:39 -04:00
Eric S. Raymond a05e39ae47 Factor out the wrap function for C/C++ parser generation.
#2 in the retargeting patch series.
2020-09-20 18:36:39 -04:00
Eric S. Raymond f0161f217e Refactoring step - separate output generation from option processing.
#1 in the retargeting patch series.
2020-09-20 18:36:39 -04:00
Eric S. Raymond 04c5b7c920 remove some gcc warnings 2020-09-06 11:21:46 -04:00
Joerg Sonnenberger a631f5da8d correct some indentation in skeleton 2020-04-24 12:06:24 -04:00
Will Estes 8b1fbf674f doc: document release page in README 2019-09-12 16:42:40 -04:00
Will Estes d3de49f842 doc: new translations 2019-06-20 14:05:30 -04:00
Houtan Bastani 1d27d6343e doc: fix typo 2018-11-26 15:51:23 +01:00
Explorer09 9be1980ef2 build: Fix autogen.sh $LIBTOOLIZE detection logic
* Don't silence `libtoolize --version` error message. It would be
useful for diagnosing any problem when `libtoolize --version` fails.
(libtoolize not found? No permission to execute? Now you know which
error it is.)
* Change the guessing code of libtoolize program name to a loop.
It'll perform silently.
* Silence the `libtoolize --version` output when it succeeds.

Signed-off-by: Kang-che Sung <explorer09@gmail.com>
2018-09-22 11:01:53 +08:00
Explorer09 8900923e91 build: autogen.sh libtoolize invocation minor fixes.
* Let autogen.sh error message go to stderr.
* Don't quote the variable $LIBTOOLIZE when invoking it. This would
allow invocation when LIBTOOLIZE='a-future-libtoolize --gnu-compat'

Signed-off-by: Kang-che Sung <explorer09@gmail.com>
2018-09-22 11:00:18 +08:00
Explorer09 98018e3f58 scanner: Include-guard flexint_shared.h
This prevents compiler's "redefinition of typedef" warnings or errors
when we could include flexint_shared.h twice, when building flex's own
scanner (scan.c) or in the "multiple_scanners" test in the testsuite.

(Depending on the compiler's flags this might or might not produce
errors, but it's good to guard it anyway.)

Fixes: #329

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-05-22 16:56:52 -04:00
jannick0 21121feec9 scanner: no YYTABLES_NAME macro unless requested 2018-05-22 16:51:26 -04:00
Will Estes 4c7e3a5a67 po: include update_linguas script in distribution.
Since automake takes a hands off approach to the po/ directory, we
need to list update_linguas.sh in the top Makefile.am. We list it as a
dist_noinst_SCRIPT so that it will get distributed with executeable
permissions. We also list autogen.sh in the same way for the same
reason.
2018-05-07 15:53:26 -04:00
viktor.shepel a752d7c1c2 doc: display build status badge in README 2018-05-07 14:58:48 -04:00
Simon Sobisch 60b578fdaa doc: describe mailing list usage in more detail 2018-04-07 13:26:34 -04:00
Jannick b33fd4c43a doc: amend manual section on state stack functions. 2018-03-13 10:45:56 -04:00
jannick0 3971b6146a scanner: fix default of yy_top_state()
extend fix when `YY_G` is used (reentrant scanner).
2018-03-13 10:45:42 -04:00
jannick0 67b3e44872 scanner: fix default of yy_top_state()
For an _empty_ state stack the top of the state stack defaults to the state as if no state stack were present.

NB: sanity check for `yy_start_stack_ptr` could be added in `yy_top_state()`.
2018-03-13 10:45:16 -04:00
Explorer09 6a6e69af76 build: Add "-f" flag to "mv" in makefiles.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-12 10:34:36 +08:00
Explorer09 dcd8e8b401 build: Fix makefile dist-hook directory permissions.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-12 10:15:31 +08:00
Explorer09 e1f6b4a263 scanner: More compatible flex integer type definitions.
Visual C++ 2010 does not define __STDC_VERSION__, and (before Visual
C++ 2013) has <stdint.h> and not <inttypes.h>.

ANSI/ISO C only requires at least 16 bits for int type (not 32 bits as
required by POSIX since SUSv2), so check the bit length before the
typedef.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-08 16:00:24 -05:00
Explorer09 5574881ff4 scanner: Skeleton no longer includes integer limit macros.
The [U]INT{8,16,32}_{MIN,MAX} macros are never used in skeleton code.
Having them in skeleton just increases the chance of conflicts in case
that user defines them in non-C99 environment (see issue #307, when
flex code is built in Visual C++ (before VS2013)).

flexint.h is now split in two files. Only "flexint_shared.h" will be
included in skeleton now, which defines flex integral types.
flexint.h contains integer limits macros that would be used in flex
only.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-08 16:00:24 -05:00
Explorer09 ec4f23d5d2 scanner: Add a fallback INT_MAX definition.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-08 16:00:24 -05:00
Explorer09 1985bb3c7a scanner: correct comments about __STDC_LIMIT_MACROS.
No code changes.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-08 16:00:24 -05:00
Explorer09 4081efa083 scanner: Fix glibc features.h dependency in skeleton.
Commit a17d79e9c7 defines _POSIX_C_SOURCE
to the minimum of 1 if it's not defined in the user's scanner code or
the compiling environment. However in glibc the macros are not yet set
up until one of the libc headers is included. This unfortunately have
made us overwrite the default _POSIX_C_SOURCE value that would be
defined by glibc (200809L at the time of writing), causing regressions
in user code.

Now in this patch:
1. Ensure feature test macros have been set up in glibc before checking
or defining any of them in our skeleton code.
2. Have a more conservative logic when determining the need to define
_POSIX_C_SOURCE (required for fileno()).

Fixes: #313

Note:
It could be tricky for application code to ensure feature test macros
have been set up in glibc, since <features.h> is no portable header and
not meant to be included directly by applications. The way to do it is
to include a libc header which in turn includes <features.h>. However,
many of the glibc headers check __USE_POSIX (a glibc internal macro
defined if _POSIX_C_SOURCE is defined) and determine which interfaces
to expose already, making the headers inappropriate for our goal.
Those which don't depend on _POSIX_C_SOURCE, and are also available
since ANSI C89, are only <assert.h>, <errno.h> and <math.h>.

<assert.h> is finally favored due to other considerations:
- <math.h> check for __USE_XOPEN in glibc, making a dependency on
_XOPEN_SOURCE, besides it exposes much more interfaces than we need.
- In djgpp, <errno.h> depends on _POSIX_SOURCE to hide definitions of
some errno values when it's defined.
- <assert.h> exposes the fewest interfaces among the 3 headers and, at
the time of writing, checks for only C99 (for __func__), C11 (for
_Static_assert), and _GNU_SOURCE when needed.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-08 10:04:36 +08:00
Explorer09 d5023f5a48 scanner: Fix scan.l xgettext warnings.
xgettext was not very clever at interpreting lex patterns and can get
confused when seeing unquoted quotation marks, and emit warnings for
them. Now fix the warnings by properly quoting the quotation marks in
lex regex patterns.

Example
    Original: \"[^"\n]*\" -> "warning: unterminated string literal"
    Fixed:    "\""[^""\n]*"\"" -> OK

My basic build test shows that the generated stage1scan.c is
bit-identical to the original.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-04 20:51:38 +08:00
Explorer09 e104f5589c travis: '--disable-acl' when building gettext
This silences a configure warning about libacl not found in Travis
build log.
2018-03-01 14:08:54 -05:00
Explorer09 6aa652b089 travis: Silence build output of automake and gettext
Only when a build error occurs on building any of these dependent
packages do we dump some sensible logs to standard output.
2018-03-01 14:08:54 -05:00
Kang-Che Sung e63c0bb6b6 travis: Hard-code hashes for verifying tarballs
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 the hashes, provided they're trusted (i.e. you verify a hash
against a GPG signature once).

Fixes: #311.

As a side note: the original two signatures
(gettext-0.19.8.1.tar.lz.sig and automake-1.15.1.tar.gz.sig) are signed
against the files' SHA-1 hash.
2018-03-01 14:08:54 -05:00
Explorer09 c42de062bb build: Move dnl comments out of AC_CHECK_FUNCS
Due to a bug, autoheader (2.69) will treat M4 dnl comments in a quoted
argument of AC_CHECK_FUNCS as function tokens and generate a lot of
redundant and useless HAVE_* macros in config.h.in.
(Examples: HAVE_DNL, HAVE_AVAILABLE_, HAVE_BY)

It seems to be this commit dbb4e94dc7 of
mine that revealed this autoheader bug, and the affected config.h.in
had been shipped within flex-2.6.4 release tarball.

I have reported the autoheader bug here:
<https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html>

As a workaround, let's move comments out of AC_CHECK_FUNCS.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-02-28 19:30:56 -05:00
Explorer09 065c9fbe22 test: Remove redundant '-o $@' in tableopts.am
$(LINK) in Automake already contains the '-o $@' arguments.
2018-02-24 23:12:09 +08:00
Will Estes ff7bc8af46 doc: list travis in NEWS [skip ci] 2018-01-03 08:49:00 -05:00
Will Estes c0508df61d initial .travis.yml file 2018-01-03 08:49:00 -05:00
Explorer09 e7d45afc6a scanner: Allow "--" as option argument.
Previously, invocations such as:

    flex --outfile -- wc1.l

 would fail with "requires an
argument" error message.

Fixes #285
2017-12-09 16:29:52 -05:00
Explorer09 c984ab0fd0 scanner: scanopt_err() now returns void 2017-12-08 09:56:18 -05:00
Explorer09 aa775c8711 scanner: simplify scanopt_usage().
In-function macro CALC_LEN removed and no longer needed.

Local variable renames:

    maxlen[0] => opt_col_width

    maxlen[1] => desc_col_width

    indent now explicitly const
2017-12-08 09:55:19 -05:00
Explorer09 23882383d4 scanner: prevent overflow in add_action() 2017-12-06 16:23:25 -05:00
Michael W. Bombardieri 08e1b25b0e scanner: use calloc to allocate new filter memory 2017-11-29 08:11:22 -05:00
Explorer09 87472f5aa7 Obsolete yypad64() macro.
Slightly rewrite the logic in yytbl_data_load() and yytbl_write_pad64()
so they simply check if the bytes read/written are in 8-byte boundary.
No need to calculate how many bytes we need to pad. (Incidentally this
makes smaller code in x86_64.)

For yytbl_hdr_init(), just expand the calculation from the macro.
2017-11-28 15:06:10 -05:00
Explorer09 12d2f86080 scanner: temporarily protect against ccl overflow & overwriting.
For ccladd(), if cclp given is a non-last ccl, adding a char into it
will overflow the buffer and overwrite the first char in the next ccl.

For now, add a temporary detection and protection code.  (Not sure if
this could happen in user input, but if it could, then you can expect
some "corrupted" behavior for generated scanners.)
2017-11-28 14:56:42 -05:00
Explorer09 ea1faa2d09 build: fix ENABLE_NLS preprocessor check.
Because ENABLE_NLS may be defined to 0 (manually, not through
autoconf) and it's semantically incorrect to only check whether it's
defined.

This is a correction to commit
661d603b65.
2017-11-28 14:09:04 -05:00
Explorer09 11b7512664 scanner: Rename genecs() local variables. No code changes. 2017-11-03 19:12:49 -04:00
Explorer09 3c0f34cf12 scanner: Remove unused BASENAME() macro.
(Simply forgot to do so in commit fb731ac022)
2017-11-03 18:41:16 -04:00
Alex Richardson 661d603b65 build: use #ifdef for ENABLE_NLS check.
config.h will have either define ENABLE_NLS or not define it. If it is
not defined we get a -Wundef warning due to using #if with an
undefined macro
2017-11-03 10:39:32 -04:00
Explorer09 a17d79e9c7 scanner: Define _POSIX_C_SOURCE when needed in skeleton.
The function fileno() is defined by POSIX. When flex would otherwise not provide that feature macro, we define it.

Fixes #263
2017-11-03 10:19:21 -04:00
Lukasz Baj 0db9f8903a build: Remove custom reallocarray() declaration.
Use one from <stdlib.h> instead because that is more portable.
2017-10-05 11:31:18 -04:00
Explorer09 37a6184dab scanner: Simplify PRINT_SPACES() macro 2017-10-05 11:27:54 -04:00
Explorer09 24fd055133 build: AC_USE_SYSTEM_EXTENSIONS in configure.ac.
This would, e.g. define _GNU_SOURCE in config.h, enabling the
reallocarray() prototype in glibc 2.26+ on Linux systems with that
version of glibc.

Fixes #241.
2017-09-04 11:22:30 -04:00
Will Estes 1d62d3eb24 doc: document config.h inclusion by flex itself 2017-09-03 21:25:57 -04:00
Explorer09 4b5111d977 scanner: Include flexdef.h at %top block of scan.l
config.h may define macros that alter the API of the standard library
funtions, and so it should be included before any other standard
header, even before the skeleton's standard header inclusion.

For example: config.h may #define _GNU_SOURCE that would expose the
reallocarray() prototype from <stdlib.h> on glibc 2.26+ systems. If we
include <stdlib.h> before config.h, reallocarray() would not be
available for use in lex file since the second include doesn't help
due to header guard.

For now our config.h might `#define malloc rpl_malloc` -- this
substitution must work before including stdlib.h, or else the compiler
will complain about missing prototypes, and may result in incorrect
code in scan.l (gcc warning: return makes pointer from integer without
a cast [-Wint-conversion]).

Fixes #247.
2017-09-03 21:17:59 -04:00
Explorer09 f2943389fd {re,}allocate_array code cleanup 2017-09-02 15:09:28 -04:00
Will Estes 71d3525ad2 doc: document libfl targets in Makefile 2017-09-02 15:07:52 -04:00
Explorer09 dd1afa37e1 build: Add convenience targets to build libfl only
These are wrappers around automake- and libtool-generated targets,
allowing users to build libfl only, without the main flex program.

See GH-256 for discussion.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2017-08-31 15:54:02 -04:00
Will Estes b84ad149c9 doc: document src/libfl in NEWS 2017-08-31 15:51:25 -04:00
Explorer09 08e19c55ca Don't install libfl.pc if --disable-libfl. 2017-08-27 00:18:44 +08:00
Explorer09 e199cb6bdf libfl.pc: Rewrite descriptions, remove unneeded Cflags.
There's no need to include any header when linking with `-lfl`.
2017-08-27 00:18:32 +08:00
Explorer09 7e06407175 Move libfl.pc.in to src subdirectory. 2017-08-27 00:17:57 +08:00
Will Estes 931d29bdea doc: NEWS updates 2017-08-24 09:26:02 -04:00
Explorer09 b115f389b2 Hardcode flex name in --help text
Don't use program_name in the description of -T/--trace or -V/--version
option. It's ugly when user invokes flex with a long path like
"/home/username/tools/bin/my-custom-built-flex".

This solution is not long term. If possible, the help text should be
modified so that the "flex" name is no longer needed below the first
"Usage:" line. All translations of help text will need to be updated
as well.
2017-08-24 08:34:23 -04:00
Explorer09 a657f0c6f5 Remove an unneeded gettext() in --version output
"%s %s\n" is not translatable
2017-08-24 08:34:23 -04:00
Explorer09 fb731ac022 scanner: remove BASENAME(); don't strip path from program_name
There's no technical need of stripping path from program_name. I think
the users should be fine if they see the path they use to invoke flex
is diagnostic messages and help texts.

Yes, users will see "Usage: ../flex [OPTIONS]..." now if they invoke
flex with the path "../flex".

The --version output has been changed so that the name field will be
always "flex" or "flex++". If the flex program has been renamed to
"lex" (for compatibility or other reason) this will allow identifying
the implementation name ("flex"). (And it's a recommended practice in
GNU Coding Standards)
2017-08-24 08:34:23 -04:00
Will Estes d64a5263cf build: sort .gitignore 2017-08-24 08:18:11 -04:00
Michael Haubenwallner 24e73c4446 have libobjs depend on libobjdir (#244) 2017-08-24 08:15:00 -04:00
Will Estes aa50a492fc build: git ignore libfl.pc 2017-08-24 08:02:19 -04:00
Tyler Slabinski c1ed5df2f6 Create libfl.pc target for pkgconfig 2017-08-24 07:52:13 -04:00
Jannick 535524ea6b scanner: #define BASENAME, remove #include libgen.h 2017-07-17 21:12:44 -04:00
Jannick 3f2b9a4d63 mkskel.sh: fix EOL issue for CRLF systems 2017-07-18 02:03:45 +02:00
jannick0 7af066b952 scanner: Ignore comment lines in skeleton files.
In skeleton files comments are indicated by leading `%#` and when
directly read in using `flex -S <skeleton.skl>` they should be
ignored. Example: `flex.skl`.

Amending commit 2f21edac99 which removed
this conditional branch.
2017-07-15 18:52:28 -04:00
Explorer09 e784a805ef filter: faster is_blank_line implementation
Using regex_t regex_blank_line is *slow*.
2017-07-15 18:31:41 -04:00
Explorer09 0f370436e1 filter: new internal function is_blank_line()
It's simply to return (regexec(&regex_blank_line, str, 0, NULL, 0) == 0);
The reason for encapsulation is to allow replacing this with a
non-regex method if necessary.
2017-07-13 15:15:29 -04:00
Will Estes 19cffb0ff0 build: require automake, gettext versions as per maintainer dev setup 2017-07-13 15:14:58 -04:00
Will Estes 36c2c0a2e8 doc: NEWS memory leak fix 2017-07-03 11:49:36 -04:00
viktor.shepel faa877a843 scanner: memory leak free scanner generator.
**Issue:**
Scanner generation leaks memory for transition tables when invoked
without `--tables-file` option.

**Root cause:**
`gentabs` function has different memory acquire/release conditions.

**Solution:**
Reclaim memory at the same scope where it was alloacated.
2017-07-03 11:45:55 -04:00
viktor.shepel 8a044dbe6d filter: memory leak free scanner postprocessing.
**Issue:**
Scanner postprocessing leaks memory during correction of `#line`
directives values and generation of C header file.

**Root cause:**
`filter_fix_linedirs` and `filter_tee_header` functions do not
dispose allocated memory.

**Solution:**
Automatically reclaim affected memory by allocating it on stack
insted of heap. Stack allocation should not be a problem as its
only 512 bytes and there is no recursive calls.
2017-07-03 11:45:37 -04:00
Will Estes ef32155253 doc: NEWS c{i,j} 2017-07-03 11:34:14 -04:00
NieDzejkob ea4b0a129e scanner: c{i,j} should preserve case.
Fixes #193
2017-07-03 11:34:00 -04:00
Will Estes 6bebb264a9 doc: document --backup-file in NEWS 2017-07-03 09:46:48 -04:00
EricSharkey c55bf919cc scanner: add optionn to specify backup filename.
In a directory containing multiple scanners, we want to allow
specifying the name of the backup file else the backup files will be
overwritten.
2017-07-03 09:41:42 -04:00
Will Estes 8bd14f1387 doc: new uk translation 2017-06-18 13:56:06 -04:00
Translation Project 90c62441b3 doc: new uk translation from the Translation Project 2017-06-18 13:55:11 -04:00
Explorer09 9e00f250f6 doc: formatting fixes in README 2017-06-04 16:20:04 -04:00
Explorer09 b4735d6925 test: echo 'set -v' before setting so in shell. 2017-06-04 16:15:23 -04:00
Will Estes 71b9c0cedc doc: tableopts rule portability mentioned in NEWS 2017-05-26 11:23:12 -04:00
Will Estes 2c0152a0c3 test: remove duplicate shell options line 2017-05-26 11:21:16 -04:00
Explorer09 1f3db3aeb3 test: use portable pattern substitution in tableopts.sh
Fixes: #222
2017-05-24 15:33:09 +08:00
Will Estes db4f5e0fe5 doc: document NetBSD build crash fix 2017-05-19 08:05:51 -04:00
Will Estes 2ae437ad54 build: remove automake check-news 2017-05-19 08:03:48 -04:00
Thomas Klausner 2b290d8ebd scanner: Use reallocarr() when available.
NetBSD had a crash during build. Since the provided substitute for
reallocarray() wasn't working, use NetBSD's reallocarr(). Let
configure choose that function whenever it is available. Use
reallocarray if available. Still fallback if neither is available.

Fixes #219
2017-05-19 07:29:15 -04:00
Will Estes 3a70bac04a doc: list line number directives in NEWS 2017-05-14 07:16:45 -04:00
Jeff Smith 2c7e34bb95 filter: Output correct #line value for current file.
A #line pre-processor directive specifies the line number and source
file of the following lines. If the source file _is_ the current file,
the line number should be that of the line following the directive. So
the specified line number should be the current line number plus 1.
2017-05-14 06:31:56 -04:00
Will Estes 596a221844 scanner: corrected typo 2017-05-13 17:24:55 -04:00
Will Estes 0be3198908 doc: noyyget/set_column options documented 2017-05-13 17:23:18 -04:00
Will Estes 5cadd124f8 scanner: finish support for noyy{get,set}_column.
Unattributed patch carried over from sourceforge bug tracker.
2017-05-13 15:15:45 -04:00
Will Estes 7284970311 build: .mailmap for cleaning up shortlog 2017-05-13 14:24:17 -04:00
Hans-Bernhard Broeker 2c3f463909 test: rename some files for non-case-sensitive filesystems.
-C*f and -C*F option-specific test files collide on case-insensitive
file systems, and cause tests to either not be run at all, or to
overwrite each other's files at build time.  So rename -C*F ones to
-C*_F.
2017-05-06 20:46:20 -04:00
Will Estes af72e9e222 build: 2.6.4 is previous version 2017-05-06 20:26:28 -04:00
Will Estes 385766c5cf build: ignore .sig files.
We generate gpg signatures in place for releases. Since these should
not be tracked in the flex repo itself, we tell git to ignore them.
2017-05-06 16:54:54 -04:00
Will Estes 5dfc45ef5a build: no longer ignore *.tar.bz2
Since we no longer generate *.tar.bz2 archives, we do not need to tell
git to ignore them.
2017-05-06 16:53:14 -04:00
Will Estes ab49343b08 gettext: pulled latest translations; recompiled against current sources 2017-05-06 16:34:36 -04:00
Will Estes 0cfad78b32 version 2.6.4
* NEWS: Record release date.
2017-05-06 16:34:35 -04:00
Will Estes 31cdc1f095 note previous version 2017-05-06 16:34:35 -04:00
Will Estes 3d843a0f8d doc: update NEWS for upcoming release 2017-05-06 16:34:35 -04:00
viktor.shepel 7889866f58 doc: Correct typo in C code sample in manual 2017-05-06 10:56:29 -04:00
Explorer09 e5c7ad3aec scanner: Mention %# comments are removed when building skel.c 2017-05-06 10:51:48 -04:00
Demi Obenour a1634aa8d3 Honor user definitions of yy_* macros
The user may have defined the yy_* macros themselves.  In that case,
don't clobber them.
2017-05-03 16:16:37 -04:00
Demi Obenour d564d45477 Don't leak macro definitions into header files
This allowed unnamespaced definitions to leak into header files,
breaking client code.

Fixes #142
2017-05-03 16:16:37 -04:00
Demi Obenour ba530cd52f scanner: Check for 0 bracecount when EOL ends quoted literal.
This can happen in the case of // comments (which Flex doesn't handle
specially).
2017-05-03 16:13:39 -04:00
Demi Obenour b1c2957b3f scanner: when bracelevel is negative, treat as zero.
This really should never happen, but this at least fixes the
breakage on Verilator.
2017-05-03 16:13:02 -04:00
Jeff Smith 8b746fa025 test: enable more silent building of tests.
When running 'make V=0 check', some compile and link steps are made
less verbose and some are not.  This cleans up most steps that are
not.

These have no effect if V=0 is not specified.
2017-05-03 14:27:42 -04:00
Demi Obenour 2f21edac99 build: Delete comments from skeleton file.
Since the comments in flex.skl are, by hypothesis, not needed in
skel.c, we remove them. THis reduces the size of the resulting
executable somewhat.
2017-05-03 13:24:09 -04:00
Explorer09 2592576239 build: do not generate lib/Makefile.in.
Files in lib/ are picked up and built using makefile directives in
src/Makefile.am. Remove the need to generate lib/Makefile.in and the
stub lib/Makefile.am.
2017-05-03 13:14:16 -04:00
Will Estes 9131b8426a gettext: revert listing generated .c files 2017-05-02 20:39:15 -04:00
Jeff Smith 88b8e2a9d5 FLEX_EXIT() is the preferred way to exit flex 2017-05-02 15:31:05 -04:00
Explorer09 47d6a45345 Fix myesc() 'sptr' conditionals
* Don't call isascii() here. It's deprecated in POSIX and not needed
  for myesc's case.
* The check of the character class and range here should match what's
  defined as {ESCSEQ} in scan.l, so for [[:xdigit:]] we use isxdigit();
  for [0-7] we check '0' <= c <= '7' (not isdigit(c) because isdigit is
  locale-dependant in standard's sense)
* Add missing length limit for "\x<hex>" (<hex> is at most 2 digits)
2017-05-02 15:14:25 -04:00
Explorer09 d4ab90f185 Obsolete htoui() and otoui(); use strtoul().
No sense to keep these two function when libc's strtoul() can do the
same job, but better.
2017-05-02 15:14:25 -04:00
Todd C. Miller 09697fb269 scanner: update yy_buf_size after yyrealloc() 2017-05-02 15:08:10 -04:00
Simon Sobisch c2ceb3e129 build: use lowest versions for gettext, automake. 2017-05-02 14:56:59 -04:00
Simon Sobisch 5b30b23fe9 gettext: more recent makevars; new script to update po files.
Previously, "make dist" and similar commands would cause the po files
to be updated, which is incorrect. The more recent version now used
should not do this.

Replaced Rules-getpo by extra script to manually update and rebuild all po files.
2017-05-02 14:56:59 -04:00
Simon Sobisch 3211921c23 gettext: list generated files instead of flex, bison sources in POTFILES.in.
Listing the flex and bison sources -- as the gettext manual suggests
-- causes warnings. Listing the generated C files for the lexer and
parser removes the warnings. Since both files contain line directives,
any translator who needs to refer back to those files should be able
to find the context in which strings are needed.
2017-05-02 14:56:38 -04:00
Simon Sobisch 4efcf28ee6 build: only touch ChangeLog if it does not exist 2017-05-02 14:43:49 -04:00
Simon Sobisch 634ef8a945 build: list earliest useable versions for automake 2017-05-02 14:43:49 -04:00
Simon Sobisch 0a9687d138 build: check for how to call libtoolize.
Previously, we would call libtoolize and if that failed, we would call
glibtoolize since some platforms have the libtoolize program under
that name.

Instead, we check to see if the environment variable LIBTOOLIZE is set
and use that if so. Otherwise, we try to find a program "libtoolize"
on the path and failing that glibtoolize. We alert the user if no
suitable program can be found.
2017-05-02 14:43:49 -04:00
Alastair Hughes 89f10ee36f build: support cross compiling.
Check for cross compiling. If cross compiling, build stage1flex using a
custom link command.
We also override LDADD since that adds the replacement implementations
that are cross compiled, and instead always use the replacement library
implementations.

We don't use BUILD_OBJEXT and BUILD_EXEEXT since it seems that automake
does not support these.

Fixes #78.
2017-02-23 14:07:56 -05:00
Explorer09 d1b195b671 build: Include <strings.h>; add strcasecmp() check to configure.
strings.h (not string.h) is the standard-defined include header for
strcasecmp(). Include <strings.h> for portability (even though glibc
exposes strcasecmp() declaration also in <string.h> by default).
2017-02-17 16:56:21 -05:00
Explorer09 dbb4e94dc7 build: Let configure error if missing required functions, headers..
`configure` will now error if a required header or function is not
found on the system.

Also add comments on optional functions checks.

Add sys/stats.h and sys/wait.h to list of required headers in
configure.

This fixes issue #180.
2017-02-17 16:55:33 -05:00
Explorer09 c7a545ae09 scanner: compute powers of two faster.
Replace the naive "for" loop in determining power of two with a clever
bitwise solution. This code is around the Internet already and is in
Public Domain.
2017-02-16 13:26:21 -05:00
Explorer09 122e58965a test: skip pthread test when needed files missing.
"Unlisting" the pthread test when libpthread is not available is never
a good idea. Should let it compile into a stub program that returns
the "skip" status.

configure.ac and tests/Makefile.am are edited so that pthread test can
be built anyway, but only works (not as the stub) when both pthread.h
and libpthread are detected on the system.

Also fix a small typo in tests/pthread.l comments.
2017-02-16 09:33:35 -05:00
Will Estes 2e820b6015 build: mv scan.c when building dist.
Revert change to copy scan.c when building the distribution
archive. Move it instead. This satisfies automake's notions of what
should be clean and ensures that the distribution archive contains a
just-built copy of scan.c.

Fixes #186
2017-02-16 09:27:22 -05:00
Will Estes 44f10b366f build: don't assume distdir/scan.c is writeable 2017-02-06 12:04:03 -05:00
Explorer09 a7adbf20a9 build: Add dist-hook to force remake scan.c.
This will ensure the flex scanner included in release tarball being
generated by exactly the flex version to be released.

Here's one catch after this change: You may not run "make dist" or
"make distdir" if you configure the flex source to be cross-compiled.
2017-02-06 11:48:05 -05:00
Explorer09 dae5c22f87 build: respect '--localedir' from configure.
Makefile shouldn't overwrite the 'localedir' variable, because that's
what '--localedir' option in 'configure' is for.
2017-02-06 11:45:09 -05:00
Explorer09 dec3a380e5 build: Remove "-I$(top_srcdir)/intl" from CPPFLAGS.
Revert commit e02c3d27ee

("include the intl/ subdirectory when searching for include files")

Flex doesn't come with libintl source code, so inclusion of
$(top_srcdir)/intl subdirectory during compiling is unnecessary.

This flag seems to be left after "remove intl from dist"
(commit 8f45da06ad) without someone
cleaning this up.

Users who need to build with gettext functionality from libintl would
use the '--with-libintl-prefix' configure option.
2017-02-06 11:44:13 -05:00
Explorer09 e2d569053a scanner: fix regcomp's error reporting, double malloc.
Fix unneeded double malloc - let regerror(). Write its message after
our "regcomp for (regex) failed: " string.

Also, errbuf cannot be free()'d because of flexfatal containing a
longjmp.
2017-02-06 11:37:18 -05:00
Explorer09 3c0ccc4520 test: Skip bison tests if bison is not available 2017-01-25 10:33:06 -05:00
Explorer09 546851ba35 build: remove repeated bison detection from configure.
AC_PROG_YACC already detects the bison program. We can just use it,
and make notice if [ $YACC != 'bison -y' ]

Remove unused AC_SUBST([BISON], ...).

Add AM_CONDITIONAL([HAVE_BISON], ...) so that we can skip bison tests
in testsuite when bison is absent.

We don't make any attempt to detect other yacc implementations since
flex is developed with bison. While it would be possible, the need
isn't there right now. It would be possible to add a --with-parser
option that defaulted to bison if such a need cropped up.
2017-01-25 10:29:26 -05:00
Explorer09 a2fccbe579 build: fix Makefile parse.h dependency clauses.
The current clauses stating "main.c: parse.h" and "yylex.c: parse.h" do
not work as expected. Make did not try to build parse.h upon building
flex-main.o as it would think main.c exist already and ignore the
clause. Fix this by explicitly stating that the .o files depend on
parse.h instead.

This dependency bug only happens if user builds flex from a
checked-out repository.
2017-01-24 12:07:06 -05:00
Explorer09 e8cb34ed48 test: Remake *_scanner.c if *_scanner.h is missing.
If a ${foo}_scanner.c exists but the respective ${foo}_scanner.h is
missing, then 'make' can halt. Fix this by deleting the
${foo}_scanner.c file and then remake it. This rule is the same as the
automake-generated rule for .c files that require LEX or YACC (except
automake will use ylwrap).
2017-01-24 11:56:09 -05:00
Explorer09 afc687f586 test: remove BUILT_SOURCES; add missing dependencies.
Without BUILT_SOURCES in Makefile, no test sources in tests/ will be
built when using the default "make all" target. This is desireable for
people who are just building flex but who do not want to run, and
therefore, build any part of the test suite.

Also fix missing sources dependencies:

    bison_nr_scanner.$(OBJEXT): bison_nr_parser.h
    bison_yylloc_scanner.$(OBJEXT): bison_yylloc_parser.h
    bison_yylval_scanner.$(OBJEXT): bison_yylval_parser.h
2017-01-24 11:53:46 -05:00
Explorer09 9c54eb6e30 build: detect overflow for [re]allocate_array.
Use reallocarray() when we have it (i.e. in OpenBSD system). When we
don't, use equivalent overflow detection for our allocate_array and
reallocate_array functions.

Remove lib/reallocarray.c from our LIBOBJS as we no longer need it.

Provide a fallback SIZE_MAX macro definition in flexint.h (not
preprocessor friendly, but enough for our reallocate_array use case).
2017-01-24 07:36:50 -05:00
Will Estes 7e4d538724 doc: v2.6.4 2017-01-23 14:25:11 -05:00
Thomas Klausner 0a89eef5dc build: more BSD make and vpath build fixes.
BSD make doesn't like $< with more than one source
specified. Additionally, make sure to specify srcdir when referring to
source files since vpath builds depend on this.
2017-01-23 13:48:15 -05:00
Thomas Klausner b61b0fe906 build: Fix skel.c generation with BSD make 2017-01-23 13:45:34 -05:00
Christos Zoulas 078b46c69d Add more defines in the non-reentrant part.
Fix the reentrant part; don't "#define yyfoo yyfoo" because it breaks
code that does #ifndef yywrap ..
2017-01-23 13:39:49 -05:00
Christos Zoulas 726c8dab23 scanner: Add yyparse prototype 2017-01-23 13:38:58 -05:00
Thomas Klausner 6bf98d9aea scanner: move comment for consistency 2017-01-23 13:35:26 -05:00
Christos Zoulas 1a9468797d scanner: Use array instead of pointer 2017-01-23 13:32:40 -05:00
Christos Zoulas 43a5bebd7d scanner: manage path to m4 better.
Avoid alloca() for SSP; it is better anyway; since we don't need to
strdup the path.
2017-01-23 12:31:21 -05:00
Christos Zoulas fb175a49c3 scanner: Avoid creating unused label 2017-01-23 12:06:53 -05:00
Christos Zoulas f01ab4fe02 Cast argument to avoid arithmetic on void *. 2017-01-23 11:42:14 -05:00
Christos Zoulas 7ca76038df scanner: Use strncpy 2017-01-23 11:38:36 -05:00
Christos Zoulas f5d87f1a26 scanner: Use prefix when defining yywrap to avoid redefinition.
Fixes regression introduced in v2.6.3.
2017-01-23 11:35:19 -05:00
Christos Zoulas 6f47a5232c scanner: Include stdarg.h for va_list 2017-01-23 11:27:51 -05:00
Christos Zoulas d0d0573900 scanner: Rename warn to lwarn.
This avoids a naming conflict in NetBSD's  libc.
2017-01-23 11:01:54 -05:00
Explorer09 da071cfb7a test: document automake convention for skipped exit status. 2017-01-20 11:06:06 -05:00
Explorer09 dd7c6d4a0f test: let testwrapper scripts be run by ${SHELL}.
This allows user to use a different shell if /bin/sh has problems.
The use of $SHELL (variable) to run scripts is already an Automake
convention. All shell scripts in build-aux are run by $SHELL.
2017-01-17 21:10:42 -05:00
Explorer09 bcf7a07369 test: Remove test scripts bashisms.
They now all work under a POSIX compliant sh. Specifically, 'dash' can
now be used for running "make check" tests.

Note that none of these scripts has ever been using a pipe, so
`set -o pipefail` is unnecessary and removed.
2017-01-17 21:10:16 -05:00
Explorer09 8c8691c3fd test: exit on '-1' test non-zero status.
If a '-1' test program returns a non-zero status, don't go further and
compare it's (numeric) output values. This allows a '-1' test to
indicate a "skip" status or an otherwise error. (Currently no such '-1'
test would skip like this, though.)

Shell syntax note: `set -e` will not exit with the syntax like this
`test $(false) = $(false);`. The exit statuses of `false` in the
example will be ignored instead. But putting the output in a variable,
such as `VAR=$(false)`, DOES exit.
2017-01-17 21:08:42 -05:00
Explorer09 bb92951c02 build: Fix 'make indent' target
This 'make indent' target has not been working since the directories
reorganization in flex 2.6.0. Now make it work again.

Note that the current indent profile breaks many styles of existing
code. The indent target should not be used until the .indent.pro
options are reviewed for desireability.
2017-01-12 18:02:24 -05:00
Explorer09 8db5267af4 build: Simplify indent program detection 2017-01-12 18:01:57 -05:00
Tobias Klauser de0c5e91df filter: Don't emit #line if %option noline set
One place emitting a #line directive to the generated header was
missed in commit 647a92b9f4 when resolving #55. Fix it to respect
gen_line_dirs as well.
2017-01-12 17:44:00 -05:00
Will Estes 84a9a4b9fc translation: refresh po files from translation project 2017-01-12 13:22:02 -05:00
Harald van Dijk e666829949 c++: Fix yyrestart(NULL) SEGV.
Binding a reference to a dereferenced null pointer is invalid and
compilers optimise away the &file == 0 check. We need a real stream.

yyin is available already, and yyrestart(NULL) is only supported when
yyin will not be used, so there is no harm in just passing in that.
Since we now always have a valid stream, we can skip the null check
too.

Fixes #98.
2017-01-11 21:04:28 -05:00
luistung 7f263e3520 scanner: join symbol list.
Removed a newline that caused a problem building the scanner in some
circumstances. Specifically:

'bad character' error  when executing

/bin/sh ../build-aux/ylwrap scan.l lex.yy.c scan.c -- flex
2017-01-11 09:09:15 -05:00
Will Estes a58086a269 scanner: remove void cast before fprintf 2017-01-11 09:05:18 -05:00
Will Estes 581ef6d17f doc: update NEWS for 2.6.3 release 2016-12-30 12:48:24 -05:00
Explorer09 adddfba7ab build: New configure option '--disable-bootstrap'.
If configure is run with '--disable-bootstrap', then stage1flex won't
be built and stage1scan.c will be generated by sed'ing scan.c.

This option is intended to workaround bootstrap bugs rather than to
fix the bootstrapping issues which are proving subtler and harder to
fix than anyone would like.
2016-12-29 17:26:07 -05:00
Explorer09 6964073c59 build: "make clean" deletes stage1scan.c, stage1flex 2016-12-29 17:25:19 -05:00
Explorer09 935478c3fe build: allow building libfl even with --disable-libfl.
For various reasons, we may wish to build libfl explicitly even when
configure has been run with the --disable-libfl option. This is
possible, now, via 'make -C src libfl.la'.
2016-12-29 17:19:53 -05:00
Alexis La Goutte a33e6fd5b4 scanner: remove trailing whitespace in skeleton 2016-12-29 15:11:11 -05:00
Demi Obenour 8d4aa5ccaf scanner: Disallow, overquote '[' and ']' in prefix 2016-12-29 14:18:15 -05:00
Samuel Thibault 7975c43384 scanner: allocate correct buffer size for m4 path.
Flex did not check the length of the m4 path which could lead to a
buffer overflow in some cases. Additionally, not all platforms believe
in PATH_MAX, so stop relying on it.

Fixes #138
2016-12-29 08:47:10 -05:00
Will Estes 6bea32e937 doc: note no more libcompat in NEWS 2016-11-24 18:50:21 -05:00
Will Estes 223f297825 build: explain empty lib/Makefile.am 2016-11-24 18:50:21 -05:00
Explorer09 44fa758931 build: warn about cross compiling with *alloc 2016-11-24 18:48:28 -05:00
Explorer09 713f5a0cb4 build: Link $(LIBOBJS) from src/ dir, remove libcompat.la.
The libcompat.la library was small and less friendly to bootstrapping
and cross compilation. Now, we will simply link individual object
files as needed, which is simpler.
2016-11-24 18:45:07 -05:00
Explorer09 11c445cde9 build: Let stage1flex respect LFLAGS 2016-11-15 19:26:08 -05:00
Will Estes 99612781d9 doc: describe --disable-libfl in NEWS 2016-11-14 14:26:48 -05:00
Explorer09 5d71e9ffb9 build: Add --disable-libfl configure option.
Disabling libfl is useful when building flex for a cross-toolchain.

Fixes: GH-99
2016-11-14 14:23:27 -05:00
Demi Obenour 347652c32b fix backwards incompatible changes in 2.6.2.
This patch addscompatibility `#defines` for all macros affected by
`%prefix`.

Fixes #113.
2016-11-12 12:00:12 -05:00
Will Estes d374b87e68 git: ignore quote_in_comment artifacts 2016-11-08 12:53:21 -05:00
Demi Obenour c8ad3d682f Fixes a major bug in Flex's own lexing of literals.
My changes caused Flex to mishandle string and character literals in
line comments.  This commit fixes them.

Fixes #113.
2016-11-08 12:49:44 -05:00
Thomas Klausner 0af671a275 Fix unportable test(1) operator.
"==" is only supported by bash, "=" is the standard comparison
operator.
2016-11-06 22:32:43 +01:00
Demi Obenour 14846e5e1a Add more escaping tests 2016-11-02 13:22:02 -04:00
Demi Obenour e1038db19a Fix another escaping bug
in non-indented verbatim section 2 code.

I also did some reformatting.
2016-11-01 20:20:46 -04:00
Alastair Hughes 75f4305eed build: fix false negatives for help2man and texi2dvi
HELP2MAN and TEXI2DVI (or the corresponding ac_prog variables) will
never be zero length as they fall back to the missing script; check for
the fall back and warn on that instead of always warning.
2016-10-29 09:11:20 -04:00
Explorer09 c503eaf061 doc: Don't delete flex.1 during "make distclean".
flex.1 is pre-generated in release tarball. If we delete it, the next
"configure and make" on the source directory will then require help2man
unnecessarily.
2016-10-28 19:48:11 -04:00
Alastair Hughes 92311a56b3 Only regenerate the man page when required.
Make the flex binary an order-only prerequisite, and add back the
prerequisites from before 7cfb440. This prevents rebuilding the man page
whenever the flex binary is rebuilt, which causes problems if help2man
is not installed and will never work when cross compiling.

Fixes #108.
2016-10-27 17:55:46 -04:00
Will Estes 2bf2ad6d68 build: no longer build PIC version of libfl.
The PIC version of libfl was not being built correctly. From the lack
of bug reports around this problem, we conclude that the PIC version
of libfl is not used and so we drop it from the build build targets
for flex.
2016-10-26 14:09:36 -04:00
Explorer09 023cd4f754 doc: README.md formatting fixes
* Wrap everything in the raw document in 72 char per line limit.
* Proper casing for terms "Git" and "GitHub" (don't try to look lazy).
* Add unordered list marks when needed.
* Say `configure && make && make install` and quoted for fixed-width
  font.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2016-10-25 10:20:35 -04:00
Will Estes 31cc18ebd0 build: version 2.6.3 begins 2016-10-25 09:53:50 -04:00
Will Estes 35d2fdfad1 doc: mark 2.6.2 release date 2016-10-24 18:29:36 -04:00
Will Estes 2ecf674239 build: switch xz to lzip 2016-10-24 18:26:22 -04:00
Demi Obenour b02489f588 Fix M4 quotation in section 2 prologue and refactor duplicated code 2016-10-23 14:04:42 -04:00
Alex Kennedy 802cd0a6ed Update flex.texi: Removed repedative wording
"Flex used to" was written twice at the beginning of Chapter 9, paragraph 2.
2016-10-21 20:42:36 -07:00
Demi Obenour 4bffa41e4e Improved M4 quotation
This fixes M4 quotation of certain strings beginning with `yy` (in
section 3 of the input file only) and character literals.  The new
quotation method is also less brittle and faster.

Tests that relied on the old behavior were fixed.

Also, `yyconst` is no longer defined; use `const` (which it
unconditionally was defined to) instead.
2016-10-19 20:39:06 -04:00
Will Estes 7dcb10c048 build: for automake, flex is foreign 2016-10-19 17:00:50 -04:00
Will Estes 9a4ae5d619 doc: mv README to README.md 2016-10-19 10:27:23 -04:00
Will Estes 2ad733a56e doc: touch up README 2016-10-19 10:26:44 -04:00
Will Estes 507f96a5ff doc: README no longer mentions sourceforge 2016-10-19 05:25:36 -04:00
Will Estes 17bf278ad7 doc: update NEWS with more post-2.6.1 additions 2016-10-06 16:39:04 -04:00
Demi Obenour 9d3ddf572e Fix M4 quoting of section 3.
This fixes M4 quoting of section 3 of the input file, including escape
sequences and character constants.

Tests were added to verify the behavior in section 3 with respect to
quoting. Both escaping of quotes and quoting of potential macro-start
characters are tested. Existing tests were also fixed to account for the new -- and now correct -- behavior. Many tests relied on the old behavior of expanding M4 macros
in section 3.  They needed to be updated for the new behavior.
2016-10-05 19:25:56 -04:00
Mightyjo 735ffb6a65 Fix yyrestart(NULL) SEGV. 2016-10-05 17:19:03 -04:00
Demi Obenour ee87e5df00 scanner: M4 quoting fixes 2016-09-25 19:40:10 -04:00
Demi Obenour 749a8c80f7 Support make indent for out of source builds 2016-09-25 19:40:10 -04:00
Demi Obenour fb91984b3b Simplify some shell code 2016-09-25 18:53:29 -04:00
Demi Obenour e50d903620 no longer generate K&R C scanners 2016-09-25 16:12:14 -04:00
Demi Obenour 7528bc0aee Fix escaping of [[ and ]] in strings
Previously, `[[` and `]]` were not escaped in strings, which led
to bad interactions with m4.

Also, don't break strings on newline, as GCC et al support whitespace
between a backslash and the subsequent newline.
2016-09-04 18:29:30 -04:00
Translation Project b22b8fdb97 new sv translation 2016-06-20 09:17:57 -04:00
Demetri Obenour 925549475e Delete action_m4_define from misc.c
This function was not used and always triggered a fatal error when run.
2016-05-23 17:36:33 -04:00
Will Estes 7878f90988 test: run direct tests from srcdir 2016-05-20 17:31:27 -04:00
Egor Pugin 1b7a7165f3 Exited with error code on some conditions in include tests 2016-05-20 17:31:27 -04:00
Will Estes 98fd512f9a test: drop .exe when making input file names 2016-05-20 17:31:27 -04:00
Will Estes 0cc66ab7fd test: removed dependencies for include tests 2016-05-20 14:09:29 -04:00
Tobias Klauser 0afeed389c Avoid realloc on every call of sf_push()
Currently, every call to sf_push() realloc()'s _sf_stack, even if the
maximum size _sf_max wasn't changed. As the indentation beneath the
"if" clause already indicates, the realloc() should only be executed
if _sf_max was increased.

Found by compiling flex with the -Wmisleading-indentation flags of gcc,
which leads to the following warning:

scanflags.c: In function ‘sf_push’:
scanflags.c:42:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
     if (_sf_top_ix + 1 >= _sf_max)
     ^~
scanflags.c:44:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
         _sf_stk = realloc(_sf_stk, sizeof(scanflags_t) * _sf_max);
         ^~~~~~~
2016-04-28 10:18:21 +02:00
Will Estes 2061043d3d build: prettified command to build man page 2016-03-31 18:47:00 -04:00
Will Estes 84ca965d1f build: added man page to DISTCLEANFILES 2016-03-31 18:46:23 -04:00
Will Estes 9f2343bf65 remove unused TODO, BUGS files 2016-03-31 16:09:28 -04:00
Will Estes ad46bcf9cd removed to.do/ directory 2016-03-31 15:58:16 -04:00
Will Estes e15146bbaa gettext: removed flex.skl from POTFILES.in file list 2016-03-31 13:36:09 -04:00
rlar 4db9c203f6 fix skel.c dependency (missing tables_shared.c) and
polish build rule

Also remove references to srcdir since skel.c is no longer mentioned in po/POTFILES.in.
2016-03-31 11:19:20 -04:00
rlar 7cfb440c7c fix flex.1 dependency
git clean -fdx && ./autogen.sh && \
  mkdir -p ../build && cd ../build && ../flex/configure && make -j10 && \
  make dist

failed with:

>  help2man: can't get `--help' info from ../../flex/src/flex

Note:
  There is no dependency except for the flex binary.
2016-03-31 10:51:19 -04:00
rlar 39cff7e239 fix stage1scan.c and stage1scan.l dependency
git clean -fdx && ./autogen.sh && \
  mkdir -p ../build && cd ../build && ../flex/configure && make -j10

failed with:

> ../src/stage1flex -o stage1scan.c stage1scan.l
> stage1flex: can't open stage1scan.l

Note:
  stage1scan.c is not necessairy in the "make dist" generated tar.gz file.
  stage1flex will be build from scan.c (which is distributed),
    and this will then generate stage1scan.c from scan.l
2016-03-31 10:47:00 -04:00
Will Estes 07a1d30ba3 gettext: list src/flex.skl in po/POTFILES.in 2016-03-31 10:21:56 -04:00
rlar 8d09d89c33 warning in generated code, with -Ca
warning: conversion to 'yy_state_type' from 'flex_uint32_t' may change the sign of the result [-Wsign-conversion]
2016-03-31 07:17:32 -04:00
rlar f57cb42c7d suppress WARNINGFLAGS' for the almost obsolete noansi' test cases 2016-03-31 07:15:43 -04:00
rlar f1ce47684c configure option --enable-warnings' and WARNINGFLAGS'
`WARNINGFLAGS' can be passed when invoking `configure'
 and when invoking `make'

if configure switch `--enable-warnings' was given
  then default to something useful if we have `GCC'

`WARNINGFLAGS' is not used when compiling `stage1flex'
  to avoid unnecessary clutter
2016-03-31 07:11:51 -04:00
Tobias Klauser babe9a1e8e Fix potential buffer overflow in strncat()
When using clang/llvm 3.8 to compile flex, the following warning is
emitted:

main.c:378:27: warning: the value of the size argument in 'strncat' is too large, might lead to a buffer overflow [-Wstrncat-size]
                                        strncat(m4_path, m4, sizeof(m4_path));
                                                             ^~~~~~~~~~~~~~~
main.c:378:27: note: change the argument to be the free space in the destination buffer minus the terminating null byte
                                        strncat(m4_path, m4, sizeof(m4_path));
                                                             ^~~~~~~~~~~~~~~
                                                             sizeof(m4_path) - strlen(m4_path) - 1

Fix it up by using the solution proposed by the warning message.
2016-03-31 10:09:57 +02:00
Robert.Larice Robert Larice c5d903dcda build: simplified dependency tracking so parallel make runs succeed 2016-03-29 15:19:00 -04:00
rlar fab3f206e4 avoid warning in generated code, with -Cf
warning: conversion to 'unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
2016-03-28 16:41:15 -04:00
Will Estes 42325b8b39 mention v2.6.2; summarize changes since 2.6.1 2016-03-18 15:25:10 -04:00
Will Estes e873499f32 doc: corrected example in manual, gh#67 2016-03-18 15:09:44 -04:00
rlar 0292299ec5 warning: conversion to 'size_t' from 'int' may change the sign of the result [-Wsign-conversion] 2016-03-18 14:52:04 -04:00
rlar ed59d3e066 warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion] 2016-03-18 14:49:23 -04:00
rlar c2429b5a4a warning: conversion to 'flex_uint32_t' from 'long unsigned int' may alter its value [-Wconversion]
struct yytbl_reader, member bread is of type flex_uint32_t
2016-03-18 14:46:43 -04:00
rlar 70b804fb02 warning: redundant redeclaration of '...' [-Wredundant-decls] 2016-03-18 14:39:21 -04:00
rlar 676a62ec1e warning: no previous prototype for '...' [-Wmissing-prototypes] 2016-03-18 14:35:39 -04:00
rlar d112fbaf53 warning: unused variable 'fp' [-Wunused-variable] 2016-03-18 14:31:37 -04:00
rlar 2da698f147 main(), warning: redundant redeclaration of 'main' [-Wredundant-decls] 2016-03-18 14:27:58 -04:00
rlar 08fd44f453 main(), warning: old-style function definition [-Wold-style-definition] 2016-03-18 14:06:11 -04:00
rlar f4be44b2b2 main(), warning: old-style function definition [-Wold-style-definition] 2016-03-18 13:56:25 -04:00
rlar 8756116ccb Fix two more casts 2016-03-16 08:27:58 -04:00
Bastian Köcher 1da19feba7 Fixes yyl compare with unsigned warning 2016-03-16 08:23:01 -04:00
Robert Larice 197b523555 Suppress portability warnings in Makefile generation 2016-03-16 08:23:01 -04:00
rlar dc55016677 generated code, in yyensure_buffer_stack(), change type of local `num_to_alloc'
which is exclusively used in yy_size_t context
2016-03-12 14:29:47 -05:00
rlar 8c098febc9 generated code, in yy_get_next_buffer(), change type of local `number_to_move'
suits better, because `yy_n_chars' and `yy_buf_size' are of type `int'
2016-03-12 14:28:55 -05:00
rlar cf4121fa97 generated code, _yybytes_len' is of type int', fix code accordingly 2016-03-12 14:27:38 -05:00
rlar 3946924ed5 generated code, max_size' seems to be of type int', fix casts accordingly 2016-03-12 14:25:34 -05:00
rlar 986bb5e294 generated code, here new_size' is of type int', fix casts accordingly 2016-03-12 14:23:30 -05:00
rlar 33dd868353 generated code, yy_buf_size' is of type int', fix casts accordingly 2016-03-12 14:22:43 -05:00
rlar 3614d4c834 generated code, offset' is of type int' 2016-03-12 14:21:33 -05:00
rlar 04c31bf09f generated code, yy_more_len' is of type int' 2016-03-12 14:20:30 -05:00
rlar 48152721a0 scan.l, rewrite two loops to avoid unneccesairy casting 2016-03-12 14:16:46 -05:00
rlar bdc999cbc1 improve readability 2016-03-12 14:12:49 -05:00
rlar fb60d5a04e another cast in tblcmp.c to avoid warning 2016-03-12 14:10:48 -05:00
rlar 3d640d049d casts in buf_append() to get rid of warnings 2016-03-08 15:35:53 -05:00
rlar de3fb712c2 cast to suite type of flex_uint32_t td_lolen 2016-03-08 15:35:45 -05:00
rlar 9160ceb67f cast to get rid of warnings 2016-03-08 15:30:35 -05:00
rlar 00bc43fa04 cast and fix usage of log10(), ceil to prevent buffer overflow 2016-03-08 15:20:45 -05:00
rlar c7b3db7957 tables.c, sprinkle casts to get rid of warnings 2016-03-08 15:20:45 -05:00
rlar 598ba7fd4c yytbl_data_compress(), change type of local newsz to get rid of warnings 2016-03-08 15:20:45 -05:00
rlar e8e83d2dbe change type of struct yytbl_writer.total_written to get rid of warnings 2016-03-08 15:13:05 -05:00
rlar c2940d142b change argument type of yytbl_writen() to get rid of warnings 2016-03-08 13:29:08 -05:00
rlar fe89a09e29 yytbl_write8/16/32(), change type of local variables to get rid of warnings 2016-03-08 13:22:54 -05:00
rlar 1d5b34b52a change return type and rename int htoi()/otoi() --> unsigned int htoui()/otoui() 2016-03-08 13:19:20 -05:00
Will Estes 609af5775f Mention 2.6.1 release date 2016-03-01 19:24:24 -05:00
rlar 455205b2e0 avoid warning, add (int) cast to the read() return value
For similiarity with the fread() case.
2016-03-01 06:08:30 -05:00
rlar 265e8e5c90 avoid warning, POSIX says yyless() has an `int' argument 2016-03-01 06:07:36 -05:00
rlar f951c3f8cc use type size_t in filter_tee_header() to avoid warnings 2016-03-01 06:06:42 -05:00
rlar 22d123c1fe add (size_t) casts to malloc invocations to prevent warnings 2016-03-01 06:05:21 -05:00
rlar d2c0374297 add (int) casts to some strlen() invocations to prevent warnings 2016-02-29 20:16:03 -05:00
rlar 0f276adbb2 ndlookup(), char *, to get rid of casts and warnings 2016-02-29 20:11:13 -05:00
rlar 967819769e ndinstal(), char *, to get rid of casts and warnings 2016-02-29 20:07:58 -05:00
rlar b7b9789469 cclinstal() and ccllookup(), char *, to get rid of casts and warnings 2016-02-29 20:07:47 -05:00
rlar 2532a957a6 warning: redundant redeclaration of ‘gen_next_state’ [-Wredundant-decls] 2016-02-29 19:53:12 -05:00
rlar 0f4684dd2a warning: no previous prototype for ‘mkecstbl’ [-Wmissing-prototypes] 2016-02-29 19:41:03 -05:00
rlar cc7d14899c warning: suggest parentheses around assignment used as truth value [-Wparentheses] 2016-02-29 19:06:56 -05:00
rlar 860d7cfe15 warning: redundant redeclaration of ‘yywrap’ [-Wredundant-decls] 2016-02-28 19:43:38 -05:00
rlar ad994f507e warning: redundant redeclaration of ‘yylval’ [-Wredundant-decls] 2016-02-28 19:42:51 -05:00
rlar 4d6fb2187b warning: redundant redeclaration of ‘yyin’ [-Wredundant-decls] 2016-02-28 19:40:05 -05:00
rlar 519783bb98 warning: redundant redeclaration of ‘yyparse’ [-Wredundant-decls] 2016-02-28 19:07:18 -05:00
rlar 318396d05a unification, rename some more
rename these too for improved similiarity:
  OPTION_OP OPT_HEADER OPT_EXTRA_TYPE OPT_TABLES
2016-02-28 18:56:25 -05:00
rlar 804efe8c42 fix name clash, OPT_OUTFILE from parse.y and from options.h
these collide:
  OPT_OUTFILE OPT_PREFIX OPT_YYCLASS
rename them TOK_... in the parser
2016-02-28 18:50:12 -05:00
Will Estes 80484ea267 Prototyped reallocarray implementation 2016-02-28 16:23:19 -05:00
Will Estes aade6607e2 Removed custom strcasecmp() function 2016-02-28 15:51:57 -05:00
rlar fd722d7030 fwrite wants a size_t, yyleng is int per posix 2016-02-28 15:21:12 -05:00
rlar bffbf1fa28 Remove some unneeded casts 2016-02-28 15:17:57 -05:00
rlar 48fa65020f warning: negative integer implicitly converted to unsigned type [-Wsign-conversion] 2016-02-28 15:15:32 -05:00
rlar e66a12bbff dfa.c:157:24: warning: conversion to 'size_t' from 'int' may change the sign of the result [-Wsign-conversion]
most certainly safe cast
2016-02-27 17:40:14 -05:00
rlar 3a132d28d9 ccl.c:86:19: warning: conversion to 'unsigned char' from 'int' may alter its value [-Wconversion]
ch seems to have been checked for proper range some lines above
2016-02-27 17:38:25 -05:00
rlar 71530afc7e warning: deprecated directive, use '%pure-parser' [-Wdeprecated] 2016-02-27 17:35:53 -05:00
rlar 9132612c2c warning: no previous prototype for 'do_nothing' [-Wmissing-prototypes] 2016-02-27 17:35:07 -05:00
rlar f691a6345d included stdlib.h header 2016-02-27 17:31:19 -05:00
Will Estes 458180116d Described more post v2.6.0 changes 2016-02-27 16:23:11 -05:00
Will Estes aa4eac68e7 build: Removed bzip2 distribiution archive 2016-02-27 15:45:34 -05:00
Will Estes 782ee061ec removed obsolete program check 2016-02-27 15:41:59 -05:00
Will Estes 0e2b8c0f95 Made some program checks more robust 2016-02-27 15:35:33 -05:00
rlar 09fd5851bc Remove unneeded cast to int 2016-02-27 14:00:55 -05:00
Will Estes a5cbe929ac Fixed incorrect integer type 2016-02-27 11:56:05 -05:00
Will Estes 7a7c3dfe1b Fix more integer types, resolves sf 184, 187 2016-02-27 09:43:00 -05:00
Robert Larice de03dfb8fa Removed some type conversion warnings 2016-02-26 20:23:05 -05:00
Will Estes a51bd6c301 Changed another buffer size to int; resolves gh#61 2016-02-26 14:23:33 -05:00
Will Estes 4a8eccf830 Changed type of yy_n_chars to int; gh#53, sf#160.
The variable yy_n_chars had been of type yy_size_t which is incorrect
given its use in read(). While it might be adviseable to look at
defining a yy_ssize_t, there might be some issues doing this and so, for
now, at least, we'll punt back to int.
2016-02-24 20:11:24 -05:00
Will Estes d2a67ba6b7 Fixed size of bufferallocation, resolved gh#54.
The value of n_alloc was a count, not a size. Multiplying the value by the element size was incorrect. That multiplication was already being done and having it done twice was incorrect.
2016-02-24 17:50:00 -05:00
Tobias Klauser dcf0226b06 Allow '%option noline' in flex input file, resolves gh#56.
Allow specifying '%option noline' in the input file, leading to the same
effect as calling flex with the command line option --noline.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-24 16:21:08 -05:00
Tobias Klauser 647a92b9f4 Emit no #line directives if gen_line_dirs is false, resolves igh#55.
There are two instances in the code which will print a #line directive
to the resulting lexer, regardless of the value of gen_line_dirs. Fix
them, so they also respect gen_line_dirs.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-24 16:19:49 -05:00
Tobias Klauser 64f2774378 Converted K&R style function definitions to ANSI C style
Consistently make use of the ANSI C function definition style instead of
the K&R style.
2016-02-16 14:52:16 +01:00
Tobias Klauser 1cc6c871f9 Used NULL constant instead of plain integer for NULL pointer.
The sparse static checker warns about using plain integer 0 as NULL
pointers in the generated lexer code. Fix this by using NULL
consistently for pointers.
2016-01-29 21:19:48 -05:00
Tobias Klauser a7ff1b23a9 Marked declaration and definition of yy_fatal_error as noreturn.
Only the declaration of yy_fatal_error is marked with
__attribute__((__noreturn__)) in case GCC >= 3 is used, but not the
definition. This leads to the sparse static checker to complain about
function declaration mismatch.

Fix it by defining a macro yynoreturn and using it for both the
declaration and the definition of yy_fatal_error.
2016-01-29 21:19:30 -05:00
Tobias Klauser 4936786fc5 Fixed declaration mismatch in yy_fatal_error.
The prototype declares yy_fatal_error parameter as "const char msg[]"
while the definition uses "const char* msg" (introduced by commit
e9d5fc713f) which causes the sparse static checkers to produce an
error.

Fix this by adjusting the definition to use "const char* msg" as well.
Also change the C++ version accordingly so it matches the declaration in
FlexLexer.hpp.
2016-01-27 17:01:14 -05:00
Will Estes 24a1589f86 flex is for flex #NCoC 2016-01-23 11:43:07 -05:00
Will Estes c351f39a2f Referred to github for issue tracking, no longer sf 2016-01-18 16:00:04 -05:00
Egor Pugin 3d1175b232 Opened files in binary mode explicitly 2016-01-10 15:43:47 -05:00
OBATA Akio 11ea8d73fc Linked flex binary against libintl, not libfl.
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
2016-01-08 15:23:18 -05:00
Michael van Elst 958ccda44e Improved pipe-stdin hack behavior; resolves sf#198.
Signed-off-by: Thomas <Klausner wiz@NetBSD.org>
2016-01-08 15:07:57 -05:00
Will Estes 3efb40df0e Removed no longer needed header checks 2015-12-27 14:05:51 -05:00
Will Estes 5b856d1fa3 Checked for reallocarray() with AC_REPLACE_FUNCS 2015-12-27 13:57:13 -05:00
Will Estes 5d22149d43 include libgen.h from flexdef.h, not main.c 2015-12-27 13:46:37 -05:00
Michael Reed 145968f5e2 Replace basename2() with basename(3).
Given the following program:

	\#include <libgen.h>
	\#include <stdio.h>

	/* extracts basename from path, optionally stripping the extension "\.*"
	 * (same concept as /bin/sh `basename`, but different handling of extension). */
	static char *basename2 (char *path)
	{
		char   *b;

		for (b = path; *path; path++)
			if (*path == '/')
				b = path + 1;
		return b;
	}

	static void basename_compare(char *path)
	{
		printf("basename: %s\n", basename(path));
		printf("basename2: %s\n\n", basename2(path));
	}

	int main (int argc, char *argv[])
	{
		// From http://pubs.opengroup.org/onlinepubs/9699919799/
		// ``Sample Input and Output Strings''
		basename_compare("/usr/lib");
		basename_compare("/usr/");
		basename_compare("/");
		basename_compare("///");
		basename_compare("//usr//lib//");
		return 0;
	}

... and the program's output:

	basename: lib
	basename2: lib

	basename: usr
	basename2:

	basename: /
	basename2:

	basename: /
	basename2:

	basename: lib
	basename2:

... we can see that basename2() behaves the same as basename(3) in the
average use case, but messes up pretty severely in others.  Besides
that, basename(3) is mandated by POSIX so should be present on modern
Unix-like systems, so we shouldn't define it ourselves.

Some notes:
- it doesn't appear to be mentioned in POSIX, but OpenBSD's basename(3)
  returns NULL if the returned path componenet is > PATH_MAX, so add a
  check for that
- basename(3) shouldn't return an empty string, so remove the
  program_name[0] != '\0' check
2015-12-27 13:39:45 -05:00
Michael Reed 0e00f445a9 Simplify basename2().
It's only call site does not activate the `strip_ext` code path, so the
function can be simplified a lot.  While here, remove a double
assignment.
2015-12-27 13:39:09 -05:00
Michael Reed 6fa7ed0446 Cleaned up __STDC__ #ifdefs.
Assuming a compiler conforming to the ISO C standard is used, i.e.,
__STDC__ is defined to 1, YY_USE_CONST is always defined and can be
eliminated.
2015-12-27 08:32:33 -05:00
Michael Reed 64874cd464 Remove remaining use of PROTO 2015-12-25 14:01:24 -05:00
Serguey Parkhomovsky 5f6b7645e6 buf.c: use snprintf 2015-12-21 14:40:24 -08:00
Will Estes ed855892c7 build: reformatted AC_CHECK_FUNCS for readability 2015-12-19 16:17:31 -05:00
Will Estes aebf37aa12 correct function prototype 2015-12-17 16:45:14 -05:00
Michael Reed c1c3b82b79 Remove more instances of PROTO 2015-12-15 16:11:01 -05:00
Michael Reed c918627e08 Removed prototype for main().
It's not called anywhere else so the prototype is not needed.
See the C99 standard [1], section 5.1.2.2.1 for more info.

[1]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
2015-12-15 16:05:49 -05:00
Michael McConville 559d79d0f5 Removed more instances of PROTO, ansifying. 2015-12-14 07:20:53 -05:00
Will Estes 56f558ffef Noted github for issue tracking and pull requests 2015-12-13 19:44:19 -05:00
Michael McConville 43f8adbe60 Reformatted README; removed sf bug tracking link. 2015-12-13 19:42:39 -05:00
Michael McConville bfdef978fc Removed macros for indentation level.
Just increment or decrement the indentation counter. That's less to
remember and makes the code more readable.

w# Please enter the commit message for your changes. Lines starting
2015-12-13 19:25:23 -05:00
Mike Frysinger 4082a04921 tests: fixed paths to input files.
The current test wrapper works only when the inputs are specified using
relative paths.  If they're specified with absolute paths, the driver
fails to detect the inputs because it always prepends the input dir name
which itself is a relative path:
$ cd tests
$ ./testwrapper.sh -d . -i $PWD/reject.txt -t ./reject_ver.table
<fails to open inputs>

This normally doesn't show up because people run `./configure` or, for
out of tree builds, `../configure`.  But if you happen to run configure
with an absolute path, then automake tends to generate absolute paths
as well leading to test failures.

Fix all of this by dropping the implicit input directory prepending.

- INPUT_NAME is often a list of files, not just a single one
- the input directory is used to find the testname tables which are
  usually generated, so it's impossible to use files from both source
  and build directories
- most of the time, the full/correct path is already specified
2015-12-13 19:02:51 -05:00
Mike Frysinger ff622ae961 configure: fixed realloc test.
The [] characters are used for quoting in m4, so the attempt to use
them in place of `test` fails yielding the warning at build time:

.../flex/configure: line 20222: no: command not found
2015-12-13 19:01:29 -05:00
Michael McConville 9acbb870c1 Started removal of PROTO macro.
The PROTO macro is no longer needed. Additionally, its usage is inconsistent,
so we began removing it.
2015-12-12 18:01:13 -05:00
Michael Reed e05e093047 Removed SHORT_FILE_NAMES preprocessor symbol.
As a relic of MS-DOS, we don't need this.

It's never defined; see 13b5b214f5.

Removed additional MSDOS ifdef.
2015-12-12 15:40:58 -05:00
Michael McConville 77e54b25ee Added new function reallocarray.
This is taken from OpenSSH Portable, which in turn takes it from
OpenBSD.

reallocarray wraps the stdlib's realloc function. It takes two size
arguments and checks for overflow, like calloc, but doesn't zero the
memory. Therefore, it allows us to do overflow-safe array reallocations
and overflow-safe unzeroed array allocations, which the stdlib
allocation functions don't.

We have a bunch of specific array allocation macros, none of
which check for overflow. reallocarray should be able to replace them.
2015-12-12 15:25:40 -05:00
Michael McConville 13b5b214f5 Removed MS-DOS, VMS macros.
Given the age of the MS-DOS and VMS platforms, it's likely that no one is building flex on them any more. Additionally, the preferred approach is to test for particular platform features rather than to test for particular platforms.
2015-12-12 14:19:37 -05:00
Will Estes c34590c4bf Made search for m4 more explicit. 2015-12-12 11:03:05 -05:00
Will Estes f863c9490e Returned 0 from yywrap() instead of EOF 2015-12-12 07:35:23 -05:00
Will Estes 3a4af3424c Changed end of main() in libmain to exit(0) 2015-12-11 20:25:50 -05:00
Will Estes 965c9fa979 Mentioned v2.6.1; documented some changes since v2.6.0 2015-12-11 10:57:46 -05:00
Will Estes 6f9cbd4af1 Updated build documentation; finished sf#155.
Removed version numbers for build tools. Noted that version requirements for build tools will be noted in configure.ac. Expanded documentation of building texinfo based docs.
2015-12-11 10:41:08 -05:00
Will Estes e5e5fb59c9 Removed flex.pdf from distribution; partially fixed sf#155 2015-12-11 10:40:34 -05:00
Will Estes 07d89829cc Commented in C style in skeleton; fixed sf#195 2015-12-11 09:45:14 -05:00
Will Estes 1e13e9656b Ignored autoscan files 2015-12-10 10:05:59 -05:00
Will Estes d4e8f383e8 Checked for ranlib and strdup() at configure time 2015-12-09 19:39:20 -05:00
Michael McConville 8205442c7c Replace zero_out() with stdlib's memset. 2015-12-09 17:44:33 -05:00
Michael McConville 3d08a01292 Removed memory allocation casts. 2015-12-09 17:33:58 -05:00
Michael McConville 0dfcb6228f Removed alloca() configuration.
Since alloca() is dangerous, depricated, we remove it.
2015-12-09 15:54:02 -05:00
Michael McConville d41be27501 Removed implementation of isascii().
POSIX defines isascii(), so it's likely present on anything weactually build flex on these days.
2015-12-09 15:36:18 -05:00
Michael McConville 7969134687 Removed NULL-checks before free() 2015-12-09 13:15:08 -05:00
Michael McConville d95947343e Removed flex_free()i, corrected buf_destroy logic.
As with flex_alloc(), replace with direct calls to free().

The function buf_destroy is now null safe and the logic was corrected to free()
correctly.
2015-12-09 09:53:57 -05:00
Michael McConville 1cc5d87032 Removed flex_realloc().
As with flex_alloc(), replace calls to flex_realloc(), which was just a
wrapper around realloc().
2015-12-09 09:51:17 -05:00
Michael McConville c53d722b0b Removed flex_alloc; cleaned up style.
The function flex_alloc() was just a wrapper around malloc(). Since this only added unclarity, and the flex_alloc() function is likely a legacy of olden times, remove it in favor of calls to malloc() directly.

Style elements cleaned up:

 * superfluous spacing around parentheses
 * non-constant initialization in variable declarations
 * needless casts
 * almost all uses of assignments as subexpressions
2015-12-09 09:48:39 -05:00
Michael McConville c03bef5411 Remove allocation casts 2015-12-07 21:28:21 -05:00
Will Estes 53e3088d75 Built flex with itself.
Changes in scan.l need to be built into flex with the same version of
flex in some cases. Since this build requirement is minimal, we simply
bootstrap flex unconditionally.

We intentionally exclude from version control the bootstrap artifacts as
the extra copy of the lexer, the intermediate scanner and the bootstrap
executable are not of interest.
2015-12-07 15:37:01 -05:00
Michael McConville e0877888da Use NULL rather than (type *) 0. 2015-12-05 18:50:53 -05:00
Michael McConville 3a1d84cfc0 Replace copy_unsigned_string() with xstrdup().
Like copy_string(), copy_unsigned_string() is just a clone of the
stlib's strdup(). We only use it twice. I'm pretty confident that char
signedness is irrelevant in this case.
2015-12-05 17:42:40 -05:00
Akim Demaille a562291415 Cleaned up white space. 2015-12-05 06:01:48 -05:00
Akim Demaille 35a307f959 Removed struct keyword before yy_buffer_state 2015-12-05 05:49:51 -05:00
Akim Demaille 004399be12 Replaced FLEX_STD macro with std::.
The std:: construct exists as of C++98, so we can simply assume it is
supported.
2015-12-05 05:46:19 -05:00
Akim Demaille 4cea6bfe54 Generated skel.c explicitly in srcdir.
Rewrote the target for skel.c to explicitly mention the srcdir. This
should help when building flex from a directory outside the flex
tree. Spread the rule out over several lines to enhance readability.
2015-12-04 15:07:11 -05:00
Akim Demaille 7ddfe81aa8 Called glibtoolize if libtoolize run fails.
On Mac OS X, libtoolize is known as glibtoolize. In cases where libtoolize is not present, then calling glibtoolize when bootstrapping the build system gives more folks a shot at getting flex built from the ground up.
2015-12-04 14:59:54 -05:00
Mightyjo 9e24fe5ea9 Checked for (g)texi2dvi. Better bison, help2man checks.
Added test for presence of (g)texi2dvi program. Gave notice if texi2dvi
is unavailable and set TEXI2DVI=: to avoid giving users headaches.

Enhanced tests for bison and help2man with notices when the programs
aren't found.  Set their program variables to use the missing script
in build-aux since it's compatible with them.
2015-12-03 07:21:48 -05:00
Michael McConville 399e94f904 Made string copying more standard.
copy_string() was a clone of the stdlib's strdup(). For safety,
simplicity, and speed, we should use that instead. We introduce xstrdup() which wraps strdup() in a failure upon memory allocation errors.
2015-12-02 14:39:09 -05:00
Serguey Parkhomovsky 9ba6e5283e Error on unbalanced parentheses in rules section. 2015-11-30 19:33:32 -05:00
Will Estes f1d53eb001 Cleaned up BUILT_SOURCES list.
Removed reference to skel.c as a built source since other make rules cover this case.
2015-11-29 19:43:05 -05:00
Will Estes 9e1ec519f4 Sorted file names in flex_SOURCES 2015-11-29 19:30:19 -05:00
Mightyjo a97cf48486 Replaced CHAR macro with unsigned char type.
Thanks to Michael McConville for pointing out that the old Char macro
causes problems with static analysis.  The macro has been removed and
replaced with 'unsigned char' throughout the flex sources. The macro is
not needed at best and was confusing at worst. It was not used in any of
the example files nor was it mentioned in the manual at all.
2015-11-29 17:20:22 -05:00
Will Estes 45db9033fe updated syntax of AC_INIT call as per autoupdate 2015-11-21 13:15:53 -05:00
Will Estes 3bc38e963e removed extra call to a _CPPFLAGS variable 2015-11-21 13:12:58 -05:00
Stefan Reinauer 0f7b9136ed Switch function definitions from mixed K&R to consistent ANSI C.
flex was using K&R function definitions for some functions and
ANSI C style in others, sometimes even in the same file. Change
the code to consistently use ANSI C.

Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-11-19 19:26:07 -05:00
Mightyjo 09eae589d3 Used in-tree header file for c++ tests. 2015-11-18 15:03:03 -05:00
Will Estes 83d5d1695a Declared version 2.6.0 2015-11-17 11:16:43 -05:00
Will Estes d34b6160af Dated, described flex release 2.6.0 2015-11-17 11:14:05 -05:00
Will Estes 5263986825 Declared version 2.6.0rc1 2015-11-13 14:56:25 -05:00
lukeallardyce 54201ab377 Supplied versioning information in flex libraries.
Resolves sourceforge bug #182. On OSX, and possibly other platforms, building the libfl libraries without versioning information caused a build failures.
2015-11-13 14:48:19 -05:00
Will Estes 0be145eea8 Cleaned up more precisely after make check.
BUILT_SOURCES is now just the list of headers built as per the
automake manual. We provide the list of files to clean to make
rebuilding the test suite programs easier. We then use the CLEANFILES
list in a dist-hook to clean up the distribution that automake gathers
since not distributing flex generated files is foreign to automake's
mindset, but we need exactly that.

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

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

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

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

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

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

Re-added backward-compatible versions of the yyFlexLexer methods that take iostream pointers.  All tests passing.
2015-11-07 23:25:24 -08:00
Translation Project 5acd407ed4 new zh_CN translation from the translation project 2015-09-29 15:53:33 -04:00
Jaska Uimonen b4b8b7ed81 fix possible resource leak with yynultrans_tbl 2015-08-06 09:28:21 -04:00
Jaska Uimonen 5f23fc0033 fix possible uninitialized array values 2015-08-06 09:27:30 -04:00
Will Estes 4f2ae90b28 add %{...%} block to example in manual 2015-08-05 15:27:37 -04:00
Will Estes b6fa146a0f initialize libtool earlier in build system generation 2015-07-15 15:20:11 -04:00
Translation Project 341bfbd389 new da translation from the Translation Project 2015-05-08 15:15:56 -04:00
259 changed files with 32565 additions and 39026 deletions
+29
View File
@@ -0,0 +1,29 @@
name: Build and Test
on:
push:
branches: [ master ]
tags-ignore:
- 'v*'
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: apt
run: sudo apt-get install gcc autoconf bison gettext autopoint help2man lzip texinfo texlive
- name: autogen
run: ./autogen.sh
- name: configure
run: ./configure
- name: make
run: make
- name: make check
run: make check
- name: make distcheck
run: make distcheck
+79
View File
@@ -0,0 +1,79 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '31 22 * * 4'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Apt
run: sudo apt-get install gcc autoconf bison gettext autopoint help2man lzip texinfo texlive
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild expects to start by running configure.
# Run autogen.sh to ensure configure exists.
- name: Autogen
run: |
./autogen.sh
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following four lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- name: Build
# run: |
# ./configure
# make
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
+6 -5
View File
@@ -1,23 +1,24 @@
*.orig
*.rej
*.tar.bz2
*.sig
*.tar.gz
*.tar.xz
*.tar.lz
*~
.deps
.libs
ABOUT-NLS
ChangeLog
INSTALL
Makefile
Makefile.in
aclocal.m4
autom4te.cache
autoscan.log
build-aux/
config.log
config.status
configure
configure.scan
flex-*/
libtool
stamp-*
m4/
build-aux/
stamp-*
+50
View File
@@ -0,0 +1,50 @@
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
@@ -0,0 +1 @@
2.6.4
-107
View File
@@ -1,107 +0,0 @@
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
@@ -0,0 +1,5 @@
# 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.
+67
View File
@@ -0,0 +1,67 @@
# INSTALLING Flex
## Should you be here at all?
If building, developing or compiling C programs is new to you, you probably want to use your operating system's standard means of installing software to install flex. If you do not need the latest features of flex, you probably just want to use your operating system's standard means of installing software to obtain flex.
## Now that you know you should be here ...
If you are not familiar with bootstrapping C code from a git repository or if GNU autotools seems like a jumble of tenuous incantationery to you, then make sure that you downloaded one of the release tar archives of flex. You can verify this by checking the filename of what you downloaded. If it is something like "flex-<version>.tar.<compressiontype>" then you have a release tar archives. If you have a filename like "flex.tar.gz" or "flex.zip", you have a copy of the git repository and you didn't download the thing you wanted to.
## Building from a release archive
To build flex from a release archive:
$ ./configure <any configure options you need>
$ make
To see what options are available from the configure script:
$ ./configure --help
Optionally run the test suite:
$ make check
To install the flex you just built:
$ make install
Note that you may want to make use of the DESTDIR argument on the "make install" command line or that you may want to have used the "--prefix" argument with configure (or mostly equivalently the "prefix" argument on the make command line).
## Building from the git repository
To build from the git repository:
First, make sure you have a copy of flex installed somewhere on your path so that configure can find it. You can usually do this with your operating system's standard means of installing software. Sometimes, you have to build from a recent release of flex, however.
You will also need all the programs that flex needs in order to be built from scratch --
* 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.
Then:
$ ./autogen.sh
After autogen.sh finishes successfully, building flex follows the same steps as building flex from a release archive.
Note that, in addition to "make check", "make distcheck" builds a release archive and builds and tests flex from inside a directory containing only known distributed files.
+37 -10
View File
@@ -27,28 +27,25 @@
# 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
README.md
EXTRA_DIST = \
.indent.pro \
autogen.sh
INSTALL
dist_noinst_SCRIPTS = \
autogen.sh \
po/update_linguas.sh
SUBDIRS = \
lib \
src \
doc \
examples \
@@ -56,6 +53,29 @@ 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
@@ -63,8 +83,15 @@ 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: ChangeLog tags indent
lint:
shellcheck -f gcc tests/*.sh src/*.sh *.sh
.PHONY: libfl install-libfl uninstall-libfl clean-libfl \
ChangeLog indent lint
+270 -4
View File
@@ -1,9 +1,273 @@
This is the file NEWS for the flex package. It records user -visible
changes between releases of flex.
flex NEWS
See the file COPYING for copying conditions.
* Noteworthy changes in release ?.? (????-??-??) [?]
* version 2.6.0-pre
** 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
* flex version 2.5.39 released 2014-03-26
@@ -528,6 +792,8 @@ 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
@@ -1,113 +0,0 @@
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.
+73
View File
@@ -0,0 +1,73 @@
[![Build Status](https://github.com/westes/flex/actions/workflows/build.yml/badge.svg)](https://github.com/westes/flex/actions/workflows/build.yml)
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.
---
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.
+6 -63
View File
@@ -1,66 +1,9 @@
* the manual:
Things to be worked on:
** do an end-to-end proofread of the manual (this is under way, but is
going slowly)
* Tests for %option user-init, %option pre-action, %option post-action.
** pretty up the dvi output; overflows, etc.
* integrate examples directory into tests so that normal testing
proves the examples are up to date.
** 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:
* Do away with any need for -lfl by generating a default yywrap
if the user doesn't specify one.
+22 -2
View File
@@ -24,9 +24,29 @@
# If you see no configure script, then run ./autogen.sh to create it
# and procede with the "normal" build procedures.
# use LIBTOOLIZE, if set
if test "x$LIBTOOLIZE" = "x"; then
for ac_prog in libtoolize glibtoolize; do
if $ac_prog --version >/dev/null 2>&1; then
LIBTOOLIZE=$ac_prog
break
fi
done
fi
# test libtoolize
if test "x$LIBTOOLIZE" = "x" || ! $LIBTOOLIZE --version >/dev/null; then
echo "error: libtoolize not working, re-run with LIBTOOLIZE=/path/to/libtoolize">&2
echo " LIBTOOLIZE is currently \"$LIBTOOLIZE\"">&2
exit 1
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.)
touch ChangeLog
autoreconf --install --verbose --force
if ! test -f ChangeLog; then
touch ChangeLog
fi
$LIBTOOLIZE --install --force
autoreconf --install --force
+90 -30
View File
@@ -24,33 +24,79 @@
# autoconf requirements and initialization
AC_INIT([the fast lexical analyser generator], [2.6.0-pre],
[flex-help@lists.sourceforge.net], [flex])
AC_INIT([the fast lexical analyser generator],[2.6.4],[flex-help@lists.sourceforge.net],[flex])
AC_PREREQ([2.60])
AC_CONFIG_SRCDIR([src/scan.l])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([gnu check-news std-options dist-bzip2 dist-xz parallel-tests 1.14.1])
AC_USE_SYSTEM_EXTENSIONS
LT_INIT
AM_INIT_AUTOMAKE([1.15 -Wno-portability foreign std-options dist-lzip parallel-tests subdir-objects])
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])
AM_GNU_GETTEXT_VERSION([0.19.7])
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
AC_PATH_PROG(BISON, bison,bison)
AC_PATH_PROG(HELP2MAN, help2man, help2man)
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)
)
# Check for a m4 that supports -P
@@ -63,25 +109,20 @@ 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, 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
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)
])
# checks for headers
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])
AC_CHECK_HEADERS([regex.h strings.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])
# checks for libraries
@@ -89,12 +130,12 @@ AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h r
# 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_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_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_CHECK_LIB(m, log10)
@@ -108,9 +149,28 @@ 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
AC_CHECK_FUNCS([dup2 isascii memset pow regcomp setlocale strchr strtol])
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_CONFIG_FILES(
Makefile
@@ -118,8 +178,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
Regular → Executable
+12 -26
View File
@@ -1,31 +1,17 @@
help2man = @HELP2MAN@
FLEX = $(top_builddir)/src/flex$(EXEEXT)
TEXI2DVI = @TEXI2DVI@ -I $(srcdir)/../examples/manual/
TEXI2PDF = @TEXI2PDF@ -I $(srcdir)/../examples/manual/
info_TEXINFOS = flex.texi
AM_MAKEINFOFLAGS = -I $(srcdir)/../examples/manual/
dist_man_MANS = flex.1
dist_doc_DATA= flex.pdf
MAINTAINERCLEANFILES = flex.1
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
CLEANFILES = *.aux *.cp *.cps *.fn *.fns *.hk *.hks *.ky *.log \
*.op *.ops *.pg *.toc *.tp *.tps *.vr *.vrs
$(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
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 $@
Regular → Executable
+1567 -1040
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -30,6 +30,9 @@ EXTRA_DIST = \
eof_test01.txt \
eof_test02.txt \
eof_test03.txt \
example_er.lex \
example_r.lex \
example_nr.lex \
expr.lex \
expr.y \
front.lex \
+13
View File
@@ -18,10 +18,23 @@ ALLOCA =
# DO NOT CHANGE ANYTHING FROM HERE ON !!!!!!!!!
#
############################################################
PATH := /usr/local/bin:${PATH}
all: expr front myname eof wc replace user_act string1\
string2 yymore numbers dates cat
example_r: example_r.lex
$(LEX) example_r.lex
$(CC) lex.yy.c -o example_r
example_nr: example_nr.lex
$(LEX) example_nr.lex
$(CC) lex.yy.c -o example_nr
example_er: example_er.lex
$(LEX) example_er.lex
$(CC) lex.yy.c -o example_er
expr: expr.y expr.lex
$(YACC) expr.y
$(LEX) expr.lex
+6
View File
@@ -10,3 +10,9 @@ To build the programs individually, type
For example:
make -f Makefile.examples expr
If you ad an eample to this directory, don't frget these steps:
* Add it to the EXTRA_DIST list in Makefile.am
* Add a build recipe to Makefile/examples.
+12 -12
View File
@@ -54,13 +54,13 @@ day_ext (st|nd|rd|th)?
/* the default is month-day-year */
<LONG>{day_of_the_week} strcpy(dow,yytext);
<LONG>{month} strcpy(month,yytext); BEGIN(DAY);
<LONG>{month} strcpy(month,yytext); yybegin(DAY);
/* handle the form: day-month-year */
<LONG>{nday}{day_ext} strcpy(day,yytext); BEGIN(DAY_FIRST);
<DAY_FIRST>{month} strcpy(month,yytext); BEGIN(LONG);
<DAY>{nday}{day_ext} strcpy(day,yytext); BEGIN(LONG);
<LONG>{nday}{day_ext} strcpy(day,yytext); yybegin(DAY_FIRST);
<DAY_FIRST>{month} strcpy(month,yytext); yybegin(LONG);
<DAY>{nday}{day_ext} strcpy(day,yytext); yybegin(LONG);
<LONG>{nyear}{year_ext} {
printf("Long:\n");
@@ -75,15 +75,15 @@ day_ext (st|nd|rd|th)?
/* handle dates of the form: day-month-year */
<SHORT>{nday} strcpy(day,yytext); BEGIN(YEAR_LAST);
<YEAR_LAST>{nmonth} strcpy(month,yytext);BEGIN(YLMONTH);
<YLMONTH>{nyear} strcpy(year,yytext); BEGIN(SHORT);
<SHORT>{nday} strcpy(day,yytext); yybegin(YEAR_LAST);
<YEAR_LAST>{nmonth} strcpy(month,yytext);yybegin(YLMONTH);
<YLMONTH>{nyear} strcpy(year,yytext); yybegin(SHORT);
/* handle dates of the form: year-month-day */
<SHORT>{nyear} strcpy(year,yytext); BEGIN(YEAR_FIRST);
<YEAR_FIRST>{nmonth} strcpy(month,yytext);BEGIN(YFMONTH);
<YFMONTH>{nday} strcpy(day,yytext); BEGIN(SHORT);
<SHORT>{nyear} strcpy(year,yytext); yybegin(YEAR_FIRST);
<YEAR_FIRST>{nmonth} strcpy(month,yytext);yybegin(YFMONTH);
<YFMONTH>{nday} strcpy(day,yytext); yybegin(SHORT);
<SHORT>\n {
@@ -96,8 +96,8 @@ day_ext (st|nd|rd|th)?
strcpy(month,"");
}
long\n BEGIN(LONG);
short\n BEGIN(SHORT);
long\n yybegin(LONG);
short\n yybegin(SHORT);
{skip}*
\n
+5 -5
View File
@@ -17,15 +17,15 @@ int include_count = -1;
%%
^"#include"[ \t]*\" BEGIN(INCLUDE);
<INCLUDE>\" BEGIN(INITIAL);
^"#include"[ \t]*\" yybegin(INCLUDE);
<INCLUDE>\" yybegin(INITIAL);
<INCLUDE>[^\"]+ { /* get the include file name */
if ( include_count >= MAX_NEST){
fprintf( stderr, "Too many include files" );
exit( 1 );
}
include_stack[++include_count] = YY_CURRENT_BUFFER;
include_stack[++include_count] = yy_current_buffer();
yyin = fopen( yytext, "r" );
if ( ! yyin ){
@@ -35,7 +35,7 @@ int include_count = -1;
yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
BEGIN(INITIAL);
yybegin(INITIAL);
}
<INCLUDE><<EOF>>
{
@@ -48,7 +48,7 @@ int include_count = -1;
} else {
yy_delete_buffer(include_stack[include_count--] );
yy_switch_to_buffer(include_stack[include_count] );
BEGIN(INCLUDE);
yybegin(INCLUDE);
}
}
[a-z]+ ECHO;
+35
View File
@@ -0,0 +1,35 @@
/* basic example, fully reentrant thread-safe version */
%{
struct stats {
int num_lines;
int num_chars;
};
%}
%option reentrant noyywrap
%option extra-type="struct stats"
%%
\n {
struct stats ns = yyget_extra(yyscanner);
++ns.num_lines; ++ns.num_chars;
yyset_extra(ns, yyscanner);
}
. {
struct stats ns = yyget_extra(yyscanner);
++ns.num_chars;
yyset_extra(ns, yyscanner);
}
%%
int main() {
yyscan_t scanner;
struct stats ns;
yylex_init ( &scanner );
yylex ( scanner );
ns = yyget_extra(scanner);
printf( "# of lines = %d, # of chars = %d\n",
ns.num_lines, ns.num_chars);
yylex_destroy ( scanner );
}
+16
View File
@@ -0,0 +1,16 @@
/* basic example - non-reentrant version */
%{
int num_lines = 0, num_chars = 0;
%}
%option noyywrap
%%
\n ++num_lines; ++num_chars;
. ++num_chars;
%%
int main() {
yylex();
printf( "# of lines = %d, # of chars = %d\n",
num_lines, num_chars );
}
+21
View File
@@ -0,0 +1,21 @@
/* basic example - flawed reentrant version with global */
%{
int num_lines = 0, num_chars = 0;
%}
%option reentrant noyywrap
%%
\n ++num_lines; ++num_chars;
. ++num_chars;
%%
int main() {
yyscan_t scanner;
yylex_init ( &scanner );
yylex ( scanner );
yylex_destroy ( scanner );
printf( "# of lines = %d, # of chars = %d\n",
num_lines, num_chars );
}
-3
View File
@@ -3,9 +3,6 @@
#include <string.h>
#include "y.tab.h" /* this comes from bison */
#define TRUE 1
#define FALSE 0
#define copy_and_return(token_type) { strcpy(yylval.name,yytext); \
return(token_type); }
+22 -22
View File
@@ -158,7 +158,7 @@ void write_block_header(char *type)
printf("\n\n@table @b\n");
}
"Examples:"[^\.]+ ECHO;
"Examples:"[^\.]+ yyecho();
"*"[^*\n]+"*" { /* @emph{}(emphasized) text */
yytext[yyleng-1] = '\0';
@@ -205,12 +205,12 @@ void write_block_header(char *type)
yyless(loop+1);
statep++;
states[statep] = EXAMPLE2;
BEGIN(EXAMPLE2);
yybegin(EXAMPLE2);
}
<EXAMPLE,EXAMPLE2>^\n {
printf("@end example\n\n");
statep--;
BEGIN(states[statep]);
yybegin(states[statep]);
}
/*
@@ -231,7 +231,7 @@ void write_block_header(char *type)
yyless(loop);
statep++;
states[statep] = ENUM;
BEGIN(ENUM);
yybegin(ENUM);
}
<ENUM>"@" printf("@@");
@@ -239,7 +239,7 @@ void write_block_header(char *type)
printf(":\n\n@example\n");
statep++;
states[statep] = EXAMPLE;
BEGIN(EXAMPLE);
yybegin(EXAMPLE);
}
@@ -250,7 +250,7 @@ void write_block_header(char *type)
<ENUM>\n\n\n[ \t]+[^0-9] {
printf("\n\n@end enumerate\n\n");
statep--;
BEGIN(states[statep]);
yybegin(states[statep]);
}
/*
@@ -265,7 +265,7 @@ void write_block_header(char *type)
yyless(2);
statep++;
states[statep] = LITEM2;
BEGIN(LITEM2);
yybegin(LITEM2);
}
<LITEM2>^":".+":" {
(void)check_and_convert(&yytext[1]);
@@ -275,9 +275,9 @@ void write_block_header(char *type)
<LITEM2>\n\n\n+[^:\n] {
printf("\n\n@end itemize\n\n");
ECHO;
yyecho();
statep--;
BEGIN(states[statep]);
yybegin(states[statep]);
}
/*
@@ -300,7 +300,7 @@ void write_block_header(char *type)
yyless(loop);
statep++;
states[statep] = LITEM;
BEGIN(LITEM);
yybegin(LITEM);
}
<LITEM>^.+":" {
(void)check_and_convert(yytext);
@@ -318,7 +318,7 @@ void write_block_header(char *type)
printf("@end itemize\n\n");
printf("%s",&buffer[loop+1]);
statep--;
BEGIN(states[statep]);
yybegin(states[statep]);
}
/*
@@ -338,27 +338,27 @@ void write_block_header(char *type)
yyless((len-loop)+2);
statep++;
states[statep] = BITEM;
BEGIN(BITEM);
yybegin(BITEM);
}
<BITEM>^" "*"*" {
printf("@item");
statep++;
states[statep] = BITEM_ITEM;
BEGIN(BITEM_ITEM);
yybegin(BITEM_ITEM);
}
<BITEM>"@" printf("@@");
<BITEM>^\n {
printf("@end itemize\n\n");
statep--;
BEGIN(states[statep]);
yybegin(states[statep]);
}
<BITEM_ITEM>[^\:]* {
printf(" @b{%s}\n\n",check_and_convert(yytext));
}
<BITEM_ITEM>":" {
statep--;
BEGIN(states[statep]);
yybegin(states[statep]);
}
/*
@@ -369,13 +369,13 @@ void write_block_header(char *type)
(void)check_and_convert(&yytext[1]);
statep++;
states[statep] = HEADING;
BEGIN(HEADING);
yybegin(HEADING);
}
<HEADING>:[^\n] {
printf("@item @b{%s}\n",buffer);
write_underline(strlen(buffer),6,'~');
statep--;
BEGIN(states[statep]);
yybegin(states[statep]);
}
<HEADING>:\n"*"* {
if(need_closing == TRUE){
@@ -385,7 +385,7 @@ void write_block_header(char *type)
printf("@chapter %s\n",buffer);
write_underline(strlen(buffer),9,'*');
statep--;
BEGIN(states[statep]);
yybegin(states[statep]);
}
<HEADING>:\n"="* {
if(need_closing == TRUE){
@@ -395,7 +395,7 @@ void write_block_header(char *type)
printf("@section %s\n",buffer);
write_underline(strlen(buffer),9,'=');
statep--;
BEGIN(states[statep]);
yybegin(states[statep]);
}
<HEADING>"@" printf("@@");
<HEADING>:\n"-"* {
@@ -406,7 +406,7 @@ void write_block_header(char *type)
printf("@subsection %s\n",buffer);
write_underline(strlen(buffer),12,'-');
statep--;
BEGIN(states[statep]);
yybegin(states[statep]);
}
/*
@@ -417,10 +417,10 @@ void write_block_header(char *type)
printf("@example\n");
statep++;
states[statep] = EXAMPLE;
BEGIN(EXAMPLE);
yybegin(EXAMPLE);
}
<EXAMPLE>^" "
. ECHO;
. yyecho();
%%
+9 -9
View File
@@ -19,13 +19,13 @@ int include_count = -1;
%%
"{" BEGIN(COMMENT);
"{" yybegin(COMMENT);
<COMMENT>"}" BEGIN(INITIAL);
<COMMENT>"$include"[ \t]*"(" BEGIN(INCLUDE);
<COMMENT>"}" yybegin(INITIAL);
<COMMENT>"$include"[ \t]*"(" yybegin(INCLUDE);
<COMMENT>[ \t]* /* skip whitespace */
<INCLUDE>")" BEGIN(COMMENT);
<INCLUDE>")" yybegin(COMMENT);
<INCLUDE>[ \t]* /* skip whitespace */
<INCLUDE>[^ \t\n() ]+ { /* get the include file name */
if ( include_count >= MAX_NEST){
@@ -33,7 +33,7 @@ int include_count = -1;
exit( 1 );
}
include_stack[++include_count] = YY_CURRENT_BUFFER;
include_stack[++include_count] = yy_current_buffer();
yyin = fopen( yytext, "r" );
if ( ! yyin ){
@@ -43,7 +43,7 @@ int include_count = -1;
yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
BEGIN(INITIAL);
yybegin(INITIAL);
}
<INCLUDE><<EOF>>
{
@@ -61,11 +61,11 @@ int include_count = -1;
} else {
yy_delete_buffer(include_stack[include_count--] );
yy_switch_to_buffer(include_stack[include_count] );
BEGIN(INCLUDE);
yybegin(INCLUDE);
}
}
[a-z]+ ECHO;
.|\n ECHO;
[a-z]+ yyecho();
.|\n yyecho();
+4 -4
View File
@@ -31,17 +31,17 @@ bad_string \'([^'\n]|\'\')+
%%
"{" BEGIN(COMMENT1);
"{" yybegin(COMMENT1);
<COMMENT1>[^}\n]+
<COMMENT1>\n ++line_number;
<COMMENT1><<EOF>> yyerror("EOF in comment");
<COMMENT1>"}" BEGIN(INITIAL);
<COMMENT1>"}" yybegin(INITIAL);
"(*" BEGIN(COMMENT2);
"(*" yybegin(COMMENT2);
<COMMENT2>[^)*\n]+
<COMMENT2>\n ++line_number;
<COMMENT2><<EOF>> yyerror("EOF in comment");
<COMMENT2>"*)" BEGIN(INITIAL);
<COMMENT2>"*)" yybegin(INITIAL);
<COMMENT2>[*)]
/* note that FILE and BEGIN are already
+3 -3
View File
@@ -1,12 +1,12 @@
/*
* reject.lex: An example of REJECT and unput()
* reject.lex: An example of yyreject() and yyunput()
* misuse.
*/
%%
UNIX {
unput('U'); unput('N'); unput('G'); unput('\0');
REJECT;
yyunput('U'); yyunput('N'); yyunput('G'); yyunput('\0');
yyreject();
}
GNU printf("GNU is Not Unix!\n");
%%
+1 -1
View File
@@ -16,7 +16,7 @@ char upper_replace[1024];
"yy" printf("%s",lower_replace);
"YY" printf("%s",upper_replace);
, ECHO;
, yyecho();
%%
+9 -9
View File
@@ -1,5 +1,5 @@
/*
* string1.lex: Handling strings by using input()
* string1.lex: Handling strings by using yyinput()
*/
%{
@@ -27,13 +27,13 @@ void yyerror(char *message)
buffer = malloc(ALLOC_SIZE);
max_size = ALLOC_SIZE;
inch = input();
inch = yyinput();
count = 0;
while(inch != EOF && inch != '"' && inch != '\n'){
if(inch == '\\'){
inch = input();
inch = yyinput();
switch(inch){
case '\n': inch = input(); break;
case '\n': inch = yyinput(); break;
case 'b' : inch = '\b'; break;
case 't' : inch = '\t'; break;
case 'n' : inch = '\n'; break;
@@ -41,10 +41,10 @@ void yyerror(char *message)
case 'f' : inch = '\f'; break;
case 'r' : inch = '\r'; break;
case 'X' :
case 'x' : inch = input();
case 'x' : inch = yyinput();
if(isxdigit(inch)){
temp = hextoint(toupper(inch));
inch = input();
inch = yyinput();
if(isxdigit(inch)){
temp = (temp << 4) + hextoint(toupper(inch));
} else {
@@ -59,14 +59,14 @@ void yyerror(char *message)
default:
if(isodigit(inch)){
temp = inch - '0';
inch = input();
inch = yyinput();
if(isodigit(inch)){
temp = (temp << 3) + (inch - '0');
} else {
unput(inch);
goto done;
}
inch = input();
inch = yyinput();
if(isodigit(inch)){
temp = (temp << 3) + (inch - '0');
} else {
@@ -82,7 +82,7 @@ void yyerror(char *message)
buffer = realloc(buffer,max_size + ALLOC_SIZE);
max_size += ALLOC_SIZE;
}
inch = input();
inch = yyinput();
}
if(inch == EOF || inch == '\n'){
yyerror("Unterminated string.");
+4 -4
View File
@@ -30,17 +30,17 @@ oct [0-7]{1,3}
\" {
buffer = malloc(1);
buffer_size = 1; strcpy(buffer,"");
BEGIN(STRING);
yybegin(STRING);
}
<STRING>\n {
yyerror("Unterminated string");
free(buffer);
BEGIN(INITIAL);
yybegin(INITIAL);
}
<STRING><<EOF>> {
yyerror("EOF in string");
free(buffer);
BEGIN(INITIAL);
yybegin(INITIAL);
}
<STRING>[^\\\n"] {
buffer = realloc(buffer,buffer_size+yyleng+1);
@@ -87,7 +87,7 @@ oct [0-7]{1,3}
<STRING>\" {
printf("string = \"%s\"",buffer);
free(buffer);
BEGIN(INITIAL);
yybegin(INITIAL);
}
%%
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* unput.l : An example of what *not*
* to do with unput().
* to do with yyunput().
*/
@@ -24,7 +24,7 @@ void putback_yytext(void)
strcpy(buffer,yytext);
printf("Got: %s\n",yytext);
for(i=0; i<l; i++){
unput(buffer[i]);
yyunput(buffer[i]);
}
}
+3 -4
View File
@@ -4,14 +4,13 @@
void user_action(void);
#define YY_USER_ACTION user_action();
%}
%option pre-action = "user_action();"
%%
.* ECHO;
\n ECHO;
.* yyecho();
\n yyecho();
%%
+1 -2
View File
@@ -1,6 +1,4 @@
%{
#define YY_USER_INIT open_input_file()
extern FILE *yyin;
void open_input_file(void)
@@ -27,4 +25,5 @@ void open_input_file(void)
}
%}
%option user-init = "open_input_file();"
%%
+4 -4
View File
@@ -16,14 +16,14 @@ void yyerror(char *message)
%x STRING
%%
\" BEGIN(STRING);
\" yybegin(STRING);
<STRING>[^\\\n"]* yymore();
<STRING><<EOF>> yyerror("EOF in string."); BEGIN(INITIAL);
<STRING>\n yyerror("Unterminated string."); BEGIN(INITIAL);
<STRING><<EOF>> yyerror("EOF in string."); yybegin(INITIAL);
<STRING>\n yyerror("Unterminated string."); yybegin(INITIAL);
<STRING>\\\n yymore();
<STRING>\" {
yytext[yyleng-1] = '\0';
printf("string = \"%s\"",yytext); BEGIN(INITIAL);
printf("string = \"%s\"",yytext); yybegin(INITIAL);
}
%%
+4 -4
View File
@@ -16,11 +16,11 @@ void yyerror(char *message)
%x STRING
%%
\" BEGIN(STRING);
\" yybegin(STRING);
<STRING>[^\\\n"]* yymore();
<STRING><<EOF>> yyerror("EOF in string."); BEGIN(INITIAL);
<STRING>\n yyerror("Unterminated string."); BEGIN(INITIAL);
<STRING><<EOF>> yyerror("EOF in string."); yybegin(INITIAL);
<STRING>\n yyerror("Unterminated string."); yybegin(INITIAL);
<STRING>\\\n {
bcopy(yytext,yytext+2,yyleng-2);
yytext += 2; yyleng -= 2;
@@ -28,6 +28,6 @@ void yyerror(char *message)
}
<STRING>\" {
yyleng -= 1; yytext[yyleng] = '\0';
printf("string = \"%s\"",yytext); BEGIN(INITIAL);
printf("string = \"%s\"",yytext); yybegin(INITIAL);
}
%%
+3 -3
View File
@@ -39,13 +39,13 @@ number {num1}|{num2}
}
}
{number} FLEX_STD cout << "number " << YYText() << '\n';
{number} std::cout << "number " << YYText() << '\n';
\n mylineno++;
{name} FLEX_STD cout << "name " << YYText() << '\n';
{name} std::cout << "name " << YYText() << '\n';
{string} FLEX_STD cout << "string " << YYText() << '\n';
{string} std::cout << "string " << YYText() << '\n';
%%
-4
View File
@@ -1,4 +0,0 @@
noinst_LTLIBRARIES = libcompat.la
libcompat_la_SOURCES = lib.c
libcompat_la_LIBADD = $(LTLIBOBJS)
-7
View File
@@ -1,7 +0,0 @@
/* 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
@@ -0,0 +1,125 @@
# ===========================================================================
# 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
])
+2 -23
View File
@@ -1,23 +1,2 @@
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
# 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
+38 -1
View File
@@ -8,7 +8,7 @@ subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
XGETTEXT_OPTIONS = --language=C --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,6 +20,13 @@ XGETTEXT_OPTIONS = --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
@@ -39,3 +46,33 @@ 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,7 +12,6 @@ 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
@@ -1,9 +0,0 @@
# 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
+972
View File
@@ -0,0 +1,972 @@
# Bulgarian translation of flex po-file.
# Copyright (C) 2019, 2021 The Flex Project (msgids)
# This file is distributed under the same license as the flex package.
# Alexander Shopov <ash@kambanaria.org>, 2019, 2021.
msgid ""
msgstr ""
"Project-Id-Version: flex 2.6.4\n"
"Report-Msgid-Bugs-To: flex-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2022-09-27 14:18-0400\n"
"PO-Revision-Date: 2022-01-03 10:52+0100\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"
#: src/buf.c:61
msgid "Allocation of buffer to print string failed"
msgstr "Неуспешно заделяне на буфер за отпечатване на низ"
#: src/ccl.c:80
msgid "internal error: trying to add a char to a non-last ccl.\n"
msgstr ""
#: 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 " изходящи преходи: "
#: src/dfa.c:201
#, c-format
msgid ""
"\n"
" jam-transitions: EOF "
msgstr ""
"\n"
" обобщени преходи: край на файл"
#: src/dfa.c:331
msgid "consistency check failed in epsclosure()"
msgstr "неуспешна проверка за консистентност в „epsclosure()“"
#: src/dfa.c:422
msgid ""
"\n"
"\n"
"DFA Dump:\n"
"\n"
msgstr ""
"\n"
"\n"
"Извеждане на ДКА:\n"
"\n"
#: src/dfa.c:558
msgid "could not create unique end-of-buffer state"
msgstr "уникалното състояние за край на буфер не може да се създаде"
#: src/dfa.c:579
#, c-format
msgid "state # %d:\n"
msgstr "състояние №%d:\n"
#: src/dfa.c:738
msgid "Could not write yynxt_tbl[][]"
msgstr "„yynxt_tbl[][]“ не може да се запише"
#: src/dfa.c:1001
msgid "bad transition character detected in sympartition()"
msgstr "в „sympartition()“ има неправилен знак за преход"
#: src/gen.c:379
msgid ""
"\n"
"\n"
"Equivalence Classes:\n"
"\n"
msgstr ""
"\n"
"\n"
"Класове на еквивалентност:\n"
"\n"
#: src/gen.c:425 src/gen.c:454 src/gen.c:638
#, c-format
msgid "state # %d accepts: [%d]\n"
msgstr "състояние №%d приема: [%d]\n"
#: src/gen.c:533
#, c-format
msgid "state # %d accepts: "
msgstr "състояние №%d приема: "
#: src/gen.c:582
msgid "Could not write yyacclist_tbl"
msgstr "„yyacclist_tbl“ не може да се запише"
#: src/gen.c:659
msgid "Could not write yyacc_tbl"
msgstr "„yyacc_tbl“ не може да се запише"
#: src/gen.c:674 src/gen.c:947 src/gen.c:974
msgid "Could not write ecstbl"
msgstr "„ecstbl“ не може да се запише"
#: src/gen.c:694
msgid ""
"\n"
"\n"
"Meta-Equivalence Classes:\n"
msgstr ""
"\n"
"\n"
"Класове за мета-еквивалентност:\n"
#: src/gen.c:714
msgid "Could not write yymeta_tbl"
msgstr "„yymeta_tbl“ не може да се запише"
#: src/gen.c:774
msgid "Could not write yybase_tbl"
msgstr "„yybase_tbl“ не може да се запише"
#: src/gen.c:805
msgid "Could not write yydef_tbl"
msgstr "„yydef_tbl“ не може да се запише"
#: src/gen.c:844
msgid "Could not write yynxt_tbl"
msgstr "„yynxt_tbl“ не може да се запише"
#: src/gen.c:877
msgid "Could not write yychk_tbl"
msgstr "„yychk_tbl“ не може да се запише"
#: src/gen.c:932 src/gen.c:965
msgid "Could not write ftbl"
msgstr "„ftbl“ не може да се запише"
#: src/gen.c:938
msgid "Could not write ssltbl"
msgstr "„ssltbl“ не може да се запише"
#: src/gen.c:1014
msgid "Could not write eoltbl"
msgstr "„eoltbl“ не може да се запише"
#: src/gen.c:1061
msgid "Could not write yynultrans_tbl"
msgstr "„yynultrans_tbl“ не може да се запише"
#: src/main.c:169
msgid "rule cannot be matched"
msgstr "правилото не напасва"
#: src/main.c:174
msgid "-s option given but default rule can be matched"
msgstr "зададена е опцията „-s“, но стандартното правило напасва"
#: src/main.c:317
msgid "Can't use -+ with -l option"
msgstr "опциите „-+“ и „-l“ са несъвместими"
#: src/main.c:320
msgid "Can't use -f or -F with -l option"
msgstr "опциите „-f“/„-F“ и „-l“ са несъвместими"
#: src/main.c:324
#, fuzzy
msgid "Can't use --ctrl.reentrant or --bison-bridge with -l option"
msgstr "опциите „--reentrant“/„--bison-bridge“ и „-l“ са несъвместими"
#: src/main.c:356
msgid "-Cf/-CF and -Cm don't make sense together"
msgstr "опциите „-Cf“/„-CF“ и „-Cm“ са несъвместими"
#: src/main.c:359
msgid "-Cf/-CF and -I are incompatible"
msgstr "опциите „-Cf“/„-CF“ и „-I“ са несъвместими"
#: src/main.c:363
msgid "-Cf/-CF are incompatible with lex-compatibility mode"
msgstr "опциите „-Cf“/„-CF“ са несъвместими с режима за съвместимост с „lex“"
#: src/main.c:368
msgid "-Cf and -CF are mutually exclusive"
msgstr "опциите „-Cf“ и „-CF“ са несъвместими"
#: src/main.c:372
msgid "Can't use -+ with -CF option"
msgstr "опциите „-+“ и „-CF“ са несъвместими"
#: src/main.c:375
#, c-format
msgid "%array incompatible with -+ option"
msgstr "опцията „-+“ e несъвместима с декларация „%array“"
#: src/main.c:380
msgid "Options -+ and --reentrant are mutually exclusive."
msgstr "Опциите „-+“ и „--reentrant“ са несъвместими."
#: src/main.c:383
msgid "bison bridge not supported for the C++ scanner."
msgstr ""
"анализатори, които са на C++, не поддържат допълнителната поддръжка за "
"„bison“."
#: src/main.c:422 src/main.c:1235
#, c-format
msgid "could not create %s"
msgstr "„%s“ не може да се създаде"
#: src/main.c:443
#, c-format
msgid "%option yyclass only meaningful for C++ scanners"
msgstr ""
"директивата за „%option“ — „yyclass“ важи само за анализаторите, които са на "
"C++"
#: src/main.c:447
#, c-format
msgid "input error reading skeleton file %s"
msgstr "входна грешка при изчитане на скелетния файл „%s“"
#: src/main.c:451
#, c-format
msgid "error closing skeleton file %s"
msgstr "грешка при затваряне на скелетния файл „%s“"
#: src/main.c:457
#, c-format
msgid "error writing output file %s"
msgstr "грешка при записването на изходния файл „%s“"
#: src/main.c:461
#, c-format
msgid "error closing output file %s"
msgstr "грешка при затварянето на изходния файл „%s“"
#: src/main.c:465
#, c-format
msgid "error deleting output file %s"
msgstr "грешка при изтриването на изходния файл „%s“"
#: src/main.c:472
#, c-format
msgid "No backing up.\n"
msgstr "Без връщане назад.\n"
#: src/main.c:476
#, c-format
msgid "%d backing up (non-accepting) states.\n"
msgstr "%d състояния за връщане (неприемащи)\n"
#: src/main.c:480
#, c-format
msgid "Compressed tables always back up.\n"
msgstr "Компресираните таблици винаги водят до връщане назад.\n"
#: src/main.c:483
#, c-format
msgid "error writing backup file %s"
msgstr "грешка при записа на файла с връщанията назад „%s“"
#: src/main.c:487
#, c-format
msgid "error closing backup file %s"
msgstr "грешка при затварянето на файла с връщанията назад „%s“"
#: src/main.c:492
#, c-format
msgid "%s version %s usage statistics:\n"
msgstr "Статистика за употреба на %s, версия %s:\n"
#: src/main.c:495
#, c-format
msgid " scanner options: -"
msgstr " опции на лексическия анализатор: -"
#: src/main.c:574
#, c-format
msgid " %d/%d NFA states\n"
msgstr " %d/%d състояния на НКА\n"
#: src/main.c:576
#, c-format
msgid " %d/%d DFA states (%d words)\n"
msgstr " %d/%d състояния на ДКА (%d думи)\n"
#: src/main.c:578
#, c-format
msgid " %d rules\n"
msgstr " %d правила\n"
#: src/main.c:583
#, c-format
msgid " No backing up\n"
msgstr " Без връщане назад\n"
#: src/main.c:587
#, c-format
msgid " %d backing-up (non-accepting) states\n"
msgstr " %d състояния за връщане (неприемащи)\n"
#: src/main.c:592
#, c-format
msgid " Compressed tables always back-up\n"
msgstr " Компресираните таблици винаги водят до връщане\n"
#: src/main.c:596
#, c-format
msgid " Beginning-of-line patterns used\n"
msgstr " Използвани са правила за начало на ред\n"
#: src/main.c:598
#, c-format
msgid " %d/%d start conditions\n"
msgstr " %d/%d начални състояния\n"
#: src/main.c:602
#, c-format
msgid " %d epsilon states, %d double epsilon states\n"
msgstr " %d ε-състояния, %d двойни ε-състояния\n"
#: src/main.c:606
#, c-format
msgid " no character classes\n"
msgstr " няма класове знаци\n"
#: src/main.c:610
#, 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:615
#, c-format
msgid " %d state/nextstate pairs created\n"
msgstr " %d двойки състояние/преход\n"
#: src/main.c:618
#, c-format
msgid " %d/%d unique/duplicate transitions\n"
msgstr " %d/%d уникални/повтарящи се преходи\n"
#: src/main.c:623
#, c-format
msgid " %d table entries\n"
msgstr " %d таблични записи\n"
#: src/main.c:631
#, c-format
msgid " %d/%d base-def entries created\n"
msgstr " %d/%d записи за основни дефиниции\n"
#: src/main.c:635
#, c-format
msgid " %d/%d (peak %d) nxt-chk entries created\n"
msgstr " %d/%d (максимум %d) записи\n"
#: src/main.c:639
#, c-format
msgid " %d/%d (peak %d) template nxt-chk entries created\n"
msgstr " %d/%d (максимум %d) шаблонни записи\n"
#: src/main.c:643
#, c-format
msgid " %d empty table entries\n"
msgstr " %d празни таблични записи\n"
#: src/main.c:645
#, c-format
msgid " %d protos created\n"
msgstr " %d създадени прототипи\n"
#: src/main.c:648
#, c-format
msgid " %d templates created, %d uses\n"
msgstr " %d създадени шаблони, %d употреби\n"
#: src/main.c:656
#, c-format
msgid " %d/%d equivalence classes created\n"
msgstr " създадени са %d/%d класове за еквивалентност\n"
#: src/main.c:664
#, c-format
msgid " %d/%d meta-equivalence classes created\n"
msgstr " създадени са %d/%d класове за мета-еквивалентност\n"
#: src/main.c:670
#, c-format
msgid " %d (%d saved) hash collisions, %d DFAs equal\n"
msgstr " %d (%d запазени) конфликти по суми, %d ДКА са еднакви\n"
#: src/main.c:672
#, c-format
msgid " %d sets of reallocations needed\n"
msgstr " необходими са %d пъти заделяния на памет наново\n"
#: src/main.c:674
#, c-format
msgid " %d total table entries needed\n"
msgstr " необходими са общо %d записи в таблица\n"
#: src/main.c:735
#, c-format
msgid "Internal error. flexopts are malformed.\n"
msgstr "Вътрешна грешка. Неправилни опции за flex.\n"
#: src/main.c:745
#, c-format
msgid "Try `%s --help' for more information.\n"
msgstr "За повече информация изпълнете „%s --help“.\n"
#: src/main.c:807
#, c-format
msgid "unknown -C option '%c'"
msgstr "непозната опция към „-C“: „%c“"
#: src/main.c:1195
msgid "fatal parse error"
msgstr "фатална грешка на анализатора"
#: src/main.c:1247
msgid "could not write tables header"
msgstr "заглавният файл за таблиците не може за се запише"
#: src/main.c:1251
#, c-format
msgid "can't open skeleton file %s"
msgstr "скелетният файл „%s“ не може да се отвори"
#: src/main.c:1254
msgid "Prefix cannot include '[' or ']'"
msgstr "Префиксът не трябва да съдържа „[“ или „]“"
#: src/main.c:1322
#, c-format
msgid "could not create backing-up info file %s"
msgstr "файлът с информация за връщане назад не може да се създаде: „%s“"
#: src/main.c:1343
#, c-format
msgid "-l AT&T lex compatibility option entails a large performance penalty\n"
msgstr ""
"опцията за съвместимост с „lex“ на AT&T: „-l“, води до голяма загуба на "
"производителност\n"
#: src/main.c:1346
#, c-format
msgid " and may be the actual source of other reported performance penalties\n"
msgstr " и може да доведе до допълнителни проблеми с производителността\n"
#: src/main.c:1352
#, 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:1359
#, c-format
msgid "-I (interactive) entails a minor performance penalty\n"
msgstr "„-I“ (интерактивният режим) води до малка загуба на производителност\n"
#: src/main.c:1364
#, c-format
msgid "yymore() entails a minor performance penalty\n"
msgstr "„yymore()“ води до малка загуба на производителност\n"
#: src/main.c:1370
#, c-format
msgid "REJECT entails a large performance penalty\n"
msgstr "Отхвърлянето (REJECT) води до голяма загуба на производителност\n"
#: src/main.c:1375
#, c-format
msgid "Variable trailing context rules entail a large performance penalty\n"
msgstr ""
"Правила с последващ контекст, който не е константен, водят до голяма загуба "
"на производителност\n"
#: src/main.c:1387
msgid "REJECT cannot be used with -f or -F"
msgstr "Отхвърлянето (REJECT) е несъвместимо с „-f“ или „-F“"
#: src/main.c:1390
#, c-format
msgid "%option yylineno cannot be used with REJECT"
msgstr ""
"директивата за „%option“ — „yylineno“ е несъвместима с отхвърляне (REJECT)"
#: src/main.c:1393
msgid "variable trailing context rules cannot be used with -f or -F"
msgstr ""
"правила с последващ контекст, който не е константен, не може да се ползват "
"заедно с „-f“ или „-F“"
#: src/main.c:1428
msgid "allocation of macro definition failed"
msgstr "неуспешно заделяне на памет за дефиниция на макрос"
#: src/main.c:1745
#, c-format
msgid "Usage: %s [OPTIONS] [FILE]...\n"
msgstr "Употреба: %s [ОПЦИЯ] [ФАЙЛ]…\n"
#: src/main.c:1748
#, 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, --env.trace %s should run in env.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"
" --backup-file=FILE write backing-up information 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"
" -e, --emit=LANG Specify target language\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 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"
" -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=ФАЙЛ създаване и на заглавен файл на C\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"
" --nounistd без ползване на „<unistd.h>“\n"
" --noФУНКЦИЯ без създаването на определена ФУНКЦИЯ\n"
"\n"
"Други:\n"
" -c опция по POSIX, която не прави нищо\n"
" -n опция по POSIX, която не прави нищо\n"
" -?\n"
" -h, --help извеждане на това помощно съобщение\n"
" -V, --version извеждане на версията на „%s“\n"
#: src/misc.c:70 src/misc.c:81
msgid "memory allocation failed in allocate_array()"
msgstr "неуспешно заделяне на памет в „allocate_array()“"
#: src/misc.c:131
#, c-format
msgid "bad character '%s' detected in check_char()"
msgstr "„check_char()“ се натъкна на неправилен знак: „%s“"
#: src/misc.c:136
#, c-format
msgid "scanner requires -8 flag to use the character %s"
msgstr "опцията „-8“ е задължителна, за да ползвате знака „%s“ в анализатора"
#: src/misc.c:155
msgid "memory allocation failure in xstrdup()"
msgstr "неуспешно заделяне на памет в „xstrdup()“"
#: src/misc.c:231
#, c-format
msgid "%s: fatal internal error, %s\n"
msgstr "%s: фатална вътрешна грешка — %s\n"
#: src/misc.c:587 src/misc.c:598
msgid "attempt to increase array size failed"
msgstr "неуспешен опит за увеличаване на размер на масив"
#: src/misc.c:645
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"
#: 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:353
msgid "bad state type in mark_beginning_as_normal()"
msgstr "неправилен вид състояние в „mark_beginning_as_normal()“"
#: src/nfa.c:593
#, c-format
msgid "input rules are too complicated (>= %d NFA states)"
msgstr "входните правила са прекалено сложни (≥ %d състояния на НКА)"
#: src/nfa.c:671
msgid "found too many transitions in mkxtion()"
msgstr "прекалено много преходи в „mkxtion()“"
#: src/nfa.c:697
#, c-format
msgid "too many rules (> %d)!"
msgstr "прекалено много правила (> %d)!"
#: src/parse.y:163
msgid "unknown error processing section 1"
msgstr "непозната грешка при обработка на 1ви раздел"
#: src/parse.y:188 src/parse.y:373
msgid "bad start condition list"
msgstr "неправилен списък на началните състояния"
#: src/parse.y:208
msgid "Prefix must not contain [ or ]"
msgstr "Префиксът не трябва да съдържа „[“ или „]“"
#: src/parse.y:337
msgid "unrecognized rule"
msgstr "непознато правило"
#: src/parse.y:456 src/parse.y:469 src/parse.y:538
msgid "trailing context used twice"
msgstr "двукратно ползване на последващ контекст"
#: src/parse.y:574 src/parse.y:584 src/parse.y:657 src/parse.y:667
msgid "bad iteration values"
msgstr "неправилни стойности на итерация"
#: src/parse.y:602 src/parse.y:620 src/parse.y:685 src/parse.y:703
msgid "iteration value must be positive"
msgstr "стойността на итерацията трябва да е положителна"
#: src/parse.y:826 src/parse.y:836
#, c-format
msgid "the character range [%c-%c] is ambiguous in a case-insensitive scanner"
msgstr ""
"диапазонът знаци [%c-%c] не е еднозначен при лексичен анализатор, който не "
"прави разлика между главни и малки знаци"
#: src/parse.y:841
msgid "negative range in character class"
msgstr "изключващ диапазон в клас знаци"
#: src/parse.y:938
msgid "[:^lower:] is ambiguous in case insensitive scanner"
msgstr ""
"диапазонът знаци [:^lower:] не е еднозначен при лексичен анализатор, който "
"не прави разлика между главни и малки знаци"
#: src/parse.y:944
msgid "[:^upper:] ambiguous in case insensitive scanner"
msgstr ""
"диапазонът знаци [:^upper:] не е еднозначен при лексичен анализатор, който "
"не прави разлика между главни и малки знаци"
#: src/scan.l:73 src/scan.l:662 src/scan.l:720
msgid "Input line too long\n"
msgstr "Входният ред е твърде дълъг\n"
#: src/scan.l:185
#, c-format
msgid "malformed '%top' directive"
msgstr "неправилна директива „%top“"
#: src/scan.l:207
#, no-c-format
msgid "unrecognized '%' directive"
msgstr "непозната директива, започваща с „%“"
#: src/scan.l:216
msgid "Definition name too long\n"
msgstr "Името на дефиницията е твърде дълго\n"
#: src/scan.l:311
msgid "Unmatched '{'"
msgstr "„{“ без еш"
#: src/scan.l:327
#, c-format
msgid "Definition value for {%s} too long\n"
msgstr "Стойността на дефиницията „{%s}“ е твърде дълга\n"
#: src/scan.l:344
msgid "incomplete name definition"
msgstr "дефиниция с непълно име"
#: src/scan.l:486
msgid "Option line too long\n"
msgstr "Редът за опция е твърде дълъг\n"
#: src/scan.l:494
#, c-format
msgid "unrecognized %%option: %s"
msgstr "непозната опция „%%option“: „%s“"
#: src/scan.l:677 src/scan.l:850
msgid "bad character class"
msgstr "неправилен клас знаци"
#: src/scan.l:727
#, c-format
msgid "undefined definition {%s}"
msgstr "липсваща дефиниция „{%s}“"
#: src/scan.l:790
msgid "unbalanced parenthesis"
msgstr "скоба без еш"
#: src/scan.l:805
#, c-format
msgid "bad <start condition>: %s"
msgstr "лошо начално условие: „%s“"
#: src/scan.l:818
msgid "missing quote"
msgstr "липсваща кавичка"
#: src/scan.l:884
#, c-format
msgid "bad character class expression: %s"
msgstr "неправилен израз за клас от знаци: „%s“"
#: src/scan.l:906
msgid "bad character inside {}'s"
msgstr "неправилен знак между „{“ и „}“"
#: src/scan.l:912
msgid "missing }"
msgstr "липсва „}“"
#: src/scan.l:1020
msgid "EOF encountered inside an action"
msgstr "край на файл в действие"
#: src/scan.l:1025
msgid "EOF encountered inside pattern"
msgstr "край на файл в шаблон"
#: src/scan.l:1058
#, c-format
msgid "bad character: %s"
msgstr "неправилен знак: %s"
#: src/scan.l:1086
#, c-format
msgid "can't open %s"
msgstr "„%s“ не може да се отвори"
#: src/scanopt.c:248
#, c-format
msgid "Usage: %s [OPTIONS]...\n"
msgstr "Употреба: %s [ОПЦИЯ]…\n"
#: src/scanopt.c:484
#, c-format
msgid "option `%s' doesn't allow an argument\n"
msgstr "опцията „%s“ се използва без аргументи\n"
#: src/scanopt.c:489
#, c-format
msgid "option `%s' requires an argument\n"
msgstr "опцията „%s“ изисква аргумент\n"
#: src/scanopt.c:493
#, c-format
msgid "option `%s' is ambiguous\n"
msgstr "опцията „%s“ не е еднозначна\n"
#: src/scanopt.c:497
#, c-format
msgid "Unrecognized option `%s'\n"
msgstr "непозната опция „%s“\n"
#: src/scanopt.c:501
#, 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 "•Нещо странно• — лекс.: %d ст-ст: %d\n"
#~ msgid "Allocation of buffer for line directive failed"
#~ msgstr "Неуспешно заделяне на буфер за директива „#line“"
#~ msgid "Allocation of buffer for m4 def failed"
#~ msgstr "Неуспешно заделяне на буфер за добавяне на дефиниция за „m4“"
#~ msgid "Allocation of buffer for m4 undef failed"
#~ msgstr "Неуспешно заделяне на буфер за премахване на дефиниция за „m4“"
#~ msgid "error creating header file %s"
#~ msgstr "грешка при създаването на заглавен файл „%s“"
#~ msgid "%s %s\n"
#~ msgstr "%s %s\n"
#~ msgid "allocation of sko_stack failed"
#~ msgstr "неуспешно заделяне на памет за „sko_stack“"
#~ msgid "name \"%s\" ridiculously long"
#~ msgstr "прекалено дълго име: „%s“"
#~ msgid "bad line in skeleton file"
#~ msgstr "неправилен ред в скелетен файл"
+297 -243
View File
File diff suppressed because it is too large Load Diff
+263 -201
View File
File diff suppressed because it is too large Load Diff
+470 -434
View File
File diff suppressed because it is too large Load Diff
+449 -423
View File
File diff suppressed because it is too large Load Diff
+634 -419
View File
File diff suppressed because it is too large Load Diff
+275 -235
View File
File diff suppressed because it is too large Load Diff
+291 -243
View File
File diff suppressed because it is too large Load Diff
+307 -239
View File
File diff suppressed because it is too large Load Diff
+415 -417
View File
File diff suppressed because it is too large Load Diff
+879 -515
View File
File diff suppressed because it is too large Load Diff
+463 -434
View File
File diff suppressed because it is too large Load Diff
+418 -389
View File
File diff suppressed because it is too large Load Diff
+958
View File
@@ -0,0 +1,958 @@
# 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: 2022-09-27 14:18-0400\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"
#: src/buf.c:61
msgid "Allocation of buffer to print string failed"
msgstr "Falha ao alocar buffer para imprimir a cadeia"
#: src/ccl.c:80
msgid "internal error: trying to add a char to a non-last ccl.\n"
msgstr ""
#: src/dfa.c:59
#, c-format
msgid "State #%d is non-accepting -\n"
msgstr "Estado nº %d não está a aceitar -\n"
#: src/dfa.c:119
msgid "dangerous trailing context"
msgstr "conteúdo final perigoso"
#: src/dfa.c:159
#, c-format
msgid " associated rule line numbers:"
msgstr " números de linha de regra associada:"
#: src/dfa.c:193
#, c-format
msgid " out-transitions: "
msgstr " out-transitions: "
#: src/dfa.c:201
#, c-format
msgid ""
"\n"
" jam-transitions: EOF "
msgstr ""
"\n"
" jam-transitions: EOF "
#: src/dfa.c:331
msgid "consistency check failed in epsclosure()"
msgstr "falha no teste de consistência em epsclosure()"
#: src/dfa.c:422
msgid ""
"\n"
"\n"
"DFA Dump:\n"
"\n"
msgstr ""
"\n"
"\n"
"DFA Dump:\n"
"\n"
#: src/dfa.c:558
msgid "could not create unique end-of-buffer state"
msgstr "impossível criar estado end-of-buffer exclusivo"
#: src/dfa.c:579
#, c-format
msgid "state # %d:\n"
msgstr "estado nº %d\n"
#: src/dfa.c:738
msgid "Could not write yynxt_tbl[][]"
msgstr "Impossível escrever yynxt_tbl[][]"
#: src/dfa.c:1001
msgid "bad transition character detected in sympartition()"
msgstr "detectado um mau carácter de transição em sympartition()"
#: src/gen.c:379
msgid ""
"\n"
"\n"
"Equivalence Classes:\n"
"\n"
msgstr ""
"\n"
"\n"
"Classes de equivalência:\n"
"\n"
#: src/gen.c:425 src/gen.c:454 src/gen.c:638
#, c-format
msgid "state # %d accepts: [%d]\n"
msgstr "estado nº %d aceita: [%d]\n"
#: src/gen.c:533
#, c-format
msgid "state # %d accepts: "
msgstr "estado nº %d aceita: "
#: src/gen.c:582
msgid "Could not write yyacclist_tbl"
msgstr "Impossível escrever yyacclist_tbl"
#: src/gen.c:659
msgid "Could not write yyacc_tbl"
msgstr "Impossível escrever yyacc_tbl"
#: src/gen.c:674 src/gen.c:947 src/gen.c:974
msgid "Could not write ecstbl"
msgstr "Impossível escrever ecstbl"
#: src/gen.c:694
msgid ""
"\n"
"\n"
"Meta-Equivalence Classes:\n"
msgstr ""
"\n"
"\n"
"Classes de meta-equivalência:\n"
#: src/gen.c:714
msgid "Could not write yymeta_tbl"
msgstr "Impossível escrever yymeta_tbl"
#: src/gen.c:774
msgid "Could not write yybase_tbl"
msgstr "Impossível escrever yybase_tbl"
#: src/gen.c:805
msgid "Could not write yydef_tbl"
msgstr "Impossível escrever yydef_tbl"
#: src/gen.c:844
msgid "Could not write yynxt_tbl"
msgstr "Impossível escrever yynxt_tbl"
#: src/gen.c:877
msgid "Could not write yychk_tbl"
msgstr "Impossível escrever yychk_tbl"
#: src/gen.c:932 src/gen.c:965
msgid "Could not write ftbl"
msgstr "Impossível escrever ftbl"
#: src/gen.c:938
msgid "Could not write ssltbl"
msgstr "Impossível escrever ssltbl"
#: src/gen.c:1014
msgid "Could not write eoltbl"
msgstr "Impossível escrever eoltbl"
#: src/gen.c:1061
msgid "Could not write yynultrans_tbl"
msgstr "Impossível escrever yynultrans_tbl"
#: src/main.c:169
msgid "rule cannot be matched"
msgstr "impossível comparar a regra"
#: src/main.c:174
msgid "-s option given but default rule can be matched"
msgstr "indicada a opção -s, mas a regra predefinida pode ser comparada"
#: src/main.c:317
msgid "Can't use -+ with -l option"
msgstr "Impossível usar -+ com a opção -l"
#: src/main.c:320
msgid "Can't use -f or -F with -l option"
msgstr "Impossível usar -f ou -F com a opção -l"
#: src/main.c:324
#, fuzzy
msgid "Can't use --ctrl.reentrant or --bison-bridge with -l option"
msgstr "Impossível usar --reentrant ou --bison-bridge com a opção -l"
#: src/main.c:356
msgid "-Cf/-CF and -Cm don't make sense together"
msgstr "-Cf/-CF e -Cm não fazem sentido em conjunto"
#: src/main.c:359
msgid "-Cf/-CF and -I are incompatible"
msgstr "-Cf/-CF e -I são incompatíveis"
#: src/main.c:363
msgid "-Cf/-CF are incompatible with lex-compatibility mode"
msgstr "-Cf/-CF são incompatíveis com o modo lex-compatibility"
#: src/main.c:368
msgid "-Cf and -CF are mutually exclusive"
msgstr "-Cf e -CF são mutuamente exclusivas"
#: src/main.c:372
msgid "Can't use -+ with -CF option"
msgstr "Impossível usar -+ com a opção -CF"
#: src/main.c:375
#, c-format
msgid "%array incompatible with -+ option"
msgstr "%array incompatível com a opção -+"
#: src/main.c:380
msgid "Options -+ and --reentrant are mutually exclusive."
msgstr "As opções -+ e --reentrant são mutuamente exclusivas."
#: src/main.c:383
msgid "bison bridge not supported for the C++ scanner."
msgstr "bison bridge não suportada no analisador C++."
#: src/main.c:422 src/main.c:1235
#, c-format
msgid "could not create %s"
msgstr "impossível criar %s"
#: src/main.c:443
#, c-format
msgid "%option yyclass only meaningful for C++ scanners"
msgstr "a %opção yyclass só tem significado para analisadores C++"
#: src/main.c:447
#, c-format
msgid "input error reading skeleton file %s"
msgstr "erro de entrada ao ler ficheiro esqueleto %s"
#: src/main.c:451
#, c-format
msgid "error closing skeleton file %s"
msgstr "erro ao fechar ficheiro esqueleto %s"
#: src/main.c:457
#, c-format
msgid "error writing output file %s"
msgstr "erro ao escrever ficheiro de saída %s"
#: src/main.c:461
#, c-format
msgid "error closing output file %s"
msgstr "erro ao fechar ficheiro de saída %s"
#: src/main.c:465
#, c-format
msgid "error deleting output file %s"
msgstr "erro ao eliminar ficheiro de saída %s"
#: src/main.c:472
#, c-format
msgid "No backing up.\n"
msgstr "Sem seguranças.\n"
#: src/main.c:476
#, c-format
msgid "%d backing up (non-accepting) states.\n"
msgstr "%d estados de segurança (não aceitando).\n"
#: src/main.c:480
#, c-format
msgid "Compressed tables always back up.\n"
msgstr "Tabelas comprimidas têm sempre segurança.\n"
#: src/main.c:483
#, c-format
msgid "error writing backup file %s"
msgstr "erro ao escrever segurança %s"
#: src/main.c:487
#, c-format
msgid "error closing backup file %s"
msgstr "erro ao fechar segurança %s"
#: src/main.c:492
#, c-format
msgid "%s version %s usage statistics:\n"
msgstr "%s versão %s estatisticas de uso:\n"
#: src/main.c:495
#, c-format
msgid " scanner options: -"
msgstr " opções do analisador: -"
#: src/main.c:574
#, c-format
msgid " %d/%d NFA states\n"
msgstr " estados NFA %d/%d\n"
#: src/main.c:576
#, c-format
msgid " %d/%d DFA states (%d words)\n"
msgstr " estados DFA %d/%d (%d palavras)\n"
#: src/main.c:578
#, c-format
msgid " %d rules\n"
msgstr " %d regras\n"
#: src/main.c:583
#, c-format
msgid " No backing up\n"
msgstr " Sem seguranças\n"
#: src/main.c:587
#, c-format
msgid " %d backing-up (non-accepting) states\n"
msgstr " %d estados de segurança (não aceitando).\n"
#: src/main.c:592
#, c-format
msgid " Compressed tables always back-up\n"
msgstr "Tabelas comprimidas têm sempre segurança.\n"
#: src/main.c:596
#, c-format
msgid " Beginning-of-line patterns used\n"
msgstr " Padrões de início de linha usados\n"
#: src/main.c:598
#, c-format
msgid " %d/%d start conditions\n"
msgstr " condições iniciais %d/%d\n"
#: src/main.c:602
#, c-format
msgid " %d epsilon states, %d double epsilon states\n"
msgstr " estados epsilon %d, estados duplo epsilon %d\n"
#: src/main.c:606
#, c-format
msgid " no character classes\n"
msgstr " sem classes de carácter\n"
#: src/main.c:610
#, 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"
#: src/main.c:615
#, c-format
msgid " %d state/nextstate pairs created\n"
msgstr " %d pares estado/estado seguinte criados\n"
#: src/main.c:618
#, c-format
msgid " %d/%d unique/duplicate transitions\n"
msgstr " %d/%d transições únicas/duplicadas\n"
#: src/main.c:623
#, c-format
msgid " %d table entries\n"
msgstr " %d entradas de tabela\n"
#: src/main.c:631
#, c-format
msgid " %d/%d base-def entries created\n"
msgstr " %d/%d entradas base-def criadas\n"
#: src/main.c:635
#, c-format
msgid " %d/%d (peak %d) nxt-chk entries created\n"
msgstr " %d/%d (pico %d) entradas nxt-chk criadas\n"
#: src/main.c:639
#, c-format
msgid " %d/%d (peak %d) template nxt-chk entries created\n"
msgstr " %d/%d (pico %d) entradas modelo nxt-chk criadas\n"
#: src/main.c:643
#, c-format
msgid " %d empty table entries\n"
msgstr " %d entradas de tabela vazias\n"
#: src/main.c:645
#, c-format
msgid " %d protos created\n"
msgstr " %d protos criados\n"
#: src/main.c:648
#, c-format
msgid " %d templates created, %d uses\n"
msgstr " %d modelos criados, %d usos\n"
#: src/main.c:656
#, c-format
msgid " %d/%d equivalence classes created\n"
msgstr " %d/%d classes de equivalência criadas\n"
#: src/main.c:664
#, c-format
msgid " %d/%d meta-equivalence classes created\n"
msgstr " %d/%d classes de meta-equivalência criadas\n"
#: src/main.c:670
#, c-format
msgid " %d (%d saved) hash collisions, %d DFAs equal\n"
msgstr " %d (%d gravadas) colisões de hash, %d DFAs iguais\n"
#: src/main.c:672
#, c-format
msgid " %d sets of reallocations needed\n"
msgstr " %d conjuntos de re-alocação necessários\n"
#: src/main.c:674
#, c-format
msgid " %d total table entries needed\n"
msgstr " %d entradas de tabela totais necessárias\n"
#: src/main.c:735
#, c-format
msgid "Internal error. flexopts are malformed.\n"
msgstr "Erro interno. flexopts mal formados.\n"
#: src/main.c:745
#, c-format
msgid "Try `%s --help' for more information.\n"
msgstr "Tente \"%s --help\" para mais informação.\n"
#: src/main.c:807
#, c-format
msgid "unknown -C option '%c'"
msgstr "Opção -C \"%c\" desconhecida"
#: src/main.c:1195
msgid "fatal parse error"
msgstr "erro de processamento fatal"
#: src/main.c:1247
msgid "could not write tables header"
msgstr "impossível criar cabeçalho de tabelas"
#: src/main.c:1251
#, c-format
msgid "can't open skeleton file %s"
msgstr "impossível abrir ficheiro esqueleto %s"
#: src/main.c:1254
msgid "Prefix cannot include '[' or ']'"
msgstr ""
#: src/main.c:1322
#, c-format
msgid "could not create backing-up info file %s"
msgstr "impossível criar ficheiro de informação de segurança %s"
#: src/main.c:1343
#, 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"
#: src/main.c:1346
#, 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"
#: src/main.c:1352
#, 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"
#: src/main.c:1359
#, c-format
msgid "-I (interactive) entails a minor performance penalty\n"
msgstr "-I (interactiva) implica uma perda menor de desempenho\n"
#: src/main.c:1364
#, c-format
msgid "yymore() entails a minor performance penalty\n"
msgstr "yymore() implica uma perda menor de desempenho\n"
#: src/main.c:1370
#, c-format
msgid "REJECT entails a large performance penalty\n"
msgstr "REJECT implica uma grave perda de desempenho\n"
#: src/main.c:1375
#, 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"
#: src/main.c:1387
msgid "REJECT cannot be used with -f or -F"
msgstr "REJECT não ode ser usado com -f ou -F"
#: src/main.c:1390
#, c-format
msgid "%option yylineno cannot be used with REJECT"
msgstr "a %opção yylineno não pode ser usada com REJECT"
#: src/main.c:1393
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"
#: src/main.c:1428
msgid "allocation of macro definition failed"
msgstr "falha ao alocar definição de macro"
#: src/main.c:1745
#, c-format
msgid "Usage: %s [OPTIONS] [FILE]...\n"
msgstr "Uso: %s [OPÇÕES] [FICHEIRO]...\n"
#: src/main.c:1748
#, 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, --env.trace %s should run in env.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"
" --backup-file=FILE write backing-up information 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"
" -e, --emit=LANG Specify target language\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 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 ""
"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"
#: src/misc.c:70 src/misc.c:81
msgid "memory allocation failed in allocate_array()"
msgstr "falha ao alocar memória em allocate_array()"
#: src/misc.c:131
#, c-format
msgid "bad character '%s' detected in check_char()"
msgstr "mau carácter \"%s\" detectado em check_char()"
#: src/misc.c:136
#, c-format
msgid "scanner requires -8 flag to use the character %s"
msgstr "o analisador requer bandeira -8 para usar o carácter %s"
#: src/misc.c:155
#, fuzzy
msgid "memory allocation failure in xstrdup()"
msgstr "falha ao alocar memória em allocate_array()"
#: src/misc.c:231
#, c-format
msgid "%s: fatal internal error, %s\n"
msgstr "%s: erro interno fatal, %s\n"
#: src/misc.c:587 src/misc.c:598
msgid "attempt to increase array size failed"
msgstr "falha ao tentar aumentar o tamanho da matriz"
#: src/misc.c:645
msgid "memory allocation failed in yy_flex_xmalloc()"
msgstr "falha ao alocar memória em yy_flex_xmalloc()"
#: src/nfa.c:100
#, 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"
#: src/nfa.c:111
#, c-format
msgid "state # %4d\t"
msgstr "estado nº %4d\t"
#: src/nfa.c:126
#, c-format
msgid "********** end of dump\n"
msgstr "********** fim de despejo\n"
#: src/nfa.c:169
msgid "empty machine in dupmachine()"
msgstr "máquina vazia em dupmachine()"
#: src/nfa.c:234
#, c-format
msgid "Variable trailing context rule at line %d\n"
msgstr "Regra variável de contexto final na linha %d\n"
#: src/nfa.c:353
msgid "bad state type in mark_beginning_as_normal()"
msgstr "mau tipo de estado em mark_beginning_as_normal()"
#: src/nfa.c:593
#, c-format
msgid "input rules are too complicated (>= %d NFA states)"
msgstr "regras de entrada muito complicadas (>= %d estados NFA)"
#: src/nfa.c:671
msgid "found too many transitions in mkxtion()"
msgstr "encontradas demasiadas transições em mkxtion()"
#: src/nfa.c:697
#, c-format
msgid "too many rules (> %d)!"
msgstr "demasiadas regras (> %d)!"
#: src/parse.y:163
msgid "unknown error processing section 1"
msgstr "erro desconhecido ao processar a secção 1"
#: src/parse.y:188 src/parse.y:373
msgid "bad start condition list"
msgstr "má lista de condição inicial"
#: src/parse.y:208
msgid "Prefix must not contain [ or ]"
msgstr ""
#: src/parse.y:337
msgid "unrecognized rule"
msgstr "regra não reconhecida"
#: src/parse.y:456 src/parse.y:469 src/parse.y:538
msgid "trailing context used twice"
msgstr "contexto final usado duas vezes"
#: src/parse.y:574 src/parse.y:584 src/parse.y:657 src/parse.y:667
msgid "bad iteration values"
msgstr "maus valores de iteração"
#: src/parse.y:602 src/parse.y:620 src/parse.y:685 src/parse.y:703
msgid "iteration value must be positive"
msgstr "o valor de iteração tem de ser positivo"
#: src/parse.y:826 src/parse.y:836
#, 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"
#: src/parse.y:841
msgid "negative range in character class"
msgstr "intervalo negativo em classe de carácter"
#: src/parse.y:938
msgid "[:^lower:] is ambiguous in case insensitive scanner"
msgstr "[:^lower:] é ambíguo num analisador que ignora maiúsculas"
#: src/parse.y:944
msgid "[:^upper:] ambiguous in case insensitive scanner"
msgstr "[:^upper:] é ambíguo num analisador que ignora maiúsculas"
#: src/scan.l:73 src/scan.l:662 src/scan.l:720
msgid "Input line too long\n"
msgstr "Linha de entrada muito grande\n"
#: src/scan.l:185
#, c-format
msgid "malformed '%top' directive"
msgstr "directiva \"%top\" mal formada"
#: src/scan.l:207
#, no-c-format
msgid "unrecognized '%' directive"
msgstr "directiva \"%\" não reconhecida"
#: src/scan.l:216
msgid "Definition name too long\n"
msgstr "Nome de definição muito longo\n"
#: src/scan.l:311
msgid "Unmatched '{'"
msgstr "{ sem par"
#: src/scan.l:327
#, c-format
msgid "Definition value for {%s} too long\n"
msgstr "Valor de definição para {%s} muito longo\n"
#: src/scan.l:344
msgid "incomplete name definition"
msgstr "Definição de nome incompleta"
#: src/scan.l:486
msgid "Option line too long\n"
msgstr "Linha de opção muito longa\n"
#: src/scan.l:494
#, c-format
msgid "unrecognized %%option: %s"
msgstr "%%opção não reconhecida: %s"
#: src/scan.l:677 src/scan.l:850
msgid "bad character class"
msgstr "má classe de carácter"
#: src/scan.l:727
#, c-format
msgid "undefined definition {%s}"
msgstr "definição {%s} indefinida"
#: src/scan.l:790
msgid "unbalanced parenthesis"
msgstr ""
#: src/scan.l:805
#, c-format
msgid "bad <start condition>: %s"
msgstr "má <condição inicial>: %s"
#: src/scan.l:818
msgid "missing quote"
msgstr "aspa em falta"
#: src/scan.l:884
#, c-format
msgid "bad character class expression: %s"
msgstr "má expressão de classe de carácter: %s"
#: src/scan.l:906
msgid "bad character inside {}'s"
msgstr "mau carácter dentro de {}"
#: src/scan.l:912
msgid "missing }"
msgstr "} em falta"
#: src/scan.l:1020
msgid "EOF encountered inside an action"
msgstr "EOF encontrado dentro de uma acção"
#: src/scan.l:1025
msgid "EOF encountered inside pattern"
msgstr "EOF encontrado dentro de um padrão"
#: src/scan.l:1058
#, c-format
msgid "bad character: %s"
msgstr "mau carácter: %s"
#: src/scan.l:1086
#, c-format
msgid "can't open %s"
msgstr "impossível abrir %s"
#: src/scanopt.c:248
#, c-format
msgid "Usage: %s [OPTIONS]...\n"
msgstr "Uso: %s [OPÇÕES]...\n"
#: src/scanopt.c:484
#, c-format
msgid "option `%s' doesn't allow an argument\n"
msgstr "a opção \"%s\" não permite um argumento\n"
#: src/scanopt.c:489
#, c-format
msgid "option `%s' requires an argument\n"
msgstr "a opção \"%s\" requer um argumento\n"
#: src/scanopt.c:493
#, c-format
msgid "option `%s' is ambiguous\n"
msgstr "a opção \"%s\" é ambígua\n"
#: src/scanopt.c:497
#, c-format
msgid "Unrecognized option `%s'\n"
msgstr "Opção \"%s\" não reconhecida\n"
#: src/scanopt.c:501
#, c-format
msgid "Unknown error=(%d)\n"
msgstr "Erro desconhecido=(%d)\n"
#: src/sym.c:92
msgid "symbol table memory allocation failed"
msgstr "falha ao alocar memória de tabela de símbolos"
#: src/sym.c:183
msgid "name defined twice"
msgstr "nome definido duas vezes"
#: src/sym.c:231
#, c-format
msgid "start condition %s declared twice"
msgstr "condição inicial %s declarada duas vezes"
#: src/yylex.c:57
msgid "premature EOF"
msgstr "EOF prematuro"
#: src/yylex.c:200
#, c-format
msgid "End Marker\n"
msgstr "Marcador final\n"
#: src/yylex.c:206
#, c-format
msgid "*Something Weird* - tok: %d val: %d\n"
msgstr "*Algo esquisito* - tok: %d val: %d\n"
#~ msgid "Allocation of buffer for line directive failed"
#~ msgstr "Falha ao alocar buffer para directiva de linha"
#~ msgid "Allocation of buffer for m4 def failed"
#~ msgstr "Falha ao alocar buffer para m4 def"
#~ msgid "Allocation of buffer for m4 undef failed"
#~ msgstr "Falha ao alocar buffer para m4 undef"
#~ msgid "error creating header file %s"
#~ msgstr "erro ao criar ficheiro de cabeçalho %s"
#~ msgid "%s %s\n"
#~ msgstr "%s %s\n"
#~ msgid "allocation of sko_stack failed"
#~ msgstr "falha ao alocar sko_stack"
#~ msgid "name \"%s\" ridiculously long"
#~ msgstr "nome \"%s\" ridiculamente longo"
#~ msgid "dynamic memory failure in copy_string()"
#~ msgstr "falha de memória dinâmica copy_string()"
#~ msgid "bad line in skeleton file"
#~ msgstr "má linha em ficheiro esqueleto"
+455 -423
View File
File diff suppressed because it is too large Load Diff
+587 -391
View File
File diff suppressed because it is too large Load Diff
+465 -431
View File
File diff suppressed because it is too large Load Diff
+467 -435
View File
File diff suppressed because it is too large Load Diff
+420 -474
View File
File diff suppressed because it is too large Load Diff
+470 -382
View File
File diff suppressed because it is too large Load Diff
+971
View File
@@ -0,0 +1,971 @@
# 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, 2022.
msgid ""
msgstr ""
"Project-Id-Version: flex 2.6.4\n"
"Report-Msgid-Bugs-To: flex-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2022-09-27 14:18-0400\n"
"PO-Revision-Date: 2022-01-03 11:33+0200\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
"Language-Team: Ukrainian <trans-uk@lists.fedoraproject.org>\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 20.12.0\n"
#: src/buf.c:61
msgid "Allocation of buffer to print string failed"
msgstr "Не вдалось виділити буфер для рядка, що виводиться"
#: src/ccl.c:80
msgid "internal error: trying to add a char to a non-last ccl.\n"
msgstr ""
#: 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:422
msgid ""
"\n"
"\n"
"DFA Dump:\n"
"\n"
msgstr ""
"\n"
"\n"
"Дамп ДСА:\n"
"\n"
#: src/dfa.c:558
msgid "could not create unique end-of-buffer state"
msgstr "неможливо створити унікальний стан end_of_buffer"
#: src/dfa.c:579
#, c-format
msgid "state # %d:\n"
msgstr "стан # %d:\n"
#: src/dfa.c:738
msgid "Could not write yynxt_tbl[][]"
msgstr "Неможливо записати yynxt_tbl[][]"
#: src/dfa.c:1001
msgid "bad transition character detected in sympartition()"
msgstr "виявлено невірний символ переходу в sympartition()"
#: src/gen.c:379
msgid ""
"\n"
"\n"
"Equivalence Classes:\n"
"\n"
msgstr ""
"\n"
"\n"
"Класи еквівалентності:\n"
"\n"
#: src/gen.c:425 src/gen.c:454 src/gen.c:638
#, c-format
msgid "state # %d accepts: [%d]\n"
msgstr "стан # %d приймає: [%d]\n"
#: src/gen.c:533
#, c-format
msgid "state # %d accepts: "
msgstr "стан # %d приймає: "
#: src/gen.c:582
msgid "Could not write yyacclist_tbl"
msgstr "Неможливо записати yyacclist_tbl"
#: src/gen.c:659
msgid "Could not write yyacc_tbl"
msgstr "Неможливо записати yyacc_tbl"
#: src/gen.c:674 src/gen.c:947 src/gen.c:974
msgid "Could not write ecstbl"
msgstr "Неможливо записати ecstbl"
#: src/gen.c:694
msgid ""
"\n"
"\n"
"Meta-Equivalence Classes:\n"
msgstr ""
"\n"
"\n"
"Мета-Еквівалентні Класи:\n"
#: src/gen.c:714
msgid "Could not write yymeta_tbl"
msgstr "Неможливо записати yymeta_tbl"
#: src/gen.c:774
msgid "Could not write yybase_tbl"
msgstr "Неможливо записати yybase_tbl"
#: src/gen.c:805
msgid "Could not write yydef_tbl"
msgstr "Неможливо записати yydef_tbl"
#: src/gen.c:844
msgid "Could not write yynxt_tbl"
msgstr "Неможливо записати yynxt_tbl"
#: src/gen.c:877
msgid "Could not write yychk_tbl"
msgstr "Неможливо записати yychk_tbl"
#: src/gen.c:932 src/gen.c:965
msgid "Could not write ftbl"
msgstr "Неможливо записати ftbl"
#: src/gen.c:938
msgid "Could not write ssltbl"
msgstr "Неможливо записати ssltbl"
#: src/gen.c:1014
msgid "Could not write eoltbl"
msgstr "Неможливо записати eoltbl"
#: src/gen.c:1061
msgid "Could not write yynultrans_tbl"
msgstr "Неможливо записати yynultrans_tbl"
#: src/main.c:169
msgid "rule cannot be matched"
msgstr "неможливо застосувати правило"
#: src/main.c:174
msgid "-s option given but default rule can be matched"
msgstr ""
"вказано параметр -s, але правило за замовчуванням може бути застосоване"
#: src/main.c:317
msgid "Can't use -+ with -l option"
msgstr "Неможливо використовувати -+ з параметром -l"
#: src/main.c:320
msgid "Can't use -f or -F with -l option"
msgstr "Неможливо використовувати -f або -F з параметром -l"
#: src/main.c:324
#, fuzzy
msgid "Can't use --ctrl.reentrant or --bison-bridge with -l option"
msgstr ""
"Неможливо використовувати --reentrant або --bison-bridge з параметром -l"
#: src/main.c:356
msgid "-Cf/-CF and -Cm don't make sense together"
msgstr "Параметри -Cf/-CF і -Cm разом не мають сенсу"
#: src/main.c:359
msgid "-Cf/-CF and -I are incompatible"
msgstr "Параметри -Cf/-CF і -I несумісні"
#: src/main.c:363
msgid "-Cf/-CF are incompatible with lex-compatibility mode"
msgstr "Параметри -Cf/-CF несумісні з режимом lex-compatibility"
#: src/main.c:368
msgid "-Cf and -CF are mutually exclusive"
msgstr "Параметри -Cf і -CF є взаємовиключними"
#: src/main.c:372
msgid "Can't use -+ with -CF option"
msgstr "Неможливо використовувати -+ з параметром -CF"
#: src/main.c:375
#, c-format
msgid "%array incompatible with -+ option"
msgstr "%array несумісний з параметром -+"
#: src/main.c:380
msgid "Options -+ and --reentrant are mutually exclusive."
msgstr "Параметри -+ і --reentrant є взаємовиключними."
#: src/main.c:383
msgid "bison bridge not supported for the C++ scanner."
msgstr "bison bridge не підтримується для сканера C++."
#: src/main.c:422 src/main.c:1235
#, c-format
msgid "could not create %s"
msgstr "неможливо створити %s"
#: src/main.c:443
#, c-format
msgid "%option yyclass only meaningful for C++ scanners"
msgstr "%option yyclass має сенс тільки для сканерів C++"
#: src/main.c:447
#, c-format
msgid "input error reading skeleton file %s"
msgstr "помилка читання файла-каркаса %s"
#: src/main.c:451
#, c-format
msgid "error closing skeleton file %s"
msgstr "помилка при закритті файла-каркаса %s"
#: src/main.c:457
#, c-format
msgid "error writing output file %s"
msgstr "помилка запису у вихідний файл %s"
#: src/main.c:461
#, c-format
msgid "error closing output file %s"
msgstr "помилка закриття вихідного файла %s"
#: src/main.c:465
#, c-format
msgid "error deleting output file %s"
msgstr "помилка видалення вихідного файла %s"
#: src/main.c:472
#, c-format
msgid "No backing up.\n"
msgstr "Резервне копіювання вимкнено.\n"
#: src/main.c:476
#, c-format
msgid "%d backing up (non-accepting) states.\n"
msgstr "резервне копіювання %d (недопустимих) станів.\n"
#: src/main.c:480
#, c-format
msgid "Compressed tables always back up.\n"
msgstr "Створення резервних копій стислих таблиць виконується завжди.\n"
#: src/main.c:483
#, c-format
msgid "error writing backup file %s"
msgstr "помилка запису резервної копії файла %s"
#: src/main.c:487
#, c-format
msgid "error closing backup file %s"
msgstr "помилка закриття резервної копії файла %s"
#: src/main.c:492
#, c-format
msgid "%s version %s usage statistics:\n"
msgstr "статистика використання %s версії %s:\n"
#: src/main.c:495
#, c-format
msgid " scanner options: -"
msgstr " параметри сканера: -"
#: src/main.c:574
#, c-format
msgid " %d/%d NFA states\n"
msgstr " %d/%d станів НСА\n"
#: src/main.c:576
#, c-format
msgid " %d/%d DFA states (%d words)\n"
msgstr " %d/%d станів ДСА (%d слів)\n"
#: src/main.c:578
#, c-format
msgid " %d rules\n"
msgstr " %d правил\n"
#: src/main.c:583
#, c-format
msgid " No backing up\n"
msgstr " Резервне копіювання вимкнено\n"
#: src/main.c:587
#, c-format
msgid " %d backing-up (non-accepting) states\n"
msgstr " резервне копіювання %d (недопустимих) станів\n"
#: src/main.c:592
#, c-format
msgid " Compressed tables always back-up\n"
msgstr " Створення резервних копій стислих таблиць виконується завжди\n"
#: src/main.c:596
#, c-format
msgid " Beginning-of-line patterns used\n"
msgstr " Використовуються шаблони початку рядка\n"
#: src/main.c:598
#, c-format
msgid " %d/%d start conditions\n"
msgstr " %d/%d початкових умов\n"
#: src/main.c:602
#, c-format
msgid " %d epsilon states, %d double epsilon states\n"
msgstr " %d епсилон-станів, %d подвійних епсилон-станів\n"
#: src/main.c:606
#, c-format
msgid " no character classes\n"
msgstr " відсутні класи символів\n"
#: src/main.c:610
#, 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:615
#, c-format
msgid " %d state/nextstate pairs created\n"
msgstr " створено %d пар стан/наступний-стан\n"
#: src/main.c:618
#, c-format
msgid " %d/%d unique/duplicate transitions\n"
msgstr " %d/%d унікальних/повторюваних переходів\n"
#: src/main.c:623
#, c-format
msgid " %d table entries\n"
msgstr " %d елементів таблиці\n"
#: src/main.c:631
#, c-format
msgid " %d/%d base-def entries created\n"
msgstr " створено %d/%d base-def елементів\n"
#: src/main.c:635
#, c-format
msgid " %d/%d (peak %d) nxt-chk entries created\n"
msgstr " створено %d/%d (пік %d) записів nxt-chk\n"
#: src/main.c:639
#, c-format
msgid " %d/%d (peak %d) template nxt-chk entries created\n"
msgstr " створено %d/%d (пік %d) шаблонних записів nxt-chk\n"
#: src/main.c:643
#, c-format
msgid " %d empty table entries\n"
msgstr " %d порожніх елементів таблиці\n"
#: src/main.c:645
#, c-format
msgid " %d protos created\n"
msgstr " створено %d прототипів\n"
#: src/main.c:648
#, c-format
msgid " %d templates created, %d uses\n"
msgstr " створено %d шаблонів, %d використовується\n"
#: src/main.c:656
#, c-format
msgid " %d/%d equivalence classes created\n"
msgstr " створено класів еквівалентності %d/%d\n"
#: src/main.c:664
#, c-format
msgid " %d/%d meta-equivalence classes created\n"
msgstr " створено класів мета-еквівалентності %d/%d\n"
#: src/main.c:670
#, c-format
msgid " %d (%d saved) hash collisions, %d DFAs equal\n"
msgstr " %d (%d записано) колізій хеш-таблиці, %d еквівалентних ДСА\n"
#: src/main.c:672
#, c-format
msgid " %d sets of reallocations needed\n"
msgstr " потрібно %d наборів повторних розміщень\n"
#: src/main.c:674
#, c-format
msgid " %d total table entries needed\n"
msgstr " всього потрібно %d елементів таблиці\n"
#: src/main.c:735
#, c-format
msgid "Internal error. flexopts are malformed.\n"
msgstr "Внутрішня помилка. Неправильне значення flexopts.\n"
#: src/main.c:745
#, c-format
msgid "Try `%s --help' for more information.\n"
msgstr "Спробуйте «%s --help» для отримання більш докладного опису.\n"
#: src/main.c:807
#, c-format
msgid "unknown -C option '%c'"
msgstr "невідоме значення «%c» для параметру -C"
#: src/main.c:1195
msgid "fatal parse error"
msgstr "фатальна помилка розбору"
#: src/main.c:1247
msgid "could not write tables header"
msgstr "Неможливо записати заголовок таблиць"
#: src/main.c:1251
#, c-format
msgid "can't open skeleton file %s"
msgstr "Неможливо відкрити файл-каркас %s"
#: src/main.c:1254
msgid "Prefix cannot include '[' or ']'"
msgstr "Префікс не може містити «[» або «]»"
#: src/main.c:1322
#, c-format
msgid "could not create backing-up info file %s"
msgstr "неможливо створити резервну копію інформаційного файла %s"
#: src/main.c:1343
#, c-format
msgid "-l AT&T lex compatibility option entails a large performance penalty\n"
msgstr ""
"Параметр -l сумісності з AT&T lex спричиняє значне зниження продуктивності\n"
#: src/main.c:1346
#, c-format
msgid " and may be the actual source of other reported performance penalties\n"
msgstr "і також може бути істинним джерелом проблем з продуктивністю\n"
#: src/main.c:1352
#, 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:1359
#, c-format
msgid "-I (interactive) entails a minor performance penalty\n"
msgstr "-I (інтерактивний) спричиняе незначне зниження продуктивності\n"
#: src/main.c:1364
#, c-format
msgid "yymore() entails a minor performance penalty\n"
msgstr "yymore() спричиняе незначне зниження продуктивності\n"
#: src/main.c:1370
#, c-format
msgid "REJECT entails a large performance penalty\n"
msgstr "REJECT спричиняе значне зниження продуктивності\n"
#: src/main.c:1375
#, c-format
msgid "Variable trailing context rules entail a large performance penalty\n"
msgstr ""
"Правила котрі мають замикаючий контекст змінної довжини значно знижують "
"продуктивність\n"
#: src/main.c:1387
msgid "REJECT cannot be used with -f or -F"
msgstr "REJECT не може бути використано разом з -f або -F"
#: src/main.c:1390
#, c-format
msgid "%option yylineno cannot be used with REJECT"
msgstr "%option yylineno не може бути використано з REJECT"
#: src/main.c:1393
msgid "variable trailing context rules cannot be used with -f or -F"
msgstr ""
"Правила котрі мають замикаючий контекст змінної довжини не можуть бути "
"використані з -f or -F"
#: src/main.c:1428
msgid "allocation of macro definition failed"
msgstr "Не вдалось розмістити визначення макросу"
#: src/main.c:1745
#, c-format
msgid "Usage: %s [OPTIONS] [FILE]...\n"
msgstr "Використання: %s [ПАРАМЕТРИ] [ФАЙЛ]…\n"
#: src/main.c:1748
#, 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, --env.trace %s should run in env.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"
" --backup-file=FILE write backing-up information 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"
" -e, --emit=LANG Specify target language\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 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"
" --hex шістнадцяткові числа замість вісімкових у "
"діагностиці\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"
" --nounistd не додавати <unistd.h>\n"
" --noФУНКЦІЯ не генерувати задану функцію ФУНКЦІЯ\n"
"\n"
"Інше:\n"
" -с недіючий POSIX параметр\n"
" -n недіючий POSIX параметр\n"
" -?\n"
" -h, --help показати цю довідку\n"
" -V, --version показати версію %s\n"
#: src/misc.c:70 src/misc.c:81
msgid "memory allocation failed in allocate_array()"
msgstr "помилка виділення пам'яті у allocate_array()"
#: src/misc.c:131
#, c-format
msgid "bad character '%s' detected in check_char()"
msgstr "check_char() виявив недопустимий символ «%s»"
#: src/misc.c:136
#, c-format
msgid "scanner requires -8 flag to use the character %s"
msgstr "для використання символу %s сканер потребує опцію -8"
#: src/misc.c:155
msgid "memory allocation failure in xstrdup()"
msgstr "помилка виділення пам'яті у xstrdup()"
#: src/misc.c:231
#, c-format
msgid "%s: fatal internal error, %s\n"
msgstr "%s: фатальна внутрішня помилка, %s\n"
#: src/misc.c:587 src/misc.c:598
msgid "attempt to increase array size failed"
msgstr "помилка при спробі збільшити розмір масиву"
#: src/misc.c:645
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:353
msgid "bad state type in mark_beginning_as_normal()"
msgstr "невідомий тип стану у mark_beginning_as_normal()"
#: src/nfa.c:593
#, c-format
msgid "input rules are too complicated (>= %d NFA states)"
msgstr "вхідні правила занадто складні (>= %d станів НСА)"
#: src/nfa.c:671
msgid "found too many transitions in mkxtion()"
msgstr "знайдено занадто багато переходів у mkxtion()"
#: src/nfa.c:697
#, c-format
msgid "too many rules (> %d)!"
msgstr "занадто багато правил (> %d)!"
#: src/parse.y:163
msgid "unknown error processing section 1"
msgstr "невідома помилка при обробці розділу 1"
#: src/parse.y:188 src/parse.y:373
msgid "bad start condition list"
msgstr "невірний список початкових умов"
#: src/parse.y:208
msgid "Prefix must not contain [ or ]"
msgstr "Префікс не може містити символи «[» або «]»"
#: src/parse.y:337
msgid "unrecognized rule"
msgstr "нерозпізнане правило"
#: src/parse.y:456 src/parse.y:469 src/parse.y:538
msgid "trailing context used twice"
msgstr "замикаючий контекст використано двічі"
#: src/parse.y:574 src/parse.y:584 src/parse.y:657 src/parse.y:667
msgid "bad iteration values"
msgstr "невірно сформований діапазон ітерацій"
#: src/parse.y:602 src/parse.y:620 src/parse.y:685 src/parse.y:703
msgid "iteration value must be positive"
msgstr "кількість ітерацій повинна бути додатнім числом"
#: src/parse.y:826 src/parse.y:836
#, c-format
msgid "the character range [%c-%c] is ambiguous in a case-insensitive scanner"
msgstr ""
"використання діапазону символів [%c-%c] є двозначним для сканера, що не "
"чутливий до регістру символів"
#: src/parse.y:841
msgid "negative range in character class"
msgstr ""
"символьний клас описано діапазоном, перший елемент котрого більший за "
"останній"
#: src/parse.y:938
msgid "[:^lower:] is ambiguous in case insensitive scanner"
msgstr ""
"використання [:^lower:] є невизначеним для сканера, що не чутливий до "
"регістру символів"
#: src/parse.y:944
msgid "[:^upper:] ambiguous in case insensitive scanner"
msgstr ""
"використання [:^upper:] є невизначеним для сканера, що не чутливий до "
"регістру символів"
#: src/scan.l:73 src/scan.l:662 src/scan.l:720
msgid "Input line too long\n"
msgstr "Занадто довгий вхідний рядок\n"
#: src/scan.l:185
#, c-format
msgid "malformed '%top' directive"
msgstr "нерозпізнана директива «%top»"
#: src/scan.l:207
#, no-c-format
msgid "unrecognized '%' directive"
msgstr "нерозпізнана директива «%»"
#: src/scan.l:216
msgid "Definition name too long\n"
msgstr "Визначення має занадто довге ім'я\n"
#: src/scan.l:311
msgid "Unmatched '{'"
msgstr "Непарна «{»"
#: src/scan.l:327
#, c-format
msgid "Definition value for {%s} too long\n"
msgstr "Визначення {%s} має занадто довге значення\n"
#: src/scan.l:344
msgid "incomplete name definition"
msgstr "неповне визначення імені"
#: src/scan.l:486
msgid "Option line too long\n"
msgstr "Занадто довгий параметр\n"
#: src/scan.l:494
#, c-format
msgid "unrecognized %%option: %s"
msgstr "нерозпізнаний %%option: %s"
#: src/scan.l:677 src/scan.l:850
msgid "bad character class"
msgstr "помилковий символьний клас"
#: src/scan.l:727
#, c-format
msgid "undefined definition {%s}"
msgstr "нерозпізнане визначення {%s}"
#: src/scan.l:790
msgid "unbalanced parenthesis"
msgstr "незбалансовані круглі дужки"
#: src/scan.l:805
#, c-format
msgid "bad <start condition>: %s"
msgstr "невірно сформованана <умова, що активує правило>: %s"
#: src/scan.l:818
msgid "missing quote"
msgstr "відсутні лапки"
#: src/scan.l:884
#, c-format
msgid "bad character class expression: %s"
msgstr "символьний клас заданий некоректним виразом: %s"
#: src/scan.l:906
msgid "bad character inside {}'s"
msgstr "неприйнятний символ всередині {}"
#: src/scan.l:912
msgid "missing }"
msgstr "відсутній }"
#: src/scan.l:1020
msgid "EOF encountered inside an action"
msgstr "знайдено EOF всередині коду котрий асоційований з правилом"
#: src/scan.l:1025
msgid "EOF encountered inside pattern"
msgstr "знайдено EOF всередині шаблону, що задає правило"
#: src/scan.l:1058
#, c-format
msgid "bad character: %s"
msgstr "неочікуваний символ: %s"
#: src/scan.l:1086
#, c-format
msgid "can't open %s"
msgstr "неможливо відкрити %s"
#: src/scanopt.c:248
#, c-format
msgid "Usage: %s [OPTIONS]...\n"
msgstr "Використання: %s [ПАРАМЕТРИ]…\n"
#: src/scanopt.c:484
#, c-format
msgid "option `%s' doesn't allow an argument\n"
msgstr "параметр «%s» повинен використовуватись без аргументу\n"
#: src/scanopt.c:489
#, c-format
msgid "option `%s' requires an argument\n"
msgstr "параметр «% s» повинен використовуватись з аргументом\n"
#: src/scanopt.c:493
#, c-format
msgid "option `%s' is ambiguous\n"
msgstr "параметр «%s» є двозначним\n"
#: src/scanopt.c:497
#, c-format
msgid "Unrecognized option `%s'\n"
msgstr "Нерозпізнаний параметр «%s»\n"
#: src/scanopt.c:501
#, 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 "Allocation of buffer for line directive failed"
#~ msgstr "Не вдалось виділити буфер для рядкової директиви"
#~ msgid "Allocation of buffer for m4 def failed"
#~ msgstr "Не вдалось виділити буфер для m4 def"
#~ msgid "Allocation of buffer for m4 undef failed"
#~ msgstr "Не вдалось виділити буфер для m4 undef"
#~ msgid "error creating header file %s"
#~ msgstr "помилка створення файла-заголовку %s"
#~ msgid "%s %s\n"
#~ msgstr "%s %s\n"
#~ msgid "allocation of sko_stack failed"
#~ msgstr "не вдалось отримати пам’ять під sko_stack"
#~ msgid "name \"%s\" ridiculously long"
#~ msgstr "ім'я «%s» занадто довге"
#~ msgid "bad line in skeleton file"
#~ msgstr "невідомий рядок у файлі-каркасі"
#~ msgid "dynamic memory failure in copy_string()"
#~ msgstr "помилка під час роботи з динамічною пам’яттю у copy_string()"
+26
View File
@@ -0,0 +1,26 @@
#!/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
+474 -433
View File
File diff suppressed because it is too large Load Diff
+676 -451
View File
File diff suppressed because it is too large Load Diff
+434 -418
View File
File diff suppressed because it is too large Load Diff
+4 -1
View File
@@ -1,10 +1,13 @@
*.la
*.lo
*.o
*-flex.h
config.h
config.h.in
flex
libfl.pc
parse.c
parse.h
scan.c
skel.c
stage1scan.[cl]
stage1flex
+118 -124
View File
@@ -35,80 +35,74 @@
// 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 YY_CHAR* YYText() const { return yytext; }
int YYLeng() const { return yyleng; }
const char* YYText() const { return yytext; }
int YYLeng() const { return yyleng; }
virtual void
yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
virtual struct yy_buffer_state*
yy_create_buffer( FLEX_STD istream* s, int size ) = 0;
virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
virtual void yyrestart( FLEX_STD istream* s ) = 0;
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 int yylex() = 0;
virtual int yylex() = 0;
// Call yylex with new input/output sources.
int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 )
{
switch_streams( new_in, new_out );
return yylex();
}
// 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();
}
// 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;
int yylex( std::istream* new_in, std::ostream* new_out = 0)
{
switch_streams( new_in, new_out );
return yylex();
}
int lineno() const { return yylineno; }
// 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 debug() const { return yy_flex_debug; }
void set_debug( int flag ) { yy_flex_debug = flag; }
int lineno() const { return yylineno; }
#ifdef YY_CHARSET
void set_charset(char *charset);
char* get_charset();
#endif
int debug() const { return yyflexdebug; }
void set_debug( int flag ) { yyflexdebug = flag; }
protected:
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"
char* yytext;
int yyleng;
int yylineno; // only maintained if you use %option yylineno
int yyflexdebug; // only has effect with -d or "%option debug"
};
}
@@ -118,111 +112,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( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 );
// 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();
virtual ~yyFlexLexer();
public:
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 );
virtual ~yyFlexLexer();
void yypush_buffer_state( struct yy_buffer_state* new_buffer );
void yypop_buffer_state();
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 );
virtual int yylex();
virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 );
virtual int yywrap();
void yypush_buffer_state( yy_buffer_state* new_buffer );
void yypop_buffer_state();
virtual int yyread(char *buf, size_t);
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();
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_r( 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;
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;
// Flag which is used to allow yywrap()'s to do buffer switches
// instead of setting up a fresh yyin. A bit of a hack ...
int yy_did_buffer_switch_on_eof;
size_t yy_buffer_stack_top; /**< index of top of stack. */
size_t yy_buffer_stack_max; /**< capacity of stack. */
struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
void yyensure_buffer_stack(void);
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);
// 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;
YY_CHAR* yy_last_accepting_cpos;
yy_state_type yy_last_accepting_state;
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;
size_t yy_state_buf_max;
YY_CHAR* yy_full_match;
int* yy_full_state;
int yy_full_lp;
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
+132 -78
View File
@@ -1,101 +1,152 @@
AM_YFLAGS = -d
localedir = $(datadir)/locale
AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/intl
LIBS = @LIBINTL@ @LIBS@
AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
LIBS = @LIBS@
pkgconfigdir = @pkgconfigdir@
m4 = @M4@
bin_PROGRAMS = flex
lib_LTLIBRARIES = \
libfl.la \
libfl_pic.la
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
flex_SOURCES = \
$(COMMON_SOURCES)
nodist_flex_SOURCES = \
stage1scan.c
flex_CFLAGS = $(AM_CFLAGS) $(WARNINGFLAGS)
COMMON_SOURCES = \
buf.c \
ccl.c \
dfa.c \
ecs.c \
scanflags.c \
filter.c \
flexdef.h \
flexint.h \
flexint_shared.h \
gen.c \
main.c \
misc.c \
nfa.c \
parse.y \
scan.l \
skel.c \
sym.c \
tblcmp.c \
yylex.c \
options.c \
scanopt.c \
buf.c \
tables.c \
tables_shared.c \
filter.c \
regex.c
LDADD = ../lib/libcompat.la
libfl_la_SOURCES = \
libmain.c \
libyywrap.c
libfl_la_LDFLAGS = -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 \
options.h \
parse.y \
regex.c \
scanflags.c \
scanopt.c \
scanopt.h \
skeletons.c \
sym.c \
tables.c \
tables.h \
tables_shared.h
tables_shared.c \
tables_shared.h \
tblcmp.c \
version.h \
yylex.c
LDADD = $(LIBOBJS) @LIBINTL@
$(LIBOBJS): $(LIBOBJDIR)$(am__dirstamp)
include_HEADERS = \
FlexLexer.h
EXTRA_DIST = \
flex.skl \
c99-flex.skl \
cpp-flex.skl \
go-flex.skl \
mkskel.sh \
gettext.h
gettext.h \
chkskel.sh
CLEANFILES = stage1scan.c stage1flex$(EXEEXT)
BUILT_SOURCES = \
skel.c
cpp-flex.h \
c99-flex.h \
go-flex.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
clean-local:
rm -f $(BUILT_SOURCES)
# 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
cpp-flex.h: cpp-flex.skl mkskel.sh flexint_shared.h tables_shared.h tables_shared.c
$(SHELL) $(srcdir)/mkskel.sh cpp $(srcdir) $(m4) $(VERSION) > $@.tmp
$(SHELL) $(srcdir)/chkskel.sh $@.tmp
mv -f $@.tmp $@
c99-flex.h: c99-flex.skl mkskel.sh
$(SHELL) $(srcdir)/mkskel.sh c99 $(srcdir) $(m4) $(VERSION) > $@.tmp
$(SHELL) $(srcdir)/chkskel.sh $@.tmp
mv -f $@.tmp $@
go-flex.h: go-flex.skl mkskel.sh
$(SHELL) $(srcdir)/mkskel.sh go $(srcdir) $(m4) $(VERSION) > $@.tmp
$(SHELL) $(srcdir)/chkskel.sh $@.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) && \
chmod u+w $(distdir)/scan.c && \
./flex$(EXEEXT) -o scan.c $< && \
mv -f scan.c $(distdir)
# make needs to be told to make inclusions so that parallelized runs will
# not fail.
SKELINCLUDES := $(subst skl,h,$(wildcard *.skl))
stage1flex-main.$(OBJEXT): parse.h $(SKELINCLUDES)
flex-main.$(OBJEXT): parse.h $(SKELINCLUDES)
stage1flex-yylex.$(OBJEXT): parse.h $(SKELINCLUDES)
flex-yylex.$(OBJEXT): parse.h $(SKELINCLUDES)
stage1flex-scan.$(OBJEXT): parse.h $(SKELINCLUDES)
flex-stage1scan.$(OBJEXT): parse.h $(SKELINCLUDES)
# Run GNU indent on sources. Don't run this unless all the sources compile cleanly.
#
@@ -132,11 +183,14 @@ indentfiles = \
tables_shared.h \
tblcmp.c
indent:
if [ -f .indent.pro ] ; then \
for f in $(indentfiles);\
do\
echo indenting $$f ;\
$(indent) < $$f >/dev/null && indent $$f || echo $$f FAILED to indent ;\
done \
fi
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
+25 -150
View File
@@ -47,87 +47,26 @@
/* global buffers. */
struct Buf userdef_buf; /**< for user #definitions triggered by cmd-line. */
struct Buf defs_buf; /**< for #define's autogenerated. List of strings. */
struct Buf yydmap_buf; /**< string buffer to hold yydmap elements */
struct Buf m4defs_buf; /**< m4 definitions. List of strings. */
struct Buf top_buf; /**< contains %top code. String buffer. */
struct Buf *buf_print_strings(struct Buf * buf, FILE* out)
{
int i;
if(!buf || !out)
return buf;
for (i=0; i < buf->nelts; i++){
const char * s = ((char**)buf->elts)[i];
if(s)
fprintf(out, "%s", s);
}
return buf;
}
/* Append a "%s" formatted string to a string buffer */
struct Buf *buf_prints (struct Buf *buf, const char *fmt, const char *s)
{
char *t;
size_t tsz;
t = flex_alloc (tsz = strlen (fmt) + strlen (s) + 1);
tsz = strlen(fmt) + strlen(s) + 1;
t = malloc(tsz);
if (!t)
flexfatal (_("Allocation of buffer to print string failed"));
snprintf (t, tsz, fmt, s);
buf = buf_strappend (buf, t);
flex_free (t);
free(t);
return buf;
}
/** Append a line directive to the string buffer.
* @param buf A string buffer.
* @param filename file name
* @param lineno line number
* @return buf
*/
struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno)
{
char *dst, *t;
const char *src;
t = flex_alloc (strlen ("#line \"\"\n") + /* constant parts */
2 * strlen (filename) + /* filename with possibly all backslashes escaped */
(int) (1 + log10 (abs (lineno))) + /* line number */
1); /* NUL */
if (!t)
flexfatal (_("Allocation of buffer for line directive failed"));
for (dst = t + sprintf (t, "#line %d \"", lineno), src = filename; *src; *dst++ = *src++)
if (*src == '\\') /* escape backslashes */
*dst++ = '\\';
*dst++ = '"';
*dst++ = '\n';
*dst = '\0';
buf = buf_strappend (buf, t);
flex_free (t);
return buf;
}
/** Append the contents of @a src to @a dest.
* @param @a dest the destination buffer
* @param @a dest the source buffer
* @return @a dest
*/
struct Buf *buf_concat(struct Buf* dest, const struct Buf* src)
{
buf_append(dest, src->elts, src->nelts);
return dest;
}
/* Appends n characters in str to buf. */
struct Buf *buf_strnappend (buf, str, n)
struct Buf *buf;
const char *str;
int n;
struct Buf *buf_strnappend (struct Buf *buf, const char *str, int n)
{
buf_append (buf, str, n + 1);
@@ -138,88 +77,27 @@ struct Buf *buf_strnappend (buf, str, n)
}
/* Appends characters in str to buf. */
struct Buf *buf_strappend (buf, str)
struct Buf *buf;
const char *str;
struct Buf *buf_strappend (struct Buf *buf, const char *str)
{
return buf_strnappend (buf, str, strlen (str));
}
/* appends "#define str def\n" */
struct Buf *buf_strdefine (buf, str, def)
struct Buf *buf;
const char *str;
const char *def;
{
buf_strappend (buf, "#define ");
buf_strappend (buf, " ");
buf_strappend (buf, str);
buf_strappend (buf, " ");
buf_strappend (buf, def);
buf_strappend (buf, "\n");
return buf;
}
/** Pushes "m4_define( [[def]], [[val]])m4_dnl" to end of buffer.
* @param buf A buffer as a list of strings.
* @param def The m4 symbol to define.
* @param val The definition; may be NULL.
* @return buf
*/
struct Buf *buf_m4_define (struct Buf *buf, const char* def, const char* val)
{
const char * fmt = "m4_define( [[%s]], [[%s]])m4_dnl\n";
char * str;
size_t strsz;
val = val?val:"";
str = (char*)flex_alloc(strsz = strlen(fmt) + strlen(def) + strlen(val) + 2);
if (!str)
flexfatal (_("Allocation of buffer for m4 def failed"));
snprintf(str, strsz, fmt, def, val);
buf_append(buf, &str, 1);
return buf;
}
/** Pushes "m4_undefine([[def]])m4_dnl" to end of buffer.
* @param buf A buffer as a list of strings.
* @param def The m4 symbol to undefine.
* @return buf
*/
struct Buf *buf_m4_undefine (struct Buf *buf, const char* def)
{
const char * fmt = "m4_undefine( [[%s]])m4_dnl\n";
char * str;
size_t strsz;
str = (char*)flex_alloc(strsz = strlen(fmt) + strlen(def) + 2);
if (!str)
flexfatal (_("Allocation of buffer for m4 undef failed"));
snprintf(str, strsz, fmt, def);
buf_append(buf, &str, 1);
return buf;
return buf_strnappend (buf, str, (int) strlen (str));
}
/* create buf with 0 elements, each of size elem_size. */
void buf_init (buf, elem_size)
struct Buf *buf;
size_t elem_size;
void buf_init (struct Buf *buf, size_t elem_size)
{
buf->elts = (void *) 0;
buf->elts = NULL;
buf->nelts = 0;
buf->elt_size = elem_size;
buf->nmax = 0;
}
/* frees memory */
void buf_destroy (buf)
struct Buf *buf;
void buf_destroy (struct Buf *buf)
{
if (buf && buf->elts)
flex_free (buf->elts);
buf->elts = (void *) 0;
if (buf) {
free(buf->elts);
buf->elts = NULL;
}
}
@@ -229,10 +107,7 @@ void buf_destroy (buf)
* We grow by mod(512) boundaries.
*/
struct Buf *buf_append (buf, ptr, n_elem)
struct Buf *buf;
const void *ptr;
int n_elem;
struct Buf *buf_append (struct Buf *buf, const void *ptr, int n_elem)
{
int n_alloc = 0;
@@ -242,30 +117,30 @@ struct Buf *buf_append (buf, ptr, n_elem)
/* May need to alloc more. */
if (n_elem + buf->nelts > buf->nmax) {
/* exact amount needed... */
n_alloc = (n_elem + buf->nelts) * buf->elt_size;
/* exact count needed... */
n_alloc = n_elem + buf->nelts;
/* ...plus some extra */
if (((n_alloc * buf->elt_size) % 512) != 0
if ((((size_t) n_alloc * buf->elt_size) % 512) != 0
&& buf->elt_size < 512)
n_alloc +=
(512 -
((n_alloc * buf->elt_size) % 512)) /
buf->elt_size;
n_alloc += (int)
((512 -
(((size_t) n_alloc * buf->elt_size) % 512)) /
buf->elt_size);
if (!buf->elts)
buf->elts =
allocate_array (n_alloc, buf->elt_size);
allocate_array ((int) n_alloc, buf->elt_size);
else
buf->elts =
reallocate_array (buf->elts, n_alloc,
reallocate_array (buf->elts, (int) n_alloc,
buf->elt_size);
buf->nmax = n_alloc;
}
memcpy ((char *) buf->elts + buf->nelts * buf->elt_size, ptr,
n_elem * buf->elt_size);
memcpy ((char *) buf->elts + (size_t) buf->nelts * buf->elt_size, ptr,
(size_t) n_elem * buf->elt_size);
buf->nelts += n_elem;
return buf;
+2544
View File
File diff suppressed because it is too large Load Diff
+17 -15
View File
@@ -52,9 +52,7 @@ ccl_contains (const int cclp, const int ch)
/* ccladd - add a single character to a ccl */
void ccladd (cclp, ch)
int cclp;
int ch;
void ccladd (int cclp, int ch)
{
int ind, len, newpos, i;
@@ -75,6 +73,13 @@ void ccladd (cclp, 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;
@@ -85,7 +90,7 @@ void ccladd (cclp, ch)
}
ccllen[cclp] = len + 1;
ccltbl[newpos] = ch;
ccltbl[newpos] = (unsigned char) ch;
}
/* dump_cclp - same thing as list_character_set, but for cclps. */
@@ -96,7 +101,7 @@ static void dump_cclp (FILE* file, int cclp)
putc ('[', file);
for (i = 0; i < csize; ++i) {
for (i = 0; i < ctrl.csize; ++i) {
if (ccl_contains(cclp, i)){
int start_char = i;
@@ -104,7 +109,7 @@ static void dump_cclp (FILE* file, int cclp)
fputs (readable_form (i), file);
while (++i < csize && ccl_contains(cclp,i)) ;
while (++i < ctrl.csize && ccl_contains(cclp,i)) ;
if (i - 1 > start_char)
/* this was a run */
@@ -133,7 +138,7 @@ ccl_set_diff (int a, int b)
* addding each char in a that is not in b.
* (This could be O(n^2), but n is small and bounded.)
*/
for ( ch = 0; ch < csize; ++ch )
for ( ch = 0; ch < ctrl.csize; ++ch )
if (ccl_contains (a, ch) && !ccl_contains(b, ch))
ccladd (d, ch);
@@ -185,7 +190,7 @@ ccl_set_union (int a, int b)
/* cclinit - return an empty ccl */
int cclinit ()
int cclinit (void)
{
if (++lastccl >= current_maxccls) {
current_maxccls += MAX_CCLS_INCREMENT;
@@ -225,8 +230,7 @@ int cclinit ()
/* cclnegate - negate the given ccl */
void cclnegate (cclp)
int cclp;
void cclnegate (int cclp)
{
cclng[cclp] = 1;
ccl_has_nl[cclp] = !ccl_has_nl[cclp];
@@ -240,15 +244,13 @@ void cclnegate (cclp)
* has a non-zero value in the cset array.
*/
void list_character_set (file, cset)
FILE *file;
int cset[];
void list_character_set (FILE *file, int cset[])
{
int i;
putc ('[', file);
for (i = 0; i < csize; ++i) {
for (i = 0; i < ctrl.csize; ++i) {
if (cset[i]) {
int start_char = i;
@@ -256,7 +258,7 @@ void list_character_set (file, cset)
fputs (readable_form (i), file);
while (++i < csize && cset[i]) ;
while (++i < ctrl.csize && cset[i]) ;
if (i - 1 > start_char)
/* this was a run */
+33
View File
@@ -0,0 +1,33 @@
#! /bin/sh
# This file is part of flex.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
if test ! $# = 1; then
echo 'Usage: chkskel.sh file' >&2
exit 1
fi
file=$1
lines=$(grep -c '^ "%%' "${file}")
if [ ! "${lines}" -eq 6 ]; then
echo 'ERROR: skeleton does not have the right number of %% section lines'
exit 2
fi
+4369
View File
File diff suppressed because it is too large Load Diff
+72 -120
View File
@@ -34,10 +34,10 @@
/* declare functions that have forward references */
void dump_associated_rules PROTO ((FILE *, int));
void dump_transitions PROTO ((FILE *, int[]));
void sympartition PROTO ((int[], int, int[], int[]));
int symfollowset PROTO ((int[], int, int, int[]));
void dump_associated_rules(FILE *, int);
void dump_transitions(FILE *, int[]);
void sympartition(int[], int, int[], int[]);
int symfollowset(int[], int, int, int[]);
/* check_for_backing_up - check a DFA state for backing up
@@ -49,26 +49,24 @@ int symfollowset PROTO ((int[], int, int, int[]));
* indexed by equivalence class.
*/
void check_for_backing_up (ds, state)
int ds;
int state[];
void check_for_backing_up (int ds, int state[])
{
if ((reject && !dfaacc[ds].dfaacc_set) || (!reject && !dfaacc[ds].dfaacc_state)) { /* state is non-accepting */
++num_backing_up;
if (backing_up_report) {
fprintf (backing_up_file,
if (env.backing_up_report) {
fprintf (ctrl.backing_up_file,
_("State #%d is non-accepting -\n"), ds);
/* identify the state */
dump_associated_rules (backing_up_file, ds);
dump_associated_rules (ctrl.backing_up_file, ds);
/* Now identify it further using the out- and
* jam-transitions.
*/
dump_transitions (backing_up_file, state);
dump_transitions (ctrl.backing_up_file, state);
putc ('\n', backing_up_file);
putc ('\n', ctrl.backing_up_file);
}
}
}
@@ -96,10 +94,7 @@ void check_for_backing_up (ds, state)
* accset[1 .. nacc] is the list of accepting numbers for the DFA state.
*/
void check_trailing_context (nfa_states, num_states, accset, nacc)
int *nfa_states, num_states;
int *accset;
int nacc;
void check_trailing_context (int *nfa_states, int num_states, int *accset, int nacc)
{
int i, j;
@@ -137,9 +132,7 @@ void check_trailing_context (nfa_states, num_states, accset, nacc)
* and writes a report to the given file.
*/
void dump_associated_rules (file, ds)
FILE *file;
int ds;
void dump_associated_rules (FILE *file, int ds)
{
int i, j;
int num_associated_rules = 0;
@@ -161,7 +154,7 @@ void dump_associated_rules (file, ds)
}
}
qsort (&rule_set [1], num_associated_rules, sizeof (rule_set [1]), intcmp);
qsort (&rule_set [1], (size_t) num_associated_rules, sizeof (rule_set [1]), intcmp);
fprintf (file, _(" associated rule line numbers:"));
@@ -187,14 +180,12 @@ void dump_associated_rules (file, ds)
* is done to the given file.
*/
void dump_transitions (file, state)
FILE *file;
int state[];
void dump_transitions (FILE *file, int state[])
{
int i, ec;
int out_char_set[CSIZE];
for (i = 0; i < csize; ++i) {
for (i = 0; i < ctrl.csize; ++i) {
ec = ABS (ecgroup[i]);
out_char_set[i] = state[ec];
}
@@ -204,7 +195,7 @@ void dump_transitions (file, state)
list_character_set (file, out_char_set);
/* now invert the members of the set to get the jam transitions */
for (i = 0; i < csize; ++i)
for (i = 0; i < ctrl.csize; ++i)
out_char_set[i] = !out_char_set[i];
fprintf (file, _("\n jam-transitions: EOF "));
@@ -235,8 +226,7 @@ void dump_transitions (file, state)
* hashval is the hash value for the dfa corresponding to the state set.
*/
int *epsclosure (t, ns_addr, accset, nacc_addr, hv_addr)
int *t, *ns_addr, accset[], *nacc_addr, *hv_addr;
int *epsclosure (int *t, int *ns_addr, int accset[], int *nacc_addr, int *hv_addr)
{
int stkpos, ns, tsp;
int numstates = *ns_addr, nacc, hashval, transsym, nfaccnum;
@@ -351,7 +341,7 @@ ADD_STATE(state); \
/* increase_max_dfas - increase the maximum number of DFAs */
void increase_max_dfas ()
void increase_max_dfas (void)
{
current_max_dfas += MAX_DFAS_INCREMENT;
@@ -376,9 +366,12 @@ void increase_max_dfas ()
*
* Creates the dfa corresponding to the ndfa we've constructed. The
* dfa starts out in state #1.
*
* Return the amount of space, in bytes, allocated for the next table.
* In some modes this can be zero.
*/
void ntod ()
size_t ntod (void)
{
int *accset, ds, nacc, newds;
int sym, hashval, numstates, dsize;
@@ -400,7 +393,7 @@ void ntod ()
* from 1 to CSIZE, so their size must be CSIZE + 1.
*/
int duplist[CSIZE + 1], state[CSIZE + 1];
int targfreq[CSIZE + 1], targstate[CSIZE + 1];
int targfreq[CSIZE + 1] = {0}, targstate[CSIZE + 1];
/* accset needs to be large enough to hold all of the rules present
* in the input, *plus* their YY_TRAILING_HEAD_MASK variants.
@@ -416,7 +409,7 @@ void ntod ()
*/
todo_head = todo_next = 0;
for (i = 0; i <= csize; ++i) {
for (i = 0; i <= ctrl.csize; ++i) {
duplist[i] = NIL;
symlist[i] = false;
}
@@ -424,7 +417,7 @@ void ntod ()
for (i = 0; i <= num_rules; ++i)
accset[i] = NIL;
if (trace) {
if (env.trace) {
dumpnfa (scset[1]);
fputs (_("\n\nDFA Dump:\n\n"), stderr);
}
@@ -462,38 +455,14 @@ void ntod ()
/* Note that the test for ecgroup[0] == numecs below accomplishes
* both (1) and (2) above
*
* New way: we will only use NUL table for fulltbl, because the
* scanner will use an integer instead of YY_CHAR as noted above
*/
if (!fullspd && ecgroup[0] == numecs) {
/* NUL is alone in its equivalence class, which is the
* last one.
*/
int use_NUL_table = (numecs == csize);
if (ctrl.fulltbl && ecgroup[0] == numecs && is_power_of_2(numecs))
nultrans = allocate_integer_array (current_max_dfas);
if (fulltbl && !use_NUL_table) {
/* We still may want to use the table if numecs
* is a power of 2.
*/
int power_of_two;
for (power_of_two = 1; power_of_two <= csize;
power_of_two *= 2)
if (numecs == power_of_two) {
use_NUL_table = true;
break;
}
}
if (use_NUL_table)
nultrans =
allocate_integer_array (current_max_dfas);
/* From now on, nultrans != nil indicates that we're
* saving null transitions for later, separate encoding.
*/
}
if (fullspd) {
if (ctrl.fullspd) {
for (i = 0; i <= numecs; ++i)
state[i] = 0;
@@ -501,7 +470,7 @@ void ntod ()
dfaacc[0].dfaacc_state = 0;
}
else if (fulltbl) {
else if (ctrl.fulltbl) {
if (nultrans)
/* We won't be including NUL's transitions in the
* table, so build it for entries from 0 .. numecs - 1.
@@ -521,40 +490,25 @@ void ntod ()
* So we'll have to realloc() on the way...
* we'll wait until we can calculate yynxt_tbl->td_hilen.
*/
yynxt_tbl =
(struct yytbl_data *) calloc (1,
sizeof (struct
yytbl_data));
yynxt_tbl = calloc(1, sizeof (struct yytbl_data));
yytbl_data_init (yynxt_tbl, YYTD_ID_NXT);
yynxt_tbl->td_hilen = 1;
yynxt_tbl->td_lolen = num_full_table_rows;
yynxt_tbl->td_lolen = (flex_uint32_t) num_full_table_rows;
yynxt_tbl->td_data = yynxt_data =
(flex_int32_t *) calloc (yynxt_tbl->td_lolen *
yynxt_tbl->td_hilen,
sizeof (flex_int32_t));
calloc(yynxt_tbl->td_lolen *
yynxt_tbl->td_hilen,
sizeof (flex_int32_t));
yynxt_curr = 0;
buf_prints (&yydmap_buf,
"\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
long_align ? "flex_int32_t" : "flex_int16_t");
/* Unless -Ca, declare it "short" because it's a real
* long-shot that that won't be large enough.
*/
struct packtype_t *ptype = optimize_pack(0);
/* Note: Used when ctrl.fulltbl is on. Alternately defined elsewhere */
out_str ("m4_define([[M4_HOOK_NXT_TYPE]], [[%s]])", ptype->name);
out_dec ("m4_define([[M4_HOOK_NXT_ROWS]], [[%d]])", num_full_table_rows);
outn ("m4_define([[M4_HOOK_NXT_BODY]], [[m4_dnl");
outn ("M4_HOOK_TABLE_OPENER");
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 (" {");
outn ("M4_HOOK_TABLE_OPENER");
/* Generate 0 entries for state #0. */
for (i = 0; i < num_full_table_rows; ++i) {
@@ -564,7 +518,7 @@ void ntod ()
dataflush ();
if (gentables)
outn (" },\n");
outn ("M4_HOOK_TABLE_CONTINUE");
}
/* Create the first states. */
@@ -598,7 +552,7 @@ void ntod ()
}
}
if (!fullspd) {
if (!ctrl.fullspd) {
if (!snstods (nset, 0, accset, 0, 0, &end_of_buffer_state))
flexfatal (_
("could not create unique end-of-buffer state"));
@@ -621,7 +575,7 @@ void ntod ()
dset = dss[ds];
dsize = dfasiz[ds];
if (trace)
if (env.trace)
fprintf (stderr, _("state # %d:\n"), ds);
sympartition (dset, dsize, symlist, duplist);
@@ -658,7 +612,7 @@ void ntod ()
state[sym] = newds;
if (trace)
if (env.trace)
fprintf (stderr,
"\t%d\t%d\n", sym,
newds);
@@ -676,7 +630,7 @@ void ntod ()
targ = state[duplist[sym]];
state[sym] = targ;
if (trace)
if (env.trace)
fprintf (stderr,
"\t%d\t%d\n", sym,
targ);
@@ -708,19 +662,17 @@ void ntod ()
state[NUL_ec] = 0; /* remove transition */
}
if (fulltbl) {
if (ctrl.fulltbl) {
/* Each time we hit here, it's another td_hilen, so we realloc. */
yynxt_tbl->td_hilen++;
yynxt_tbl->td_data = yynxt_data =
(flex_int32_t *) realloc (yynxt_data,
realloc (yynxt_data,
yynxt_tbl->td_hilen *
yynxt_tbl->td_lolen *
sizeof (flex_int32_t));
if (gentables)
outn (" {");
outn ("M4_HOOK_TABLE_OPENER");
/* Supply array's 0-element. */
if (ds == end_of_buffer_state) {
@@ -745,10 +697,10 @@ void ntod ()
dataflush ();
if (gentables)
outn (" },\n");
outn ("M4_HOOK_TABLE_CONTINUE");
}
else if (fullspd)
else if (ctrl.fullspd)
place_state (state, ds, totaltrans);
else if (ds == end_of_buffer_state)
@@ -776,8 +728,9 @@ void ntod ()
}
}
if (fulltbl) {
dataend ();
if (ctrl.fulltbl) {
dataend ("M4_HOOK_TABLE_CLOSER");
outn("/* body */]])");
if (tablesext) {
yytbl_data_compress (yynxt_tbl);
if (yytbl_data_fwrite (&tableswr, yynxt_tbl) < 0)
@@ -790,7 +743,7 @@ void ntod ()
}
}
else if (!fullspd) {
else if (!ctrl.fullspd) {
cmptmps (); /* create compressed template entries */
/* Create tables for all the states with only one
@@ -805,8 +758,11 @@ void ntod ()
mkdeftbl ();
}
flex_free ((void *) accset);
flex_free ((void *) nset);
free(accset);
free(nset);
return (yynxt_tbl != NULL) ? (yynxt_tbl->td_hilen * sizeof(int32_t)) : 0;
}
@@ -820,8 +776,7 @@ void ntod ()
* On return, the dfa state number is in newds.
*/
int snstods (sns, numstates, accset, nacc, hashval, newds_addr)
int sns[], numstates, accset[], nacc, hashval, *newds_addr;
int snstods (int sns[], int numstates, int accset[], int nacc, int hashval, int *newds_addr)
{
int didsort = 0;
int i, j;
@@ -836,7 +791,7 @@ int snstods (sns, numstates, accset, nacc, hashval, newds_addr)
/* We sort the states in sns so we
* can compare it to oldsns quickly.
*/
qsort (&sns [1], numstates, sizeof (sns [1]), intcmp);
qsort (&sns [1], (size_t) numstates, sizeof (sns [1]), intcmp);
didsort = 1;
}
@@ -871,7 +826,7 @@ int snstods (sns, numstates, accset, nacc, hashval, newds_addr)
*/
if (!didsort)
qsort (&sns [1], numstates, sizeof (sns [1]), intcmp);
qsort (&sns [1], (size_t) numstates, sizeof (sns [1]), intcmp);
for (i = 1; i <= numstates; ++i)
dss[newds][i] = sns[i];
@@ -881,7 +836,7 @@ int snstods (sns, numstates, accset, nacc, hashval, newds_addr)
if (nacc == 0) {
if (reject)
dfaacc[newds].dfaacc_set = (int *) 0;
dfaacc[newds].dfaacc_set = NULL;
else
dfaacc[newds].dfaacc_state = 0;
@@ -894,7 +849,7 @@ int snstods (sns, numstates, accset, nacc, hashval, newds_addr)
* match in the event of ties will work.
*/
qsort (&accset [1], nacc, sizeof (accset [1]), intcmp);
qsort (&accset [1], (size_t) nacc, sizeof (accset [1]), intcmp);
dfaacc[newds].dfaacc_set =
allocate_integer_array (nacc + 1);
@@ -942,8 +897,7 @@ int snstods (sns, numstates, accset, nacc, hashval, newds_addr)
* int transsym, int nset[current_max_dfa_size] );
*/
int symfollowset (ds, dsize, transsym, nset)
int ds[], dsize, transsym, nset[];
int symfollowset (int ds[], int dsize, int transsym, int nset[])
{
int ns, tsp, sym, i, j, lenccl, ch, numstates, ccllist;
@@ -1020,9 +974,7 @@ int symfollowset (ds, dsize, transsym, nset)
* int symlist[numecs], int duplist[numecs] );
*/
void sympartition (ds, numstates, symlist, duplist)
int ds[], numstates;
int symlist[], duplist[];
void sympartition (int ds[], int numstates, int symlist[], int duplist[])
{
int tch, i, j, k, ns, dupfwd[CSIZE + 1], lenccl, cclp, ich;
@@ -1044,7 +996,7 @@ void sympartition (ds, numstates, symlist, duplist)
tch = transchar[ns];
if (tch != SYM_EPSILON) {
if (tch < -lastccl || tch >= csize) {
if (tch < -lastccl || tch >= ctrl.csize) {
flexfatal (_
("bad transition character detected in sympartition()"));
}
+8 -11
View File
@@ -36,7 +36,7 @@
/* ccl2ecl - convert character classes to set of equivalence classes */
void ccl2ecl ()
void ccl2ecl (void)
{
int i, ich, newlen, cclp, ccls, cclmec;
@@ -56,7 +56,8 @@ void ccl2ecl ()
cclmec = ecgroup[ich];
if (cclmec > 0) {
ccltbl[cclp + newlen] = cclmec;
/* Note: range 1..256 is mapped to 1..255,0 */
ccltbl[cclp + newlen] = (unsigned char) cclmec;
++newlen;
}
}
@@ -74,8 +75,7 @@ void ccl2ecl ()
* Returned is the number of classes.
*/
int cre8ecs (fwd, bck, num)
int fwd[], bck[], num;
int cre8ecs (int fwd[], int bck[], int num)
{
int i, j, numcl;
@@ -100,9 +100,9 @@ int cre8ecs (fwd, bck, num)
/* mkeccl - update equivalence classes based on character class xtions
*
* synopsis
* Char ccls[];
* unsigned char ccls[];
* int lenccl, fwd[llsiz], bck[llsiz], llsiz, NUL_mapping;
* void mkeccl( Char ccls[], int lenccl, int fwd[llsiz], int bck[llsiz],
* void mkeccl( unsigned 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,9 +112,7 @@ int cre8ecs (fwd, bck, num)
* NUL_mapping is the value which NUL (0) should be mapped to.
*/
void mkeccl (ccls, lenccl, fwd, bck, llsiz, NUL_mapping)
Char ccls[];
int lenccl, fwd[], bck[], llsiz, NUL_mapping;
void mkeccl (unsigned char ccls[], int lenccl, int fwd[], int bck[], int llsiz, int NUL_mapping)
{
int cclp, oldec, newec;
int cclm, i, j;
@@ -201,8 +199,7 @@ void mkeccl (ccls, lenccl, fwd, bck, llsiz, NUL_mapping)
/* mkechar - create equivalence class for single character */
void mkechar (tch, fwd, bck)
int tch, fwd[], bck[];
void mkechar (int tch, int fwd[], int bck[])
{
/* If until now the character has been a proper subset of
* an equivalence class, break it away to create a new ec
+54 -68
View File
@@ -47,10 +47,9 @@ struct filter *filter_create_ext (struct filter *chain, const char *cmd,
va_list ap;
/* allocate and initialize new filter */
f = (struct filter *) flex_alloc (sizeof (struct filter));
f = calloc(sizeof(struct filter), 1);
if (!f)
flexerror (_("flex_alloc failed (f) in filter_create_ext"));
memset (f, 0, sizeof (*f));
flexerror(_("calloc failed (f) in filter_create_ext"));
f->filter_func = NULL;
f->extra = NULL;
f->next = NULL;
@@ -66,23 +65,16 @@ 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 =
(const char **) flex_alloc (sizeof (char *) *
(max_args + 1));
f->argv = malloc(sizeof(char *) * (size_t) (max_args + 1));
if (!f->argv)
flexerror (_("flex_alloc failed (f->argv) in filter_create_ext"));
flexerror(_("malloc failed (f->argv) in filter_create_ext"));
f->argv[f->argc++] = cmd;
va_start (ap, cmd);
while ((s = va_arg (ap, const char *)) != NULL) {
if (f->argc >= max_args) {
max_args += 8;
f->argv =
(const char **) flex_realloc (f->argv,
sizeof (char
*) *
(max_args +
1));
f->argv = realloc(f->argv, sizeof(char*) * (size_t) (max_args + 1));
}
f->argv[f->argc++] = s;
}
@@ -107,10 +99,9 @@ struct filter *filter_create_int (struct filter *chain,
struct filter *f;
/* allocate and initialize new filter */
f = (struct filter *) flex_alloc (sizeof (struct filter));
f = calloc(sizeof(struct filter), 1);
if (!f)
flexerror (_("flex_alloc failed in filter_create_int"));
memset (f, 0, sizeof (*f));
flexerror(_("calloc failed in filter_create_int"));
f->next = NULL;
f->argc = 0;
f->argv = NULL;
@@ -169,11 +160,13 @@ bool filter_apply_chain (struct filter * chain)
* to sync the stream. This is a Hail Mary situation. It seems to work.
*/
close (pipes[1]);
clearerr(stdin);
clearerr(stdin);
if (dup2 (pipes[0], fileno (stdin)) == -1)
flexfatal (_("dup2(pipes[0],0)"));
close (pipes[0]);
fseek (stdin, 0, SEEK_CUR);
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) {
@@ -181,16 +174,16 @@ clearerr(stdin);
if ((r = chain->filter_func (chain)) == -1)
flexfatal (_("filter_func failed"));
exit (0);
FLEX_EXIT (0);
}
else {
execvp (chain->argv[0],
(char **const) (chain->argv));
lerr_fatal ( _("exec of %s failed"),
chain->argv[0]);
lerr_fatal ( _("exec of %s failed"),
chain->argv[0]);
}
exit (1);
FLEX_EXIT (1);
}
/* Parent */
@@ -198,7 +191,7 @@ clearerr(stdin);
if (dup2 (pipes[1], fileno (stdout)) == -1)
flexfatal (_("dup2(pipes[1],1)"));
close (pipes[1]);
fseek (stdout, 0, SEEK_CUR);
fseek (stdout, 0, SEEK_CUR);
return true;
}
@@ -235,8 +228,7 @@ int filter_tee_header (struct filter *chain)
* header file at the same time.
*/
const int readsz = 512;
char *buf;
char buf[512];
int to_cfd = -1;
FILE *to_c = NULL, *to_h = NULL;
bool write_header;
@@ -264,34 +256,26 @@ int filter_tee_header (struct filter *chain)
*/
if (write_header) {
fputs (check_4_gnu_m4, to_h);
fputs (check_4_gnu_m4, to_h);
fputs ("m4_changecom`'m4_dnl\n", to_h);
fputs ("m4_changequote`'m4_dnl\n", to_h);
fputs ("m4_changequote([[,]])[[]]m4_dnl\n", to_h);
fputs ("m4_define([[M4_YY_NOOP]])[[]]m4_dnl\n", to_h);
fputs ("m4_define( [[M4_YY_IN_HEADER]],[[]])m4_dnl\n",
to_h);
fprintf (to_h, "#ifndef %sHEADER_H\n", prefix);
fprintf (to_h, "#define %sHEADER_H 1\n", prefix);
fprintf (to_h, "#define %sIN_HEADER 1\n\n", prefix);
fputs ("m4_changequote([[,]])[[]]m4_dnl\n", to_h);
fputs ("m4_define([[M4_YY_NOOP]])[[]]m4_dnl\n", to_h);
fputs ("m4_define([[M4_YY_IN_HEADER]],[[]])m4_dnl\n", to_h);
fprintf (to_h,
"m4_define( [[M4_YY_OUTFILE_NAME]],[[%s]])m4_dnl\n",
headerfilename ? headerfilename : "<stdout>");
env.headerfilename != NULL ? env.headerfilename : "<stdout>");
}
fputs (check_4_gnu_m4, to_c);
fputs (check_4_gnu_m4, to_c);
fputs ("m4_changecom`'m4_dnl\n", to_c);
fputs ("m4_changequote`'m4_dnl\n", to_c);
fputs ("m4_changequote([[,]])[[]]m4_dnl\n", to_c);
fputs ("m4_define([[M4_YY_NOOP]])[[]]m4_dnl\n", to_c);
fprintf (to_c, "m4_define( [[M4_YY_OUTFILE_NAME]],[[%s]])m4_dnl\n",
outfilename ? outfilename : "<stdout>");
env.outfilename != NULL ? env.outfilename : "<stdout>");
buf = (char *) flex_alloc (readsz);
if (!buf)
flexerror (_("flex_alloc failed in filter_tee_header"));
while (fgets (buf, readsz, stdin)) {
while (fgets (buf, sizeof buf, stdin)) {
fputs (buf, to_c);
if (write_header)
fputs (buf, to_h);
@@ -301,12 +285,8 @@ int filter_tee_header (struct filter *chain)
fprintf (to_h, "\n");
/* write a fake line number. It will get fixed by the linedir filter. */
fprintf (to_h, "#line 4000 \"M4_YY_OUTFILE_NAME\"\n");
fprintf (to_h, "#undef %sIN_HEADER\n", prefix);
fprintf (to_h, "#endif /* %sHEADER_H */\n", prefix);
fputs ("m4_undefine( [[M4_YY_IN_HEADER]])m4_dnl\n", to_h);
if (ctrl.gen_line_dirs)
line_directive_out (to_h, NULL, 4000);
fflush (to_h);
if (ferror (to_h))
lerr (_("error writing output file %s"),
@@ -320,18 +300,25 @@ int filter_tee_header (struct filter *chain)
fflush (to_c);
if (ferror (to_c))
lerr (_("error writing output file %s"),
outfilename ? outfilename : "<stdout>");
env.outfilename != NULL ? env.outfilename : "<stdout>");
else if (fclose (to_c))
lerr (_("error closing output file %s"),
outfilename ? outfilename : "<stdout>");
env.outfilename != NULL ? env.outfilename : "<stdout>");
while (wait (0) > 0) ;
exit (0);
FLEX_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,
@@ -340,8 +327,9 @@ int filter_tee_header (struct filter *chain)
*/
int filter_fix_linedirs (struct filter *chain)
{
char *buf;
const int readsz = 512;
char buf[4096];
const char *traceline_template, *cp;
const size_t readsz = sizeof buf;
int lineno = 1;
bool in_gen = true; /* in generated code */
bool last_was_blank = false;
@@ -349,17 +337,16 @@ int filter_fix_linedirs (struct filter *chain)
if (!chain)
return 0;
buf = (char *) flex_alloc (readsz);
if (!buf)
flexerror (_("flex_alloc failed in filter_fix_linedirs"));
while (fgets (buf, readsz, stdin)) {
while (fgets (buf, (int) readsz, stdin)) {
regmatch_t m[10];
/* Check for #line directive. */
if (buf[0] == '#'
&& regexec (&regex_linedir, buf, 3, m, 0) == 0) {
/* Check for directive. Note wired-in assumption:
* field reference 1 is line number, 2 is filename.
*/
if (ctrl.traceline_re != NULL &&
ctrl.traceline_template != NULL &&
regexec (&regex_linedir, buf, 3, m, 0) == 0) {
char *fname;
@@ -367,10 +354,10 @@ int filter_fix_linedirs (struct filter *chain)
fname = regmatch_dup (&m[2], buf);
if (strcmp (fname,
outfilename ? outfilename : "<stdout>")
env.outfilename != NULL ? env.outfilename : "<stdout>")
== 0
|| strcmp (fname,
headerfilename ? headerfilename : "<stdout>")
env.headerfilename != NULL ? env.headerfilename : "<stdout>")
== 0) {
char *s1, *s2;
@@ -394,8 +381,9 @@ int filter_fix_linedirs (struct filter *chain)
/* Adjust the line directives. */
in_gen = true;
snprintf (buf, readsz, "#line %d \"%s\"\n",
snprintf (buf, readsz, traceline_template,
lineno + 1, filename);
strncat(buf, "\n", sizeof(buf)-1);
}
else {
/* it's a #line directive for code we didn't write */
@@ -407,9 +395,7 @@ int filter_fix_linedirs (struct filter *chain)
}
/* squeeze blank lines from generated code */
else if (in_gen
&& regexec (&regex_blank_line, buf, 0, NULL,
0) == 0) {
else if (in_gen && is_blank_line(buf)) {
if (last_was_blank)
continue;
else
@@ -427,11 +413,11 @@ int filter_fix_linedirs (struct filter *chain)
fflush (stdout);
if (ferror (stdout))
lerr (_("error writing output file %s"),
outfilename ? outfilename : "<stdout>");
env.outfilename != NULL ? env.outfilename : "<stdout>");
else if (fclose (stdout))
lerr (_("error closing output file %s"),
outfilename ? outfilename : "<stdout>");
env.outfilename != NULL ? env.outfilename : "<stdout>");
return 0;
}
-3749
View File
File diff suppressed because it is too large Load Diff
+316 -339
View File
File diff suppressed because it is too large Load Diff
+12 -21
View File
@@ -3,31 +3,17 @@
#ifndef FLEXINT_H
#define FLEXINT_H
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
/* C++ systems might need __STDC_LIMIT_MACROS defined before including
* <stdint.h>, if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
/* "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"
/* Limits of integral types. */
#ifndef INT8_MIN
@@ -58,6 +44,11 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#ifndef INT_MAX
#define INT_MAX ((int)(~0U)>>1)
#endif
#ifndef SIZE_MAX
#define SIZE_MAX (~(size_t)0)
#endif
#endif /* ! FLEXINT_H */
+59
View File
@@ -0,0 +1,59 @@
/* flex integer type definitions */
#ifndef YYFLEX_INTTYPES_DEFINED
#define YYFLEX_INTTYPES_DEFINED
/* Prefer C99 integer types if available. */
# if defined(__cplusplus) && __cplusplus >= 201103L
#include <cstdint>
# define YYFLEX_USE_STDINT
# endif
# 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. */
# ifdef __cplusplus
#include <climits>
# else
#include <limits.h>
# endif
# 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 */
+288 -1393
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. */
#if ENABLE_NLS
#ifdef ENABLE_NLS
/* Get declarations of GNU message catalog functions. */
# include <libintl.h>
+2391
View File
File diff suppressed because it is too large Load Diff
+8
View File
@@ -0,0 +1,8 @@
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
+3 -1
View File
@@ -21,6 +21,8 @@
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */
#include <stdlib.h>
extern int yylex (void);
int main (int argc, char *argv[])
@@ -30,5 +32,5 @@ int main (int argc, char *argv[])
while (yylex () != 0) ;
return 0;
exit(0);
}
+919 -1070
View File
File diff suppressed because it is too large Load Diff
+133 -461
View File
@@ -30,128 +30,23 @@
/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */
#include "flexdef.h"
#include "tables.h"
#define CMD_IF_TABLES_SER "%if-tables-serialization"
#define CMD_TABLES_YYDMAP "%tables-yydmap"
#define CMD_DEFINE_YYTABLES "%define-yytables"
#define CMD_IF_CPP_ONLY "%if-c++-only"
#define CMD_IF_C_ONLY "%if-c-only"
#define CMD_IF_C_OR_CPP "%if-c-or-c++"
#define CMD_NOT_FOR_HEADER "%not-for-header"
#define CMD_OK_FOR_HEADER "%ok-for-header"
#define CMD_PUSH "%push"
#define CMD_POP "%pop"
#define CMD_IF_REENTRANT "%if-reentrant"
#define CMD_IF_NOT_REENTRANT "%if-not-reentrant"
#define CMD_IF_BISON_BRIDGE "%if-bison-bridge"
#define CMD_IF_NOT_BISON_BRIDGE "%if-not-bison-bridge"
#define CMD_ENDIF "%endif"
/* we allow the skeleton to push and pop. */
struct sko_state {
bool dc; /**< do_copy */
};
static struct sko_state *sko_stack=0;
static int sko_len=0,sko_sz=0;
static void sko_push(bool dc)
{
if(!sko_stack){
sko_sz = 1;
sko_stack = (struct sko_state*)flex_alloc(sizeof(struct sko_state)*sko_sz);
if (!sko_stack)
flexfatal(_("allocation of sko_stack failed"));
sko_len = 0;
}
if(sko_len >= sko_sz){
sko_sz *= 2;
sko_stack = (struct sko_state*)flex_realloc(sko_stack,sizeof(struct sko_state)*sko_sz);
}
/* initialize to zero and push */
sko_stack[sko_len].dc = dc;
sko_len++;
}
static void sko_peek(bool *dc)
{
if(sko_len <= 0)
flex_die("peek attempt when sko stack is empty");
if(dc)
*dc = sko_stack[sko_len-1].dc;
}
static void sko_pop(bool* dc)
{
sko_peek(dc);
sko_len--;
if(sko_len < 0)
flex_die("popped too many times in skeleton.");
}
/* Append "#define defname value\n" to the running buffer. */
void action_define (defname, value)
const char *defname;
int value;
{
char buf[MAXLINE];
char *cpy;
if ((int) strlen (defname) > MAXLINE / 2) {
format_pinpoint_message (_
("name \"%s\" ridiculously long"),
defname);
return;
}
snprintf (buf, sizeof(buf), "#define %s %d\n", defname, value);
add_action (buf);
/* track #defines so we can undef them when we're done. */
cpy = copy_string (defname);
buf_append (&defs_buf, &cpy, 1);
}
#ifdef notdef
/** Append "m4_define([[defname]],[[value]])m4_dnl\n" to the running buffer.
* @param defname The macro name.
* @param value The macro value, can be NULL, which is the same as the empty string.
*/
static void action_m4_define (const char *defname, const char * value)
{
char buf[MAXLINE];
flexfatal ("DO NOT USE THIS FUNCTION!");
if ((int) strlen (defname) > MAXLINE / 2) {
format_pinpoint_message (_
("name \"%s\" ridiculously long"),
defname);
return;
}
snprintf (buf, sizeof(buf), "m4_define([[%s]],[[%s]])m4_dnl\n", defname, value?value:"");
add_action (buf);
}
#endif
/* Append "new_text" to the running buffer. */
void add_action (new_text)
const char *new_text;
void add_action (const char *new_text)
{
int len = strlen (new_text);
int len = (int) strlen (new_text);
while (len + action_index >= action_size - 10 /* slop */ ) {
int new_size = action_size * 2;
if (new_size <= 0)
if (action_size > INT_MAX / 2)
/* Increase just a little, to try to avoid overflow
* on 16-bit machines.
*/
action_size += action_size / 8;
else
action_size = new_size;
action_size = action_size * 2;
action_array =
reallocate_character_array (action_array,
@@ -166,29 +61,35 @@ void add_action (new_text)
/* allocate_array - allocate memory for an integer array of the given size */
void *allocate_array (size, element_size)
int size;
size_t element_size;
void *allocate_array (int size, size_t element_size)
{
void *mem;
size_t num_bytes = element_size * size;
mem = flex_alloc (num_bytes);
if (!mem)
flexfatal (_
("memory allocation failed in allocate_array()"));
return mem;
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;
}
/* all_lower - true if a string is all lower-case */
int all_lower (str)
char *str;
int all_lower (char *str)
{
while (*str) {
if (!isascii ((Char) * str) || !islower ((Char) * str))
if (!isascii ((unsigned char) * str) || !islower ((unsigned char) * str))
return 0;
++str;
}
@@ -199,11 +100,10 @@ int all_lower (str)
/* all_upper - true if a string is all upper-case */
int all_upper (str)
char *str;
int all_upper (char *str)
{
while (*str) {
if (!isascii ((Char) * str) || !isupper ((Char) * str))
if (!isascii ((unsigned char) * str) || !isupper ((unsigned char) * str))
return 0;
++str;
}
@@ -225,14 +125,13 @@ int intcmp (const void *a, const void *b)
* and exits.
*/
void check_char (c)
int c;
void check_char (int c)
{
if (c >= CSIZE)
lerr (_("bad character '%s' detected in check_char()"),
readable_form (c));
if (c >= csize)
if (c >= ctrl.csize)
lerr (_
("scanner requires -8 flag to use the character %s"),
readable_form (c));
@@ -242,57 +141,20 @@ void check_char (c)
/* clower - replace upper-case letter to lower-case */
Char clower (c)
int c;
unsigned char clower (int c)
{
return (Char) ((isascii (c) && isupper (c)) ? tolower (c) : c);
return (unsigned char) ((isascii (c) && isupper (c)) ? tolower (c) : c);
}
/* copy_string - returns a dynamically allocated copy of a string */
char *copy_string (str)
const char *str;
char *xstrdup(const char *s)
{
const char *c1;
char *c2;
char *copy;
unsigned int size;
char *s2;
/* find length */
for (c1 = str; *c1; ++c1) ;
if ((s2 = strdup(s)) == NULL)
flexfatal (_("memory allocation failure in xstrdup()"));
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;
return s2;
}
@@ -300,19 +162,19 @@ Char *copy_unsigned_string (str)
int cclcmp (const void *a, const void *b)
{
if (!*(const Char *) a)
return 1;
else
if (!*(const Char *) b)
return - 1;
if (!*(const unsigned char *) a)
return 1;
else
return *(const Char *) a - *(const Char *) b;
if (!*(const unsigned char *) b)
return - 1;
else
return *(const unsigned char *) a - *(const unsigned char *) b;
}
/* dataend - finish up a block of data declarations */
void dataend ()
void dataend (const char *endit)
{
/* short circuit any output */
if (gentables) {
@@ -321,7 +183,8 @@ void dataend ()
dataflush ();
/* add terminator for initialization; { for vi */
outn (" } ;\n");
if (endit)
outn (endit);
}
dataline = 0;
datapos = 0;
@@ -330,13 +193,14 @@ void dataend ()
/* dataflush - flush generated data statements */
void dataflush ()
void dataflush (void)
{
/* short circuit any output */
if (!gentables)
return;
outc ('\n');
if (datapos > 0)
outc ('\n');
if (++dataline >= NUMDATALINES) {
/* Put out a blank line so that the table is grouped into
@@ -353,8 +217,7 @@ void dataflush ()
/* flexerror - report an error message and terminate */
void flexerror (msg)
const char *msg;
void flexerror (const char *msg)
{
fprintf (stderr, "%s: %s\n", program_name, msg);
flexend (1);
@@ -363,8 +226,7 @@ void flexerror (msg)
/* flexfatal - report a fatal error message and terminate */
void flexfatal (msg)
const char *msg;
void flexfatal (const char *msg)
{
fprintf (stderr, _("%s: fatal internal error, %s\n"),
program_name, msg);
@@ -372,22 +234,10 @@ void flexfatal (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;
@@ -412,30 +262,27 @@ void lerr_fatal (const char *msg, ...)
}
/* line_directive_out - spit out a "#line" statement */
void line_directive_out (output_file, do_infile)
FILE *output_file;
int do_infile;
/* line_directive_out - spit out a "#line" statement or equivalent */
void line_directive_out (FILE *output_file, char *path, int linenum)
{
char directive[MAXLINE], filename[MAXLINE];
char *trace_fmt = "m4_ifdef([[M4_HOOK_TRACE_LINE_FORMAT]], [[M4_HOOK_TRACE_LINE_FORMAT([[%d]], [[%s]])]])";
char directive[MAXLINE*2], filename[MAXLINE];
char *s1, *s2, *s3;
static const char *line_fmt = "#line %d \"%s\"\n";
if (!gen_line_dirs)
if (!ctrl.gen_line_dirs)
return;
s1 = do_infile ? infilename : "M4_YY_OUTFILE_NAME";
s1 = (path != NULL) ? path : "M4_YY_OUTFILE_NAME";
if (do_infile && !s1)
s1 = "<stdin>";
if ((path != NULL) && !s1)
s1 = "<stdin>";
s2 = filename;
s3 = &filename[sizeof (filename) - 2];
while (s2 < s3 && *s1) {
if (*s1 == '\\')
/* Escape the '\' */
if (*s1 == '\\' || *s1 == '"')
/* Escape the '\' or '"' */
*s2++ = '\\';
*s2++ = *s1++;
@@ -443,10 +290,10 @@ void line_directive_out (output_file, do_infile)
*s2 = '\0';
if (do_infile)
snprintf (directive, sizeof(directive), line_fmt, linenum, filename);
if (path != NULL)
snprintf (directive, sizeof(directive), trace_fmt, linenum, filename);
else {
snprintf (directive, sizeof(directive), line_fmt, 0, filename);
snprintf (directive, sizeof(directive), trace_fmt, 0, filename);
}
/* If output_file is nil then we should put the directive in
@@ -464,7 +311,7 @@ void line_directive_out (output_file, do_infile)
* representing where the user's section 1 definitions end
* and the prolog begins
*/
void mark_defs1 ()
void mark_defs1 (void)
{
defs1_offset = 0;
action_array[action_index++] = '\0';
@@ -476,7 +323,7 @@ void mark_defs1 ()
/* mark_prolog - mark the current position in the action array as
* representing the end of the action prolog
*/
void mark_prolog ()
void mark_prolog (void)
{
action_array[action_index++] = '\0';
action_offset = action_index;
@@ -488,8 +335,7 @@ void mark_prolog ()
*
* Generates a data statement initializing the current 2-D array to "value".
*/
void mk2data (value)
int value;
void mk2data (int value)
{
/* short circuit any output */
if (!gentables)
@@ -518,8 +364,7 @@ void mk2data (value)
* Generates a data statement initializing the current array element to
* "value".
*/
void mkdata (value)
int value;
void mkdata (int value)
{
/* short circuit any output */
if (!gentables)
@@ -532,7 +377,7 @@ void mkdata (value)
if (datapos == 0)
/* Indent. */
out (" ");
out (" ");
else
outc (',');
@@ -544,8 +389,7 @@ void mkdata (value)
/* myctoi - return the integer represented by a string of digits */
int myctoi (array)
const char *array;
int myctoi (const char *array)
{
int val = 0;
@@ -557,10 +401,9 @@ int myctoi (array)
/* myesc - return character corresponding to escape sequence */
Char myesc (array)
Char array[];
unsigned char myesc (unsigned char array[])
{
Char c, esc_char;
unsigned char c, esc_char;
switch (array[1]) {
case 'b':
@@ -573,19 +416,10 @@ Char myesc (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':
@@ -597,18 +431,15 @@ Char myesc (array)
{ /* \<octal> */
int sptr = 1;
while (isascii (array[sptr]) &&
isdigit (array[sptr]))
/* Don't increment inside loop control
* because if isdigit() is a macro it might
* expand into multiple increments ...
*/
while (sptr <= 3 &&
array[sptr] >= '0' && array[sptr] <= '7') {
++sptr;
}
c = array[sptr];
array[sptr] = '\0';
esc_char = otoi (array + 1);
esc_char = (unsigned char) strtoul (array + 1, NULL, 8);
array[sptr] = c;
@@ -619,18 +450,18 @@ Char myesc (array)
{ /* \x<hex> */
int sptr = 2;
while (isascii (array[sptr]) &&
isxdigit (array[sptr]))
while (sptr <= 3 && isxdigit (array[sptr])) {
/* Don't increment inside loop control
* because if isdigit() is a macro it might
* because if isxdigit() is a macro it might
* expand into multiple increments ...
*/
++sptr;
}
c = array[sptr];
array[sptr] = '\0';
esc_char = htoi (array + 2);
esc_char = (unsigned char) strtoul (array + 2, NULL, 16);
array[sptr] = c;
@@ -643,76 +474,46 @@ Char myesc (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 (str)
const char *str;
void out (const char *str)
{
fputs (str, stdout);
}
void out_dec (fmt, n)
const char *fmt;
int n;
void out_dec (const char *fmt, int n)
{
fprintf (stdout, fmt, n);
}
void out_dec2 (fmt, n1, n2)
const char *fmt;
int n1, n2;
void out_dec2 (const char *fmt, int n1, int n2)
{
fprintf (stdout, fmt, n1, n2);
}
void out_hex (fmt, x)
const char *fmt;
unsigned int x;
void out_hex (const char *fmt, unsigned int x)
{
fprintf (stdout, fmt, x);
}
void out_str (fmt, str)
const char *fmt, str[];
void out_str (const char *fmt, const char str[])
{
fprintf (stdout,fmt, str);
}
void out_str3 (fmt, s1, s2, s3)
const char *fmt, s1[], s2[], s3[];
{
fprintf (stdout,fmt, s1, s2, s3);
}
void out_str_dec (fmt, str, n)
const char *fmt, str[];
int n;
void out_str_dec (const char *fmt, const char str[], int n)
{
fprintf (stdout,fmt, str, n);
}
void outc (c)
int c;
void outc (int c)
{
fputc (c, stdout);
}
void outn (str)
const char *str;
void outn (const char *str)
{
fputs (str,stdout);
fputc('\n',stdout);
@@ -734,8 +535,7 @@ void out_m4_define (const char* def, const char* val)
* The returned string is in static storage.
*/
char *readable_form (c)
int c;
char *readable_form (int c)
{
static char rform[20];
@@ -751,16 +551,12 @@ char *readable_form (c)
return "\\r";
case '\t':
return "\\t";
#if defined (__STDC__)
case '\a':
return "\\a";
case '\v':
return "\\v";
#endif
default:
if(trace_hex)
if(env.trace_hex)
snprintf (rform, sizeof(rform), "\\x%.2x", (unsigned int) c);
else
snprintf (rform, sizeof(rform), "\\%.3o", (unsigned int) c);
@@ -772,7 +568,7 @@ char *readable_form (c)
return "' '";
else {
rform[0] = c;
rform[0] = (char) c;
rform[1] = '\0';
return rform;
@@ -782,168 +578,44 @@ char *readable_form (c)
/* reallocate_array - increase the size of a dynamic array */
void *reallocate_array (array, size, element_size)
void *array;
int size;
size_t element_size;
void *reallocate_array (void *array, int size, size_t element_size)
{
void *new_array;
size_t num_bytes = element_size * size;
new_array = flex_realloc (array, num_bytes);
#if 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
if (!new_array)
flexfatal (_("attempt to increase array size failed"));
#endif
return new_array;
}
/* skelout - write out one section of the skeleton file
*
* Description
* Copies skelfile or skel array to stdout until a line beginning with
* "%%" or EOF is found.
*/
void skelout ()
{
char buf_storage[MAXLINE];
char *buf = buf_storage;
bool do_copy = true;
/* "reset" the state by clearing the buffer and pushing a '1' */
if(sko_len > 0)
sko_peek(&do_copy);
sko_len = 0;
sko_push(do_copy=true);
/* Loop pulling lines either from the skelfile, if we're using
* one, or from the skel[] array.
*/
while (skelfile ?
(fgets (buf, MAXLINE, skelfile) != NULL) :
((buf = (char *) skel[skel_ind++]) != 0)) {
if (skelfile)
chomp (buf);
/* copy from skel array */
if (buf[0] == '%') { /* control line */
/* print the control line as a comment. */
if (ddebug && buf[1] != '#') {
if (buf[strlen (buf) - 1] == '\\')
out_str ("/* %s */\\\n", buf);
else
out_str ("/* %s */\n", buf);
}
/* We've been accused of using cryptic markers in the skel.
* So we'll use emacs-style-hyphenated-commands.
* We might consider a hash if this if-else-if-else
* chain gets too large.
*/
#define cmd_match(s) (strncmp(buf,(s),strlen(s))==0)
if (buf[1] == '%') {
/* %% is a break point for skelout() */
return;
}
else if (cmd_match (CMD_PUSH)){
sko_push(do_copy);
if(ddebug){
out_str("/*(state = (%s) */",do_copy?"true":"false");
}
out_str("%s\n", buf[strlen (buf) - 1] =='\\' ? "\\" : "");
}
else if (cmd_match (CMD_POP)){
sko_pop(&do_copy);
if(ddebug){
out_str("/*(state = (%s) */",do_copy?"true":"false");
}
out_str("%s\n", buf[strlen (buf) - 1] =='\\' ? "\\" : "");
}
else if (cmd_match (CMD_IF_REENTRANT)){
sko_push(do_copy);
do_copy = reentrant && do_copy;
}
else if (cmd_match (CMD_IF_NOT_REENTRANT)){
sko_push(do_copy);
do_copy = !reentrant && do_copy;
}
else if (cmd_match(CMD_IF_BISON_BRIDGE)){
sko_push(do_copy);
do_copy = bison_bridge_lval && do_copy;
}
else if (cmd_match(CMD_IF_NOT_BISON_BRIDGE)){
sko_push(do_copy);
do_copy = !bison_bridge_lval && do_copy;
}
else if (cmd_match (CMD_ENDIF)){
sko_pop(&do_copy);
}
else if (cmd_match (CMD_IF_TABLES_SER)) {
do_copy = do_copy && tablesext;
}
else if (cmd_match (CMD_TABLES_YYDMAP)) {
if (tablesext && yydmap_buf.elts)
outn ((char *) (yydmap_buf.elts));
}
else if (cmd_match (CMD_DEFINE_YYTABLES)) {
out_str("#define YYTABLES_NAME \"%s\"\n",
tablesname?tablesname:"yytables");
}
else if (cmd_match (CMD_IF_CPP_ONLY)) {
/* only for C++ */
sko_push(do_copy);
do_copy = C_plus_plus;
}
else if (cmd_match (CMD_IF_C_ONLY)) {
/* %- only for C */
sko_push(do_copy);
do_copy = !C_plus_plus;
}
else if (cmd_match (CMD_IF_C_OR_CPP)) {
/* %* for C and C++ */
sko_push(do_copy);
do_copy = true;
}
else if (cmd_match (CMD_NOT_FOR_HEADER)) {
/* %c begin linkage-only (non-header) code. */
OUT_BEGIN_CODE ();
}
else if (cmd_match (CMD_OK_FOR_HEADER)) {
/* %e end linkage-only code. */
OUT_END_CODE ();
}
else if (buf[1] == '#') {
/* %# a comment in the skel. ignore. */
}
else {
flexfatal (_("bad line in skeleton file"));
}
}
else if (do_copy)
outn (buf);
} /* end while */
}
/* transition_struct_out - output a yy_trans_info structure
*
* outputs the yy_trans_info structure with the two elements, element_v and
* element_n. Formats the output with spaces and carriage returns.
*/
void transition_struct_out (element_v, element_n)
int element_v, element_n;
void transition_struct_out (int element_v, int element_n)
{
/* short circuit any output */
if (!gentables)
return;
out_dec2 (" {%4d,%4d },", element_v, element_n);
out_dec2 ("M4_HOOK_TABLE_OPENER[[%4d]],[[%4d]]M4_HOOK_TABLE_CONTINUE", element_v, element_n);
outc ('\n');
datapos += TRANS_STRUCT_PRINT_LENGTH;
@@ -960,12 +632,14 @@ void transition_struct_out (element_v, 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 (size)
int size;
void *yy_flex_xmalloc (int size)
{
void *result = flex_alloc ((size_t) size);
void *result;
result = malloc((size_t) size);
if (!result)
flexfatal (_
("memory allocation failed in yy_flex_xmalloc()"));
@@ -974,29 +648,10 @@ void *yy_flex_xmalloc (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 (str)
char *str;
char *chomp (char *str)
{
char *p = str;
@@ -1013,3 +668,20 @@ char *chomp (str)
*p-- = 0;
return str;
}
void comment(const char *txt)
{
char buf[MAXLINE];
bool eol;
strncpy(buf, txt, MAXLINE-1);
eol = buf[strlen(buf)-1] == '\n';
if (eol)
buf[strlen(buf)-1] = '\0';
out_str("M4_HOOK_COMMENT_OPEN [[%s]] M4_HOOK_COMMENT_CLOSE", buf);
if (eol)
outc ('\n');
}
+26 -14
View File
@@ -21,17 +21,29 @@
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
cat <<!
/* File created from flex.skl via mkskel.sh */
#include "flexdef.h"
const char *skel[] = {
!
sed 's/\\/&&/g' | sed 's/"/\\"/g' | sed 's/.*/ "&",/'
cat <<!
0
};
!
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=.
# we do want word splitting, so we won't put double quotes around it (see IFS above)
# shellcheck disable=2086
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]*/ "&",/'
+38 -55
View File
@@ -36,8 +36,8 @@
/* declare functions that have forward references */
int dupmachine PROTO ((int));
void mkxtion PROTO ((int, int));
int dupmachine(int);
void mkxtion(int, int);
/* add_accept - add an accepting state to a machine
@@ -45,8 +45,7 @@ void mkxtion PROTO ((int, int));
* accepting_number becomes mach's accepting number.
*/
void add_accept (mach, accepting_number)
int mach, accepting_number;
void add_accept (int mach, int 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
@@ -77,8 +76,7 @@ void add_accept (mach, accepting_number)
* num - the number of copies of singl to be present in newsng
*/
int copysingl (singl, num)
int singl, num;
int copysingl (int singl, int num)
{
int copy, i;
@@ -93,9 +91,7 @@ int copysingl (singl, num)
/* dumpnfa - debugging routine to write out an nfa */
void dumpnfa (state1)
int state1;
void dumpnfa (int state1)
{
int sym, tsp1, tsp2, anum, ns;
@@ -148,8 +144,7 @@ void dumpnfa (state1)
* states accessible by the arrays firstst and lastst
*/
int dupmachine (mach)
int mach;
int dupmachine (int mach)
{
int i, init, state_offset;
int state = 0;
@@ -196,9 +191,8 @@ int dupmachine (mach)
* context has variable length.
*/
void finish_rule (mach, variable_trail_rule, headcnt, trailcnt,
pcont_act)
int mach, variable_trail_rule, headcnt, trailcnt, pcont_act;
void finish_rule (int mach, int variable_trail_rule, int headcnt, int trailcnt,
int pcont_act)
{
char action_text[MAXLINE];
@@ -222,10 +216,10 @@ void finish_rule (mach, variable_trail_rule, headcnt, trailcnt,
if (pcont_act && rule_has_nl[num_rules - 1])
rule_has_nl[num_rules] = true;
snprintf (action_text, sizeof(action_text), "case %d:\n", num_rules);
snprintf (action_text, sizeof(action_text), "M4_HOOK_NORMAL_STATE_CASE_ARM(%d)\n", num_rules);
add_action (action_text);
if (rule_has_nl[num_rules]) {
snprintf (action_text, sizeof(action_text), "/* rule %d can match eol */\n",
snprintf (action_text, sizeof(action_text), "M4_HOOK_COMMENT_OPEN rule %d can match eol M4_HOOK_COMMENT_CLOSE\n",
num_rules);
add_action (action_text);
}
@@ -234,7 +228,7 @@ void finish_rule (mach, variable_trail_rule, headcnt, trailcnt,
if (variable_trail_rule) {
rule_type[num_rules] = RULE_VARIABLE;
if (performance_report > 0)
if (env.performance_hint > 0)
fprintf (stderr,
_
("Variable trailing context rule at line %d\n"),
@@ -250,49 +244,46 @@ void finish_rule (mach, variable_trail_rule, headcnt, trailcnt,
/* Do trailing context magic to not match the trailing
* characters.
*/
char *scanner_cp = "YY_G(yy_c_buf_p) = yy_cp";
char *scanner_bp = "yy_bp";
add_action
("*yy_cp = YY_G(yy_hold_char); /* undo effects of setting up yytext */\n");
add_action ("M4_HOOK_RELEASE_YYTEXT\n");
if (headcnt > 0) {
if (rule_has_nl[num_rules]) {
snprintf (action_text, sizeof(action_text),
"YY_LINENO_REWIND_TO(%s + %d);\n", scanner_bp, headcnt);
"M4_HOOK_LINE_FORWARD(%d)\n", headcnt);
add_action (action_text);
}
snprintf (action_text, sizeof(action_text), "%s = %s + %d;\n",
scanner_cp, scanner_bp, headcnt);
snprintf (action_text, sizeof(action_text), "M4_HOOK_CHAR_FORWARD(%d)\n",
headcnt);
add_action (action_text);
}
else {
if (rule_has_nl[num_rules]) {
snprintf (action_text, sizeof(action_text),
"YY_LINENO_REWIND_TO(yy_cp - %d);\n", trailcnt);
"M4_HOOK_LINE_REWIND(%d)\n", trailcnt);
add_action (action_text);
}
snprintf (action_text, sizeof(action_text), "%s -= %d;\n",
scanner_cp, trailcnt);
snprintf (action_text, sizeof(action_text), "M4_HOOK_CHAR_REWIND(%d)\n",
trailcnt);
add_action (action_text);
}
add_action
("YY_DO_BEFORE_ACTION; /* set up yytext again */\n");
("M4_HOOK_TAKE_YYTEXT\n");
}
}
/* Okay, in the action code at this point yytext and yyleng have
* their proper final values for this rule, so here's the point
* to do any user action. But don't do it for continued actions,
* as that'll result in multiple YY_RULE_SETUP's.
* as that'll result in multiple rule-setup calls.
*/
if (!continued_action)
add_action ("YY_RULE_SETUP\n");
add_action ("M4_HOOK_SET_RULE_SETUP\n");
line_directive_out ((FILE *) 0, 1);
line_directive_out(NULL, infilename, linenum);
add_action("[[");
}
@@ -312,8 +303,7 @@ void finish_rule (mach, variable_trail_rule, headcnt, trailcnt,
* FIRST is set to new by the operation. last is unmolested.
*/
int link_machines (first, last)
int first, last;
int link_machines (int first, int last)
{
if (first == NIL)
return last;
@@ -339,8 +329,7 @@ int link_machines (first, last)
* The "beginning" states are the epsilon closure of the first state
*/
void mark_beginning_as_normal (mach)
int mach;
void mark_beginning_as_normal (int mach)
{
switch (state_type[mach]) {
case STATE_NORMAL:
@@ -381,8 +370,7 @@ void mark_beginning_as_normal (mach)
* more mkbranch's. Compare with mkor()
*/
int mkbranch (first, second)
int first, second;
int mkbranch (int first, int second)
{
int eps;
@@ -409,8 +397,7 @@ int mkbranch (first, second)
* new - a new state which matches the closure of "state"
*/
int mkclos (state)
int state;
int mkclos (int state)
{
return mkopt (mkposcl (state));
}
@@ -430,8 +417,7 @@ int mkclos (state)
* 2. mach is destroyed by the call
*/
int mkopt (mach)
int mach;
int mkopt (int mach)
{
int eps;
@@ -467,8 +453,7 @@ int mkopt (mach)
* the number of epsilon states needed
*/
int mkor (first, second)
int first, second;
int mkor (int first, int second)
{
int eps, orend;
@@ -510,6 +495,8 @@ int mkor (first, second)
}
}
firstst[first] = MIN(firstst[first], firstst[second]);
finalst[first] = orend;
return first;
}
@@ -523,8 +510,7 @@ int mkor (first, second)
* new - a machine matching the positive closure of "state"
*/
int mkposcl (state)
int state;
int mkposcl (int state)
{
int eps;
@@ -553,8 +539,7 @@ int mkposcl (state)
* if "ub" is INFINITE_REPEAT then "new" matches "lb" or more occurrences of "mach"
*/
int mkrep (mach, lb, ub)
int mach, lb, ub;
int mkrep (int mach, int lb, int ub)
{
int base_mach, tail, copy, i;
@@ -600,8 +585,7 @@ int mkrep (mach, lb, ub)
* that it admittedly is)
*/
int mkstate (sym)
int sym;
int mkstate (int sym)
{
if (++lastnfa >= current_mns) {
if ((current_mns += MNS_INCREMENT) >= maximum_mns)
@@ -658,9 +642,9 @@ current_mns);
else {
check_char (sym);
if (useecs)
if (ctrl.useecs)
/* Map NUL's to csize. */
mkechar (sym ? sym : csize, nextecm, ecgroup);
mkechar (sym ? sym : ctrl.csize, nextecm, ecgroup);
}
return lastnfa;
@@ -677,8 +661,7 @@ current_mns);
* stateto - the state to which the transition is to be made
*/
void mkxtion (statefrom, stateto)
int statefrom, stateto;
void mkxtion (int statefrom, int stateto)
{
if (trans1[statefrom] == NO_TRANSITION)
trans1[statefrom] = stateto;
@@ -695,7 +678,7 @@ void mkxtion (statefrom, stateto)
/* new_rule - initialize for a new rule */
void new_rule ()
void new_rule (void)
{
if (++num_rules >= current_max_rules) {
++num_reallocs;
+25 -8
View File
@@ -33,7 +33,7 @@
#include "options.h"
/* Be sure to synchronize these options with those defined in "options.h",
/* Be sure to synchronize these options with those defined in "ctrl.h",
* the giant switch() statement in "main.c", and the %option processing in
* "scan.l".
*/
@@ -62,6 +62,8 @@ 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}
@@ -98,7 +100,11 @@ optspec_t flexopts[] = {
{"-n", OPT_DONOTHING, 0}
, /* For POSIX lex compatibility. */
{"--ecs", OPT_ECS, 0}
, /* Construct equivalence classes. */
,
{"--emit=LANG", OPT_EMIT, 0}
, /* select language to emit */
{"-e LANG", OPT_EMIT, 0}
,
{"--noecs", OPT_NO_ECS, 0}
,
{"-F", OPT_FAST, 0}
@@ -213,10 +219,6 @@ 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}
@@ -233,7 +235,13 @@ optspec_t flexopts[] = {
{"--yywrap", OPT_YYWRAP, 0}
,
{"--nounput", OPT_NO_UNPUT, 0}
{"--noinput", OPT_NO_YYINPUT, 0}
,
{"--noyyinput", OPT_NO_YYINPUT, 0}
,
{"--nounput", OPT_NO_YYUNPUT, 0}
,
{"--noyyunput", OPT_NO_YYUNPUT, 0}
,
{"--noyy_push_state", OPT_NO_YY_PUSH_STATE, 0}
,
@@ -259,6 +267,10 @@ 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}
@@ -275,7 +287,12 @@ optspec_t flexopts[] = {
,
{"--noyyset_lloc", OPT_NO_YYSET_LLOC, 0}
,
{"--noyyget_debug", OPT_NO_YYGET_DEBUG, 0}
,
{"--noyyset_debug", OPT_NO_YYSET_DEBUG, 0}
,
{"--unsafe-no-m4-sect3-escape", OPT_NO_SECT3_ESCAPE, 0}
,
{0, 0, 0} /* required final NULL entry. */
};
+10 -4
View File
@@ -46,6 +46,7 @@ enum flexopt_flag_t {
OPT_ALWAYS_INTERACTIVE,
OPT_ARRAY,
OPT_BACKUP,
OPT_BACKUP_FILE,
OPT_BATCH,
OPT_BISON_BRIDGE,
OPT_BISON_BRIDGE_LOCATIONS,
@@ -56,6 +57,7 @@ enum flexopt_flag_t {
OPT_DEFAULT,
OPT_DONOTHING,
OPT_ECS,
OPT_EMIT,
OPT_FAST,
OPT_FULL,
OPT_HEADER_FILE,
@@ -68,8 +70,6 @@ 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,
@@ -79,24 +79,29 @@ enum flexopt_flag_t {
OPT_NO_REENTRANT,
OPT_NO_REJECT,
OPT_NO_STDINIT,
OPT_NO_UNPUT,
OPT_NO_YYINPUT,
OPT_NO_YYUNPUT,
OPT_NO_WARN,
OPT_NO_YYGET_EXTRA,
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,
OPT_NO_YYGET_DEBUG,
OPT_NO_YYGET_TEXT,
OPT_NO_YYLINENO,
OPT_NO_YYMORE,
OPT_NO_YYSET_EXTRA,
OPT_NO_YYSET_IN,
OPT_NO_YYSET_LINENO,
OPT_NO_YYSET_COLUMN,
OPT_NO_YYSET_LLOC,
OPT_NO_YYSET_LVAL,
OPT_NO_YYSET_OUT,
OPT_NO_YYSET_DEBUG,
OPT_NO_YYWRAP,
OPT_NO_YY_POP_STATE,
OPT_NO_YY_PUSH_STATE,
@@ -127,7 +132,8 @@ enum flexopt_flag_t {
OPT_YYCLASS,
OPT_YYLINENO,
OPT_YYMORE,
OPT_YYWRAP
OPT_YYWRAP,
OPT_NO_SECT3_ESCAPE,
};
#endif
+80 -72
View File
@@ -1,8 +1,9 @@
/* parse.y - parser for flex input */
%token CHAR NUMBER SECTEND SCDECL XSCDECL NAME PREVCCL EOF_OP
%token OPTION_OP OPT_OUTFILE OPT_PREFIX OPT_YYCLASS OPT_HEADER OPT_HEADER_CHAR
%token OPT_EXTRA_TYPE OPT_TABLES OPT_CHARSET_SOURCE
%token TOK_OPTION TOK_OUTFILE TOK_PREFIX TOK_YYCLASS TOK_HEADER_FILE TOK_EXTRA_TYPE
%token TOK_TABLES_FILE TOK_YYLMAX TOK_NUMERIC TOK_YYDECL TOK_PREACTION TOK_POSTACTION
%token TOK_USERINIT TOK_EMIT TOK_BUFSIZE TOK_YYTERMINATE
%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,14 +81,14 @@ int previous_continued_action; /* whether the previous rule's action was '|' */
do{ \
char fw3_msg[MAXLINE];\
snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\
warn( fw3_msg );\
lwarn( fw3_msg );\
}while(0)
/* Expand a POSIX character class expression. */
#define CCL_EXPR(func) \
do{ \
int c; \
for ( c = 0; c < csize; ++c ) \
for ( c = 0; c < ctrl.csize; ++c ) \
if ( isascii(c) && func(c) ) \
ccladd( currccl, c ); \
}while(0)
@@ -96,7 +97,7 @@ int previous_continued_action; /* whether the previous rule's action was '|' */
#define CCL_NEG_EXPR(func) \
do{ \
int c; \
for ( c = 0; c < csize; ++c ) \
for ( c = 0; c < ctrl.csize; ++c ) \
if ( !func(c) ) \
ccladd( currccl, c ); \
}while(0)
@@ -134,13 +135,16 @@ goal : initlex sect1 sect1end sect2 initforrule
for ( i = 1; i <= lastsc; ++i )
scset[i] = mkbranch( scset[i], def_rule );
if ( spprdflt )
add_action(
"YY_FATAL_ERROR( \"flex scanner jammed\" )" );
else
add_action( "ECHO" );
add_action("]]");
add_action( ";\n\tYY_BREAK\n" );
if ( ctrl.spprdflt )
add_action(
"M4_HOOK_FATAL_ERROR(\"flex scanner jammed\")");
else {
add_action("M4_HOOK_ECHO");
}
add_action( "\n\tM4_HOOK_STATE_CASE_BREAK\n" );
}
;
@@ -184,32 +188,46 @@ namelist1 : namelist1 NAME
{ synerr( _("bad start condition list") ); }
;
options : OPTION_OP optionlist
options : TOK_OPTION optionlist
;
optionlist : optionlist option
|
;
option : OPT_OUTFILE '=' NAME
option : TOK_OUTFILE '=' NAME
{
outfilename = copy_string( nmstr );
did_outfilename = 1;
env.outfilename = xstrdup(nmstr);
env.did_outfilename = 1;
}
| OPT_EXTRA_TYPE '=' NAME
{ extra_type = copy_string( nmstr ); }
| OPT_PREFIX '=' NAME
{ prefix = copy_string( nmstr ); }
| OPT_YYCLASS '=' NAME
{ yyclass = copy_string( nmstr ); }
| OPT_HEADER '=' NAME
{ headerfilename = copy_string( nmstr ); }
| OPT_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); }
| TOK_EXTRA_TYPE '=' NAME
{ extra_type = xstrdup(nmstr); }
| TOK_PREFIX '=' NAME
{ ctrl.prefix = xstrdup(nmstr);
if (strchr(ctrl.prefix, '[') || strchr(ctrl.prefix, ']'))
flexerror(_("Prefix must not contain [ or ]")); }
| TOK_YYCLASS '=' NAME
{ ctrl.yyclass = xstrdup(nmstr); }
| TOK_HEADER_FILE '=' NAME
{ env.headerfilename = xstrdup(nmstr); }
| TOK_YYLMAX '=' TOK_NUMERIC
{ ctrl.yylmax = nmval; }
| TOK_YYDECL '=' NAME
{ ctrl.yydecl = xstrdup(nmstr); }
| TOK_PREACTION '=' NAME
{ ctrl.preaction = xstrdup(nmstr); }
| TOK_POSTACTION '=' NAME
{ ctrl.postaction = xstrdup(nmstr); }
| TOK_BUFSIZE '=' TOK_NUMERIC
{ ctrl.bufsize = nmval; }
| TOK_EMIT '=' NAME
{ ctrl.emit = xstrdup(nmstr); backend_by_name(ctrl.emit); }
| TOK_USERINIT '=' NAME
{ ctrl.userinit = xstrdup(nmstr); }
| TOK_YYTERMINATE '=' NAME
{ ctrl.yyterminate = xstrdup(nmstr); }
| TOK_TABLES_FILE '=' NAME
{ tablesext = true; tablesfilename = xstrdup(nmstr); }
;
sect2 : sect2 scon initforrule flexrule '\n'
@@ -262,7 +280,7 @@ flexrule : '^' rule
{
bol_needed = true;
if ( performance_report > 1 )
if ( env.performance_hint > 1 )
pinpoint_message(
"'^' operator results in sub-optimal performance" );
}
@@ -307,7 +325,7 @@ flexrule : '^' rule
scon_stk[++scon_stk_ptr] = i;
if ( scon_stk_ptr == 0 )
warn(
lwarn(
"all start conditions already have <<EOF>> rules" );
else
@@ -402,7 +420,7 @@ rule : re2 re
* erroneously.
*/
if ( ! varlength || headcnt != 0 )
warn(
lwarn(
"trailing context made variable due to preceding '|' action" );
/* Mark as variable. */
@@ -411,7 +429,7 @@ rule : re2 re
}
if ( lex_compat || (varlength && headcnt == 0) )
if ( ctrl.lex_compat || (varlength && headcnt == 0) )
{ /* variable trailing context rule */
/* Mark the first part of the rule as the
* accepting "head" part of a trailing
@@ -457,13 +475,13 @@ rule : re2 re
/* See the comment in the rule for "re2 re"
* above.
*/
warn(
lwarn(
"trailing context made variable due to preceding '|' action" );
varlength = true;
}
if ( lex_compat || varlength )
if ( ctrl.lex_compat || varlength )
{
/* Again, see the comment in the rule for
* "re2 re" above.
@@ -486,7 +504,7 @@ rule : re2 re
if ( trlcontxt )
{
if ( lex_compat || (varlength && headcnt == 0) )
if ( ctrl.lex_compat || (varlength && headcnt == 0) )
/* Both head and trail are
* variable-length.
*/
@@ -700,19 +718,19 @@ singleton : singleton '*'
ccladd( ccldot, '\n' );
cclnegate( ccldot );
if ( useecs )
if ( ctrl.useecs )
mkeccl( ccltbl + cclmap[ccldot],
ccllen[ccldot], nextecm,
ecgroup, csize, csize );
ecgroup, ctrl.csize, ctrl.csize );
/* Create the (?s:'.') character class. */
cclany = cclinit();
cclnegate( cclany );
if ( useecs )
if ( ctrl.useecs )
mkeccl( ccltbl + cclmap[cclany],
ccllen[cclany], nextecm,
ecgroup, csize, csize );
ecgroup, ctrl.csize, ctrl.csize );
madeany = true;
}
@@ -729,11 +747,11 @@ singleton : singleton '*'
{
/* Sort characters for fast searching.
*/
qsort( ccltbl + cclmap[$1], ccllen[$1], sizeof (*ccltbl), cclcmp );
qsort( ccltbl + cclmap[$1], (size_t) ccllen[$1], sizeof (*ccltbl), cclcmp );
if ( useecs )
if ( ctrl.useecs )
mkeccl( ccltbl + cclmap[$1], ccllen[$1],
nextecm, ecgroup, csize, csize );
nextecm, ecgroup, ctrl.csize, ctrl.csize);
++rulelen;
@@ -917,13 +935,13 @@ ccl_expr:
| CCE_NEG_XDIGIT { CCL_NEG_EXPR(isxdigit); }
| CCE_NEG_LOWER {
if ( sf_case_ins() )
warn(_("[:^lower:] is ambiguous in case insensitive scanner"));
lwarn(_("[:^lower:] is ambiguous in case insensitive scanner"));
else
CCL_NEG_EXPR(islower);
}
| CCE_NEG_UPPER {
if ( sf_case_ins() )
warn(_("[:^upper:] ambiguous in case insensitive scanner"));
lwarn(_("[:^upper:] ambiguous in case insensitive scanner"));
else
CCL_NEG_EXPR(isupper);
}
@@ -955,7 +973,7 @@ string : string CHAR
* conditions
*/
void build_eof_action()
void build_eof_action(void)
{
int i;
char action_text[MAXLINE];
@@ -980,7 +998,8 @@ void build_eof_action()
}
}
line_directive_out( (FILE *) 0, 1 );
line_directive_out(NULL, infilename, linenum);
add_action("[[");
/* 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
@@ -994,8 +1013,7 @@ void build_eof_action()
/* format_synerr - write out formatted syntax error */
void format_synerr( msg, arg )
const char *msg, arg[];
void format_synerr( const char *msg, const char arg[] )
{
char errmsg[MAXLINE];
@@ -1006,8 +1024,7 @@ const char *msg, arg[];
/* synerr - report a syntax error */
void synerr( str )
const char *str;
void synerr( const char *str )
{
syntaxerror = true;
pinpoint_message( str );
@@ -1016,20 +1033,18 @@ const char *str;
/* format_warn - write out formatted warning */
void format_warn( msg, arg )
const char *msg, arg[];
void format_warn( const char *msg, const char arg[] )
{
char warn_msg[MAXLINE];
snprintf( warn_msg, sizeof(warn_msg), msg, arg );
warn( warn_msg );
lwarn( warn_msg );
}
/* warn - report a warning, unless -w was given */
/* lwarn - report a warning, unless -w was given */
void warn( str )
const char *str;
void lwarn( const char *str )
{
line_warning( str, linenum );
}
@@ -1038,10 +1053,9 @@ const char *str;
* pinpointing its location
*/
void format_pinpoint_message( msg, arg )
const char *msg, arg[];
void format_pinpoint_message( const char *msg, const char arg[] )
{
char errmsg[MAXLINE];
char errmsg[MAXLINE*2];
snprintf( errmsg, sizeof(errmsg), msg, arg );
pinpoint_message( errmsg );
@@ -1050,8 +1064,7 @@ const char *msg, arg[];
/* pinpoint_message - write out a message, pinpointing its location */
void pinpoint_message( str )
const char *str;
void pinpoint_message( const char *str )
{
line_pinpoint( str, linenum );
}
@@ -1059,13 +1072,11 @@ const char *str;
/* line_warning - report a warning at a given line, unless -w was given */
void line_warning( str, line )
const char *str;
int line;
void line_warning( const char *str, int line )
{
char warning[MAXLINE];
char warning[MAXLINE*2];
if ( ! nowarn )
if ( ! env.nowarn )
{
snprintf( warning, sizeof(warning), "warning, %s", str );
line_pinpoint( warning, line );
@@ -1075,9 +1086,7 @@ int line;
/* line_pinpoint - write out a message, pinpointing it at the given line */
void line_pinpoint( str, line )
const char *str;
int line;
void line_pinpoint( const char *str, int line )
{
fprintf( stderr, "%s:%d: %s\n", infilename, line, str );
}
@@ -1087,8 +1096,7 @@ int line;
* currently, messages are ignore
*/
void yyerror( msg )
const char *msg;
void yyerror( const char *msg )
{
(void)msg;
}
+19 -28
View File
@@ -24,22 +24,17 @@
#include "flexdef.h"
static const char* REGEXP_LINEDIR = "^#line ([[:digit:]]+) \"(.*)\"";
static const char* REGEXP_BLANK_LINE = "^[[:space:]]*$";
regex_t regex_linedir; /**< matches line directives */
regex_t regex_blank_line; /**< matches blank lines */
/** Initialize the regular expressions.
* @return true upon success.
*/
bool flex_init_regex(void)
bool flex_init_regex(const char *traceline_re)
{
flex_regcomp(&regex_linedir, REGEXP_LINEDIR, REG_EXTENDED);
flex_regcomp(&regex_blank_line, REGEXP_BLANK_LINE, REG_EXTENDED);
return true;
if (traceline_re != NULL)
flex_regcomp(&regex_linedir, traceline_re, REG_EXTENDED);
return true;
}
/** Compiles a regular expression or dies trying.
@@ -49,26 +44,22 @@ bool flex_init_regex(void)
*/
void flex_regcomp(regex_t *preg, const char *regex, int cflags)
{
int err;
int err;
memset (preg, 0, sizeof (regex_t));
if ((err = regcomp (preg, regex, cflags)) != 0) {
const int errbuf_sz = 200;
char *errbuf, *rxerr;
const size_t errbuf_sz = 200;
char *errbuf;
int n;
errbuf = (char*)flex_alloc(errbuf_sz *sizeof(char));
errbuf = malloc(errbuf_sz * sizeof(char));
if (!errbuf)
flexfatal(_("Unable to allocate buffer to report regcomp"));
rxerr = (char*)flex_alloc(errbuf_sz *sizeof(char));
if (!rxerr)
flexfatal(_("Unable to allocate buffer for regerror"));
regerror (err, preg, rxerr, errbuf_sz);
snprintf (errbuf, errbuf_sz, "regcomp for \"%s\" failed: %s", regex, rxerr);
n = snprintf(errbuf, errbuf_sz, "regcomp for \"%s\" failed: ", regex);
regerror(err, preg, errbuf+n, errbuf_sz-(size_t)n);
flexfatal (errbuf);
free(errbuf);
free(rxerr);
flexfatal (errbuf); /* never returns - no need to free(errbuf) */
}
}
@@ -80,12 +71,12 @@ void flex_regcomp(regex_t *preg, const char *regex, int cflags)
char *regmatch_dup (regmatch_t * m, const char *src)
{
char *str;
int len;
size_t len;
if (m == NULL || m->rm_so < 0)
if (m == NULL || m->rm_so < 0 || m->rm_eo < m->rm_so)
return NULL;
len = m->rm_eo - m->rm_so;
str = (char *) flex_alloc ((len + 1) * sizeof (char));
len = (size_t) (m->rm_eo - m->rm_so);
str = malloc((len + 1) * sizeof(char));
if (!str)
flexfatal(_("Unable to allocate a copy of the match"));
strncpy (str, src + m->rm_so, len);
@@ -107,8 +98,8 @@ char *regmatch_cpy (regmatch_t * m, char *dest, const char *src)
return dest;
}
snprintf (dest, regmatch_len(m), "%s", src + m->rm_so);
return dest;
snprintf (dest, (size_t) regmatch_len(m), "%s", src + m->rm_so);
return dest;
}
/** Get the length in characters of the match.
@@ -150,7 +141,7 @@ int regmatch_strtol (regmatch_t * m, const char *src, char **endptr,
else
s = regmatch_dup (m, src);
n = strtol (s, endptr, base);
n = (int) strtol (s, endptr, base);
if (s != buf)
free (s);
+373 -274
View File
File diff suppressed because it is too large Load Diff

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