rework some bits of the compiler to work more appropriately

This commit is contained in:
Alex Zenla
2025-07-16 23:14:25 -07:00
parent 17b1aa44c0
commit a48fac4581
8 changed files with 27 additions and 6 deletions

View File

@ -1,5 +1,7 @@
package gay.pizza.pork.common
import java.util.stream.IntStream
class IndentBuffer(
val buffer: StringBuilder = StringBuilder(),
indent: String = " "
@ -13,4 +15,12 @@ class IndentBuffer(
}
override fun toString(): String = buffer.toString()
override fun chars(): IntStream {
return buffer.chars()
}
override fun codePoints(): IntStream {
return buffer.codePoints()
}
}

View File

@ -11,6 +11,11 @@ abstract class IndentTracked(val indent: String) {
emit(indentLevelText)
}
fun emitIndented(text: String) {
emitIndent()
emit(text)
}
fun emitIndentedLine(line: String) {
emitIndent()
emitLine(line)