@Override
        void process(GlobToRegex converter, char c) {
          if (c == ']') {
            // A glob like "[]]" or "[]q]" is apparently fine in Unix (when used with ls for
            // example) but doesn't work for the default java.nio.file implementations. In the cases
            // of "[]]" it produces:
            // java.util.regex.PatternSyntaxException: Unclosed character class near index 13
            // ^[[^/]&&[]]\]$
            //              ^
            // The error here is slightly different, but trying to make this work would require some
            // kind of lookahead and break the simplicity of char-by-char conversion here. Also, if
            // someone wants to include a ']' inside a character class, they should escape it.
            throw converter.syntaxError("Empty []");
          }
          if (c == '!') {
            converter.appendExact('^');
          } else if (c == '-') {
            converter.appendExact(c);
          } else {
            converter.appendInBracket(c);
          }
          converter.popState();
          converter.pushState(BRACKET);
        }
State immediately following the reading of a [.
jimfs/src/main/java/com/google/common/jimfs/GlobToRegex.java