ruleset method

Ruleset ruleset ()

A Ruleset is something like:

div, .class, body > p {...}

It has selectors and rules:

selectors { rules }

Implementation

Ruleset ruleset() {
  DebugInfo debugInfo;
  List<Node> rules;

  parserInput.save();

  if (isNotEmpty(context.dumpLineNumbers)) {
    debugInfo = getDebugInfo(parserInput.i);
  }

  final List<Selector> selectors = this.selectors();

  if (selectors != null && (rules = block()) != null) {
    parserInput.forget();
    final Ruleset ruleset =
        Ruleset(selectors, rules, strictImports: context.strictImports);
    if (context.dumpLineNumbers?.isNotEmpty ?? false) {
      ruleset.debugInfo = debugInfo;
    }
    return ruleset;
  } else {
    parserInput.restore();
  }
  return null;

// 3.5.0.beta 20180625
//  ruleset: function () {
//      var selectors, rules, debugInfo;
//
//      parserInput.save();
//
//      if (context.dumpLineNumbers) {
//          debugInfo = getDebugInfo(parserInput.i);
//      }
//
//      selectors = this.selectors();
//
//      if (selectors && (rules = this.block())) {
//          parserInput.forget();
//          var ruleset = new(tree.Ruleset)(selectors, rules, context.strictImports);
//          if (context.dumpLineNumbers) {
//              ruleset.debugInfo = debugInfo;
//          }
//          return ruleset;
//      } else {
//          parserInput.restore();
//      }
//  },
}