diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2022-09-23 14:55:58 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2022-09-23 14:55:58 +0100 |
commit | f3911888915f6aa96e6b28bd2a98a662faf20f47 (patch) | |
tree | 55373234480b057e1615c0d51316be256b1d6d29 /main/regexast.go | |
parent | 0a8690993d572a50b95dd4f1c1903ed00ddb9c2b (diff) | |
download | subex-f3911888915f6aa96e6b28bd2a98a662faf20f47.tar |
Adds try, maybe and join operators with !, ? and ; respectively
Diffstat (limited to 'main/regexast.go')
-rw-r--r-- | main/regexast.go | 20 |
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), + } +} |