Due date: August 18, 2019
Package
- kotlin.kak
Module
- kotlin.keywords
- kdoc.keywords
- kakoune.faces
- kakoune.commands
- kakoune.keys
Problem Domain
- Minimise the use of strings with a higher level of abstraction
- Correct indentation on keywords and tokens
- Loosely couple modules
Requirements
- Test with 80% coverage Kotlintest
- Documentation Kdoc
- Loading Kscript
- Sources referenced
- Open source repository
- Compatible with Kakoune v2019.07.01
Authorisation
- Me
- Myself, and
- I
Scope
- Syntax highlighting
- Kotlin keywords
- Kdoc keywords
- Regular expressions / tokens / white-space
Limitations
- Kakoune front-end API
- Bash shell
- Kotlin-stdlib
- Kdoc docstrings
- Kscript loading
Outside the scope [Future project]
inline fun <reified T : Enum<T>> enumKeywordAlternationGroup(decapitalize: Boolean): AlternationGroup {
return enumValues<T>()
.joinToString(prefix = "(", postfix = ")", separator = "|")
{ it.toString() }.also { when { decapitalize -> it.decapitalize() } }
}
fun keywordAlternationGroup(size: HowManyKeywords): AlternationGroup {
require(size > 0) { "$size > 0 is false" }
if (size < 2) return "(%s)"
val sb = StringBuilder()
for (k in 0 until size) {
val isFirst = { k == 0 }
val isLast = { k == size - 1 }
when {
isFirst() -> sb.append("(%s|")
isLast() -> sb.append("%s)")
else -> sb.append("%s|")
}
}
return sb.toString()
}
fun String.wordBoundaryFrontAndBack() = "\\b$this\\b"
Note:
[1] Still in the design phase hoping to move into TDD next week time permitting.