Class MagicLiteralExemptions

java.lang.Object
org.ek9lang.compiler.phase5.MagicLiteralExemptions
All Implemented Interfaces:
Predicate<org.antlr.v4.runtime.tree.ParseTree>

final class MagicLiteralExemptions extends Object implements Predicate<org.antlr.v4.runtime.tree.ParseTree>
THE contexts in which a literal is never a magic literal, for both magic-literal checks (E11064, a number in a comparison, and E11065, a repeated String): the fix itself (a constant declaration), a pre/post-condition (require, assert), a constrain declaration, and a NAMED argument - the label documents the value and the compiler checks it against the declared parameter (E06240/E06250), so it cannot lie.

The test is: is a literal that has this node among its ancestors exempt from every magic-literal check? A check with further exemptions of its own (E11065 also exempts list, dict and range literals and string concatenation) holds one of these, asks it and adds them, so what the two share is one list and what differs is one visible difference (F10, 2026-10-20: it was two copies that had drifted). A constructor call is not an exemption (D4) - label it. Was the static isExemptNode (no-statics lane P2, 2026-10-29).

  • Constructor Details

    • MagicLiteralExemptions

      MagicLiteralExemptions()
  • Method Details

    • test

      public boolean test(org.antlr.v4.runtime.tree.ParseTree node)
      Specified by:
      test in interface Predicate<org.antlr.v4.runtime.tree.ParseTree>