UNPKG

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