diff options
author | Ori Bernstein <ori@eigenstate.org> | 2015-04-29 21:23:39 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2015-04-29 21:23:39 -0700 |
commit | ff18725b46d903e6dcedd0c6262aea47fe6c8869 (patch) | |
tree | cfdee0a795df83e672a3709b285ff40ca4a9d7d0 /libregex/types.myr | |
parent | 404f711755c8dbe4104eedbae62cddfbba6bbfa8 (diff) | |
download | mc-ff18725b46d903e6dcedd0c6262aea47fe6c8869.tar.gz |
Add regex parsing to libregex.
I'd like to use the same regex parser for source indexing
and parser generation.
Diffstat (limited to 'libregex/types.myr')
-rw-r--r-- | libregex/types.myr | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libregex/types.myr b/libregex/types.myr index 24e9842..a0f8ceb 100644 --- a/libregex/types.myr +++ b/libregex/types.myr @@ -11,6 +11,32 @@ pkg regex = `Badescape ;; + type ast = union + /* basic string building */ + `Alt (ast#, ast#) + `Cat (ast#, ast#) + + /* repetition */ + `Star ast# + `Rstar ast# + `Plus ast# + `Rplus ast# + `Quest ast# + + /* end matches */ + `Byte byte + `Chr char + `Ranges char[2][:] + + /* meta */ + `Cap (std.size, ast#) /* id, ast */ + `Bol /* beginning of line */ + `Eol /* end of line */ + `Bow /* beginning of word */ + `Eow /* end of word */ + ;; + + type regex = struct /* compile state */ debug : bool |