Compare commits
1 Commits
implementP
...
6850396bf9
Author | SHA1 | Date | |
---|---|---|---|
|
6850396bf9 |
15
compile.go
15
compile.go
@@ -155,21 +155,6 @@ func shuntingYard(re string, flags ...ReFlag) ([]postfixNode, error) {
|
|||||||
i++ // Skip all characters inside _unescaped_ brackets (we are _not_ at a closing bracket, or if we are, the previous character is a backslash)
|
i++ // Skip all characters inside _unescaped_ brackets (we are _not_ at a closing bracket, or if we are, the previous character is a backslash)
|
||||||
// TODO: Check for escaped characters
|
// TODO: Check for escaped characters
|
||||||
|
|
||||||
// Check ahead for character range
|
|
||||||
if i < len(re_runes)-2 && re_runes[i+1] == '-' {
|
|
||||||
rangeStart := re_runes[i]
|
|
||||||
rangeEnd := re_runes[i+2]
|
|
||||||
if int(rangeEnd) < int(rangeStart) {
|
|
||||||
return nil, fmt.Errorf("Range is out of order.")
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := rangeStart; i <= rangeEnd; i++ {
|
|
||||||
toAppend = append(toAppend, i)
|
|
||||||
}
|
|
||||||
|
|
||||||
i += 2 // Skip start and hyphen (end will automatically be skipped on next iteration of loop)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
toAppend = append(toAppend, re_runes[i])
|
toAppend = append(toAppend, re_runes[i])
|
||||||
}
|
}
|
||||||
// Replace the last character (which should have been ']', with RBRACKET
|
// Replace the last character (which should have been ']', with RBRACKET
|
||||||
|
Reference in New Issue
Block a user