Class BinaryExpressions

java.lang.Object
org.ek9lang.compiler.phase1.BinaryExpressions

final class BinaryExpressions extends Object
THE reading of a binary or prefix expression alternative for the phase-1 operand-parentheses checks - E08269 (CoalescingOperandParenthesesOrError), E08273 (NotOperandParenthesesOrError) and E08274 (DoubleNegationOrError). Use its parts for any further rule over an operator's operand rather than another private copy; hold the ones a check needs.

A binary expression is any alternative with both a left and a right operand (IsBinaryExpression; its operator BinaryOperatorOf). A prefix expression is one of the symbol/word prefix alternatives of EK9.g4 (PREFIX_OPERATORS) with no left (IsPrefixExpression; its operand PrefixOperandOf). Word not is a prefix too, but it is the loose negation and is read on its own (IsWordNot). A negation - word not, ~ or unary - - is IsNegation, what it negates NegatedOperandOf, the negation an operand is under NegationApplyingTo, and a literal spelt with a sign IsSignedLiteral. A parenthesised operand is a primary, so it is never a binary or prefix expression here (WithoutParentheses looks through it). The source of an operand as written is support.SourceText.

This class keeps only the prefix operator set and the signpost; its parts were its static methods until no-statics lane P1 (2026-10-29).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final Set<Integer>
    The prefix operators of expression other than word not, exactly as EK9.g4 lists them: $$ (TOJSON), $ (DOLLAR), #^ (PROMOTE), length [of], #< (PREFIX), #> (SUFFIX), #? (HASHCODE), abs [of], sqrt [of], ~ (TILDE) and unary - (SUB with no left operand).
  • Method Summary

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PREFIX_OPERATORS

      static final Set<Integer> PREFIX_OPERATORS
      The prefix operators of expression other than word not, exactly as EK9.g4 lists them: $$ (TOJSON), $ (DOLLAR), #^ (PROMOTE), length [of], #< (PREFIX), #> (SUFFIX), #? (HASHCODE), abs [of], sqrt [of], ~ (TILDE) and unary - (SUB with no left operand). Pinned against the grammar by BinaryExpressionsTest.