]> granicus.if.org Git - re2c/log
re2c
7 years agosync --help output w/ manpage 177/head
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 agomore manpage fixes 175/head
Petr Skocik [Tue, 4 Apr 2017 13:08:00 +0000 (15:08 +0200)]
more manpage fixes

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

8 years agoFix #163
Paulo Custodio [Fri, 11 Nov 2016 21:32:34 +0000 (21:32 +0000)]
Fix #163

The previous fix to #163 (a51c7c8) was not working properly, simplified and fixed.

8 years agoConvert all line endings to LF before writing the generated code to file.
Ulya Trofimovich [Fri, 11 Nov 2016 13:54:33 +0000 (13:54 +0000)]
Convert all line endings to LF before writing the generated code to file.

This commit should fix bug #163 reported by pauloscustodio:
    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.

8 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

8 years agoOpen text files with "wb" causes issues on Windows 161/head
Paulo Custodio [Sat, 5 Nov 2016 13:00:08 +0000 (13:00 +0000)]
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).

8 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.

8 years agoInconsistent forward declaration of struct/class vs definition 159/head
Paulo Custodio [Sat, 5 Nov 2016 00:24:02 +0000 (00:24 +0000)]
Inconsistent forward declaration of struct/class vs definition

structs State and OutputFile forward declared as class.
classes Range, RegExp and RuleOp forward declared as struct.

Fixed forward declarations.

8 years agoFix #156
Paulo Custodio [Wed, 2 Nov 2016 23:57:27 +0000 (23:57 +0000)]
Fix #156

Rename INFINITY to INFINITE so that it does not clash with infinity from
the MS C++ library.

8 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.

8 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.

8 years agoFixed bug #142 "segvault with null terminated input"
Ulya Trofimovich [Wed, 11 May 2016 14:17:17 +0000 (15:17 +0100)]
Fixed bug #142 "segvault with null terminated input"

Steps to reproduce:
    $ echo -ne "&\x00" > A
    $ re2c A
    Segmentation fault

Analyses: when re2c finds NULL in the input file, it checks for the
end of input; if indeed it has reached the end of input, it stops.
Otherwise, it's just some NULL byte in the middle of input; it should
be handled like any other character.

The first case (NULL as end of input) was handled correctly, but
in the second case (NULL in the middle of input) re2c crashed:
someone forgot to put an appropriate 'goto' statement, which caused
completely ad-hoc control flow in lexer.

8 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"

8 years agorun_tests.sh: don't crash on absolute filepaths in test names.
Ulya Trofimovich [Wed, 24 Feb 2016 16:57:54 +0000 (16:57 +0000)]
run_tests.sh: don't crash on absolute filepaths in test names.

This patch fixes bug #137 "run_tests.sh fail when running configure
script with absolute path".

The fix: copy all test files into temporary build directory (which
is addressed by a relative filepath) and keep messing with relative
filepaths.

8 years agorun_tests.sh: avoid another '+=' in bash arrays (compatibility with old bash).
Ulya Trofimovich [Thu, 28 Jan 2016 08:54:49 +0000 (08:54 +0000)]
run_tests.sh: avoid another '+=' in bash arrays (compatibility with old bash).

See #135 "In installation "make check" give syntax error".

8 years agorun_tests.sh: avoid '+=' in bash arrays (compatibility with old bash).
Ulya Trofimovich [Wed, 27 Jan 2016 19:53:39 +0000 (19:53 +0000)]
run_tests.sh: avoid '+=' in bash arrays (compatibility with old bash).

See #135 "In installation "make check" give syntax error".

8 years agoadd basic support for travis-ci.org integration 136/head
Sergei Trofimovich [Sun, 7 Feb 2016 11:14:55 +0000 (11:14 +0000)]
add basic support for travis-ci.org integration

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
8 years agore2c/Makefile.am: use RST2MAN variable instead of hardcoded rst2man.py
Sergei Trofimovich [Sun, 7 Feb 2016 11:56:07 +0000 (11:56 +0000)]
re2c/Makefile.am: use RST2MAN variable instead of hardcoded rst2man.py

Ubuntu installs docutils binaries without .py prefix.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
8 years agoRelease 0.16. 0.16
Ulya Trofimovich [Thu, 21 Jan 2016 10:48:30 +0000 (10:48 +0000)]
Release 0.16.

8 years agoMerged branch 'devel'.
Ulya Trofimovich [Thu, 21 Jan 2016 10:45:21 +0000 (10:45 +0000)]
Merged branch 'devel'.

8 years agoUpdated CHANGELOG (preparing release 0.16).
Ulya Trofimovich [Thu, 21 Jan 2016 10:08:56 +0000 (10:08 +0000)]
Updated CHANGELOG (preparing release 0.16).

8 years agoMakefile.am: fixed path to header.
Ulya Trofimovich [Wed, 20 Jan 2016 08:41:04 +0000 (08:41 +0000)]
Makefile.am: fixed path to header.

8 years agoRemoved forgotten 'typename' kewyword in non-template code.
Ulya Trofimovich [Wed, 20 Jan 2016 08:07:33 +0000 (08:07 +0000)]
Removed forgotten 'typename' kewyword in non-template code.

8 years agoFixed includes (applied some of 'include-what-you-use' suggestions).
Ulya Trofimovich [Tue, 19 Jan 2016 18:56:07 +0000 (18:56 +0000)]
Fixed includes (applied some of 'include-what-you-use' suggestions).

8 years agoApplied #131: "Use bash-specific '[[' builtin".
Ulya Trofimovich [Sun, 17 Jan 2016 10:15:09 +0000 (10:15 +0000)]
Applied #131: "Use bash-specific '[[' builtin".

8 years agoStabilized the list of shadowing rules reported by [-Wunreachable-rules].
Ulya Trofimovich [Sat, 16 Jan 2016 23:07:17 +0000 (23:07 +0000)]
Stabilized the list of shadowing rules reported by [-Wunreachable-rules].

Before this commit, the list of rules depended on the order of NFA states
in each DFA state under construction (which is simply a matter of ordering
pointers to heap: the order can be different).

Now all rules for each DFA state are collected and the final choice of
rule is delayed until DFA is constructed, so the order of NFA states
no longer matters.

8 years agoMerged two small headers into one.
Ulya Trofimovich [Fri, 15 Jan 2016 10:07:20 +0000 (10:07 +0000)]
Merged two small headers into one.

8 years agoCompact DFA states after minimization.
Ulya Trofimovich [Wed, 13 Jan 2016 09:12:14 +0000 (09:12 +0000)]
Compact DFA states after minimization.

8 years agoReplaced class method with function.
Ulya Trofimovich [Wed, 13 Jan 2016 08:44:58 +0000 (08:44 +0000)]
Replaced class method with function.

8 years agoKeep data relevant to DFA determinization outsde of DFA states.
Ulya Trofimovich [Wed, 13 Jan 2016 08:14:38 +0000 (08:14 +0000)]
Keep data relevant to DFA determinization outsde of DFA states.

8 years agoMoved YYFILL points calculation to the earlier stage of DFA construction.
Ulya Trofimovich [Mon, 11 Jan 2016 15:01:05 +0000 (15:01 +0000)]
Moved YYFILL points calculation to the earlier stage of DFA construction.

No serious changes intended (mostly cleanup and comments).

The underlying algorithm for finding strongly connected components
(SCC) remains the same: it's a slightly modified Tarjan's algorithm.

We now mark non-YYFILL states by setting YYFILL argument to zero,
which is only logical: why would anyone call YYFILL to provide zero
characters. In fact, re2c didn't generate 'YYFILL(0)' call itself,
but some remnants of YYFILL did remain (which caused changes in tests).

8 years agoSerialize '--skeleton' generated data in little-endian.
Ulya Trofimovich [Thu, 7 Jan 2016 14:24:52 +0000 (14:24 +0000)]
Serialize '--skeleton' generated data in little-endian.

This commit fixes bug #132 "test failure on big endian archs with 0.15.3".

Tests failed because re2c with '--skeleton' option used host endianness
when serializing binary data to file. Expected test result was generated
on little-endian arch, while actual test was run on big-endian arch.

Only three tests failed (out of ~40 tests that are always run with
'--skeleton'), because in most cases data unit is 1 byte and endianness
doesn't matter.

The fix: re2c now converts binary data from host-endian to little-endian
before dumping it to file. Skeleton programs convert data back from
little-endian to host-endian when reading it from file (iff data unit
size is greater than 1 byte).

8 years agoSerialize '--skeleton' generated data in little-endian.
Ulya Trofimovich [Thu, 7 Jan 2016 14:24:52 +0000 (14:24 +0000)]
Serialize '--skeleton' generated data in little-endian.

This commit fixes bug #132 "test failure on big endian archs with 0.15.3".

Tests failed because re2c with '--skeleton' option used host endianness
when serializing binary data to file. Expected test result was generated
on little-endian arch, while actual test was run on big-endian arch.

Only three tests failed (out of ~40 tests that are always run with
'--skeleton'), because in most cases data unit is 1 byte and endianness
doesn't matter.

The fix: re2c now converts binary data from host-endian to little-endian
before dumping it to file. Skeleton programs convert data back from
little-endian to host-endian when reading it from file (iff data unit
size is greater than 1 byte).

8 years agoconfigure.ac: fixed error message.
Ulya Trofimovich [Wed, 6 Jan 2016 10:11:39 +0000 (10:11 +0000)]
configure.ac: fixed error message.

Message should report 'rst2man' as well as 'rst2man.py'.

8 years agoconfigure.ac: check for 'rst2man' as well as 'rst2man.py'.
Ulya Trofimovich [Wed, 6 Jan 2016 09:21:57 +0000 (09:21 +0000)]
configure.ac: check for 'rst2man' as well as 'rst2man.py'.

Fixes bug #133 "rst2man.py depreciated in RHEL7".

8 years agoExplicitely handle default state as special case during DFA construction.
Ulya Trofimovich [Tue, 5 Jan 2016 17:15:37 +0000 (17:15 +0000)]
Explicitely handle default state as special case during DFA construction.

8 years agoCheck accumulated parameter before entering recursion.
Ulya Trofimovich [Sat, 2 Jan 2016 17:27:45 +0000 (17:27 +0000)]
Check accumulated parameter before entering recursion.

8 years agoRenamed files and function.
Ulya Trofimovich [Fri, 1 Jan 2016 10:11:56 +0000 (10:11 +0000)]
Renamed files and function.

8 years agoMoved source subdirectory.
Ulya Trofimovich [Thu, 31 Dec 2015 22:06:13 +0000 (22:06 +0000)]
Moved source subdirectory.

8 years agoMoved source files to a proper subdirectory.
Ulya Trofimovich [Thu, 31 Dec 2015 21:52:54 +0000 (21:52 +0000)]
Moved source files to a proper subdirectory.

8 years agoRemoved obsolete code deduplication mechanism.
Ulya Trofimovich [Thu, 31 Dec 2015 21:17:32 +0000 (21:17 +0000)]
Removed obsolete code deduplication mechanism.

This mechanism was tricky and fragile; it cost us a most unfortunate
bug in PHP lexer: https://bugs.gentoo.org/show_bug.cgi?id=518904
(and a couple of other bugs).

Now that re2c does DFA minimization this is no longer needed. Hoooray!

The updated test changed because skeleton is constructed prior to
DFA minimization.

8 years agoRemoved obsolete comments.
Ulya Trofimovich [Thu, 31 Dec 2015 20:56:41 +0000 (20:56 +0000)]
Removed obsolete comments.

8 years agoAdded test for bug #128 "very slow DFA construction (resulting in a very large DFA)".
Ulya Trofimovich [Thu, 31 Dec 2015 20:17:16 +0000 (20:17 +0000)]
Added test for bug #128 "very slow DFA construction (resulting in a very large DFA)".

After minimization the resulting DFA is much smaller:
    /*!re2c
        [ac]{0,14} [a] [ac]{0,14} {}
    */

Was:
    $ time re2c slow.re > slow.c && stat -c '%s' slow.c

    real    1m54.837s
    user    1m54.733s
    sys     0m0.120s
    5627102

Now:
    $ time ./re2c slow.re > slow.c && stat -c '%s' slow.c

    real    0m0.732s
    user    0m0.684s
    sys     0m0.048s
    15078

8 years agoAdded DFA minimization and option '--dfa-minimization <table | moore>'.
Ulya Trofimovich [Thu, 31 Dec 2015 15:35:30 +0000 (15:35 +0000)]
Added DFA minimization and option '--dfa-minimization <table | moore>'.

Test results changed a lot; it is next to impossible to verify them
by hand. I therefore implemented two different minimization algorithms:
    - "table filling" algorithm (simple and inefficient)
    - Moore's algorithm (not so simple and efficient enough)
They produce identical minimized DFA (up to states relabelling), thus
giving some confidence in that the resulting DFA is correct.

I also checked the results with '--skeleton': re2c constructs
skeleton prior to reordering and minimization, therefore
skeleton-generated data is free of (potential) minimization errors.

8 years agoSplit DFA intermediate representation in two parts: DFA and ADFA.
Ulya Trofimovich [Wed, 30 Dec 2015 20:52:33 +0000 (20:52 +0000)]
Split DFA intermediate representation in two parts: DFA and ADFA.

ADFA stands for 'action DFA', that is, DFA with actions.

During DFA construction (aka NFA determinization) it is convenient
to represent DFA states as indexes to array of states.
Later on, while binding actions, it is more convanient to store
states in a linked list.

9 years agoMerge branch 'master' of git://github.com/jcfp/re2c
Ulya Trofimovich [Mon, 21 Dec 2015 14:29:20 +0000 (14:29 +0000)]
Merge branch 'master' of git://github.com/jcfp/re2c

*  missed some occurrences...

9 years agomissed some occurrences... 130/head
jcfp [Mon, 21 Dec 2015 13:25:49 +0000 (14:25 +0100)]
missed some occurrences...

9 years agoMerge branch 'master' into devel
Ulya Trofimovich [Mon, 21 Dec 2015 11:51:47 +0000 (11:51 +0000)]
Merge branch 'master' into devel

9 years agoMerge branch 'jcfp-master'
Ulya Trofimovich [Mon, 21 Dec 2015 11:46:46 +0000 (11:46 +0000)]
Merge branch 'jcfp-master'

9 years agotyp0 fixes 129/head
jcfp [Mon, 21 Dec 2015 10:57:59 +0000 (11:57 +0100)]
typ0 fixes

9 years agoKeep DFA states in a hash map (to speedup lookup fo an identical state).
Ulya Trofimovich [Sat, 19 Dec 2015 17:17:00 +0000 (17:17 +0000)]
Keep DFA states in a hash map (to speedup lookup fo an identical state).

This partially fixes bug #128: "very slow DFA construction (resulting
in a very large DFA)". DFA construction is no longer slow, but the
resulting DFA is still too large and needs to be minimized.

9 years agoDFA construction: epsilon-closure of NFA states: pick only kernel states.
Ulya Trofimovich [Fri, 18 Dec 2015 21:48:27 +0000 (21:48 +0000)]
DFA construction: epsilon-closure of NFA states: pick only kernel states.

9 years agoChanged bytecode intermediate representation to a simpler NFA representation.
Ulya Trofimovich [Fri, 18 Dec 2015 12:52:17 +0000 (12:52 +0000)]
Changed bytecode intermediate representation to a simpler NFA representation.

9 years agoBase '+' (one or more repetitions) on '*' (zero or more repetitions).
Ulya Trofimovich [Tue, 15 Dec 2015 12:44:47 +0000 (12:44 +0000)]
Base '+' (one or more repetitions) on '*' (zero or more repetitions).

Kleene star '*' (aka iteration, repetition, etc.) is a primitive
operation in regular expressions.

For some reason re2c used '+' as a primitive operation and expressed
'*' in terms of '+'. It is inconvenient, because all algorithms
described in literature are based on '*'.

Because we now express 'a+' as 'a* a', we have to set 'PRIVATE' attribute
on 'a': otherwize 'a' gets shared between the two occurences which causes
complex bugs.

Expressing 'a+' in a more intuitive way as 'a a*' rather than 'a* a'
causes the generated code to duplicate certain states. The generated code
is (supposedly correct), but re2c fails to deduplicate these states.
We therefore prefer 'a* a' expansion, which results in exactly the same
code as before.

9 years agoNo need to preserve special order of states while building DFA (thanks to states...
Ulya Trofimovich [Mon, 14 Dec 2015 14:33:21 +0000 (14:33 +0000)]
No need to preserve special order of states while building DFA (thanks to states reordering).

9 years agoDropped the difference between left and right default rule (thanks to states reordering).
Ulya Trofimovich [Mon, 14 Dec 2015 14:21:13 +0000 (14:21 +0000)]
Dropped the difference between left and right default rule (thanks to states reordering).

Bootstrap lexer changed a lot: this change is caused by commit
a4c192f27ae8806e67a8ff311eeff53d74dacb71: "Reordered states in DFA.".
Changes in parser by this commit triggered lexer regeneration.

9 years agoReordered states in DFA.
Ulya Trofimovich [Mon, 14 Dec 2015 13:59:34 +0000 (13:59 +0000)]
Reordered states in DFA.

9 years agoFixed bug #127: "code generation error with wide chars and bitmaps (omitted 'goto...
Ulya Trofimovich [Wed, 9 Dec 2015 11:22:08 +0000 (11:22 +0000)]
Fixed bug #127: "code generation error with wide chars and bitmaps (omitted 'goto' statement)".

Minimal test case:
    /*!re2c
        [^a]+ {}
        [a]   {}
    */

Catched with skeleton:
    $ re2c -W -ubi err.re -S -o err.c && gcc err.c -o err && ./err
    error: lex_line4: at position 294 (iteration 98):
            expected: match length 2, rule 0
            actual:   match length 1, rule 1

9 years agoSimplified handling of character ranges in DFA construction algorithm.
Ulya Trofimovich [Sat, 5 Dec 2015 22:39:12 +0000 (22:39 +0000)]
Simplified handling of character ranges in DFA construction algorithm.

Now disjoint character ranges in bytecode are represented using
range index rather than range lower bound (as it used to be).

9 years agoOptimized charset representation.
Ulya Trofimovich [Fri, 4 Dec 2015 12:28:17 +0000 (12:28 +0000)]
Optimized charset representation.

re2c used a complex and slow algorithm to split charset into
disjoint character ranges. This commit replaces old algorithm with
new (much simpler and quicker).

re2c test suite now runs 2x faster due to speedup in Unicode tests.

9 years agoRelease 0.15.3. 0.15.3
Ulya Trofimovich [Wed, 2 Dec 2015 12:11:01 +0000 (12:11 +0000)]
Release 0.15.3.

9 years agoPrepare release 0.15.3: updated CHANGELOG.
Ulya Trofimovich [Tue, 1 Dec 2015 17:49:06 +0000 (17:49 +0000)]
Prepare release 0.15.3: updated CHANGELOG.

9 years agoAdded description of '--no-version' option to help and manpage.
Ulya Trofimovich [Tue, 1 Dec 2015 17:45:59 +0000 (17:45 +0000)]
Added description of '--no-version' option to help and manpage.

9 years agoFixed '#include's (appied most of 'include-what-you-use' suggestions).
Ulya Trofimovich [Tue, 1 Dec 2015 16:14:49 +0000 (16:14 +0000)]
Fixed '#include's (appied most of 'include-what-you-use' suggestions).

The worst dependency which 'include-what-you-use' fails to see
(and rightly so) is 'src/parse/lex.re' -> 'src/parse/parser.h'.
This dependency is caused by '#include "y.tab.h"' in 'src/parse/lex.re'.

Another ubiquitos issue is 'src/util/c99_stdint.h' ('include-what-you-use'
suggests to substitute it with '<stdint.h>').

And a couple of other dependencies that 'include-what-you-use' fails to see.

9 years agoPrefixed all tokens with 'TOKEN_'.
Ulya Trofimovich [Tue, 1 Dec 2015 12:59:54 +0000 (12:59 +0000)]
Prefixed all tokens with 'TOKEN_'.

Inspired by commit commit c172f266b4b611cb69bde3b46e4be350819cde73.

9 years agoMakefile.am: use 'AM_V_GEN' prefix to report custom rules.
Ulya Trofimovich [Tue, 1 Dec 2015 12:42:42 +0000 (12:42 +0000)]
Makefile.am: use 'AM_V_GEN' prefix to report custom rules.

9 years agorun_tests.sh (with '--skeleton'): clarified message, use generic CC rathen than ...
Ulya Trofimovich [Tue, 1 Dec 2015 12:10:49 +0000 (12:10 +0000)]
run_tests.sh (with '--skeleton'): clarified message, use generic CC rathen than 'gcc'.

9 years agoRenamed tests that contained uppercase letters in file extension.
Ulya Trofimovich [Mon, 30 Nov 2015 22:50:23 +0000 (22:50 +0000)]
Renamed tests that contained uppercase letters in file extension.

We use file extensions to encode re2c options.
Some (short) options are uppercase letters: e.g. '-D', '-F', '-S'.
There also short options for the same lowercase letters: '-d', '-f', '-s'.
This can cause filename collisions on platforms with case-insensitive
file extensions (e.g. Windows and OS X).

See bud #125: "[OS X] git reports changes not staged for commit
in newly cloned repository".

Fix: use long versions for options that uppercase options.
Disallowed uppercase options in 'run_tests.sh'.

9 years agoconfigure.ac: suppress some warnings with '-Weverything'.
Ulya Trofimovich [Mon, 30 Nov 2015 15:22:13 +0000 (15:22 +0000)]
configure.ac: suppress some warnings with '-Weverything'.

9 years ago'-Wundefined-control-flow': fixed patterns ordering, reduced memory consumption.
Ulya Trofimovich [Mon, 30 Nov 2015 12:12:44 +0000 (12:12 +0000)]
'-Wundefined-control-flow': fixed patterns ordering, reduced memory consumption.

The problem with pattern ordering first emerged on FreeBSD-10.2
(I was able to reproduce it with 'CXXFLAGS=-fsanitize=address').
Some tests failed because patterns reported by '-Wundefined-control-flow'
were sorted in different order than expected. This is because
patterns ordering was inconsistent: patterns were compared by length,
(it doesn't work for patterns of equal length). Now first ordering
criterion is length, and second criterion is lexicographical order.

This commit reduces the amount of memory consumed by '-Wundefined-control-flow':
re2c no longer allocates vectors on stack while deep-first-searching skeleton.

This commit also reduces the limit of memory for '-Wundefined-control-flow'
(64Mb edges -> 1Kb edges). Real-world programs rarely need that much.
The limit was so high to acommodate some few artificial tests (with lower
limit these tests cannot find shortest patterns).

This commit also removes the upper bound for the number of faulty patterns
reported by '-Wundefined-control-flow'. This bound was needed by the
artificial tests mentioned above: they produce lots of patterns.
Now these tests are limited with 1Kb of edges anyway.

Note that 1Kb limit is checked after each new pattern is added, so that
at least one pattern will fit in (even if it takes more than 1Kb).

9 years agoRemoved one particularly fat test from test collection.
Ulya Trofimovich [Wed, 25 Nov 2015 07:04:32 +0000 (07:04 +0000)]
Removed one particularly fat test from test collection.

9 years agoSubstitute template class with non-template, as only one specialization is used.
Ulya Trofimovich [Wed, 25 Nov 2015 06:49:29 +0000 (06:49 +0000)]
Substitute template class with non-template, as only one specialization is used.

9 years agoSkeleton data generation: suffix should be multipath as well as prefix.
Ulya Trofimovich [Tue, 24 Nov 2015 17:51:25 +0000 (17:51 +0000)]
Skeleton data generation: suffix should be multipath as well as prefix.

Prefix of current path under construction is a multipath, because prefix
arcs have not been covered yet. Suffix can be a simple path (that is, a
multipath of width 1), because all alternative suffix arcs have already
been covered.

prefix       suffix
_________   _________
...      \ /
--------- o
_________/

But nothing prevents us from alternating suffix arcs also, as long as
suffix remains a single multipath:

_________   _________
...      \ / ...
--------- o ---------
_________/ \_________

The resulting path's width is the maximum of prefix ans suffix width
(hence the growth in size of those tests in which suffix is wider
than prefix), but it only makes a small difference. And the generated
paths are more "variable".

9 years agoSkeleton data generation: cover all edges in 1-byte range (not only range bounds).
Ulya Trofimovich [Tue, 24 Nov 2015 16:36:14 +0000 (16:36 +0000)]
Skeleton data generation: cover all edges in 1-byte range (not only range bounds).

If code units occupy 1 byte, then the generated path cover covers
*all* edges in the original DFA. If the size of code unit exceeds 1 byte,
then only some ~0x100 (or less) range values will be chosen
(including range bounds).

9 years agoSkeleton data generation: dropped exponential algorithm, always use path cover.
Ulya Trofimovich [Tue, 24 Nov 2015 16:09:15 +0000 (16:09 +0000)]
Skeleton data generation: dropped exponential algorithm, always use path cover.

9 years agoRemoved obsolete '__STDC_LIMIT_MACROS' and '__STDC_CONSTANT_MACROS' defines.
Ulya Trofimovich [Sun, 29 Nov 2015 11:38:04 +0000 (11:38 +0000)]
Removed obsolete '__STDC_LIMIT_MACROS' and '__STDC_CONSTANT_MACROS' defines.

These defines were necessary to enable numeric limits definitions
(such as 'UINT32_MAX') in our local version of 'stdint.h' (which is
used on platforms that don't have system header 'stdint.h').

As noted by commit b237daed2095c1e138761fb94a01d53ba2c80c95, this
workaround doesn't work on FreeBSD, so re2c now uses 'numeric_limits.h'.

9 years agoFixed [-Wconversion] warning.
Ulya Trofimovich [Sun, 29 Nov 2015 11:24:48 +0000 (11:24 +0000)]
Fixed [-Wconversion] warning.

Warning was introduced in commit b237daed2095c1e138761fb94a01d53ba2c80c95:
compiler fails to recognise (or deliberately choses not to recognize)
'std::numeric_limits<...>::max()' as a special constant.

9 years agorun_tests.sh: use '--no-version --no-generation-date' instead of sed hack.
Ulya Trofimovich [Sun, 29 Nov 2015 11:04:56 +0000 (11:04 +0000)]
run_tests.sh: use '--no-version --no-generation-date' instead of sed hack.

These options make re2c omit version and date info and thus produce
stable test results.

9 years agoAdded option '--no-version' that omits version in fingerprint.
Ulya Trofimovich [Sun, 29 Nov 2015 10:57:47 +0000 (10:57 +0000)]
Added option '--no-version' that omits version in fingerprint.

9 years agoGet rid of UINT32_MAX and friends 124/head
Sergei Trofimovich [Sat, 28 Nov 2015 18:11:58 +0000 (18:11 +0000)]
Get rid of UINT32_MAX and friends

UINT32_MAX is conditionally defined only
for C compiler on FreeBSD but not for C++,

Stop using __STDC_LIMIT_MACROS workaround
as it does not work on FreeBSD.

Use std::numeric_limits<> from C++98 instead.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
9 years agoFixed crashes of 'ostream& operator<< (ostream& os, const char* s)' on NULL.
Ulya Trofimovich [Sat, 28 Nov 2015 17:31:56 +0000 (17:31 +0000)]
Fixed crashes of 'ostream& operator<< (ostream& os, const char* s)' on NULL.

Crashes observed on platforms OS X (clang-7.0.0) and FreeBSD-10.2 (clang-3.4).
First reported in bug #122 "clang does not compile re2c 0.15.x".

What caused NULL passed to 'operator <<': re2c always generates content of
header file (regardless of '-t --type-header' option), but the content is
dumped to file (and header filename initialized to non-NULL) only if the
option was enabled.

Fix: always initialize header filename to non-NULL string.

9 years agorun_tests.sh: use '/usr/bin/env bash' to locate bash.
Ulya Trofimovich [Sat, 28 Nov 2015 15:44:04 +0000 (15:44 +0000)]
run_tests.sh: use '/usr/bin/env bash' to locate bash.

9 years agoMakefile.am: use '=' instead of '==' to compare strings.
Ulya Trofimovich [Sat, 28 Nov 2015 15:39:56 +0000 (15:39 +0000)]
Makefile.am: use '=' instead of '==' to compare strings.

'==' appears to be a bash feature.

9 years agoDon't use overloaded constructors with integral types.
Ulya Trofimovich [Sat, 28 Nov 2015 11:36:41 +0000 (11:36 +0000)]
Don't use overloaded constructors with integral types.

This causes ambiguity in overload resolution on OS X:

    src/codegen/skeleton/generate_data.cc:308:30: error: ambiguous conversion for functional-style cast from 'const size_t' (aka 'const unsigned long') to 'Node::covers_t'
          (aka 'u32lim_t<1024 * 1024 * 1024>')
            const Node::covers_t size = Node::covers_t (len) * Node::covers_t (count);
                                        ^~~~~~~~~~~~~~~~~~~
    ./src/util/u32lim.h:20:11: note: candidate constructor
            explicit u32lim_t (uint32_t x)
                     ^
    ./src/util/u32lim.h:23:11: note: candidate constructor
            explicit u32lim_t (uint64_t x)

Use static constructor-like methods with expliit names.

9 years agoFix "CODE" symbol collision on OS X (see #122)
Oleksii Taran [Sat, 28 Nov 2015 04:08:09 +0000 (20:08 -0800)]
Fix "CODE" symbol collision on OS X (see #122)

On OS X bison generates token enums as CPP macro
constants (y.tab.h):
    #define CODE 260
while on my box it's
   enum yytokentype {
     ...
     CODE = 260,
     ...
   };

That #define causes symbol collision as:

    ../src/parse/lex.re:169:38: error: expected unqualified-id
                                            else if (opts->target == opt_t::CODE)
                                                                            ^
    src/parse/y.tab.h:58:14: note: expanded from macro 'CODE'
    #define CODE 260

Renamed enum entry to TOKEN_CODE.

9 years agoAllowed chaining for all 'OutputFile' methods; renamed them in a uniform way.
Ulya Trofimovich [Fri, 27 Nov 2015 14:29:16 +0000 (14:29 +0000)]
Allowed chaining for all 'OutputFile' methods; renamed them in a uniform way.

9 years agoUse local re2c (in '$(top_bulddir)') rather than system re2c for 'make bootstrap'.
Ulya Trofimovich [Fri, 27 Nov 2015 13:58:29 +0000 (13:58 +0000)]
Use local re2c (in '$(top_bulddir)') rather than system re2c for 'make bootstrap'.

Correct behaviour was broken by commit 38f526d04415adb7b5e6bca228fc26409833f5c3.

9 years agoDon't use 'operator <<' overloads with integral types: resolution is platform-dependent.
Ulya Trofimovich [Fri, 27 Nov 2015 13:41:42 +0000 (13:41 +0000)]
Don't use 'operator <<' overloads with integral types: resolution is platform-dependent.

See bug #122 "clang does not compile re2c 0.15.x".

Example of error on Mac OS X:
    src/codegen/emit_dfa.cc:250:65: error: use of overloaded operator '<<' is ambiguous (with operand types 're2c::OutputFile' and 'const size_t'
          (aka 'const unsigned long'))
            o << indent(ind++) << "static void *" << opts->yyctable << "[" << conds << "] = {\n";
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~
    ./src/codegen/output.h:84:22: note: candidate function
            friend OutputFile & operator << (OutputFile & o, char c);
                                ^
    ./src/codegen/output.h:85:22: note: candidate function
            friend OutputFile & operator << (OutputFile & o, uint32_t n);
                                ^
    ./src/codegen/output.h:86:22: note: candidate function
            friend OutputFile & operator << (OutputFile & o, uint64_t n);
                            ^

On OS X 'size_t' is neither 'uint32_t' nor 'uint64_t', resolution is therefore ambiguous.

9 years agoRelease 0.15.2. 0.15.2
Ulya Trofimovich [Mon, 23 Nov 2015 21:20:12 +0000 (21:20 +0000)]
Release 0.15.2.

9 years agoPrepare release 0-15.2: updated CHANGELOG.
Ulya Trofimovich [Mon, 23 Nov 2015 21:15:38 +0000 (21:15 +0000)]
Prepare release 0-15.2: updated CHANGELOG.

9 years agoMakefile.am: lexer dependends on bison-generated parser; fixed rule order.
Ulya Trofimovich [Mon, 23 Nov 2015 21:11:19 +0000 (21:11 +0000)]
Makefile.am: lexer dependends on bison-generated parser; fixed rule order.

9 years agoRelease 0.15.1. 0.15.1
Ulya Trofimovich [Sun, 22 Nov 2015 21:03:29 +0000 (21:03 +0000)]
Release 0.15.1.

9 years agoPrepare release 0.15.1: updated CHANGELOG.
Ulya Trofimovich [Sun, 22 Nov 2015 20:59:29 +0000 (20:59 +0000)]
Prepare release 0.15.1: updated CHANGELOG.

9 years agorun_tests.sh: fix the order of files in test results.
Ulya Trofimovich [Sun, 22 Nov 2015 20:55:04 +0000 (20:55 +0000)]
run_tests.sh: fix the order of files in test results.

'sort' behavior depends on current locale; set 'LC_ALL=C LANG=C'
before doing locale-sensitive things. Updated test results.

9 years agorelease.sh: don't forget to push tags.
Ulya Trofimovich [Sun, 22 Nov 2015 20:50:15 +0000 (20:50 +0000)]
release.sh: don't forget to push tags.

9 years agoRelease 0.15. 0.15
Ulya Trofimovich [Sun, 22 Nov 2015 19:53:04 +0000 (19:53 +0000)]
Release 0.15.

9 years agoPrepare release 0.15: updated release instructions.
Ulya Trofimovich [Sun, 22 Nov 2015 19:48:37 +0000 (19:48 +0000)]
Prepare release 0.15: updated release instructions.

9 years agoPrepare release 0.15: updated CHANGELOG.
Ulya Trofimovich [Sun, 22 Nov 2015 19:46:45 +0000 (19:46 +0000)]
Prepare release 0.15: updated CHANGELOG.

9 years agoUse 'rst2man.py' to build manpage; updated manpage.
Ulya Trofimovich [Sun, 22 Nov 2015 19:42:21 +0000 (19:42 +0000)]
Use 'rst2man.py' to build manpage; updated manpage.