|
@@ -96,21 +96,23 @@ public class ScriptingEngine {
|
96
|
96
|
CompilingPackage scriptPackage = new CompilingPackage(new ZSPackage(space.rootPackage, name), scriptModule);
|
97
|
97
|
|
98
|
98
|
List<ParsedFile> files = new ArrayList<>();
|
99
|
|
- Predicate<ParsedFile> preProcessor = null;
|
100
|
|
- for(PreProcessor processor : preProcessors) {
|
101
|
|
- if(preProcessor == null) {
|
102
|
|
- preProcessor = processor;
|
103
|
|
- continue;
|
104
|
|
- }
|
105
|
|
- preProcessor = preProcessor.and(processor);
|
106
|
|
- }
|
107
|
|
- for (int i = 0; i < sources.length; i++) {
|
108
|
|
- sourceFileConsumer.accept(sources[i]);
|
|
99
|
+
|
|
100
|
+ for(int i = 0; i < sources.length; i++) {
|
|
101
|
+ boolean loadFile = true;
|
|
102
|
+ sourceFileConsumer.accept(sources[i]);
|
109
|
103
|
ParsedFile parsed = ParsedFile.parse(scriptPackage, bracketParser, sources[i]);
|
110
|
|
- if(preProcessor.test(parsed)){
|
|
104
|
+ for(PreProcessor processor : preProcessors) {
|
|
105
|
+ if(processor.test(parsed)) {
|
|
106
|
+ if(!processor.getCall().test(parsed)) {
|
|
107
|
+ loadFile = false;
|
|
108
|
+ }
|
|
109
|
+ // should we stop once we find we can't load it or go on??
|
|
110
|
+ }
|
|
111
|
+ }
|
|
112
|
+ if(loadFile) {
|
111
|
113
|
files.add(parsed);
|
112
|
114
|
}
|
113
|
|
- }
|
|
115
|
+ }
|
114
|
116
|
|
115
|
117
|
SemanticModule[] dependencyModules = new SemanticModule[dependencies.length + 1];
|
116
|
118
|
dependencyModules[0] = space.getModule("stdlib");
|