void (int type) { final String tokenValue = switch (type) { case NUMBER -> { final StringBuilder value = new StringBuilder(); iterateWhile(Character::isDigit, value::append); yield value.toString(); } default -> throw new IllegalStateException("Unexpected value: " + type); }; }