‘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!noritnk@kcn.ne.jp
(
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 Norihiro Tanaka <noritnk@kcn.ne.jp>
+
+ 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!noritnk@kcn.ne.jp
+ (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 <bruno@clisp.org>
unistd tests: Fix link error on MSVC.
/* 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;
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))
/* 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. */