class CmakeOutputParser implements BuildOutputParser {

  @VisibleForTesting
  static ErrorFields matchErrorFileAndLineNumberErrorParts(
    @NonNull Matcher matcher, @NonNull String line) {
    ErrorFields
      fields = new ErrorFields();
    fields.kind = MessageEvent.Kind.WARNING;
    if (matcher.group(1).equals(ERROR)) {
      fields.kind = MessageEvent.Kind.ERROR;
    }

    fields.lineNumber = 0;
    if (matcher.group(4) != null) {
      fields.lineNumber = Integer.valueOf(matcher.group(4));
    }

    fields.columnNumber = 0;
    if (matcher.group(6) != null) {
      fields.columnNumber = Integer.valueOf(matcher.group(6));
    }

    fields.errorMessage = line;
    if (matcher.group(7) != null) {
      fields.errorMessage = matcher.group(7).trim();
    }

    return fields;
  }

}