mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 21:21:33 +00:00
rework some bits of the compiler to work more appropriately
This commit is contained in:
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user