修正刚才上次更新的规则中匹配筛选器匹配成功时未重置匹配位置,导致分隔字串被划分到下段规则的问题

pull/1114/head
bushixuanqi 3 years ago
parent 1081f0f0a9
commit d6db01eba9
  1. 6
      app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt

@ -130,9 +130,9 @@ class RuleAnalyzer(data: String) {
*/ */
private fun findToAny(vararg seq:Char): Int { private fun findToAny(vararg seq:Char): Int {
val start = pos //声明新变量记录临时起始位置,不更改类本身的起始位置 var pos = pos //声明新变量记录匹配位置,不更改类本身的位置
while (!isEmpty) { while (pos != queue.length) {
for (s in seq) if(queue[pos] == s) return pos //匹配则返回位置 for (s in seq) if(queue[pos] == s) return pos //匹配则返回位置
@ -140,8 +140,6 @@ class RuleAnalyzer(data: String) {
} }
pos = start //匹配失败,位置回退
return -1 return -1
} }

Loading…
Cancel
Save