Renderer

class Renderer(val maxWidth: Int, val colorApplyPrefix: Attrs, val colorLiteral: Attrs, val indentStep: Int)

Basically like mkString, but for nested iterators. Used whenever you want to put stuff "in between" the elements of the larger iterator

Kotlin Note: In general I have chosen to represent things with Iterators but I need to use .asSequence() when I want to perform map, flatMap, filter etc... operators on the interator because Kotlin iterators don't support these operators. The other option would be to make everything a Sequence instead of an iterator but the problem with that is that Sequence does not support a the .next() and .hasNext() operators. Now we could go down to the Sequence.iterator() level and call these operators but the problem with that is if you go back up to an iterator by doing Sequence.iterator().{stuff}.asSequence() and then do .iterator() on the result of that again, you can only call the .iterator() on it once. This is because Iterator.asSequence() calls a Sequence { this }.constrainOnce() operation which creates a sequence whose .iterator() function can only be call once (have a look at Sequences.kt for more info). This make sense because if you mess around calling methods of an iterator of a once-only sequence unexpected things will happen to that sequence. The only probelm is that the we are doing .asSequence() on that ConcatIterator which means we can't do concatIterator.asSequence().{stuff}.hasNext() and then .next() on it. The way to work around that would be to write a custom .asSequenceMulti operator on ConcatIterator which returns a sequence whose iterator can be returned many times. This might be fine with how ConcatIterator works. If there are problems with the current approach of converting to a sequence whenver a .map/filter/flatMap call is needed we can take a look at that approach.

Constructors

Link copied to clipboard
constructor(maxWidth: Int, colorApplyPrefix: Attrs, colorLiteral: Attrs, indentStep: Int)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun rec(x: Tree, leftOffset: Int, indentCount: Int): Result