void (char ch) { MessageFormatElement element = new MessageFormatElement(); element.indexSegmentStart = current + 1; //skip { MessageFormatPart messageFormatPart = new MessageFormatPart(current, MessageFormatParsedType.FORMAT_ELEMENT, element); parts.add(messageFormatPart); messageFormatPart.text.append(ch); } private void addChar(char ch) { getLastPart().add(ch); } private boolean moveSegmentOfFormatElement() { MessageFormatPart part = getLastPart(); if (part.parsedType != MessageFormatParsedType.FORMAT_ELEMENT || part.messageFormatElement == null || !part.messageFormatElement.tryMoveSegment(this)) { return false; } part.text.append(','); return true; } private void finishFormatElement(char ch) { MessageFormatPart part = getLastPart(); part.text.append(ch); if (part.messageFormatElement != null) { part.messageFormatElement.finish(this); } startStringElement(); } private void addError(@NotNull MessageFormatErrorType errorType, int from, int until) { if (!hasRuntimeError) { errors.add(new MessageFormatError(errorType, from, until)); } if (errorType.severity == ErrorSeverity.RUNTIME_EXCEPTION) { hasRuntimeError = true; } } private void merge(@NotNull MessageHolder subHolder, int start) { List<MessageFormatError> errors = subHolder.getErrors(); for (MessageFormatError error : rearrangeErrors(errors, this.pattern, subHolder.pattern, start)) { addError(error.errorType, error.fromIndex, error.toIndex); } for (MessageFormatPart part : subHolder.parts) { part.start += start; MessageFormatElement nestedMessageFormatElement = part.messageFormatElement; if (nestedMessageFormatElement != null) { nestedMessageFormatElement.indexSegmentStart += start; nestedMessageFormatElement.formatTypeSegmentStart += start; nestedMessageFormatElement.formatStyleSegmentStart += start; } this.parts.add(part); } } }