From ac02a9993448ed7f5f5e869aa28b9527cd6748ad Mon Sep 17 00:00:00 2001 From: meisl Date: Mon, 2 Aug 2021 09:15:11 +0200 Subject: [PATCH] * move ModuleImporter to prog8.compiler (package & module), together with its tests --- compiler/src/prog8/compiler/Compiler.kt | 1 - .../parser => compiler/src/prog8/compiler}/ModuleImporter.kt | 4 +++- .../test/ModuleImporterTests.kt | 2 +- compiler/test/fixtures/file_with_syntax_error.p8 | 2 ++ .../test/fixtures/import_file_with_syntax_error.p8 | 0 .../test/fixtures/import_import_nonexisting.p8 | 0 {compilerAst => compiler}/test/fixtures/import_nonexisting.p8 | 0 7 files changed, 6 insertions(+), 3 deletions(-) rename {compilerAst/src/prog8/parser => compiler/src/prog8/compiler}/ModuleImporter.kt (98%) rename compilerAst/test/TestModuleImporter.kt => compiler/test/ModuleImporterTests.kt (99%) create mode 100644 compiler/test/fixtures/file_with_syntax_error.p8 rename {compilerAst => compiler}/test/fixtures/import_file_with_syntax_error.p8 (100%) rename {compilerAst => compiler}/test/fixtures/import_import_nonexisting.p8 (100%) rename {compilerAst => compiler}/test/fixtures/import_nonexisting.p8 (100%) diff --git a/compiler/src/prog8/compiler/Compiler.kt b/compiler/src/prog8/compiler/Compiler.kt index 557b23a2a..e0ae421e1 100644 --- a/compiler/src/prog8/compiler/Compiler.kt +++ b/compiler/src/prog8/compiler/Compiler.kt @@ -16,7 +16,6 @@ import prog8.compiler.target.Cx16Target import prog8.compiler.target.ICompilationTarget import prog8.compiler.target.asmGeneratorFor import prog8.optimizer.* -import prog8.parser.ModuleImporter import prog8.parser.ParsingFailedError import java.io.File import java.io.InputStream diff --git a/compilerAst/src/prog8/parser/ModuleImporter.kt b/compiler/src/prog8/compiler/ModuleImporter.kt similarity index 98% rename from compilerAst/src/prog8/parser/ModuleImporter.kt rename to compiler/src/prog8/compiler/ModuleImporter.kt index fbb6ca3f1..c18e32cc3 100644 --- a/compilerAst/src/prog8/parser/ModuleImporter.kt +++ b/compiler/src/prog8/compiler/ModuleImporter.kt @@ -1,4 +1,4 @@ -package prog8.parser +package prog8.compiler import prog8.ast.Module import prog8.ast.Program @@ -6,6 +6,8 @@ import prog8.ast.base.Position import prog8.ast.base.SyntaxError import prog8.ast.statements.Directive import prog8.ast.statements.DirectiveArg +import prog8.parser.Prog8Parser +import prog8.parser.SourceCode import java.io.File import java.nio.file.Path import kotlin.io.FileSystemException diff --git a/compilerAst/test/TestModuleImporter.kt b/compiler/test/ModuleImporterTests.kt similarity index 99% rename from compilerAst/test/TestModuleImporter.kt rename to compiler/test/ModuleImporterTests.kt index 0f08b09d5..19cef532a 100644 --- a/compilerAst/test/TestModuleImporter.kt +++ b/compiler/test/ModuleImporterTests.kt @@ -15,7 +15,7 @@ import kotlin.io.path.* import prog8.ast.Program import prog8.parser.ParseError -import prog8.parser.ModuleImporter +import prog8.compiler.ModuleImporter import kotlin.test.assertContains diff --git a/compiler/test/fixtures/file_with_syntax_error.p8 b/compiler/test/fixtures/file_with_syntax_error.p8 new file mode 100644 index 000000000..6b9930fe0 --- /dev/null +++ b/compiler/test/fixtures/file_with_syntax_error.p8 @@ -0,0 +1,2 @@ +; test expects the following 2nd (!) line: +bad { } ; -> missing EOL at '}' (ie: *after* the '{') diff --git a/compilerAst/test/fixtures/import_file_with_syntax_error.p8 b/compiler/test/fixtures/import_file_with_syntax_error.p8 similarity index 100% rename from compilerAst/test/fixtures/import_file_with_syntax_error.p8 rename to compiler/test/fixtures/import_file_with_syntax_error.p8 diff --git a/compilerAst/test/fixtures/import_import_nonexisting.p8 b/compiler/test/fixtures/import_import_nonexisting.p8 similarity index 100% rename from compilerAst/test/fixtures/import_import_nonexisting.p8 rename to compiler/test/fixtures/import_import_nonexisting.p8 diff --git a/compilerAst/test/fixtures/import_nonexisting.p8 b/compiler/test/fixtures/import_nonexisting.p8 similarity index 100% rename from compilerAst/test/fixtures/import_nonexisting.p8 rename to compiler/test/fixtures/import_nonexisting.p8