diff options
-rw-r--r-- | subex/parse.go | 10 | ||||
-rw-r--r-- | subex/subexast.go | 54 |
2 files changed, 1 insertions, 63 deletions
diff --git a/subex/parse.go b/subex/parse.go index 24ae082..6e1493b 100644 --- a/subex/parse.go +++ b/subex/parse.go @@ -206,7 +206,7 @@ func parseSubex(l *RuneReader, minPower int) SubexAST { case '[': rangeParts := parseRangeSubex(l) lhs = SubexASTRange {rangeParts} - case ')', '*', '-', '|', '!', '?', ';', '{': + case ')', '|', ';', '{': l.rewind() return nil case '$': @@ -247,14 +247,6 @@ func parseSubex(l *RuneReader, minPower int) SubexAST { content: lhs, acceptable: parseRepeatRange(l), } - case r == '*' && minPower <= 8: - lhs = SubexASTMaximise{lhs} - case r == '-' && minPower <= 8: - lhs = SubexASTMinimise{lhs} - case r == '!' && minPower <= 8: - lhs = SubexASTTry{lhs} - case r == '?' && minPower <= 8: - lhs = SubexASTMaybe{lhs} case r == '|' && minPower <= 4: rhs := parseSubex(l, 5) if rhs == nil { diff --git a/subex/subexast.go b/subex/subexast.go index 650f038..5e63f03 100644 --- a/subex/subexast.go +++ b/subex/subexast.go @@ -48,38 +48,6 @@ func (ast SubexASTOr) compileWith(next SubexState) SubexState { } } -// Run the content subex as many times as possible as the input is read in -type SubexASTMaximise struct { - content SubexAST -} -func (ast SubexASTMaximise) compileWith(next SubexState) SubexState { - state := &SubexGroupState { - nil, - next, - } - state.first = ast.content.compileWith(state) - return state -} -func (ast SubexASTMaximise) String() string { - return fmt.Sprintf("(%v)*", ast.content) -} - -// Run the content subex as few times as possible as the input is read in -type SubexASTMinimise struct { - content SubexAST -} -func (ast SubexASTMinimise) compileWith(next SubexState) SubexState { - state := &SubexGroupState { - next, - nil, - } - state.second = ast.content.compileWith(state) - return state -} -func (ast SubexASTMinimise) String() string { - return fmt.Sprintf("(%v)-", ast.content) -} - type ConvexRange struct { start, end int } @@ -185,28 +153,6 @@ func (ast SubexASTOutput) compileWith(next SubexState) SubexState { } } -// Try to use a subex but just skip over this if it doesn't match -type SubexASTTry struct { - content SubexAST -} -func (ast SubexASTTry) compileWith(next SubexState) SubexState { - return &SubexGroupState { - ast.content.compileWith(next), - next, - } -} - -// Try to skip over this subex but use it should that not match -type SubexASTMaybe struct { - content SubexAST -} -func (ast SubexASTMaybe) compileWith(next SubexState) SubexState { - return &SubexGroupState { - next, - ast.content.compileWith(next), - } -} - // Read in a repeated subex separated by a delimiter. Greedy type SubexASTJoin struct { content, delimiter SubexAST |