Skip to content

Instantly share code, notes, and snippets.

View rekendahl's full-sized avatar
:bowtie:

Robert Ekendahl rekendahl

:bowtie:
View GitHub Profile
@rekendahl
rekendahl / scratch.kt
Created November 3, 2017 16:12
Kotlin list merge example
if (defines[macroName]?.body?.isNotEmpty() == true) {
val mergedList = mutableListOf<Pair<IElementType?, String?>>()
for (tokenInfo in defines[macroName]?.body.orEmpty()) {
val tokenType = tokenInfo.first
val tokenName = tokenInfo.second
when (tokenType) {
CD_TICK_TICK -> {
val lastToken = mergedList.last()
mergedList.remove(lastToken)
val nextToken = defines[macroName]?.body?.iterator()?.next()