src/language-css/parser-postcss.js/parseNestedCSS
function parseNestedCSS(node) {
  if (node && typeof node === "object") {
    delete node.parent;

    for (const key in node) {
      parseNestedCSS(node[key]);
    }

    if (typeof node.selector === "string" && node.selector.trim().length > 0) {
      let selector = node.raws.selector
        ? node.raws.selector.raw
        : node.selector;

      if (node.raws.between && node.raws.between.trim()) {
        selector += node.raws.between;
      }

      if (selector.startsWith("@") && selector.endsWith(":")) {
        return node;
      }

      try {
        node.selector = parseSelector(selector);
      } catch (e) {
        // Fail silently. It's better to print it as is than to try and parse it
        // Note: A common failure is for SCSS nested properties. `background:
        // none { color: red; }` is parsed as a NestedDeclaration by
        // postcss-scss, while `background: { color: red; }` is parsed as a Rule
        // with a selector ending with a colon. See:
        // https://github.com/postcss/postcss-scss/issues/39
        node.selector = {
          type: "selector-root-invalid",
          value: selector
        };
      }

      return node;
    }

    if (
      node.type &&
      node.type !== "css-comment-yaml" &&
      typeof node.value === "string" &&
      node.value.trim().length > 0
    ) {
      try {
        let value = node.raws.value ? node.raws.value.raw : node.value;

        const defaultSCSSDirectiveIndex = value.match(DEFAULT_SCSS_DIRECTIVE);

        if (defaultSCSSDirectiveIndex) {
          value = value.substring(0, defaultSCSSDirectiveIndex.index);
          node.scssDefault = true;

          if (defaultSCSSDirectiveIndex[0].trim() !== "!default") {
            node.raws.scssDefault = defaultSCSSDirectiveIndex[0];
          }
        }

        const globalSCSSDirectiveIndex = value.match(GLOBAL_SCSS_DIRECTIVE);

        if (globalSCSSDirectiveIndex) {
          value = value.substring(0, globalSCSSDirectiveIndex.index);
          node.scssGlobal = true;

          if (globalSCSSDirectiveIndex[0].trim() !== "!global") {
            node.raws.scssGlobal = globalSCSSDirectiveIndex[0];
          }
        }

        if (value.startsWith("progid:")) {
          return node;
        }

        node.value = parseValue(value);
      } catch (e) {
        throw createError(
          "(postcss-values-parser) " + e.toString(),
          node.source
        );
      }

      return node;
    }

    if (node.type === "css-atrule" && typeof node.params === "string") {
      let params =
        node.raws.params && node.raws.params.raw
          ? node.raws.params.raw
          : node.params;

      if (node.raws.afterName.trim()) {
        params = node.raws.afterName + params;
      }

      if (node.raws.between.trim()) {
        params = params + node.raws.between;
      }

      params = params.trim();

      if (params.length === 0) {
        return node;
      }

      const name = node.name;
      const lowercasedName = node.name.toLowerCase();

      if (name === "warn" || name === "error") {
        node.params = {
          type: "media-unknown",
          value: params
        };

        return node;
      }

      if (name === "extend" || name === "nest") {
        node.selector = parseSelector(params);
        delete node.params;

        return node;
      }

      if (name === "at-root") {
        if (/^\(\s*(without|with)\s*:[\s\S]+\)$/.test(params)) {
          node.params = parseMediaQuery(params);
        } else {
          node.selector = parseSelector(params);
          delete node.params;
        }

        return node;
      }

      if (
        [
          "if",
          "else",
          "for",
          "each",
          "while",
          "debug",
          "mixin",
          "include",
          "function",
          "return",
          "define-mixin",
          "add-mixin"
        ].indexOf(name) !== -1
      ) {
        // Remove unnecessary spaces in SCSS variable arguments
        params = params.replace(/(\$\S+?)\s+?\.\.\./, "$1...");
        // Remove unnecessary spaces before SCSS control, mixin and function directives
        params = params.replace(/^(?!if)(\S+)\s+\(/, "$1(");

        node.value = parseValue(params);
        delete node.params;

        return node;
      }

      if (name === "custom-selector") {
        const customSelector = params.match(/:--\S+?\s+/)[0].trim();

        node.customSelector = customSelector;
        node.selector = parseSelector(params.substring(customSelector.length));
        delete node.params;

        return node;
      }

      if (
        ["namespace", "import", "media", "supports", "custom-media"].indexOf(
          lowercasedName
        ) !== -1
      ) {
        if (params.includes("#{")) {
          // Workaround for media at rule with scss interpolation
          return {
            type: "media-unknown",
            value: params
          };
        }

        node.params = parseMediaQuery(params);

        return node;
      }

      node.params = params;

      return node;
    }
  }

  return node;
}