mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 21:21:33 +00:00
gradle: 8.4 and parser: lazy tokenization
This commit is contained in:
@ -22,14 +22,14 @@ abstract class Tool {
|
||||
val rootImportLocator: ImportLocator
|
||||
get() = ImportLocator("local", rootFilePath())
|
||||
|
||||
fun tokenize(): TokenStream =
|
||||
Tokenizer(createCharSource()).stream()
|
||||
fun tokenize(): LazyTokenSource =
|
||||
LazyTokenSource(Tokenizer(createCharSource()))
|
||||
|
||||
fun parse(attribution: NodeAttribution = DiscardNodeAttribution): CompilationUnit =
|
||||
Parser(TokenStreamSource(tokenize()), attribution).parseCompilationUnit()
|
||||
Parser(TokenStreamSource(tokenize().streamAllRemainingTokens()), attribution).parseCompilationUnit()
|
||||
|
||||
fun highlight(scheme: HighlightScheme): List<Highlight> =
|
||||
Highlighter(scheme).highlight(tokenize())
|
||||
Highlighter(scheme).highlight(tokenize().streamAllRemainingTokens())
|
||||
|
||||
fun reprint(): String = buildString { visit(Printer(this)) }
|
||||
|
||||
|
Reference in New Issue
Block a user