<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex
diff options
context:
space:
mode:
Diffstat (limited to 'subex')
-rw-r--r--subex/parse.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/subex/parse.go b/subex/parse.go
index b403adc..52488a7 100644
--- a/subex/parse.go
+++ b/subex/parse.go
@@ -329,8 +329,8 @@ func parseSubex(l RuneReader, minPower int) SubexAST {
lhs = SubexASTCopyAtom{Atom: walk.StringAtom(r)}
}
loop: for {
- if minPower <= 0 {
- next := parseSubex(l, 1)
+ if minPower <= 20 {
+ next := parseSubex(l, 21)
if next != nil {
lhs = SubexASTConcat{lhs, next}
continue loop
@@ -338,22 +338,22 @@ func parseSubex(l RuneReader, minPower int) SubexAST {
}
r := l.Next()
switch {
- case r == '{' && minPower <= 8:
+ case r == '{' && minPower <= 4:
lhs = SubexASTRepeat {
Content: lhs,
Acceptable: parseRepeatRange(l),
}
- case r == '+' && minPower <= 8:
+ case r == '+' && minPower <= 4:
lhs = SubexASTSum {lhs}
- case r == '*' && minPower <= 8:
+ case r == '*' && minPower <= 4:
lhs = SubexASTProduct {lhs}
- case r == '-' && minPower <= 8:
+ case r == '-' && minPower <= 4:
lhs = SubexASTNegate {lhs}
- case r == '/' && minPower <= 8:
+ case r == '/' && minPower <= 4:
lhs = SubexASTReciprocal {lhs}
- case r == '!' && minPower <= 8:
+ case r == '!' && minPower <= 4:
lhs = SubexASTNot {lhs}
- case r == '$' && minPower <= 8:
+ case r == '$' && minPower <= 4:
slot := l.Next()
if slot == eof {
panic("Missing slot character")
@@ -362,14 +362,14 @@ func parseSubex(l RuneReader, minPower int) SubexAST {
Match: lhs,
Slot: slot,
}
- case r == '|' && minPower <= 4:
- rhs := parseSubex(l, 5)
+ case r == '|' && minPower <= 8:
+ rhs := parseSubex(l, 9)
if rhs == nil {
panic("Missing subex after |")
}
lhs = SubexASTOr{lhs, rhs}
- case r == ';' && minPower <= 2:
- rhs := parseSubex(l, 3)
+ case r == ';' && minPower <= 10:
+ rhs := parseSubex(l, 11)
if rhs == nil {
panic("Missing subex after ;")
}