Text-Sass-XS

 view release on metacpan or  search on metacpan

libsass/old/ast_node.hpp  view on Meta::CPAN

    bool               is_root;
    // needed for properly formatted CSS emission
    bool               has_hoistable;
    bool               has_non_hoistable;

    Block(string p, size_t l, size_t size = 0, bool root = false)
    : Statement(p, l), statements(vector<Statement*>()), is_root(root)
    { statements.reserve(size); }

    size_t length() const
    { return statements.size(); }
    Statement*& operator[](size_t i)
    { return statements[i]; }
    Block& operator<<(Statement* s)
    {
      statements.push_back(s);
      if (s->hoistable()) has_hoistable     = true;
      else                has_non_hoistable = true;
      return *this;
    }
    Block& operator+=(Block* b)
    {
      for (size_t i = 0, L = b->length(); i < L; ++i) *this << (*b)[i];
      return *this;
    }
    ATTACH_OPERATIONS();
  };

  ////////////////////////////////////////////////////////////////////////
  // Abstract base class for statements that contain blocks of statements.
  ////////////////////////////////////////////////////////////////////////
  struct Has_Block : public Statement {
    Block* block;
    Has_Block(string p, size_t l, Block* b)
    : Statement(p, l), block(b)
    { }
    virtual ~Has_Block() = 0;
  };
  inline Has_Block::~Has_Block() { }

  /////////////////////////////////////////////////////////////////////////////
  // Rulesets (i.e., sets of styles headed by a selector and containing a block
  // of style declarations.
  /////////////////////////////////////////////////////////////////////////////
  struct Selector;
  struct Ruleset : public Has_Block {
    Selector* selector;

    Ruleset(string p, size_t l, Selector* s, Block* b)
    : Has_Block(p, l, b), selector(s)
    { }
    // nested rulesets need to be hoisted out of their enclosing blocks
    bool hoistable() { return true; }
    ATTACH_OPERATIONS();
  };

  /////////////////////////////////////////////////////////
  // Nested declaration sets (i.e., namespaced properties).
  /////////////////////////////////////////////////////////
  struct String;
  struct Propset : public Has_Block {
    String* property_fragment;

    Propset(string p, size_t l, String* pf, Block* b)
    : Has_Block(p, l, b), property_fragment(pf)
    { }
    ATTACH_OPERATIONS();
  };

  /////////////////
  // Media queries.
  /////////////////
  struct List;
  struct Media_Query : public Has_Block {
    List* query_list;

    Media_Query(string p, size_t l, List* q, Block* b)
    : Has_Block(p, l, b), query_list(q)
    { }
    ATTACH_OPERATIONS();
  };

  /////////////////////////////////////////////////////////////////////////////
  // Directives -- arbitrary rules beginning with "@" that may have an optional
  // statement block.
  /////////////////////////////////////////////////////////////////////////////
  struct Directive : public Has_Block {
    string    keyword;
    Selector* selector;

    Directive(string p, size_t l,
              string kwd, Selector* sel, Block* b)
    : Has_Block(p, l, b), keyword(kwd), selector(sel)
    { }
    ATTACH_OPERATIONS();
  };

  ////////////////////////////////////////////////////////////////////////
  // Declarations -- style rules consisting of a property name and values.
  ////////////////////////////////////////////////////////////////////////
  struct Declaration : public Statement {
    String* property;
    List*   values;

    Declaration(string p, size_t l, String* prop, List* vals)
    : Statement(p, l), property(prop), values(vals)
    { }
    ATTACH_OPERATIONS();
  };

  /////////////////////////////////////
  // Assignments -- variable and value.
  /////////////////////////////////////
  struct Variable;
  struct Expression;
  struct Assignment : public Statement {
    string variable;
    Expression* value;
    bool   is_guarded;

    Assignment(string p, size_t l,
               string var, Expression* val, bool guarded = false)
    : Statement(p, l), variable(var), value(val), is_guarded(guarded)
    { }



( run in 1.223 second using v1.01-cache-2.11-cpan-71847e10f99 )