|
@@ -5,34 +5,21 @@
|
5
|
5
|
*/
|
6
|
6
|
package org.openzen.zencode.java;
|
7
|
7
|
|
8
|
|
-import java.io.File;
|
9
|
|
-import java.io.IOException;
|
10
|
|
-import java.util.ArrayList;
|
11
|
|
-import java.util.Collections;
|
12
|
|
-import java.util.List;
|
13
|
|
-import java.util.Map;
|
14
|
|
-import java.util.function.Consumer;
|
|
8
|
+import org.openzen.zencode.shared.*;
|
|
9
|
+import org.openzen.zenscript.codemodel.*;
|
|
10
|
+import org.openzen.zenscript.codemodel.context.*;
|
|
11
|
+import org.openzen.zenscript.codemodel.definition.*;
|
|
12
|
+import org.openzen.zenscript.codemodel.type.*;
|
|
13
|
+import org.openzen.zenscript.codemodel.type.storage.*;
|
|
14
|
+import org.openzen.zenscript.javabytecode.*;
|
|
15
|
+import org.openzen.zenscript.javashared.*;
|
|
16
|
+import org.openzen.zenscript.lexer.*;
|
|
17
|
+import org.openzen.zenscript.parser.*;
|
|
18
|
+import org.openzen.zenscript.validator.*;
|
15
|
19
|
|
16
|
|
-import org.openzen.zencode.shared.CompileException;
|
17
|
|
-import org.openzen.zencode.shared.SourceFile;
|
18
|
|
-import org.openzen.zenscript.codemodel.FunctionParameter;
|
19
|
|
-import org.openzen.zenscript.codemodel.Module;
|
20
|
|
-import org.openzen.zenscript.codemodel.ModuleSpace;
|
21
|
|
-import org.openzen.zenscript.codemodel.SemanticModule;
|
22
|
|
-import org.openzen.zenscript.codemodel.context.CompilingPackage;
|
23
|
|
-import org.openzen.zenscript.codemodel.definition.ZSPackage;
|
24
|
|
-import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
|
25
|
|
-import org.openzen.zenscript.codemodel.type.ISymbol;
|
26
|
|
-import org.openzen.zenscript.codemodel.type.storage.StorageType;
|
27
|
|
-import org.openzen.zenscript.javabytecode.JavaBytecodeRunUnit;
|
28
|
|
-import org.openzen.zenscript.javabytecode.JavaCompiler;
|
29
|
|
-import org.openzen.zenscript.javashared.SimpleJavaCompileSpace;
|
30
|
|
-import org.openzen.zenscript.lexer.ParseException;
|
31
|
|
-import org.openzen.zenscript.parser.BracketExpressionParser;
|
32
|
|
-import org.openzen.zenscript.parser.ParsedFile;
|
33
|
|
-import org.openzen.zenscript.parser.ZippedPackage;
|
34
|
|
-import org.openzen.zenscript.validator.ValidationLogEntry;
|
35
|
|
-import org.openzen.zenscript.validator.Validator;
|
|
20
|
+import java.io.*;
|
|
21
|
+import java.util.*;
|
|
22
|
+import java.util.function.*;
|
36
|
23
|
|
37
|
24
|
/**
|
38
|
25
|
*
|
|
@@ -57,14 +44,10 @@ public class ScriptingEngine {
|
57
|
44
|
SemanticModule stdlibModule = stdlibs.loadModule(space, "stdlib", null, new SemanticModule[0], FunctionParameter.NONE, stdlib);
|
58
|
45
|
stdlibModule = Validator.validate(stdlibModule, error -> System.out.println(error.toString()));
|
59
|
46
|
space.addModule("stdlib", stdlibModule);
|
60
|
|
- } catch (IOException ex) {
|
61
|
|
- throw new RuntimeException(ex);
|
62
|
|
- } catch (CompileException ex) {
|
63
|
|
- throw new RuntimeException(ex);
|
64
|
|
- } catch (ParseException ex) {
|
|
47
|
+ } catch (IOException | CompileException | ParseException ex) {
|
65
|
48
|
throw new RuntimeException(ex);
|
66
|
49
|
}
|
67
|
|
- }
|
|
50
|
+ }
|
68
|
51
|
|
69
|
52
|
public JavaNativeModule createNativeModule(String name, String basePackage, JavaNativeModule... dependencies) {
|
70
|
53
|
ZSPackage testPackage = new ZSPackage(space.rootPackage, name);
|
|
@@ -73,8 +56,7 @@ public class ScriptingEngine {
|
73
|
56
|
|
74
|
57
|
public void registerNativeProvided(JavaNativeModule module) throws CompileException {
|
75
|
58
|
SemanticModule semantic = Validator.validate(
|
76
|
|
- module.toSemantic(space),
|
77
|
|
- entry -> System.out.println(entry));
|
|
59
|
+ module.toSemantic(space), System.out::println);
|
78
|
60
|
if (!semantic.isValid())
|
79
|
61
|
return;
|
80
|
62
|
|