update shell
This commit is contained in:
+3
@@ -3,6 +3,8 @@ package p.studio.compiler;
|
||||
import p.studio.compiler.models.FrontendSpec;
|
||||
import p.studio.utilities.structures.ReadOnlySet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PBSDefinitions {
|
||||
public static final FrontendSpec PBS = FrontendSpec
|
||||
.builder()
|
||||
@@ -10,5 +12,6 @@ public class PBSDefinitions {
|
||||
.allowedExtensions(ReadOnlySet.from("pbs", "barrel"))
|
||||
.sourceRoots(ReadOnlySet.from("src"))
|
||||
.entryPointCallableName("frame")
|
||||
.stdlibVersions(List.of(FrontendSpec.Stdlib.asDefault(1)))
|
||||
.build();
|
||||
}
|
||||
|
||||
+28
@@ -4,6 +4,8 @@ import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import p.studio.utilities.structures.ReadOnlySet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
public class FrontendSpec {
|
||||
@@ -13,8 +15,34 @@ public class FrontendSpec {
|
||||
private final boolean caseSensitive;
|
||||
@Builder.Default
|
||||
private final String entryPointCallableName = "main";
|
||||
@Builder.Default
|
||||
private final List<Stdlib> stdlibVersions = List.of();
|
||||
|
||||
public String toString() {
|
||||
return String.format("FrontendSpec(language=%s, entryPoint=%s)", languageId, entryPointCallableName);
|
||||
}
|
||||
|
||||
public enum StdlibType {
|
||||
DEFAULT,
|
||||
STABLE,
|
||||
EXPERIMENTAL,
|
||||
}
|
||||
|
||||
public record Stdlib(int version, StdlibType type) {
|
||||
public static Stdlib asDefault(final int version) {
|
||||
return new Stdlib(version, StdlibType.DEFAULT);
|
||||
}
|
||||
|
||||
public static Stdlib asStable(final int version) {
|
||||
return new Stdlib(version, StdlibType.STABLE);
|
||||
}
|
||||
|
||||
public static Stdlib of(final int version) {
|
||||
return asStable(version);
|
||||
}
|
||||
|
||||
public static Stdlib asExperimental(final int version) {
|
||||
return new Stdlib(version, StdlibType.EXPERIMENTAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-1
@@ -5,6 +5,7 @@ import p.studio.compiler.services.FrontendPhaseService;
|
||||
import p.studio.compiler.services.PBSFrontendPhaseService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -28,4 +29,10 @@ public class FrontendRegistryService {
|
||||
public static Optional<FrontendPhaseService> getFrontendPhaseService(final String languageId) {
|
||||
return Optional.ofNullable(FRONTEND_PHASE_SERVICES.get(languageId));
|
||||
}
|
||||
}
|
||||
|
||||
public static List<FrontendSpec> listFrontendSpecs() {
|
||||
return FRONTEND_SPECS.values().stream()
|
||||
.sorted((left, right) -> left.getLanguageId().compareToIgnoreCase(right.getLanguageId()))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user