Class OperatorPositionMap

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

public final class OperatorPositionMap extends Object
Maps EK9 operators to their syntactic position (prefix vs suffix/postfix). Used to detect when operators are used in the wrong position and provide helpful error messages.

In EK9:

  • PREFIX operators come BEFORE the expression: #< list, $ value, ~ number
  • SUFFIX operators come AFTER the expression: value?

Common mistakes this helps detect:

  • list#< instead of #< list
  • value$ instead of $value
  • ?value instead of value?
  • Method Details

    • isPrefixOperator

      public static boolean isPrefixOperator(String operator)
      Check if an operator is a prefix operator (must come BEFORE expression).
    • isSuffixOperator

      public static boolean isSuffixOperator(String operator)
      Check if an operator is a suffix operator (must come AFTER expression).
    • isPositionSensitiveOperator

      public static boolean isPositionSensitiveOperator(String operator)
      Check if this is a position-sensitive operator (either prefix or suffix).