From 32242537f85ebbda33db4e0fbac67fa970ae2586 Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Sun, 4 Jul 2021 23:36:41 +0800 Subject: [PATCH 01/11] Update RuleAnalyzer.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正刚才的更新中,找到筛选器起始字符时,未重置位置导致分隔字串被划分到下一段规则的问题。 --- .../java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt index dfc5cae23..6f736259d 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt +++ b/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 { - val start = pos //声明新变量记录临时起始位置,不更改类本身的起始位置 + var pos = pos //声明新变量记录匹配位置,不更改类本身的位置 - while (!isEmpty) { + while (pos != queue.length) { for (s in seq) if(queue[pos] == s) return pos //匹配则返回位置 @@ -140,8 +140,6 @@ class RuleAnalyzer(data: String) { } - pos = start //匹配失败,位置回退 - return -1 } From 9e6ecbf2ca434f78b679783e47eca71a6687722e Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Mon, 5 Jul 2021 01:07:55 +0800 Subject: [PATCH 02/11] Update AnalyzeByJSoup.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 查找是否存在索引列表时,当区间与当前数字都空时跳出,避免jsoup选择器被当做索引列表而导致出错。 --- .../java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt index 3bb2e4e33..a182dc7f2 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt @@ -237,7 +237,12 @@ class AnalyzeByJSoup(doc: Any) { else -> { //为保证查找顺序,区间和单个索引都添加到同一集合 - if(curList.isEmpty())indexSet.indexs.add(curInt!!) + if(curList.isEmpty()) { + + if(curInt == null) break //是jsoup选择器而非索引列表,跳出 + + indexSet.indexs.add(curInt) + } else{ //列表最后压入的是区间右端,若列表有两位则最先压入的是间隔 From 8d957e2ce21ce27bb50ff490e869c7085f1e9fd5 Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Mon, 5 Jul 2021 10:39:12 +0800 Subject: [PATCH 03/11] Update RuleAnalyzer.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化代码,减少不必要的变量和操作 --- .../app/model/analyzeRule/RuleAnalyzer.kt | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt index 6f736259d..229925003 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt @@ -104,13 +104,15 @@ class RuleAnalyzer(data: String) { */ fun consumeToAny(vararg seq:String): Boolean { - start = pos + var pos = pos //声明新变量记录匹配位置,不更改类本身的位置 - while (!isEmpty) { + while (pos != queue.length) { for (s in seq) { if (matches(s)) { step = s.length //间隔数 + this.pos = pos //匹配成功, 同步处理位置到类 + start = pos //匹配成功, 设置规则下次起始位置 return true //匹配就返回 true } } @@ -118,8 +120,6 @@ class RuleAnalyzer(data: String) { pos++ //逐个试探 } - pos = start //匹配失败,位置回退 - return false } @@ -219,7 +219,9 @@ class RuleAnalyzer(data: String) { * 在双重转义字串中拉出一个规则平衡组 */ fun chompRuleBalanced(open: Char = '[', close: Char = ']',f: ((Char) ->Boolean?)? = null ): Boolean { - start = pos + + val start = pos //声明临时变量记录本次起始位置,不更改类的start + var depth = 0 //嵌套深度 var otherDepth = 0 //其他对称符合嵌套深度 @@ -252,7 +254,10 @@ class RuleAnalyzer(data: String) { } } while (depth > 0 || otherDepth > 0) //拉出一个平衡字串 - return !(depth > 0 || otherDepth > 0) //平衡返回false,不平衡返回true + return if(depth > 0 || otherDepth > 0) { + pos = start //匹配失败,位置回退 + } else true + } /** @@ -312,9 +317,7 @@ class RuleAnalyzer(data: String) { } else { - val start0 = start //记录当前规则开头位置 if(!chompRuleBalanced(queue[pos],next)) throw Error(queue.substring(0, start)+"后未平衡") //拉出一个筛选器,不平衡则报错 - start = start0 //筛选器的开头不是本段规则开头,故恢复开头设置 splitRule(rule) //首段已匹配,但当前段匹配未完成,调用二段匹配 } @@ -352,9 +355,7 @@ class RuleAnalyzer(data: String) { pos = st //位置推移到筛选器处 val next = if(queue[pos] == '[' ) ']' else ')' //平衡组末尾字符 - val start0 = start //记录当前规则开头位置 if(!chompRuleBalanced(queue[pos],next)) throw Error(queue.substring(0, start)+"后未平衡") //拉出一个筛选器,不平衡时返回true,表示未平衡 - start = start0 //筛选器平衡,但筛选器的开头不是当前规则开头,故恢复开头设置 return splitRule(rule) //递归匹配 @@ -377,15 +378,13 @@ class RuleAnalyzer(data: String) { while (!isEmpty && consumeTo(inner)) { //拉取成功返回true,ruleAnalyzes里的字符序列索引变量pos后移相应位置,否则返回false,且isEmpty为true - val start1 = start //记录拉取前起点 - if (chompRuleBalanced {//拉出一个以[]为默认嵌套、以{}为补充嵌套的平衡字段 - when (it) { - '{' -> true - '}' -> false - else -> null - } - }) { + when (it) { + '{' -> true + '}' -> false + else -> null + } + }) { val frv= fr(currBalancedString(startStep,endStep)) if(frv != null) { @@ -395,8 +394,7 @@ class RuleAnalyzer(data: String) { } } - start = start1 //拉出字段不平衡,重置起点 - pos = start + inner.length //拉出字段不平衡,inner只是个普通字串,规则回退到开头,并跳到此inner后继续匹配 + pos += inner.length //拉出字段不平衡,inner只是个普通字串,跳到此inner后继续匹配 } From d55b264db034aff57ff3cf9227ccf8ae8bf82ed8 Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Mon, 5 Jul 2021 10:41:24 +0800 Subject: [PATCH 04/11] Update RuleAnalyzer.kt --- .../main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt index 229925003..08ae0c402 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt @@ -256,6 +256,7 @@ class RuleAnalyzer(data: String) { return if(depth > 0 || otherDepth > 0) { pos = start //匹配失败,位置回退 + false } else true } From e2b4f77c32a39c7f9c903676e50112fae2d1fbc9 Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Mon, 5 Jul 2021 12:06:56 +0800 Subject: [PATCH 05/11] Update RuleAnalyzer.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 简化规则 --- .../java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt index 08ae0c402..c1680e16b 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt @@ -111,8 +111,8 @@ class RuleAnalyzer(data: String) { for (s in seq) { if (matches(s)) { step = s.length //间隔数 + start = this.pos //匹配成功, 设置规则下次起始位置 this.pos = pos //匹配成功, 同步处理位置到类 - start = pos //匹配成功, 设置规则下次起始位置 return true //匹配就返回 true } } @@ -378,7 +378,7 @@ class RuleAnalyzer(data: String) { val st = StringBuilder() while (!isEmpty && consumeTo(inner)) { //拉取成功返回true,ruleAnalyzes里的字符序列索引变量pos后移相应位置,否则返回false,且isEmpty为true - + val posPre = pos //记录上次结束位置 if (chompRuleBalanced {//拉出一个以[]为默认嵌套、以{}为补充嵌套的平衡字段 when (it) { '{' -> true @@ -389,7 +389,7 @@ class RuleAnalyzer(data: String) { val frv= fr(currBalancedString(startStep,endStep)) if(frv != null) { - st.append(queue.substring(start1,start)+frv) //压入内嵌规则前的内容,及内嵌规则解析得到的字符串 + st.append(queue.substring(start,posPre)+frv) //压入内嵌规则前的内容,及内嵌规则解析得到的字符串 continue //获取内容成功,继续选择下个内嵌规则 } From 0dc8604b6c875612a075fca75a5715ed98894308 Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Mon, 5 Jul 2021 12:31:35 +0800 Subject: [PATCH 06/11] Update RuleAnalyzer.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正两个逻辑错误 --- .../main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt index c1680e16b..e72d7e680 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt @@ -277,7 +277,7 @@ class RuleAnalyzer(data: String) { if(st == -1) { - var rule = arrayOf(queue.substring(0, pos)) //压入分隔的首段规则到数组 + var rule = arrayOf(queue.substring(start, pos)) //压入分隔的首段规则到数组 elementsType = queue.substring(pos, pos + step) //设置组合类型 pos += step //跳过分隔符 @@ -294,7 +294,7 @@ class RuleAnalyzer(data: String) { val rule = if(st >pos ){ //先匹配到st1pos,表明分隔字串不在选择器中,将选择器前分隔字串分隔的字段依次压入数组 - var rule = arrayOf(queue.substring(0, pos)) //压入分隔的首段规则到数组 + var rule = arrayOf(queue.substring(start, pos)) //压入分隔的首段规则到数组 elementsType = queue.substring(pos, pos + step) //设置组合类型 pos += step //跳过分隔符 From 514dbf4ff97cccbb901e32cac7218b98d938320d Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Mon, 5 Jul 2021 12:47:44 +0800 Subject: [PATCH 07/11] Update RuleAnalyzer.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 简化规则 --- .../app/model/analyzeRule/RuleAnalyzer.kt | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt index e72d7e680..197a93005 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt @@ -151,7 +151,7 @@ class RuleAnalyzer(data: String) { else -> null } } ): Boolean { - start = pos + val pos = pos //声明变量记录临时处理位置 var depth = 0 //嵌套深度 var bracketsDepth = 0 //[]嵌套深度 @@ -164,13 +164,13 @@ class RuleAnalyzer(data: String) { do { if (isEmpty) break - var c = consume() + var c = queue[pos++] if (c != '\\') { //非转义字符 if (c == '\'' && !commits && !commit && !regex && !inDoubleQuote && !inOtherQuote) inSingleQuote = !inSingleQuote //匹配具有语法功能的单引号 else if (c == '"' && !commits && !commit && !regex && !inSingleQuote && !inOtherQuote) inDoubleQuote = !inDoubleQuote //匹配具有语法功能的双引号 else if (c == '`' && !commits && !commit && !regex && !inSingleQuote && !inDoubleQuote) inOtherQuote = !inOtherQuote //匹配具有语法功能的'`' else if (c == '/' && !commits && !commit && !regex && !inSingleQuote && !inDoubleQuote && !inOtherQuote) { //匹配注释或正则起点 - c = consume() + c = queue[pos++] when(c){ '/'->commit=true //匹配单行注释起点 '*'->commits=true //匹配多行注释起点 @@ -178,7 +178,7 @@ class RuleAnalyzer(data: String) { } } else if(commits && c == '*') { //匹配多行注释终点 - c = consume() + c = queue[pos++] if(c == '/')commits = false } else if(regex && c == '/') { //正则的终点或[]平衡 @@ -200,19 +200,20 @@ class RuleAnalyzer(data: String) { if (fn) depth++ else depth-- //嵌套或者闭合 }else { //转义字符 - var next = consume() //拉出被转义字符 + var next = queue[pos++] //拉出被转义字符 if(commit && next == 'n') commit = false //匹配单行注释终点。当前为\,下个为n,表示换行 else if (!commits && !commit && next == '\\') { - consume() //当前为\,下个为\,双重转义中"\\"表示转义字符本身,根据if条件"\\"字串不在注释中,则只能在字串或正则中 - next = consume() //拉出下个字符,因为在双重转义的字串或正则中,类似于 \\/ 这样的结构才是转义结构 - if(next == '\\')consume() //若为转义字符则继续拉出,因为双重转义中转义字符成对存在,即 \\\\ + queue[pos++] //当前为\,下个为\,双重转义中"\\"表示转义字符本身,根据if条件"\\"字串不在注释中,则只能在字串或正则中 + next = queue[pos++] //拉出下个字符,因为在双重转义的字串或正则中,类似于 \\/ 这样的结构才是转义结构 + if(next == '\\')queue[pos++] //若为转义字符则继续拉出,因为双重转义中转义字符成对存在,即 \\\\ } } } while (depth > 0 || bracketsDepth >0) //拉出全部符合js语法的字段 - if(depth > 0 || bracketsDepth >0) start = pos - - return pos > start + return if(depth > 0 || bracketsDepth > 0) false else { + this.pos = pos //同步位置 + true + } } /** @@ -220,7 +221,7 @@ class RuleAnalyzer(data: String) { */ fun chompRuleBalanced(open: Char = '[', close: Char = ']',f: ((Char) ->Boolean?)? = null ): Boolean { - val start = pos //声明临时变量记录本次起始位置,不更改类的start + val pos = pos //声明临时变量记录匹配位置,匹配成功后才同步到类的pos var depth = 0 //嵌套深度 var otherDepth = 0 //其他对称符合嵌套深度 @@ -230,7 +231,7 @@ class RuleAnalyzer(data: String) { do { if (isEmpty) break - val c = consume() + val c = queue[pos++] if (c != ESC) { //非转义字符 if (c == '\'' && !inDoubleQuote) inSingleQuote = !inSingleQuote //匹配具有语法功能的单引号 else if (c == '"' && !inSingleQuote) inDoubleQuote = !inDoubleQuote //匹配具有语法功能的双引号 @@ -245,20 +246,19 @@ class RuleAnalyzer(data: String) { } }else { //转义字符 - var next = consume() //拉出被转义字符,匹配\/、\"、\'等 + var next = queue[pos++] //拉出被转义字符,匹配\/、\"、\'等 if (next == ESC) { - consume() //当前为\,下个为\,双重转义中"\\"表示转义字符本身,根据语法特征当前字段在字串或正则中 - next = consume() //拉出下个字符,因为在双重转义的字串或正则中,类似于 \\/ 这样的结构才是转义结构 - if(next == ESC)consume() //若为转义字符则继续拉出,因为双重转义中转义字符成对存在,即 \\\\ + queue[pos++] //当前为\,下个为\,双重转义中"\\"表示转义字符本身,根据语法特征当前字段在字串或正则中 + next = queue[pos++] //拉出下个字符,因为在双重转义的字串或正则中,类似于 \\/ 这样的结构才是转义结构 + if(next == ESC)queue[pos++] //若为转义字符则继续拉出,因为双重转义中转义字符成对存在,即 \\\\ } } } while (depth > 0 || otherDepth > 0) //拉出一个平衡字串 - return if(depth > 0 || otherDepth > 0) { - pos = start //匹配失败,位置回退 - false - } else true - + return if(depth > 0 || otherDepth > 0) false else { + this.pos = pos //同步位置 + true + } } /** From b71d37fc04a21428152df6d6e46aefbda0ec27f3 Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Mon, 5 Jul 2021 13:03:43 +0800 Subject: [PATCH 08/11] Update RuleAnalyzer.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 简化规则,并修正两个逻辑错误 --- .../main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt index 197a93005..d90b58a79 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt @@ -151,7 +151,7 @@ class RuleAnalyzer(data: String) { else -> null } } ): Boolean { - val pos = pos //声明变量记录临时处理位置 + var pos = pos //声明变量记录临时处理位置 var depth = 0 //嵌套深度 var bracketsDepth = 0 //[]嵌套深度 @@ -221,7 +221,7 @@ class RuleAnalyzer(data: String) { */ fun chompRuleBalanced(open: Char = '[', close: Char = ']',f: ((Char) ->Boolean?)? = null ): Boolean { - val pos = pos //声明临时变量记录匹配位置,匹配成功后才同步到类的pos + var pos = pos //声明临时变量记录匹配位置,匹配成功后才同步到类的pos var depth = 0 //嵌套深度 var otherDepth = 0 //其他对称符合嵌套深度 From 9691228561f5f0487faf6fcb20b0fa412c288da2 Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Mon, 5 Jul 2021 13:40:43 +0800 Subject: [PATCH 09/11] Update updateLog.md --- app/src/main/assets/updateLog.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 2e50026d8..10597e3aa 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -8,6 +8,16 @@ * 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则出现问题。先关闭替换净化并刷新,再观察是否正常。如果正常说明净化规则存在误杀,如果关闭后仍然出现相关问题,请点击源链接查看原文与正文是否相同,如果不同,再进行反馈。 * 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源! +**2021/07/5** +1. 默认规则新增类似`jsonPath`的索引写法 by bushixuanqi +* 格式形如 `[index,index, ...]` 或 `[!index,index, ...]` 其中`[!`开头表示筛选方式为排除,`index`可以是单个索引,也可以是区间。 +* 区间格式为 `start:end` 或 `start:end:step`,其中`start`为`0`可省略,`end`为`-1`可省略。 +* 索引、区间两端、区间间隔都支持负数 +* 例如 `tag.div[-1, 3:-2:-10, 2]` +* 特殊用法 `tag.div[-1:0]` 可在任意地方让列表反向 +2. 允许索引作为首规则,此时相当于前面是`children` +* `head@.1@text` 与 `head@[1]@text` 与 `head@children[1]@text` 等价 + **2021/06/29** * 修复html格式化bug * 订阅界面webView支持css prefers-color-scheme: dark 查询,需webView v76或更高版本 @@ -455,4 +465,4 @@ getTxtInFolder(unzipPath: String): String **2020/09/10** * 修复自动换源的bug * 修复保存主题的bug -* 书源排序,分享,注释优化 by [h11128](https://github.com/h11128) \ No newline at end of file +* 书源排序,分享,注释优化 by [h11128](https://github.com/h11128) From 808e58d4b53094d48075890ad122ac200e2d44a7 Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Mon, 5 Jul 2021 13:42:10 +0800 Subject: [PATCH 10/11] Update updateLog.md --- app/src/main/assets/updateLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 10597e3aa..5e445dcb1 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -15,7 +15,7 @@ * 索引、区间两端、区间间隔都支持负数 * 例如 `tag.div[-1, 3:-2:-10, 2]` * 特殊用法 `tag.div[-1:0]` 可在任意地方让列表反向 -2. 允许索引作为首规则,此时相当于前面是`children` +2. 允许索引作为@分段后每个部分的首规则,此时相当于前面是`children` * `head@.1@text` 与 `head@[1]@text` 与 `head@children[1]@text` 等价 **2021/06/29** From a3dbb32812c217aad43debb66db922b11db875cf Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Mon, 5 Jul 2021 13:59:05 +0800 Subject: [PATCH 11/11] Update RuleAnalyzer.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 搞错了,那两个不是逻辑错误 --- .../main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt index d90b58a79..e2f08660f 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/RuleAnalyzer.kt @@ -277,7 +277,7 @@ class RuleAnalyzer(data: String) { if(st == -1) { - var rule = arrayOf(queue.substring(start, pos)) //压入分隔的首段规则到数组 + var rule = arrayOf(queue.substring(0, pos)) //压入分隔的首段规则到数组 elementsType = queue.substring(pos, pos + step) //设置组合类型 pos += step //跳过分隔符 @@ -294,7 +294,7 @@ class RuleAnalyzer(data: String) { val rule = if(st >pos ){ //先匹配到st1pos,表明分隔字串不在选择器中,将选择器前分隔字串分隔的字段依次压入数组 - var rule = arrayOf(queue.substring(start, pos)) //压入分隔的首段规则到数组 + var rule = arrayOf(queue.substring(0, pos)) //压入分隔的首段规则到数组 elementsType = queue.substring(pos, pos + step) //设置组合类型 pos += step //跳过分隔符