extractNamespace = function(line, pattern, opt_antiPattern) {
    var pos = line.indexOf(pattern);
    if (pos == 0) {
      if (opt_antiPattern && line.indexOf(opt_antiPattern) == 0) {
        return null;
      }
      return line.substring(
          pos + pattern.length + 2, line.indexOf(';', pos) - 2);
    }
    return null;
  }
@param {string} line
@param {string} pattern Pattern to look for, e.g. goog.module(...).
@param {string=} opt_antiPattern Pattern to ignore if it shared same prefix
    as pattern, e.g. goog.module.declareLegacyNamespace.
@return {?string} Extracted namespace or null.