+ temporarily hack together a module name inside Prog8Parser.parseModule, to make the current all-too-simple import resolution work

This commit is contained in:
meisl 2021-06-21 20:09:50 +02:00
parent 4096aae8d4
commit 44da7a302f

View File

@ -39,9 +39,19 @@ object Prog8Parser {
parser.addErrorListener(antlrErrorListener)
val parseTree = parser.module()
val moduleName = "anonymous"
val module = parseTree.toAst(moduleName, Path(""), PetsciiEncoding)
// FIXME: hacking together a name for the module:
var moduleName = src.origin
if (moduleName.startsWith("<res:")) {
moduleName = Path(moduleName.substring(5, moduleName.length - 1))
.fileName.toString()
} else if (!moduleName.startsWith("<")) {
moduleName = Path(moduleName).fileName.toString()
}
moduleName = moduleName.substringBeforeLast('.')
val module = parseTree.toAst(moduleName, source = Path(""), PetsciiEncoding)
// TODO: use Module ctor directly
for (statement in module.statements) {