diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2017-07-23 22:24:32 -0500 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2017-07-24 21:19:10 -0500 |
commit | c8a0b7157d544f2359f2373160dcc69cdef8f4de (patch) | |
tree | 2fa9c2cc4646cab3886025a9663289b177ad4c55 /ast.h |
Initial commit
Diffstat (limited to 'ast.h')
-rw-r--r-- | ast.h | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -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 + |