|
|
|
@ -128,7 +128,7 @@ class AnalyzeRule( |
|
|
|
|
@JvmOverloads |
|
|
|
|
fun getStringList(rule: String?, isUrl: Boolean = false): List<String>? { |
|
|
|
|
if (rule.isNullOrEmpty()) return null |
|
|
|
|
val ruleList = splitSourceRule(rule, true) |
|
|
|
|
val ruleList = splitSourceRule(rule, false) |
|
|
|
|
return getStringList(ruleList, isUrl) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -256,7 +256,7 @@ class AnalyzeRule( |
|
|
|
|
fun getElement(ruleStr: String): Any? { |
|
|
|
|
if (TextUtils.isEmpty(ruleStr)) return null |
|
|
|
|
var result: Any? = null |
|
|
|
|
val ruleList = splitSourceRule(ruleStr) |
|
|
|
|
val ruleList = splitSourceRule(ruleStr, true) |
|
|
|
|
content?.let { o -> |
|
|
|
|
if (ruleList.isNotEmpty()) result = o |
|
|
|
|
for (sourceRule in ruleList) { |
|
|
|
@ -370,13 +370,13 @@ class AnalyzeRule( |
|
|
|
|
/** |
|
|
|
|
* 分解规则生成规则列表 |
|
|
|
|
*/ |
|
|
|
|
fun splitSourceRule(ruleStr: String?, isList: Boolean = false): List<SourceRule> { |
|
|
|
|
fun splitSourceRule(ruleStr: String?, allInOne: Boolean = false): List<SourceRule> { |
|
|
|
|
if (ruleStr.isNullOrEmpty()) return ArrayList<SourceRule>() |
|
|
|
|
val ruleList = ArrayList<SourceRule>() |
|
|
|
|
var mMode: Mode = Mode.Default |
|
|
|
|
var start = 0 |
|
|
|
|
//仅首字符为:时为AllInOne,其实:与伪类选择器冲突,建议改成?更合理 |
|
|
|
|
if (isList && ruleStr.startsWith(":")) { |
|
|
|
|
if (allInOne && ruleStr.startsWith(":")) { |
|
|
|
|
mMode = Mode.Regex |
|
|
|
|
isRegex = true |
|
|
|
|
start = 1 |
|
|
|
|