Package: org.codehaus.groovy.syntax

## [Java] Class TokenUtil

- org.codehaus.groovy.syntax.TokenUtil

-     public class TokenUtil
      extends Object

  Utility methods for working with tokens and operators. Provides helper functions for operator type manipulation and conversion.

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static Optional<Token>` | `asAssignment(int op)` Converts an increment or decrement operator to its corresponding assignment operator.
    `` | `public static int` | `removeAssignment(int op)` Removes the assignment portion of an assignment operator, returning the base operator.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### public static Optional<Token> asAssignment(int op)

      Converts an increment or decrement operator to its corresponding assignment operator. For example, `++` becomes `+=`, and `--` becomes `-=`.

      Parameters:
        `op` - the operator type (e.g., `Types.PLUS_PLUS`, `Types.PREFIX_PLUS_PLUS`)
      Returns:
        an Optional containing the assignment operator token, or empty if not applicable

    - #### public static int removeAssignment(int op)

      Removes the assignment portion of an assignment operator, returning the base operator. For example, `+=` becomes `+`, `-=` becomes `-`. If the operator is not an assignment operator, returns it unchanged.

      Parameters:
        `op` - the operator type from Types
      Returns:
        the base operator type without assignment, or the original type if not an assignment operator