Class IrDirectiveText

java.lang.Object
org.ek9lang.compiler.directives.IrDirectiveText

final class IrDirectiveText extends Object
THE normalisation applied to generated @IR / @IR_PARAMETERISED golden content before it is compared against - or emitted into - a directive body.

A directive body in a .ek9 file is backtick-delimited, so a literal backtick inside the generated IR would prematurely close the directive and break parsing of the whole source file. The one place this occurs today is the `expr` quoting inside a require failure's Panic message (e.g. Requirement failed: `count >= 0` at ...). Mirror the bytecode side (see BytecodeNormalizer, which does the identical substitution for the same reason): represent a backtick as the token BACKTICK in the golden, and apply the same substitution to generated IR before both the line comparison and the update-block emission so the two always agree.

  • Method Details

    • forDirective

      static String forDirective(String generatedIr)
      Normalise generated IR text for use as (or comparison against) a backtick-delimited directive.