added frontend compile phase

This commit is contained in:
2026-03-24 13:42:15 +00:00
parent 31c59f670e
commit c7c6c8bef5
18 changed files with 107 additions and 28 deletions
@@ -1,31 +1,31 @@
package p.studio.compiler;
import p.studio.compiler.models.FrontendSpec;
import p.studio.compiler.services.FrontendPhaseService;
import p.studio.compiler.services.PBSFrontendPhaseService;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
public class FrontendRegistryService {
private static final FrontendSpec[] FRONTEND_SPECS = {
PBSDefinitions.PBS,
};
private static final Map<String, FrontendSpec> FRONTENDS = new HashMap<>();
private static final Map<String, FrontendSpec> FRONTEND_SPECS = new HashMap<>();
private static final Map<String, FrontendPhaseService> FRONTEND_PHASE_SERVICES = new HashMap<>();
static {
for (final var frontendSpec : FRONTEND_SPECS) {
FRONTENDS.put(frontendSpec.getLanguageId(), frontendSpec);
}
if (FRONTENDS.size() != FRONTEND_SPECS.length)
throw new IllegalStateException("Duplicate frontend specs found");
FRONTEND_SPECS.put(PBSDefinitions.PBS.getLanguageId(), PBSDefinitions.PBS);
FRONTEND_PHASE_SERVICES.put(PBSDefinitions.PBS.getLanguageId(), new PBSFrontendPhaseService());
}
public static FrontendSpec getDefaultFrontendSpec() {
return FRONTENDS.get(PBSDefinitions.PBS.getLanguageId());
return FRONTEND_SPECS.get(PBSDefinitions.PBS.getLanguageId());
}
public static Optional<FrontendSpec> getFrontendSpec(final String languageId) {
return Optional.ofNullable(FRONTENDS.get(languageId));
return Optional.ofNullable(FRONTEND_SPECS.get(languageId));
}
public static Optional<FrontendPhaseService> getFrontendPhaseService(final String languageId) {
return Optional.ofNullable(FRONTEND_PHASE_SERVICES.get(languageId));
}
}