public long classLoaderLocation;
public String defaultLocalName;
public List<EVar> export;
+
// Features
public boolean chr;
public boolean fields;
break;
case "export":
if(assignment.value == null)
- errorLog.log(assignment.location, "Property export needs to be given a string list value.");
+ errorLog.log(assignment.location, "Property export needs to be given a list of exported symbols.");
else {
export = AnnotationUtils.extractIdentifierList(assignment.value);
if(export == null)
- errorLog.log(assignment.value.location, "Expected a list of exported items.");
+ errorLog.log(assignment.value.location, "Expected a list of exported symbols.");
+ }
+ break;
+ case "features":
+ if(assignment.value == null)
+ errorLog.log(assignment.location, "Property features needs to be given a list of features (identifiers).");
+ else {
+ List<EVar> features = AnnotationUtils.extractIdentifierList(assignment.value);
+ if(features == null)
+ errorLog.log(assignment.value.location, "Expected a list of features (identifiers).");
+ for(EVar feature : features)
+ handleFeature(errorLog, feature);
}
break;
case "defaultLocalName":
- if(assignment.value == null)
+ if(assignment.value == null)
errorLog.log(assignment.location, "Property defaultLocalName needs to be given a string value.");
- else {
- defaultLocalName = AnnotationUtils.extractString(assignment.value);
- if(defaultLocalName == null)
- errorLog.log(assignment.value.location, "Expected string here.");
- }
- break;
- case "fields":
- if(assignment.value != null)
- errorLog.log(assignment.location, "No value expected for property fields.");
- this.fields = true;
+ else {
+ defaultLocalName = AnnotationUtils.extractString(assignment.value);
+ if(defaultLocalName == null)
+ errorLog.log(assignment.value.location, "Expected string here.");
+ }
break;
- case "chr":
- if(assignment.value != null)
- errorLog.log(assignment.location, "No value expected for property chr.");
- this.chr = true;
- break;
default:
errorLog.logWarning(assignment.location, "Unknown module header field was skipped.");
}
}
+ private void handleFeature(ErrorLog errorLog, EVar feature) {
+ switch(feature.name) {
+ case "chr": chr = true; break;
+ case "fields": fields = true; break;
+ default:
+ errorLog.log(feature.location, "Unknown feature " + feature.name + ".");
+ }
+ }
+
public static ModuleHeader process(ErrorLog errorLog, FieldAssignment[] fields) {
if(fields == null)
return null;
-module { export = [main], chr }
+module { export = [main], features = [chr] }
import "StandardLibrary"
main = ()
1.0
()
--
-module { export = [main], chr }
+module { export = [main], features = [chr] }
import "StandardLibrary"
main = ()
--
7:13-7:26: Field y not defined.
--
-module { export = [main], chr }
+module { export = [main], features = [chr] }
import "StandardLibrary"
--
8:13-8:35: Relation V does not define field names.
--
-module { export = [main], chr }
+module { export = [main], features = [chr] }
import "StandardLibrary"