summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2016-11-21 16:17:29 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2016-11-21 16:17:31 +0900
commit1108713bd4b4e1353fbffffa9d049fef8a100503 (patch)
treea4a507d11c3f3aa311f1b852f87d4ad71798c651
parente8df6a2524e98ce64b54852e65a79d6bac9bf3d2 (diff)
downloadre2c-1108713bd4b4e1353fbffffa9d049fef8a100503.tar.gz
re2c-1108713bd4b4e1353fbffffa9d049fef8a100503.tar.bz2
re2c-1108713bd4b4e1353fbffffa9d049fef8a100503.zip
Imported Upstream version 0.14.2
Change-Id: I7ac29982120d9d50f26dd97339e23df605444390 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
-rw-r--r--CHANGELOG4
-rw-r--r--actions.cc14
-rw-r--r--bootstrap/re2c.16
-rw-r--r--config_w32.h6
-rw-r--r--configure.ac2
-rwxr-xr-xhtdocs/index.html4
-rw-r--r--test/bug57.c114
-rw-r--r--test/bug57.re27
8 files changed, 166 insertions, 11 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 9494115b..fb1740cf 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+Version 0.14.2 (2015-03-25)
+-----------------------------
+- fixed #57 Wrong result only if another rule is present
+
Version 0.14.1 (2015-02-27)
-----------------------------
- fixed #55 re2c-0.14: re2c -V outputs null byte
diff --git a/actions.cc b/actions.cc
index 24356cf0..60aba798 100644
--- a/actions.cc
+++ b/actions.cc
@@ -278,8 +278,11 @@ RegExp *mkAlt(RegExp *e1, RegExp *e2)
m1 = dynamic_cast<MatchOp*>(a->exp1);
if (m1 != NULL)
{
- m1->ins_access = e1->ins_access;
- a->exp2->ins_access = e1->ins_access;
+ if (e1->ins_access == RegExp::PRIVATE)
+ {
+ m1->ins_access = RegExp::PRIVATE;
+ a->exp2->ins_access = RegExp::PRIVATE;
+ }
e1 = a->exp2;
}
}
@@ -296,8 +299,11 @@ RegExp *mkAlt(RegExp *e1, RegExp *e2)
m2 = dynamic_cast<MatchOp*>(a->exp1);
if (m2 != NULL)
{
- m2->ins_access = e2->ins_access;
- a->exp2->ins_access = e2->ins_access;
+ if (e2->ins_access == RegExp::PRIVATE)
+ {
+ m2->ins_access = RegExp::PRIVATE;
+ a->exp2->ins_access = RegExp::PRIVATE;
+ }
e2 = a->exp2;
}
}
diff --git a/bootstrap/re2c.1 b/bootstrap/re2c.1
index e0b802e5..fa2cd075 100644
--- a/bootstrap/re2c.1
+++ b/bootstrap/re2c.1
@@ -2,12 +2,12 @@
.\" Title: re2c
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.78.0 <http://docbook.sf.net/>
-.\" Date: 02/27/2015
+.\" Date: 03/25/2015
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "RE2C" "1" "02/27/2015" "\ \&" "\ \&"
+.TH "RE2C" "1" "03/25/2015" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -1514,4 +1514,4 @@ skvadrik@gmail\&.com
.RE
.SH "VERSION INFORMATION"
.sp
-This manpage describes \fBre2c\fR, version 0\&.14\&.1, package date 27 Feb 2015\&.
+This manpage describes \fBre2c\fR, version 0\&.14\&.2, package date 25 Mar 2015\&.
diff --git a/config_w32.h b/config_w32.h
index 083a1df2..84aba1ec 100644
--- a/config_w32.h
+++ b/config_w32.h
@@ -59,13 +59,13 @@
#define PACKAGE_NAME "re2c"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "re2c 0.14.1"
+#define PACKAGE_STRING "re2c 0.14.2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "re2c"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.14.1"
+#define PACKAGE_VERSION "0.14.2"
/* The size of a `char', as computed by sizeof. */
#define SIZEOF_CHAR 1
@@ -83,7 +83,7 @@
#define STDC_HEADERS 1
/* Version number of package */
-#define VERSION "0.14.1"
+#define VERSION "0.14.2"
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
diff --git a/configure.ac b/configure.ac
index 01e9e20c..c5eb237f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ([2.57])
-AC_INIT(re2c, 0.14.1, re2c-general@lists.sourceforge.net)
+AC_INIT(re2c, 0.14.2, re2c-general@lists.sourceforge.net)
AM_INIT_AUTOMAKE(re2c, $PACKAGE_VERSION)
AC_CONFIG_SRCDIR(actions.cc)
AM_CONFIG_HEADER(config.h)
diff --git a/htdocs/index.html b/htdocs/index.html
index 89cff569..dc0b3595 100755
--- a/htdocs/index.html
+++ b/htdocs/index.html
@@ -68,6 +68,10 @@
</ul>
<hr />
<h1>Changelog</h1>
+ <h2>2015-03-25: 0.14.2</h2>
+ <ul>
+ <li>fixed #57 Wrong result only if another rule is present</li>
+ </ul>
<h2>2015-02-27: 0.14.1</h2>
<ul>
<li>fixed #55 re2c-0.14: re2c -V outputs null byte</li>
diff --git a/test/bug57.c b/test/bug57.c
new file mode 100644
index 00000000..96f1ce30
--- /dev/null
+++ b/test/bug57.c
@@ -0,0 +1,114 @@
+/* Generated by re2c */
+#line 1 "bug57.re"
+#include <stdio.h>
+
+int scan(const char *p)
+{
+#define YYCTYPE char
+ const char *YYCURSOR = p;
+ const char *YYMARKER;
+
+
+#line 13 "<stdout>"
+{
+ YYCTYPE yych;
+ unsigned int yyaccept = 0;
+
+ yych = *YYCURSOR;
+ switch (yych) {
+ case '\n': goto yy2;
+ case '<': goto yy3;
+ case '\\': goto yy6;
+ case 'a': goto yy5;
+ default: goto yy7;
+ }
+yy2:
+#line 15 "bug57.re"
+ { return YYCURSOR - p; }
+#line 29 "<stdout>"
+yy3:
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ switch (yych) {
+ case '>': goto yy15;
+ case '\\': goto yy14;
+ case 'x':
+ case 'y': goto yy12;
+ default: goto yy4;
+ }
+yy4:
+#line 16 "bug57.re"
+ { return 0; }
+#line 43 "<stdout>"
+yy5:
+ yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy9;
+yy6:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'b': goto yy8;
+ default: goto yy4;
+ }
+yy7:
+ yych = *++YYCURSOR;
+ goto yy4;
+yy8:
+ yyaccept = 1;
+ YYMARKER = ++YYCURSOR;
+ yych = *YYCURSOR;
+yy9:
+ switch (yych) {
+ case '\\': goto yy10;
+ case 'a': goto yy8;
+ default: goto yy2;
+ }
+yy10:
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'b': goto yy8;
+ default: goto yy11;
+ }
+yy11:
+ YYCURSOR = YYMARKER;
+ if (yyaccept == 0) {
+ goto yy4;
+ } else {
+ goto yy2;
+ }
+yy12:
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ switch (yych) {
+ case '>': goto yy15;
+ case '\\': goto yy14;
+ case 'x':
+ case 'y': goto yy12;
+ default: goto yy11;
+ }
+yy14:
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'b': goto yy12;
+ default: goto yy11;
+ }
+yy15:
+ ++YYCURSOR;
+#line 14 "bug57.re"
+ { return YYCURSOR - p; }
+#line 102 "<stdout>"
+}
+#line 17 "bug57.re"
+
+}
+
+int main()
+{
+ const char *str = "aaa\\baaa";
+ int res = scan(str);
+ printf("%d: %s\n", res, str + res);
+ return 0;
+}
+
diff --git a/test/bug57.re b/test/bug57.re
new file mode 100644
index 00000000..f50abac3
--- /dev/null
+++ b/test/bug57.re
@@ -0,0 +1,27 @@
+#include <stdio.h>
+
+int scan(const char *p)
+{
+#define YYCTYPE char
+ const char *YYCURSOR = p;
+ const char *YYMARKER;
+
+/*!re2c
+ re2c:yyfill:enable = 0;
+
+ escaped_char = "\\b";
+
+ [<] ([x] | escaped_char | [y])* [>] { return YYCURSOR - p; }
+ ("a" | escaped_char)* { return YYCURSOR - p; }
+ . { return 0; }
+*/
+}
+
+int main()
+{
+ const char *str = "aaa\\baaa";
+ int res = scan(str);
+ printf("%d: %s\n", res, str + res);
+ return 0;
+}
+