[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/4] dfa: separate parse and compile phase
From: |
Paul Eggert |
Subject: |
[PATCH 1/4] dfa: separate parse and compile phase |
Date: |
Wed, 11 Dec 2019 15:09:59 -0800 |
From: Norihiro Tanaka <address@hidden>
‘dfamust’ must be called after parsing and before tokens are
reordered, but both are executed in the compilation phase.
Token reordering was introduced in Gnulib commit
2018-10-22T15:01:08Z!address@hidden
(5c7a0371823876cca7a1347fa09ca26bbbff0c98).
* lib/dfa.c (dfaparse): Change it to global function.
(dfacomp): If first argument is NULL, skip parse.
* lib/dfa.h: (dfaparse): Add a prototype.
---
ChangeLog | 12 ++++++++++++
lib/dfa.c | 6 ++++--
lib/dfa.h | 3 +++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a5577f7c3..f80f33b38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2019-12-11 Norihiro Tanaka <address@hidden>
+
+ dfa: separate parse and compile phase
+ ‘dfamust’ must be called after parsing and before tokens are
+ reordered, but both are executed in the compilation phase.
+ Token reordering was introduced in Gnulib commit
+ 2018-10-22T15:01:08Z!address@hidden
+ (5c7a0371823876cca7a1347fa09ca26bbbff0c98).
+ * lib/dfa.c (dfaparse): Change it to global function.
+ (dfacomp): If first argument is NULL, skip parse.
+ * lib/dfa.h: (dfaparse): Add a prototype.
+
2019-12-11 Bruno Haible <address@hidden>
unistd tests: Fix link error on MSVC.
diff --git a/lib/dfa.c b/lib/dfa.c
index 329a2092a..1e125b4d2 100644
--- a/lib/dfa.c
+++ b/lib/dfa.c
@@ -1969,7 +1969,7 @@ regexp (struct dfa *dfa)
/* Main entry point for the parser. S is a string to be parsed, len is the
length of the string, so s can include NUL characters. D is a pointer to
the struct dfa to parse into. */
-static void
+void
dfaparse (char const *s, size_t len, struct dfa *d)
{
d->lex.ptr = s;
@@ -3745,7 +3745,9 @@ dfassbuild (struct dfa *d)
void
dfacomp (char const *s, size_t len, struct dfa *d, bool searchflag)
{
- dfaparse (s, len, d);
+ if (s != NULL)
+ dfaparse (s, len, d);
+
dfassbuild (d);
if (dfa_supported (d))
diff --git a/lib/dfa.h b/lib/dfa.h
index 60512e294..221f7d172 100644
--- a/lib/dfa.h
+++ b/lib/dfa.h
@@ -71,6 +71,9 @@ extern struct dfamust *dfamust (struct dfa const *);
/* Free the storage held by the components of a struct dfamust. */
extern void dfamustfree (struct dfamust *);
+/* Parse the given string of given length into the given struct dfa. */
+extern void dfaparse (char const *, size_t, struct dfa *);
+
/* Compile the given string of the given length into the given struct dfa.
Final argument is a flag specifying whether to build a searching or an
exact matcher. */
--
2.23.0
- [PATCH 1/4] dfa: separate parse and compile phase,
Paul Eggert <=
- [PATCH 2/4] dfa: update commentary for previous change, Paul Eggert, 2019/12/11
- [PATCH 3/4] dfa: fix index overflow, Paul Eggert, 2019/12/11
- [PATCH 4/4] dfa: prefer signed integers for internals, Paul Eggert, 2019/12/11
- Re: [PATCH 4/4] dfa: prefer signed integers for internals, Bruno Haible, 2019/12/11
- Re: [PATCH 4/4] dfa: prefer signed integers for internals, Paul Eggert, 2019/12/11
- Re: range types, ptrdiff_t, signed integers for internals, Bruno Haible, 2019/12/12
- Re: range types, ptrdiff_t, signed integers for internals, Paul Eggert, 2019/12/12
- Re: range types, ptrdiff_t, signed integers for internals, Bruno Haible, 2019/12/12