Class SourceRegions

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

public final class SourceRegions extends Object
THE reader of the region and elide markers in a compiled example source (site-examples spec ยง3.4, decision D5) - every page fragment is cut from a whole, compiled source through here; never parse the markers anywhere else.
  // region: anatomy          a region a page may show:  classes/classes_anatomy.ek9#anatomy
  // end region: anatomy
  // elide: constructors      lines the page shows as ONE comment, "// ... constructors"
  // end elide: constructors

A marker is an EK9 comment WITH text (a bare // line is a syntax error), so the source still compiles exactly as written. Regions may nest, and a region name is unique within its file. An elided run is rendered as ONE comment line at the marker's indentation, // ... <name> - never a bare ... line, which is EK9's range operator, does not compile, and would teach a model that it is legal (Steve, D5).

Two views of one source, each a class to hold an instance of (no statics, Steve 2026-10-28):

  • SourceRegionExtract - what a page shows: a region (or the whole body), markers removed, elided runs collapsed, dedented to its least-indented line;
  • SourceRegionFull - the "full source" page: every line, markers removed, with the line each region starts on so the page can carry an id per region.

SourceRegionProblems checks the markers and SourceRegionNames lists the regions.

  • Field Details

    • MARKER

      static final Pattern MARKER
    • REGION_NAME

      static final Pattern REGION_NAME