eco-source 1.1.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/eco/eco.js +8 -0
  2. data/lib/eco/source.rb +9 -0
  3. metadata +72 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Eco Compiler v1.1.0-rc-1
3
+ * http://github.com/sstephenson/eco
4
+ *
5
+ * Copyright (c) 2011 Sam Stephenson
6
+ * Released under the MIT License
7
+ */
8
+ this.eco=function(a){return function b(c){var d,e={id:c,exports:{}};if(d=a[c]){d(e,b,e.exports);return e.exports}throw"Cannot find module '"+c+"'"}}({eco:function(a,b,c){(function(){var c,d,e,f,g;g=b("./compiler"),c=g.compile,e=g.precompile,f=b("./preprocessor").preprocess,a.exports=d=function(a){var b,e;return d.cache?(e=(b=d.cache)[a])!=null?e:b[a]=c(a):c(a)},d.cache={},d.preprocess=f,d.precompile=e,d.compile=c,d.render=function(a,b){return d(a)(b)},b.extensions&&(b.extensions[".eco"]=function(a,c){var d;d=b("fs").readFileSync(c,"utf-8");return a._compile("module.exports = "+e(d),c)})}).call(this)},"./compiler":function(a,b,c){(function(){var a,d,e,f;a=b("coffee-script"),f=b("./preprocessor").preprocess,d=b("./util").indent,c.precompile=e=function(b){var c;c=a.compile(f(b),{noWrap:!0});return"function(__obj) {\n if (!__obj) __obj = {};\n var __out = [], __capture = function(callback) {\n var out = __out, result;\n __out = [];\n callback.call(this);\n result = __out.join('');\n __out = out;\n return __safe(result);\n }, __sanitize = function(value) {\n if (value && value.ecoSafe) {\n return value;\n } else if (typeof value !== 'undefined' && value != null) {\n return __escape(value);\n } else {\n return '';\n }\n }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;\n __safe = __obj.safe = function(value) {\n if (value && value.ecoSafe) {\n return value;\n } else {\n if (!(typeof value !== 'undefined' && value != null)) value = '';\n var result = new String(value);\n result.ecoSafe = true;\n return result;\n }\n };\n if (!__escape) {\n __escape = __obj.escape = function(value) {\n return ('' + value)\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;');\n };\n }\n (function() {\n"+d(c,4)+"\n }).call(__obj);\n __obj.safe = __objSafe, __obj.escape = __escape;\n return __out.join('');\n}"},c.compile=function(a){return(new Function("return "+e(a)))()}}).call(this)},"./preprocessor":function(a,b,c){(function(){var c,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}};d=b("./scanner"),e=b("./util"),a.exports=c=function(){function a(a){this.scanner=new d(a),this.output="",this.level=0,this.options={},this.captures=[]}a.preprocess=function(b){var c;c=new a(b);return c.preprocess()},a.prototype.preprocess=function(){while(!this.scanner.done)this.scanner.scan(f(function(a){return this[a[0]].apply(this,a.slice(1))},this));return this.output},a.prototype.record=function(a){this.output+=e.repeat(" ",this.level);return this.output+=a+"\n"},a.prototype.printString=function(a){if(a.length)return this.record("__out.push "+e.inspectString(a))},a.prototype.beginCode=function(a){return this.options=a},a.prototype.recordCode=function(a){if(a!=="end")return this.options.print?this.options.safe?this.record("__out.push "+a):this.record("__out.push __sanitize "+a):this.record(a)},a.prototype.indent=function(a){this.level++;if(a){this.record("__capture "+a),this.captures.unshift(this.level);return this.indent()}},a.prototype.dedent=function(){this.level--,this.level<0&&this.fail("unexpected dedent");if(this.captures[0]===this.level){this.captures.shift();return this.dedent()}},a.prototype.fail=function(a){throw"Parse error on line "+this.scanner.lineNo+": "+a};return a}()}).call(this)},"./scanner":function(a,b,c){(function(){var c,d,e;d=b("strscan").StringScanner,e=b("./util").trim,a.exports=c=function(){function a(a){this.source=a.replace(/\r\n?/g,"\n"),this.scanner=new d(this.source),this.mode="data",this.buffer="",this.lineNo=1,this.done=!1}a.modePatterns={data:/(.*?)(<%%|<%\s*(\#)|<%(([=-])?)|\n|$)/,code:/(.*?)((((:|(->|=>))\s*))?%>|\n|$)/,comment:/(.*?)(%>|\n|$)/},a.dedentablePattern=/^(end|when|else|catch|finally)(?:\W|$)/,a.scan=function(b){var c,d;d=[],c=new a(b);while(!c.done)c.scan(function(a){return d.push(a)});return d},a.prototype.scan=function(a){if(this.done)return a();if(this.scanner.hasTerminated()){this.done=!0;switch(this.mode){case"data":return a(["printString",this.flush()]);case"code":return a(["fail","unexpected end of template"])}}else{this.advance();switch(this.mode){case"data":return this.scanData(a);case"code":return this.scanCode(a);case"comment":return this.scanComment(a)}}},a.prototype.advance=function(){this.scanner.scanUntil(a.modePatterns[this.mode]),this.buffer+=this.scanner.getCapture(0),this.tail=this.scanner.getCapture(1),this.comment=this.scanner.getCapture(2),this.directive=this.scanner.getCapture(4);return this.arrow=this.scanner.getCapture(5)},a.prototype.scanData=function(a){if(this.tail==="<%%"){this.buffer+="<%";return this.scan(a)}if(this.tail==="\n"){this.buffer+=this.tail,this.lineNo++;return this.scan(a)}if(this.tail){a(["printString",this.flush()]);if(this.comment)return this.mode="comment";this.mode="code";return a(["beginCode",{print:this.directive!=null,safe:this.directive==="-"}])}},a.prototype.scanCode=function(a){var b;if(this.tail==="\n")return a(["fail","unexpected newline in code block"]);if(this.tail){this.mode="data",b=e(this.flush()),this.arrow&&(b+=" "+this.arrow),this.isDedentable(b)&&a(["dedent"]),a(["recordCode",b]);if(this.directive)return a(["indent",this.arrow])}},a.prototype.scanComment=function(a){if(this.tail==="\n")return a(["fail","unexpected newline in code block"]);if(this.tail){this.mode="data";return this.buffer=""}},a.prototype.flush=function(){var a;a=this.buffer,this.buffer="";return a},a.prototype.isDedentable=function(b){return b.match(a.dedentablePattern)};return a}()}).call(this)},"./util":function(a,b,c){(function(){var a,b;c.repeat=a=function(a,b){return Array(b+1).join(a)},c.indent=function(b,c){var d,e,f;f=a(" ",c),e=function(){var a,c,e,g;e=b.split("\n"),g=[];for(a=0,c=e.length;a<c;a++)d=e[a],g.push(f+d);return g}();return e.join("\n")},c.trim=function(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")},b={"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},c.inspectString=function(a){var c;c=a.replace(/[\x00-\x1f\\]/g,function(a){var c;if(a in b)return b[a];c=a.charCodeAt(0).toString(16),c.length===1&&(c="0"+c);return"\\u00"+c});return"'"+c.replace(/'/g,"\\'")+"'"}}).call(this)},strscan:function(a,b,c){(function(){var a;(typeof c!="undefined"&&c!==null?c:this).StringScanner=function(){a=function(a){this.source=a.toString(),this.reset();return this},a.prototype.scan=function(a){var b;return(b=a.exec(this.getRemainder()))&&b.index===0?this.setState(b,{head:this.head+b[0].length,last:this.head}):this.setState([])},a.prototype.scanUntil=function(a){var b;if(b=a.exec(this.getRemainder())){this.setState(b,{head:this.head+b.index+b[0].length,last:this.head});return this.source.slice(this.last,this.head)}return this.setState([])},a.prototype.scanChar=function(){return this.scan(/[\s\S]/)},a.prototype.skip=function(a){if(this.scan(a))return this.match.length},a.prototype.skipUntil=function(a){if(this.scanUntil(a))return this.head-this.last},a.prototype.check=function(a){var b;return(b=a.exec(this.getRemainder()))&&b.index===0?this.setState(b):this.setState([])},a.prototype.checkUntil=function(a){var b;if(b=a.exec(this.getRemainder())){this.setState(b);return this.source.slice(this.head,this.head+b.index+b[0].length)}return this.setState([])},a.prototype.peek=function(a){return this.source.substr(this.head,typeof a!="undefined"&&a!==null?a:1)},a.prototype.getSource=function(){return this.source},a.prototype.getRemainder=function(){return this.source.slice(this.head)},a.prototype.getPosition=function(){return this.head},a.prototype.hasTerminated=function(){return this.head===this.source.length},a.prototype.getPreMatch=function(){if(this.match)return this.source.slice(0,this.head-this.match.length)},a.prototype.getMatch=function(){return this.match},a.prototype.getPostMatch=function(){if(this.match)return this.source.slice(this.head)},a.prototype.getCapture=function(a){return this.captures[a]},a.prototype.reset=function(){return this.setState([],{head:0,last:0})},a.prototype.terminate=function(){return this.setState([],{head:this.source.length,last:this.head})},a.prototype.concat=function(a){return this.source+=a},a.prototype.unscan=function(){if(this.match)return this.setState([],{head:this.last,last:0});throw"nothing to unscan"},a.prototype.setState=function(a,b){var c,d;this.head=typeof (c=typeof b=="undefined"||b===null?undefined:b.head)!="undefined"&&c!==null?c:this.head,this.last=typeof (d=typeof b=="undefined"||b===null?undefined:b.last)!="undefined"&&d!==null?d:this.last,this.captures=a.slice(1);return this.match=a[0]};return a}()})()},"coffee-script":function(a,b,c){if(typeof CoffeeScript!="undefined"&&CoffeeScript!=null)a.exports=CoffeeScript;else throw"Cannot require '"+a.id+"': CoffeeScript not found"}})("eco")
@@ -0,0 +1,9 @@
1
+ module Eco
2
+ module Source
3
+ VERSION = "1.1.0.rc.1"
4
+
5
+ def self.bundled_path
6
+ File.expand_path("../eco.js", __FILE__)
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eco-source
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15424039
5
+ prerelease: 6
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 0
10
+ - rc
11
+ - 1
12
+ version: 1.1.0.rc.1
13
+ platform: ruby
14
+ authors:
15
+ - Sam Stephenson
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2011-06-04 00:00:00 -05:00
21
+ default_executable:
22
+ dependencies: []
23
+
24
+ description: JavaScript source code for the Eco (Embedded CoffeeScript template language) compiler
25
+ email: sstephenson@gmail.com
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files: []
31
+
32
+ files:
33
+ - lib/eco/eco.js
34
+ - lib/eco/source.rb
35
+ has_rdoc: true
36
+ homepage: https://github.com/sstephenson/eco/
37
+ licenses: []
38
+
39
+ post_install_message:
40
+ rdoc_options: []
41
+
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ hash: 3
50
+ segments:
51
+ - 0
52
+ version: "0"
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">"
57
+ - !ruby/object:Gem::Version
58
+ hash: 25
59
+ segments:
60
+ - 1
61
+ - 3
62
+ - 1
63
+ version: 1.3.1
64
+ requirements: []
65
+
66
+ rubyforge_project:
67
+ rubygems_version: 1.5.0
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Eco compiler source
71
+ test_files: []
72
+