public class TokenUtil
extends Object
Utility methods for working with tokens and operators. Provides helper functions for operator type manipulation and conversion.
| 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. |
Converts an increment or decrement operator to its corresponding assignment operator.
For example, ++ becomes +=, and -- becomes -=.
op - the operator type (e.g., Types.PLUS_PLUS, Types.PREFIX_PLUS_PLUS) 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.
op - the operator type from Types