/// <summary>Initializes a new instance of the RulesetNode class</summary> /// <param name="selectorsGroupNode">Selectors group node.</param> /// <param name="declarations">The list of declarations.</param> public RulesetNode(SelectorsGroupNode selectorsGroupNode, ReadOnlyCollection <DeclarationNode> declarations, ReadOnlyCollection <ImportantCommentNode> importantComments) { Contract.Requires(selectorsGroupNode != null); // Member Initialization this.SelectorsGroupNode = selectorsGroupNode; this.Declarations = declarations ?? new List <DeclarationNode>(0).AsReadOnly(); this.ImportantComments = importantComments ?? new List <ImportantCommentNode>(0).AsReadOnly(); }
/// <summary>The <see cref="SelectorsGroupNode"/> visit implementation</summary> /// <param name="selectorsGroupNode">The selectors group node.</param> /// <returns>The modified AST node if modified otherwise the original node</returns> public override AstNode VisitSelectorsGroupNode(SelectorsGroupNode selectorsGroupNode) { // selectors_group // : selector [ COMMA S* selector ]* // ; selectorsGroupNode.SelectorNodes.ForEach((selector, last) => { selector.Accept(this); if (!last) { _printerFormatter.AppendLine(CssConstants.Comma); } }); // End the selector with a line _printerFormatter.AppendLine(); return(selectorsGroupNode); }
/// <summary>The <see cref="SelectorsGroupNode"/> visit implementation</summary> /// <param name="selectorsGroupNode">The selectors group node.</param> /// <returns>The modified AST node if modified otherwise the original node</returns> public virtual AstNode VisitSelectorsGroupNode(SelectorsGroupNode selectorsGroupNode) { return(selectorsGroupNode); }
/// <summary>The <see cref="SelectorsGroupNode"/> visit implementation</summary> /// <param name="selectorsGroupNode">The selectors group node.</param> /// <returns>The modified AST node if modified otherwise the original node</returns> public override AstNode VisitSelectorsGroupNode(SelectorsGroupNode selectorsGroupNode) { return(new SelectorsGroupNode(selectorsGroupNode.SelectorNodes.Select(selectorNode => (SelectorNode)selectorNode.Accept(this)).ToSafeReadOnlyCollection())); }