Class ExternSourceGenerator

java.lang.Object
org.ek9lang.compiler.common.ExternSourceGenerator

public class ExternSourceGenerator extends Object
Facade that combines ANTLR parsing with the ExternSourceVisitor to generate extern representations of EK9 source files. This is a key component for incremental builds: unchanged modules can be represented as extern source, avoiding full recompilation.
  • Constructor Details

    • ExternSourceGenerator

      public ExternSourceGenerator()
  • Method Details

    • generateExtern

      public Optional<String> generateExtern(File sourceFile)
      Parse a .ek9 file and return its extern representation.
      Parameters:
      sourceFile - The EK9 source file to process.
      Returns:
      Optional containing the extern source text, empty if parsing failed.
    • generateExtern

      public Optional<String> generateExtern(String filename, InputStream source)
      Parse from an InputStream and return the extern representation.
      Parameters:
      filename - The name to use for error reporting.
      source - The InputStream containing EK9 source code.
      Returns:
      Optional containing the extern source text, empty if parsing failed.