text: // Generated by CoffeeScript 1.9.1
  (function() {
    var Dimensions, FS, GR, VL, Values;
  
    GR = require("../../syntax/gr_nodes");
  
    VL = require("./vl_nodes");
  
    FS = require("../fs_nodes");
  
    Dimensions = require("./dimensions");
  
    Values = exports;
  
    Values.primitiveTypes = {
      ident: new GR.Ident(function(x) {
        return new VL.Keyword(x.value);
      }),
      number: new GR.Number(function(x) {
        return new VL.Number(x.value);
      }),
      integer: new GR.Integer(function(x) {
        return new VL.Number(x.value);
      }),
      percentage: new GR.Percentage(function(x) {
        return new VL.Percentage(x.value);
      }),
      string: new GR.String(function(x) {
        return new VL.String(x.value);
      }),
      url: new GR.Url(function(x) {
        return new VL.Url(x.value);
      }),
      color: new GR.Hash(function(x) {
        var b, g, r, v;
        v = x.value;
        if (/^[0-9a-fA-F]{3,6}$/.exec(v)) {
          if (v.length === 3) {
            return new VL.Color({
              r: new VL.Number(parseInt((r = v.charAt(0)) + r, 16)),
              g: new VL.Number(parseInt((g = v.charAt(1)) + g, 16)),
              b: new VL.Number(parseInt((b = v.charAt(2)) + b, 16))
            });
          } else if (v.length === 6) {
            return new VL.Color({
              r: new VL.Number(parseInt(v.substr(0, 2), 16)),
              g: new VL.Number(parseInt(v.substr(2, 2), 16)),
              b: new VL.Number(parseInt(v.substr(4, 2), 16))
            });
          } else {
            throw new Error("Internal error in FuncSS");
          }
        } else {
          throw new ER.InvalidColor("#" + v);
        }
      }),
      length: Dimensions.metrics.length.grammar(),
      time: Dimensions.metrics.time.grammar(),
      angle: Dimensions.metrics.angle.grammar(),
      frequency: Dimensions.metrics.frequency.grammar(),
      resolution: Dimensions.metrics.resolution.grammar()
    };
  
    exports.primitiveTypes.ident.decodejs = function(x) {
      return "''+" + x;
    };
  
    exports.primitiveTypes.number.decodejs = function(x) {
      return "+" + x;
    };
  
    exports.primitiveTypes.integer.decodejs = function(x) {
      return "Math.round(" + x + ")";
    };
  
    exports.primitiveTypes.percentage.decodejs = function(x) {
      return x + "*100 + '%'";
    };
  
    exports.primitiveTypes.string.decodejs = function(x) {
      return "JSON.stringify(''+" + x + ")";
    };
  
    exports.primitiveTypes.color.decodejs = function(x) {
      return "(function(){\n  var c=" + x + ";\n  return (c.a || c.a === 0) ? \n    'rgba('+Math.round(c.r)+','+Math.round(c.g)+','+Math.round(c.b)+','+Math.round(c.a)+')' :\n     'rgb('+Math.round(c.r)+','+Math.round(c.g)+','+Math.round(c.b)+')'\n})()";
    };
  
  }).call(this);
  