bug ffpm-745.txt U dans I n'est pas correctement exclu

This commit is contained in:
dotmg 2026-01-10 15:20:12 +01:00
parent 99314a1b4d
commit f3206c1554

View file

@ -21,7 +21,6 @@ import mg.dot.feufaro.midi.MidiWriterKotlin
//@todo: ews-80.txt ${m:12/4}
//@todo: ews-81.txt ${R=}${D:....}
//@todo: bug ffpm-629.txt sssszd au lieu de ssss-d(-rrrrtdr)
//@todo: bug ffpm-745.txt U dans I n'est pas correctement exclu
class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository: FileRepository) {
private val T: MutableList<PTemplate> = mutableListOf()
@ -340,7 +339,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
loadN(voiceNumber, result, templateComments)
}
private suspend fun parseOneLine(line: String) {
private suspend fun parseOneLine(line: String, regexIgnoreString: String = "") {
val index: Int
val value: String
val lineLength = line.trim().length
@ -385,12 +384,12 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
loadO(index, value)
"I" ->
loadI(value)
loadI(value, regexIgnoreString)
}
}
suspend fun loadI(line: String) {
suspend fun loadI(line: String, regexIgnoreString: String = "") {
val lineSplit = line.split(":")
val lastSlashInFilename = currentFile.lastIndexOf('/')
val fileNamePrefix = if (lastSlashInFilename != -1) {
@ -398,6 +397,15 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
} else {
""
}
val regexIgnoreString = try {
if (regexIgnoreString != "") {
regexIgnoreString + "|" + lineSplit[1]
} else {
lineSplit[1]
}
} catch (e: Exception) {
"^:"
}
val filePath = fileNamePrefix + lineSplit[0]
val lines = try {
fileRepository.readFileLines(filePath)
@ -406,11 +414,11 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
emptyList()
}
try {
val ignoredLines = Regex(lineSplit[1])
val ignoredLines = Regex(regexIgnoreString)
lines.forEach {
val match = ignoredLines.find(it)
if (match == null) {
parseOneLine(it)
parseOneLine(it, regexIgnoreString)
}
}
} catch (e: Exception) {