From 4aa516f0fb232bb3cfc43f3b68e00c15b4b79125 Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Mon, 4 Sep 2023 02:38:09 -0700 Subject: [PATCH] Fix some overqualifications due to IDE renaming. --- .../main/kotlin/gay/pizza/pork/frontend/FsContentSource.kt | 3 ++- frontend/src/main/kotlin/gay/pizza/pork/frontend/World.kt | 3 ++- parser/src/main/kotlin/gay/pizza/pork/parser/Parser.kt | 4 +++- tool/src/main/kotlin/gay/pizza/pork/tool/FileTool.kt | 3 ++- tool/src/main/kotlin/gay/pizza/pork/tool/HighlightCommand.kt | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/frontend/src/main/kotlin/gay/pizza/pork/frontend/FsContentSource.kt b/frontend/src/main/kotlin/gay/pizza/pork/frontend/FsContentSource.kt index 9754c2f..505b241 100644 --- a/frontend/src/main/kotlin/gay/pizza/pork/frontend/FsContentSource.kt +++ b/frontend/src/main/kotlin/gay/pizza/pork/frontend/FsContentSource.kt @@ -1,12 +1,13 @@ package gay.pizza.pork.frontend +import gay.pizza.pork.parser.CharSource import gay.pizza.pork.parser.StringCharSource import java.nio.file.Path import kotlin.io.path.absolutePathString import kotlin.io.path.readText class FsContentSource(val root: Path) : ContentSource { - override fun loadAsCharSource(path: String): gay.pizza.pork.parser.CharSource = + override fun loadAsCharSource(path: String): CharSource = StringCharSource(asFsPath(path).readText()) override fun stableContentIdentity(path: String): String = diff --git a/frontend/src/main/kotlin/gay/pizza/pork/frontend/World.kt b/frontend/src/main/kotlin/gay/pizza/pork/frontend/World.kt index 68f5931..b1d8401 100644 --- a/frontend/src/main/kotlin/gay/pizza/pork/frontend/World.kt +++ b/frontend/src/main/kotlin/gay/pizza/pork/frontend/World.kt @@ -2,6 +2,7 @@ package gay.pizza.pork.frontend import gay.pizza.pork.ast.CompilationUnit import gay.pizza.pork.ast.ImportDeclaration +import gay.pizza.pork.parser.DiscardNodeAttribution import gay.pizza.pork.parser.Parser import gay.pizza.pork.parser.TokenStreamSource import gay.pizza.pork.parser.Tokenizer @@ -18,7 +19,7 @@ class World(val contentSource: ContentSource) { val charSource = contentSource.loadAsCharSource(path) val tokenizer = Tokenizer(charSource) val tokenStream = tokenizer.tokenize() - val parser = Parser(TokenStreamSource(tokenStream), gay.pizza.pork.parser.DiscardNodeAttribution) + val parser = Parser(TokenStreamSource(tokenStream), DiscardNodeAttribution) return parser.readCompilationUnit() } diff --git a/parser/src/main/kotlin/gay/pizza/pork/parser/Parser.kt b/parser/src/main/kotlin/gay/pizza/pork/parser/Parser.kt index 0f73352..2b86bf3 100644 --- a/parser/src/main/kotlin/gay/pizza/pork/parser/Parser.kt +++ b/parser/src/main/kotlin/gay/pizza/pork/parser/Parser.kt @@ -198,7 +198,9 @@ class Parser(source: PeekableSource, val attribution: NodeAttribution) { expect(TokenType.Func) val name = readSymbolRaw() expect(TokenType.LeftParentheses) - val arguments = collect(TokenType.RightParentheses, TokenType.Comma) { readSymbolRaw() } + val arguments = collect(TokenType.RightParentheses, TokenType.Comma) { + readSymbolRaw() + } expect(TokenType.RightParentheses) FunctionDefinition(modifiers, name, arguments, readBlock()) } diff --git a/tool/src/main/kotlin/gay/pizza/pork/tool/FileTool.kt b/tool/src/main/kotlin/gay/pizza/pork/tool/FileTool.kt index eb597cf..0f53e9a 100644 --- a/tool/src/main/kotlin/gay/pizza/pork/tool/FileTool.kt +++ b/tool/src/main/kotlin/gay/pizza/pork/tool/FileTool.kt @@ -2,12 +2,13 @@ package gay.pizza.pork.tool import gay.pizza.pork.frontend.ContentSource import gay.pizza.pork.frontend.FsContentSource +import gay.pizza.pork.parser.CharSource import gay.pizza.pork.parser.StringCharSource import java.nio.file.Path import kotlin.io.path.readText class FileTool(val path: Path) : Tool() { - override fun createCharSource(): gay.pizza.pork.parser.CharSource = StringCharSource(path.readText()) + override fun createCharSource(): CharSource = StringCharSource(path.readText()) override fun createContentSource(): ContentSource = FsContentSource(path.parent) override fun rootFilePath(): String = path.fileName.toString() } diff --git a/tool/src/main/kotlin/gay/pizza/pork/tool/HighlightCommand.kt b/tool/src/main/kotlin/gay/pizza/pork/tool/HighlightCommand.kt index a940f04..131b706 100644 --- a/tool/src/main/kotlin/gay/pizza/pork/tool/HighlightCommand.kt +++ b/tool/src/main/kotlin/gay/pizza/pork/tool/HighlightCommand.kt @@ -3,12 +3,13 @@ package gay.pizza.pork.tool import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.arguments.argument import com.github.ajalt.clikt.parameters.types.path +import gay.pizza.pork.parser.AnsiHighlightScheme class HighlightCommand : CliktCommand(help = "Syntax Highlighter", name = "highlight") { val path by argument("file").path(mustExist = true, canBeDir = false) override fun run() { val tool = FileTool(path) - print(tool.highlight(gay.pizza.pork.parser.AnsiHighlightScheme()).joinToString("")) + print(tool.highlight(AnsiHighlightScheme()).joinToString("")) } }