code cleanup

This commit is contained in:
Alex Zenla
2025-07-26 15:49:44 -07:00
parent a262c09219
commit 08f9b6f2ae
14 changed files with 15 additions and 36 deletions

View File

@ -6,11 +6,7 @@ import gay.pizza.pork.ast.gen.NodeType
import gay.pizza.pork.tokenizer.*
abstract class ParserBase(source: TokenSource, val attribution: NodeAttribution) : NodeParser {
val source: TokenSource = if (source is ParserAwareTokenSource) {
source
} else {
LazySkippingTokenSource(source, TokenType.ParserIgnoredTypes)
}
val source: TokenSource = source as? ParserAwareTokenSource ?: LazySkippingTokenSource(source, TokenType.ParserIgnoredTypes)
@Suppress("NOTHING_TO_INLINE")
protected inline fun <T: Node> produce(type: NodeType, noinline block: () -> T): T =