src/compile/literal.js
function(literal) {

      var ret = [];

      if (literal.isRange) {

        var begin = literal.value[0];
        if (begin.type === 'references') {
          begin = this.getReferences(begin);
        }

        var end = literal.value[1];
        if (end.type === 'references') {
          end = this.getReferences(end);
        }

        end   = parseInt(end, 10);
        begin = parseInt(begin, 10);

        var i;

        if (!isNaN(begin) && !isNaN(end)) {

          if (begin < end) {
            for (i = begin; i <= end; i++) ret.push(i);
          } else {
            for (i = begin; i >= end; i--) ret.push(i);
          }
        }

      } else {
        utils.forEach(literal.value, function(exp) {
          ret.push(this.getLiteral(exp));
        }, this);
      }

      return ret;
    }
function(literal) {

      var ret = [];

      if (literal.isRange) {

        var begin = literal.value[0];
        if (begin.type === 'references') {
          begin = this.getReferences(begin);
        }

        var end = literal.value[1];
        if (end.type === 'references') {
          end = this.getReferences(end);
        }

        end   = parseInt(end, 10);
        begin = parseInt(begin, 10);

        var i;

        if (!isNaN(begin) && !isNaN(end)) {

          if (begin < end) {
            for (i = begin; i <= end; i++) ret.push(i);
          } else {
            for (i = begin; i >= end; i--) ret.push(i);
          }
        }

      } else {
        utils.forEach(literal.value, function(exp) {
          ret.push(this.getLiteral(exp));
        }, this);
      }

      return ret;
    }
function ( literal ) { var ret = [ ] ; if ( literal . isRange ) { var begin = literal . value [ 0 ] ; if ( begin . type === 'references' ) { begin = this . getReferences ( begin ) ; } var end = literal . value [ 1 ] ; if ( end . type === 'references' ) { end = this . getReferences ( end ) ; } end = parseInt ( end , 10 ) ; begin = parseInt ( begin , 10 ) ; var i ; if ( ! isNaN ( begin ) && ! isNaN ( end ) ) { if ( begin < end ) { for ( i = begin ; i <= end ; i ++ ) ret . push ( i ) ; } else { for ( i = begin ; i >= end ; i -- ) ret . push ( i ) ; } } } else { utils . forEach ( literal . value , function ( exp ) { ret . push ( this . getLiteral ( exp ) ) ; } , this ) ; } return ret ; }
对array字面量求值，比如[1, 2]=> [1,2]，[1..5] => [1,2,3,4,5]
@param literal {object} array字面量的描述对象，分为普通数组和range数组两种
，和js基本一致
@return {array} 求值得到的数组
对array字面量求值，比如 [ 1 2 ] = > [ 1 2 ] ， [ 1 .. 5 ] = > [ 1 2 3 4 5 ]