Class OperatorKeywordNameOrError

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

final class OperatorKeywordNameOrError extends Object implements Consumer<org.antlr.v4.runtime.tree.ParseTree>
Detects variable names that shadow operator keywords (E11032).

The EK9 grammar allows operator keywords like 'empty', 'length', 'contains' as identifiers for flexibility. However, using them as variable names shadows the corresponding operator — making it unusable in that scope and producing confusing downstream parse errors.

Real-world example: naming a variable 'empty' then trying 'numbers is empty' fails because the parser treats 'empty' as the variable, not the operator.

  • Constructor Details

  • Method Details

    • accept

      public void accept(org.antlr.v4.runtime.tree.ParseTree node)
      Specified by:
      accept in interface Consumer<org.antlr.v4.runtime.tree.ParseTree>