]> granicus.if.org Git - re2c/log
re2c
6 years agoAlways add structural tags to the RHS of alternative/catenation in POSIX captures.
Ulya Trofimovich [Sat, 4 Aug 2018 09:44:56 +0000 (10:44 +0100)]
Always add structural tags to the RHS of alternative/catenation in POSIX captures.

(Preliminary work before switching from Kuklewicz POSIX disambiguation
algorithm to Okui algorithm.)

6 years agoDon't move the closing tag of POSIX capture group out of the enclosing iteration.
Ulya Trofimovich [Sat, 4 Aug 2018 09:25:01 +0000 (10:25 +0100)]
Don't move the closing tag of POSIX capture group out of the enclosing iteration.

RE2C used to perform the following optimization: when a POSIX capture is
under iteration, we only need to get tag values of the last iteration
(according to the POSIX standard). Therefore we can move the closing tag
out of loop.

This commit removes this optimization (as part of the effort to switch
from Kuklewicz POSIX disambiguation algorthm to Okui algorithm).

In other words, for RE (x)* re2c used to generate this "optimized" IRE:
    1 (3 x)* 4 2
and now it generates the "canonical" IRE:
    1 (3 x 4)* 2

Updated tests for '--posix-captures' that have been affected by the change.

6 years agoAllow default copy for POD struct (fixes [-Wclass-memaccess] GCC warning).
Ulya Trofimovich [Sat, 4 Aug 2018 09:09:01 +0000 (10:09 +0100)]
Allow default copy for POD struct (fixes [-Wclass-memaccess] GCC warning).

6 years agoUpdated GOR1 (fixed the core algorithm to avoid useless re-scans of the same state).
Ulya Trofimovich [Sat, 28 Jul 2018 22:30:04 +0000 (23:30 +0100)]
Updated GOR1 (fixed the core algorithm to avoid useless re-scans of the same state).

Also, depth-first traversal was done in a slightly incorrect way:
we checked outgoing nodes for admissibility and pushed the corresponding
child states on stack all at once. This is not the same as checking
the first child and recursing into it, then checking the next child,
..., and so on (because we might discover the second child while exploring
the first, and admissiblitiy check for the second child *after* that
might yield false, while *before* exploring the first child it yielded
true).

6 years agoPick the shortest available path suffix when generating skeleton path cover.
Ulya Trofimovich [Sat, 28 Jul 2018 21:52:44 +0000 (22:52 +0100)]
Pick the shortest available path suffix when generating skeleton path cover.

This also fixes a error in the generation process: sometimes in case
of loops the current node's suffix was set before all of its children
were processed.

Updated test results (in some cases .input files became larger because
of the above fix, in some cases they became smaller because we now pick
the shortest suffix).

Added new test; this one was found by slyfox's fuzzer and revealed the
above bug.

6 years agoChanged the name of a local variable in the test to avoid collision with skeleton...
Ulya Trofimovich [Sat, 28 Jul 2018 09:53:34 +0000 (10:53 +0100)]
Changed the name of a local variable in the test to avoid collision with skeleton names.

Before tags were added to re2c, skeleton programs only used a limited
number of predefined names, such as 'yych', 'yystate', etc. With tags,
however, this is no longer true as tags may have any names. So now we need
to be more cautios when picking names for sekleton variables.

This patch is only a workaround to make all tests pass; the real solution
requires inventing a good naming scheme for skeleton programs and
regenerating all skeleton test results.

6 years agoPaper: more tweaks of GOR1.
Ulya Trofimovich [Sat, 28 Jul 2018 09:36:08 +0000 (10:36 +0100)]
Paper: more tweaks of GOR1.

6 years agoFixed error in calculation of maximal skeleton path length.
Ulya Trofimovich [Sat, 28 Jul 2018 09:21:37 +0000 (10:21 +0100)]
Fixed error in calculation of maximal skeleton path length.

The error was found by slyfox's fuzzer (a randomly-generated skeleton test).

The bug in the code was, apparently, too early modification of the state's
estimated maximal distance to the end states: the distance was set before
all of the state's children were processed, which resulted in aborting the
accumulation of distance from the remaining children, and, as a consequence,
shorter than necessary max distance for the root itself.

6 years agoPaper: updated version of GOR1.
Ulya Trofimovich [Wed, 25 Jul 2018 21:12:23 +0000 (22:12 +0100)]
Paper: updated version of GOR1.

6 years agoPaper: some tweaks for the examples of traces computation.
Ulya Trofimovich [Fri, 6 Jul 2018 23:01:15 +0000 (00:01 +0100)]
Paper: some tweaks for the examples of traces computation.

6 years agoPaper: another example of traces computation.
Ulya Trofimovich [Mon, 2 Jul 2018 22:06:40 +0000 (23:06 +0100)]
Paper: another example of traces computation.

6 years agoPaper: added example of PEs and traces computation.
Ulya Trofimovich [Sat, 30 Jun 2018 20:23:13 +0000 (21:23 +0100)]
Paper: added example of PEs and traces computation.

6 years agoFixed processing of #line directives in input files.
Ulya Trofimovich [Mon, 25 Jun 2018 21:42:33 +0000 (22:42 +0100)]
Fixed processing of #line directives in input files.

The correct behaviour was broken somewhere in between 0.16 and 1.0:
re2c was forgetting to output the chunk of input file that precedes
the #line directive.

Reported by pskocik in #98.

6 years agoPaper: re-worked the theorem about compatibility of total and partial orders.
Ulya Trofimovich [Sun, 24 Jun 2018 22:06:06 +0000 (23:06 +0100)]
Paper: re-worked the theorem about compatibility of total and partial orders.

6 years agoPaper: started re-working the theorem about compatibility of total and partial orders.
Ulya Trofimovich [Sun, 24 Jun 2018 08:37:48 +0000 (09:37 +0100)]
Paper: started re-working the theorem about compatibility of total and partial orders.

6 years agoPaper: made example about parse trees consistent with its description.
Ulya Trofimovich [Sat, 23 Jun 2018 10:06:02 +0000 (11:06 +0100)]
Paper: made example about parse trees consistent with its description.

6 years agoPaper: continued restructuring the part about indexed parse trees.
Ulya Trofimovich [Sat, 23 Jun 2018 09:57:58 +0000 (10:57 +0100)]
Paper: continued restructuring the part about indexed parse trees.

6 years agoPaper: restructured the IRE construction example.
Ulya Trofimovich [Wed, 20 Jun 2018 21:29:17 +0000 (22:29 +0100)]
Paper: restructured the IRE construction example.

6 years agoPaper: added an example of IRE construction.
Ulya Trofimovich [Mon, 18 Jun 2018 22:14:22 +0000 (23:14 +0100)]
Paper: added an example of IRE construction.

6 years agoPaper: added introduction to the second chapter.
Ulya Trofimovich [Sun, 17 Jun 2018 09:21:02 +0000 (10:21 +0100)]
Paper: added introduction to the second chapter.

6 years agoPaper: revise basic definitions before introducing partial order on trees.
Ulya Trofimovich [Sat, 16 Jun 2018 09:41:18 +0000 (10:41 +0100)]
Paper: revise basic definitions before introducing partial order on trees.

6 years agopaper: taken care of Angelo's remarks.
Ulya Trofimovich [Wed, 13 Jun 2018 22:00:45 +0000 (23:00 +0100)]
paper: taken care of Angelo's remarks.

6 years agoAdded option "--conditions" (an alias for "-c" and "--start-conditions").
Ulya Trofimovich [Mon, 11 Jun 2018 20:27:27 +0000 (21:27 +0100)]
Added option "--conditions" (an alias for "-c" and "--start-conditions").

Fixes issue #206 "wrong long option for -c mode".

6 years agoAdded first part of TDFA paper v2.
Ulya Trofimovich [Thu, 24 May 2018 22:44:23 +0000 (23:44 +0100)]
Added first part of TDFA paper v2.

6 years agoImproved error reporting in fuzz-testing script.
Ulya Trofimovich [Wed, 25 Apr 2018 21:49:15 +0000 (22:49 +0100)]
Improved error reporting in fuzz-testing script.

6 years agoIf the input starts with a re2c block, apply re2c configurations immediately. (see...
Ulya Trofimovich [Sat, 14 Apr 2018 20:50:32 +0000 (21:50 +0100)]
If the input starts with a re2c block, apply re2c configurations immediately. (see #201).

6 years agoEscape backslashes in file names (see #201).
Ulya Trofimovich [Fri, 13 Apr 2018 23:23:35 +0000 (00:23 +0100)]
Escape backslashes in file names (see #201).

7 years agoRelease 1.0.3. 1.0.3
Ulya Trofimovich [Wed, 8 Nov 2017 20:40:53 +0000 (20:40 +0000)]
Release 1.0.3.

7 years agoFix for #198. mac_ports
Ulya Trofimovich [Wed, 8 Nov 2017 07:19:21 +0000 (07:19 +0000)]
Fix for #198.

GCC-4.2.1 is unable to compile code like this:

    std::vector<int> v;
    std::vector<int>::const_reverse_iterator i;
    for (i = v.rbegin(); i != v.rend(); ++i) ;

It's unable to deduce const overload for 'rend':

    "no match for ‘operator!=’ in ‘i != std::vector<_Tp, _Alloc>::rend()"

However, the following code compiles fine:

    std::vector<int> v;
    std::vector<int>::const_reverse_iterator i = v.rbegin(), e = v.rend();
    for (i != e; ++i) ;

This was reported by Ryan Shmidt.

7 years agoFixed typo in docs (found by Maxim Reznik).
Ulya Trofimovich [Thu, 14 Sep 2017 19:08:37 +0000 (20:08 +0100)]
Fixed typo in docs (found by Maxim Reznik).

7 years agoRemoved unaccurate example.
Ulya Trofimovich [Mon, 28 Aug 2017 16:33:46 +0000 (17:33 +0100)]
Removed unaccurate example.

Parsing floating-point numbers is hard and re2c doesn't help much,
so this example was somewhat misleading.

7 years agoRelease 1.0.2. 1.0.2
Ulya Trofimovich [Sat, 26 Aug 2017 20:07:06 +0000 (21:07 +0100)]
Release 1.0.2.

7 years agoUpdated changelog.
Ulya Trofimovich [Sat, 26 Aug 2017 20:02:22 +0000 (21:02 +0100)]
Updated changelog.

7 years agoSome more fixes to the documentation.
Ulya Trofimovich [Sat, 26 Aug 2017 19:26:26 +0000 (20:26 +0100)]
Some more fixes to the documentation.

7 years agoUpdated documentation.
Ulya Trofimovich [Sat, 26 Aug 2017 18:10:24 +0000 (19:10 +0100)]
Updated documentation.

7 years agoDisallow condition names and named definitions to start with digit.
Ulya Trofimovich [Sat, 26 Aug 2017 09:31:35 +0000 (10:31 +0100)]
Disallow condition names and named definitions to start with digit.

This has always been the intended behavior and was accidentally broken
by commit e3db638fc3e9bfb318edafedbefd02f25f1c1b8c.

7 years agoRenamed tests.
Ulya Trofimovich [Tue, 22 Aug 2017 20:39:33 +0000 (21:39 +0100)]
Renamed tests.

7 years agoUpdated examples and added them to 'run_tests.sh' script.
Ulya Trofimovich [Tue, 22 Aug 2017 17:06:55 +0000 (18:06 +0100)]
Updated examples and added them to 'run_tests.sh' script.

7 years agoUpdated changelog.
Ulya Trofimovich [Tue, 22 Aug 2017 08:15:47 +0000 (09:15 +0100)]
Updated changelog.

7 years agoAdded forgotten 'genhelp.sh' to distribution files.
Ulya Trofimovich [Tue, 22 Aug 2017 08:09:35 +0000 (09:09 +0100)]
Added forgotten 'genhelp.sh' to distribution files.

This fixes bug #194 "Build with "--enable-docs" fails".

7 years agoAdded examples to test suite.
Ulya Trofimovich [Fri, 18 Aug 2017 15:09:59 +0000 (16:09 +0100)]
Added examples to test suite.

7 years agoAdded benchmarks to test suite.
Ulya Trofimovich [Wed, 16 Aug 2017 17:43:13 +0000 (18:43 +0100)]
Added benchmarks to test suite.

7 years agoUpdated changelog for 1.0.1 version.
Ulya Trofimovich [Fri, 11 Aug 2017 21:43:05 +0000 (22:43 +0100)]
Updated changelog for 1.0.1 version.

7 years agoRelease 1.0.1. 1.0.1
Ulya Trofimovich [Fri, 11 Aug 2017 21:31:09 +0000 (22:31 +0100)]
Release 1.0.1.

7 years agoMakefile.am: add paper on Lookahead TDFA to distribution.
Ulya Trofimovich [Fri, 11 Aug 2017 21:16:04 +0000 (22:16 +0100)]
Makefile.am: add paper on Lookahead TDFA to distribution.

7 years agoFixed #193: "1.0 build failure on macOS: error: calling a private constructor of...
Ulya Trofimovich [Fri, 11 Aug 2017 21:04:05 +0000 (22:04 +0100)]
Fixed #193: "1.0 build failure on macOS: error: calling a private constructor of class 're2c::Rule'".

Copy constructor and assignment are requred by std::valarray
implementation on macOS.

7 years agoRelease 1.0. 1.0
Ulya Trofimovich [Fri, 11 Aug 2017 13:46:23 +0000 (14:46 +0100)]
Release 1.0.

7 years agoPaper on lookahead TDFA: finished.
Ulya Trofimovich [Fri, 11 Aug 2017 11:52:10 +0000 (12:52 +0100)]
Paper on lookahead TDFA: finished.

7 years agoUpdated help and manpage.
Ulya Trofimovich [Thu, 10 Aug 2017 15:03:46 +0000 (16:03 +0100)]
Updated help and manpage.

7 years agoLeave the definition of 'yynmatch' and 'yypmatch' to the user.
Ulya Trofimovich [Thu, 10 Aug 2017 12:25:07 +0000 (13:25 +0100)]
Leave the definition of 'yynmatch' and 'yypmatch' to the user.

With '--posix-captures' RE2C stores submatch results in 'yynmatch'
(the total number of capturing groups for the matching rule) and
'yypmatch' (an array of submatch values for each group).

These variables should be user-defined, so that users can override
default implementation (e.g. make 'yypmatch' an array of integer
offsets rather than an array of pointers). Overriding is only possible
with generic API: if default API is used, then RE2C can autogenerate
'yynmatch' and 'yypmatch' (and so it did prior to this commit).
However, it is better to have the same behavior with both APIs; also,
it is coherent with '--tags' option (RE2C leaves tag definition to
the user).

7 years agoUpdated options list and regenerated docs.
Ulya Trofimovich [Wed, 9 Aug 2017 17:35:15 +0000 (18:35 +0100)]
Updated options list and regenerated docs.

7 years agoAdded short option '-P' corresponding to '--posix-captures'.
Ulya Trofimovich [Wed, 9 Aug 2017 17:07:50 +0000 (18:07 +0100)]
Added short option '-P' corresponding to '--posix-captures'.

7 years agoFixed includes with 'include-what-you-use'.
Ulya Trofimovich [Wed, 9 Aug 2017 16:17:09 +0000 (17:17 +0100)]
Fixed includes with 'include-what-you-use'.

Command:

    $ configure CXX=include-what-you-use CXXFLAGS="--check-also" \
        && make -k 2>log \
        && python2 `which fix_inclydes.py` < log

7 years agoPaper on Lookahead TDFA: added bibliography.
Ulya Trofimovich [Wed, 9 Aug 2017 13:04:10 +0000 (14:04 +0100)]
Paper on Lookahead TDFA: added bibliography.

7 years agoAmended README instructions for benchmarks.
Ulya Trofimovich [Wed, 9 Aug 2017 07:47:51 +0000 (08:47 +0100)]
Amended README instructions for benchmarks.

7 years agoPaper on Lookahead TDFA: added pictures.
Ulya Trofimovich [Mon, 7 Aug 2017 11:57:30 +0000 (12:57 +0100)]
Paper on Lookahead TDFA: added pictures.

7 years agoPaper on Lookahead TDFA: fixed captions and ran through aspell.
Ulya Trofimovich [Mon, 7 Aug 2017 11:54:29 +0000 (12:54 +0100)]
Paper on Lookahead TDFA: fixed captions and ran through aspell.

7 years agoPaper on Lookahead TDFA: added benchmark results and graphs.
Ulya Trofimovich [Sat, 5 Aug 2017 08:33:30 +0000 (09:33 +0100)]
Paper on Lookahead TDFA: added benchmark results and graphs.

7 years agoPaper on Lookahead TDFA: reformatted examples.
Ulya Trofimovich [Fri, 4 Aug 2017 08:57:58 +0000 (09:57 +0100)]
Paper on Lookahead TDFA: reformatted examples.

7 years agoTweaked CXXFLAGS in asan build script.
Ulya Trofimovich [Fri, 4 Aug 2017 08:52:14 +0000 (09:52 +0100)]
Tweaked CXXFLAGS in asan build script.

7 years agoA small tweak in benchmarking scripts that reduces warmup time.
Ulya Trofimovich [Fri, 4 Aug 2017 08:50:59 +0000 (09:50 +0100)]
A small tweak in benchmarking scripts that reduces warmup time.

7 years agoFuzzers: a bunch of small tweaks.
Ulya Trofimovich [Thu, 3 Aug 2017 11:14:19 +0000 (12:14 +0100)]
Fuzzers: a bunch of small tweaks.

7 years agoSkeleton: fixed initialization of maximal path length.
Ulya Trofimovich [Thu, 3 Aug 2017 10:52:49 +0000 (11:52 +0100)]
Skeleton: fixed initialization of maximal path length.

Broken by commit fffb5932ee52127e03b9f7f5ccca83a421d69061.

Path length were initialized with 0 instead 'DIST_ERROR', which caused
incorrect calculation of maximal path length. This in turn caused errors
in estimating the number of byted necessary to hold keys during data
generation in skeleton. The resulting keys were one-byte while maximal
path length was more than one byte, which (fortunately!) caused runtime
errors in skeleton programs.

Example of program that caused skeleton error:
    /*!re2c
        (@t [\x00] [^]{5,6})* {}
    */

The error was hidden for so long because in practice inputs that need
more than one-byte keys are rare, and fuzzer sets 'ulimit -t 10' when
running re2c, so most of such programs were simply aborted. Those that
were not aborted still had a chance of estimating key size correctly.

7 years agoFixed cppcheck 'style' warnings.
Ulya Trofimovich [Wed, 2 Aug 2017 22:11:13 +0000 (23:11 +0100)]
Fixed cppcheck 'style' warnings.

Used the following command to run cppcheck:

   cppcheck --enable=all --inconclusive --std=posix --quiet --force -I. src/

7 years agoFixed headers that were not self-contained.
Ulya Trofimovich [Wed, 2 Aug 2017 20:43:36 +0000 (21:43 +0100)]
Fixed headers that were not self-contained.

Used the following command to find errors:

    for h in $(find src/ -name '*.h*'); do echo "CHECKING $h"; g++ -I. -c $h -o foo.o; done

7 years agoBenchmarks: added README and small samples of input data.
Ulya Trofimovich [Wed, 2 Aug 2017 17:07:16 +0000 (18:07 +0100)]
Benchmarks: added README and small samples of input data.

7 years agoAdded scripts that run benchmarks.
Ulya Trofimovich [Wed, 2 Aug 2017 14:49:07 +0000 (15:49 +0100)]
Added scripts that run benchmarks.

7 years agoAdded fuzzers (contributed by Sergei Trofimovich).
Ulya Trofimovich [Tue, 1 Aug 2017 15:41:58 +0000 (16:41 +0100)]
Added fuzzers (contributed by Sergei Trofimovich).

7 years agoDon't loose mtag versions in TDFA intitalizer.
Ulya Trofimovich [Tue, 1 Aug 2017 15:36:45 +0000 (16:36 +0100)]
Don't loose mtag versions in TDFA intitalizer.

7 years agoMakefile.am: use portable POSIX primitive to get directory name.
Ulya Trofimovich [Tue, 1 Aug 2017 12:19:06 +0000 (13:19 +0100)]
Makefile.am: use portable POSIX primitive to get directory name.

Use '$(@D)' instead of '$(dir $@)', as the latter requires secondary
expansion feature specific to GNU make; it causes build failures on
bmake.

'$(@D)', on the other hand, is a POSIX make feature documented e.g. in
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html
(section "Internal Macros").

7 years agoAdded some testing scripts for various CXX/CXXFLAGS confgurations.
Ulya Trofimovich [Tue, 1 Aug 2017 11:51:19 +0000 (12:51 +0100)]
Added some testing scripts for various CXX/CXXFLAGS confgurations.

7 years agoMakefile.am: fixed other custom rules to avoid writing into unexistent directory.
Ulya Trofimovich [Tue, 1 Aug 2017 10:39:39 +0000 (11:39 +0100)]
Makefile.am: fixed other custom rules to avoid writing into unexistent directory.

The fixed rules do not presently trigger any build errors: target directory
is created by configure as it need to put autogenerated files doc/manpage.rst
and doc/help.rst in it.

However, this behaviour is occasional: if one removes the .in files, build
failure would be unmasked. So it makes sense to ensure that target directory
exists.

7 years agoMakefile.am (building docs): create target directory before writing into it.
Ulya Trofimovich [Tue, 1 Aug 2017 10:19:27 +0000 (11:19 +0100)]
Makefile.am (building docs): create target directory before writing into it.

To reproduce build falure (before the fix):

    $ mkdir <builddir>
    $ cd <builddir>
    $ ../condigure --disable-dependency-tracking
    $ make src/conf/help.cc V=1
    cp ../bootstrap/src/conf/help.cc src/conf/help.cc
    cp: cannot create regular file ‘src/conf/help.cc’: No such file or directory
    Makefile:1984: recipe for target 'src/conf/help.cc' failed
    make: *** [src/conf/help.cc] Error 1

7 years agoMakefile.am (rebuilding docs): create target directory before writing into it.
Ulya Trofimovich [Tue, 1 Aug 2017 10:09:03 +0000 (11:09 +0100)]
Makefile.am (rebuilding docs): create target directory before writing into it.

To reproduce build falure (before the fix):

    $ mkdir <builddir>
    $ cd <builddir>
    $ ../condigure --disable-dependency-tracking --enable-docs
    $ make src/conf/help.cc V=1
    rst2man.py ./doc/help.rst > src/conf/help.cc.1
    /bin/sh: src/conf/help.cc.1: No such file or directory
    Makefile:1976: recipe for target 'src/conf/help.cc' failed
    make: *** [src/conf/help.cc] Error 1

7 years agoMakefile.am: create target directory before writing into it 192/head
Ross Burton [Mon, 31 Jul 2017 14:43:41 +0000 (15:43 +0100)]
Makefile.am: create target directory before writing into it

In some situations src/parse/ may not exist before a file is copied into the
directory. Ensure that this doesn't happen by creating the directory first.

7 years agoDon't assert that comparator arguments are non-equal.
Ulya Trofimovich [Tue, 1 Aug 2017 07:22:14 +0000 (08:22 +0100)]
Don't assert that comparator arguments are non-equal.

Comparator is used in 'std::sort'.
All items in closure have unnique TNFA states, therefore we assumed
that the compared items must always be different. However, 'std::sort'
does not have this requirement and some implementations of it compare
the element with itself.

The removed assert caused crashes with old version of GCC (4.2).

Thanks to Sergei Trofimovich for debugging the issue.

7 years agoMakefile.am: create target directory before writing into it 191/head
Ross Burton [Mon, 31 Jul 2017 14:43:41 +0000 (15:43 +0100)]
Makefile.am: create target directory before writing into it

In some situations src/parse/ may not exist before a file is copied into the
directory. Ensure that this doesn't happen by creating the directory first.

7 years agorun_tests.sh: avoid using 'sed -i' as it is non-portable.
Ulya Trofimovich [Mon, 31 Jul 2017 14:05:44 +0000 (15:05 +0100)]
run_tests.sh: avoid using 'sed -i' as it is non-portable.

On FreeBSD 'sed -i' works in a different way than on Linux.

7 years agoUse explicit stack instead of implicit recursion.
Ulya Trofimovich [Mon, 31 Jul 2017 13:22:19 +0000 (14:22 +0100)]
Use explicit stack instead of implicit recursion.

With CXXFLAGS='-fsanitize=addres' GCC complains about stack overflow.

7 years agoFixed unaligned memory access.
Ulya Trofimovich [Mon, 31 Jul 2017 12:59:51 +0000 (13:59 +0100)]
Fixed unaligned memory access.

With CXXFLAGS='-fsanitize=undefined' GCC complains about unaligned access:
if custom allocator is used to allocate structs or other alignment-sensitive
things, then it must take care of the alignment (for example, add padding
to all unaligned blocks of memory which it allocates).

7 years agoAvoid calling 'memcpy' to copy zero bytes from NULL source.
Ulya Trofimovich [Mon, 31 Jul 2017 12:30:44 +0000 (13:30 +0100)]
Avoid calling 'memcpy' to copy zero bytes from NULL source.

With CXXFLAGS='-fsanitize=undefined' GCC complains about passing NULL
pointer to function which parameter is marked as 'attribute__((nonnull))'.

7 years agoFixed MINGW warnings.
Ulya Trofimovich [Mon, 31 Jul 2017 11:40:07 +0000 (12:40 +0100)]
Fixed MINGW warnings.

7 years agoAdded some more suggestions for pre-release testing.
Ulya Trofimovich [Mon, 31 Jul 2017 11:03:28 +0000 (12:03 +0100)]
Added some more suggestions for pre-release testing.

7 years agoFixed GCC warnings with '-m32'.
Ulya Trofimovich [Mon, 31 Jul 2017 10:49:20 +0000 (11:49 +0100)]
Fixed GCC warnings with '-m32'.

7 years agoFixed some of the warnings that Clang emits with '-Weverythng'.
Ulya Trofimovich [Mon, 31 Jul 2017 10:29:36 +0000 (11:29 +0100)]
Fixed some of the warnings that Clang emits with '-Weverythng'.

7 years agoMerge remote-tracking branch 'origin/devel'.
Ulya Trofimovich [Sun, 30 Jul 2017 20:51:31 +0000 (21:51 +0100)]
Merge remote-tracking branch 'origin/devel'.

7 years agofix documentation issue #184 devel
Petr Skocik [Thu, 20 Apr 2017 15:53:25 +0000 (17:53 +0200)]
fix documentation issue #184

7 years agoManpage: removed occasionally copy-pasted section.
Ulya Trofimovich [Mon, 10 Apr 2017 12:43:02 +0000 (13:43 +0100)]
Manpage: removed occasionally copy-pasted section.

7 years agoAutogenerate help from manpage.
Ulya Trofimovich [Mon, 10 Apr 2017 12:41:17 +0000 (13:41 +0100)]
Autogenerate help from manpage.

7 years agoManpage: include paths must be relative to 'top_srcdir'.
Ulya Trofimovich [Sun, 9 Apr 2017 18:36:28 +0000 (19:36 +0100)]
Manpage: include paths must be relative to 'top_srcdir'.

Otherwise out-of-source builds won't work.

7 years agocompose manpage out of rsts from gh-pages-gen
Petr Skocik [Sat, 8 Apr 2017 21:14:36 +0000 (23:14 +0200)]
compose manpage out of rsts from gh-pages-gen

7 years agosync --help output w/ manpage
Petr Skocik [Fri, 7 Apr 2017 23:29:38 +0000 (01:29 +0200)]
sync --help output w/ manpage

    + set output width to 80
    + make help output go to stdout rather than stderr

7 years agoGrammar fixes in the manpage
Petr Skocik [Mon, 3 Apr 2017 15:48:10 +0000 (17:48 +0200)]
Grammar fixes in the manpage

7 years agoRecognize newlines in character strings and classes.
Ulya Trofimovich [Mon, 7 Nov 2016 09:46:18 +0000 (09:46 +0000)]
Recognize newlines in character strings and classes.

As for now, newline inside of a character string or class is an error:
re2c should emit clear error message. Different styles of newlines
should be recognized ("\n", "\r\n").

This commit fixes bug #162 reported by pauloscustodio:
    Reading files with "rb" causes issues in Windows

7 years agoFixed line endings in output files on Windows (#162, #163).
Ulya Trofimovich [Sun, 30 Jul 2017 16:45:30 +0000 (17:45 +0100)]
Fixed line endings in output files on Windows (#162, #163).

This fix consists of two issues, both reported and fixed by pauloscustodio.

1. #162 "Open text files with "wb" causes issues on Windows"

    Text files need to be opened for writing with "w", so that stdio does
    the right thing in respect to the correct line endings for the current OS.
    ("\r\n" in Windows, "\n" in Linux).

2. #163 "Reading files with "rb" causes issues in Windows"

    re2c reads input files in binary mode and writes the generated output in
    text mode. This caused CR LF conversion to CR CR LF on Windows: first CR
    comes from reading input in binary mode, second CR is added when writing
    output in text mode. This only happened to those parts of input which are
    not transformed by re2c: we used to copy-paste verbatim, now we patch line
    endings. Now we convert all line endings to LF before writing the generated
    code to file.

7 years agoFixed #147 "Please add symbol name to "can't find symbol" error message".
Ulya Trofimovich [Sat, 25 Jun 2016 15:22:08 +0000 (16:22 +0100)]
Fixed #147 "Please add symbol name to "can't find symbol" error message".

As suggested by sirzooro:
    Please add symbol name to "can't find symbol" error message,
    it would allow to quickly spot what is wrong. Now we have to
    position cursor at given row and column to find that name.

Also tweaked error reporitng function to append "..." at the end
of the message if it didn't fit into buffer.

7 years agoFixed bug #145 "Values for enum YYCONDTYPE are not generated
Ulya Trofimovich [Fri, 24 Jun 2016 21:46:16 +0000 (22:46 +0100)]
Fixed bug #145 "Values for enum YYCONDTYPE are not generated
when default rules with conditions are used".

Default rule is handled in a special (delayed) way;
re2c uses different code for default rule than for normal rules.
This special code simply forgot to add condition name to the list
of conditions.

Thanks to sirzooro for bug report.

7 years agorun_tests.sh: fix permissions after copying source files to build directory.
Ulya Trofimovich [Sun, 9 Apr 2017 18:28:28 +0000 (19:28 +0100)]
run_tests.sh: fix permissions after copying source files to build directory.

`make distcheck` protects source files from writing.
Test script run_tests.sh copies source files into build directory,
but the copied files inherit permissions, so `make distcheck` fails.

7 years agorun_tests.sh: patch line endings in the generated file.
Ulya Trofimovich [Sat, 5 Nov 2016 15:24:02 +0000 (15:24 +0000)]
run_tests.sh: patch line endings in the generated file.

Line endings in the generated code depend on the target platform: e.g.,
"\r\n" on Windows vs. "\n" on Linux. However, reference test results are
(currently) generated on Linux and therefore contain "\n" line endings.
So we have to patch line endings in the generated code in order to pass
the tests on Windows.

Testing script did patch line endings in stdout and stderr, but forgot
to patch them in the generated file (it was broken since we started to
use '-o' option for testing). This commit fixes testing script.

It also deletes a couple of tests in which source code contains "\r\n"
instead of "\n". These tests are duplicates of other tests (they were
added by commit bd2875441cae4ab3934bfafcd34728021295b842 supposedly to
test that re2c preserves line endings in source code). They are broken
by current commit and fixing them is probably not worth of the effort.

7 years agoFixed #141 "Tests under Windows".
Ulya Trofimovich [Fri, 29 Apr 2016 07:16:12 +0000 (08:16 +0100)]
Fixed #141 "Tests under Windows".

Thanks to Abs62, who noted that under Windows (in MSYS) tests fail
because '2>"$outc.stderr"' dumps CRLF to file instead of LF
and proposed a fix:
    sed -i 's/\r//g' "$outc.stderr"