From c8a0b7157d544f2359f2373160dcc69cdef8f4de Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Sun, 23 Jul 2017 22:24:32 -0500 Subject: Initial commit --- ast.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 ast.h (limited to 'ast.h') diff --git a/ast.h b/ast.h new file mode 100644 index 0000000..4694c33 --- /dev/null +++ b/ast.h @@ -0,0 +1,40 @@ +#ifndef AST_H +#define AST_H + +struct repeat { + long min, max; +}; + +enum { + ATOM_ALTERNATION, + ATOM_SEQUENCE, + ATOM_REPETITION, + ATOM_ALPHABETIC, + ATOM_NUMERIC, + ATOM_UPPERCASE, + ATOM_LOWERCASE, + ATOM_CONTROL, + ATOM_PUNCTUATION, + ATOM_EVERYTHING, + ATOM_LITERAL, +}; + +struct atom { + int type; + union { + struct { + struct repeat counts; + struct atom *child; + } repeat; + const struct atom *children[2]; + const char *literal; + } u; +}; + +struct atom *mkatom(const struct atom *src); +void dump_atom(const struct atom *a); + +extern struct atom *ast; + +#endif + -- cgit v1.2.3