mirror of
https://github.com/irmen/prog8.git
synced 2025-01-12 04:30:03 +00:00
improve IR error message
This commit is contained in:
parent
f739e679e4
commit
ed15fac691
@ -283,13 +283,21 @@ private fun parseCall(rest: String): ParsedCall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal fun parseRegisterOrStatusflag(regs: String): RegisterOrStatusflag {
|
internal fun parseRegisterOrStatusflag(sourceregs: String): RegisterOrStatusflag {
|
||||||
var reg: RegisterOrPair? = null
|
var reg: RegisterOrPair? = null
|
||||||
var sf: Statusflag? = null
|
var sf: Statusflag? = null
|
||||||
|
|
||||||
|
val regs = if(sourceregs.endsWith(".b") || sourceregs.endsWith(".w") || sourceregs.endsWith(".f"))
|
||||||
|
sourceregs.dropLast(2) else sourceregs
|
||||||
|
|
||||||
try {
|
try {
|
||||||
reg = RegisterOrPair.valueOf(regs)
|
reg = RegisterOrPair.valueOf(regs)
|
||||||
} catch (x: IllegalArgumentException) {
|
} catch (x: IllegalArgumentException) {
|
||||||
|
try {
|
||||||
sf = Statusflag.valueOf(regs)
|
sf = Statusflag.valueOf(regs)
|
||||||
|
} catch(x: IllegalArgumentException) {
|
||||||
|
throw IRParseException("invalid IR register or statusflag: $regs")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return RegisterOrStatusflag(reg, sf)
|
return RegisterOrStatusflag(reg, sf)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user