2021-01-12 21:04:43 -08:00
|
|
|
//
|
2021-01-15 19:32:37 -08:00
|
|
|
// pattern.h - Header file for BP pattern compilation.
|
2021-01-12 21:04:43 -08:00
|
|
|
//
|
2021-01-15 19:32:37 -08:00
|
|
|
#ifndef PATTERN__H
|
|
|
|
#define PATTERN__H
|
2020-09-11 01:28:06 -07:00
|
|
|
|
2021-01-15 19:27:25 -08:00
|
|
|
#include "files.h"
|
2020-12-14 22:13:47 -08:00
|
|
|
#include "types.h"
|
2020-09-11 01:28:06 -07:00
|
|
|
|
2021-09-23 14:38:46 -07:00
|
|
|
typedef struct {
|
|
|
|
bool success;
|
|
|
|
union {
|
|
|
|
pat_t *pat;
|
|
|
|
struct {
|
|
|
|
const char *start, *end, *msg;
|
|
|
|
} error;
|
|
|
|
} value;
|
|
|
|
} maybe_pat_t;
|
|
|
|
|
2021-05-10 23:46:46 -07:00
|
|
|
__attribute__((returns_nonnull, nonnull(1,2)))
|
2021-05-20 15:27:24 -07:00
|
|
|
pat_t *new_pat(file_t *f, const char *start, const char *end, size_t minlen, ssize_t maxlen, enum pattype_e type);
|
2021-09-21 18:45:43 -07:00
|
|
|
__attribute__((nonnull))
|
2021-09-23 14:38:46 -07:00
|
|
|
maybe_pat_t bp_stringpattern(file_t *f, const char *str);
|
2020-09-23 22:37:28 -07:00
|
|
|
__attribute__((nonnull(1,2)))
|
2021-09-23 14:38:46 -07:00
|
|
|
maybe_pat_t bp_replacement(file_t *f, pat_t *replacepat, const char *replacement);
|
2021-01-17 13:33:10 -08:00
|
|
|
__attribute__((nonnull(1)))
|
|
|
|
pat_t *chain_together(file_t *f, pat_t *first, pat_t *second);
|
2021-01-20 16:12:46 -08:00
|
|
|
__attribute__((nonnull(1)))
|
|
|
|
pat_t *either_pat(file_t *f, pat_t *first, pat_t *second);
|
2021-01-15 12:40:19 -08:00
|
|
|
__attribute__((nonnull))
|
2021-09-23 14:38:46 -07:00
|
|
|
maybe_pat_t bp_pattern(file_t *f, const char *str);
|
|
|
|
|
2020-09-11 01:28:06 -07:00
|
|
|
|
|
|
|
#endif
|
2021-08-28 16:05:30 -07:00
|
|
|
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
|