generated from rnentjes/kotlin-server-web-undertow
91 lines
2.3 KiB
Kotlin
91 lines
2.3 KiB
Kotlin
package mtmc.asm.instructions
|
|
|
|
import mtmc.asm.Assembler
|
|
import mtmc.tokenizer.MTMCToken
|
|
|
|
class MetaInstruction(instruction: MTMCToken) :
|
|
Instruction(InstructionType.META, listOf(), instruction) {
|
|
private var originalFilePath: MTMCToken? = null
|
|
private var originaLineNumber: MTMCToken? = null
|
|
private var globalName: MTMCToken? = null
|
|
private var globalLocation: MTMCToken? = null
|
|
private var globalType: MTMCToken? = null
|
|
private var localName: MTMCToken? = null
|
|
private var localOffset: MTMCToken? = null
|
|
private var localType: MTMCToken? = null
|
|
|
|
override fun genCode(output: ByteArray, assembler: Assembler) {
|
|
// do nothing
|
|
}
|
|
|
|
val isFileDirective: Boolean
|
|
get() = "file" == this.instructionToken.stringValue
|
|
|
|
val isLineDirective: Boolean
|
|
get() = "line" == this.instructionToken.stringValue
|
|
|
|
val isGlobalDirective: Boolean
|
|
get() = "global" == this.instructionToken.stringValue
|
|
|
|
val isLocalDirective: Boolean
|
|
get() = "local" == this.instructionToken.stringValue
|
|
|
|
val isEndLocalDirective: Boolean
|
|
get() = "endlocal" == this.instructionToken.stringValue
|
|
|
|
fun setOriginalFilePath(path: MTMCToken) {
|
|
this.originalFilePath = path
|
|
}
|
|
|
|
fun setOriginalLineNumber(lineNumber: MTMCToken) {
|
|
this.originaLineNumber = lineNumber
|
|
}
|
|
|
|
val originalLineNumber: Int
|
|
get() = this.originaLineNumber!!.intValue()
|
|
|
|
fun setGlobalInfo(name: MTMCToken, location: MTMCToken, type: MTMCToken) {
|
|
this.globalName = name
|
|
this.globalLocation = location
|
|
this.globalType = type
|
|
}
|
|
|
|
fun setLocalInfo(name: MTMCToken, offset: MTMCToken, type: MTMCToken) {
|
|
this.localName = name
|
|
this.localOffset = offset
|
|
this.localType = type
|
|
}
|
|
|
|
fun setEndLocalInfo(name: MTMCToken) {
|
|
this.localName = name
|
|
}
|
|
|
|
fun getOriginalFilePath(): String? {
|
|
return this.originalFilePath!!.stringValue
|
|
}
|
|
|
|
fun getGlobalName(): String? {
|
|
return this.globalName!!.stringValue
|
|
}
|
|
|
|
fun getGlobalLocation(): Int {
|
|
return this.globalLocation!!.intValue()
|
|
}
|
|
|
|
fun getGlobalType(): String? {
|
|
return this.globalType!!.stringValue
|
|
}
|
|
|
|
fun getLocalName(): String? {
|
|
return this.localName!!.stringValue
|
|
}
|
|
|
|
fun getLocalOffset(): Int {
|
|
return this.localOffset!!.intValue()
|
|
}
|
|
|
|
fun getLocalType(): String? {
|
|
return this.localType!!.stringValue
|
|
}
|
|
}
|