Rename regex_t to parse_tree_t and merge module into parser
This commit is contained in:
54
lib/regex.h
54
lib/regex.h
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Camden Dixie O'Brien
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#ifndef REGEX_H
|
||||
#define REGEX_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct {
|
||||
bool negated;
|
||||
int count, capacity;
|
||||
char *contents;
|
||||
} class_t;
|
||||
|
||||
typedef enum {
|
||||
QUANTIFIER_NONE,
|
||||
QUANTIFIER_ZERO_OR_MORE,
|
||||
QUANTIFIER_ONE_OR_MORE,
|
||||
QUANTIFIER_ZERO_OR_ONE,
|
||||
} quantifier_t;
|
||||
|
||||
typedef enum {
|
||||
TERM_TYPE_WILDCARD,
|
||||
TERM_TYPE_CLASS,
|
||||
TERM_TYPE_LITERAL,
|
||||
TERM_TYPE_REGEX,
|
||||
} term_type_t;
|
||||
|
||||
struct _term;
|
||||
typedef struct {
|
||||
int len, capacity;
|
||||
struct _term *contents;
|
||||
} sequence_t;
|
||||
|
||||
typedef struct _regex {
|
||||
sequence_t sequence;
|
||||
struct _regex *alternative;
|
||||
} regex_t;
|
||||
|
||||
typedef struct _term {
|
||||
quantifier_t quantifier;
|
||||
term_type_t type;
|
||||
union {
|
||||
class_t class;
|
||||
char literal;
|
||||
regex_t regex;
|
||||
};
|
||||
} term_t;
|
||||
|
||||
void regex_free_children(regex_t *r);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user