mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 16:29:21 +00:00
+ temporarily hack together a module name inside Prog8Parser.parseModule, to make the current all-too-simple import resolution work
This commit is contained in:
parent
4096aae8d4
commit
44da7a302f
@ -39,9 +39,19 @@ object Prog8Parser {
|
|||||||
parser.addErrorListener(antlrErrorListener)
|
parser.addErrorListener(antlrErrorListener)
|
||||||
|
|
||||||
val parseTree = parser.module()
|
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
|
// TODO: use Module ctor directly
|
||||||
|
|
||||||
for (statement in module.statements) {
|
for (statement in module.statements) {
|
||||||
|
Loading…
Reference in New Issue
Block a user