Permalink
Browse files

CoffeeScript 0.9.2

  • Loading branch information...
jashkenas committed Aug 24, 2010
1 parent bd3471b commit e2c46d14f06803fca308bc185226b273e5c55fd9
View
@@ -6,7 +6,7 @@ require 'yui/compressor'
HEADER = <<-EOS
/**
- * CoffeeScript Compiler v0.9.1
+ * CoffeeScript Compiler v0.9.2
* http://coffeescript.org
*
* Copyright 2010, Jeremy Ashkenas
@@ -1,4 +1,4 @@
###
-CoffeeScript Compiler v0.9.1
+CoffeeScript Compiler v0.9.2
Released under the MIT License
###
@@ -1,8 +1,8 @@
mobyDick = "Call me Ishmael. Some years ago --
-never mind how long precisely -- having little
-or no money in my purse, and nothing particular
-to interest me on shore, I thought I would sail
-about a little and see the watery part of the
-world..."
+ never mind how long precisely -- having little
+ or no money in my purse, and nothing particular
+ to interest me on shore, I thought I would sail
+ about a little and see the watery part of the
+ world..."
@@ -15,7 +15,7 @@ a {
color: #000055;
}
h1, h2, h3, h4, h5, h6 {
- margin-top: 40px;
+ margin-top: 50px;
}
br.clear {
height: 0;
@@ -16,7 +16,7 @@
<span class="k">this</span><span class="p">.</span><span class="nv">exports = </span><span class="k">this</span><span class="p">.</span><span class="nv">CoffeeScript = </span><span class="p">{}</span>
<span class="nv">Lexer = </span><span class="k">this</span><span class="p">.</span><span class="nx">Lexer</span>
<span class="nv">parser = </span><span class="k">this</span><span class="p">.</span><span class="nx">parser</span>
- <span class="nv">helpers = </span><span class="k">this</span><span class="p">.</span><span class="nx">helpers</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-3">#</a> </div> <p>The current CoffeeScript version number.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.VERSION = </span><span class="s1">&#39;0.9.1&#39;</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-4">#</a> </div> <p>Instantiate a Lexer for our use here.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">lexer = </span><span class="k">new</span> <span class="nx">Lexer</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-5">#</a> </div> <p>Compile a string of CoffeeScript code to JavaScript, using the Coffee/Jison
+ <span class="nv">helpers = </span><span class="k">this</span><span class="p">.</span><span class="nx">helpers</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-3">#</a> </div> <p>The current CoffeeScript version number.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.VERSION = </span><span class="s1">&#39;0.9.2&#39;</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-4">#</a> </div> <p>Instantiate a Lexer for our use here.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">lexer = </span><span class="k">new</span> <span class="nx">Lexer</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-5">#</a> </div> <p>Compile a string of CoffeeScript code to JavaScript, using the Coffee/Jison
compiler.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.compile = compile = </span><span class="p">(</span><span class="nx">code</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="o">-&gt;</span>
<span class="nx">options</span> <span class="o">or=</span> <span class="p">{}</span>
<span class="k">try</span>
@@ -45,15 +45,28 @@
<span class="vi">@tokens = </span><span class="nx">tokens</span>
<span class="vi">@pos = </span><span class="mi">0</span>
<span class="nx">upcomingInput</span><span class="o">:</span> <span class="o">-&gt;</span> <span class="s2">&quot;&quot;</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-10">#</a> </div> <p>Activate CoffeeScript in the browser by having it compile and evaluate
-all script tags with a content-type of <code>text/coffeescript</code>. This happens
-on page load. Unfortunately, the text contents of remote scripts cannot be
-accessed from the browser, so only inline script tags will work.</p> </td> <td class="code"> <div class="highlight"><pre><span class="k">if</span> <span class="nb">document</span><span class="o">?</span> <span class="o">and</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByTagName</span>
+all script tags with a content-type of <code>text/coffeescript</code>.
+This happens on page load.</p> </td> <td class="code"> <div class="highlight"><pre><span class="k">if</span> <span class="nb">document</span><span class="o">?</span><span class="p">.</span><span class="nx">getElementsByTagName</span>
+ <span class="nv">grind = </span><span class="p">(</span><span class="nx">coffee</span><span class="p">)</span> <span class="o">-&gt;</span>
+ <span class="nx">setTimeout</span> <span class="nx">exports</span><span class="p">.</span><span class="nx">compile</span> <span class="nx">coffee</span>
+ <span class="nv">grindRemote = </span><span class="p">(</span><span class="nx">url</span><span class="p">)</span> <span class="o">-&gt;</span>
+ <span class="nv">xhr = </span><span class="k">new</span> <span class="p">(</span><span class="nb">window</span><span class="p">.</span><span class="nx">ActiveXObject</span> <span class="o">or</span> <span class="nx">XMLHttpRequest</span><span class="p">)(</span><span class="s1">&#39;Microsoft.XMLHTTP&#39;</span><span class="p">)</span>
+ <span class="nx">xhr</span><span class="p">.</span><span class="nx">open</span> <span class="s1">&#39;GET&#39;</span><span class="p">,</span> <span class="nx">url</span><span class="p">,</span> <span class="kc">true</span>
+ <span class="nx">xhr</span><span class="p">.</span><span class="nx">overrideMimeType</span> <span class="s1">&#39;text/plain&#39;</span> <span class="k">if</span> <span class="s1">&#39;overrideMimeType&#39;</span> <span class="k">of</span> <span class="nx">xhr</span>
+ <span class="nv">xhr.onreadystatechange = </span><span class="o">-&gt;</span>
+ <span class="nx">grind</span> <span class="nx">xhr</span><span class="p">.</span><span class="nx">responseText</span> <span class="k">if</span> <span class="nx">xhr</span><span class="p">.</span><span class="nx">readyState</span> <span class="o">is</span> <span class="mi">4</span>
+ <span class="nx">xhr</span><span class="p">.</span><span class="nx">send</span> <span class="kc">null</span>
<span class="nv">processScripts = </span><span class="o">-&gt;</span>
- <span class="k">for</span> <span class="nx">tag</span> <span class="k">in</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByTagName</span><span class="p">(</span><span class="s1">&#39;script&#39;</span><span class="p">)</span> <span class="k">when</span> <span class="nx">tag</span><span class="p">.</span><span class="nx">type</span> <span class="o">is</span> <span class="s1">&#39;text/coffeescript&#39;</span>
- <span class="nb">eval</span> <span class="nx">exports</span><span class="p">.</span><span class="nx">compile</span> <span class="nx">tag</span><span class="p">.</span><span class="nx">innerHTML</span>
+ <span class="k">for</span> <span class="nx">script</span> <span class="k">in</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByTagName</span> <span class="s1">&#39;script&#39;</span>
+ <span class="k">if</span> <span class="nx">script</span><span class="p">.</span><span class="nx">type</span> <span class="o">is</span> <span class="s1">&#39;text/coffeescript&#39;</span>
+ <span class="k">if</span> <span class="nx">script</span><span class="p">.</span><span class="nx">src</span>
+ <span class="nx">grindRemote</span> <span class="nx">script</span><span class="p">.</span><span class="nx">src</span>
+ <span class="k">else</span>
+ <span class="nx">grind</span> <span class="nx">script</span><span class="p">.</span><span class="nx">innerHTML</span>
+ <span class="kc">null</span>
<span class="k">if</span> <span class="nb">window</span><span class="p">.</span><span class="nx">addEventListener</span>
- <span class="nb">window</span><span class="p">.</span><span class="nx">addEventListener</span> <span class="s1">&#39;load&#39;</span><span class="p">,</span> <span class="nx">processScripts</span><span class="p">,</span> <span class="kc">false</span>
- <span class="k">else</span> <span class="k">if</span> <span class="nb">window</span><span class="p">.</span><span class="nx">attachEvent</span>
- <span class="nb">window</span><span class="p">.</span><span class="nx">attachEvent</span> <span class="s1">&#39;onload&#39;</span><span class="p">,</span> <span class="nx">processScripts</span>
+ <span class="nx">addEventListener</span> <span class="s1">&#39;DOMContentLoaded&#39;</span><span class="p">,</span> <span class="nx">processScripts</span><span class="p">,</span> <span class="kc">false</span>
+ <span class="k">else</span>
+ <span class="nx">attachEvent</span> <span class="s1">&#39;onload&#39;</span><span class="p">,</span> <span class="nx">processScripts</span>
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
Oops, something went wrong.

0 comments on commit e2c46d1

Please sign in to comment.