Class ProbeDirective

java.lang.Object
org.ek9lang.compiler.directives.ProbeDirective
All Implemented Interfaces:
Directive

public class ProbeDirective extends Object implements Directive
To be used in EK9 source code to assert that the Oracle query at a specific line produces the expected JSON output. This validates the exact data an LLM would receive when querying the compiler about a symbol via MCP or the ek9 -ai REPL.
@Probe: PRE_IR_CHECKS: `{"name":"Counter","genus":"CLASS"}`
The directive applies to the next line in the source — the line where the symbol is declared. The listener resolves the symbol at that line using LocationResolver, extracts symbol info via SymbolInfoExtractor, and compares the JSON output line-by-line against the expected JSON.
  • Constructor Details

    • ProbeDirective

      public ProbeDirective(IToken token, CompilationPhase phase, String expectedJson, int lineNumber)
      A new probe directive for Oracle JSON validation.
  • Method Details

    • type

      public DirectiveType type()
      Description copied from interface: Directive
      What s the type of the directive.
      Specified by:
      type in interface Directive
    • isForPhase

      public boolean isForPhase(CompilationPhase phase)
      Description copied from interface: Directive
      Is it for the particular compiler phase.
      Specified by:
      isForPhase in interface Directive
    • getExpectedJson

      public String getExpectedJson()
    • getDirectiveToken

      public IToken getDirectiveToken()
      Description copied from interface: Directive
      Provide a token from the source, by default if not possible supply synthetic.
      Specified by:
      getDirectiveToken in interface Directive
    • getAppliesToLineNumber

      public int getAppliesToLineNumber()
      Description copied from interface: Directive
      Which line number does this directive apply to.
      Specified by:
      getAppliesToLineNumber in interface Directive
    • toString

      public String toString()
      Overrides:
      toString in class Object