module.js 585 B

12345678910111213141516171819202122232425262728293031323334
  1. var _ast = {
  2. initialize: function() {
  3. this._nodes = [];
  4. this._node = {};
  5. this._stash = [];
  6. },
  7. set: function(props) {
  8. for (var k in props) this._node[k] = props[k];
  9. return this._node;
  10. },
  11. node: function(obj) {
  12. if (arguments.length) this._node = obj;
  13. return this._node;
  14. },
  15. push: function() {
  16. this._nodes.push(this._node);
  17. this._node = {};
  18. },
  19. unshift: function() {
  20. this._nodes.unshift(this._node);
  21. this._node = {};
  22. },
  23. yield: function() {
  24. var _nodes = this._nodes;
  25. this.initialize();
  26. return _nodes;
  27. }
  28. };