<- Back to shtanton's homepage
summaryrefslogtreecommitdiff
path: root/main/regexast.go
diff options
context:
space:
mode:
Diffstat (limited to 'main/regexast.go')
-rw-r--r--main/regexast.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/main/regexast.go b/main/regexast.go
index 0aab053..a5a60c4 100644
--- a/main/regexast.go
+++ b/main/regexast.go
@@ -70,3 +70,23 @@ func (ast RegexASTMinimise) compileWith(next RegexState) RegexState {
state.second = ast.content.compileWith(state)
return state
}
+
+type RegexASTTry struct {
+ content RegexAST
+}
+func (ast RegexASTTry) compileWith(next RegexState) RegexState {
+ return RegexGroupState{
+ ast.content.compileWith(next),
+ next,
+ }
+}
+
+type RegexASTMaybe struct {
+ content RegexAST
+}
+func (ast RegexASTMaybe) compileWith(next RegexState) RegexState {
+ return RegexGroupState {
+ next,
+ ast.content.compileWith(next),
+ }
+}