 var stdoutStream = StdOutStream()
 var diagnosticStream = ColoredANSIStream(&stdoutStream)
 
-private func diagnose(_ kind : DiagnosticKind, _ loc : CheckLoc, _ message : String) {
-  diagnosticStream.write("\(kind): ", with: [.bold, kind.color])
-  diagnosticStream.write("\(message)\n", with: [.bold])
+private func diagnose(_ kind : DiagnosticKind, at loc : CheckLoc, with message : String, options: FileCheckOptions) {
+  let disableColors = options.contains(.disableColors)
+  if disableColors {
+    print("\(kind): \(message)")
+  } else {
+    diagnosticStream.write("\(kind): ", with: [.bold, kind.color])
+    diagnosticStream.write("\(message)\n", with: [.bold])
+  }
+
   let msg = loc.message
   if !msg.isEmpty {
-    diagnosticStream.write("\(msg)\n")
-  }
-}
+    if disableColors {
+      print(msg)
+    } else {
+      diagnosticStream.write("\(msg)\n")
+    }
+  }
+}

        for (i, c) in name.characters.enumerated() {
          if i == 0 && c == "@" {
            if nameEnd == nil {
              diagnose(.error, diagLoc, "invalid name in named regex definition")
              return nil
            }
            isExpression = true
            continue
          }
          if c != "_" && isalnum(Int32(c.utf8CodePoint)) == 0 && (!isExpression || (c != "+" && c != "-")) {
            diagnose(.error, diagLoc, "invalid name in named regex")
            return nil
          }
        }

        // Name can't start with a digit.
        if isdigit(Int32(name.utf8.first!)) != 0 {
          diagnose(.error, diagLoc, "invalid name in named regex")
          return nil
        }


/// strings read from the check file.
///
/// Returns `false` if the input fails to satisfy the checks.
private func check(input b : String, against checkStrings : [CheckString], options: FileCheckOptions) -> Bool {
  var buffer = b
  var failedChecks = false

