"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "support/dfa.h" between
gawk-5.0.1.tar.xz and gawk-5.1.0.tar.xz

About: GNU awk - pattern scanning and processing language.

dfa.h  (gawk-5.0.1.tar.xz):dfa.h  (gawk-5.1.0.tar.xz)
/* dfa.h - declarations for GNU deterministic regexp compiler /* dfa.h - declarations for GNU deterministic regexp compiler
Copyright (C) 1988, 1998, 2007, 2009-2019 Free Software Foundation, Inc. Copyright (C) 1988, 1998, 2007, 2009-2020 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option) the Free Software Foundation; either version 3, or (at your option)
any later version. any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
skipping to change at line 40 skipping to change at line 40
{ {
bool exact; bool exact;
bool begline; bool begline;
bool endline; bool endline;
char *must; char *must;
}; };
/* The dfa structure. It is completely opaque. */ /* The dfa structure. It is completely opaque. */
struct dfa; struct dfa;
/* Needed when Gnulib is not used. */
#ifndef _GL_ATTRIBUTE_MALLOC
# define _GL_ATTRIBUTE_MALLOC
#endif
/* Entry points. */ /* Entry points. */
/* Allocate a struct dfa. The struct dfa is completely opaque. /* Allocate a struct dfa. The struct dfa is completely opaque.
It should be initialized via dfasyntax or dfacopysyntax before other use.
The returned pointer should be passed directly to free() after The returned pointer should be passed directly to free() after
calling dfafree() on it. */ calling dfafree() on it. */
extern struct dfa *dfaalloc (void) /* _GL_ATTRIBUTE_MALLOC */; extern struct dfa *dfaalloc (void) _GL_ATTRIBUTE_MALLOC;
/* DFA options that can be ORed together, for dfasyntax's 4th arg. */ /* DFA options that can be ORed together, for dfasyntax's 4th arg. */
enum enum
{ {
/* ^ and $ match only the start and end of data, and do not match /* ^ and $ match only the start and end of data, and do not match
end-of-line within data. This is always false for grep, but end-of-line within data. This is always false for grep, but
possibly true for other apps. */ possibly true for other apps. */
DFA_ANCHOR = 1 << 0, DFA_ANCHOR = 1 << 0,
/* '\0' in data is end-of-line, instead of the traditional '\n'. */ /* '\0' in data is end-of-line, instead of the traditional '\n'. */
DFA_EOL_NUL = 1 << 1 DFA_EOL_NUL = 1 << 1
}; };
/* Initialize or reinitialize a DFA. This must be called before /* Initialize or reinitialize a DFA. The arguments are:
any of the routines below. The arguments are:
1. The DFA to operate on. 1. The DFA to operate on.
2. Information about the current locale. 2. Information about the current locale.
3. Syntax bits described in regex.h. 3. Syntax bits described in regex.h.
4. Additional DFA options described above. */ 4. Additional DFA options described above. */
extern void dfasyntax (struct dfa *, struct localeinfo const *, extern void dfasyntax (struct dfa *, struct localeinfo const *,
reg_syntax_t, int); reg_syntax_t, int);
/* Build and return the struct dfamust from the given struct dfa. */ /* Initialize or reinitialize a DFA from an already-initialized DFA. */
extern void dfacopysyntax (struct dfa *, struct dfa const *);
/* Parse the given string of given length into the given struct dfa. */
extern void dfaparse (char const *, ptrdiff_t, struct dfa *);
/* Allocate and return a struct dfamust from a struct dfa that was
initialized by dfaparse and not yet given to dfacomp. */
extern struct dfamust *dfamust (struct dfa const *); extern struct dfamust *dfamust (struct dfa const *);
/* Free the storage held by the components of a struct dfamust. */ /* Free the storage held by the components of a struct dfamust. */
extern void dfamustfree (struct dfamust *); extern void dfamustfree (struct dfamust *);
/* Compile the given string of the given length into the given 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 The last argument says whether to build a searching or an exact matcher.
exact matcher. */ A null first argument means the struct dfa has already been
extern void dfacomp (char const *, size_t, struct dfa *, bool); initialized by dfaparse; the second argument is ignored. */
extern void dfacomp (char const *, ptrdiff_t, struct dfa *, bool);
/* Search through a buffer looking for a match to the given struct dfa. /* Search through a buffer looking for a match to the given struct dfa.
Find the first occurrence of a string matching the regexp in the Find the first occurrence of a string matching the regexp in the
buffer, and the shortest possible version thereof. Return a pointer to buffer, and the shortest possible version thereof. Return a pointer to
the first character after the match, or NULL if none is found. BEGIN the first character after the match, or NULL if none is found. BEGIN
points to the beginning of the buffer, and END points to the first byte points to the beginning of the buffer, and END points to the first byte
after its end. Note however that we store a sentinel byte (usually after its end. Note however that we store a sentinel byte (usually
newline) in *END, so the actual buffer must be one byte longer. newline) in *END, so the actual buffer must be one byte longer.
When ALLOW_NL is true, newlines may appear in the matching string. When ALLOW_NL is true, newlines may appear in the matching string.
If COUNT is non-NULL, increment *COUNT once for each newline processed. If COUNT is non-NULL, increment *COUNT once for each newline processed.
Finally, if BACKREF is non-NULL set *BACKREF to indicate whether we Finally, if BACKREF is non-NULL set *BACKREF to indicate whether we
encountered a back-reference. The caller can use this to decide encountered a back-reference. The caller can use this to decide
whether to fall back on a backtracking matcher. */ whether to fall back on a backtracking matcher. */
extern char *dfaexec (struct dfa *d, char const *begin, char *end, extern char *dfaexec (struct dfa *d, char const *begin, char *end,
bool allow_nl, size_t *count, bool *backref); bool allow_nl, ptrdiff_t *count, bool *backref);
/* Return a superset for D. The superset matches everything that D /* Return a superset for D. The superset matches everything that D
matches, along with some other strings (though the latter should be matches, along with some other strings (though the latter should be
rare, for efficiency reasons). Return a null pointer if no useful rare, for efficiency reasons). Return a null pointer if no useful
superset is available. */ superset is available. */
extern struct dfa *dfasuperset (struct dfa const *d) _GL_ATTRIBUTE_PURE; extern struct dfa *dfasuperset (struct dfa const *d) _GL_ATTRIBUTE_PURE;
/* The DFA is likely to be fast. */ /* The DFA is likely to be fast. */
extern bool dfaisfast (struct dfa const *) _GL_ATTRIBUTE_PURE; extern bool dfaisfast (struct dfa const *) _GL_ATTRIBUTE_PURE;
/* Copy the syntax settings from one dfa instance to another.
Saves considerable computation time if compiling many regular expressions
based on the same setting. */
extern void dfacopysyntax (struct dfa *to, const struct dfa *from);
/* Free the storage held by the components of a struct dfa. */ /* Free the storage held by the components of a struct dfa. */
extern void dfafree (struct dfa *); extern void dfafree (struct dfa *);
/* Error handling. */ /* Error handling. */
/* dfawarn() is called by the regexp routines whenever a regex is compiled /* dfawarn() is called by the regexp routines whenever a regex is compiled
that likely doesn't do what the user wanted. It takes a single that likely doesn't do what the user wanted. It takes a single
argument, a NUL-terminated string describing the situation. The user argument, a NUL-terminated string describing the situation. The user
must supply a dfawarn. */ must supply a dfawarn. */
extern void dfawarn (const char *); extern void dfawarn (const char *);
 End of changes. 9 change blocks. 
14 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)