forked from StarOpenSource/Engine
Fix TwoCycleFormatterImpl parsing
This commit is contained in:
parent
048ae6b074
commit
01c91244aa
1 changed files with 9 additions and 0 deletions
|
@ -57,6 +57,7 @@ abstract class TwoCycleFormatterImpl: TwoCycleFormatter() {
|
||||||
if (inTag) {
|
if (inTag) {
|
||||||
if (char == '>') {
|
if (char == '>') {
|
||||||
inTag = false
|
inTag = false
|
||||||
|
|
||||||
if (currentComponent.isNotEmpty())
|
if (currentComponent.isNotEmpty())
|
||||||
when (currentComponent.toString()) {
|
when (currentComponent.toString()) {
|
||||||
"reset" -> components.add("RESET")
|
"reset" -> components.add("RESET")
|
||||||
|
@ -64,6 +65,8 @@ abstract class TwoCycleFormatterImpl: TwoCycleFormatter() {
|
||||||
"white", "black", "gray", "yellow", "green", "cyan", "light_blue", "blue", "purple", "magenta", "pink", "red", "orange" -> components.add("COLOR:${currentComponent.toString().uppercase()}")
|
"white", "black", "gray", "yellow", "green", "cyan", "light_blue", "blue", "purple", "magenta", "pink", "red", "orange" -> components.add("COLOR:${currentComponent.toString().uppercase()}")
|
||||||
else -> components[components.lastIndex] = "${components[components.lastIndex]}<${currentComponent}>"
|
else -> components[components.lastIndex] = "${components[components.lastIndex]}<${currentComponent}>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentComponent.clear()
|
||||||
} else
|
} else
|
||||||
currentComponent.append(char)
|
currentComponent.append(char)
|
||||||
} else
|
} else
|
||||||
|
@ -80,11 +83,17 @@ abstract class TwoCycleFormatterImpl: TwoCycleFormatter() {
|
||||||
currentComponent.append(char)
|
currentComponent.append(char)
|
||||||
} else
|
} else
|
||||||
inTag = true
|
inTag = true
|
||||||
|
|
||||||
|
if (currentComponent.isNotEmpty())
|
||||||
|
components.add("TEXT:${currentComponent}")
|
||||||
currentComponent.clear()
|
currentComponent.clear()
|
||||||
}
|
}
|
||||||
else -> currentComponent.append(char)
|
else -> currentComponent.append(char)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentComponent.isNotEmpty())
|
||||||
|
components.add("TEXT:${currentComponent}")
|
||||||
|
|
||||||
return components.toTypedArray()
|
return components.toTypedArray()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue